From 35d8edd15e665878627915c4c37c80710b0fc9cf Mon Sep 17 00:00:00 2001 From: Tim203 Date: Wed, 29 Jul 2020 12:53:00 +0200 Subject: [PATCH 001/766] Floodgate 2.0 update --- .../geysermc/floodgate/util/BedrockData.java | 67 +++++++++++----- .../util/{DeviceOS.java => DeviceOs.java} | 22 ++++-- .../floodgate/util/EncryptionUtil.java | 6 +- .../geysermc/floodgate/util/InputMode.java | 49 ++++++++++++ .../geysermc/floodgate/util/LinkedPlayer.java | 76 +++++++++++++++++++ .../geysermc/floodgate/util/UiProfile.java | 46 +++++++++++ .../network/session/GeyserSession.java | 1 + .../session/auth/BedrockClientData.java | 26 ++----- 8 files changed, 244 insertions(+), 49 deletions(-) rename common/src/main/java/org/geysermc/floodgate/util/{DeviceOS.java => DeviceOs.java} (79%) create mode 100644 common/src/main/java/org/geysermc/floodgate/util/InputMode.java create mode 100644 common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java create mode 100644 common/src/main/java/org/geysermc/floodgate/util/UiProfile.java diff --git a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java index dc895a79d..44544291d 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java +++ b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java @@ -1,36 +1,53 @@ package org.geysermc.floodgate.util; +import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; -import java.util.UUID; - -@AllArgsConstructor +/** + * This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. + * This class is only used internally, and you should look at FloodgatePlayer instead + * (FloodgatePlayer is present in the common module in the Floodgate repo) + */ +@AllArgsConstructor(access = AccessLevel.PRIVATE) @Getter -public class BedrockData { - public static final int EXPECTED_LENGTH = 7; +public final class BedrockData { + public static final int EXPECTED_LENGTH = 9; public static final String FLOODGATE_IDENTIFIER = "Geyser-Floodgate"; - private String version; - private String username; - private String xuid; - private int deviceId; - private String languageCode; - private int inputMode; - private String ip; - private int dataLength; + private final String version; + private final String username; + private final String xuid; + private final int deviceOs; + private final String languageCode; + private final int uiProfile; + private final int inputMode; + private final String ip; + private final LinkedPlayer linkedPlayer; + private final int dataLength; - public BedrockData(String version, String username, String xuid, int deviceId, String languageCode, int inputMode, String ip) { - this(version, username, xuid, deviceId, languageCode, inputMode, ip, EXPECTED_LENGTH); + public BedrockData(String version, String username, String xuid, int deviceOs, + String languageCode, int uiProfile, int inputMode, String ip, + LinkedPlayer linkedPlayer) { + this(version, username, xuid, deviceOs, languageCode, + inputMode, uiProfile, ip, linkedPlayer, EXPECTED_LENGTH); + } + + public BedrockData(String version, String username, String xuid, int deviceOs, + String languageCode, int uiProfile, int inputMode, String ip) { + this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null); } public static BedrockData fromString(String data) { String[] split = data.split("\0"); - if (split.length != EXPECTED_LENGTH) return null; + if (split.length != EXPECTED_LENGTH) return emptyData(split.length); + LinkedPlayer linkedPlayer = LinkedPlayer.fromString(split[8]); + // The format is the same as the order of the fields in this class return new BedrockData( - split[0], split[1], split[2], Integer.parseInt(split[3]), - split[4], Integer.parseInt(split[5]), split[6], split.length + split[0], split[1], split[2], Integer.parseInt(split[3]), split[4], + Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], + linkedPlayer, split.length ); } @@ -40,7 +57,17 @@ public class BedrockData { @Override public String toString() { - return version +'\0'+ username +'\0'+ xuid +'\0'+ deviceId +'\0'+ languageCode +'\0'+ - inputMode +'\0'+ ip; + // The format is the same as the order of the fields in this class + return version + '\0' + username + '\0' + xuid + '\0' + deviceOs + '\0' + + languageCode + '\0' + uiProfile + '\0' + inputMode + '\0' + ip + '\0' + + (linkedPlayer != null ? linkedPlayer.toString() : "null"); + } + + public boolean hasPlayerLink() { + return linkedPlayer != null; + } + + private static BedrockData emptyData(int dataLength) { + return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/DeviceOS.java b/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java similarity index 79% rename from common/src/main/java/org/geysermc/floodgate/util/DeviceOS.java rename to common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java index 93d3c121e..da783982c 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/DeviceOS.java +++ b/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java @@ -26,9 +26,14 @@ package org.geysermc.floodgate.util; import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; -public enum DeviceOS { - +/** + * The Operation Systems where Bedrock players can connect with + */ +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum DeviceOs { @JsonEnumDefaultValue UNKNOWN("Unknown"), ANDROID("Android"), @@ -46,15 +51,16 @@ public enum DeviceOS { XBOX_ONE("Xbox One"), WIN_PHONE("Windows Phone"); - private static final DeviceOS[] VALUES = values(); + private static final DeviceOs[] VALUES = values(); private final String displayName; - DeviceOS(final String displayName) { - this.displayName = displayName; - } - - public static DeviceOS getById(int id) { + /** + * Get the DeviceOs instance from the identifier. + * @param id the DeviceOs identifier + * @return The DeviceOs or {@link #UNKNOWN} if the DeviceOs wasn't found + */ + public static DeviceOs getById(int id) { return id < VALUES.length ? VALUES[id] : VALUES[0]; } diff --git a/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java b/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java index 881d01ba9..619c7011a 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java +++ b/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java @@ -12,7 +12,11 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Base64; -public class EncryptionUtil { +/** + * The class which contains all the encryption and decryption method used in Geyser and Floodgate + * (for Floodgate data). This is only used internally and doesn't serve a purpose for anything else + */ +public final class EncryptionUtil { public static String encrypt(Key key, String data) throws IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { KeyGenerator generator = KeyGenerator.getInstance("AES"); diff --git a/common/src/main/java/org/geysermc/floodgate/util/InputMode.java b/common/src/main/java/org/geysermc/floodgate/util/InputMode.java new file mode 100644 index 000000000..4dcaa8ab3 --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/util/InputMode.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.util; + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; + +public enum InputMode { + @JsonEnumDefaultValue + UNKNOWN, + KEYBOARD_MOUSE, + TOUCH, // I guess Touch? + CONTROLLER, + VR; + + private static final InputMode[] VALUES = values(); + + /** + * Get the InputMode instance from the identifier. + * @param id the InputMode identifier + * @return The InputMode or {@link #UNKNOWN} if the DeviceOs wasn't found + */ + public static InputMode getById(int id) { + return VALUES.length > id ? VALUES[id] : VALUES[0]; + } +} \ No newline at end of file diff --git a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java new file mode 100644 index 000000000..a930b013a --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.util; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; + +import java.util.UUID; + +@Getter +public final class LinkedPlayer { + /** + * The Java username of the linked player + */ + private final String javaUsername; + /** + * The Java UUID of the linked player + */ + private final UUID javaUniqueId; + /** + * The UUID of the Bedrock player + */ + private final UUID bedrockId; + /** + * If the LinkedPlayer is send from a different platform. + * For example the LinkedPlayer is from Bungee but the data has been sent to the Bukkit server. + */ + @Setter(AccessLevel.PRIVATE) + private boolean fromDifferentPlatform = false; + + public LinkedPlayer(String javaUsername, UUID javaUniqueId, UUID bedrockId) { + this.javaUsername = javaUsername; + this.javaUniqueId = javaUniqueId; + this.bedrockId = bedrockId; + } + + static LinkedPlayer fromString(String data) { + if (data.length() == 4) return null; + String[] split = data.split(";"); + LinkedPlayer player = new LinkedPlayer( + split[0], UUID.fromString(split[1]), UUID.fromString(split[2]) + ); + player.setFromDifferentPlatform(true); + return player; + } + + @Override + public String toString() { + return javaUsername + ';' + javaUniqueId.toString() + ';' + bedrockId.toString(); + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java b/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java new file mode 100644 index 000000000..441e9202a --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.util; + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; + +public enum UiProfile { + @JsonEnumDefaultValue + CLASSIC, + POCKET; + + private static final UiProfile[] VALUES = values(); + + /** + * Get the UiProfile instance from the identifier. + * @param id the UiProfile identifier + * @return The UiProfile or {@link #CLASSIC} if the UiProfile wasn't found + */ + public static UiProfile getById(int id) { + return VALUES.length > id ? VALUES[id] : VALUES[0]; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index b861f64c4..623bf16a9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -327,6 +327,7 @@ public class GeyserSession implements CommandSender { authData.getXboxUUID(), clientData.getDeviceOS().ordinal(), clientData.getLanguageCode(), + clientData.getUiProfile().ordinal(), clientData.getCurrentInputMode().ordinal(), upstream.getSession().getAddress().getAddress().getHostAddress() )); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java index 6aeebbaa3..fe8c769e9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java @@ -1,16 +1,17 @@ package org.geysermc.connector.network.session.auth; -import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; -import org.geysermc.floodgate.util.DeviceOS; +import org.geysermc.floodgate.util.DeviceOs; +import org.geysermc.floodgate.util.InputMode; +import org.geysermc.floodgate.util.UiProfile; import java.util.UUID; @JsonIgnoreProperties(ignoreUnknown = true) @Getter -public class BedrockClientData { +public final class BedrockClientData { @JsonProperty(value = "GameVersion") private String gameVersion; @JsonProperty(value = "ServerAddress") @@ -52,9 +53,9 @@ public class BedrockClientData { @JsonProperty(value = "DeviceModel") private String deviceModel; @JsonProperty(value = "DeviceOS") - private DeviceOS deviceOS; + private DeviceOs deviceOS; @JsonProperty(value = "UIProfile") - private UIProfile uiProfile; + private UiProfile uiProfile; @JsonProperty(value = "GuiScale") private int guiScale; @JsonProperty(value = "CurrentInputMode") @@ -78,19 +79,4 @@ public class BedrockClientData { private String skinColor; @JsonProperty(value = "ThirdPartyNameOnly") private boolean thirdPartyNameOnly; - - public enum UIProfile { - @JsonEnumDefaultValue - CLASSIC, - POCKET - } - - public enum InputMode { - @JsonEnumDefaultValue - UNKNOWN, - KEYBOARD_MOUSE, - TOUCH, // I guess Touch? - CONTROLLER, - VR - } } From d37113388ba649ecb0b9941c040fa94bb1ce6e1f Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Tue, 18 Aug 2020 11:39:29 -0400 Subject: [PATCH 002/766] Update to 1.16.2 --- .../src/main/java/org/geysermc/connector/dump/DumpInfo.java | 6 +++--- .../java/org/geysermc/connector/entity/FireworkEntity.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index 9d91cde6b..5aed562ec 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.BedrockProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.FileUtils; -import org.geysermc.floodgate.util.DeviceOS; +import org.geysermc.floodgate.util.DeviceOs; import java.io.IOException; import java.net.InetAddress; @@ -54,7 +54,7 @@ public class DumpInfo { private final DumpInfo.VersionInfo versionInfo; private Properties gitInfo; private final GeyserConfiguration config; - private Object2IntMap userPlatforms; + private Object2IntMap userPlatforms; private RamInfo ramInfo; private final BootstrapDumpInfo bootstrapInfo; @@ -72,7 +72,7 @@ public class DumpInfo { this.userPlatforms = new Object2IntOpenHashMap(); for (GeyserSession session : GeyserConnector.getInstance().getPlayers()) { - DeviceOS device = session.getClientData().getDeviceOS(); + DeviceOs device = session.getClientData().getDeviceOS(); userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java index b940b87b9..3ca170436 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java @@ -40,7 +40,7 @@ import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.FireworkColor; import org.geysermc.connector.utils.MathUtils; -import org.geysermc.floodgate.util.DeviceOS; +import org.geysermc.floodgate.util.DeviceOs; import java.util.ArrayList; import java.util.List; @@ -67,7 +67,7 @@ public class FireworkEntity extends Entity { // TODO: Remove once Mojang fixes bugs with fireworks crashing clients on these specific devices. // https://bugs.mojang.com/browse/MCPE-89115 - if (session.getClientData().getDeviceOS() == DeviceOS.XBOX_ONE || session.getClientData().getDeviceOS() == DeviceOS.ORBIS) { + if (session.getClientData().getDeviceOS() == DeviceOs.XBOX_ONE || session.getClientData().getDeviceOS() == DeviceOs.ORBIS) { return; } From ec87344a772254e04e381cc313789f6b142d6594 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Wed, 19 Aug 2020 23:13:05 -0400 Subject: [PATCH 003/766] Initial skin support --- .../spigot/GeyserSpigotConfiguration.java | 2 +- .../platform/spigot/GeyserSpigotPlugin.java | 2 +- .../geysermc/floodgate/util/BedrockData.java | 20 ++++--- .../floodgate/util/EncryptionUtil.java | 11 +++- .../org/geysermc/floodgate/util/RawSkin.java | 56 +++++++++++++++++++ .../network/session/GeyserSession.java | 3 +- .../session/auth/BedrockClientData.java | 47 ++++++++++++++++ .../connector/utils/LoginEncryptionUtils.java | 4 +- 8 files changed, 129 insertions(+), 16 deletions(-) create mode 100644 common/src/main/java/org/geysermc/floodgate/util/RawSkin.java diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java index 380f70376..8667a692b 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java @@ -48,7 +48,7 @@ public class GeyserSpigotConfiguration extends GeyserJacksonConfiguration { private Path floodgateKey; public void loadFloodgate(GeyserSpigotPlugin plugin) { - Plugin floodgate = Bukkit.getPluginManager().getPlugin("floodgate-bukkit"); + Plugin floodgate = Bukkit.getPluginManager().getPlugin("floodgate-spigot"); floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(plugin.getDataFolder().toString(), plugin.getConfig().getString("floodgate-key-file", "public-key.pem")), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null); } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index 496681d33..b0cc5e6c3 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -93,7 +93,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { this.geyserLogger = new GeyserSpigotLogger(getLogger(), geyserConfig.isDebugMode()); GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger); - if (geyserConfig.getRemote().getAuthType().equals("floodgate") && Bukkit.getPluginManager().getPlugin("floodgate-bukkit") == null) { + if (geyserConfig.getRemote().getAuthType().equals("floodgate") && Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); this.getPluginLoader().disablePlugin(this); return; diff --git a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java index 3d80c0f9b..1f1b3bc88 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java +++ b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java @@ -51,19 +51,21 @@ public final class BedrockData { private final LinkedPlayer linkedPlayer; private final int dataLength; + private RawSkin skin; + public BedrockData(String version, String username, String xuid, int deviceOs, String languageCode, int uiProfile, int inputMode, String ip, - LinkedPlayer linkedPlayer) { + LinkedPlayer linkedPlayer, RawSkin skin) { this(version, username, xuid, deviceOs, languageCode, - inputMode, uiProfile, ip, linkedPlayer, EXPECTED_LENGTH); + inputMode, uiProfile, ip, linkedPlayer, EXPECTED_LENGTH, skin); } public BedrockData(String version, String username, String xuid, int deviceOs, - String languageCode, int uiProfile, int inputMode, String ip) { - this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null); + String languageCode, int uiProfile, int inputMode, String ip, RawSkin skin) { + this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null, skin); } - public static BedrockData fromString(String data) { + public static BedrockData fromString(String data, String skin) { String[] split = data.split("\0"); if (split.length != EXPECTED_LENGTH) return emptyData(split.length); @@ -72,12 +74,12 @@ public final class BedrockData { return new BedrockData( split[0], split[1], split[2], Integer.parseInt(split[3]), split[4], Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], - linkedPlayer, split.length + linkedPlayer, split.length, RawSkin.parse(skin) ); } - public static BedrockData fromRawData(byte[] data) { - return fromString(new String(data)); + public static BedrockData fromRawData(byte[] data, String skin) { + return fromString(new String(data), skin); } @Override @@ -93,6 +95,6 @@ public final class BedrockData { } private static BedrockData emptyData(int dataLength) { - return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength); + return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength, null); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java b/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java index ccad8d1c2..2f3048bd9 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java +++ b/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java @@ -58,9 +58,14 @@ public final class EncryptionUtil { Base64.getEncoder().encodeToString(encryptedText); } + public static String encryptBedrockData(Key key, BedrockData data, boolean includeSkin) throws IllegalBlockSizeException, + InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { + return encrypt(key, data.toString()) + (includeSkin ? data.getSkin() : ""); + } + public static String encryptBedrockData(Key key, BedrockData data) throws IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { - return encrypt(key, data.toString()); + return encryptBedrockData(key, data, true); } public static byte[] decrypt(Key key, String encryptedData) throws IllegalBlockSizeException, @@ -80,9 +85,9 @@ public final class EncryptionUtil { return cipher.doFinal(Base64.getDecoder().decode(split[1])); } - public static BedrockData decryptBedrockData(Key key, String encryptedData) throws IllegalBlockSizeException, + public static BedrockData decryptBedrockData(Key key, String encryptedData, String skin) throws IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { - return BedrockData.fromRawData(decrypt(key, encryptedData)); + return BedrockData.fromRawData(decrypt(key, encryptedData), skin); } @SuppressWarnings("unchecked") diff --git a/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java b/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java new file mode 100644 index 000000000..ba22b632a --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.util; + +import lombok.AllArgsConstructor; + +import java.nio.charset.StandardCharsets; + +@AllArgsConstructor +public class RawSkin { + public int width; + public int height; + public byte[] data; + + private RawSkin() {} + + public static RawSkin parse(String data) { + if (data == null) return null; + String[] split = data.split(":"); + if (split.length != 3) return null; + + RawSkin skin = new RawSkin(); + skin.width = Integer.parseInt(split[0]); + skin.height = Integer.parseInt(split[1]); + skin.data = split[2].getBytes(StandardCharsets.UTF_8); + return skin; + } + + @Override + public String toString() { + return Integer.toString(width) + ':' + height + ':' + new String(data); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 06c669c9d..e53dd03aa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -371,7 +371,8 @@ public class GeyserSession implements CommandSender { clientData.getLanguageCode(), clientData.getUiProfile().ordinal(), clientData.getCurrentInputMode().ordinal(), - upstream.getSession().getAddress().getAddress().getHostAddress() + upstream.getSession().getAddress().getAddress().getHostAddress(), + clientData.getImage("Skin") )); } catch (Exception e) { connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java index ad1fb2fb1..2a3e174ed 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java @@ -25,18 +25,25 @@ package org.geysermc.connector.network.session.auth; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; +import net.minidev.json.JSONObject; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.InputMode; +import org.geysermc.floodgate.util.RawSkin; import org.geysermc.floodgate.util.UiProfile; +import java.util.Base64; import java.util.UUID; @JsonIgnoreProperties(ignoreUnknown = true) @Getter public final class BedrockClientData { + @JsonIgnore + private JSONObject jsonData; + @JsonProperty(value = "GameVersion") private String gameVersion; @JsonProperty(value = "ServerAddress") @@ -104,4 +111,44 @@ public final class BedrockClientData { private String skinColor; @JsonProperty(value = "ThirdPartyNameOnly") private boolean thirdPartyNameOnly; + + public void setJsonData(JSONObject data) { + if (this.jsonData != null && data != null) { + this.jsonData = data; + } + } + + /** + * Taken from https://github.com/NukkitX/Nukkit/blob/master/src/main/java/cn/nukkit/network/protocol/LoginPacket.java
+ * Internally only used for Skins, but can be used for Capes too + */ + public RawSkin getImage(String name) { + if (jsonData == null || !jsonData.containsKey(name + "Data")) return null; + byte[] image = Base64.getDecoder().decode(jsonData.getAsString(name + "Data")); + if (jsonData.containsKey(name + "ImageWidth") && jsonData.containsKey(name + "ImageHeight")) { + return new RawSkin( + (int) jsonData.getAsNumber(name + "ImageWidth"), + (int) jsonData.get(name + "ImageHeight"), + image + ); + } + return getLegacyImage(image); + } + + private static RawSkin getLegacyImage(byte[] imageData) { + if (imageData == null) return null; + // width * height * 4 (rgba) + switch (imageData.length) { + case 8192: + return new RawSkin(64, 32, imageData); + case 16384: + return new RawSkin(64, 64, imageData); + case 32768: + return new RawSkin(64, 128, imageData); + case 65536: + return new RawSkin(128, 128, imageData); + default: + throw new IllegalArgumentException("Unknown legacy skin size"); + } + } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index 4bc997bdf..7e4989d6e 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -131,7 +131,9 @@ public class LoginEncryptionUtils { JWSObject clientJwt = JWSObject.parse(clientData); EncryptionUtils.verifyJwt(clientJwt, identityPublicKey); - session.setClientData(JSON_MAPPER.convertValue(JSON_MAPPER.readTree(clientJwt.getPayload().toBytes()), BedrockClientData.class)); + BedrockClientData data = JSON_MAPPER.convertValue(JSON_MAPPER.readTree(clientJwt.getPayload().toBytes()), BedrockClientData.class); + data.setJsonData(clientJwt.getPayload().toJSONObject()); + session.setClientData(data); if (EncryptionUtils.canUseEncryption()) { LoginEncryptionUtils.startEncryptionHandshake(session, identityPublicKey); From 29977605213682fd672449def0829e9246ebcb04 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 12 Sep 2020 15:29:18 +0200 Subject: [PATCH 004/766] Switch Floodgate encryption from RSA to AES --- .../geysermc/floodgate/crypto/AesCipher.java | 95 ++++++++++ .../floodgate/crypto/AesKeyProducer.java | 56 ++++++ .../floodgate/crypto/FloodgateCipher.java | 165 ++++++++++++++++++ .../floodgate/crypto/KeyProducer.java | 41 +++++ .../geysermc/floodgate/util/BedrockData.java | 19 +- .../floodgate/util/EncryptionUtil.java | 80 --------- .../util/InvalidHeaderException.java | 41 +++++ .../geysermc/floodgate/util/LinkedPlayer.java | 10 +- .../geysermc/connector/GeyserConnector.java | 19 +- .../network/session/GeyserSession.java | 43 ++--- 10 files changed, 445 insertions(+), 124 deletions(-) create mode 100644 common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java create mode 100644 common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java create mode 100644 common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java create mode 100644 common/src/main/java/org/geysermc/floodgate/crypto/KeyProducer.java delete mode 100644 common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java create mode 100644 common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java new file mode 100644 index 000000000..3e6fef01a --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2019-2020 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/Floodgate + * + */ + +package org.geysermc.floodgate.crypto; + +import org.geysermc.floodgate.util.InvalidHeaderException; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; +import java.nio.ByteBuffer; +import java.security.Key; +import java.security.SecureRandom; + +public final class AesCipher implements FloodgateCipher { + private static final int IV_LENGTH = 12; + private static final int TAG_BIT_LENGTH = 128; + private static final String CIPHER_NAME = "AES/GCM/NoPadding"; + + private final SecureRandom secureRandom = new SecureRandom(); + private SecretKey secretKey; + + public void init(Key key) { + if (!"AES".equals(key.getAlgorithm())) { + throw new RuntimeException( + "Algorithm was expected to be AES, but got " + key.getAlgorithm() + ); + } + secretKey = (SecretKey) key; + } + + public byte[] encrypt(byte[] data) throws Exception { + Cipher cipher = Cipher.getInstance(CIPHER_NAME); + + byte[] iv = new byte[IV_LENGTH]; + secureRandom.nextBytes(iv); + + GCMParameterSpec spec = new GCMParameterSpec(TAG_BIT_LENGTH, iv); + cipher.init(Cipher.ENCRYPT_MODE, secretKey, spec); + byte[] cipherText = cipher.doFinal(data); + + return ByteBuffer.allocate(iv.length + cipherText.length + HEADER_LENGTH) + .put(IDENTIFIER).put(VERSION) // header + .put(iv) + .put(cipherText) + .array(); + } + + public byte[] decrypt(byte[] cipherTextWithIv) throws Exception { + HeaderResult pair = checkHeader(cipherTextWithIv); + if (pair.getVersion() != VERSION) { + throw new InvalidHeaderException( + "Expected version " + VERSION + ", got " + pair.getVersion() + ); + } + + Cipher cipher = Cipher.getInstance(CIPHER_NAME); + + int bufferLength = cipherTextWithIv.length - HEADER_LENGTH; + ByteBuffer buffer = ByteBuffer.wrap(cipherTextWithIv, HEADER_LENGTH, bufferLength); + + byte[] iv = new byte[IV_LENGTH]; + buffer.get(iv); + + byte[] cipherText = new byte[buffer.remaining()]; + buffer.get(cipherText); + + GCMParameterSpec spec = new GCMParameterSpec(TAG_BIT_LENGTH, iv); + cipher.init(Cipher.DECRYPT_MODE, secretKey, spec); + return cipher.doFinal(cipherText); + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java new file mode 100644 index 000000000..5217b4cf7 --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019-2020 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/Floodgate + * + */ + +package org.geysermc.floodgate.crypto; + +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.security.SecureRandom; + +public final class AesKeyProducer implements KeyProducer { + public static int KEY_SIZE = 128; + + @Override + public SecretKey produce() { + try { + KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); + keyGenerator.init(KEY_SIZE, SecureRandom.getInstanceStrong()); + return keyGenerator.generateKey(); + } catch (Exception exception) { + throw new RuntimeException(exception); + } + } + + @Override + public SecretKey produceFrom(byte[] keyFileData) { + try { + return new SecretKeySpec(keyFileData, "AES"); + } catch (Exception exception) { + throw new RuntimeException(exception); + } + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java new file mode 100644 index 000000000..23e57fb64 --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2019-2020 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/Floodgate + * + */ + +package org.geysermc.floodgate.crypto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import org.geysermc.floodgate.util.InvalidHeaderException; + +import java.nio.charset.StandardCharsets; +import java.security.Key; + +/** + * Responsible for both encrypting and decrypting data + */ +public interface FloodgateCipher { + byte[] IDENTIFIER = "Floodgate".getBytes(StandardCharsets.UTF_8); + byte VERSION = 2; + + int HEADER_LENGTH = IDENTIFIER.length + 1; // one byte for version + + /** + * Initializes the instance by giving it the key it needs to encrypt or decrypt data + * + * @param key the key used to encrypt and decrypt data + */ + void init(Key key); + + /** + * Encrypts the given data using the Key provided in {@link #init(Key)} + * + * @param data the data to encrypt + * @return the encrypted data + * @throws Exception when the encryption failed + */ + byte[] encrypt(byte[] data) throws Exception; + + /** + * Encrypts data from a String.
+ * This method internally calls {@link #encrypt(byte[])} + * + * @param data the data to encrypt + * @return the encrypted data + * @throws Exception when the encryption failed + */ + default byte[] encryptFromString(String data) throws Exception { + return encrypt(data.getBytes(StandardCharsets.UTF_8)); + } + + /** + * Decrypts the given data using the Key provided in {@link #init(Key)} + * + * @param data the data to decrypt + * @return the decrypted data + * @throws Exception when the decrypting failed + */ + byte[] decrypt(byte[] data) throws Exception; + + /** + * Decrypts a byte[] and turn it into a String.
+ * This method internally calls {@link #decrypt(byte[])} + * and converts the returned byte[] into a String. + * + * @param data the data to encrypt + * @return the decrypted data in a UTF-8 String + * @throws Exception when the decrypting failed + */ + default String decryptToString(byte[] data) throws Exception { + byte[] decrypted = decrypt(data); + if (decrypted == null) { + return null; + } + return new String(decrypted, StandardCharsets.UTF_8); + } + + /** + * Decrypts a String.
+ * This method internally calls {@link #decrypt(byte[])} + * by converting the UTF-8 String into a byte[] + * + * @param data the data to decrypt + * @return the decrypted data in a byte[] + * @throws Exception when the decrypting failed + */ + default byte[] decryptFromString(String data) throws Exception { + return decrypt(data.getBytes(StandardCharsets.UTF_8)); + } + + /** + * Checks if the header is valid and return a IntPair containing the header version + * and the index to start reading the actual encrypted data from. + * + * @param data the data to check + * @return IntPair. x = version number, y = the index to start reading from. + * @throws InvalidHeaderException when the header is invalid + */ + default HeaderResult checkHeader(byte[] data) throws InvalidHeaderException { + final int identifierLength = IDENTIFIER.length; + + if (data.length <= HEADER_LENGTH) { + throw new InvalidHeaderException("Data length is smaller then header." + + "Needed " + HEADER_LENGTH + ", got " + data.length); + } + + for (int i = 0; i < identifierLength; i++) { + if (IDENTIFIER[i] != data[i]) { + StringBuilder receivedIdentifier = new StringBuilder(); + for (byte b : IDENTIFIER) { + receivedIdentifier.append(b); + } + + throw new InvalidHeaderException(String.format( + "Expected identifier %s, got %s", + new String(IDENTIFIER, StandardCharsets.UTF_8), + receivedIdentifier.toString() + )); + } + } + + return new HeaderResult(data[identifierLength], HEADER_LENGTH); + } + + static boolean hasHeader(String data) { + if (data.length() < IDENTIFIER.length) { + return false; + } + + for (int i = 0; i < IDENTIFIER.length; i++) { + if (IDENTIFIER[i] != data.charAt(i)) { + return false; + } + } + return true; + } + + @Data + @AllArgsConstructor + class HeaderResult { + private int version; + private int startIndex; + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/KeyProducer.java b/common/src/main/java/org/geysermc/floodgate/crypto/KeyProducer.java new file mode 100644 index 000000000..fc2ac512d --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/crypto/KeyProducer.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019-2020 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/Floodgate + * + */ + +package org.geysermc.floodgate.crypto; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.Key; + +public interface KeyProducer { + Key produce(); + Key produceFrom(byte[] keyFileData); + + default Key produceFrom(Path keyFileLocation) throws IOException { + return produceFrom(Files.readAllBytes(keyFileLocation)); + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java index 44544291d..f730d75bd 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java +++ b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java @@ -9,11 +9,10 @@ import lombok.Getter; * This class is only used internally, and you should look at FloodgatePlayer instead * (FloodgatePlayer is present in the common module in the Floodgate repo) */ -@AllArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor(access = AccessLevel.PACKAGE) @Getter public final class BedrockData { public static final int EXPECTED_LENGTH = 9; - public static final String FLOODGATE_IDENTIFIER = "Geyser-Floodgate"; private final String version; private final String username; @@ -38,9 +37,15 @@ public final class BedrockData { this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null); } + public boolean hasPlayerLink() { + return linkedPlayer != null; + } + public static BedrockData fromString(String data) { String[] split = data.split("\0"); - if (split.length != EXPECTED_LENGTH) return emptyData(split.length); + if (split.length != BedrockData.EXPECTED_LENGTH) { + return emptyData(split.length); + } LinkedPlayer linkedPlayer = LinkedPlayer.fromString(split[8]); // The format is the same as the order of the fields in this class @@ -51,10 +56,6 @@ public final class BedrockData { ); } - public static BedrockData fromRawData(byte[] data) { - return fromString(new String(data)); - } - @Override public String toString() { // The format is the same as the order of the fields in this class @@ -63,10 +64,6 @@ public final class BedrockData { (linkedPlayer != null ? linkedPlayer.toString() : "null"); } - public boolean hasPlayerLink() { - return linkedPlayer != null; - } - private static BedrockData emptyData(int dataLength) { return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength); } diff --git a/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java b/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java deleted file mode 100644 index 619c7011a..000000000 --- a/common/src/main/java/org/geysermc/floodgate/util/EncryptionUtil.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.geysermc.floodgate.util; - -import javax.crypto.*; -import javax.crypto.spec.SecretKeySpec; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.security.*; -import java.security.spec.EncodedKeySpec; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.Base64; - -/** - * The class which contains all the encryption and decryption method used in Geyser and Floodgate - * (for Floodgate data). This is only used internally and doesn't serve a purpose for anything else - */ -public final class EncryptionUtil { - public static String encrypt(Key key, String data) throws IllegalBlockSizeException, - InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { - KeyGenerator generator = KeyGenerator.getInstance("AES"); - generator.init(128); - SecretKey secretKey = generator.generateKey(); - - Cipher cipher = Cipher.getInstance("AES"); - cipher.init(Cipher.ENCRYPT_MODE, secretKey); - byte[] encryptedText = cipher.doFinal(data.getBytes()); - - cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - cipher.init(key instanceof PublicKey ? Cipher.PUBLIC_KEY : Cipher.PRIVATE_KEY, key); - return Base64.getEncoder().encodeToString(cipher.doFinal(secretKey.getEncoded())) + '\0' + - Base64.getEncoder().encodeToString(encryptedText); - } - - public static String encryptBedrockData(Key key, BedrockData data) throws IllegalBlockSizeException, - InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { - return encrypt(key, data.toString()); - } - - public static byte[] decrypt(Key key, String encryptedData) throws IllegalBlockSizeException, - InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { - String[] split = encryptedData.split("\0"); - if (split.length != 2) { - throw new IllegalArgumentException("Expected two arguments, got " + split.length); - } - - Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - cipher.init(key instanceof PublicKey ? Cipher.PUBLIC_KEY : Cipher.PRIVATE_KEY, key); - byte[] decryptedKey = cipher.doFinal(Base64.getDecoder().decode(split[0])); - - SecretKey secretKey = new SecretKeySpec(decryptedKey, 0, decryptedKey.length, "AES"); - cipher = Cipher.getInstance("AES"); - cipher.init(Cipher.DECRYPT_MODE, secretKey); - return cipher.doFinal(Base64.getDecoder().decode(split[1])); - } - - public static BedrockData decryptBedrockData(Key key, String encryptedData) throws IllegalBlockSizeException, - InvalidKeyException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException { - return BedrockData.fromRawData(decrypt(key, encryptedData)); - } - - @SuppressWarnings("unchecked") - public static T getKeyFromFile(Path fileLocation, Class keyType) throws - IOException, InvalidKeySpecException, NoSuchAlgorithmException { - boolean isPublicKey = keyType == PublicKey.class; - if (!isPublicKey && keyType != PrivateKey.class) { - throw new RuntimeException("I can only read public and private keys!"); - } - - byte[] key = Files.readAllBytes(fileLocation); - - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - EncodedKeySpec keySpec = isPublicKey ? new X509EncodedKeySpec(key) : new PKCS8EncodedKeySpec(key); - return (T) (isPublicKey ? - keyFactory.generatePublic(keySpec) : - keyFactory.generatePrivate(keySpec) - ); - } -} diff --git a/common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java b/common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java new file mode 100644 index 000000000..30dbf0726 --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.util; + +public class InvalidHeaderException extends Exception { + public InvalidHeaderException() { + super(); + } + + public InvalidHeaderException(String message) { + super(message); + } + + public InvalidHeaderException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java index a930b013a..53a167f9b 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java +++ b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java @@ -26,9 +26,7 @@ package org.geysermc.floodgate.util; -import lombok.AccessLevel; import lombok.Getter; -import lombok.Setter; import java.util.UUID; @@ -50,7 +48,6 @@ public final class LinkedPlayer { * If the LinkedPlayer is send from a different platform. * For example the LinkedPlayer is from Bungee but the data has been sent to the Bukkit server. */ - @Setter(AccessLevel.PRIVATE) private boolean fromDifferentPlatform = false; public LinkedPlayer(String javaUsername, UUID javaUniqueId, UUID bedrockId) { @@ -60,12 +57,15 @@ public final class LinkedPlayer { } static LinkedPlayer fromString(String data) { - if (data.length() == 4) return null; + if (data.length() != 3) { + return null; + } + String[] split = data.split(";"); LinkedPlayer player = new LinkedPlayer( split[0], UUID.fromString(split[1]), UUID.fromString(split[2]) ); - player.setFromDifferentPlatform(true); + player.fromDifferentPlatform = true; return player; } diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index ee687dbbd..622add139 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -57,10 +57,14 @@ import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.floodgate.crypto.AesCipher; +import org.geysermc.floodgate.crypto.AesKeyProducer; +import org.geysermc.floodgate.crypto.FloodgateCipher; import javax.naming.directory.Attribute; import javax.naming.directory.InitialDirContext; import java.net.InetSocketAddress; +import java.security.Key; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; @@ -77,7 +81,7 @@ public class GeyserConnector { public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v407.V407_CODEC; public static final String NAME = "Geyser"; - public static final String VERSION = "DEV"; // A fallback for running in IDEs + public static final String VERSION = "1.0.0 (git-master-35d8edd)"; // A fallback for running in IDEs private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"; @@ -89,6 +93,8 @@ public class GeyserConnector { @Setter private AuthType authType; + private FloodgateCipher cipher; + private boolean shuttingDown = false; private final ScheduledExecutorService generalThreadPool; @@ -165,6 +171,17 @@ public class GeyserConnector { remoteServer = new RemoteServer(config.getRemote().getAddress(), remotePort); authType = AuthType.getByName(config.getRemote().getAuthType()); + if (authType == AuthType.FLOODGATE) { + try { + Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyFile()); + cipher = new AesCipher(); + cipher.init(key); + logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); + } catch (Exception exception) { + logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception); + } + } + if (config.isAboveBedrockNetherBuilding()) DimensionUtils.changeBedrockNetherId(); // Apply End dimension ID workaround to Nether diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 623bf16a9..a02a356fb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -71,15 +71,13 @@ import org.geysermc.connector.network.translators.PacketTranslatorRegistry; import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.utils.*; +import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.util.BedrockData; -import org.geysermc.floodgate.util.EncryptionUtil; -import java.io.IOException; import java.net.InetSocketAddress; -import java.security.NoSuchAlgorithmException; -import java.security.PublicKey; -import java.security.spec.InvalidKeySpecException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Base64; import java.util.List; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; @@ -294,24 +292,6 @@ public class GeyserSession implements CommandSender { } boolean floodgate = connector.getAuthType() == AuthType.FLOODGATE; - final PublicKey publicKey; - - if (floodgate) { - PublicKey key = null; - try { - key = EncryptionUtil.getKeyFromFile( - connector.getConfig().getFloodgateKeyFile(), - PublicKey.class - ); - } catch (IOException | InvalidKeySpecException | NoSuchAlgorithmException e) { - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), e); - } - publicKey = key; - } else publicKey = null; - - if (publicKey != null) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); - } downstream = new Client(remoteServer.getAddress(), remoteServer.getPort(), protocol, new TcpSessionFactory()); downstream.getSession().addListener(new SessionAdapter() { @@ -319,9 +299,11 @@ public class GeyserSession implements CommandSender { public void packetSending(PacketSendingEvent event) { //todo move this somewhere else if (event.getPacket() instanceof HandshakePacket && floodgate) { - String encrypted = ""; + byte[] encryptedData; + try { - encrypted = EncryptionUtil.encryptBedrockData(publicKey, new BedrockData( + FloodgateCipher cipher = connector.getCipher(); + encryptedData = cipher.encryptFromString(new BedrockData( clientData.getGameVersion(), authData.getName(), authData.getXboxUUID(), @@ -330,15 +312,22 @@ public class GeyserSession implements CommandSender { clientData.getUiProfile().ordinal(), clientData.getCurrentInputMode().ordinal(), upstream.getSession().getAddress().getAddress().getHostAddress() - )); + ).toString()); } catch (Exception e) { connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); + disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.floodgate.encryption_fail", getClientData().getLanguageCode())); + return; } + String encrypted = new String( + Base64.getEncoder().encode(encryptedData), + StandardCharsets.UTF_8 + ); + HandshakePacket handshakePacket = event.getPacket(); event.setPacket(new HandshakePacket( handshakePacket.getProtocolVersion(), - handshakePacket.getHostname() + '\0' + BedrockData.FLOODGATE_IDENTIFIER + '\0' + encrypted, + handshakePacket.getHostname() + '\0' + encrypted, handshakePacket.getPort(), handshakePacket.getIntent() )); From 7fbc401dfa6b7841307be48eca457d699745e90e Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 19 Sep 2020 14:21:54 +0200 Subject: [PATCH 005/766] Added RawSkins, Toppings and renamed the Floodgate plugin name --- .../bungeecord/GeyserBungeeConfiguration.java | 2 +- .../bungeecord/GeyserBungeePlugin.java | 2 +- .../spigot/GeyserSpigotConfiguration.java | 2 +- .../platform/spigot/GeyserSpigotPlugin.java | 2 +- .../geysermc/floodgate/crypto/AesCipher.java | 49 ++++++++++--- .../floodgate/crypto/Base64Topping.java | 40 +++++++++++ .../floodgate/crypto/FloodgateCipher.java | 35 +++++---- .../geysermc/floodgate/crypto/Topping.java | 31 ++++++++ .../geysermc/floodgate/util/BedrockData.java | 20 ++---- ...ption.java => InvalidFormatException.java} | 18 +++-- .../org/geysermc/floodgate/util/RawSkin.java | 55 ++++++++++---- .../geysermc/connector/GeyserConnector.java | 3 +- .../network/session/GeyserSession.java | 27 +++---- .../session/auth/BedrockClientData.java | 72 +++++++++++++------ .../connector/utils/LoginEncryptionUtils.java | 5 +- .../connector/utils/SkinProvider.java | 2 +- 16 files changed, 261 insertions(+), 104 deletions(-) create mode 100644 common/src/main/java/org/geysermc/floodgate/crypto/Base64Topping.java create mode 100644 common/src/main/java/org/geysermc/floodgate/crypto/Topping.java rename common/src/main/java/org/geysermc/floodgate/util/{InvalidHeaderException.java => InvalidFormatException.java} (77%) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java index d9b86a2e8..500f342a6 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java @@ -44,7 +44,7 @@ public class GeyserBungeeConfiguration extends GeyserJacksonConfiguration { private Path floodgateKey; public void loadFloodgate(GeyserBungeePlugin plugin, Configuration configuration) { - Plugin floodgate = plugin.getProxy().getPluginManager().getPlugin("floodgate-bungee"); + Plugin floodgate = plugin.getProxy().getPluginManager().getPlugin("floodgate"); floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(plugin.getDataFolder().toString(), configuration.getString("floodgate-key-file"), "public-key.pem"), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null); } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index 059e1dfd8..a600ebcd3 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -94,7 +94,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { this.geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode()); GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger); - if (geyserConfig.getRemote().getAuthType().equals("floodgate") && getProxy().getPluginManager().getPlugin("floodgate-bungee") == null) { + if (geyserConfig.getRemote().getAuthType().equals("floodgate") && getProxy().getPluginManager().getPlugin("floodgate") == null) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java index 8667a692b..de4e58c3b 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java @@ -48,7 +48,7 @@ public class GeyserSpigotConfiguration extends GeyserJacksonConfiguration { private Path floodgateKey; public void loadFloodgate(GeyserSpigotPlugin plugin) { - Plugin floodgate = Bukkit.getPluginManager().getPlugin("floodgate-spigot"); + Plugin floodgate = Bukkit.getPluginManager().getPlugin("floodgate"); floodgateKey = FloodgateKeyLoader.getKey(plugin.getGeyserLogger(), this, Paths.get(plugin.getDataFolder().toString(), plugin.getConfig().getString("floodgate-key-file", "public-key.pem")), floodgate, floodgate != null ? floodgate.getDataFolder().toPath() : null); } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index b0cc5e6c3..dab63c4ea 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -93,7 +93,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { this.geyserLogger = new GeyserSpigotLogger(getLogger(), geyserConfig.isDebugMode()); GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger); - if (geyserConfig.getRemote().getAuthType().equals("floodgate") && Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) { + if (geyserConfig.getRemote().getAuthType().equals("floodgate") && Bukkit.getPluginManager().getPlugin("floodgate") == null) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); this.getPluginLoader().disablePlugin(this); return; diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java index 3e6fef01a..2627584f6 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java @@ -26,7 +26,7 @@ package org.geysermc.floodgate.crypto; -import org.geysermc.floodgate.util.InvalidHeaderException; +import lombok.RequiredArgsConstructor; import javax.crypto.Cipher; import javax.crypto.SecretKey; @@ -35,12 +35,14 @@ import java.nio.ByteBuffer; import java.security.Key; import java.security.SecureRandom; +@RequiredArgsConstructor public final class AesCipher implements FloodgateCipher { - private static final int IV_LENGTH = 12; + public static final int IV_LENGTH = 12; private static final int TAG_BIT_LENGTH = 128; private static final String CIPHER_NAME = "AES/GCM/NoPadding"; private final SecureRandom secureRandom = new SecureRandom(); + private final Topping topping; private SecretKey secretKey; public void init(Key key) { @@ -62,32 +64,57 @@ public final class AesCipher implements FloodgateCipher { cipher.init(Cipher.ENCRYPT_MODE, secretKey, spec); byte[] cipherText = cipher.doFinal(data); - return ByteBuffer.allocate(iv.length + cipherText.length + HEADER_LENGTH) - .put(IDENTIFIER).put(VERSION) // header + if (topping != null) { + iv = topping.encode(iv); + cipherText = topping.encode(cipherText); + } + + return ByteBuffer.allocate(iv.length + cipherText.length + HEADER_LENGTH + 1) + .put(IDENTIFIER) // header .put(iv) + .put((byte) 0x21) .put(cipherText) .array(); } public byte[] decrypt(byte[] cipherTextWithIv) throws Exception { - HeaderResult pair = checkHeader(cipherTextWithIv); - if (pair.getVersion() != VERSION) { - throw new InvalidHeaderException( - "Expected version " + VERSION + ", got " + pair.getVersion() - ); - } + checkHeader(cipherTextWithIv); Cipher cipher = Cipher.getInstance(CIPHER_NAME); int bufferLength = cipherTextWithIv.length - HEADER_LENGTH; ByteBuffer buffer = ByteBuffer.wrap(cipherTextWithIv, HEADER_LENGTH, bufferLength); - byte[] iv = new byte[IV_LENGTH]; + int ivLength = IV_LENGTH; + + if (topping != null) { + int mark = buffer.position(); + + // we need the first index, the second is for the optional RawSkin + boolean found = false; + while (buffer.hasRemaining() && !found) { + if (buffer.get() == 0x21) { + found = true; + } + } + + ivLength = buffer.position() - mark - 1; // don't include the splitter itself + buffer.position(mark); // reset to the pre-while index + } + + byte[] iv = new byte[ivLength]; buffer.get(iv); + buffer.position(buffer.position() + 1); // skip splitter + byte[] cipherText = new byte[buffer.remaining()]; buffer.get(cipherText); + if (topping != null) { + iv = topping.decode(iv); + cipherText = topping.decode(cipherText); + } + GCMParameterSpec spec = new GCMParameterSpec(TAG_BIT_LENGTH, iv); cipher.init(Cipher.DECRYPT_MODE, secretKey, spec); return cipher.doFinal(cipherText); diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/Base64Topping.java b/common/src/main/java/org/geysermc/floodgate/crypto/Base64Topping.java new file mode 100644 index 000000000..fbec78a1d --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/crypto/Base64Topping.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.crypto; + +import java.util.Base64; + +public final class Base64Topping implements Topping { + @Override + public byte[] encode(byte[] data) { + return Base64.getEncoder().encode(data); + } + + @Override + public byte[] decode(byte[] data) { + return Base64.getDecoder().decode(data); + } +} diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java index 23e57fb64..4869531e2 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java @@ -28,7 +28,7 @@ package org.geysermc.floodgate.crypto; import lombok.AllArgsConstructor; import lombok.Data; -import org.geysermc.floodgate.util.InvalidHeaderException; +import org.geysermc.floodgate.util.InvalidFormatException; import java.nio.charset.StandardCharsets; import java.security.Key; @@ -38,9 +38,7 @@ import java.security.Key; */ public interface FloodgateCipher { byte[] IDENTIFIER = "Floodgate".getBytes(StandardCharsets.UTF_8); - byte VERSION = 2; - - int HEADER_LENGTH = IDENTIFIER.length + 1; // one byte for version + int HEADER_LENGTH = IDENTIFIER.length; /** * Initializes the instance by giving it the key it needs to encrypt or decrypt data @@ -110,19 +108,20 @@ public interface FloodgateCipher { } /** - * Checks if the header is valid and return a IntPair containing the header version - * and the index to start reading the actual encrypted data from. + * Checks if the header is valid. + * This method will throw an InvalidFormatException when the header is invalid. * * @param data the data to check - * @return IntPair. x = version number, y = the index to start reading from. - * @throws InvalidHeaderException when the header is invalid + * @throws InvalidFormatException when the header is invalid */ - default HeaderResult checkHeader(byte[] data) throws InvalidHeaderException { + default void checkHeader(byte[] data) throws InvalidFormatException { final int identifierLength = IDENTIFIER.length; if (data.length <= HEADER_LENGTH) { - throw new InvalidHeaderException("Data length is smaller then header." + - "Needed " + HEADER_LENGTH + ", got " + data.length); + throw new InvalidFormatException("Data length is smaller then header." + + "Needed " + HEADER_LENGTH + ", got " + data.length, + true + ); } for (int i = 0; i < identifierLength; i++) { @@ -132,15 +131,15 @@ public interface FloodgateCipher { receivedIdentifier.append(b); } - throw new InvalidHeaderException(String.format( - "Expected identifier %s, got %s", - new String(IDENTIFIER, StandardCharsets.UTF_8), - receivedIdentifier.toString() - )); + throw new InvalidFormatException( + String.format("Expected identifier %s, got %s", + new String(IDENTIFIER, StandardCharsets.UTF_8), + receivedIdentifier.toString() + ), + true + ); } } - - return new HeaderResult(data[identifierLength], HEADER_LENGTH); } static boolean hasHeader(String data) { diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/Topping.java b/common/src/main/java/org/geysermc/floodgate/crypto/Topping.java new file mode 100644 index 000000000..f3dc0d4b8 --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/crypto/Topping.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2019-2020 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.floodgate.crypto; + +public interface Topping { + byte[] encode(byte[] data); + byte[] decode(byte[] data); +} diff --git a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java index dcc412f50..89eaf5395 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java +++ b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java @@ -50,25 +50,23 @@ public final class BedrockData { private final LinkedPlayer linkedPlayer; private final int dataLength; - private RawSkin skin; - public BedrockData(String version, String username, String xuid, int deviceOs, String languageCode, int uiProfile, int inputMode, String ip, - LinkedPlayer linkedPlayer, RawSkin skin) { + LinkedPlayer linkedPlayer) { this(version, username, xuid, deviceOs, languageCode, - inputMode, uiProfile, ip, linkedPlayer, EXPECTED_LENGTH, skin); + inputMode, uiProfile, ip, linkedPlayer, EXPECTED_LENGTH); } public BedrockData(String version, String username, String xuid, int deviceOs, - String languageCode, int uiProfile, int inputMode, String ip, RawSkin skin) { - this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null, skin); + String languageCode, int uiProfile, int inputMode, String ip) { + this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null); } public boolean hasPlayerLink() { return linkedPlayer != null; } - public static BedrockData fromString(String data, String skin) { + public static BedrockData fromString(String data) { String[] split = data.split("\0"); if (split.length != EXPECTED_LENGTH) { return emptyData(split.length); @@ -79,14 +77,10 @@ public final class BedrockData { return new BedrockData( split[0], split[1], split[2], Integer.parseInt(split[3]), split[4], Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], - linkedPlayer, split.length, RawSkin.parse(skin) + linkedPlayer, split.length ); } - public static BedrockData fromRawData(byte[] data, String skin) { - return fromString(new String(data), skin); - } - @Override public String toString() { // The format is the same as the order of the fields in this class @@ -96,6 +90,6 @@ public final class BedrockData { } private static BedrockData emptyData(int dataLength) { - return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength, null); + return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java b/common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java similarity index 77% rename from common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java rename to common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java index 30dbf0726..9ec5b1710 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/InvalidHeaderException.java +++ b/common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java @@ -26,16 +26,26 @@ package org.geysermc.floodgate.util; -public class InvalidHeaderException extends Exception { - public InvalidHeaderException() { +import lombok.Getter; + +@Getter +public class InvalidFormatException extends Exception { + private boolean header = false; + + public InvalidFormatException() { super(); } - public InvalidHeaderException(String message) { + public InvalidFormatException(String message) { super(message); } - public InvalidHeaderException(String message, Throwable cause) { + public InvalidFormatException(String message, boolean header) { + super(message); + this.header = header; + } + + public InvalidFormatException(String message, Throwable cause) { super(message, cause); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java b/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java index ba22b632a..2ff0e3fb2 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java +++ b/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java @@ -26,31 +26,62 @@ package org.geysermc.floodgate.util; import lombok.AllArgsConstructor; +import lombok.ToString; -import java.nio.charset.StandardCharsets; +import java.nio.ByteBuffer; +import java.util.Base64; @AllArgsConstructor -public class RawSkin { +@ToString +public final class RawSkin { public int width; public int height; public byte[] data; private RawSkin() {} - public static RawSkin parse(String data) { - if (data == null) return null; - String[] split = data.split(":"); - if (split.length != 3) return null; + public static RawSkin decode(byte[] data) throws InvalidFormatException { + if (data == null) { + return null; + } + + int maxEncodedLength = 4 * (((64 * 64 * 4 + 8) + 2) / 3); + // if the RawSkin is longer then the max Java Edition skin length + if (data.length > maxEncodedLength) { + throw new InvalidFormatException( + "Encoded data cannot be longer then " + maxEncodedLength + " bytes!" + ); + } + + // if the encoded data doesn't even contain the width and height (8 bytes, 2 ints) + if (data.length < 4 * ((8 + 2) / 3)) { + throw new InvalidFormatException("Encoded data must be at least 12 bytes long!"); + } + + data = Base64.getDecoder().decode(data); + + ByteBuffer buffer = ByteBuffer.wrap(data); RawSkin skin = new RawSkin(); - skin.width = Integer.parseInt(split[0]); - skin.height = Integer.parseInt(split[1]); - skin.data = split[2].getBytes(StandardCharsets.UTF_8); + skin.width = buffer.getInt(); + skin.height = buffer.getInt(); + if (buffer.remaining() != (skin.width * skin.height * 4)) { + throw new InvalidFormatException(String.format( + "Expected skin length to be %s, got %s", + (skin.width * skin.height * 4), buffer.remaining() + )); + } + skin.data = new byte[buffer.remaining()]; + buffer.get(skin.data); return skin; } - @Override - public String toString() { - return Integer.toString(width) + ':' + height + ':' + new String(data); + public byte[] encode() { + // 2 x int = 8 bytes + ByteBuffer buffer = ByteBuffer.allocate(8 + data.length); + buffer.putInt(width); + buffer.putInt(height); + buffer.put(data); + return Base64.getEncoder().encode(buffer.array()); } } diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 21fb5564f..9b6045be2 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -57,6 +57,7 @@ import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.utils.LocaleUtils; import org.geysermc.floodgate.crypto.AesCipher; import org.geysermc.floodgate.crypto.AesKeyProducer; +import org.geysermc.floodgate.crypto.Base64Topping; import org.geysermc.floodgate.crypto.FloodgateCipher; import javax.naming.directory.Attribute; @@ -180,7 +181,7 @@ public class GeyserConnector { if (authType == AuthType.FLOODGATE) { try { Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyFile()); - cipher = new AesCipher(); + cipher = new AesCipher(new Base64Topping()); cipher.init(key); logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); } catch (Exception exception) { diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 3e4314fd4..9a2ebe56d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -77,15 +77,8 @@ import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.util.BedrockData; import java.net.InetSocketAddress; -import java.security.NoSuchAlgorithmException; -import java.security.PublicKey; -import java.security.spec.InvalidKeySpecException; -import java.util.*; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @Getter @@ -359,8 +352,7 @@ public class GeyserSession implements CommandSender { clientData.getLanguageCode(), clientData.getUiProfile().ordinal(), clientData.getCurrentInputMode().ordinal(), - upstream.getSession().getAddress().getAddress().getHostAddress(), - clientData.getImage("Skin") + upstream.getSession().getAddress().getAddress().getHostAddress() ).toString()); } catch (Exception e) { connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); @@ -368,15 +360,18 @@ public class GeyserSession implements CommandSender { return; } - String encrypted = new String( - Base64.getEncoder().encode(encryptedData), - StandardCharsets.UTF_8 - ); + byte[] rawSkin = clientData.getAndTransformImage("Skin").encode(); + byte[] finalData = new byte[encryptedData.length + rawSkin.length + 1]; + System.arraycopy(encryptedData, 0, finalData, 0, encryptedData.length); + finalData[encryptedData.length] = 0x21; // splitter + System.arraycopy(rawSkin, 0, finalData, encryptedData.length + 1, rawSkin.length); + + String finalDataString = new String(finalData, StandardCharsets.UTF_8); HandshakePacket handshakePacket = event.getPacket(); event.setPacket(new HandshakePacket( handshakePacket.getProtocolVersion(), - handshakePacket.getHostname() + '\0' + encrypted, + handshakePacket.getHostname() + '\0' + finalDataString, handshakePacket.getPort(), handshakePacket.getIntent() )); @@ -626,7 +621,7 @@ public class GeyserSession implements CommandSender { /** * Send a packet immediately to the player. - * + * * @param packet the bedrock packet from the NukkitX protocol lib */ public void sendUpstreamPacketImmediately(BedrockPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java index 2a3e174ed..ab0fad845 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java @@ -28,13 +28,15 @@ package org.geysermc.connector.network.session.auth; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; import lombok.Getter; -import net.minidev.json.JSONObject; +import org.geysermc.connector.utils.SkinProvider; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.InputMode; import org.geysermc.floodgate.util.RawSkin; import org.geysermc.floodgate.util.UiProfile; +import java.awt.image.BufferedImage; import java.util.Base64; import java.util.UUID; @@ -42,7 +44,7 @@ import java.util.UUID; @Getter public final class BedrockClientData { @JsonIgnore - private JSONObject jsonData; + private JsonNode jsonData; @JsonProperty(value = "GameVersion") private String gameVersion; @@ -112,31 +114,17 @@ public final class BedrockClientData { @JsonProperty(value = "ThirdPartyNameOnly") private boolean thirdPartyNameOnly; - public void setJsonData(JSONObject data) { - if (this.jsonData != null && data != null) { + public void setJsonData(JsonNode data) { + if (this.jsonData == null && data != null) { this.jsonData = data; } } - /** - * Taken from https://github.com/NukkitX/Nukkit/blob/master/src/main/java/cn/nukkit/network/protocol/LoginPacket.java
- * Internally only used for Skins, but can be used for Capes too - */ - public RawSkin getImage(String name) { - if (jsonData == null || !jsonData.containsKey(name + "Data")) return null; - byte[] image = Base64.getDecoder().decode(jsonData.getAsString(name + "Data")); - if (jsonData.containsKey(name + "ImageWidth") && jsonData.containsKey(name + "ImageHeight")) { - return new RawSkin( - (int) jsonData.getAsNumber(name + "ImageWidth"), - (int) jsonData.get(name + "ImageHeight"), - image - ); - } - return getLegacyImage(image); - } - private static RawSkin getLegacyImage(byte[] imageData) { - if (imageData == null) return null; + if (imageData == null) { + return null; + } + // width * height * 4 (rgba) switch (imageData.length) { case 8192: @@ -151,4 +139,44 @@ public final class BedrockClientData { throw new IllegalArgumentException("Unknown legacy skin size"); } } + + /** + * Taken from https://github.com/NukkitX/Nukkit/blob/master/src/main/java/cn/nukkit/network/protocol/LoginPacket.java
+ * Internally only used for Skins, but can be used for Capes too + */ + public RawSkin getImage(String name) { + System.out.println(jsonData.toString()); + if (jsonData == null || !jsonData.has(name + "Data")) { + return null; + } + + byte[] image = Base64.getDecoder().decode(jsonData.get(name + "Data").asText()); + if (jsonData.has(name + "ImageWidth") && jsonData.has(name + "ImageHeight")) { + return new RawSkin( + jsonData.get(name + "ImageWidth").asInt(), + jsonData.get(name + "ImageHeight").asInt(), + image + ); + } + return getLegacyImage(image); + } + + public RawSkin getAndTransformImage(String name) { + RawSkin skin = getImage(name); + if (skin != null && (skin.width > 64 || skin.height > 64)) { + BufferedImage scaledImage = SkinProvider.imageDataToBufferedImage(skin.data, skin.width, skin.height); + + int max = Math.max(skin.width, skin.height); + while (max > 64) { + max /= 2; + scaledImage = SkinProvider.scale(scaledImage); + } + + byte[] skinData = SkinProvider.bufferedImageToImageData(scaledImage); + skin.width = scaledImage.getWidth(); + skin.height = scaledImage.getHeight(); + skin.data = skinData; + } + return skin; + } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index 7e4989d6e..62d70f612 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -131,8 +131,9 @@ public class LoginEncryptionUtils { JWSObject clientJwt = JWSObject.parse(clientData); EncryptionUtils.verifyJwt(clientJwt, identityPublicKey); - BedrockClientData data = JSON_MAPPER.convertValue(JSON_MAPPER.readTree(clientJwt.getPayload().toBytes()), BedrockClientData.class); - data.setJsonData(clientJwt.getPayload().toJSONObject()); + JsonNode clientDataJson = JSON_MAPPER.readTree(clientJwt.getPayload().toBytes()); + BedrockClientData data = JSON_MAPPER.convertValue(clientDataJson, BedrockClientData.class); + data.setJsonData(clientDataJson); session.setClientData(data); if (EncryptionUtils.canUseEncryption()) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java index 5551230b9..9b3d737e8 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java @@ -460,7 +460,7 @@ public class SkinProvider { return null; } - private static BufferedImage scale(BufferedImage bufferedImage) { + public static BufferedImage scale(BufferedImage bufferedImage) { BufferedImage resized = new BufferedImage(bufferedImage.getWidth() / 2, bufferedImage.getHeight() / 2, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = resized.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); From f8939ca5de6382b3f087aee9bc64e01bdbd76f27 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 19 Sep 2020 14:45:36 +0200 Subject: [PATCH 006/766] Updated to latest Geyser --- .../src/main/java/org/geysermc/connector/GeyserConnector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index de4d2c2bf..6cd6aa521 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -186,7 +186,7 @@ public class GeyserConnector { if (authType == AuthType.FLOODGATE) { try { - Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyFile()); + Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath()); cipher = new AesCipher(new Base64Topping()); cipher.init(key); logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); From d75169392b0e35237a79f574df1e97c6d97a0759 Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Sun, 27 Sep 2020 21:08:31 -0400 Subject: [PATCH 007/766] Small consistency fixes --- .../org/geysermc/platform/bungeecord/GeyserBungeePlugin.java | 2 +- .../java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java | 2 +- .../main/java/org/geysermc/connector/FloodgateKeyLoader.java | 2 +- connector/src/main/resources/config.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index 9d8e05ac7..e06640896 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -97,7 +97,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { if (geyserConfig.getRemote().getAuthType().equals("floodgate") && getProxy().getPluginManager().getPlugin("floodgate") == null) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; - } else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate-bungee") != null) { + } else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) { // Floodgate installed means that the user wants Floodgate authentication geyserLogger.debug("Auto-setting to Floodgate authentication."); geyserConfig.getRemote().setAuthType("floodgate"); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index a8ae50d69..12794d1c8 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -101,7 +101,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); this.getPluginLoader().disablePlugin(this); return; - } else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) { + } else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate") != null) { // Floodgate installed means that the user wants Floodgate authentication geyserLogger.debug("Auto-setting to Floodgate authentication."); geyserConfig.getRemote().setAuthType("floodgate"); diff --git a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java b/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java index ec5dd349a..7bf0ac67f 100644 --- a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java +++ b/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java @@ -37,7 +37,7 @@ public class FloodgateKeyLoader { if (!Files.exists(floodgateKey) && config.getRemote().getAuthType().equals("floodgate")) { if (floodgate != null) { - Path autoKey = floodgateDataFolder.resolve("public-key.pem"); + Path autoKey = floodgateDataFolder.resolve("key.pem"); if (Files.exists(autoKey)) { logger.info(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded")); floodgateKey = autoKey; diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 0602bb546..b9e6700fc 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -34,9 +34,9 @@ remote: auth-type: online # Floodgate uses encryption to ensure use from authorised sources. -# This should point to the public key generated by Floodgate (Bungee or CraftBukkit) +# This should point to the public key generated by Floodgate (BungeeCord, Spigot or Velocity) # You can ignore this when not using Floodgate. -floodgate-key-file: public-key.pem +floodgate-key-file: key.pem ## the Xbox/MCPE username is the key for the Java server auth-info ## this allows automatic configuration/login to the remote Java server From 7f4b588cdfe16df614fc1ce5f6b723589965809e Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Fri, 16 Oct 2020 15:25:05 -0800 Subject: [PATCH 008/766] server inventory. WORK IN PROGRESS wip commit of implementing server authoritative inventories. there is a lot of experimental and debug code. this is NOT ready for testing or review. --- .../org/geysermc/connector/entity/Entity.java | 8 +- .../connector/inventory/Container.java | 69 +++ .../inventory/EnchantmentInventory.java | 40 ++ .../connector/inventory/FurnaceInventory.java | 41 ++ .../connector/inventory/GeyserItemStack.java | 123 +++++ .../connector/inventory/Inventory.java | 30 +- .../inventory/MerchantContainer.java | 44 ++ .../connector/inventory/PlayerInventory.java | 22 +- .../network/session/GeyserSession.java | 81 ++- .../network/session/cache/InventoryCache.java | 61 --- .../BedrockContainerCloseTranslator.java | 32 +- ...BedrockInventoryTransactionTranslator.java | 45 +- .../BedrockItemStackRequestTranslator.java | 49 ++ .../BedrockMobEquipmentTranslator.java | 4 +- .../entity/BedrockEntityEventTranslator.java | 32 +- .../player/BedrockInteractTranslator.java | 7 +- .../inventory/AnvilInventoryTranslator.java | 167 ------- .../inventory/BaseInventoryTranslator.java | 50 +- .../inventory/BedrockContainerSlot.java | 36 ++ .../inventory/BlockInventoryTranslator.java | 72 --- .../inventory/BrewingInventoryTranslator.java | 99 ---- .../inventory/ChestInventoryTranslator.java | 20 +- .../CraftingInventoryTranslator.java | 89 ---- .../EnchantmentInventoryTranslator.java | 267 ---------- .../inventory/FurnaceInventoryTranslator.java | 70 --- .../GrindstoneInventoryTranslator.java | 69 --- .../inventory/InventoryTranslator.java | 460 +++++++++++++++++- .../MerchantInventoryTranslator.java | 92 ++-- .../inventory/PlayerInventoryTranslator.java | 115 ++--- .../SmithingInventoryTranslator.java | 69 --- .../inventory/action/ClickPlan.java | 125 ----- .../action/InventoryActionDataTranslator.java | 338 ------------- .../inventory/{action => click}/Click.java | 17 +- .../inventory/click/ClickPlan.java | 211 ++++++++ .../updater/ChestInventoryUpdater.java | 4 +- .../updater/ContainerInventoryUpdater.java | 4 +- .../inventory/updater/InventoryUpdater.java | 4 +- ...ryUpdater.java => UIInventoryUpdater.java} | 7 +- .../java/JavaDeclareRecipesTranslator.java | 11 +- .../java/JavaRespawnTranslator.java | 2 +- .../player/JavaPlayerActionAckTranslator.java | 13 +- .../JavaPlayerChangeHeldItemTranslator.java | 14 +- .../window/JavaCloseWindowTranslator.java | 6 +- .../JavaConfirmTransactionTranslator.java | 11 +- .../java/window/JavaOpenWindowTranslator.java | 77 +-- .../java/window/JavaSetSlotTranslator.java | 54 +- .../window/JavaWindowItemsTranslator.java | 36 +- .../window/JavaWindowPropertyTranslator.java | 17 +- .../world/JavaNotifyClientTranslator.java | 2 +- .../java/world/JavaTradeListTranslator.java | 35 +- .../sound/BlockSoundInteractionHandler.java | 9 +- .../sound/EntitySoundInteractionHandler.java | 9 +- .../block/BucketSoundInteractionHandler.java | 2 +- .../MilkCowSoundInteractionHandler.java | 2 +- .../geysermc/connector/utils/BlockUtils.java | 2 +- .../connector/utils/InventoryUtils.java | 91 ++-- connector/src/main/resources/languages | 2 +- connector/src/main/resources/mappings | 2 +- 58 files changed, 1611 insertions(+), 1859 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/inventory/Container.java create mode 100644 connector/src/main/java/org/geysermc/connector/inventory/EnchantmentInventory.java create mode 100644 connector/src/main/java/org/geysermc/connector/inventory/FurnaceInventory.java create mode 100644 connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java create mode 100644 connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/session/cache/InventoryCache.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/BlockInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/EnchantmentInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/FurnaceInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/GrindstoneInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/SmithingInventoryTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/ClickPlan.java delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java rename connector/src/main/java/org/geysermc/connector/network/translators/inventory/{action => click}/Click.java (66%) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java rename connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/{CursorInventoryUpdater.java => UIInventoryUpdater.java} (89%) diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index 5e825e892..57c827a9f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -50,6 +50,7 @@ import org.geysermc.connector.entity.attribute.Attribute; import org.geysermc.connector.entity.attribute.AttributeType; import org.geysermc.connector.entity.living.ArmorStandEntity; import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.utils.AttributeUtils; @@ -288,11 +289,12 @@ public class Entity { // Shield code if (session.getPlayerEntity().getEntityId() == entityId && metadata.getFlags().getFlag(EntityFlag.SNEAKING)) { - if ((session.getInventory().getItemInHand() != null && session.getInventory().getItemInHand().getId() == ItemRegistry.SHIELD.getJavaId()) || - (session.getInventoryCache().getPlayerInventory().getItem(45) != null && session.getInventoryCache().getPlayerInventory().getItem(45).getId() == ItemRegistry.SHIELD.getJavaId())) { + PlayerInventory playerInv = session.getPlayerInventory(); + if ((playerInv.getItemInHand().getId() == ItemRegistry.SHIELD.getJavaId()) || + (playerInv.getOffhand().getId() == ItemRegistry.SHIELD.getJavaId())) { ClientPlayerUseItemPacket useItemPacket; metadata.getFlags().setFlag(EntityFlag.BLOCKING, true); - if (session.getInventory().getItemInHand() != null && session.getInventory().getItemInHand().getId() == ItemRegistry.SHIELD.getJavaId()) { + if (playerInv.getItemInHand().getId() == ItemRegistry.SHIELD.getJavaId()) { useItemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); } // Else we just assume it's the offhand, to simplify logic and to assure the packet gets sent diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Container.java b/connector/src/main/java/org/geysermc/connector/inventory/Container.java new file mode 100644 index 000000000..acf450e14 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/inventory/Container.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2019-2020 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.connector.inventory; + +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import lombok.Getter; +import lombok.NonNull; +import org.geysermc.connector.network.translators.inventory.InventoryTranslator; + +/** + * Combination of {@link Inventory} and {@link PlayerInventory} + */ +@Getter +public class Container extends Inventory { + private final PlayerInventory playerInventory; + private final int containerSize; + + public Container(String title, int id, WindowType windowType, int size, PlayerInventory playerInventory) { + super(title, id, windowType, size); + this.playerInventory = playerInventory; + this.containerSize = this.size + InventoryTranslator.PLAYER_INVENTORY_SIZE; + } + + @Override + public GeyserItemStack getItem(int slot) { + if (slot < this.size) { + return super.getItem(slot); + } else { + return playerInventory.getItem(slot - this.size + InventoryTranslator.PLAYER_INVENTORY_OFFSET); + } + } + + @Override + public void setItem(int slot, @NonNull GeyserItemStack item) { + if (slot < this.size) { + super.setItem(slot, item); + } else { + playerInventory.setItem(slot - this.size + InventoryTranslator.PLAYER_INVENTORY_OFFSET, item); + } + } + + @Override + public int getSize() { + return this.containerSize; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/inventory/EnchantmentInventory.java b/connector/src/main/java/org/geysermc/connector/inventory/EnchantmentInventory.java new file mode 100644 index 000000000..65debc486 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/inventory/EnchantmentInventory.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019-2020 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.connector.inventory; + +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; +import lombok.Getter; + +@Getter +public class EnchantmentInventory extends Inventory { + private EnchantOptionData[] enchantOptions; + + public EnchantmentInventory(String title, int id, WindowType windowType, int size) { + super(title, id, windowType, size); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/inventory/FurnaceInventory.java b/connector/src/main/java/org/geysermc/connector/inventory/FurnaceInventory.java new file mode 100644 index 000000000..4dc098d89 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/inventory/FurnaceInventory.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019-2020 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.connector.inventory; + +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import lombok.Getter; +import lombok.Setter; + +@Getter +public class FurnaceInventory extends Inventory { + @Setter + private int test; + + public FurnaceInventory(String title, int id, WindowType windowType, int size) { + super(title, id, windowType, size); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java b/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java new file mode 100644 index 000000000..c935fcdb4 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2019-2020 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.connector.inventory; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import lombok.Data; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.item.ItemEntry; +import org.geysermc.connector.network.translators.item.ItemRegistry; +import org.geysermc.connector.network.translators.item.ItemTranslator; + +@Data +public class GeyserItemStack { + public static final GeyserItemStack EMPTY = new GeyserItemStack(0, 0, null); + + private final int id; + private int amount; + private CompoundTag nbt; + private int netId; + + public GeyserItemStack(int id) { + this(id, 1); + } + + public GeyserItemStack(int id, int amount) { + this(id, amount, null); + } + + public GeyserItemStack(int id, int amount, CompoundTag nbt) { + this(id, amount, nbt, 1); + } + + public GeyserItemStack(int id, int amount, CompoundTag nbt, int netId) { + this.id = id; + this.amount = amount; + this.nbt = nbt; + this.netId = netId; + } + + public int getId() { + return isEmpty() ? 0 : id; + } + + public int getAmount() { + return isEmpty() ? 0 : amount; + } + + public CompoundTag getNbt() { + return isEmpty() ? null : nbt; + } + + public int getNetId() { + return isEmpty() ? 0 : netId; + } + + public void add(int add) { + amount += add; + } + + public void sub(int sub) { + amount -= sub; + } + + public static GeyserItemStack from(ItemStack itemStack) { + return from(itemStack, 1); + } + + public static GeyserItemStack from(ItemStack itemStack, int netId) { + return itemStack == null ? EMPTY : new GeyserItemStack(itemStack.getId(), itemStack.getAmount(), itemStack.getNbt(), netId); + } + + public ItemStack getItemStack() { + return isEmpty() ? null : new ItemStack(id, amount, nbt); + } + + public ItemData getItemData(GeyserSession session) { + ItemData itemData = ItemTranslator.translateToBedrock(session, getItemStack()); + itemData.setNetId(getNetId()); + return itemData; + } + + public ItemEntry getItemEntry() { + return ItemRegistry.ITEM_ENTRIES.get(getId()); + } + + public boolean isEmpty() { + return amount <= 0 || id == 0; + } + + public GeyserItemStack copy() { + return copy(amount); + } + + public GeyserItemStack copy(int newAmount) { + return isEmpty() ? EMPTY : new GeyserItemStack(id, newAmount, nbt == null ? null : nbt.clone(), netId); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java index 539fe1e26..f4aea4c90 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java @@ -25,23 +25,19 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.window.WindowType; import com.nukkitx.math.vector.Vector3i; import lombok.Getter; +import lombok.NonNull; import lombok.Setter; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.Arrays; public class Inventory { @Getter protected int id; - @Getter - @Setter - protected boolean open; - @Getter protected WindowType windowType; @@ -52,8 +48,7 @@ public class Inventory { @Setter protected String title; - @Setter - protected ItemStack[] items; + protected GeyserItemStack[] items; @Getter @Setter @@ -64,27 +59,30 @@ public class Inventory { protected long holderId = -1; @Getter - protected AtomicInteger transactionId = new AtomicInteger(1); + protected short transactionId = 0; - public Inventory(int id, WindowType windowType, int size) { + protected Inventory(int id, WindowType windowType, int size) { this("Inventory", id, windowType, size); } - public Inventory(String title, int id, WindowType windowType, int size) { + protected Inventory(String title, int id, WindowType windowType, int size) { this.title = title; this.id = id; this.windowType = windowType; this.size = size; - this.items = new ItemStack[size]; + this.items = new GeyserItemStack[size]; + Arrays.fill(items, GeyserItemStack.EMPTY); } - public ItemStack getItem(int slot) { + public GeyserItemStack getItem(int slot) { return items[slot]; } - public void setItem(int slot, ItemStack item) { - if (item != null && (item.getId() == 0 || item.getAmount() < 1)) - item = null; + public void setItem(int slot, @NonNull GeyserItemStack item) { items[slot] = item; } + + public short getNextTransactionId() { + return ++transactionId; + } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java new file mode 100644 index 000000000..03ae8ac3a --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019-2020 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.connector.inventory; + +import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import lombok.Getter; +import lombok.Setter; +import org.geysermc.connector.entity.Entity; + +@Getter +@Setter +public class MerchantContainer extends Container { + private Entity villager; + private VillagerTrade[] villagerTrades; + + public MerchantContainer(String title, int id, WindowType windowType, int size, PlayerInventory playerInventory) { + super(title, id, windowType, size, playerInventory); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java b/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java index 225335a97..e6aeb5cab 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java @@ -25,8 +25,8 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import lombok.Getter; +import lombok.NonNull; import lombok.Setter; public class PlayerInventory extends Inventory { @@ -40,20 +40,24 @@ public class PlayerInventory extends Inventory { private int heldItemSlot; @Getter - private ItemStack cursor; + @Setter + @NonNull + private GeyserItemStack cursor = GeyserItemStack.EMPTY; public PlayerInventory() { super(0, null, 46); heldItemSlot = 0; } - public void setCursor(ItemStack stack) { - if (stack != null && (stack.getId() == 0 || stack.getAmount() < 1)) - stack = null; - cursor = stack; - } - - public ItemStack getItemInHand() { + public GeyserItemStack getItemInHand() { return items[36 + heldItemSlot]; } + + public void setItemInHand(@NonNull GeyserItemStack item) { + items[36 + heldItemSlot] = item; + } + + public GeyserItemStack getOffhand() { + return items[45]; + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 1a0bbfb29..1d8120f37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -32,6 +32,7 @@ import com.github.steveice10.mc.protocol.MinecraftConstants; import com.github.steveice10.mc.protocol.MinecraftProtocol; import com.github.steveice10.mc.protocol.data.SubProtocol; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; +import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; import com.github.steveice10.mc.protocol.data.message.MessageSerializer; import com.github.steveice10.mc.protocol.packet.handshake.client.HandshakePacket; @@ -49,11 +50,14 @@ import com.nukkitx.protocol.bedrock.BedrockServerSession; import com.nukkitx.protocol.bedrock.data.*; import com.nukkitx.protocol.bedrock.data.command.CommandPermission; import com.nukkitx.protocol.bedrock.packet.*; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; +import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.geysermc.common.window.CustomFormWindow; @@ -63,6 +67,7 @@ import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.PlayerEntity; +import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.remote.RemoteServer; import org.geysermc.connector.network.session.auth.AuthData; @@ -71,7 +76,6 @@ import org.geysermc.connector.network.session.cache.*; import org.geysermc.connector.network.translators.BiomeTranslator; import org.geysermc.connector.network.translators.EntityIdentifierRegistry; import org.geysermc.connector.network.translators.PacketTranslatorRegistry; -import org.geysermc.connector.network.translators.inventory.EnchantmentInventoryTranslator; import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.utils.*; @@ -83,6 +87,12 @@ import java.net.InetSocketAddress; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.spec.InvalidKeySpecException; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; import java.util.*; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicInteger; @@ -100,11 +110,20 @@ public class GeyserSession implements CommandSender { private BedrockClientData clientData; private PlayerEntity playerEntity; - private PlayerInventory inventory; + + private final PlayerInventory playerInventory; + @Setter + private Inventory openInventory; + + private final AtomicInteger itemNetId = new AtomicInteger(1); + + @Getter(AccessLevel.NONE) + private final Object inventoryLock = new Object(); + @Getter(AccessLevel.NONE) + private CompletableFuture inventoryFuture; private ChunkCache chunkCache; private EntityCache entityCache; - private InventoryCache inventoryCache; private WorldCache worldCache; private WindowCache windowCache; @Setter @@ -170,9 +189,6 @@ public class GeyserSession implements CommandSender { @Setter private Entity ridingVehicleEntity; - @Setter - private int craftSlot = 0; - @Setter private long lastWindowCloseTime = 0; @@ -187,10 +203,8 @@ public class GeyserSession implements CommandSender { @Setter private long lastInteractedVillagerEid; - /** - * Stores the enchantment information the client has received if they are in an enchantment table GUI - */ - private final EnchantmentInventoryTranslator.EnchantmentSlotData[] enchantmentSlotData = new EnchantmentInventoryTranslator.EnchantmentSlotData[3]; + @Setter + private Int2ObjectMap craftingRecipes; /** * The current attack speed of the player. Used for sending proper cooldown timings. @@ -282,18 +296,19 @@ public class GeyserSession implements CommandSender { this.chunkCache = new ChunkCache(this); this.entityCache = new EntityCache(this); - this.inventoryCache = new InventoryCache(this); this.worldCache = new WorldCache(this); this.windowCache = new WindowCache(this); this.playerEntity = new PlayerEntity(new GameProfile(UUID.randomUUID(), "unknown"), 1, 1, Vector3f.ZERO, Vector3f.ZERO, Vector3f.ZERO); - this.inventory = new PlayerInventory(); + + this.playerInventory = new PlayerInventory(); + this.openInventory = null; + this.inventoryFuture = CompletableFuture.completedFuture(null); + this.craftingRecipes = new Int2ObjectOpenHashMap<>(); this.spawned = false; this.loggedIn = false; - this.inventoryCache.getInventories().put(0, inventory); - bedrockServerSession.addDisconnectHandler(disconnectReason -> { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.disconnect", bedrockServerSession.getAddress().getAddress(), disconnectReason)); @@ -529,7 +544,6 @@ public class GeyserSession implements CommandSender { this.chunkCache = null; this.entityCache = null; this.worldCache = null; - this.inventoryCache = null; this.windowCache = null; closed = true; @@ -638,10 +652,47 @@ public class GeyserSession implements CommandSender { startGamePacket.setBlockPalette(BlockTranslator.BLOCKS); startGamePacket.setItemEntries(ItemRegistry.ITEMS); startGamePacket.setVanillaVersion("*"); + // startGamePacket.setMovementServerAuthoritative(true); + startGamePacket.setInventoriesServerAuthoritative(true); startGamePacket.setAuthoritativeMovementMode(AuthoritativeMovementMode.CLIENT); upstream.sendPacket(startGamePacket); } + /** + * Adds a new inventory task. + * Inventory tasks are executed one at a time, in order. + * + * @param task the task to run + */ + public void addInventoryTask(Runnable task) { + synchronized (inventoryLock) { + System.out.println("new task " + task.toString()); + inventoryFuture = inventoryFuture.thenRun(task).exceptionally(throwable -> { + GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause()); + return null; + }); + } + } + + /** + * Adds a new inventory task with a delay. + * The delay is achieved by scheduling with the Geyser general thread pool. + * Inventory tasks are executed one at a time, in order. + * + * @param task the delayed task to run + * @param delayMillis delay in milliseconds + */ + public void addInventoryTask(Runnable task, long delayMillis) { + synchronized (inventoryLock) { + System.out.println("new delayed task " + task.toString()); + Executor delayedExecutor = command -> GeyserConnector.getInstance().getGeneralThreadPool().schedule(command, delayMillis, TimeUnit.MILLISECONDS); + inventoryFuture = inventoryFuture.thenRunAsync(task, delayedExecutor).exceptionally(throwable -> { + GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause()); + return null; + }); + } + } + public boolean confirmTeleport(Vector3d position) { if (teleportCache != null) { if (!teleportCache.canConfirm(position)) { diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/InventoryCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/InventoryCache.java deleted file mode 100644 index 032f64024..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/InventoryCache.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.session.cache; - -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import lombok.Getter; -import lombok.Setter; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; - -public class InventoryCache { - - private GeyserSession session; - - @Getter - @Setter - private Inventory openInventory; - - @Getter - private Int2ObjectMap inventories = new Int2ObjectOpenHashMap<>(); - - public InventoryCache(GeyserSession session) { - this.session = session; - } - - public Inventory getPlayerInventory() { - return inventories.get(0); - } - - public void cacheInventory(Inventory inventory) { - inventories.put(inventory.getId(), inventory); - } - - public void uncacheInventory(int id) { - inventories.remove(id); - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java index 00905f6d9..5571ff8b9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java @@ -38,24 +38,24 @@ public class BedrockContainerCloseTranslator extends PacketTranslator { + session.setLastWindowCloseTime(0); + byte windowId = packet.getId(); + + if (windowId == -1 && session.getOpenInventory() != null) { + windowId = (byte) session.getOpenInventory().getId(); } - } - if (windowId == 0 || (openInventory != null && openInventory.getId() == windowId)) { - ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId); - session.getDownstream().getSession().send(closeWindowPacket); - InventoryUtils.closeInventory(session, windowId); - } + Inventory openInventory = session.getOpenInventory(); + if (openInventory != null && windowId == openInventory.getId()) { + System.out.println(packet); + ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId); + session.getDownstream().getSession().send(closeWindowPacket); + InventoryUtils.closeInventory(session, windowId); + } - //Client wants close confirmation - session.sendUpstreamPacket(packet); + //Client wants close confirmation + session.sendUpstreamPacket(packet); + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index b81025beb..9dd0f1996 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -25,7 +25,6 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; @@ -43,23 +42,23 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; +import com.nukkitx.protocol.bedrock.data.inventory.InventorySource; import com.nukkitx.protocol.bedrock.packet.InventoryTransactionPacket; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import org.geysermc.connector.entity.CommandBlockMinecartEntity; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ItemFrameEntity; import org.geysermc.connector.entity.living.merchant.AbstractMerchantEntity; -import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.network.translators.item.ItemEntry; import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.network.translators.sound.EntitySoundInteractionHandler; import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.utils.BlockUtils; -import org.geysermc.connector.utils.InventoryUtils; import java.util.concurrent.TimeUnit; @@ -70,15 +69,36 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { + if (session.getPlayerInventory().getHeldItemSlot() != containerAction.getSlot()) + return; + if (session.getPlayerInventory().getItemInHand().isEmpty()) + return; + + boolean dropAll = worldAction.getToItem().getCount() > 1; + ClientPlayerActionPacket dropAllPacket = new ClientPlayerActionPacket( + dropAll ? PlayerAction.DROP_ITEM_STACK : PlayerAction.DROP_ITEM, + new Position(0, 0, 0), + BlockFace.DOWN + ); + session.sendDownstreamPacket(dropAllPacket); + + if (dropAll) { + session.getPlayerInventory().setItemInHand(GeyserItemStack.EMPTY); + } else { + session.getPlayerInventory().getItemInHand().sub(1); + } + }); + } + } break; case INVENTORY_MISMATCH: - Inventory inv = session.getInventoryCache().getOpenInventory(); - if (inv == null) inv = session.getInventory(); - InventoryTranslator.INVENTORY_TRANSLATORS.get(inv.getWindowType()).updateInventory(session, inv); - InventoryUtils.updateCursor(session); break; case ITEM_USE: switch (packet.getActionType()) { @@ -164,9 +184,8 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { + + @Override + public void translate(ItemStackRequestPacket packet, GeyserSession session) { + Inventory inventory = session.getOpenInventory(); + if (inventory == null) + return; + + InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); + session.addInventoryTask(() -> translator.translateRequests(session, inventory, packet.getRequests())); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java index a220e389f..ade949199 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java @@ -40,12 +40,12 @@ public class BedrockMobEquipmentTranslator extends PacketTranslator 8 || - packet.getContainerId() != ContainerId.INVENTORY || session.getInventory().getHeldItemSlot() == packet.getHotbarSlot()) { + packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) { // For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention return; } - session.getInventory().setHeldItemSlot(packet.getHotbarSlot()); + session.getPlayerInventory().setHeldItemSlot(packet.getHotbarSlot()); ClientPlayerChangeHeldItemPacket changeHeldItemPacket = new ClientPlayerChangeHeldItemPacket(packet.getHotbarSlot()); session.sendDownstreamPacket(changeHeldItemPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index 18fd6614e..eaf352da9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -26,12 +26,13 @@ package org.geysermc.connector.network.translators.bedrock.entity; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSelectTradePacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.inventory.MerchantContainer; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -47,20 +48,25 @@ public class BedrockEntityEventTranslator extends PacketTranslator { + ClientSelectTradePacket selectTradePacket = new ClientSelectTradePacket(packet.getData()); + session.getDownstream().getSession().send(selectTradePacket); + }); - Entity villager = session.getPlayerEntity(); - Inventory openInventory = session.getInventoryCache().getOpenInventory(); - if (openInventory != null && openInventory.getWindowType() == WindowType.MERCHANT) { - VillagerTrade[] trades = session.getVillagerTrades(); - if (trades != null && packet.getData() >= 0 && packet.getData() < trades.length) { - VillagerTrade trade = session.getVillagerTrades()[packet.getData()]; - openInventory.setItem(2, trade.getOutput()); - villager.getMetadata().put(EntityData.TRADE_XP, trade.getXp() + villager.getMetadata().getInt(EntityData.TRADE_XP)); - villager.updateBedrockMetadata(session); + session.addInventoryTask(() -> { + Entity villager = session.getPlayerEntity(); + Inventory openInventory = session.getOpenInventory(); + if (openInventory instanceof MerchantContainer) { + MerchantContainer merchantInventory = (MerchantContainer) openInventory; + VillagerTrade[] trades = merchantInventory.getVillagerTrades(); + if (trades != null && packet.getData() >= 0 && packet.getData() < trades.length) { + VillagerTrade trade = merchantInventory.getVillagerTrades()[packet.getData()]; + openInventory.setItem(2, GeyserItemStack.from(trade.getOutput())); + villager.getMetadata().put(EntityData.TRADE_XP, trade.getXp() + villager.getMetadata().getInt(EntityData.TRADE_XP)); + villager.updateBedrockMetadata(session); + } } - } + }, 100); return; } session.getConnector().getLogger().debug("Did not translate incoming EntityEventPacket: " + packet.toString()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java index c5d6f2dda..ff261aba7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java @@ -60,7 +60,7 @@ public class BedrockInteractTranslator extends PacketTranslator switch (packet.getAction()) { case INTERACT: - if (session.getInventory().getItem(session.getInventory().getHeldItemSlot() + 36).getId() == ItemRegistry.SHIELD.getJavaId()) { + if (session.getPlayerInventory().getItemInHand().getId() == ItemRegistry.SHIELD.getJavaId()) { break; } ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(), @@ -135,14 +135,15 @@ public class BedrockInteractTranslator extends PacketTranslator } break; case OPEN_INVENTORY: - if (!session.getInventory().isOpen()) { + if (session.getOpenInventory() == null) { + session.setOpenInventory(session.getPlayerInventory()); + ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) 0); containerOpenPacket.setType(ContainerType.INVENTORY); containerOpenPacket.setUniqueEntityId(-1); containerOpenPacket.setBlockPosition(entity.getPosition().toInt()); session.sendUpstreamPacket(containerOpenPacket); - session.getInventory().setOpen(true); } break; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java deleted file mode 100644 index ab266faef..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/AnvilInventoryTranslator.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket; -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.google.gson.JsonSyntaxException; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.protocol.bedrock.data.inventory.*; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; - -import java.util.List; -import java.util.stream.Collectors; - -public class AnvilInventoryTranslator extends BlockInventoryTranslator { - public AnvilInventoryTranslator() { - super(3, "minecraft:anvil[facing=north]", ContainerType.ANVIL, new CursorInventoryUpdater()); - } - - @Override - public int bedrockSlotToJava(InventoryActionData action) { - if (action.getSource().getContainerId() == ContainerId.UI) { - switch (action.getSlot()) { - case 1: - return 0; - case 2: - return 1; - case 50: - return 2; - } - } - if (action.getSource().getContainerId() == ContainerId.ANVIL_RESULT) { - return 2; - } - return super.bedrockSlotToJava(action); - } - - @Override - public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 1; - case 1: - return 2; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); - } - - @Override - public SlotType getSlotType(int javaSlot) { - if (javaSlot == 2) - return SlotType.OUTPUT; - return SlotType.NORMAL; - } - - @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - InventoryActionData anvilResult = null; - InventoryActionData anvilInput = null; - for (InventoryActionData action : actions) { - if (action.getSource().getContainerId() == ContainerId.ANVIL_MATERIAL) { - //useless packet - return; - } else if (action.getSource().getContainerId() == ContainerId.ANVIL_RESULT) { - anvilResult = action; - } else if (bedrockSlotToJava(action) == 0) { - anvilInput = action; - } - } - ItemData itemName = null; - if (anvilResult != null) { - itemName = anvilResult.getFromItem(); - } else if (anvilInput != null) { - itemName = anvilInput.getToItem(); - } - if (itemName != null) { - String rename; - NbtMap tag = itemName.getTag(); - if (tag != null && tag.containsKey("display")) { - String name = tag.getCompound("display").getString("Name"); - try { - Component component = GsonComponentSerializer.gson().deserialize(name); - rename = LegacyComponentSerializer.legacySection().serialize(component); - } catch (JsonSyntaxException e) { - rename = name; - } - } else { - rename = ""; - } - ClientRenameItemPacket renameItemPacket = new ClientRenameItemPacket(rename); - session.sendDownstreamPacket(renameItemPacket); - } - if (anvilResult != null) { - //Strip unnecessary actions - List strippedActions = actions.stream() - .filter(action -> action.getSource().getContainerId() == ContainerId.ANVIL_RESULT - || (action.getSource().getType() == InventorySource.Type.CONTAINER - && !(action.getSource().getContainerId() == ContainerId.UI && action.getSlot() != 0))) - .collect(Collectors.toList()); - super.translateActions(session, inventory, strippedActions); - return; - } - - super.translateActions(session, inventory, actions); - } - - @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { - if (slot == 0) { - ItemStack item = inventory.getItem(slot); - if (item != null) { - String rename; - CompoundTag tag = item.getNbt(); - if (tag != null) { - CompoundTag displayTag = tag.get("display"); - if (displayTag != null && displayTag.contains("Name")) { - String itemName = displayTag.get("Name").getValue().toString(); - try { - Component component = GsonComponentSerializer.gson().deserialize(itemName); - rename = LegacyComponentSerializer.legacySection().serialize(component); - } catch (JsonSyntaxException e) { - rename = itemName; - } - } else { - rename = ""; - } - } else { - rename = ""; - } - ClientRenameItemPacket renameItemPacket = new ClientRenameItemPacket(rename); - session.sendDownstreamPacket(renameItemPacket); - } - } - super.updateSlot(session, inventory, slot); - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java index 6f00fc4d7..7d54667bd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BaseInventoryTranslator.java @@ -25,15 +25,15 @@ package org.geysermc.connector.network.translators.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; +import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import org.geysermc.connector.inventory.Container; import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.action.InventoryActionDataTranslator; -import java.util.List; - -public abstract class BaseInventoryTranslator extends InventoryTranslator{ +public abstract class BaseInventoryTranslator extends InventoryTranslator { BaseInventoryTranslator(int size) { super(size); } @@ -44,15 +44,18 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator{ } @Override - public int bedrockSlotToJava(InventoryActionData action) { - int slotnum = action.getSlot(); - if (action.getSource().getContainerId() == ContainerId.INVENTORY) { - //hotbar - if (slotnum >= 9) { - return slotnum + this.size - 9; - } else { - return slotnum + this.size + 27; - } + public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + int slotnum = slotInfoData.getSlot(); + switch (slotInfoData.getContainer()) { + case HOTBAR_AND_INVENTORY: + case HOTBAR: + case INVENTORY: + //hotbar + if (slotnum >= 9) { + return slotnum + this.size - 9; + } else { + return slotnum + this.size + 27; + } } return slotnum; } @@ -70,13 +73,26 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator{ return slot; } + @Override + public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { + if (slot >= this.size) { + final int tmp = slot - this.size; + if (tmp < 27) { + return new BedrockContainerSlot(ContainerSlotType.INVENTORY, tmp + 9); + } else { + return new BedrockContainerSlot(ContainerSlotType.HOTBAR, tmp - 27); + } + } + throw new IllegalArgumentException("Unknown bedrock slot"); + } + @Override public SlotType getSlotType(int javaSlot) { return SlotType.NORMAL; } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - InventoryActionDataTranslator.translate(this, session, inventory, actions); + public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { + return new Container(name, windowId, windowType, this.size, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java new file mode 100644 index 000000000..b3a09e167 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019-2020 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.connector.network.translators.inventory; + +import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; +import lombok.Value; + +@Value +public class BedrockContainerSlot { + ContainerSlotType container; + int slot; +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BlockInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BlockInventoryTranslator.java deleted file mode 100644 index 4b8b57e8f..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BlockInventoryTranslator.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockTranslator; -import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.connector.network.translators.inventory.holder.InventoryHolder; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; - -public class BlockInventoryTranslator extends BaseInventoryTranslator { - private final InventoryHolder holder; - private final InventoryUpdater updater; - - public BlockInventoryTranslator(int size, String javaBlockIdentifier, ContainerType containerType, InventoryUpdater updater) { - super(size); - int javaBlockState = BlockTranslator.getJavaBlockState(javaBlockIdentifier); - int blockId = BlockTranslator.getBedrockBlockId(javaBlockState); - this.holder = new BlockInventoryHolder(blockId, containerType); - this.updater = updater; - } - - @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { - holder.prepareInventory(this, session, inventory); - } - - @Override - public void openInventory(GeyserSession session, Inventory inventory) { - holder.openInventory(this, session, inventory); - } - - @Override - public void closeInventory(GeyserSession session, Inventory inventory) { - holder.closeInventory(this, session, inventory); - } - - @Override - public void updateInventory(GeyserSession session, Inventory inventory) { - updater.updateInventory(this, session, inventory); - } - - @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { - updater.updateSlot(this, session, inventory, slot); - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java deleted file mode 100644 index 89cdbe8d7..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BrewingInventoryTranslator.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; - -public class BrewingInventoryTranslator extends BlockInventoryTranslator { - public BrewingInventoryTranslator() { - super(5, "minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=false,has_bottle_2=false]", ContainerType.BREWING_STAND, new ContainerInventoryUpdater()); - } - - @Override - public void openInventory(GeyserSession session, Inventory inventory) { - super.openInventory(session, inventory); - ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); - dataPacket.setWindowId((byte) inventory.getId()); - dataPacket.setProperty(ContainerSetDataPacket.BREWING_STAND_FUEL_TOTAL); - dataPacket.setValue(20); - session.sendUpstreamPacket(dataPacket); - } - - @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { - ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); - dataPacket.setWindowId((byte) inventory.getId()); - switch (key) { - case 0: - dataPacket.setProperty(ContainerSetDataPacket.BREWING_STAND_BREW_TIME); - break; - case 1: - dataPacket.setProperty(ContainerSetDataPacket.BREWING_STAND_FUEL_AMOUNT); - break; - default: - return; - } - dataPacket.setValue(value); - session.sendUpstreamPacket(dataPacket); - } - - @Override - public int bedrockSlotToJava(InventoryActionData action) { - final int slot = super.bedrockSlotToJava(action); - switch (slot) { - case 0: - return 3; - case 1: - return 0; - case 2: - return 1; - case 3: - return 2; - default: - return slot; - } - } - - @Override - public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 1; - case 1: - return 2; - case 2: - return 3; - case 3: - return 0; - } - return super.javaSlotToBedrock(slot); - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/ChestInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/ChestInventoryTranslator.java index 152f4a852..df97563e5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/ChestInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/ChestInventoryTranslator.java @@ -25,14 +25,11 @@ package org.geysermc.connector.network.translators.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; +import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.inventory.updater.ChestInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; -import org.geysermc.connector.utils.InventoryUtils; - -import java.util.List; public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; @@ -53,17 +50,10 @@ public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - for (InventoryActionData action : actions) { - if (action.getSource().getContainerId() == inventory.getId()) { - if (action.getSlot() >= size) { - updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - } - } + public BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot) { + if (javaSlot < this.size) { + return new BedrockContainerSlot(ContainerSlotType.CONTAINER, javaSlot); } - - super.translateActions(session, inventory, actions); + return super.javaSlotToBedrockContainer(javaSlot); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java deleted file mode 100644 index b260565b8..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/CraftingInventoryTranslator.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import com.nukkitx.protocol.bedrock.data.inventory.InventorySource; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; -import org.geysermc.connector.utils.InventoryUtils; - -import java.util.List; - -public class CraftingInventoryTranslator extends BlockInventoryTranslator { - public CraftingInventoryTranslator() { - super(10, "minecraft:crafting_table", ContainerType.WORKBENCH, new CursorInventoryUpdater()); - } - - @Override - public int bedrockSlotToJava(InventoryActionData action) { - if (action.getSlot() == 50) { - // Slot 50 is used for crafting with a controller. - return 0; - } - - if (action.getSource().getContainerId() == ContainerId.UI) { - int slotnum = action.getSlot(); - if (slotnum >= 32 && 42 >= slotnum) { - return slotnum - 31; - } - } - return super.bedrockSlotToJava(action); - } - - @Override - public int javaSlotToBedrock(int slot) { - if (slot < size) { - return slot == 0 ? 50 : slot + 31; - } - return super.javaSlotToBedrock(slot); - } - - @Override - public SlotType getSlotType(int javaSlot) { - if (javaSlot == 0) - return SlotType.OUTPUT; - return SlotType.NORMAL; - } - - @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - if (session.getGameMode() == GameMode.CREATIVE) { - for (InventoryActionData action : actions) { - if (action.getSource().getType() == InventorySource.Type.CREATIVE) { - updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - } - } - } - super.translateActions(session, inventory, actions); - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/EnchantmentInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/EnchantmentInventoryTranslator.java deleted file mode 100644 index cbcdce10b..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/EnchantmentInventoryTranslator.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClickWindowButtonPacket; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; -import com.nukkitx.nbt.NbtType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.utils.InventoryUtils; -import org.geysermc.connector.utils.LocaleUtils; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * A temporary reconstruction of the enchantment table UI until our inventory rewrite is complete. - * The enchantment table on Bedrock without server authoritative inventories doesn't tell us which button is pressed - * when selecting an enchantment. - */ -public class EnchantmentInventoryTranslator extends BlockInventoryTranslator { - - private static final int DYE_ID = 351; - private static final short LAPIS_DAMAGE = 4; - private static final int ENCHANTED_BOOK_ID = 403; - - public EnchantmentInventoryTranslator(InventoryUpdater updater) { - super(2, "minecraft:hopper[enabled=false,facing=down]", ContainerType.HOPPER, updater); - } - - @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - for (InventoryActionData action : actions) { - if (action.getSource().getContainerId() == inventory.getId()) { - // This is the hopper UI - switch (action.getSlot()) { - case 1: - // Don't allow the slot to be put through if the item isn't lapis - if ((action.getToItem().getId() != DYE_ID - && action.getToItem().getDamage() != LAPIS_DAMAGE) && action.getToItem() != ItemData.AIR) { - updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - } - break; - case 2: - case 3: - case 4: - // The books here act as buttons - ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), action.getSlot() - 2); - session.sendDownstreamPacket(packet); - updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - default: - break; - } - } - } - - super.translateActions(session, inventory, actions); - } - - @Override - public void updateInventory(GeyserSession session, Inventory inventory) { - super.updateInventory(session, inventory); - ItemData[] items = new ItemData[5]; - items[0] = ItemTranslator.translateToBedrock(session, inventory.getItem(0)); - items[1] = ItemTranslator.translateToBedrock(session, inventory.getItem(1)); - for (int i = 0; i < 3; i++) { - items[i + 2] = session.getEnchantmentSlotData()[i].getItem() != null ? session.getEnchantmentSlotData()[i].getItem() : createEnchantmentBook(); - } - - InventoryContentPacket contentPacket = new InventoryContentPacket(); - contentPacket.setContainerId(inventory.getId()); - contentPacket.setContents(items); - session.sendUpstreamPacket(contentPacket); - } - - @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { - int bookSlotToUpdate; - switch (key) { - case 0: - case 1: - case 2: - // Experience required - bookSlotToUpdate = key; - session.getEnchantmentSlotData()[bookSlotToUpdate].setExperienceRequired(value); - break; - case 4: - case 5: - case 6: - // Enchantment name - bookSlotToUpdate = key - 4; - if (value != -1) { - session.getEnchantmentSlotData()[bookSlotToUpdate].setEnchantmentType(EnchantmentTableEnchantments.values()[value - 1]); - } else { - // -1 means no enchantment specified - session.getEnchantmentSlotData()[bookSlotToUpdate].setEnchantmentType(null); - } - break; - case 7: - case 8: - case 9: - // Enchantment level - bookSlotToUpdate = key - 7; - session.getEnchantmentSlotData()[bookSlotToUpdate].setEnchantmentLevel(value); - break; - default: - return; - } - updateEnchantmentBook(session, inventory, bookSlotToUpdate); - } - - @Override - public void openInventory(GeyserSession session, Inventory inventory) { - super.openInventory(session, inventory); - for (int i = 0; i < session.getEnchantmentSlotData().length; i++) { - session.getEnchantmentSlotData()[i] = new EnchantmentSlotData(); - } - } - - @Override - public void closeInventory(GeyserSession session, Inventory inventory) { - super.closeInventory(session, inventory); - Arrays.fill(session.getEnchantmentSlotData(), null); - } - - private ItemData createEnchantmentBook() { - NbtMapBuilder root = NbtMap.builder(); - NbtMapBuilder display = NbtMap.builder(); - - display.putString("Name", ChatColor.RESET + "No Enchantment"); - - root.put("display", display.build()); - return ItemData.of(ENCHANTED_BOOK_ID, (short) 0, 1, root.build()); - } - - private void updateEnchantmentBook(GeyserSession session, Inventory inventory, int slot) { - NbtMapBuilder root = NbtMap.builder(); - NbtMapBuilder display = NbtMap.builder(); - EnchantmentSlotData data = session.getEnchantmentSlotData()[slot]; - if (data.getEnchantmentType() != null) { - display.putString("Name", ChatColor.ITALIC + data.getEnchantmentType().toString(session) + - (data.getEnchantmentLevel() != -1 ? " " + toRomanNumeral(session, data.getEnchantmentLevel()) : "") + "?"); - } else { - display.putString("Name", ChatColor.RESET + "No Enchantment"); - } - - display.putList("Lore", NbtType.STRING, Collections.singletonList(ChatColor.DARK_GRAY + data.getExperienceRequired() + "xp")); - root.put("display", display.build()); - ItemData book = ItemData.of(ENCHANTED_BOOK_ID, (short) 0, 1, root.build()); - - InventorySlotPacket slotPacket = new InventorySlotPacket(); - slotPacket.setContainerId(inventory.getId()); - slotPacket.setSlot(slot + 2); - slotPacket.setItem(book); - session.sendUpstreamPacket(slotPacket); - data.setItem(book); - } - - private String toRomanNumeral(GeyserSession session, int level) { - return LocaleUtils.getLocaleString("enchantment.level." + level, - session.getClientData().getLanguageCode()); - } - - /** - * Stores the data of each slot in an enchantment table - */ - @NoArgsConstructor - @Getter - @Setter - @ToString - public static class EnchantmentSlotData { - private EnchantmentTableEnchantments enchantmentType = null; - private int enchantmentLevel = 0; - private int experienceRequired = 0; - private ItemData item; - } - - /** - * Classifies enchantments by Java order - */ - public enum EnchantmentTableEnchantments { - PROTECTION, - FIRE_PROTECTION, - FEATHER_FALLING, - BLAST_PROTECTION, - PROJECTILE_PROTECTION, - RESPIRATION, - AQUA_AFFINITY, - THORNS, - DEPTH_STRIDER, - FROST_WALKER, - BINDING_CURSE, - SHARPNESS, - SMITE, - BANE_OF_ARTHROPODS, - KNOCKBACK, - FIRE_ASPECT, - LOOTING, - SWEEPING, - EFFICIENCY, - SILK_TOUCH, - UNBREAKING, - FORTUNE, - POWER, - PUNCH, - FLAME, - INFINITY, - LUCK_OF_THE_SEA, - LURE, - LOYALTY, - IMPALING, - RIPTIDE, - CHANNELING, - MENDING, - VANISHING_CURSE, // After this is not documented - MULTISHOT, - PIERCING, - QUICK_CHARGE, - SOUL_SPEED; - - public String toString(GeyserSession session) { - return LocaleUtils.getLocaleString("enchantment.minecraft." + this.toString().toLowerCase(), - session.getClientData().getLanguageCode()); - } - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/FurnaceInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/FurnaceInventoryTranslator.java deleted file mode 100644 index 1f148e024..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/FurnaceInventoryTranslator.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; - -public class FurnaceInventoryTranslator extends BlockInventoryTranslator { - public FurnaceInventoryTranslator() { - super(3, "minecraft:furnace[facing=north,lit=false]", ContainerType.FURNACE, new ContainerInventoryUpdater()); - } - - @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { - ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); - dataPacket.setWindowId((byte) inventory.getId()); - switch (key) { - case 0: - dataPacket.setProperty(ContainerSetDataPacket.FURNACE_LIT_TIME); - break; - case 1: - dataPacket.setProperty(ContainerSetDataPacket.FURNACE_LIT_DURATION); - break; - case 2: - dataPacket.setProperty(ContainerSetDataPacket.FURNACE_TICK_COUNT); - if (inventory.getWindowType() == WindowType.BLAST_FURNACE || inventory.getWindowType() == WindowType.SMOKER) { - value *= 2; - } - break; - default: - return; - } - dataPacket.setValue(value); - session.sendUpstreamPacket(dataPacket); - } - - @Override - public SlotType getSlotType(int javaSlot) { - if (javaSlot == 2) - return SlotType.FURNACE_OUTPUT; - return SlotType.NORMAL; - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/GrindstoneInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/GrindstoneInventoryTranslator.java deleted file mode 100644 index 4b4a12465..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/GrindstoneInventoryTranslator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; - -public class GrindstoneInventoryTranslator extends BlockInventoryTranslator { - - public GrindstoneInventoryTranslator() { - super(3, "minecraft:grindstone[face=floor,facing=north]", ContainerType.GRINDSTONE, new CursorInventoryUpdater()); - } - - @Override - public int bedrockSlotToJava(InventoryActionData action) { - final int slot = super.bedrockSlotToJava(action); - if (action.getSource().getContainerId() == ContainerId.UI) { - switch (slot) { - case 16: - return 0; - case 17: - return 1; - case 50: - return 2; - default: - return slot; - } - } return slot; - } - - @Override - public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 16; - case 1: - return 17; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); - } - -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java index e44e4bd0b..b4a12b00f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java @@ -25,18 +25,26 @@ package org.geysermc.connector.network.translators.inventory; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; +import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; +import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; +import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; +import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket; +import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import lombok.AllArgsConstructor; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.connector.network.translators.inventory.click.Click; +import org.geysermc.connector.network.translators.inventory.click.ClickPlan; +import org.geysermc.connector.network.translators.item.ItemRegistry; +import org.geysermc.connector.network.translators.item.ItemTranslator; +import org.geysermc.connector.utils.InventoryUtils; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @AllArgsConstructor public abstract class InventoryTranslator { @@ -50,12 +58,13 @@ public abstract class InventoryTranslator { put(WindowType.GENERIC_9X4, new DoubleChestInventoryTranslator(36)); put(WindowType.GENERIC_9X5, new DoubleChestInventoryTranslator(45)); put(WindowType.GENERIC_9X6, new DoubleChestInventoryTranslator(54)); - put(WindowType.BREWING_STAND, new BrewingInventoryTranslator()); + /*put(WindowType.BREWING_STAND, new BrewingInventoryTranslator()); put(WindowType.ANVIL, new AnvilInventoryTranslator()); put(WindowType.CRAFTING, new CraftingInventoryTranslator()); - put(WindowType.GRINDSTONE, new GrindstoneInventoryTranslator()); + put(WindowType.GRINDSTONE, new GrindstoneInventoryTranslator());*/ put(WindowType.MERCHANT, new MerchantInventoryTranslator()); - put(WindowType.SMITHING, new SmithingInventoryTranslator()); + /*put(WindowType.SMITHING, new SmithingInventoryTranslator()); + //put(WindowType.ENCHANTMENT, new EnchantmentInventoryTranslator()); //TODO InventoryTranslator furnace = new FurnaceInventoryTranslator(); put(WindowType.FURNACE, furnace); @@ -63,14 +72,15 @@ public abstract class InventoryTranslator { put(WindowType.SMOKER, furnace); InventoryUpdater containerUpdater = new ContainerInventoryUpdater(); - put(WindowType.ENCHANTMENT, new EnchantmentInventoryTranslator(containerUpdater)); //TODO put(WindowType.GENERIC_3X3, new BlockInventoryTranslator(9, "minecraft:dispenser[facing=north,triggered=false]", ContainerType.DISPENSER, containerUpdater)); put(WindowType.HOPPER, new BlockInventoryTranslator(5, "minecraft:hopper[enabled=false,facing=down]", ContainerType.HOPPER, containerUpdater)); put(WindowType.SHULKER_BOX, new BlockInventoryTranslator(27, "minecraft:shulker_box[facing=north]", ContainerType.CONTAINER, containerUpdater)); - //put(WindowType.BEACON, new BlockInventoryTranslator(1, "minecraft:beacon", ContainerType.BEACON)); //TODO + //put(WindowType.BEACON, new BlockInventoryTranslator(1, "minecraft:beacon", ContainerType.BEACON)); //TODO*/ } }; + public static final int PLAYER_INVENTORY_SIZE = 36; + public static final int PLAYER_INVENTORY_OFFSET = 9; public final int size; public abstract void prepareInventory(GeyserSession session, Inventory inventory); @@ -79,8 +89,428 @@ public abstract class InventoryTranslator { public abstract void updateProperty(GeyserSession session, Inventory inventory, int key, int value); public abstract void updateInventory(GeyserSession session, Inventory inventory); public abstract void updateSlot(GeyserSession session, Inventory inventory, int slot); - public abstract int bedrockSlotToJava(InventoryActionData action); - public abstract int javaSlotToBedrock(int slot); + public abstract int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData); + public abstract int javaSlotToBedrock(int javaSlot); //TODO + public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot); //TODO public abstract SlotType getSlotType(int javaSlot); - public abstract void translateActions(GeyserSession session, Inventory inventory, List actions); + public abstract Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory); + + public void translateRequests(GeyserSession session, Inventory inventory, List requests) { + ItemStackResponsePacket responsePacket = new ItemStackResponsePacket(); + for (ItemStackRequestPacket.Request request : requests) { + if (request.getActions().length > 0) { + StackRequestActionData firstAction = request.getActions()[0]; + if (firstAction.getType() == StackRequestActionType.CRAFT_RECIPE || firstAction.getType() == StackRequestActionType.CRAFT_RECIPE_AUTO) { + responsePacket.getEntries().add(translateCraftingRequest(session, inventory, request)); + } else if (firstAction.getType() == StackRequestActionType.CRAFT_CREATIVE) { + responsePacket.getEntries().add(translateCreativeRequest(session, inventory, request)); + } else { + responsePacket.getEntries().add(translateRequest(session, inventory, request)); + } + } else { + responsePacket.getEntries().add(rejectRequest(request)); + } + } + session.sendUpstreamPacket(responsePacket); + System.out.println(responsePacket); + } + + public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) { + System.out.println(request); + ClickPlan plan = new ClickPlan(session, this, inventory); + for (StackRequestActionData action : request.getActions()) { + GeyserItemStack cursor = session.getPlayerInventory().getCursor(); + switch (action.getType()) { + case TAKE: + case PLACE: { + TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) + return rejectRequest(request); + + if (isCursor(transferAction.getSource()) && isCursor(transferAction.getDestination())) { //??? + return rejectRequest(request); + } else if (isCursor(transferAction.getSource())) { //releasing cursor + int sourceAmount = cursor.getAmount(); + int destSlot = bedrockSlotToJava(transferAction.getDestination()); + if (transferAction.getCount() == sourceAmount) { //release all + plan.add(Click.LEFT, destSlot); + } else { //release some + for (int i = 0; i < transferAction.getCount(); i++) { + plan.add(Click.RIGHT, destSlot); + } + } + } else if (isCursor(transferAction.getDestination())) { //picking up into cursor + int sourceSlot = bedrockSlotToJava(transferAction.getSource()); + GeyserItemStack sourceItem = plan.getItem(sourceSlot); + int sourceAmount = sourceItem.getAmount(); + if (cursor.isEmpty()) { //picking up into empty cursor + if (transferAction.getCount() == sourceAmount) { //pickup all + plan.add(Click.LEFT, sourceSlot); + } else if (transferAction.getCount() == sourceAmount - (sourceAmount / 2)) { //larger half; simple right click + plan.add(Click.RIGHT, sourceSlot); + } else { //pickup some; not a simple right click + plan.add(Click.LEFT, sourceSlot); //first pickup all + for (int i = 0; i < sourceAmount - transferAction.getCount(); i++) { + plan.add(Click.RIGHT, sourceSlot); //release extra items back into source slot + } + } + } else { //pickup into non-empty cursor + if (!InventoryUtils.canStack(cursor, plan.getItem(sourceSlot))) { //doesn't make sense, reject + return rejectRequest(request); + } + if (transferAction.getCount() != sourceAmount) { //TODO: handle partially picking up into non-empty cursor (temp slot) + return rejectRequest(request); + } + plan.add(Click.LEFT, sourceSlot); //release cursor onto source slot + plan.add(Click.LEFT, sourceSlot); //pickup combined cursor and source + } + } else { //transfer from one slot to another + if (!cursor.isEmpty()) { //TODO: handle slot transfer when cursor is already in use (temp slot) + return rejectRequest(request); + } + int sourceSlot = bedrockSlotToJava(transferAction.getSource()); + int sourceAmount = plan.getItem(sourceSlot).getAmount(); + int destSlot = bedrockSlotToJava(transferAction.getDestination()); + if (transferAction.getCount() == sourceAmount) { //transfer all + plan.add(Click.LEFT, sourceSlot); //pickup source + plan.add(Click.LEFT, destSlot); //let go of all items and done + } else { //transfer some + //try to transfer items with least clicks possible + int halfSource = sourceAmount / 2; //smaller half + int holding; + if (transferAction.getCount() <= halfSource) { //faster to take only half + plan.add(Click.RIGHT, sourceSlot); + holding = halfSource; + } else { //need all + plan.add(Click.LEFT, sourceSlot); + holding = sourceAmount; + } + if (transferAction.getCount() > holding / 2) { //faster to release extra items onto source or dest slot? + for (int i = 0; i < holding - transferAction.getCount(); i++) { + plan.add(Click.RIGHT, sourceSlot); //prepare cursor + } + plan.add(Click.LEFT, destSlot); //release cursor onto dest slot + } else { + for (int i = 0; i < transferAction.getCount(); i++) { + plan.add(Click.RIGHT, destSlot); //right click until transfer goal is met + } + plan.add(Click.LEFT, sourceSlot); //return extra items to source slot + } + } + } + break; + } + case SWAP: { //TODO + SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action; + if (!(checkNetId(session, inventory, swapAction.getSource()) && checkNetId(session, inventory, swapAction.getDestination()))) + return rejectRequest(request); + + if (isCursor(swapAction.getSource()) && isCursor(swapAction.getDestination())) { //??? + return rejectRequest(request); + } else if (isCursor(swapAction.getSource())) { //swap cursor + int destSlot = bedrockSlotToJava(swapAction.getDestination()); + if (InventoryUtils.canStack(cursor, plan.getItem(destSlot))) { //TODO: cannot simply swap if cursor stacks with slot (temp slot) + return rejectRequest(request); + } + plan.add(Click.LEFT, destSlot); + } else if (isCursor(swapAction.getDestination())) { //swap cursor + int sourceSlot = bedrockSlotToJava(swapAction.getSource()); + if (InventoryUtils.canStack(cursor, plan.getItem(sourceSlot))) { //TODO + return rejectRequest(request); + } + plan.add(Click.LEFT, sourceSlot); + } else { + int sourceSlot = bedrockSlotToJava(swapAction.getSource()); + int destSlot = bedrockSlotToJava(swapAction.getDestination()); + if (!cursor.isEmpty()) { //TODO: (temp slot) + return rejectRequest(request); + } + if (sourceSlot == destSlot) { //doesn't make sense + return rejectRequest(request); + } + if (InventoryUtils.canStack(plan.getItem(sourceSlot), plan.getItem(destSlot))) { //TODO: (temp slot) + return rejectRequest(request); + } + plan.add(Click.LEFT, sourceSlot); //pickup source into cursor + plan.add(Click.LEFT, destSlot); //swap cursor with dest slot + plan.add(Click.LEFT, sourceSlot); //release cursor onto source + } + break; + } + case DROP: { + DropStackRequestActionData dropAction = (DropStackRequestActionData) action; + if (!checkNetId(session, inventory, dropAction.getSource())) + return rejectRequest(request); + + if (isCursor(dropAction.getSource())) { //clicking outside of window + int sourceAmount = plan.getCursor().getAmount(); + if (dropAction.getCount() == sourceAmount) { //drop all + plan.add(Click.LEFT_OUTSIDE, Click.OUTSIDE_SLOT); + } else { //drop some + for (int i = 0; i < dropAction.getCount(); i++) { + plan.add(Click.RIGHT_OUTSIDE, Click.OUTSIDE_SLOT); //drop one until goal is met + } + } + } else { //dropping from inventory + int sourceSlot = bedrockSlotToJava(dropAction.getSource()); + int sourceAmount = plan.getItem(sourceSlot).getAmount(); + if (dropAction.getCount() == sourceAmount && sourceAmount > 1) { //dropping all? (prefer DROP_ONE if only one) + plan.add(Click.DROP_ALL, sourceSlot); + } else { //drop some + for (int i = 0; i < dropAction.getCount(); i++) { + plan.add(Click.DROP_ONE, sourceSlot); //drop one until goal is met + } + } + } + break; + } + case CRAFT_CREATIVE: { + CraftCreativeStackRequestActionData creativeAction = (CraftCreativeStackRequestActionData) action; + System.out.println(creativeAction.getCreativeItemNetworkId()); + } + default: + return rejectRequest(request); + } + } + plan.execute(false); + return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots())); + } + + public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) { + System.out.println(request); + + int recipeId = 0; + int resultSize = 0; + boolean autoCraft; + CraftState craftState = CraftState.START; + + int leftover = 0; + ClickPlan plan = new ClickPlan(session, this, inventory); + for (StackRequestActionData action : request.getActions()) { + switch (action.getType()) { + case CRAFT_RECIPE: { + CraftRecipeStackRequestActionData craftAction = (CraftRecipeStackRequestActionData) action; + if (craftState != CraftState.START) { + return rejectRequest(request); + } + craftState = CraftState.RECIPE_ID; + recipeId = craftAction.getRecipeNetworkId(); + System.out.println(session.getCraftingRecipes().get(recipeId).toString()); + autoCraft = false; + break; + } + /*case CRAFT_RECIPE_AUTO: { + AutoCraftRecipeStackRequestActionData autoCraftAction = (AutoCraftRecipeStackRequestActionData) action; + if (craftState != CraftState.START) { + return rejectRequest(request); + } + craftState = CraftState.RECIPE_ID; + recipeId = autoCraftAction.getRecipeNetworkId(); + autoCraft = true; + //TODO: reject transaction if crafting grid is not clear + break; + }*/ + case CRAFT_RESULTS_DEPRECATED: { + CraftResultsDeprecatedStackRequestActionData deprecatedCraftAction = (CraftResultsDeprecatedStackRequestActionData) action; + if (craftState != CraftState.RECIPE_ID) { + return rejectRequest(request); + } + craftState = CraftState.DEPRECATED; + + if (deprecatedCraftAction.getResultItems().length != 1) { + return rejectRequest(request); + } + resultSize = deprecatedCraftAction.getResultItems()[0].getCount(); + if (resultSize <= 0) { + return rejectRequest(request); + } + break; + } + case CONSUME: { + ConsumeStackRequestActionData consumeAction = (ConsumeStackRequestActionData) action; + if (craftState != CraftState.DEPRECATED && craftState != CraftState.INGREDIENTS) { + return rejectRequest(request); + } + craftState = CraftState.INGREDIENTS; + break; + } + case TAKE: + case PLACE: { + TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + if (craftState != CraftState.INGREDIENTS && craftState != CraftState.TRANSFER) { + return rejectRequest(request); + } + craftState = CraftState.TRANSFER; + + if (transferAction.getSource().getContainer() != ContainerSlotType.CREATIVE_OUTPUT) { + return rejectRequest(request); + } + if (transferAction.getCount() <= 0) { + return rejectRequest(request); + } + + int sourceSlot = bedrockSlotToJava(transferAction.getSource()); + if (isCursor(transferAction.getDestination())) { + plan.add(Click.LEFT, sourceSlot); + craftState = CraftState.DONE; + } else { + int destSlot = bedrockSlotToJava(transferAction.getDestination()); + if (leftover != 0) { + if (transferAction.getCount() > leftover) { + return rejectRequest(request); + } + if (transferAction.getCount() == leftover) { + plan.add(Click.LEFT, destSlot); + } else { + for (int i = 0; i < transferAction.getCount(); i++) { + plan.add(Click.RIGHT, destSlot); + } + } + leftover -= transferAction.getCount(); + break; + } + + int remainder = transferAction.getCount() % resultSize; + int timesToCraft = transferAction.getCount() / resultSize; + for (int i = 0; i < timesToCraft; i++) { + plan.add(Click.LEFT, sourceSlot); + plan.add(Click.LEFT, destSlot); + } + if (remainder > 0) { + plan.add(Click.LEFT, 0); + for (int i = 0; i < remainder; i++) { + plan.add(Click.RIGHT, destSlot); + } + leftover = resultSize - remainder; + } + } + break; + } + default: + return rejectRequest(request); + } + } + plan.execute(false); + Set affectedSlots = plan.getAffectedSlots(); + affectedSlots.addAll(Arrays.asList(1, 2, 3, 4)); //TODO: crafting grid + return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots)); + } + + public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) { + int creativeId = 0; + CraftState craftState = CraftState.START; + for (StackRequestActionData action : request.getActions()) { + switch (action.getType()) { + case CRAFT_CREATIVE: { + CraftCreativeStackRequestActionData creativeAction = (CraftCreativeStackRequestActionData) action; + if (craftState != CraftState.START) { + return rejectRequest(request); + } + craftState = CraftState.RECIPE_ID; + + creativeId = creativeAction.getCreativeItemNetworkId(); + break; + } + case CRAFT_RESULTS_DEPRECATED: { + CraftResultsDeprecatedStackRequestActionData deprecatedCraftAction = (CraftResultsDeprecatedStackRequestActionData) action; + if (craftState != CraftState.RECIPE_ID) { + return rejectRequest(request); + } + craftState = CraftState.DEPRECATED; + break; + } + case TAKE: + case PLACE: { + TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; + if (craftState != CraftState.DEPRECATED) { + return rejectRequest(request); + } + craftState = CraftState.TRANSFER; + + if (transferAction.getSource().getContainer() != ContainerSlotType.CREATIVE_OUTPUT) { + return rejectRequest(request); + } + if (isCursor(transferAction.getDestination())) { + session.getPlayerInventory().setCursor(GeyserItemStack.from(ItemTranslator.translateToJava(ItemRegistry.CREATIVE_ITEMS[creativeId]), session.getItemNetId().getAndIncrement())); //TODO + return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet())); + } else { + int javaSlot = bedrockSlotToJava(transferAction.getDestination()); + ItemStack javaItem = ItemTranslator.translateToJava(ItemRegistry.CREATIVE_ITEMS[creativeId - 1]); //TODO + inventory.setItem(javaSlot, GeyserItemStack.from(javaItem, session.getItemNetId().getAndIncrement())); + ClientCreativeInventoryActionPacket creativeActionPacket = new ClientCreativeInventoryActionPacket( + javaSlot, + javaItem + ); + session.sendDownstreamPacket(creativeActionPacket); + Set affectedSlots = Collections.singleton(javaSlot); + return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots)); + } + } + default: + return rejectRequest(request); + } + } + return rejectRequest(request); + } + + public static ItemStackResponsePacket.Response acceptRequest(ItemStackRequestPacket.Request request, List containerEntries) { + return new ItemStackResponsePacket.Response(true, request.getRequestId(), containerEntries); + } + + public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request) { + new Throwable("DEBUGGING: ItemStackRequest rejected").printStackTrace(); //TODO: temporary debugging + return new ItemStackResponsePacket.Response(false, request.getRequestId(), Collections.emptyList()); + } + + public boolean checkNetId(GeyserSession session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { + if (slotInfoData.getStackNetworkId() < 0) + return true; + + GeyserItemStack currentItem = isCursor(slotInfoData) ? session.getPlayerInventory().getCursor() : inventory.getItem(bedrockSlotToJava(slotInfoData)); + return currentItem.getNetId() == slotInfoData.getStackNetworkId(); + } + + public List makeContainerEntries(GeyserSession session, Inventory inventory, Set affectedSlots) { + Map> containerMap = new HashMap<>(); + for (int slot : affectedSlots) { + BedrockContainerSlot bedrockSlot = javaSlotToBedrockContainer(slot); + List list = containerMap.computeIfAbsent(bedrockSlot.getContainer(), k -> new ArrayList<>()); + list.add(makeItemEntry(session, bedrockSlot.getSlot(), inventory.getItem(slot))); + } + + List containerEntries = new ArrayList<>(); + for (Map.Entry> entry : containerMap.entrySet()) { + containerEntries.add(new ItemStackResponsePacket.ContainerEntry(entry.getKey(), entry.getValue())); + } + + ItemStackResponsePacket.ItemEntry cursorEntry = makeItemEntry(session, 0, session.getPlayerInventory().getCursor()); + containerEntries.add(new ItemStackResponsePacket.ContainerEntry(ContainerSlotType.CURSOR, Collections.singletonList(cursorEntry))); + + return containerEntries; + } + + public static ItemStackResponsePacket.ItemEntry makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) { + ItemStackResponsePacket.ItemEntry itemEntry; + if (!itemStack.isEmpty()) { + int newNetId = session.getItemNetId().getAndIncrement(); + itemStack.setNetId(newNetId); + itemEntry = new ItemStackResponsePacket.ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), newNetId); + } else { + itemEntry = new ItemStackResponsePacket.ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0); + } + return itemEntry; + } + + private static boolean isCursor(StackRequestSlotInfoData slotInfoData) { + return slotInfoData.getContainer() == ContainerSlotType.CURSOR; + } + + private enum CraftState { + START, + RECIPE_ID, + DEPRECATED, + INGREDIENTS, + TRANSFER, + DONE + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/MerchantInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/MerchantInventoryTranslator.java index 25fdae688..c4b2fc9a1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/MerchantInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/MerchantInventoryTranslator.java @@ -25,15 +25,21 @@ package org.geysermc.connector.network.translators.inventory; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import com.nukkitx.protocol.bedrock.data.inventory.InventorySource; +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; +import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; +import com.nukkitx.protocol.bedrock.data.inventory.*; +import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; +import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.inventory.MerchantContainer; +import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; - -import java.util.List; +import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; public class MerchantInventoryTranslator extends BaseInventoryTranslator { @@ -41,7 +47,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { public MerchantInventoryTranslator() { super(3); - this.updater = new CursorInventoryUpdater(); + this.updater = new UIInventoryUpdater(); } @Override @@ -58,26 +64,30 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public int bedrockSlotToJava(InventoryActionData action) { - switch (action.getSource().getContainerId()) { - case ContainerId.UI: - switch (action.getSlot()) { - case 4: - return 0; - case 5: - return 1; - case 50: - return 2; - } - break; - case -28: // Trading 1? + public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { + switch (slot) { + case 0: + return new BedrockContainerSlot(ContainerSlotType.TRADE2_INGREDIENT1, 4); + case 1: + return new BedrockContainerSlot(ContainerSlotType.TRADE2_INGREDIENT2, 5); + case 2: + return new BedrockContainerSlot(ContainerSlotType.TRADE2_RESULT, 50); + } + return super.javaSlotToBedrockContainer(slot); + } + + @Override + public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + switch (slotInfoData.getContainer()) { + case TRADE2_INGREDIENT1: return 0; - case -29: // Trading 2? + case TRADE2_INGREDIENT2: return 1; - case -30: // Trading Output? + case TRADE2_RESULT: + case CREATIVE_OUTPUT: return 2; } - return super.bedrockSlotToJava(action); + return super.bedrockSlotToJava(slotInfoData); } @Override @@ -90,18 +100,40 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { @Override public void prepareInventory(GeyserSession session, Inventory inventory) { + MerchantContainer merchantInventory = (MerchantContainer) inventory; + if (merchantInventory.getVillager() == null) { + long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); + Vector3f pos = session.getPlayerEntity().getPosition().sub(0, 3, 0); + EntityDataMap metadata = new EntityDataMap(); + metadata.put(EntityData.SCALE, 0f); + metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0f); + metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0f); + + Entity villager = new Entity(0, geyserId, EntityType.VILLAGER, pos, Vector3f.ZERO, Vector3f.ZERO); + villager.setMetadata(metadata); + villager.spawnEntity(session); + + SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); + EntityLinkData.Type type = EntityLinkData.Type.PASSENGER; + linkPacket.setEntityLink(new EntityLinkData(session.getPlayerEntity().getGeyserId(), geyserId, type, true, false)); + session.sendUpstreamPacket(linkPacket); + + merchantInventory.setVillager(villager); + } } @Override public void openInventory(GeyserSession session, Inventory inventory) { - + //Handled in JavaTradeListTranslator } @Override public void closeInventory(GeyserSession session, Inventory inventory) { - session.setLastInteractedVillagerEid(-1); - session.setVillagerTrades(null); + MerchantContainer merchantInventory = (MerchantContainer) inventory; + if (merchantInventory.getVillager() != null) { + merchantInventory.getVillager().despawnEntity(session); + } } @Override @@ -115,11 +147,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - if (actions.stream().anyMatch(a -> a.getSource().getContainerId() == -31)) { - return; - } - - super.translateActions(session, inventory, actions); + public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { + return new MerchantContainer(name, windowId, windowType, this.size, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java index 7d7673c4e..48315fc1c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/PlayerInventoryTranslator.java @@ -25,18 +25,15 @@ package org.geysermc.connector.network.translators.inventory; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import com.nukkitx.protocol.bedrock.data.inventory.InventorySource; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; +import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket; import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.action.InventoryActionDataTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.utils.InventoryUtils; import org.geysermc.connector.utils.LanguageUtils; @@ -59,11 +56,11 @@ public class PlayerInventoryTranslator extends InventoryTranslator { ItemData[] contents = new ItemData[36]; // Inventory for (int i = 9; i < 36; i++) { - contents[i] = ItemTranslator.translateToBedrock(session, inventory.getItem(i)); + contents[i] = inventory.getItem(i).getItemData(session); } // Hotbar for (int i = 36; i < 45; i++) { - contents[i - 36] = ItemTranslator.translateToBedrock(session, inventory.getItem(i)); + contents[i - 36] = inventory.getItem(i).getItemData(session); } inventoryContentPacket.setContents(contents); session.sendUpstreamPacket(inventoryContentPacket); @@ -73,7 +70,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { armorContentPacket.setContainerId(ContainerId.ARMOR); contents = new ItemData[4]; for (int i = 5; i < 9; i++) { - contents[i - 5] = ItemTranslator.translateToBedrock(session, inventory.getItem(i)); + contents[i - 5] = inventory.getItem(i).getItemData(session); } armorContentPacket.setContents(contents); session.sendUpstreamPacket(armorContentPacket); @@ -81,7 +78,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { // Offhand InventoryContentPacket offhandPacket = new InventoryContentPacket(); offhandPacket.setContainerId(ContainerId.OFFHAND); - offhandPacket.setContents(new ItemData[]{ItemTranslator.translateToBedrock(session, inventory.getItem(45))}); + offhandPacket.setContents(new ItemData[]{inventory.getItem(45).getItemData(session)}); session.sendUpstreamPacket(offhandPacket); } @@ -100,7 +97,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { if (session.getGameMode() == GameMode.CREATIVE) { slotPacket.setItem(UNUSUABLE_CRAFTING_SPACE_BLOCK); }else{ - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(i))); + slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(i).getItemStack())); } session.sendUpstreamPacket(slotPacket); @@ -125,21 +122,23 @@ public class PlayerInventoryTranslator extends InventoryTranslator { slotPacket.setContainerId(ContainerId.UI); slotPacket.setSlot(slot + 27); } - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(slot))); + slotPacket.setItem(inventory.getItem(slot).getItemData(session)); session.sendUpstreamPacket(slotPacket); } else if (slot == 45) { InventoryContentPacket offhandPacket = new InventoryContentPacket(); offhandPacket.setContainerId(ContainerId.OFFHAND); - offhandPacket.setContents(new ItemData[]{ItemTranslator.translateToBedrock(session, inventory.getItem(slot))}); + offhandPacket.setContents(new ItemData[]{inventory.getItem(slot).getItemData(session)}); session.sendUpstreamPacket(offhandPacket); } } @Override - public int bedrockSlotToJava(InventoryActionData action) { - int slotnum = action.getSlot(); - switch (action.getSource().getContainerId()) { - case ContainerId.INVENTORY: + public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { + int slotnum = slotInfoData.getSlot(); + switch (slotInfoData.getContainer()) { + case HOTBAR_AND_INVENTORY: + case HOTBAR: + case INVENTORY: // Inventory if (slotnum >= 9 && slotnum <= 35) { return slotnum; @@ -149,19 +148,19 @@ public class PlayerInventoryTranslator extends InventoryTranslator { return slotnum + 36; } break; - case ContainerId.ARMOR: + case ARMOR: if (slotnum >= 0 && slotnum <= 3) { return slotnum + 5; } break; - case ContainerId.OFFHAND: + case OFFHAND: return 45; - case ContainerId.UI: + case CRAFTING_INPUT: if (slotnum >= 28 && 31 >= slotnum) { return slotnum - 27; } break; - case ContainerId.CRAFTING_RESULT: + case CREATIVE_OUTPUT: return 0; } return slotnum; @@ -169,7 +168,26 @@ public class PlayerInventoryTranslator extends InventoryTranslator { @Override public int javaSlotToBedrock(int slot) { - return slot; + return -1; + } + + @Override + public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { + if (slot >= 36 && slot <= 44) { + return new BedrockContainerSlot(ContainerSlotType.HOTBAR, slot - 36); + } else if (slot >= 9 && slot <= 35) { + return new BedrockContainerSlot(ContainerSlotType.INVENTORY, slot); + } else if (slot >= 5 && slot <= 8) { + return new BedrockContainerSlot(ContainerSlotType.ARMOR, slot - 5); + } else if (slot == 45) { + return new BedrockContainerSlot(ContainerSlotType.OFFHAND, 1); + } else if (slot >= 1 && slot <= 4) { + return new BedrockContainerSlot(ContainerSlotType.CRAFTING_INPUT, slot + 27); + } else if (slot == 0) { + return new BedrockContainerSlot(ContainerSlotType.CRAFTING_OUTPUT, 0); + } else { + throw new IllegalArgumentException("Unknown bedrock slot"); + } } @Override @@ -180,52 +198,13 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void translateActions(GeyserSession session, Inventory inventory, List actions) { - if (session.getGameMode() == GameMode.CREATIVE) { - //crafting grid is not visible in creative mode in java edition - for (InventoryActionData action : actions) { - if (action.getSource().getContainerId() == ContainerId.UI && (action.getSlot() >= 28 && 31 >= action.getSlot())) { - updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - } - } + public void translateRequests(GeyserSession session, Inventory inventory, List requests) { + super.translateRequests(session, inventory, requests); + } - ItemStack javaItem; - for (InventoryActionData action : actions) { - switch (action.getSource().getContainerId()) { - case ContainerId.INVENTORY: - case ContainerId.ARMOR: - case ContainerId.OFFHAND: - int javaSlot = bedrockSlotToJava(action); - if (action.getToItem().getId() == 0) { - javaItem = new ItemStack(-1, 0, null); - } else { - javaItem = ItemTranslator.translateToJava(action.getToItem()); - } - ClientCreativeInventoryActionPacket creativePacket = new ClientCreativeInventoryActionPacket(javaSlot, javaItem); - session.sendDownstreamPacket(creativePacket); - inventory.setItem(javaSlot, javaItem); - break; - case ContainerId.UI: - if (action.getSlot() == 0) { - session.getInventory().setCursor(ItemTranslator.translateToJava(action.getToItem())); - } - break; - case ContainerId.NONE: - if (action.getSource().getType() == InventorySource.Type.WORLD_INTERACTION - && action.getSource().getFlag() == InventorySource.Flag.DROP_ITEM) { - javaItem = ItemTranslator.translateToJava(action.getToItem()); - ClientCreativeInventoryActionPacket creativeDropPacket = new ClientCreativeInventoryActionPacket(-1, javaItem); - session.sendDownstreamPacket(creativeDropPacket); - } - break; - } - } - return; - } - - InventoryActionDataTranslator.translate(this, session, inventory, actions); + @Override + public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { + throw new UnsupportedOperationException(); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/SmithingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/SmithingInventoryTranslator.java deleted file mode 100644 index f7f0acd8c..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/SmithingInventoryTranslator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory; - -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; - -public class SmithingInventoryTranslator extends BlockInventoryTranslator { - - public SmithingInventoryTranslator() { - super(3, "minecraft:smithing_table", ContainerType.SMITHING_TABLE, new CursorInventoryUpdater()); - } - - @Override - public int bedrockSlotToJava(InventoryActionData action) { - final int slot = super.bedrockSlotToJava(action); - if (action.getSource().getContainerId() == ContainerId.UI) { - switch (slot) { - case 51: - return 0; - case 52: - return 1; - case 50: - return 2; - default: - return slot; - } - } return slot; - } - - @Override - public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 51; - case 1: - return 52; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); - } - -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/ClickPlan.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/ClickPlan.java deleted file mode 100644 index a9c1eddca..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/ClickPlan.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory.action; - -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.window.WindowAction; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.utils.InventoryUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; - -class ClickPlan { - private final List plan = new ArrayList<>(); - - public void add(Click click, int slot) { - plan.add(new ClickAction(click, slot)); - } - - public void execute(GeyserSession session, InventoryTranslator translator, Inventory inventory, boolean refresh) { - PlayerInventory playerInventory = session.getInventory(); - ListIterator planIter = plan.listIterator(); - while (planIter.hasNext()) { - final ClickAction action = planIter.next(); - final ItemStack cursorItem = playerInventory.getCursor(); - final ItemStack clickedItem = inventory.getItem(action.slot); - final short actionId = (short) inventory.getTransactionId().getAndIncrement(); - - //TODO: stop relying on refreshing the inventory for crafting to work properly - if (translator.getSlotType(action.slot) != SlotType.NORMAL) - refresh = true; - - ClientWindowActionPacket clickPacket = new ClientWindowActionPacket(inventory.getId(), - actionId, action.slot, !planIter.hasNext() && refresh ? InventoryUtils.REFRESH_ITEM : clickedItem, - WindowAction.CLICK_ITEM, action.click.actionParam); - - if (translator.getSlotType(action.slot) == SlotType.OUTPUT) { - if (cursorItem == null && clickedItem != null) { - playerInventory.setCursor(clickedItem); - } else if (InventoryUtils.canStack(cursorItem, clickedItem)) { - playerInventory.setCursor(new ItemStack(cursorItem.getId(), - cursorItem.getAmount() + clickedItem.getAmount(), cursorItem.getNbt())); - } - } else { - switch (action.click) { - case LEFT: - if (!InventoryUtils.canStack(cursorItem, clickedItem)) { - playerInventory.setCursor(clickedItem); - inventory.setItem(action.slot, cursorItem); - } else { - playerInventory.setCursor(null); - inventory.setItem(action.slot, new ItemStack(clickedItem.getId(), - clickedItem.getAmount() + cursorItem.getAmount(), clickedItem.getNbt())); - } - break; - case RIGHT: - if (cursorItem == null && clickedItem != null) { - ItemStack halfItem = new ItemStack(clickedItem.getId(), - clickedItem.getAmount() / 2, clickedItem.getNbt()); - inventory.setItem(action.slot, halfItem); - playerInventory.setCursor(new ItemStack(clickedItem.getId(), - clickedItem.getAmount() - halfItem.getAmount(), clickedItem.getNbt())); - } else if (cursorItem != null && clickedItem == null) { - playerInventory.setCursor(new ItemStack(cursorItem.getId(), - cursorItem.getAmount() - 1, cursorItem.getNbt())); - inventory.setItem(action.slot, new ItemStack(cursorItem.getId(), - 1, cursorItem.getNbt())); - } else if (InventoryUtils.canStack(cursorItem, clickedItem)) { - playerInventory.setCursor(new ItemStack(cursorItem.getId(), - cursorItem.getAmount() - 1, cursorItem.getNbt())); - inventory.setItem(action.slot, new ItemStack(clickedItem.getId(), - clickedItem.getAmount() + 1, clickedItem.getNbt())); - } - break; - } - } - session.sendDownstreamPacket(clickPacket); - session.sendDownstreamPacket(new ClientConfirmTransactionPacket(inventory.getId(), actionId, true)); - } - - /*if (refresh) { - translator.updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - }*/ - } - - private static class ClickAction { - final Click click; - final int slot; - ClickAction(Click click, int slot) { - this.click = click; - this.slot = slot; - } - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java deleted file mode 100644 index 96cbd61fb..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/InventoryActionDataTranslator.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.connector.network.translators.inventory.action; - -import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; -import com.github.steveice10.mc.protocol.data.game.window.*; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; -import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; -import com.nukkitx.protocol.bedrock.data.inventory.InventorySource; -import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.utils.InventoryUtils; - -import java.util.*; - -public class InventoryActionDataTranslator { - public static void translate(InventoryTranslator translator, GeyserSession session, Inventory inventory, List actions) { - if (actions.size() != 2) - return; - - InventoryActionData worldAction = null; - InventoryActionData cursorAction = null; - InventoryActionData containerAction = null; - boolean refresh = false; - for (InventoryActionData action : actions) { - if (action.getSource().getContainerId() == ContainerId.CRAFTING_USE_INGREDIENT) { - return; - } else if (action.getSource().getType() == InventorySource.Type.WORLD_INTERACTION) { - worldAction = action; - } else if (action.getSource().getContainerId() == ContainerId.UI && action.getSlot() == 0) { - cursorAction = action; - ItemData translatedCursor = ItemTranslator.translateToBedrock(session, session.getInventory().getCursor()); - if (!translatedCursor.equals(action.getFromItem())) { - refresh = true; - } - } else { - containerAction = action; - ItemData translatedItem = ItemTranslator.translateToBedrock(session, inventory.getItem(translator.bedrockSlotToJava(action))); - if (!translatedItem.equals(action.getFromItem())) { - refresh = true; - } - } - } - - final int craftSlot = session.getCraftSlot(); - session.setCraftSlot(0); - - if (worldAction != null) { - InventoryActionData sourceAction; - if (cursorAction != null) { - sourceAction = cursorAction; - } else { - sourceAction = containerAction; - } - - if (sourceAction != null) { - if (worldAction.getSource().getFlag() == InventorySource.Flag.DROP_ITEM) { - //quick dropping from hotbar? - if (session.getInventoryCache().getOpenInventory() == null && sourceAction.getSource().getContainerId() == ContainerId.INVENTORY) { - int heldSlot = session.getInventory().getHeldItemSlot(); - if (sourceAction.getSlot() == heldSlot) { - ClientPlayerActionPacket actionPacket = new ClientPlayerActionPacket( - sourceAction.getToItem().getCount() == 0 ? PlayerAction.DROP_ITEM_STACK : PlayerAction.DROP_ITEM, - new Position(0, 0, 0), BlockFace.DOWN); - session.sendDownstreamPacket(actionPacket); - ItemStack item = session.getInventory().getItem(heldSlot); - if (item != null) { - session.getInventory().setItem(heldSlot, new ItemStack(item.getId(), item.getAmount() - 1, item.getNbt())); - } - return; - } - } - int dropAmount = sourceAction.getFromItem().getCount() - sourceAction.getToItem().getCount(); - if (sourceAction != cursorAction) { //dropping directly from inventory - int javaSlot = translator.bedrockSlotToJava(sourceAction); - if (dropAmount == sourceAction.getFromItem().getCount()) { - ClientWindowActionPacket dropPacket = new ClientWindowActionPacket(inventory.getId(), - inventory.getTransactionId().getAndIncrement(), - javaSlot, null, WindowAction.DROP_ITEM, - DropItemParam.DROP_SELECTED_STACK); - session.sendDownstreamPacket(dropPacket); - } else { - for (int i = 0; i < dropAmount; i++) { - ClientWindowActionPacket dropPacket = new ClientWindowActionPacket(inventory.getId(), - inventory.getTransactionId().getAndIncrement(), - javaSlot, null, WindowAction.DROP_ITEM, - DropItemParam.DROP_FROM_SELECTED); - session.sendDownstreamPacket(dropPacket); - } - } - ItemStack item = inventory.getItem(javaSlot); - if (item != null) { - inventory.setItem(javaSlot, new ItemStack(item.getId(), item.getAmount() - dropAmount, item.getNbt())); - } - return; - } else { //clicking outside of inventory - ClientWindowActionPacket dropPacket = new ClientWindowActionPacket(inventory.getId(), inventory.getTransactionId().getAndIncrement(), - -999, null, WindowAction.CLICK_ITEM, - dropAmount > 1 ? ClickItemParam.LEFT_CLICK : ClickItemParam.RIGHT_CLICK); - session.sendDownstreamPacket(dropPacket); - ItemStack cursor = session.getInventory().getCursor(); - if (cursor != null) { - session.getInventory().setCursor(new ItemStack(cursor.getId(), dropAmount > 1 ? 0 : cursor.getAmount() - 1, cursor.getNbt())); - } - return; - } - } - } - } else if (cursorAction != null && containerAction != null) { - //left/right click - ClickPlan plan = new ClickPlan(); - int javaSlot = translator.bedrockSlotToJava(containerAction); - if (cursorAction.getFromItem().equals(containerAction.getToItem()) - && containerAction.getFromItem().equals(cursorAction.getToItem()) - && !InventoryUtils.canStack(cursorAction.getFromItem(), containerAction.getFromItem())) { //simple swap - plan.add(Click.LEFT, javaSlot); - } else if (cursorAction.getFromItem().getCount() > cursorAction.getToItem().getCount()) { //release - if (cursorAction.getToItem().getCount() == 0) { - plan.add(Click.LEFT, javaSlot); - } else { - int difference = cursorAction.getFromItem().getCount() - cursorAction.getToItem().getCount(); - for (int i = 0; i < difference; i++) { - plan.add(Click.RIGHT, javaSlot); - } - } - } else { //pickup - if (cursorAction.getFromItem().getCount() == 0) { - if (containerAction.getToItem().getCount() == 0) { //pickup all - plan.add(Click.LEFT, javaSlot); - } else { //pickup some - if (translator.getSlotType(javaSlot) == SlotType.FURNACE_OUTPUT - || containerAction.getToItem().getCount() == containerAction.getFromItem().getCount() / 2) { //right click - plan.add(Click.RIGHT, javaSlot); - } else { - plan.add(Click.LEFT, javaSlot); - int difference = containerAction.getFromItem().getCount() - cursorAction.getToItem().getCount(); - for (int i = 0; i < difference; i++) { - plan.add(Click.RIGHT, javaSlot); - } - } - } - } else { //pickup into non-empty cursor - if (translator.getSlotType(javaSlot) == SlotType.FURNACE_OUTPUT) { - if (containerAction.getToItem().getCount() == 0) { - plan.add(Click.LEFT, javaSlot); - } else { - ClientWindowActionPacket shiftClickPacket = new ClientWindowActionPacket(inventory.getId(), - inventory.getTransactionId().getAndIncrement(), - javaSlot, InventoryUtils.REFRESH_ITEM, WindowAction.SHIFT_CLICK_ITEM, - ShiftClickItemParam.LEFT_CLICK); - session.sendDownstreamPacket(shiftClickPacket); - translator.updateInventory(session, inventory); - return; - } - } else if (translator.getSlotType(javaSlot) == SlotType.OUTPUT) { - plan.add(Click.LEFT, javaSlot); - } else { - int cursorSlot = findTempSlot(inventory, session.getInventory().getCursor(), Collections.singletonList(javaSlot), false); - if (cursorSlot != -1) { - plan.add(Click.LEFT, cursorSlot); - } else { - translator.updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - } - plan.add(Click.LEFT, javaSlot); - int difference = cursorAction.getToItem().getCount() - cursorAction.getFromItem().getCount(); - for (int i = 0; i < difference; i++) { - plan.add(Click.RIGHT, cursorSlot); - } - plan.add(Click.LEFT, javaSlot); - plan.add(Click.LEFT, cursorSlot); - } - } - } - plan.execute(session, translator, inventory, refresh); - return; - } else { - ClickPlan plan = new ClickPlan(); - InventoryActionData fromAction; - InventoryActionData toAction; - if (actions.get(0).getFromItem().getCount() >= actions.get(0).getToItem().getCount()) { - fromAction = actions.get(0); - toAction = actions.get(1); - } else { - fromAction = actions.get(1); - toAction = actions.get(0); - } - int fromSlot = translator.bedrockSlotToJava(fromAction); - int toSlot = translator.bedrockSlotToJava(toAction); - - if (translator.getSlotType(fromSlot) == SlotType.OUTPUT) { - if ((craftSlot != 0 && craftSlot != -2) && (inventory.getItem(toSlot) == null - || InventoryUtils.canStack(session.getInventory().getCursor(), inventory.getItem(toSlot)))) { - if (fromAction.getToItem().getCount() == 0) { - refresh = true; - plan.add(Click.LEFT, toSlot); - if (craftSlot != -1) { - plan.add(Click.LEFT, craftSlot); - } - } else { - int difference = toAction.getToItem().getCount() - toAction.getFromItem().getCount(); - for (int i = 0; i < difference; i++) { - plan.add(Click.RIGHT, toSlot); - } - session.setCraftSlot(craftSlot); - } - plan.execute(session, translator, inventory, refresh); - return; - } else { - session.setCraftSlot(-2); - } - } - - int cursorSlot = -1; - if (session.getInventory().getCursor() != null) { //move cursor contents to a temporary slot - cursorSlot = findTempSlot(inventory, - session.getInventory().getCursor(), - Arrays.asList(fromSlot, toSlot), - translator.getSlotType(fromSlot) == SlotType.OUTPUT); - if (cursorSlot != -1) { - plan.add(Click.LEFT, cursorSlot); - } else { - translator.updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - return; - } - } - if ((fromAction.getFromItem().equals(toAction.getToItem()) && !InventoryUtils.canStack(fromAction.getFromItem(), toAction.getFromItem())) - || fromAction.getToItem().getId() == 0) { //slot swap - plan.add(Click.LEFT, fromSlot); - plan.add(Click.LEFT, toSlot); - if (fromAction.getToItem().getId() != 0) { - plan.add(Click.LEFT, fromSlot); - } - } else if (InventoryUtils.canStack(fromAction.getFromItem(), toAction.getToItem())) { //partial item move - if (translator.getSlotType(fromSlot) == SlotType.FURNACE_OUTPUT) { - ClientWindowActionPacket shiftClickPacket = new ClientWindowActionPacket(inventory.getId(), - inventory.getTransactionId().getAndIncrement(), - fromSlot, InventoryUtils.REFRESH_ITEM, WindowAction.SHIFT_CLICK_ITEM, - ShiftClickItemParam.LEFT_CLICK); - session.sendDownstreamPacket(shiftClickPacket); - translator.updateInventory(session, inventory); - return; - } else if (translator.getSlotType(fromSlot) == SlotType.OUTPUT) { - session.setCraftSlot(cursorSlot); - plan.add(Click.LEFT, fromSlot); - int difference = toAction.getToItem().getCount() - toAction.getFromItem().getCount(); - for (int i = 0; i < difference; i++) { - plan.add(Click.RIGHT, toSlot); - } - //client will send additional packets later to finish transferring crafting output - //translator will know how to handle this using the craftSlot variable - } else { - plan.add(Click.LEFT, fromSlot); - int difference = toAction.getToItem().getCount() - toAction.getFromItem().getCount(); - for (int i = 0; i < difference; i++) { - plan.add(Click.RIGHT, toSlot); - } - plan.add(Click.LEFT, fromSlot); - } - } - if (cursorSlot != -1) { - plan.add(Click.LEFT, cursorSlot); - } - plan.execute(session, translator, inventory, refresh); - return; - } - - translator.updateInventory(session, inventory); - InventoryUtils.updateCursor(session); - } - - private static int findTempSlot(Inventory inventory, ItemStack item, List slotBlacklist, boolean emptyOnly) { - /*try and find a slot that can temporarily store the given item - only look in the main inventory and hotbar - only slots that are empty or contain a different type of item are valid*/ - int offset = inventory.getId() == 0 ? 1 : 0; //offhand is not a viable slot (some servers disable it) - List itemBlacklist = new ArrayList<>(slotBlacklist.size() + 1); - itemBlacklist.add(item); - for (int slot : slotBlacklist) { - ItemStack blacklistItem = inventory.getItem(slot); - if (blacklistItem != null) - itemBlacklist.add(blacklistItem); - } - for (int i = inventory.getSize() - (36 + offset); i < inventory.getSize() - offset; i++) { - ItemStack testItem = inventory.getItem(i); - boolean acceptable = true; - if (testItem != null) { - if (emptyOnly) { - continue; - } - for (ItemStack blacklistItem : itemBlacklist) { - if (InventoryUtils.canStack(testItem, blacklistItem)) { - acceptable = false; - break; - } - } - } - if (acceptable && !slotBlacklist.contains(i)) - return i; - } - //could not find a viable temp slot - return -1; - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/Click.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java similarity index 66% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/Click.java rename to connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java index 1fdfa3640..d27290bff 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/action/Click.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java @@ -23,16 +23,25 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.action; +package org.geysermc.connector.network.translators.inventory.click; import com.github.steveice10.mc.protocol.data.game.window.ClickItemParam; +import com.github.steveice10.mc.protocol.data.game.window.DropItemParam; +import com.github.steveice10.mc.protocol.data.game.window.WindowAction; import com.github.steveice10.mc.protocol.data.game.window.WindowActionParam; import lombok.AllArgsConstructor; @AllArgsConstructor -enum Click { - LEFT(ClickItemParam.LEFT_CLICK), - RIGHT(ClickItemParam.RIGHT_CLICK); +public enum Click { + LEFT(WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK), + RIGHT(WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK), + DROP_ONE(WindowAction.DROP_ITEM, DropItemParam.DROP_FROM_SELECTED), + DROP_ALL(WindowAction.DROP_ITEM, DropItemParam.DROP_SELECTED_STACK), + LEFT_OUTSIDE(WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK), + RIGHT_OUTSIDE(WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); + public static final int OUTSIDE_SLOT = -999; + + public final WindowAction windowAction; public final WindowActionParam actionParam; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java new file mode 100644 index 000000000..f4cf35617 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2019-2020 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.connector.network.translators.inventory.click; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; +import com.github.steveice10.mc.protocol.data.game.window.WindowAction; +import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import lombok.Value; +import org.geysermc.connector.inventory.GeyserItemStack; +import org.geysermc.connector.inventory.Inventory; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.connector.network.translators.inventory.SlotType; +import org.geysermc.connector.utils.InventoryUtils; + +import java.util.*; + +public class ClickPlan { + private final List plan = new ArrayList<>(); + private final Int2ObjectMap simulatedItems; + private GeyserItemStack simulatedCursor; + private boolean simulating; + + private final GeyserSession session; + private final InventoryTranslator translator; + private final Inventory inventory; + + public ClickPlan(GeyserSession session, InventoryTranslator translator, Inventory inventory) { + this.session = session; + this.translator = translator; + this.inventory = inventory; + + this.simulatedItems = new Int2ObjectOpenHashMap<>(inventory.getSize()); + this.simulatedCursor = session.getPlayerInventory().getCursor().copy(); + this.simulating = true; + } + + public void add(Click click, int slot) { + if (!simulating) + throw new UnsupportedOperationException("ClickPlan already executed"); + + if (click == Click.LEFT_OUTSIDE || click == Click.RIGHT_OUTSIDE) { + slot = Click.OUTSIDE_SLOT; + } + + ClickAction action = new ClickAction(click, slot); + plan.add(action); + simulateAction(action); + } + + public void execute(boolean refresh) { + simulating = false; + ListIterator planIter = plan.listIterator(); + while (planIter.hasNext()) { + ClickAction action = planIter.next(); + + if (action.slot != Click.OUTSIDE_SLOT && translator.getSlotType(action.slot) != SlotType.NORMAL) { + refresh = true; + } + + ItemStack clickedItemStack; + if (!planIter.hasNext() && refresh) { + clickedItemStack = InventoryUtils.REFRESH_ITEM; + } else if (action.click.windowAction == WindowAction.DROP_ITEM || action.slot == Click.OUTSIDE_SLOT) { + clickedItemStack = null; + } else { + clickedItemStack = inventory.getItem(action.slot).getItemStack(); + } + + short actionId = inventory.getNextTransactionId(); + ClientWindowActionPacket clickPacket = new ClientWindowActionPacket( + inventory.getId(), + actionId, + action.slot, + clickedItemStack, + action.click.windowAction, + action.click.actionParam + ); + + simulateAction(action); + + session.sendDownstreamPacket(clickPacket); + if (clickedItemStack == InventoryUtils.REFRESH_ITEM) { + session.sendDownstreamPacket(new ClientConfirmTransactionPacket(inventory.getId(), actionId, true)); + } + System.out.println(clickPacket); + } + } + + public GeyserItemStack getItem(int slot) { + return simulatedItems.computeIfAbsent(slot, k -> inventory.getItem(slot).copy()); + } + + public GeyserItemStack getCursor() { + return simulatedCursor; + } + + private void setItem(int slot, GeyserItemStack item) { + if (simulating) { + simulatedItems.put(slot, item); + } else { + inventory.setItem(slot, item); + } + } + + private void setCursor(GeyserItemStack item) { + if (simulating) { + simulatedCursor = item; + } else { + session.getPlayerInventory().setCursor(item); + } + } + + private void simulateAction(ClickAction action) { + GeyserItemStack cursor = simulating ? getCursor() : session.getPlayerInventory().getCursor(); + switch (action.click) { + case LEFT_OUTSIDE: + setCursor(GeyserItemStack.EMPTY); + return; + case RIGHT_OUTSIDE: + if (!cursor.isEmpty()) { + cursor.sub(1); + } + return; + } + + GeyserItemStack clicked = simulating ? getItem(action.slot) : inventory.getItem(action.slot); + if (translator.getSlotType(action.slot) == SlotType.OUTPUT) { + if (cursor.isEmpty() && !clicked.isEmpty()) { + setCursor(clicked.copy()); + } else if (InventoryUtils.canStack(cursor, clicked)) { + cursor.add(clicked.getAmount()); + } + } else { + switch (action.click) { + case LEFT: + if (!InventoryUtils.canStack(cursor, clicked)) { + setCursor(clicked); + setItem(action.slot, cursor); + } else { + setCursor(GeyserItemStack.EMPTY); + clicked.add(cursor.getAmount()); + } + break; + case RIGHT: + if (cursor.isEmpty() && !clicked.isEmpty()) { + int half = clicked.getAmount() / 2; //smaller half + setCursor(clicked.copy(clicked.getAmount() - half)); //larger half + clicked.setAmount(half); + } else if (!cursor.isEmpty() && clicked.isEmpty()) { + cursor.sub(1); + setItem(action.slot, cursor.copy(1)); + } else if (InventoryUtils.canStack(cursor, clicked)) { + cursor.sub(1); + clicked.add(1); + } + break; + case DROP_ONE: + if (!clicked.isEmpty()) { + clicked.sub(1); + } + break; + case DROP_ALL: + setItem(action.slot, GeyserItemStack.EMPTY); + break; + } + } + } + + public Set getAffectedSlots() { + Set affectedSlots = new HashSet<>(); + for (ClickAction action : plan) { + if (translator.getSlotType(action.slot) == SlotType.NORMAL && action.slot != Click.OUTSIDE_SLOT) { + affectedSlots.add(action.slot); + } + } + return affectedSlots; + } + + @Value + private static class ClickAction { + Click click; + int slot; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java index e45945bc3..58e6178b4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java @@ -49,7 +49,7 @@ public class ChestInventoryUpdater extends InventoryUpdater { ItemData[] bedrockItems = new ItemData[paddedSize]; for (int i = 0; i < bedrockItems.length; i++) { if (i < translator.size) { - bedrockItems[i] = ItemTranslator.translateToBedrock(session, inventory.getItem(i)); + bedrockItems[i] = inventory.getItem(i).getItemData(session); } else { bedrockItems[i] = UNUSUABLE_SPACE_BLOCK; } @@ -69,7 +69,7 @@ public class ChestInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(inventory.getId()); slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(javaSlot))); + slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session)); session.sendUpstreamPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java index 51f33ac43..1abc65b5b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java @@ -40,7 +40,7 @@ public class ContainerInventoryUpdater extends InventoryUpdater { ItemData[] bedrockItems = new ItemData[translator.size]; for (int i = 0; i < bedrockItems.length; i++) { - bedrockItems[translator.javaSlotToBedrock(i)] = ItemTranslator.translateToBedrock(session, inventory.getItem(i)); + bedrockItems[translator.javaSlotToBedrock(i)] = inventory.getItem(i).getItemData(session); } InventoryContentPacket contentPacket = new InventoryContentPacket(); @@ -57,7 +57,7 @@ public class ContainerInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(inventory.getId()); slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(javaSlot))); + slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session)); session.sendUpstreamPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java index 57601a9e0..655868c9a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java @@ -39,7 +39,7 @@ public abstract class InventoryUpdater { ItemData[] bedrockItems = new ItemData[36]; for (int i = 0; i < 36; i++) { final int offset = i < 9 ? 27 : -9; - bedrockItems[i] = ItemTranslator.translateToBedrock(session, inventory.getItem(translator.size + i + offset)); + bedrockItems[i] = inventory.getItem(translator.size + i + offset).getItemData(session); } InventoryContentPacket contentPacket = new InventoryContentPacket(); contentPacket.setContainerId(ContainerId.INVENTORY); @@ -52,7 +52,7 @@ public abstract class InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.INVENTORY); slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(javaSlot))); + slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session)); session.sendUpstreamPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java similarity index 89% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java rename to connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java index 26d889900..5100ddc99 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/CursorInventoryUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java @@ -32,9 +32,8 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator; -public class CursorInventoryUpdater extends InventoryUpdater { +public class UIInventoryUpdater extends InventoryUpdater { - //TODO: Consider renaming this? Since the Protocol enum updated @Override public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { super.updateInventory(translator, session, inventory); @@ -46,7 +45,7 @@ public class CursorInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.UI); slotPacket.setSlot(bedrockSlot); - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(i))); + slotPacket.setItem(inventory.getItem(i).getItemData(session)); session.sendUpstreamPacket(slotPacket); } } @@ -59,7 +58,7 @@ public class CursorInventoryUpdater extends InventoryUpdater { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.UI); slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); - slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(javaSlot))); + slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session)); session.sendUpstreamPacket(slotPacket); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java index 9ffb4f0d9..559da5d97 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java @@ -34,6 +34,8 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import lombok.AllArgsConstructor; @@ -51,8 +53,10 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator recipeMap = new Int2ObjectOpenHashMap<>(); CraftingDataPacket craftingDataPacket = new CraftingDataPacket(); craftingDataPacket.setCleanRecipes(true); + int netId = 1; for (Recipe recipe : packet.getRecipes()) { switch (recipe.getType()) { case CRAFTING_SHAPELESS: { @@ -63,7 +67,8 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator // Max health must be divisible by two in bedrock entity.getAttributes().put(AttributeType.HEALTH, AttributeType.HEALTH.getAttribute(maxHealth, (maxHealth % 2 == 1 ? maxHealth + 1 : maxHealth))); - session.getInventoryCache().setOpenInventory(null); + session.setOpenInventory(null); SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket(); playerGameTypePacket.setGamemode(packet.getGamemode().ordinal()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java index 9ed11a23d..05cc1a418 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java @@ -32,6 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -71,15 +72,9 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator { + PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); + hotbarPacket.setContainerId(0); + hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); + hotbarPacket.setSelectHotbarSlot(true); + session.sendUpstreamPacket(hotbarPacket); - session.getInventory().setHeldItemSlot(packet.getSlot()); + session.getPlayerInventory().setHeldItemSlot(packet.getSlot()); + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java index 93cfa08e4..68f1dda91 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java @@ -26,6 +26,7 @@ package org.geysermc.connector.network.translators.java.window; import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket; +import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -36,7 +37,8 @@ public class JavaCloseWindowTranslator extends PacketTranslator { + InventoryUtils.closeInventory(session, packet.getWindowId()); + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaConfirmTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaConfirmTransactionTranslator.java index e67877536..6d6c1686c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaConfirmTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaConfirmTransactionTranslator.java @@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.java.window; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientConfirmTransactionPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerConfirmTransactionPacket; +import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -36,9 +37,11 @@ public class JavaConfirmTransactionTranslator extends PacketTranslator { + if (!packet.isAccepted()) { + ClientConfirmTransactionPacket confirmPacket = new ClientConfirmTransactionPacket(packet.getWindowId(), packet.getActionId(), true); + session.sendDownstreamPacket(confirmPacket); + } + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java index 820639b3d..e5ef4ecf5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java @@ -43,46 +43,47 @@ public class JavaOpenWindowTranslator extends PacketTranslator { + if (packet.getWindowId() == 0) { + return; + } + + InventoryTranslator newTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(packet.getType()); + Inventory openInventory = session.getOpenInventory(); + //No translator exists for this window type. Close all windows and return. + if (newTranslator == null) { + if (openInventory != null) { + InventoryUtils.closeInventory(session, openInventory.getId()); + } + ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(packet.getWindowId()); + session.sendDownstreamPacket(closeWindowPacket); + return; + } + + String name = packet.getName(); + try { + JsonParser parser = new JsonParser(); + JsonObject jsonObject = parser.parse(packet.getName()).getAsJsonObject(); + if (jsonObject.has("text")) { + name = jsonObject.get("text").getAsString(); + } else if (jsonObject.has("translate")) { + name = jsonObject.get("translate").getAsString(); + } + } catch (Exception e) { + GeyserConnector.getInstance().getLogger().debug("JavaOpenWindowTranslator: " + e.toString()); + } + + name = LocaleUtils.getLocaleString(name, session.getClientData().getLanguageCode()); + + Inventory newInventory = newTranslator.createInventory(name, packet.getWindowId(), packet.getType(), session.getPlayerInventory()); if (openInventory != null) { - InventoryUtils.closeWindow(session, openInventory.getId()); - InventoryUtils.closeInventory(session, openInventory.getId()); + InventoryTranslator openTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(openInventory.getWindowType()); + if (!openTranslator.getClass().equals(newTranslator.getClass())) { + InventoryUtils.closeInventory(session, openInventory.getId()); + } } - ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(packet.getWindowId()); - session.sendDownstreamPacket(closeWindowPacket); - return; - } - String name = packet.getName(); - try { - JsonParser parser = new JsonParser(); - JsonObject jsonObject = parser.parse(packet.getName()).getAsJsonObject(); - if (jsonObject.has("text")) { - name = jsonObject.get("text").getAsString(); - } else if (jsonObject.has("translate")) { - name = jsonObject.get("translate").getAsString(); - } - } catch (Exception e) { - GeyserConnector.getInstance().getLogger().debug("JavaOpenWindowTranslator: " + e.toString()); - } - - name = LocaleUtils.getLocaleString(name, session.getClientData().getLanguageCode()); - - Inventory newInventory = new Inventory(name, packet.getWindowId(), packet.getType(), newTranslator.size + 36); - session.getInventoryCache().cacheInventory(newInventory); - if (openInventory != null) { - InventoryTranslator openTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(openInventory.getWindowType()); - if (!openTranslator.getClass().equals(newTranslator.getClass())) { - InventoryUtils.closeWindow(session, openInventory.getId()); - InventoryUtils.closeInventory(session, openInventory.getId()); - } - } - - InventoryUtils.openInventory(session, newInventory); + InventoryUtils.openInventory(session, newInventory); + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java index 19d7db217..22a0edcac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java @@ -26,37 +26,53 @@ package org.geysermc.connector.network.translators.java.window; import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; -import java.util.Objects; - @Translator(packet = ServerSetSlotPacket.class) public class JavaSetSlotTranslator extends PacketTranslator { @Override public void translate(ServerSetSlotPacket packet, GeyserSession session) { - if (packet.getWindowId() == 255 && packet.getSlot() == -1) { //cursor - if (session.getCraftSlot() != 0) + session.addInventoryTask(() -> { + if (packet.getWindowId() == 255) { //cursor + GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); + GeyserItemStack oldItem = session.getPlayerInventory().getCursor(); + if (newItem.getItemData(session).equals(oldItem.getItemData(session))) { + newItem.setNetId(oldItem.getNetId()); + } else { + newItem.setNetId(session.getItemNetId().getAndIncrement()); + } + session.getPlayerInventory().setCursor(newItem); + InventoryUtils.updateCursor(session); + return; + } + + //TODO: support window id -2, should update player inventory + Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); + if (inventory == null) return; - session.getInventory().setCursor(packet.getItem()); - InventoryUtils.updateCursor(session); - return; - } - - Inventory inventory = session.getInventoryCache().getInventories().get(packet.getWindowId()); - if (inventory == null || (packet.getWindowId() != 0 && inventory.getWindowType() == null)) - return; - - InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); - if (translator != null) { - inventory.setItem(packet.getSlot(), packet.getItem()); - translator.updateSlot(session, inventory, packet.getSlot()); - } + InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); + if (translator != null) { + GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); + GeyserItemStack oldItem = inventory.getItem(packet.getSlot()); + if (newItem.getItemData(session).equals(oldItem.getItemData(session), false, false, false)) { + newItem.setNetId(oldItem.getNetId()); + System.out.println("OLD: " + newItem.getNetId()); + } else { + newItem.setNetId(session.getItemNetId().getAndIncrement()); + System.out.println("NEW: " + newItem.getNetId()); + } + inventory.setItem(packet.getSlot(), newItem); + translator.updateSlot(session, inventory, packet.getSlot()); + } + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java index 2cc392f53..26aab47b3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java @@ -26,32 +26,40 @@ package org.geysermc.connector.network.translators.java.window; import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket; +import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; - -import java.util.Arrays; +import org.geysermc.connector.utils.InventoryUtils; @Translator(packet = ServerWindowItemsPacket.class) public class JavaWindowItemsTranslator extends PacketTranslator { @Override public void translate(ServerWindowItemsPacket packet, GeyserSession session) { - Inventory inventory = session.getInventoryCache().getInventories().get(packet.getWindowId()); - if (inventory == null || (packet.getWindowId() != 0 && inventory.getWindowType() == null)) - return; + session.addInventoryTask(() -> { + Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); + if (inventory == null) + return; - if (packet.getItems().length < inventory.getSize()) { - inventory.setItems(Arrays.copyOf(packet.getItems(), inventory.getSize())); - } else { - inventory.setItems(packet.getItems()); - } + for (int i = 0; i < packet.getItems().length; i++) { + GeyserItemStack newItem = GeyserItemStack.from(packet.getItems()[i]); + GeyserItemStack oldItem = inventory.getItem(i); + if (newItem.getItemData(session).equals(oldItem.getItemData(session), false, false, false)) { + newItem.setNetId(oldItem.getNetId()); + } else { + newItem.setNetId(session.getItemNetId().getAndIncrement()); + } + inventory.setItem(i, newItem); + } - InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); - if (translator != null) { - translator.updateInventory(session, inventory); - } + InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); + if (translator != null) { + translator.updateInventory(session, inventory); + } + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java index daebed1b6..97c4708ff 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java @@ -31,19 +31,22 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.connector.utils.InventoryUtils; @Translator(packet = ServerWindowPropertyPacket.class) public class JavaWindowPropertyTranslator extends PacketTranslator { @Override public void translate(ServerWindowPropertyPacket packet, GeyserSession session) { - Inventory inventory = session.getInventoryCache().getInventories().get(packet.getWindowId()); - if (inventory == null || (packet.getWindowId() != 0 && inventory.getWindowType() == null)) - return; + session.addInventoryTask(() -> { + Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); + if (inventory == null) + return; - InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); - if (translator != null) { - translator.updateProperty(session, inventory, packet.getRawProperty(), packet.getValue()); - } + InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); + if (translator != null) { + translator.updateProperty(session, inventory, packet.getRawProperty(), packet.getValue()); + } + }); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java index d7961dd98..cb1aeaa71 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java @@ -111,7 +111,7 @@ public class JavaNotifyClientTranslator extends PacketTranslator tags = new ArrayList<>(); - for (VillagerTrade trade : packet.getTrades()) { + for (int i = 0; i < packet.getTrades().length; i++) { + VillagerTrade trade = packet.getTrades()[i]; NbtMapBuilder recipe = NbtMap.builder(); - recipe.putInt("maxUses", trade.getMaxUses()); + recipe.putInt("netId", i + 1); + recipe.putInt("maxUses", trade.isTradeDisabled() ? 0 : trade.getMaxUses()); recipe.putInt("traderExp", trade.getXp()); recipe.putFloat("priceMultiplierA", trade.getPriceMultiplier()); recipe.put("sell", getItemTag(session, trade.getOutput(), 0)); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java b/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java index f3dff0cc2..ab73e6028 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java @@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.sound; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemRegistry; @@ -60,12 +61,12 @@ public interface BlockSoundInteractionHandler extends SoundInteractionHandler 500) { - ContainerClosePacket closePacket = new ContainerClosePacket(); - closePacket.setId((byte) windowId); - session.sendUpstreamPacket(closePacket); + Inventory inventory = getInventory(session, windowId); + if (inventory != null) { + InventoryTranslator translator = InventoryTranslator.INVENTORY_TRANSLATORS.get(inventory.getWindowType()); + translator.closeInventory(session, inventory); session.setLastWindowCloseTime(System.currentTimeMillis()); } - */ + session.setOpenInventory(null); + } + + public static Inventory getInventory(GeyserSession session, int windowId) { + if (windowId == 0) { + return session.getPlayerInventory(); + } else { + Inventory openInventory = session.getOpenInventory(); + if (openInventory != null && windowId == openInventory.getId()) { + return openInventory; + } + return null; + } } public static void updateCursor(GeyserSession session) { InventorySlotPacket cursorPacket = new InventorySlotPacket(); cursorPacket.setContainerId(ContainerId.UI); cursorPacket.setSlot(0); - cursorPacket.setItem(ItemTranslator.translateToBedrock(session, session.getInventory().getCursor())); + cursorPacket.setItem(session.getPlayerInventory().getCursor().getItemData(session)); session.sendUpstreamPacket(cursorPacket); } + public static boolean canStack(GeyserItemStack item1, GeyserItemStack item2) { + if (item1.isEmpty() || item2.isEmpty()) + return false; + return item1.getId() == item2.getId() && Objects.equals(item1.getNbt(), item2.getNbt()); + } + public static boolean canStack(ItemStack item1, ItemStack item2) { if (item1 == null || item2 == null) return false; @@ -170,19 +162,16 @@ public class InventoryUtils { */ public static void findOrCreatePickedBlock(GeyserSession session, String itemName) { // Get the inventory to choose a slot to pick - Inventory inventory = session.getInventoryCache().getOpenInventory(); - if (inventory == null) { - inventory = session.getInventory(); - } + PlayerInventory inventory = session.getPlayerInventory(); // Check hotbar for item for (int i = 36; i < 45; i++) { - if (inventory.getItem(i) == null) { + GeyserItemStack geyserItem = inventory.getItem(i); + if (geyserItem.isEmpty()) { continue; } - ItemEntry item = ItemRegistry.getItem(inventory.getItem(i)); // If this isn't the item we're looking for - if (!item.getJavaIdentifier().equals(itemName)) { + if (!geyserItem.getItemEntry().getJavaIdentifier().equals(itemName)) { continue; } @@ -193,12 +182,12 @@ public class InventoryUtils { // Check inventory for item for (int i = 9; i < 36; i++) { - if (inventory.getItem(i) == null) { + GeyserItemStack geyserItem = inventory.getItem(i); + if (geyserItem.isEmpty()) { continue; } - ItemEntry item = ItemRegistry.getItem(inventory.getItem(i)); // If this isn't the item we're looking for - if (!item.getJavaIdentifier().equals(itemName)) { + if (!geyserItem.getItemEntry().getJavaIdentifier().equals(itemName)) { continue; } @@ -209,10 +198,10 @@ public class InventoryUtils { // If we still have not found the item, and we're in creative, ask for the item from the server. if (session.getGameMode() == GameMode.CREATIVE) { - int slot = session.getInventory().getHeldItemSlot() + 36; - if (session.getInventory().getItemInHand() != null) { // Otherwise we should just use the current slot + int slot = inventory.getHeldItemSlot() + 36; + if (!inventory.getItemInHand().isEmpty()) { // Otherwise we should just use the current slot for (int i = 36; i < 45; i++) { - if (inventory.getItem(i) == null) { + if (inventory.getItem(i).isEmpty()) { slot = i; break; } @@ -221,7 +210,7 @@ public class InventoryUtils { ClientCreativeInventoryActionPacket actionPacket = new ClientCreativeInventoryActionPacket(slot, new ItemStack(ItemRegistry.getItemEntry(itemName).getJavaId())); - if ((slot - 36) != session.getInventory().getHeldItemSlot()) { + if ((slot - 36) != inventory.getHeldItemSlot()) { setHotbarItem(session, slot); } session.sendDownstreamPacket(actionPacket); diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index 5f2179226..93b2caed3 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit 5f21792264a364e32425014e0be79db93593da1e +Subproject commit 93b2caed3c4ecd94b3c77a87f1b2304a7bf4f062 diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 0fae8d3f0..ec8b68297 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 0fae8d3f0de6210a10435a36128db14cb7650ae6 +Subproject commit ec8b68297c4d62a9e4d640a8c7e77977062628ee From c9102348ded01f7fa058dcbbe983413a2b8dcd49 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 30 Oct 2020 00:58:17 +0100 Subject: [PATCH 009/766] First version of the Forms rewrite The next version will split the implementation from the api --- common/pom.xml | 2 +- .../org/geysermc/common/form/CustomForm.java | 177 ++++++++++++++++ .../java/org/geysermc/common/form/Form.java | 137 +++++++++++++ .../org/geysermc/common/form/ModalForm.java | 103 ++++++++++ .../org/geysermc/common/form/SimpleForm.java | 117 +++++++++++ .../component/ButtonComponent.java} | 37 ++-- .../common/form/component/Component.java | 77 +++++++ .../form/component/DropdownComponent.java | 102 +++++++++ .../component/InputComponent.java | 40 ++-- .../component/LabelComponent.java | 19 +- .../form/component/SliderComponent.java | 73 +++++++ .../form/component/StepSliderComponent.java | 116 +++++++++++ .../component/ToggleComponent.java | 35 ++-- .../form/response/CustomFormResponse.java | 193 ++++++++++++++++++ .../response/FormResponse.java | 8 +- .../response/ModalFormResponse.java} | 47 ++--- .../response/SimpleFormResponse.java} | 52 ++--- .../common/form/util/FormAdaptor.java | 126 ++++++++++++ .../button => form/util}/FormImage.java | 36 ++-- .../common/window/CustomFormBuilder.java | 71 ------- .../common/window/CustomFormWindow.java | 165 --------------- .../common/window/ModalFormWindow.java | 82 -------- .../common/window/SimpleFormWindow.java | 94 --------- .../window/component/DropdownComponent.java | 56 ----- .../window/component/FormComponent.java | 38 ---- .../window/component/SliderComponent.java | 65 ------ .../window/response/CustomFormResponse.java | 46 ----- .../window/response/FormResponseData.java | 37 ---- .../window/response/ModalFormResponse.java | 38 ---- .../window/response/SimpleFormResponse.java | 39 ---- .../network/UpstreamPacketHandler.java | 10 +- .../network/session/GeyserSession.java | 28 ++- .../{WindowCache.java => FormCache.java} | 70 +++---- ...edrockServerSettingsRequestTranslator.java | 8 +- .../java/JavaPluginMessageTranslator.java | 72 +++++-- .../connector/utils/LoginEncryptionUtils.java | 114 ++++------- .../connector/utils/SettingsUtils.java | 141 +++++-------- 37 files changed, 1559 insertions(+), 1112 deletions(-) create mode 100644 common/src/main/java/org/geysermc/common/form/CustomForm.java create mode 100644 common/src/main/java/org/geysermc/common/form/Form.java create mode 100644 common/src/main/java/org/geysermc/common/form/ModalForm.java create mode 100644 common/src/main/java/org/geysermc/common/form/SimpleForm.java rename common/src/main/java/org/geysermc/common/{window/button/FormButton.java => form/component/ButtonComponent.java} (65%) create mode 100644 common/src/main/java/org/geysermc/common/form/component/Component.java create mode 100644 common/src/main/java/org/geysermc/common/form/component/DropdownComponent.java rename common/src/main/java/org/geysermc/common/{window => form}/component/InputComponent.java (62%) rename common/src/main/java/org/geysermc/common/{window => form}/component/LabelComponent.java (81%) create mode 100644 common/src/main/java/org/geysermc/common/form/component/SliderComponent.java create mode 100644 common/src/main/java/org/geysermc/common/form/component/StepSliderComponent.java rename common/src/main/java/org/geysermc/common/{window => form}/component/ToggleComponent.java (70%) create mode 100644 common/src/main/java/org/geysermc/common/form/response/CustomFormResponse.java rename common/src/main/java/org/geysermc/common/{window => form}/response/FormResponse.java (87%) rename common/src/main/java/org/geysermc/common/{window/FormWindow.java => form/response/ModalFormResponse.java} (55%) rename common/src/main/java/org/geysermc/common/{window/component/StepSliderComponent.java => form/response/SimpleFormResponse.java} (56%) create mode 100644 common/src/main/java/org/geysermc/common/form/util/FormAdaptor.java rename common/src/main/java/org/geysermc/common/{window/button => form/util}/FormImage.java (72%) delete mode 100644 common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java delete mode 100644 common/src/main/java/org/geysermc/common/window/CustomFormWindow.java delete mode 100644 common/src/main/java/org/geysermc/common/window/ModalFormWindow.java delete mode 100644 common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java delete mode 100644 common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java delete mode 100644 common/src/main/java/org/geysermc/common/window/component/FormComponent.java delete mode 100644 common/src/main/java/org/geysermc/common/window/component/SliderComponent.java delete mode 100644 common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java delete mode 100644 common/src/main/java/org/geysermc/common/window/response/FormResponseData.java delete mode 100644 common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java delete mode 100644 common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java rename connector/src/main/java/org/geysermc/connector/network/session/cache/{WindowCache.java => FormCache.java} (56%) diff --git a/common/pom.xml b/common/pom.xml index 85dde12c6..30c8afc06 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -15,7 +15,7 @@ com.google.code.gson gson - 2.8.2 + 2.8.5 compile diff --git a/common/src/main/java/org/geysermc/common/form/CustomForm.java b/common/src/main/java/org/geysermc/common/form/CustomForm.java new file mode 100644 index 000000000..5e8d93252 --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/CustomForm.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2019-2020 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.common.form; + +import com.google.gson.annotations.JsonAdapter; +import lombok.Getter; +import org.geysermc.common.form.component.*; +import org.geysermc.common.form.response.CustomFormResponse; +import org.geysermc.common.form.util.FormAdaptor; +import org.geysermc.common.form.util.FormImage; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Getter +@JsonAdapter(FormAdaptor.class) +public final class CustomForm extends Form { + private final String title; + private final FormImage icon; + private final List content; + + private CustomForm(String title, FormImage icon, List content) { + super(Form.Type.CUSTOM_FORM); + + this.title = title; + this.icon = icon; + this.content = Collections.unmodifiableList(content); + } + + public static Builder builder() { + return new Builder(); + } + + public static CustomForm of(String title, FormImage icon, List content) { + return new CustomForm(title, icon, content); + } + + public CustomFormResponse parseResponse(String data) { + if (isClosed(data)) { + return CustomFormResponse.closed(); + } + return CustomFormResponse.of(this, data); + } + + public static final class Builder extends Form.Builder { + private final List components = new ArrayList<>(); + private FormImage icon; + + public Builder icon(FormImage.Type type, String data) { + icon = FormImage.of(type, data); + return this; + } + + public Builder iconPath(String path) { + return icon(FormImage.Type.PATH, path); + } + + public Builder iconUrl(String url) { + return icon(FormImage.Type.URL, url); + } + + public Builder component(Component component) { + components.add(component); + return this; + } + + public Builder dropdown(DropdownComponent.Builder dropdownBuilder) { + return component(dropdownBuilder.translateAndBuild(this::translate)); + } + + public Builder dropdown(String text, int defaultOption, String... options) { + List optionsList = new ArrayList<>(); + for (String option : options) { + optionsList.add(translate(option)); + } + return component(DropdownComponent.of(translate(text), optionsList, defaultOption)); + } + + public Builder dropdown(String text, String... options) { + return dropdown(text, -1, options); + } + + public Builder input(String text, String placeholder, String defaultText) { + return component(InputComponent.of( + translate(text), translate(placeholder), translate(defaultText) + )); + } + + public Builder input(String text, String placeholder) { + return component(InputComponent.of(translate(text), translate(placeholder))); + } + + public Builder input(String text) { + return component(InputComponent.of(translate(text))); + } + + public Builder label(String text) { + return component(LabelComponent.of(translate(text))); + } + + public Builder slider(String text, float min, float max, int step, float defaultValue) { + return component(SliderComponent.of(text, min, max, step, defaultValue)); + } + + public Builder slider(String text, float min, float max, int step) { + return slider(text, min, max, step, -1); + } + + public Builder slider(String text, float min, float max, float defaultValue) { + return slider(text, min, max, -1, defaultValue); + } + + public Builder slider(String text, float min, float max) { + return slider(text, min, max, -1, -1); + } + + public Builder stepSlider(StepSliderComponent.Builder stepSliderBuilder) { + return component(stepSliderBuilder.translateAndBuild(this::translate)); + } + + public Builder stepSlider(String text, int defaultStep, String... steps) { + List stepsList = new ArrayList<>(); + for (String option : steps) { + stepsList.add(translate(option)); + } + return component(StepSliderComponent.of(translate(text), stepsList, defaultStep)); + } + + public Builder stepSlider(String text, String... steps) { + return stepSlider(text, -1, steps); + } + + public Builder toggle(String text, boolean defaultValue) { + return component(ToggleComponent.of(translate(text), defaultValue)); + } + + public Builder toggle(String text) { + return component(ToggleComponent.of(translate(text))); + } + + @Override + public CustomForm build() { + CustomForm form = of(title, icon, components); + if (biResponseHandler != null) { + form.setResponseHandler(response -> biResponseHandler.accept(form, response)); + return form; + } + + form.setResponseHandler(responseHandler); + return form; + } + } +} diff --git a/common/src/main/java/org/geysermc/common/form/Form.java b/common/src/main/java/org/geysermc/common/form/Form.java new file mode 100644 index 000000000..5b3437572 --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/Form.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2019-2020 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.common.form; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import org.geysermc.common.form.response.FormResponse; + +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Consumer; + +@Getter +public abstract class Form { + protected static final Gson GSON = new Gson(); + private final Type type; + + @Getter(AccessLevel.NONE) + protected String hardcodedJsonData = null; + + @Setter protected Consumer responseHandler; + + public Form(Type type) { + this.type = type; + } + + public String getJsonData() { + if (hardcodedJsonData != null) { + return hardcodedJsonData; + } + return GSON.toJson(this); + } + + public abstract FormResponse parseResponse(String response); + + @SuppressWarnings("unchecked") + public T parseResponseAs(String response) { + return (T) parseResponse(response); + } + + public boolean isClosed(String response) { + return response == null || response.isEmpty() || response.equalsIgnoreCase("null"); + } + + @Getter + @RequiredArgsConstructor + public enum Type { + @SerializedName("form") + SIMPLE_FORM(SimpleForm.class), + @SerializedName("modal") + MODAL_FORM(ModalForm.class), + @SerializedName("custom_form") + CUSTOM_FORM(CustomForm.class); + + private static final Type[] VALUES = values(); + private final Class typeClass; + + public static Type getByOrdinal(int ordinal) { + return ordinal < VALUES.length ? VALUES[ordinal] : null; + } + } + + public static abstract class Builder, F extends Form> { + protected String title = ""; + + protected BiFunction translationHandler = null; + protected BiConsumer biResponseHandler; + protected Consumer responseHandler; + protected String locale; + + public T title(String title) { + this.title = translate(title); + return self(); + } + + public T translator(BiFunction translator, String locale) { + this.translationHandler = translator; + this.locale = locale; + return title(title); + } + + public T translator(BiFunction translator) { + return translator(translator, locale); + } + + public T responseHandler(BiConsumer responseHandler) { + biResponseHandler = responseHandler; + return self(); + } + + public T responseHandler(Consumer responseHandler) { + this.responseHandler = responseHandler; + return self(); + } + + public abstract F build(); + + protected String translate(String text) { + if (translationHandler != null && text != null && !text.isEmpty()) { + return translationHandler.apply(text, locale); + } + return text; + } + + @SuppressWarnings("unchecked") + protected T self() { + return (T) this; + } + } +} diff --git a/common/src/main/java/org/geysermc/common/form/ModalForm.java b/common/src/main/java/org/geysermc/common/form/ModalForm.java new file mode 100644 index 000000000..10309f9c2 --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/ModalForm.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2019-2020 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.common.form; + +import com.google.gson.annotations.JsonAdapter; +import lombok.Getter; +import org.geysermc.common.form.response.ModalFormResponse; +import org.geysermc.common.form.util.FormAdaptor; + +@Getter +@JsonAdapter(FormAdaptor.class) +public class ModalForm extends Form { + private final String title; + private final String content; + private final String button1; + private final String button2; + + private ModalForm(String title, String content, String button1, String button2) { + super(Type.MODAL_FORM); + + this.title = title; + this.content = content; + this.button1 = button1; + this.button2 = button2; + } + + public static Builder builder() { + return new Builder(); + } + + public static ModalForm of(String title, String content, String button1, String button2) { + return new ModalForm(title, content, button1, button2); + } + + public ModalFormResponse parseResponse(String data) { + if (isClosed(data)) { + return ModalFormResponse.closed(); + } + + if ("true".equals(data)) { + return ModalFormResponse.of(0, button1); + } else if ("false".equals(data)) { + return ModalFormResponse.of(1, button2); + } + return ModalFormResponse.invalid(); + } + + public static final class Builder extends Form.Builder { + private String content; + private String button1; + private String button2; + + public Builder content(String content) { + this.content = translate(content); + return this; + } + + public Builder button1(String button1) { + this.button1 = translate(button1); + return this; + } + + public Builder button2(String button2) { + this.button2 = translate(button2); + return this; + } + + @Override + public ModalForm build() { + ModalForm form = of(title, content, button1, button2); + if (biResponseHandler != null) { + form.setResponseHandler(response -> biResponseHandler.accept(form, response)); + return form; + } + + form.setResponseHandler(responseHandler); + return form; + } + } +} diff --git a/common/src/main/java/org/geysermc/common/form/SimpleForm.java b/common/src/main/java/org/geysermc/common/form/SimpleForm.java new file mode 100644 index 000000000..1a1ce616b --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/SimpleForm.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019-2020 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.common.form; + +import com.google.gson.annotations.JsonAdapter; +import lombok.Getter; +import org.geysermc.common.form.component.ButtonComponent; +import org.geysermc.common.form.response.SimpleFormResponse; +import org.geysermc.common.form.util.FormAdaptor; +import org.geysermc.common.form.util.FormImage; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Getter +@JsonAdapter(FormAdaptor.class) +public final class SimpleForm extends Form { + private final String title; + private final String content; + private final List buttons; + + private SimpleForm(String title, String content, List buttons) { + super(Type.SIMPLE_FORM); + + this.title = title; + this.content = content; + this.buttons = Collections.unmodifiableList(buttons); + } + + public static Builder builder() { + return new Builder(); + } + + public static SimpleForm of(String title, String content, List buttons) { + return new SimpleForm(title, content, buttons); + } + + public SimpleFormResponse parseResponse(String data) { + if (isClosed(data)) { + return SimpleFormResponse.closed(); + } + + int buttonId; + try { + buttonId = Integer.parseInt(data); + } catch (Exception exception) { + return SimpleFormResponse.invalid(); + } + + if (buttonId >= buttons.size()) { + return SimpleFormResponse.invalid(); + } + + return SimpleFormResponse.of(buttonId, buttons.get(buttonId)); + } + + public static final class Builder extends Form.Builder { + private final List buttons = new ArrayList<>(); + private String content; + + public Builder content(String content) { + this.content = translate(content); + return this; + } + + public Builder button(String text, FormImage.Type type, String data) { + buttons.add(ButtonComponent.of(translate(text), type, data)); + return this; + } + + public Builder button(String text, FormImage image) { + buttons.add(ButtonComponent.of(translate(text), image)); + return this; + } + + public Builder button(String text) { + buttons.add(ButtonComponent.of(translate(text))); + return this; + } + + @Override + public SimpleForm build() { + SimpleForm form = of(title, content, buttons); + if (biResponseHandler != null) { + form.setResponseHandler(response -> biResponseHandler.accept(form, response)); + return form; + } + + form.setResponseHandler(responseHandler); + return form; + } + } +} diff --git a/common/src/main/java/org/geysermc/common/window/button/FormButton.java b/common/src/main/java/org/geysermc/common/form/component/ButtonComponent.java similarity index 65% rename from common/src/main/java/org/geysermc/common/window/button/FormButton.java rename to common/src/main/java/org/geysermc/common/form/component/ButtonComponent.java index 6daa2feae..de241e3dd 100644 --- a/common/src/main/java/org/geysermc/common/window/button/FormButton.java +++ b/common/src/main/java/org/geysermc/common/form/component/ButtonComponent.java @@ -23,35 +23,28 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.button; +package org.geysermc.common.form.component; +import lombok.AccessLevel; import lombok.Getter; -import lombok.Setter; +import lombok.RequiredArgsConstructor; +import org.geysermc.common.form.util.FormImage; -public class FormButton { +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public final class ButtonComponent { + private final String text; + private final FormImage image; - @Getter - @Setter - private String text; - - @Getter - private FormImage image; - - public FormButton(String text) { - this.text = text; + public static ButtonComponent of(String text, FormImage image) { + return new ButtonComponent(text, image); } - public FormButton(String text, FormImage image) { - this.text = text; - - if (image.getData() != null && !image.getData().isEmpty()) { - this.image = image; - } + public static ButtonComponent of(String text, FormImage.Type type, String data) { + return of(text, FormImage.of(type, data)); } - public void setImage(FormImage image) { - if (image.getData() != null && !image.getData().isEmpty()) { - this.image = image; - } + public static ButtonComponent of(String text) { + return of(text, null); } } diff --git a/common/src/main/java/org/geysermc/common/form/component/Component.java b/common/src/main/java/org/geysermc/common/form/component/Component.java new file mode 100644 index 000000000..8f44a2a0a --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/component/Component.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2019-2020 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.common.form.component; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +import java.util.Objects; + +@Getter +public abstract class Component { + private final Type type; + private final String text; + + Component(Type type, String text) { + Objects.requireNonNull(type, "Type cannot be null"); + Objects.requireNonNull(text, "Text cannot be null"); + + this.type = type; + this.text = text; + } + + @Getter + @RequiredArgsConstructor + public enum Type { + @SerializedName("dropdown") + DROPDOWN(DropdownComponent.class), + @SerializedName("input") + INPUT(InputComponent.class), + @SerializedName("label") + LABEL(LabelComponent.class), + @SerializedName("slider") + SLIDER(SliderComponent.class), + @SerializedName("step_slider") + STEP_SLIDER(StepSliderComponent.class), + @SerializedName("toggle") + TOGGLE(ToggleComponent.class); + + private static final Type[] VALUES = values(); + + private final String name = name().toLowerCase(); + private final Class componentClass; + + public static Type getByName(String name) { + for (Type type : VALUES) { + if (type.name.equals(name)) { + return type; + } + } + return null; + } + } +} diff --git a/common/src/main/java/org/geysermc/common/form/component/DropdownComponent.java b/common/src/main/java/org/geysermc/common/form/component/DropdownComponent.java new file mode 100644 index 000000000..6bf3f5e1a --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/component/DropdownComponent.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019-2020 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.common.form.component; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +@Getter +public class DropdownComponent extends Component { + private final List options; + @SerializedName("default") + private final int defaultOption; + + private DropdownComponent(String text, List options, int defaultOption) { + super(Type.DROPDOWN, text); + this.options = Collections.unmodifiableList(options); + this.defaultOption = defaultOption; + } + + public static DropdownComponent of(String text, List options, int defaultOption) { + if (defaultOption == -1 || defaultOption >= options.size()) { + defaultOption = 0; + } + return new DropdownComponent(text, options, defaultOption); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(String text) { + return builder().text(text); + } + + public static class Builder { + private final List options = new ArrayList<>(); + private String text; + private int defaultOption = 0; + + public Builder text(String text) { + this.text = text; + return this; + } + + public Builder option(String option, boolean isDefault) { + options.add(option); + if (isDefault) { + defaultOption = options.size() - 1; + } + return this; + } + + public Builder option(String option) { + return option(option, false); + } + + public Builder defaultOption(int defaultOption) { + this.defaultOption = defaultOption; + return this; + } + + public DropdownComponent build() { + return of(text, options, defaultOption); + } + + public DropdownComponent translateAndBuild(Function translator) { + for (int i = 0; i < options.size(); i++) { + options.set(i, translator.apply(options.get(i))); + } + + return of(translator.apply(text), options, defaultOption); + } + } +} diff --git a/common/src/main/java/org/geysermc/common/window/component/InputComponent.java b/common/src/main/java/org/geysermc/common/form/component/InputComponent.java similarity index 62% rename from common/src/main/java/org/geysermc/common/window/component/InputComponent.java rename to common/src/main/java/org/geysermc/common/form/component/InputComponent.java index fad6a0fed..b5e07535f 100644 --- a/common/src/main/java/org/geysermc/common/window/component/InputComponent.java +++ b/common/src/main/java/org/geysermc/common/form/component/InputComponent.java @@ -23,30 +23,32 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.component; +package org.geysermc.common.form.component; +import com.google.gson.annotations.SerializedName; import lombok.Getter; -import lombok.Setter; -public class InputComponent extends FormComponent { +@Getter +public class InputComponent extends Component { + private final String placeholder; + @SerializedName("default") + private final String defaultText; - @Getter - @Setter - private String text; - - @Getter - @Setter - private String placeholder; - - @Getter - @Setter - private String defaultText; - - public InputComponent(String text, String placeholder, String defaultText) { - super("input"); - - this.text = text; + private InputComponent(String text, String placeholder, String defaultText) { + super(Type.INPUT, text); this.placeholder = placeholder; this.defaultText = defaultText; } + + public static InputComponent of(String text, String placeholder, String defaultText) { + return new InputComponent(text, placeholder, defaultText); + } + + public static InputComponent of(String text, String placeholder) { + return new InputComponent(text, placeholder, ""); + } + + public static InputComponent of(String text) { + return new InputComponent(text, "", ""); + } } diff --git a/common/src/main/java/org/geysermc/common/window/component/LabelComponent.java b/common/src/main/java/org/geysermc/common/form/component/LabelComponent.java similarity index 81% rename from common/src/main/java/org/geysermc/common/window/component/LabelComponent.java rename to common/src/main/java/org/geysermc/common/form/component/LabelComponent.java index a76b313fa..410f14a25 100644 --- a/common/src/main/java/org/geysermc/common/window/component/LabelComponent.java +++ b/common/src/main/java/org/geysermc/common/form/component/LabelComponent.java @@ -23,20 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.component; +package org.geysermc.common.form.component; import lombok.Getter; -import lombok.Setter; -public class LabelComponent extends FormComponent { +@Getter +public class LabelComponent extends Component { + private LabelComponent(String text) { + super(Type.LABEL, text); + } - @Getter - @Setter - private String text; - - public LabelComponent(String text) { - super("label"); - - this.text = text; + public static LabelComponent of(String text) { + return new LabelComponent(text); } } diff --git a/common/src/main/java/org/geysermc/common/form/component/SliderComponent.java b/common/src/main/java/org/geysermc/common/form/component/SliderComponent.java new file mode 100644 index 000000000..0eb019e3a --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/component/SliderComponent.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019-2020 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.common.form.component; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; + +@Getter +public final class SliderComponent extends Component { + private final float min; + private final float max; + private final int step; + @SerializedName("default") + private final float defaultValue; + + private SliderComponent(String text, float min, float max, int step, float defaultValue) { + super(Type.SLIDER, text); + this.min = min; + this.max = max; + this.step = step; + this.defaultValue = defaultValue; + } + + public static SliderComponent of(String text, float min, float max, int step, float defaultValue) { + min = Math.max(min, 0f); + max = Math.max(max, min); + + if (step < 1) { + step = 1; + } + + if (defaultValue == -1f) { + defaultValue = (int) Math.floor(min + max / 2D); + } + + return new SliderComponent(text, min, max, step, defaultValue); + } + + public static SliderComponent of(String text, float min, float max, int step) { + return of(text, min, max, step, -1); + } + + public static SliderComponent of(String text, float min, float max, float defaultValue) { + return of(text, min, max, -1, defaultValue); + } + + public static SliderComponent of(String text, float min, float max) { + return of(text, min, max, -1, -1); + } +} diff --git a/common/src/main/java/org/geysermc/common/form/component/StepSliderComponent.java b/common/src/main/java/org/geysermc/common/form/component/StepSliderComponent.java new file mode 100644 index 000000000..4d6d8fcb2 --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/component/StepSliderComponent.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2019-2020 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.common.form.component; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +@Getter +public final class StepSliderComponent extends Component { + private final List steps; + @SerializedName("default") + private final int defaultStep; + + private StepSliderComponent(String text, List steps, int defaultStep) { + super(Type.STEP_SLIDER, text); + this.steps = Collections.unmodifiableList(steps); + this.defaultStep = defaultStep; + } + + public static StepSliderComponent of(String text, List steps, int defaultStep) { + if (text == null) { + text = ""; + } + + if (defaultStep >= steps.size() || defaultStep == -1) { + defaultStep = 0; + } + + return new StepSliderComponent(text, steps, defaultStep); + } + + public static StepSliderComponent of(String text, int defaultStep, String... steps) { + return of(text, Arrays.asList(steps), defaultStep); + } + + public static StepSliderComponent of(String text, String... steps) { + return of(text, 0, steps); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(String text) { + return builder().text(text); + } + + public static final class Builder { + private final List steps = new ArrayList<>(); + private String text; + private int defaultStep; + + public Builder text(String text) { + this.text = text; + return this; + } + + public Builder step(String step, boolean defaultStep) { + steps.add(step); + if (defaultStep) { + this.defaultStep = steps.size() - 1; + } + return this; + } + + public Builder step(String step) { + return step(step, false); + } + + public Builder defaultStep(int defaultStep) { + this.defaultStep = defaultStep; + return this; + } + + public StepSliderComponent build() { + return of(text, steps, defaultStep); + } + + public StepSliderComponent translateAndBuild(Function translator) { + for (int i = 0; i < steps.size(); i++) { + steps.set(i, translator.apply(steps.get(i))); + } + + return of(translator.apply(text), steps, defaultStep); + } + } +} diff --git a/common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java b/common/src/main/java/org/geysermc/common/form/component/ToggleComponent.java similarity index 70% rename from common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java rename to common/src/main/java/org/geysermc/common/form/component/ToggleComponent.java index f972d5906..08341aaca 100644 --- a/common/src/main/java/org/geysermc/common/window/component/ToggleComponent.java +++ b/common/src/main/java/org/geysermc/common/form/component/ToggleComponent.java @@ -23,29 +23,26 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.component; +package org.geysermc.common.form.component; +import com.google.gson.annotations.SerializedName; import lombok.Getter; -import lombok.Setter; -public class ToggleComponent extends FormComponent { +@Getter +public class ToggleComponent extends Component { + @SerializedName("default") + private final boolean defaultValue; - @Getter - @Setter - private String text; - - @Getter - @Setter - private boolean defaultValue; - - public ToggleComponent(String text) { - this(text, false); - } - - public ToggleComponent(String text, boolean defaultValue) { - super("toggle"); - - this.text = text; + private ToggleComponent(String text, boolean defaultValue) { + super(Type.TOGGLE, text); this.defaultValue = defaultValue; } + + public static ToggleComponent of(String text, boolean defaultValue) { + return new ToggleComponent(text, defaultValue); + } + + public static ToggleComponent of(String text) { + return of(text, false); + } } diff --git a/common/src/main/java/org/geysermc/common/form/response/CustomFormResponse.java b/common/src/main/java/org/geysermc/common/form/response/CustomFormResponse.java new file mode 100644 index 000000000..8ef50c7fb --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/response/CustomFormResponse.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2019-2020 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.common.form.response; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonPrimitive; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.ToString; +import org.geysermc.common.form.CustomForm; +import org.geysermc.common.form.component.Component; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +@ToString +public class CustomFormResponse implements FormResponse { + private static final Gson GSON = new Gson(); + private static final CustomFormResponse CLOSED = + new CustomFormResponse(true, false, null, null); + private static final CustomFormResponse INVALID = + new CustomFormResponse(false, true, null, null); + private final boolean closed; + private final boolean invalid; + + private final JsonArray responses; + private final List componentTypes; + + private int index = -1; + + public static CustomFormResponse closed() { + return CLOSED; + } + + public static CustomFormResponse invalid() { + return INVALID; + } + + public static CustomFormResponse of(CustomForm form, String responseData) { + JsonArray responses = GSON.fromJson(responseData, JsonArray.class); + List types = new ArrayList<>(); + for (Component component : form.getContent()) { + types.add(component.getType()); + } + return of(types, responses); + } + + public static CustomFormResponse of(List componentTypes, + JsonArray responses) { + if (componentTypes.size() != responses.size()) { + return invalid(); + } + + return new CustomFormResponse(false, false, responses, + Collections.unmodifiableList(componentTypes)); + } + + @SuppressWarnings("unchecked") + public T next(boolean includeLabels) { + if (!hasNext()) { + return null; + } + + while (++index < responses.size()) { + Component.Type type = componentTypes.get(index); + if (type == Component.Type.LABEL && !includeLabels) { + continue; + } + return (T) getDataFromType(type, index); + } + return null; // we don't have anything to check anymore + } + + public T next() { + return next(false); + } + + public void skip(int amount) { + index += amount; + } + + public void skip() { + skip(1); + } + + public void index(int index) { + this.index = index; + } + + public boolean hasNext() { + return responses.size() > index + 1; + } + + public JsonPrimitive get(int index) { + try { + return responses.get(index).getAsJsonPrimitive(); + } catch (IllegalStateException exception) { + wrongType(index, "a primitive"); + return null; + } + } + + public int getDropdown(int index) { + JsonPrimitive primitive = get(index); + if (!primitive.isNumber()) { + wrongType(index, "dropdown"); + } + return primitive.getAsInt(); + } + + public String getInput(int index) { + JsonPrimitive primitive = get(index); + if (!primitive.isString()) { + wrongType(index, "input"); + } + return primitive.getAsString(); + } + + public float getSlider(int index) { + JsonPrimitive primitive = get(index); + if (!primitive.isNumber()) { + wrongType(index, "slider"); + } + return primitive.getAsFloat(); + } + + public int getStepSlide(int index) { + JsonPrimitive primitive = get(index); + if (!primitive.isNumber()) { + wrongType(index, "step slider"); + } + return primitive.getAsInt(); + } + + public boolean getToggle(int index) { + JsonPrimitive primitive = get(index); + if (!primitive.isBoolean()) { + wrongType(index, "toggle"); + } + return primitive.getAsBoolean(); + } + + private Object getDataFromType(Component.Type type, int index) { + switch (type) { + case DROPDOWN: + return getDropdown(index); + case INPUT: + return getInput(index); + case SLIDER: + return getSlider(index); + case STEP_SLIDER: + return getStepSlide(index); + case TOGGLE: + return getToggle(index); + default: + return null; // label e.g. is always null + } + } + + private void wrongType(int index, String expected) { + throw new IllegalStateException(String.format( + "Expected %s on %s, got %s", + expected, index, responses.get(index).toString())); + } +} diff --git a/common/src/main/java/org/geysermc/common/window/response/FormResponse.java b/common/src/main/java/org/geysermc/common/form/response/FormResponse.java similarity index 87% rename from common/src/main/java/org/geysermc/common/window/response/FormResponse.java rename to common/src/main/java/org/geysermc/common/form/response/FormResponse.java index 2be646837..7c62236f6 100644 --- a/common/src/main/java/org/geysermc/common/window/response/FormResponse.java +++ b/common/src/main/java/org/geysermc/common/form/response/FormResponse.java @@ -23,7 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.response; +package org.geysermc.common.form.response; public interface FormResponse { + boolean isClosed(); + boolean isInvalid(); + + default boolean isCorrect() { + return !isClosed() && !isInvalid(); + } } diff --git a/common/src/main/java/org/geysermc/common/window/FormWindow.java b/common/src/main/java/org/geysermc/common/form/response/ModalFormResponse.java similarity index 55% rename from common/src/main/java/org/geysermc/common/window/FormWindow.java rename to common/src/main/java/org/geysermc/common/form/response/ModalFormResponse.java index c3cc4258b..b0e4de883 100644 --- a/common/src/main/java/org/geysermc/common/window/FormWindow.java +++ b/common/src/main/java/org/geysermc/common/form/response/ModalFormResponse.java @@ -23,37 +23,38 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window; +package org.geysermc.common.form.response; -import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AccessLevel; import lombok.Getter; -import lombok.Setter; -import org.geysermc.common.window.response.FormResponse; +import lombok.RequiredArgsConstructor; -public abstract class FormWindow { +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public final class ModalFormResponse implements FormResponse { + private static final ModalFormResponse CLOSED = + new ModalFormResponse(true, false, -1, null); + private static final ModalFormResponse INVALID = + new ModalFormResponse(false, true, -1, null); + private final boolean closed; + private final boolean invalid; - @Getter - private final String type; + private final int clickedButtonId; + private final String clickedButtonText; - @Getter - protected FormResponse response; - - @Getter - @Setter - protected boolean closed; - - public FormWindow(String type) { - this.type = type; + public static ModalFormResponse closed() { + return CLOSED; } - // Lombok won't work here, so we need to make our own method - public void setResponse(FormResponse response) { - this.response = response; + public static ModalFormResponse invalid() { + return INVALID; } - @JsonIgnore - public abstract String getJSONData(); - - public abstract void setResponse(String response); + public static ModalFormResponse of(int clickedButtonId, String clickedButtonText) { + return new ModalFormResponse(false, false, clickedButtonId, clickedButtonText); + } + public boolean getResult() { + return clickedButtonId == 0; + } } diff --git a/common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java b/common/src/main/java/org/geysermc/common/form/response/SimpleFormResponse.java similarity index 56% rename from common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java rename to common/src/main/java/org/geysermc/common/form/response/SimpleFormResponse.java index 8f128d1a4..6ee819f37 100644 --- a/common/src/main/java/org/geysermc/common/window/component/StepSliderComponent.java +++ b/common/src/main/java/org/geysermc/common/form/response/SimpleFormResponse.java @@ -23,47 +23,33 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.component; +package org.geysermc.common.form.response; +import lombok.AccessLevel; import lombok.Getter; -import lombok.Setter; +import lombok.RequiredArgsConstructor; +import org.geysermc.common.form.component.ButtonComponent; -import java.util.ArrayList; -import java.util.List; +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public final class SimpleFormResponse implements FormResponse { + private static final SimpleFormResponse CLOSED = new SimpleFormResponse(true, false, -1, null); + private static final SimpleFormResponse INVALID = new SimpleFormResponse(false, true, -1, null); + private final boolean closed; + private final boolean invalid; -public class StepSliderComponent extends FormComponent { + private final int clickedButtonId; + private final ButtonComponent clickedButton; - @Getter - @Setter - private String text; - - @Getter - private List steps; - - @Getter - @Setter - private int defaultStepIndex; - - public StepSliderComponent(String text) { - this(text, new ArrayList()); + public static SimpleFormResponse closed() { + return CLOSED; } - public StepSliderComponent(String text, List steps) { - this(text, steps, 0); + public static SimpleFormResponse invalid() { + return INVALID; } - public StepSliderComponent(String text, List steps, int defaultStepIndex) { - super("step_slider"); - - this.text = text; - this.steps = steps; - this.defaultStepIndex = defaultStepIndex; - } - - public void addStep(String step, boolean isDefault) { - steps.add(step); - - if (isDefault) - defaultStepIndex = steps.size() - 1; + public static SimpleFormResponse of(int clickedButtonId, ButtonComponent clickedButton) { + return new SimpleFormResponse(false, false, clickedButtonId, clickedButton); } } diff --git a/common/src/main/java/org/geysermc/common/form/util/FormAdaptor.java b/common/src/main/java/org/geysermc/common/form/util/FormAdaptor.java new file mode 100644 index 000000000..8c30e7e8f --- /dev/null +++ b/common/src/main/java/org/geysermc/common/form/util/FormAdaptor.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2019-2020 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.common.form.util; + +import com.google.gson.*; +import com.google.gson.reflect.TypeToken; +import org.geysermc.common.form.CustomForm; +import org.geysermc.common.form.Form; +import org.geysermc.common.form.ModalForm; +import org.geysermc.common.form.SimpleForm; +import org.geysermc.common.form.component.ButtonComponent; +import org.geysermc.common.form.component.Component; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +public class FormAdaptor implements JsonDeserializer
, JsonSerializer { + private static final Type LIST_BUTTON_TYPE = + new TypeToken>() {}.getType(); + + @Override + public Form deserialize(JsonElement jsonElement, Type typeOfT, + JsonDeserializationContext context) + throws JsonParseException { + + if (!jsonElement.isJsonObject()) { + throw new JsonParseException("Form has to be a JsonObject"); + } + JsonObject json = jsonElement.getAsJsonObject(); + + if (typeOfT == SimpleForm.class) { + String title = json.get("title").getAsString(); + String content = json.get("content").getAsString(); + List buttons = context + .deserialize(json.get("buttons"), LIST_BUTTON_TYPE); + return SimpleForm.of(title, content, buttons); + } + + if (typeOfT == ModalForm.class) { + String title = json.get("title").getAsString(); + String content = json.get("content").getAsString(); + String button1 = json.get("button1").getAsString(); + String button2 = json.get("button2").getAsString(); + return ModalForm.of(title, content, button1, button2); + } + + if (typeOfT == CustomForm.class) { + String title = json.get("title").getAsString(); + FormImage icon = context.deserialize(json.get("icon"), FormImage.class); + List content = new ArrayList<>(); + + JsonArray contentArray = json.getAsJsonArray("content"); + for (JsonElement contentElement : contentArray) { + String typeName = contentElement.getAsJsonObject().get("type").getAsString(); + + Component.Type type = Component.Type.getByName(typeName); + if (type == null) { + throw new JsonParseException("Failed to find Component type " + typeName); + } + + content.add(context.deserialize(contentElement, type.getComponentClass())); + } + return CustomForm.of(title, icon, content); + } + return null; + } + + @Override + public JsonElement serialize(Form src, Type typeOfSrc, JsonSerializationContext context) { + JsonObject result = new JsonObject(); + result.add("type", context.serialize(src.getType())); + + if (typeOfSrc == SimpleForm.class) { + SimpleForm form = (SimpleForm) src; + + result.addProperty("title", form.getTitle()); + result.addProperty("content", form.getContent()); + result.add("buttons", context.serialize(form.getButtons(), LIST_BUTTON_TYPE)); + return result; + } + + if (typeOfSrc == ModalForm.class) { + ModalForm form = (ModalForm) src; + + result.addProperty("title", form.getTitle()); + result.addProperty("content", form.getContent()); + result.addProperty("button1", form.getButton1()); + result.addProperty("button2", form.getButton2()); + return result; + } + + if (typeOfSrc == CustomForm.class) { + CustomForm form = (CustomForm) src; + + result.addProperty("title", form.getTitle()); + result.add("icon", context.serialize(form.getIcon())); + result.add("content", context.serialize(form.getContent())); + return result; + } + return null; + } +} diff --git a/common/src/main/java/org/geysermc/common/window/button/FormImage.java b/common/src/main/java/org/geysermc/common/form/util/FormImage.java similarity index 72% rename from common/src/main/java/org/geysermc/common/window/button/FormImage.java rename to common/src/main/java/org/geysermc/common/form/util/FormImage.java index 72579f7ac..876e662d0 100644 --- a/common/src/main/java/org/geysermc/common/window/button/FormImage.java +++ b/common/src/main/java/org/geysermc/common/form/util/FormImage.java @@ -23,36 +23,32 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.common.window.button; +package org.geysermc.common.form.util; +import lombok.AccessLevel; import lombok.Getter; -import lombok.Setter; +import lombok.RequiredArgsConstructor; +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) public class FormImage { + private final String type; + private final String data; - @Getter - @Setter - private String type; - - @Getter - @Setter - private String data; - - public FormImage(FormImageType type, String data) { - this.type = type.getName(); - this.data = data; + public static FormImage of(String type, String data) { + return new FormImage(type, data); } - public enum FormImageType { + public static FormImage of(Type type, String data) { + return of(type.getName(), data); + } + + @RequiredArgsConstructor + public enum Type { PATH("path"), URL("url"); - @Getter - private String name; - - FormImageType(String name) { - this.name = name; - } + @Getter private final String name; @Override public String toString() { diff --git a/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java b/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java deleted file mode 100644 index 004b00a96..000000000 --- a/common/src/main/java/org/geysermc/common/window/CustomFormBuilder.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window; - -import lombok.Getter; -import org.geysermc.common.window.CustomFormWindow; -import org.geysermc.common.window.button.FormImage; -import org.geysermc.common.window.component.FormComponent; -import org.geysermc.common.window.response.CustomFormResponse; - -public class CustomFormBuilder { - - @Getter - private CustomFormWindow form; - - public CustomFormBuilder(String title) { - form = new CustomFormWindow(title); - } - - public CustomFormBuilder setTitle(String title) { - form.setTitle(title); - return this; - } - - public CustomFormBuilder setIcon(FormImage icon) { - form.setIcon(icon); - return this; - } - - public CustomFormBuilder setResponse(String data) { - form.setResponse(data); - return this; - } - - public CustomFormBuilder setResponse(CustomFormResponse response) { - form.setResponse(response); - return this; - } - - public CustomFormBuilder addComponent(FormComponent component) { - form.addComponent(component); - return this; - } - - public CustomFormWindow build() { - return form; - } -} diff --git a/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java b/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java deleted file mode 100644 index efc71ae8d..000000000 --- a/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.Getter; -import lombok.Setter; -import org.geysermc.common.window.button.FormImage; -import org.geysermc.common.window.component.*; -import org.geysermc.common.window.response.CustomFormResponse; -import org.geysermc.common.window.response.FormResponseData; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class CustomFormWindow extends FormWindow { - - @Getter - @Setter - private String title; - - @Getter - @Setter - private FormImage icon; - - @Getter - private List content; - - public CustomFormWindow(String title) { - this(title, new ArrayList<>()); - } - - public CustomFormWindow(String title, List content) { - this(title, content, (FormImage) null); - } - - public CustomFormWindow(String title, List content, String icon) { - this(title, content, new FormImage(FormImage.FormImageType.URL, icon)); - } - - public CustomFormWindow(String title, List content, FormImage icon) { - super("custom_form"); - - this.title = title; - this.content = content; - this.icon = icon; - } - - public void addComponent(FormComponent component) { - content.add(component); - } - - public String getJSONData() { - String toModify = ""; - try { - toModify = new ObjectMapper().writeValueAsString(this); - } catch (JsonProcessingException e) { } - - //We need to replace this due to Java not supporting declaring class field 'default' - return toModify.replace("defaultOptionIndex", "default") - .replace("defaultText", "default") - .replace("defaultValue", "default") - .replace("defaultStepIndex", "default"); - } - - public void setResponse(String data) { - if (data == null || data.equalsIgnoreCase("null") || data.isEmpty()) { - closed = true; - return; - } - - int i = 0; - Map dropdownResponses = new HashMap(); - Map inputResponses = new HashMap(); - Map sliderResponses = new HashMap(); - Map stepSliderResponses = new HashMap(); - Map toggleResponses = new HashMap(); - Map responses = new HashMap(); - Map labelResponses = new HashMap(); - - List componentResponses = new ArrayList<>(); - try { - componentResponses = new ObjectMapper().readValue(data, new TypeReference>(){}); - } catch (IOException e) { } - - for (String response : componentResponses) { - if (i >= content.size()) { - break; - } - - FormComponent component = content.get(i); - if (component == null) - return; - - if (component instanceof LabelComponent) { - LabelComponent labelComponent = (LabelComponent) component; - labelResponses.put(i, labelComponent.getText()); - } - - if (component instanceof DropdownComponent) { - DropdownComponent dropdownComponent = (DropdownComponent) component; - String option = dropdownComponent.getOptions().get(Integer.parseInt(response)); - - dropdownResponses.put(i, new FormResponseData(Integer.parseInt(response), option)); - responses.put(i, option); - } - - if (component instanceof InputComponent) { - inputResponses.put(i, response); - responses.put(i, response); - } - - if (component instanceof SliderComponent) { - float value = Float.parseFloat(response); - sliderResponses.put(i, value); - responses.put(i, value); - } - - if (component instanceof StepSliderComponent) { - StepSliderComponent stepSliderComponent = (StepSliderComponent) component; - String step = stepSliderComponent.getSteps().get(Integer.parseInt(response)); - stepSliderResponses.put(i, new FormResponseData(Integer.parseInt(response), step)); - responses.put(i, step); - } - - if (component instanceof ToggleComponent) { - boolean answer = Boolean.parseBoolean(response); - toggleResponses.put(i, answer); - responses.put(i, answer); - } - i++; - } - - this.response = new CustomFormResponse(responses, dropdownResponses, inputResponses, - sliderResponses, stepSliderResponses, toggleResponses, labelResponses); - } -} diff --git a/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java b/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java deleted file mode 100644 index bfeafa1b0..000000000 --- a/common/src/main/java/org/geysermc/common/window/ModalFormWindow.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.Getter; -import lombok.Setter; -import org.geysermc.common.window.response.ModalFormResponse; - -public class ModalFormWindow extends FormWindow { - - @Getter - @Setter - private String title; - - @Getter - @Setter - private String content; - - @Getter - @Setter - private String button1; - - @Getter - @Setter - private String button2; - - public ModalFormWindow(String title, String content, String button1, String button2) { - super("modal"); - - this.title = title; - this.content = content; - this.button1 = button1; - this.button2 = button2; - } - - @Override - public String getJSONData() { - try { - return new ObjectMapper().writeValueAsString(this); - } catch (JsonProcessingException e) { - return ""; - } - } - - public void setResponse(String data) { - if (data == null || data.equalsIgnoreCase("null")) { - closed = true; - return; - } - - if (Boolean.parseBoolean(data)) { - response = new ModalFormResponse(0, button1); - } else { - response = new ModalFormResponse(1, button2); - } - } -} diff --git a/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java b/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java deleted file mode 100644 index 7c1acc26f..000000000 --- a/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.Getter; -import lombok.Setter; -import org.geysermc.common.window.button.FormButton; -import org.geysermc.common.window.response.SimpleFormResponse; - -import java.util.ArrayList; -import java.util.List; - - -public class SimpleFormWindow extends FormWindow { - - @Getter - @Setter - private String title; - - @Getter - @Setter - private String content; - - @Getter - @Setter - private List buttons; - - public SimpleFormWindow(String title, String content) { - this(title, content, new ArrayList()); - } - - public SimpleFormWindow(String title, String content, List buttons) { - super("form"); - - this.title = title; - this.content = content; - this.buttons = buttons; - } - - @Override - public String getJSONData() { - try { - return new ObjectMapper().writeValueAsString(this); - } catch (JsonProcessingException e) { - return ""; - } - } - - public void setResponse(String data) { - if (data == null || data.equalsIgnoreCase("null")) { - closed = true; - return; - } - - int buttonID; - try { - buttonID = Integer.parseInt(data); - } catch (Exception ex) { - return; - } - - if (buttonID >= buttons.size()) { - response = new SimpleFormResponse(buttonID, null); - return; - } - - response = new SimpleFormResponse(buttonID, buttons.get(buttonID)); - } -} diff --git a/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java b/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java deleted file mode 100644 index 4dac6b043..000000000 --- a/common/src/main/java/org/geysermc/common/window/component/DropdownComponent.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.component; - -import lombok.Getter; -import lombok.Setter; - -import java.util.List; - -public class DropdownComponent extends FormComponent { - - @Getter - @Setter - private String text; - - @Getter - @Setter - private List options; - - @Getter - @Setter - private int defaultOptionIndex; - - public DropdownComponent() { - super("dropdown"); - } - - public void addOption(String option, boolean isDefault) { - options.add(option); - if (isDefault) - defaultOptionIndex = options.size() - 1; - } -} diff --git a/common/src/main/java/org/geysermc/common/window/component/FormComponent.java b/common/src/main/java/org/geysermc/common/window/component/FormComponent.java deleted file mode 100644 index 5a56ae0cc..000000000 --- a/common/src/main/java/org/geysermc/common/window/component/FormComponent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.component; - -import lombok.Getter; - -public abstract class FormComponent { - - @Getter - private final String type; - - public FormComponent(String type) { - this.type = type; - } -} diff --git a/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java b/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java deleted file mode 100644 index a7a78362e..000000000 --- a/common/src/main/java/org/geysermc/common/window/component/SliderComponent.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.component; - -import lombok.Getter; -import lombok.Setter; - -public class SliderComponent extends FormComponent { - - @Getter - @Setter - private String text; - - @Getter - @Setter - private float min; - - @Getter - @Setter - private float max; - - @Getter - @Setter - private int step; - - @Getter - @Setter - private float defaultValue; - - public SliderComponent(String text, float min, float max, int step, float defaultValue) { - super("slider"); - - this.text = text; - this.min = Math.max(min, 0f); - this.max = max > this.min ? max : this.min; - if (step != -1f && step > 0) - this.step = step; - - if (defaultValue != -1f) - this.defaultValue = defaultValue; - } -} diff --git a/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java b/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java deleted file mode 100644 index 6cdd70978..000000000 --- a/common/src/main/java/org/geysermc/common/window/response/CustomFormResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.response; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.geysermc.common.window.response.FormResponse; -import org.geysermc.common.window.response.FormResponseData; - -import java.util.Map; - -@Getter -@AllArgsConstructor -public class CustomFormResponse implements FormResponse { - - private Map responses; - private Map dropdownResponses; - private Map inputResponses; - private Map sliderResponses; - private Map stepSliderResponses; - private Map toggleResponses; - private Map labelResponses; -} diff --git a/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java b/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java deleted file mode 100644 index fd40be0fb..000000000 --- a/common/src/main/java/org/geysermc/common/window/response/FormResponseData.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.response; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public class FormResponseData { - - private int elementID; - private String elementContent; -} diff --git a/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java b/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java deleted file mode 100644 index e1a14039d..000000000 --- a/common/src/main/java/org/geysermc/common/window/response/ModalFormResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.response; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.geysermc.common.window.response.FormResponse; - -@Getter -@AllArgsConstructor -public class ModalFormResponse implements FormResponse { - - private int clickedButtonId; - private String clickedButtonText; -} diff --git a/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java b/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java deleted file mode 100644 index e80d58e78..000000000 --- a/common/src/main/java/org/geysermc/common/window/response/SimpleFormResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019-2020 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.common.window.response; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import org.geysermc.common.window.button.FormButton; -import org.geysermc.common.window.response.FormResponse; - -@Getter -@AllArgsConstructor -public class SimpleFormResponse implements FormResponse { - - private int clickedButtonId; - private FormButton clickedButton; -} diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 7e97d4298..9f6a88e18 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -39,7 +39,6 @@ import org.geysermc.connector.utils.LoginEncryptionUtils; import org.geysermc.connector.utils.MathUtils; import org.geysermc.connector.utils.ResourcePack; import org.geysermc.connector.utils.ResourcePackManifest; -import org.geysermc.connector.utils.SettingsUtils; import java.io.FileInputStream; import java.io.InputStream; @@ -139,11 +138,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(ModalFormResponsePacket packet) { - if (packet.getFormId() == SettingsUtils.SETTINGS_FORM_ID) { - return SettingsUtils.handleSettingsForm(session, packet.getFormData()); - } - - return LoginEncryptionUtils.authenticateFromForm(session, connector, packet.getFormId(), packet.getFormData()); + session.getFormCache().handleResponse(packet); + return true; } private boolean couldLoginUserByName(String bedrockUsername) { @@ -170,7 +166,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { if (!session.isLoggedIn() && !session.isLoggingIn() && session.getConnector().getAuthType() == AuthType.ONLINE) { // TODO it is safer to key authentication on something that won't change (UUID, not username) if (!couldLoginUserByName(session.getAuthData().getName())) { - LoginEncryptionUtils.showLoginWindow(session); + LoginEncryptionUtils.buildAndShowLoginWindow(session); } // else we were able to log the user in } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 42c2f2437..ec8c7f0ee 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -55,8 +55,7 @@ import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import lombok.Getter; import lombok.Setter; -import org.geysermc.common.window.CustomFormWindow; -import org.geysermc.common.window.FormWindow; +import org.geysermc.common.form.Form; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.common.AuthType; @@ -101,7 +100,7 @@ public class GeyserSession implements CommandSender { private EntityCache entityCache; private InventoryCache inventoryCache; private WorldCache worldCache; - private WindowCache windowCache; + private FormCache formCache; @Setter private TeleportCache teleportCache; @@ -192,9 +191,6 @@ public class GeyserSession implements CommandSender { private boolean reducedDebugInfo = false; - @Setter - private CustomFormWindow settingsForm; - /** * The op permission level set by the server */ @@ -239,7 +235,7 @@ public class GeyserSession implements CommandSender { /** * Stores the last text inputted into a sign. - * + *

* Bedrock sends packets every time you update the sign, Java only wants the final packet. * Until we determine that the user has finished editing, we save the sign's current status. */ @@ -256,7 +252,7 @@ public class GeyserSession implements CommandSender { this.entityCache = new EntityCache(this); this.inventoryCache = new InventoryCache(this); this.worldCache = new WorldCache(this); - this.windowCache = new WindowCache(this); + this.formCache = new FormCache(this); this.playerEntity = new PlayerEntity(new GameProfile(UUID.randomUUID(), "unknown"), 1, 1, Vector3f.ZERO, Vector3f.ZERO, Vector3f.ZERO); this.inventory = new PlayerInventory(); @@ -497,7 +493,7 @@ public class GeyserSession implements CommandSender { this.entityCache = null; this.worldCache = null; this.inventoryCache = null; - this.windowCache = null; + this.formCache = null; closed = true; } @@ -533,10 +529,6 @@ public class GeyserSession implements CommandSender { return false; } - public void sendForm(FormWindow window, int id) { - windowCache.showWindow(window, id); - } - public void setRenderDistance(int renderDistance) { renderDistance = GenericMath.ceil(++renderDistance * MathUtils.SQRT_OF_TWO); //square to circle if (renderDistance > 32) renderDistance = 32; // <3 u ViaVersion but I don't like crashing clients x) @@ -551,8 +543,12 @@ public class GeyserSession implements CommandSender { return this.upstream.getAddress(); } - public void sendForm(FormWindow window) { - windowCache.showWindow(window); + public void sendForm(Form form) { + formCache.showForm(form); + } + + public void sendForm(Form.Builder formBuilder) { + formCache.showForm(formBuilder.build()); } private void startGame() { @@ -678,7 +674,7 @@ public class GeyserSession implements CommandSender { * Send a gamerule value to the client * * @param gameRule The gamerule to send - * @param value The value of the gamerule + * @param value The value of the gamerule */ public void sendGameRule(String gameRule, Object value) { GameRulesChangedPacket gameRulesChangedPacket = new GameRulesChangedPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WindowCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java similarity index 56% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/WindowCache.java rename to connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java index 15b9a7705..20ade2869 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/WindowCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java @@ -26,56 +26,54 @@ package org.geysermc.connector.network.session.cache; import com.nukkitx.protocol.bedrock.packet.ModalFormRequestPacket; - +import com.nukkitx.protocol.bedrock.packet.ModalFormResponsePacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; - -import lombok.Getter; - -import org.geysermc.common.window.FormWindow; +import lombok.RequiredArgsConstructor; +import org.geysermc.common.form.Form; import org.geysermc.connector.network.session.GeyserSession; -public class WindowCache { +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; - private GeyserSession session; +@RequiredArgsConstructor +public class FormCache { + private final AtomicInteger formId = new AtomicInteger(0); + private final Int2ObjectMap forms = new Int2ObjectOpenHashMap<>(); + private final GeyserSession session; - @Getter - private Int2ObjectMap windows = new Int2ObjectOpenHashMap<>(); - - public WindowCache(GeyserSession session) { - this.session = session; + public int addForm(Form form) { + int windowId = formId.getAndIncrement(); + forms.put(windowId, form); + return windowId; } - public void addWindow(FormWindow window) { - windows.put(windows.size() + 1, window); + public int showForm(Form form) { + int windowId = addForm(form); + + ModalFormRequestPacket formRequestPacket = new ModalFormRequestPacket(); + formRequestPacket.setFormId(windowId); + formRequestPacket.setFormData(form.getJsonData()); + + session.sendUpstreamPacket(formRequestPacket); + return windowId; } - public void addWindow(FormWindow window, int id) { - windows.put(id, window); - } - - public void showWindow(FormWindow window) { - showWindow(window, windows.size() + 1); - } - - public void showWindow(int id) { - if (!windows.containsKey(id)) + public void handleResponse(ModalFormResponsePacket response) { + Form form = forms.get(response.getFormId()); + if (form == null) { return; + } - ModalFormRequestPacket formRequestPacket = new ModalFormRequestPacket(); - formRequestPacket.setFormId(id); - formRequestPacket.setFormData(windows.get(id).getJSONData()); + Consumer responseConsumer = form.getResponseHandler(); + if (responseConsumer != null) { + responseConsumer.accept(response.getFormData().trim()); + } - session.sendUpstreamPacket(formRequestPacket); + removeWindow(response.getFormId()); } - public void showWindow(FormWindow window, int id) { - ModalFormRequestPacket formRequestPacket = new ModalFormRequestPacket(); - formRequestPacket.setFormId(id); - formRequestPacket.setFormData(window.getJSONData()); - - session.sendUpstreamPacket(formRequestPacket); - - addWindow(window, id); + public boolean removeWindow(int id) { + return forms.remove(id) != null; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java index a8591cd7f..01bf07b9c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java @@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.bedrock; import com.nukkitx.protocol.bedrock.packet.ServerSettingsRequestPacket; import com.nukkitx.protocol.bedrock.packet.ServerSettingsResponsePacket; +import org.geysermc.common.form.CustomForm; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -37,11 +38,12 @@ public class BedrockServerSettingsRequestTranslator extends PacketTranslator { - - private static byte[] brandData; + private static final byte[] brandData; static { byte[] data = GeyserConnector.NAME.getBytes(StandardCharsets.UTF_8); @@ -48,21 +54,11 @@ public class JavaPluginMessageTranslator extends PacketTranslator>>= 7; if (value != 0) { temp |= 0b10000000; @@ -85,4 +81,48 @@ public class JavaPluginMessageTranslator extends PacketTranslator { + byte[] raw = response.getBytes(StandardCharsets.UTF_8); + byte[] finalData = new byte[raw.length + 2]; + + finalData[0] = data[1]; + finalData[1] = data[2]; + System.arraycopy(raw, 0, finalData, 2, raw.length); + + session.sendDownstreamPacket(new ClientPluginMessagePacket(channel, finalData)); + }); + session.sendForm(form); + } + } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index 62d70f612..8109ef219 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -34,20 +34,16 @@ import com.nukkitx.network.util.Preconditions; import com.nukkitx.protocol.bedrock.packet.LoginPacket; import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; import com.nukkitx.protocol.bedrock.util.EncryptionUtils; -import org.geysermc.common.window.CustomFormBuilder; -import org.geysermc.common.window.CustomFormWindow; -import org.geysermc.common.window.FormWindow; -import org.geysermc.common.window.SimpleFormWindow; -import org.geysermc.common.window.button.FormButton; -import org.geysermc.common.window.component.InputComponent; -import org.geysermc.common.window.component.LabelComponent; -import org.geysermc.common.window.response.CustomFormResponse; -import org.geysermc.common.window.response.SimpleFormResponse; +import org.geysermc.common.form.CustomForm; +import org.geysermc.common.form.ModalForm; +import org.geysermc.common.form.SimpleForm; +import org.geysermc.common.form.response.CustomFormResponse; +import org.geysermc.common.form.response.ModalFormResponse; +import org.geysermc.common.form.response.SimpleFormResponse; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.auth.AuthData; import org.geysermc.connector.network.session.auth.BedrockClientData; -import org.geysermc.connector.network.session.cache.WindowCache; import javax.crypto.SecretKey; import java.io.IOException; @@ -72,7 +68,7 @@ public class LoginEncryptionUtils { } if (lastKey != null) { - if (!EncryptionUtils.verifyJwt(jwt, lastKey)) return false; + if (!EncryptionUtils.verifyJwt(jwt, lastKey)) return false; } JsonNode payloadNode = JSON_MAPPER.readTree(jwt.getPayload().toString()); @@ -159,69 +155,49 @@ public class LoginEncryptionUtils { session.sendUpstreamPacketImmediately(packet); } - private static int AUTH_FORM_ID = 1336; - private static int AUTH_DETAILS_FORM_ID = 1337; - - public static void showLoginWindow(GeyserSession session) { + public static void buildAndShowLoginWindow(GeyserSession session) { String userLanguage = session.getClientData().getLanguageCode(); - SimpleFormWindow window = new SimpleFormWindow(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.notice.title", userLanguage), LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.notice.desc", userLanguage)); - window.getButtons().add(new FormButton(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.notice.btn_login", userLanguage))); - window.getButtons().add(new FormButton(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.notice.btn_disconnect", userLanguage))); - session.sendForm(window, AUTH_FORM_ID); - } + session.sendForm( + SimpleForm.builder() + .translator(LanguageUtils::getPlayerLocaleString, userLanguage) + .title("geyser.auth.login.form.notice.title") + .content("geyser.auth.login.form.notice.desc") + .button("geyser.auth.login.form.notice.btn_login") // id = 0 + .button("geyser.auth.login.form.notice.btn_disconnect") + .responseHandler((form, responseData) -> { + SimpleFormResponse response = form.parseResponse(responseData.trim()); + if (!response.isCorrect()) { + buildAndShowLoginWindow(session); + return; + } - public static void showLoginDetailsWindow(GeyserSession session) { - String userLanguage = session.getClientData().getLanguageCode(); - CustomFormWindow window = new CustomFormBuilder(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.details.title", userLanguage)) - .addComponent(new LabelComponent(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.details.desc", userLanguage))) - .addComponent(new InputComponent(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.details.email", userLanguage), "account@geysermc.org", "")) - .addComponent(new InputComponent(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.details.pass", userLanguage), "123456", "")) - .build(); + if (response.getClickedButtonId() == 0) { + buildAndShowLoginDetailsWindow(session); + return; + } - session.sendForm(window, AUTH_DETAILS_FORM_ID); - } - - public static boolean authenticateFromForm(GeyserSession session, GeyserConnector connector, int formId, String formData) { - WindowCache windowCache = session.getWindowCache(); - if (!windowCache.getWindows().containsKey(formId)) - return false; - - if(formId == AUTH_FORM_ID || formId == AUTH_DETAILS_FORM_ID) { - FormWindow window = windowCache.getWindows().remove(formId); - window.setResponse(formData.trim()); - - if (!session.isLoggedIn()) { - if (formId == AUTH_DETAILS_FORM_ID && window instanceof CustomFormWindow) { - CustomFormWindow customFormWindow = (CustomFormWindow) window; - - CustomFormResponse response = (CustomFormResponse) customFormWindow.getResponse(); - if (response != null) { - String email = response.getInputResponses().get(1); - String password = response.getInputResponses().get(2); - - session.authenticate(email, password); - } else { - showLoginDetailsWindow(session); - } - - // Clear windows so authentication data isn't accidentally cached - windowCache.getWindows().clear(); - } else if (formId == AUTH_FORM_ID && window instanceof SimpleFormWindow) { - SimpleFormResponse response = (SimpleFormResponse) window.getResponse(); - if (response != null) { - if (response.getClickedButtonId() == 0) { - showLoginDetailsWindow(session); - } else if(response.getClickedButtonId() == 1) { session.disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getClientData().getLanguageCode())); - } - } else { - showLoginWindow(session); - } - } - } - } - return true; + })); } + public static void buildAndShowLoginDetailsWindow(GeyserSession session) { + String userLanguage = session.getClientData().getLanguageCode(); + session.sendForm( + CustomForm.builder() + .translator(LanguageUtils::getPlayerLocaleString, userLanguage) + .title("geyser.auth.login.form.details.title") + .label("geyser.auth.login.form.details.desc") + .input("geyser.auth.login.form.details.email", "account@geysermc.org", "") + .input("geyser.auth.login.form.details.pass", "123456", "") + .responseHandler((form, responseData) -> { + CustomFormResponse response = form.parseResponse(responseData.trim()); + if (!response.isCorrect()) { + buildAndShowLoginDetailsWindow(session); + return; + } + + session.authenticate(response.next(), response.next()); + })); + } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java b/connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java index 89e9fe67b..a2f6aeba4 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java @@ -27,62 +27,53 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; -import org.geysermc.common.window.CustomFormBuilder; -import org.geysermc.common.window.CustomFormWindow; -import org.geysermc.common.window.button.FormImage; -import org.geysermc.common.window.component.DropdownComponent; -import org.geysermc.common.window.component.InputComponent; -import org.geysermc.common.window.component.LabelComponent; -import org.geysermc.common.window.component.ToggleComponent; -import org.geysermc.common.window.response.CustomFormResponse; +import org.geysermc.common.form.CustomForm; +import org.geysermc.common.form.component.DropdownComponent; +import org.geysermc.common.form.response.CustomFormResponse; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; - -import java.util.ArrayList; +import org.geysermc.connector.network.translators.world.WorldManager; public class SettingsUtils { - // Used in UpstreamPacketHandler.java - public static final int SETTINGS_FORM_ID = 1338; - /** * Build a settings form for the given session and store it for later * * @param session The session to build the form for */ - public static void buildForm(GeyserSession session) { + public static CustomForm buildForm(GeyserSession session) { // Cache the language for cleaner access String language = session.getClientData().getLanguageCode(); - CustomFormBuilder builder = new CustomFormBuilder(LanguageUtils.getPlayerLocaleString("geyser.settings.title.main", language)); - builder.setIcon(new FormImage(FormImage.FormImageType.PATH, "textures/ui/settings_glyph_color_2x.png")); - - builder.addComponent(new LabelComponent(LanguageUtils.getPlayerLocaleString("geyser.settings.title.client", language))); - builder.addComponent(new ToggleComponent(LanguageUtils.getPlayerLocaleString("geyser.settings.option.coordinates", language, session.getWorldCache().isShowCoordinates()))); + CustomForm.Builder builder = CustomForm.builder() + .translator(LanguageUtils::getPlayerLocaleString, language) + .title("geyser.settings.title.main") + .iconPath("textures/ui/settings_glyph_color_2x.png") + .label("geyser.settings.title.client") + .toggle("geyser.settings.option.coordinates"); if (session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.server")) { - builder.addComponent(new LabelComponent(LanguageUtils.getPlayerLocaleString("geyser.settings.title.server", language))); + builder.label("geyser.settings.title.server"); - DropdownComponent gamemodeDropdown = new DropdownComponent(); - gamemodeDropdown.setText("%createWorldScreen.gameMode.personal"); - gamemodeDropdown.setOptions(new ArrayList<>()); + DropdownComponent.Builder gamemodeDropdown = DropdownComponent.builder("%createWorldScreen.gameMode.personal"); for (GameMode gamemode : GameMode.values()) { - gamemodeDropdown.addOption(LocaleUtils.getLocaleString("selectWorld.gameMode." + gamemode.name().toLowerCase(), language), session.getGameMode() == gamemode); + gamemodeDropdown.option("selectWorld.gameMode." + gamemode.name().toLowerCase(), session.getGameMode() == gamemode); } - builder.addComponent(gamemodeDropdown); + builder.dropdown(gamemodeDropdown); - DropdownComponent difficultyDropdown = new DropdownComponent(); - difficultyDropdown.setText("%options.difficulty"); - difficultyDropdown.setOptions(new ArrayList<>()); + DropdownComponent.Builder difficultyDropdown = DropdownComponent.builder("%options.difficulty"); for (Difficulty difficulty : Difficulty.values()) { - difficultyDropdown.addOption("%options.difficulty." + difficulty.name().toLowerCase(), session.getWorldCache().getDifficulty() == difficulty); + difficultyDropdown.option("%options.difficulty." + difficulty.name().toLowerCase(), session.getWorldCache().getDifficulty() == difficulty); } - builder.addComponent(difficultyDropdown); + builder.dropdown(difficultyDropdown); } if (session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.gamerules")) { - builder.addComponent(new LabelComponent(LanguageUtils.getPlayerLocaleString("geyser.settings.title.game_rules", language))); + builder.label("geyser.settings.title.game_rules") + .translator(LocaleUtils::getLocaleString); // we need translate gamerules next + + WorldManager worldManager = GeyserConnector.getInstance().getWorldManager(); for (GameRule gamerule : GameRule.values()) { if (gamerule.equals(GameRule.UNKNOWN)) { continue; @@ -90,74 +81,54 @@ public class SettingsUtils { // Add the relevant form item based on the gamerule type if (Boolean.class.equals(gamerule.getType())) { - builder.addComponent(new ToggleComponent(LocaleUtils.getLocaleString("gamerule." + gamerule.getJavaID(), language), GeyserConnector.getInstance().getWorldManager().getGameRuleBool(session, gamerule))); + builder.toggle("gamerule." + gamerule.getJavaID(), worldManager.getGameRuleBool(session, gamerule)); } else if (Integer.class.equals(gamerule.getType())) { - builder.addComponent(new InputComponent(LocaleUtils.getLocaleString("gamerule." + gamerule.getJavaID(), language), "", String.valueOf(GeyserConnector.getInstance().getWorldManager().getGameRuleInt(session, gamerule)))); + builder.input("gamerule." + gamerule.getJavaID(), "", String.valueOf(worldManager.getGameRuleInt(session, gamerule))); } } } - session.setSettingsForm(builder.build()); - } - - /** - * Handle the settings form response - * - * @param session The session that sent the response - * @param response The response string to parse - * @return True if the form was parsed correctly, false if not - */ - public static boolean handleSettingsForm(GeyserSession session, String response) { - CustomFormWindow settingsForm = session.getSettingsForm(); - settingsForm.setResponse(response); - - CustomFormResponse settingsResponse = (CustomFormResponse) settingsForm.getResponse(); - int offset = 0; - - offset++; // Client settings title - - session.getWorldCache().setShowCoordinates(settingsResponse.getToggleResponses().get(offset)); - offset++; - - if (session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.server")) { - offset++; // Server settings title - - GameMode gameMode = GameMode.values()[settingsResponse.getDropdownResponses().get(offset).getElementID()]; - if (gameMode != null && gameMode != session.getGameMode()) { - session.getConnector().getWorldManager().setPlayerGameMode(session, gameMode); + builder.responseHandler((form, responseData) -> { + CustomFormResponse response = form.parseResponseAs(responseData); + if (response.isClosed() || response.isInvalid()) { + return; } - offset++; - Difficulty difficulty = Difficulty.values()[settingsResponse.getDropdownResponses().get(offset).getElementID()]; - if (difficulty != null && difficulty != session.getWorldCache().getDifficulty()) { - session.getConnector().getWorldManager().setDifficulty(session, difficulty); - } - offset++; - } + session.getWorldCache().setShowCoordinates(response.next()); - if (session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.gamerules")) { - offset++; // Game rule title - - for (GameRule gamerule : GameRule.values()) { - if (gamerule.equals(GameRule.UNKNOWN)) { - continue; + if (session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.server")) { + GameMode gameMode = GameMode.values()[(int) response.next()]; + if (gameMode != null && gameMode != session.getGameMode()) { + session.getConnector().getWorldManager().setPlayerGameMode(session, gameMode); } - if (Boolean.class.equals(gamerule.getType())) { - Boolean value = settingsResponse.getToggleResponses().get(offset).booleanValue(); - if (value != session.getConnector().getWorldManager().getGameRuleBool(session, gamerule)) { - session.getConnector().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); + Difficulty difficulty = Difficulty.values()[(int) response.next()]; + if (difficulty != null && difficulty != session.getWorldCache().getDifficulty()) { + session.getConnector().getWorldManager().setDifficulty(session, difficulty); + } + } + + if (session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.gamerules")) { + for (GameRule gamerule : GameRule.values()) { + if (gamerule.equals(GameRule.UNKNOWN)) { + continue; } - } else if (Integer.class.equals(gamerule.getType())) { - int value = Integer.parseInt(settingsResponse.getInputResponses().get(offset)); - if (value != session.getConnector().getWorldManager().getGameRuleInt(session, gamerule)) { - session.getConnector().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); + + if (Boolean.class.equals(gamerule.getType())) { + boolean value = response.next(); + if (value != session.getConnector().getWorldManager().getGameRuleBool(session, gamerule)) { + session.getConnector().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); + } + } else if (Integer.class.equals(gamerule.getType())) { + int value = Integer.parseInt(response.next()); + if (value != session.getConnector().getWorldManager().getGameRuleInt(session, gamerule)) { + session.getConnector().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); + } } } - offset++; } - } + }); - return true; + return builder.build(); } } From dc8fb4642818012118b61411c83aa32e24283dc7 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 30 Oct 2020 01:14:34 +0100 Subject: [PATCH 010/766] Manually solve some merge issues --- .../java/org/geysermc/common/form/Form.java | 12 ++- .../java/JavaPluginMessageTranslator.java | 78 +++++++++++++++++++ 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java diff --git a/common/src/main/java/org/geysermc/common/form/Form.java b/common/src/main/java/org/geysermc/common/form/Form.java index 5b3437572..5924e6896 100644 --- a/common/src/main/java/org/geysermc/common/form/Form.java +++ b/common/src/main/java/org/geysermc/common/form/Form.java @@ -26,12 +26,14 @@ package org.geysermc.common.form; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.annotations.SerializedName; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import org.geysermc.common.form.response.FormResponse; +import org.geysermc.common.form.util.FormAdaptor; import java.util.function.BiConsumer; import java.util.function.BiFunction; @@ -39,7 +41,11 @@ import java.util.function.Consumer; @Getter public abstract class Form { - protected static final Gson GSON = new Gson(); + protected static final Gson GSON = + new GsonBuilder() + .registerTypeAdapter(ModalForm.class, new FormAdaptor()) + .create(); + private final Type type; @Getter(AccessLevel.NONE) @@ -51,6 +57,10 @@ public abstract class Form { this.type = type; } + public static T fromJson(String json, Class formClass) { + return GSON.fromJson(json, formClass); + } + public String getJsonData() { if (hardcodedJsonData != null) { return hardcodedJsonData; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java new file mode 100644 index 000000000..2a791d5a2 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2019-2020 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.connector.network.translators.java; + +import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; +import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; +import com.google.common.base.Charsets; +import org.geysermc.common.form.Form; +import org.geysermc.connector.common.AuthType; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +import java.nio.charset.StandardCharsets; + +@Translator(packet = ServerPluginMessagePacket.class) +public class JavaPluginMessageTranslator extends PacketTranslator { + @Override + public void translate(ServerPluginMessagePacket packet, GeyserSession session) { + // The only plugin messages to listen for are Floodgate plugin messages + if (session.getConnector().getAuthType() != AuthType.FLOODGATE) { + return; + } + + String channel = packet.getChannel(); + + if (channel.equals("floodgate:form")) { + byte[] data = packet.getData(); + + // receive: first byte is form type, second and third are the id, remaining is the form data + // respond: first and second byte id, remaining is form response data + + Form.Type type = Form.Type.getByOrdinal(data[0]); + if (type == null) { + throw new NullPointerException( + "Got type " + data[0] + " which isn't a valid form type!"); + } + + String dataString = new String(data, 3, data.length - 3, Charsets.UTF_8); + + Form form = Form.fromJson(dataString, type.getTypeClass()); + form.setResponseHandler(response -> { + byte[] raw = response.getBytes(StandardCharsets.UTF_8); + byte[] finalData = new byte[raw.length + 2]; + + finalData[0] = data[1]; + finalData[1] = data[2]; + System.arraycopy(raw, 0, finalData, 2, raw.length); + + session.sendDownstreamPacket(new ClientPluginMessagePacket(channel, finalData)); + }); + session.sendForm(form); + } + } +} From 819ff09ee6f390f112950212913908006b4b37bb Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 30 Oct 2020 01:31:22 +0100 Subject: [PATCH 011/766] Manually resolved merge conflicts This specific commit isn't compilable, since StatisticsUtils hasn't been updated to match the new Form style. --- .../org/geysermc/connector/network/UpstreamPacketHandler.java | 2 +- .../main/java/org/geysermc/connector/utils/StatisticsUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 72574b591..20d2bb9e7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -139,7 +139,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(ModalFormResponsePacket packet) { session.getFormCache().handleResponse(packet); - return true; //todo change the Statistics Form to match the new style + return true; } private boolean couldLoginUserByName(String bedrockUsername) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java b/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java index 3c42182d7..732217c24 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.world.block.BlockTranslator; import java.util.Map; -public class StatisticsUtils { +public class StatisticsUtils { //todo make Geyser compilable // Used in UpstreamPacketHandler.java public static final int STATISTICS_MENU_FORM_ID = 1339; From 7e3a736f20c9810f86c328f034e907399a338fb7 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Wed, 18 Nov 2020 19:38:49 +0100 Subject: [PATCH 012/766] Register Floodgate payload, updated Statistics, smaller jar, fixed bugs Quite a lot of changes, but I was too lazy to split them in different commits (and they'll be squashed later anyway): * Floodgate plugin message channels are now registered (because Spigot requires that, and I guess it's better practice) * Updated the Statistics form to match the new Forms API * The common jar is now much smaller, because Jackson isn't needed anymore in the common module * Fixed some bugs in Forms where empty fields would lead to excluding them in the serialization (making Bedrock complain) And a few other things, like a new boolean in RawSkin saying if the Skin is an Alex or Steve model. --- common/pom.xml | 6 - .../org/geysermc/common/form/ModalForm.java | 6 +- .../org/geysermc/common/form/SimpleForm.java | 2 +- .../common/window/CustomFormWindow.java | 0 .../common/window/SimpleFormWindow.java | 0 .../geysermc/floodgate/util/BedrockData.java | 49 +-- .../org/geysermc/floodgate/util/DeviceOs.java | 3 +- .../geysermc/floodgate/util/InputMode.java | 4 +- .../geysermc/floodgate/util/LinkedPlayer.java | 15 +- .../org/geysermc/floodgate/util/RawSkin.java | 33 +- .../geysermc/floodgate/util/UiProfile.java | 7 +- .../geysermc/connector/GeyserConnector.java | 2 +- .../org/geysermc/connector/dump/DumpInfo.java | 2 +- .../connector/entity/FireworkEntity.java | 2 +- .../network/session/GeyserSession.java | 4 +- .../session/auth/BedrockClientData.java | 69 +++- .../java/JavaJoinGameTranslator.java | 7 +- .../java/JavaStatisticsTranslator.java | 3 +- .../connector/utils/LanguageUtils.java | 13 +- .../connector/utils/LoginEncryptionUtils.java | 2 - .../connector/utils/PluginMessageUtils.java | 36 +- .../connector/utils/SkinProvider.java | 3 +- .../connector/utils/StatisticsUtils.java | 317 +++++++++--------- 23 files changed, 324 insertions(+), 261 deletions(-) delete mode 100644 common/src/main/java/org/geysermc/common/window/CustomFormWindow.java delete mode 100644 common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java diff --git a/common/pom.xml b/common/pom.xml index 30c8afc06..9223331be 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -18,11 +18,5 @@ 2.8.5 compile - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.9.8 - compile - \ No newline at end of file diff --git a/common/src/main/java/org/geysermc/common/form/ModalForm.java b/common/src/main/java/org/geysermc/common/form/ModalForm.java index 10309f9c2..ea58a466e 100644 --- a/common/src/main/java/org/geysermc/common/form/ModalForm.java +++ b/common/src/main/java/org/geysermc/common/form/ModalForm.java @@ -69,9 +69,9 @@ public class ModalForm extends Form { } public static final class Builder extends Form.Builder { - private String content; - private String button1; - private String button2; + private String content = ""; + private String button1 = ""; + private String button2 = ""; public Builder content(String content) { this.content = translate(content); diff --git a/common/src/main/java/org/geysermc/common/form/SimpleForm.java b/common/src/main/java/org/geysermc/common/form/SimpleForm.java index 1a1ce616b..275fb8a86 100644 --- a/common/src/main/java/org/geysermc/common/form/SimpleForm.java +++ b/common/src/main/java/org/geysermc/common/form/SimpleForm.java @@ -80,7 +80,7 @@ public final class SimpleForm extends Form { public static final class Builder extends Form.Builder { private final List buttons = new ArrayList<>(); - private String content; + private String content = ""; public Builder content(String content) { this.content = translate(content); diff --git a/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java b/common/src/main/java/org/geysermc/common/window/CustomFormWindow.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java b/common/src/main/java/org/geysermc/common/window/SimpleFormWindow.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java index 89eaf5395..08c1e28d3 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java +++ b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java @@ -30,14 +30,14 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. - * This class is only used internally, and you should look at FloodgatePlayer instead - * (FloodgatePlayer is present in the common module in the Floodgate repo) + * This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. This + * class is only used internally, and you should look at FloodgatePlayer instead (FloodgatePlayer is + * present in the API module of the Floodgate repo) */ -@AllArgsConstructor(access = AccessLevel.PACKAGE) @Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) public final class BedrockData { - public static final int EXPECTED_LENGTH = 9; + public static final int EXPECTED_LENGTH = 10; private final String version; private final String username; @@ -48,22 +48,21 @@ public final class BedrockData { private final int inputMode; private final String ip; private final LinkedPlayer linkedPlayer; + private final boolean fromProxy; + private final int dataLength; - public BedrockData(String version, String username, String xuid, int deviceOs, - String languageCode, int uiProfile, int inputMode, String ip, - LinkedPlayer linkedPlayer) { - this(version, username, xuid, deviceOs, languageCode, - inputMode, uiProfile, ip, linkedPlayer, EXPECTED_LENGTH); + public static BedrockData of(String version, String username, String xuid, int deviceOs, + String languageCode, int uiProfile, int inputMode, String ip, + LinkedPlayer linkedPlayer, boolean fromProxy) { + return new BedrockData(version, username, xuid, deviceOs, languageCode, inputMode, + uiProfile, ip, linkedPlayer, fromProxy, EXPECTED_LENGTH); } - public BedrockData(String version, String username, String xuid, int deviceOs, - String languageCode, int uiProfile, int inputMode, String ip) { - this(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null); - } - - public boolean hasPlayerLink() { - return linkedPlayer != null; + public static BedrockData of(String version, String username, String xuid, int deviceOs, + String languageCode, int uiProfile, int inputMode, String ip) { + return of(version, username, xuid, deviceOs, languageCode, + uiProfile, inputMode, ip, null, false); } public static BedrockData fromString(String data) { @@ -77,19 +76,23 @@ public final class BedrockData { return new BedrockData( split[0], split[1], split[2], Integer.parseInt(split[3]), split[4], Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], - linkedPlayer, split.length + linkedPlayer, Boolean.parseBoolean(split[9]), split.length ); } + private static BedrockData emptyData(int dataLength) { + return new BedrockData(null, null, null, -1, null, -1, -1, null, null, false, dataLength); + } + + public boolean hasPlayerLink() { + return linkedPlayer != null; + } + @Override public String toString() { // The format is the same as the order of the fields in this class return version + '\0' + username + '\0' + xuid + '\0' + deviceOs + '\0' + languageCode + '\0' + uiProfile + '\0' + inputMode + '\0' + ip + '\0' + - (linkedPlayer != null ? linkedPlayer.toString() : "null"); - } - - private static BedrockData emptyData(int dataLength) { - return new BedrockData(null, null, null, -1, null, -1, -1, null, null, dataLength); + fromProxy + '\0' + (linkedPlayer != null ? linkedPlayer.toString() : "null"); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java b/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java index da783982c..b3245ef81 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java +++ b/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java @@ -25,7 +25,6 @@ package org.geysermc.floodgate.util; -import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; @@ -34,7 +33,6 @@ import lombok.RequiredArgsConstructor; */ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum DeviceOs { - @JsonEnumDefaultValue UNKNOWN("Unknown"), ANDROID("Android"), IOS("iOS"), @@ -57,6 +55,7 @@ public enum DeviceOs { /** * Get the DeviceOs instance from the identifier. + * * @param id the DeviceOs identifier * @return The DeviceOs or {@link #UNKNOWN} if the DeviceOs wasn't found */ diff --git a/common/src/main/java/org/geysermc/floodgate/util/InputMode.java b/common/src/main/java/org/geysermc/floodgate/util/InputMode.java index 4dcaa8ab3..9664e18ae 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/InputMode.java +++ b/common/src/main/java/org/geysermc/floodgate/util/InputMode.java @@ -26,10 +26,7 @@ package org.geysermc.floodgate.util; -import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; - public enum InputMode { - @JsonEnumDefaultValue UNKNOWN, KEYBOARD_MOUSE, TOUCH, // I guess Touch? @@ -40,6 +37,7 @@ public enum InputMode { /** * Get the InputMode instance from the identifier. + * * @param id the InputMode identifier * @return The InputMode or {@link #UNKNOWN} if the DeviceOs wasn't found */ diff --git a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java index 53a167f9b..c29d461d1 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java +++ b/common/src/main/java/org/geysermc/floodgate/util/LinkedPlayer.java @@ -26,11 +26,14 @@ package org.geysermc.floodgate.util; +import lombok.AccessLevel; import lombok.Getter; +import lombok.RequiredArgsConstructor; import java.util.UUID; @Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) public final class LinkedPlayer { /** * The Java username of the linked player @@ -45,19 +48,17 @@ public final class LinkedPlayer { */ private final UUID bedrockId; /** - * If the LinkedPlayer is send from a different platform. - * For example the LinkedPlayer is from Bungee but the data has been sent to the Bukkit server. + * If the LinkedPlayer is send from a different platform. For example the LinkedPlayer is from + * Bungee but the data has been sent to the Bukkit server. */ private boolean fromDifferentPlatform = false; - public LinkedPlayer(String javaUsername, UUID javaUniqueId, UUID bedrockId) { - this.javaUsername = javaUsername; - this.javaUniqueId = javaUniqueId; - this.bedrockId = bedrockId; + public static LinkedPlayer of(String javaUsername, UUID javaUniqueId, UUID bedrockId) { + return new LinkedPlayer(javaUsername, javaUniqueId, bedrockId); } static LinkedPlayer fromString(String data) { - if (data.length() != 3) { + if (data.length() == 4) { return null; } diff --git a/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java b/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java index 2ff0e3fb2..152cbec5a 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java +++ b/common/src/main/java/org/geysermc/floodgate/util/RawSkin.java @@ -31,31 +31,36 @@ import lombok.ToString; import java.nio.ByteBuffer; import java.util.Base64; +import static java.lang.String.format; + @AllArgsConstructor @ToString public final class RawSkin { public int width; public int height; public byte[] data; + public boolean alex; - private RawSkin() {} + private RawSkin() { + } public static RawSkin decode(byte[] data) throws InvalidFormatException { if (data == null) { return null; } - int maxEncodedLength = 4 * (((64 * 64 * 4 + 8) + 2) / 3); + int maxEncodedLength = 4 * (((64 * 64 * 4 + 9) + 2) / 3); // if the RawSkin is longer then the max Java Edition skin length if (data.length > maxEncodedLength) { - throw new InvalidFormatException( - "Encoded data cannot be longer then " + maxEncodedLength + " bytes!" - ); + throw new InvalidFormatException(format( + "Encoded data cannot be longer then %s bytes! Got %s", + maxEncodedLength, data.length + )); } - // if the encoded data doesn't even contain the width and height (8 bytes, 2 ints) - if (data.length < 4 * ((8 + 2) / 3)) { - throw new InvalidFormatException("Encoded data must be at least 12 bytes long!"); + // if the encoded data doesn't even contain the width, height (8 bytes, 2 ints) and isAlex + if (data.length < 4 * ((9 + 2) / 3)) { + throw new InvalidFormatException("Encoded data must be at least 16 bytes long!"); } data = Base64.getDecoder().decode(data); @@ -65,23 +70,25 @@ public final class RawSkin { RawSkin skin = new RawSkin(); skin.width = buffer.getInt(); skin.height = buffer.getInt(); - if (buffer.remaining() != (skin.width * skin.height * 4)) { - throw new InvalidFormatException(String.format( + if (buffer.remaining() - 1 != (skin.width * skin.height * 4)) { + throw new InvalidFormatException(format( "Expected skin length to be %s, got %s", (skin.width * skin.height * 4), buffer.remaining() )); } - skin.data = new byte[buffer.remaining()]; + skin.data = new byte[buffer.remaining() - 1]; buffer.get(skin.data); + skin.alex = buffer.get() == 1; return skin; } public byte[] encode() { - // 2 x int = 8 bytes - ByteBuffer buffer = ByteBuffer.allocate(8 + data.length); + // 2 x int + 1 = 9 bytes + ByteBuffer buffer = ByteBuffer.allocate(9 + data.length); buffer.putInt(width); buffer.putInt(height); buffer.put(data); + buffer.put((byte) (alex ? 1 : 0)); return Base64.getEncoder().encode(buffer.array()); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java b/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java index 441e9202a..58d615eaa 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java +++ b/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java @@ -26,17 +26,14 @@ package org.geysermc.floodgate.util; -import com.fasterxml.jackson.annotation.JsonEnumDefaultValue; - public enum UiProfile { - @JsonEnumDefaultValue - CLASSIC, - POCKET; + CLASSIC, POCKET; private static final UiProfile[] VALUES = values(); /** * Get the UiProfile instance from the identifier. + * * @param id the UiProfile identifier * @return The UiProfile or {@link #CLASSIC} if the UiProfile wasn't found */ diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 1c35b23de..c44f8f434 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -229,7 +229,7 @@ public class GeyserConnector { for (GeyserSession session : players) { if (session == null) continue; if (session.getClientData() == null) continue; - String os = session.getClientData().getDeviceOS().toString(); + String os = session.getClientData().getDeviceOs().toString(); if (!valueMap.containsKey(os)) { valueMap.put(os, 1); } else { diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index b229e1670..d41ad64a3 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -73,7 +73,7 @@ public class DumpInfo { this.userPlatforms = new Object2IntOpenHashMap(); for (GeyserSession session : GeyserConnector.getInstance().getPlayers()) { - DeviceOs device = session.getClientData().getDeviceOS(); + DeviceOs device = session.getClientData().getDeviceOs(); userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java index ede3b78bb..630a5edd9 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java @@ -67,7 +67,7 @@ public class FireworkEntity extends Entity { // TODO: Remove once Mojang fixes bugs with fireworks crashing clients on these specific devices. // https://bugs.mojang.com/browse/MCPE-89115 - if (session.getClientData().getDeviceOS() == DeviceOs.XBOX_ONE || session.getClientData().getDeviceOS() == DeviceOs.ORBIS) { + if (session.getClientData().getDeviceOs() == DeviceOs.XBOX_ONE || session.getClientData().getDeviceOs() == DeviceOs.ORBIS) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index bea234b50..99aada2a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -402,11 +402,11 @@ public class GeyserSession implements CommandSender { try { FloodgateCipher cipher = connector.getCipher(); - encryptedData = cipher.encryptFromString(new BedrockData( + encryptedData = cipher.encryptFromString(BedrockData.of( clientData.getGameVersion(), authData.getName(), authData.getXboxUUID(), - clientData.getDeviceOS().ordinal(), + clientData.getDeviceOs().ordinal(), clientData.getLanguageCode(), clientData.getUiProfile().ordinal(), clientData.getCurrentInputMode().ordinal(), diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java index ab0fad845..905245ee4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; +import com.google.common.base.Charsets; import lombok.Getter; import org.geysermc.connector.utils.SkinProvider; import org.geysermc.floodgate.util.DeviceOs; @@ -87,7 +88,7 @@ public final class BedrockClientData { @JsonProperty(value = "DeviceModel") private String deviceModel; @JsonProperty(value = "DeviceOS") - private DeviceOs deviceOS; + private DeviceOs deviceOs; @JsonProperty(value = "UIProfile") private UiProfile uiProfile; @JsonProperty(value = "GuiScale") @@ -114,13 +115,7 @@ public final class BedrockClientData { @JsonProperty(value = "ThirdPartyNameOnly") private boolean thirdPartyNameOnly; - public void setJsonData(JsonNode data) { - if (this.jsonData == null && data != null) { - this.jsonData = data; - } - } - - private static RawSkin getLegacyImage(byte[] imageData) { + private static RawSkin getLegacyImage(byte[] imageData, boolean alex) { if (imageData == null) { return null; } @@ -128,43 +123,54 @@ public final class BedrockClientData { // width * height * 4 (rgba) switch (imageData.length) { case 8192: - return new RawSkin(64, 32, imageData); + return new RawSkin(64, 32, imageData, alex); case 16384: - return new RawSkin(64, 64, imageData); + return new RawSkin(64, 64, imageData, alex); case 32768: - return new RawSkin(64, 128, imageData); + return new RawSkin(64, 128, imageData, alex); case 65536: - return new RawSkin(128, 128, imageData); + return new RawSkin(128, 128, imageData, alex); default: throw new IllegalArgumentException("Unknown legacy skin size"); } } + public void setJsonData(JsonNode data) { + if (this.jsonData == null && data != null) { + this.jsonData = data; + } + } + /** * Taken from https://github.com/NukkitX/Nukkit/blob/master/src/main/java/cn/nukkit/network/protocol/LoginPacket.java
* Internally only used for Skins, but can be used for Capes too */ public RawSkin getImage(String name) { - System.out.println(jsonData.toString()); if (jsonData == null || !jsonData.has(name + "Data")) { return null; } + boolean alex = false; + if (name.equals("Skin")) { + alex = isAlex(); + } + byte[] image = Base64.getDecoder().decode(jsonData.get(name + "Data").asText()); if (jsonData.has(name + "ImageWidth") && jsonData.has(name + "ImageHeight")) { return new RawSkin( jsonData.get(name + "ImageWidth").asInt(), jsonData.get(name + "ImageHeight").asInt(), - image + image, alex ); } - return getLegacyImage(image); + return getLegacyImage(image, alex); } public RawSkin getAndTransformImage(String name) { RawSkin skin = getImage(name); if (skin != null && (skin.width > 64 || skin.height > 64)) { - BufferedImage scaledImage = SkinProvider.imageDataToBufferedImage(skin.data, skin.width, skin.height); + BufferedImage scaledImage = + SkinProvider.imageDataToBufferedImage(skin.data, skin.width, skin.height); int max = Math.max(skin.width, skin.height); while (max > 64) { @@ -179,4 +185,35 @@ public final class BedrockClientData { } return skin; } + + public boolean isAlex() { + try { + byte[] bytes = Base64.getDecoder().decode(geometryName.getBytes(Charsets.UTF_8)); + String geometryName = + SkinProvider.OBJECT_MAPPER + .readTree(bytes) + .get("geometry").get("default") + .asText(); + return "geometry.humanoid.customSlim".equals(geometryName); + } catch (Exception exception) { + exception.printStackTrace(); + return false; + } + } + + public DeviceOs getDeviceOs() { + return deviceOs != null ? deviceOs : DeviceOs.UNKNOWN; + } + + public InputMode getCurrentInputMode() { + return currentInputMode != null ? currentInputMode : InputMode.UNKNOWN; + } + + public InputMode getDefaultInputMode() { + return defaultInputMode != null ? defaultInputMode : InputMode.UNKNOWN; + } + + public UiProfile getUiProfile() { + return uiProfile != null ? uiProfile : UiProfile.CLASSIC; + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index a86c1a971..c0207841d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -34,6 +34,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePack import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.entity.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -46,7 +47,6 @@ import java.util.List; @Translator(packet = ServerJoinGamePacket.class) public class JavaJoinGameTranslator extends PacketTranslator { - @Override public void translate(ServerJoinGamePacket packet, GeyserSession session) { PlayerEntity entity = session.getPlayerEntity(); @@ -96,6 +96,11 @@ public class JavaJoinGameTranslator extends PacketTranslator { - @Override public void translate(ServerStatisticsPacket packet, GeyserSession session) { session.updateStatistics(packet.getStatistics()); if (session.isWaitingForStatistics()) { session.setWaitingForStatistics(false); - session.sendForm(StatisticsUtils.buildMenuForm(session), StatisticsUtils.STATISTICS_MENU_FORM_ID); + StatisticsUtils.buildAndSendStatisticsMenu(session); } } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java index 06d2936ef..fd25ce0a0 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java @@ -60,7 +60,9 @@ public class LanguageUtils { public static void loadGeyserLocale(String locale) { locale = formatLocale(locale); // Don't load the locale if it's already loaded. - if (LOCALE_MAPPINGS.containsKey(locale)) return; + if (LOCALE_MAPPINGS.containsKey(locale)) { + return; + } InputStream localeStream = GeyserConnector.class.getClassLoader().getResourceAsStream("languages/texts/" + locale + ".properties"); @@ -109,7 +111,7 @@ public class LanguageUtils { // Try and get the key from the default locale if (formatString == null) { - properties = LOCALE_MAPPINGS.get(formatLocale(getDefaultLocale())); + properties = LOCALE_MAPPINGS.get(getDefaultLocale()); formatString = properties.getProperty(key); } @@ -121,7 +123,7 @@ public class LanguageUtils { // Final fallback if (formatString == null) { - formatString = key; + return key; } return MessageFormat.format(formatString.replace("'", "''").replace("&", "\u00a7"), values); @@ -147,7 +149,10 @@ public class LanguageUtils { * @return the current default locale */ public static String getDefaultLocale() { - if (CACHED_LOCALE != null) return CACHED_LOCALE; // We definitely know the locale the user is using + if (CACHED_LOCALE != null) { + return CACHED_LOCALE; // We definitely know the locale the user is using + } + String locale; boolean isValid = true; if (GeyserConnector.getInstance() != null && diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index 391a02849..84997deb6 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -35,10 +35,8 @@ import com.nukkitx.protocol.bedrock.packet.LoginPacket; import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; import com.nukkitx.protocol.bedrock.util.EncryptionUtils; import org.geysermc.common.form.CustomForm; -import org.geysermc.common.form.ModalForm; import org.geysermc.common.form.SimpleForm; import org.geysermc.common.form.response.CustomFormResponse; -import org.geysermc.common.form.response.ModalFormResponse; import org.geysermc.common.form.response.SimpleFormResponse; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java index eff9ee57b..4c7547d3a 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java @@ -25,27 +25,47 @@ package org.geysermc.connector.utils; +import com.google.common.base.Charsets; import org.geysermc.connector.GeyserConnector; -import java.nio.charset.StandardCharsets; +import java.nio.ByteBuffer; public class PluginMessageUtils { - private static final byte[] BRAND_DATA; + private static final byte[] GEYSER_BRAND_DATA; + private static final byte[] FLOODGATE_REGISTER_DATA; static { - byte[] data = GeyserConnector.NAME.getBytes(StandardCharsets.UTF_8); - byte[] varInt = writeVarInt(data.length); - BRAND_DATA = new byte[varInt.length + data.length]; - System.arraycopy(varInt, 0, BRAND_DATA, 0, varInt.length); - System.arraycopy(data, 0, BRAND_DATA, varInt.length, data.length); + byte[] data = GeyserConnector.NAME.getBytes(Charsets.UTF_8); + GEYSER_BRAND_DATA = + ByteBuffer.allocate(data.length + getVarIntLength(data.length)) + .put(writeVarInt(data.length)) + .put(data) + .array(); + + data = "floodgate:skin\0floodgate:form".getBytes(Charsets.UTF_8); + FLOODGATE_REGISTER_DATA = + ByteBuffer.allocate(data.length + getVarIntLength(data.length)) + .put(writeVarInt(data.length)) + .put(data) + .array(); } /** * Get the prebuilt brand as a byte array + * * @return the brand information of the Geyser client */ public static byte[] getGeyserBrandData() { - return BRAND_DATA; + return GEYSER_BRAND_DATA; + } + + /** + * Get the prebuilt register data as a byte array + * + * @return the register data of the Floodgate channels + */ + public static byte[] getFloodgateRegisterData() { + return FLOODGATE_REGISTER_DATA; } private static byte[] writeVarInt(int value) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java index b74ecefad..530c551ab 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java @@ -77,7 +77,7 @@ public class SkinProvider { public static String EARS_GEOMETRY; public static String EARS_GEOMETRY_SLIM; - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); static { /* Load in the normal ears geometry */ @@ -525,7 +525,6 @@ public class SkinProvider { outputStream.write((rgba >> 24) & 0xFF); } } - return outputStream.toByteArray(); } diff --git a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java b/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java index 732217c24..41084504a 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java @@ -28,196 +28,170 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.statistic.*; -import org.geysermc.common.window.SimpleFormWindow; -import org.geysermc.common.window.button.FormButton; -import org.geysermc.common.window.response.SimpleFormResponse; +import org.geysermc.common.form.SimpleForm; +import org.geysermc.common.form.response.SimpleFormResponse; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.network.translators.world.block.BlockTranslator; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; -public class StatisticsUtils { //todo make Geyser compilable - - // Used in UpstreamPacketHandler.java - public static final int STATISTICS_MENU_FORM_ID = 1339; - public static final int STATISTICS_LIST_FORM_ID = 1340; +public class StatisticsUtils { + private static final Pattern CONTENT_PATTERN = Pattern.compile("^\\S+:", Pattern.MULTILINE); /** * Build a form for the given session with all statistic categories * * @param session The session to build the form for */ - public static SimpleFormWindow buildMenuForm(GeyserSession session) { + public static void buildAndSendStatisticsMenu(GeyserSession session) { // Cache the language for cleaner access - String language = session.getClientData().getLanguageCode(); + String language = session.getLocale(); - SimpleFormWindow window = new SimpleFormWindow(LocaleUtils.getLocaleString("gui.stats", language), ""); + session.sendForm( + SimpleForm.builder() + .translator(StatisticsUtils::translate, language) + .title("gui.stats") + .button("stat.generalButton") + .button("stat.itemsButton - stat_type.minecraft.mined") + .button("stat.itemsButton - stat_type.minecraft.broken") + .button("stat.itemsButton - stat_type.minecraft.crafted") + .button("stat.itemsButton - stat_type.minecraft.used") + .button("stat.itemsButton - stat_type.minecraft.picked_up") + .button("stat.itemsButton - stat_type.minecraft.dropped") + .button("stat.mobsButton - geyser.statistics.killed") + .button("stat.mobsButton - geyser.statistics.killed_by") + .responseHandler((form, responseData) -> { + SimpleFormResponse response = form.parseResponse(responseData); + if (!response.isCorrect()) { + return; + } - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.generalButton", language))); + SimpleForm.Builder builder = + SimpleForm.builder() + .translator(StatisticsUtils::translate, language); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.mined", language))); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.broken", language))); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.crafted", language))); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.used", language))); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.picked_up", language))); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.dropped", language))); + StringBuilder content = new StringBuilder(); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.mobsButton", language) + " - " + LanguageUtils.getPlayerLocaleString("geyser.statistics.killed", language))); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("stat.mobsButton", language) + " - " + LanguageUtils.getPlayerLocaleString("geyser.statistics.killed_by", language))); + switch (response.getClickedButtonId()) { + case 0: + builder.title("stat.generalButton"); - return window; - } + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof GenericStatistic) { + String statName = ((GenericStatistic) entry.getKey()).name().toLowerCase(); + content.append("stat.minecraft.").append(statName).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 1: + builder.title("stat.itemsButton - stat_type.minecraft.mined"); - /** - * Handle the menu form response - * - * @param session The session that sent the response - * @param response The response string to parse - * @return True if the form was parsed correctly, false if not - */ - public static boolean handleMenuForm(GeyserSession session, String response) { - SimpleFormWindow menuForm = (SimpleFormWindow) session.getWindowCache().getWindows().get(STATISTICS_MENU_FORM_ID); - menuForm.setResponse(response); - SimpleFormResponse formResponse = (SimpleFormResponse) menuForm.getResponse(); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof BreakBlockStatistic) { + String block = BlockTranslator.JAVA_ID_TO_JAVA_IDENTIFIER_MAP.get(((BreakBlockStatistic) entry.getKey()).getId()); + block = block.replace("minecraft:", "block.minecraft."); + content.append(block).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 2: + builder.title("stat.itemsButton - stat_type.minecraft.broken"); - // Cache the language for cleaner access - String language = session.getClientData().getLanguageCode(); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof BreakItemStatistic) { + String item = ItemRegistry.ITEM_ENTRIES.get(((BreakItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); + content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 3: + builder.title("stat.itemsButton - stat_type.minecraft.crafted"); - if (formResponse != null && formResponse.getClickedButton() != null) { - String title; - StringBuilder content = new StringBuilder(); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof CraftItemStatistic) { + String item = ItemRegistry.ITEM_ENTRIES.get(((CraftItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); + content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 4: + builder.title("stat.itemsButton - stat_type.minecraft.used"); - switch (formResponse.getClickedButtonId()) { - case 0: - title = LocaleUtils.getLocaleString("stat.generalButton", language); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof UseItemStatistic) { + String item = ItemRegistry.ITEM_ENTRIES.get(((UseItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); + content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 5: + builder.title("stat.itemsButton - stat_type.minecraft.picked_up"); - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof GenericStatistic) { - content.append(LocaleUtils.getLocaleString("stat.minecraft." + ((GenericStatistic) entry.getKey()).name().toLowerCase(), language) + ": " + entry.getValue() + "\n"); - } - } - break; - case 1: - title = LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.mined", language); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof PickupItemStatistic) { + String item = ItemRegistry.ITEM_ENTRIES.get(((PickupItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); + content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 6: + builder.title("stat.itemsButton - stat_type.minecraft.dropped"); - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof BreakBlockStatistic) { - String block = BlockTranslator.JAVA_ID_TO_JAVA_IDENTIFIER_MAP.get(((BreakBlockStatistic) entry.getKey()).getId()); - block = block.replace("minecraft:", "block.minecraft."); - block = LocaleUtils.getLocaleString(block, language); - content.append(block + ": " + entry.getValue() + "\n"); - } - } - break; - case 2: - title = LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.broken", language); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof DropItemStatistic) { + String item = ItemRegistry.ITEM_ENTRIES.get(((DropItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); + content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 7: + builder.title("stat.mobsButton - geyser.statistics.killed"); - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof BreakItemStatistic) { - String item = ItemRegistry.ITEM_ENTRIES.get(((BreakItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language) + ": " + entry.getValue() + "\n"); - } - } - break; - case 3: - title = LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.crafted", language); + for (Map.Entry entry : session.getStatistics().entrySet()) { + if (entry.getKey() instanceof KillEntityStatistic) { + String entityName = MagicValues.key(EntityType.class, ((KillEntityStatistic) entry.getKey()).getId()).name().toLowerCase(); + content.append("entity.minecraft.").append(entityName).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + case 8: + builder.title("stat.mobsButton - geyser.statistics.killed_by"); - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof CraftItemStatistic) { - String item = ItemRegistry.ITEM_ENTRIES.get(((CraftItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language) + ": " + entry.getValue() + "\n"); - } - } - break; - case 4: - title = LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.used", language); + for (Map.Entry entry : session + .getStatistics().entrySet()) { + if (entry.getKey() instanceof KilledByEntityStatistic) { + String entityName = MagicValues.key(EntityType.class, ((KilledByEntityStatistic) entry.getKey()).getId()).name().toLowerCase(); + content.append("entity.minecraft.").append(entityName).append(": ").append(entry.getValue()).append("\n"); + } + } + break; + default: + return; + } - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof UseItemStatistic) { - String item = ItemRegistry.ITEM_ENTRIES.get(((UseItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language) + ": " + entry.getValue() + "\n"); - } - } - break; - case 5: - title = LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.picked_up", language); + if (content.length() == 0) { + content = new StringBuilder("geyser.statistics.none"); + } - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof PickupItemStatistic) { - String item = ItemRegistry.ITEM_ENTRIES.get(((PickupItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language) + ": " + entry.getValue() + "\n"); - } - } - break; - case 6: - title = LocaleUtils.getLocaleString("stat.itemsButton", language) + " - " + LocaleUtils.getLocaleString("stat_type.minecraft.dropped", language); - - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof DropItemStatistic) { - String item = ItemRegistry.ITEM_ENTRIES.get(((DropItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language) + ": " + entry.getValue() + "\n"); - } - } - break; - case 7: - title = LocaleUtils.getLocaleString("stat.mobsButton", language) + " - " + LanguageUtils.getPlayerLocaleString("geyser.statistics.killed", language); - - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof KillEntityStatistic) { - String mob = LocaleUtils.getLocaleString("entity.minecraft." + MagicValues.key(EntityType.class, ((KillEntityStatistic) entry.getKey()).getId()).name().toLowerCase(), language); - content.append(mob + ": " + entry.getValue() + "\n"); - } - } - break; - case 8: - title = LocaleUtils.getLocaleString("stat.mobsButton", language) + " - " + LanguageUtils.getPlayerLocaleString("geyser.statistics.killed_by", language); - - for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof KilledByEntityStatistic) { - String mob = LocaleUtils.getLocaleString("entity.minecraft." + MagicValues.key(EntityType.class, ((KilledByEntityStatistic) entry.getKey()).getId()).name().toLowerCase(), language); - content.append(mob + ": " + entry.getValue() + "\n"); - } - } - break; - default: - return false; - } - - if (content.length() == 0) { - content = new StringBuilder(LanguageUtils.getPlayerLocaleString("geyser.statistics.none", language)); - } - - SimpleFormWindow window = new SimpleFormWindow(title, content.toString()); - window.getButtons().add(new FormButton(LocaleUtils.getLocaleString("gui.back", language))); - session.sendForm(window, STATISTICS_LIST_FORM_ID); - } - - return true; - } - - /** - * Handle the list form response - * - * @param session The session that sent the response - * @param response The response string to parse - * @return True if the form was parsed correctly, false if not - */ - public static boolean handleListForm(GeyserSession session, String response) { - SimpleFormWindow listForm = (SimpleFormWindow) session.getWindowCache().getWindows().get(STATISTICS_LIST_FORM_ID); - listForm.setResponse(response); - - if (!listForm.isClosed()) { - session.sendForm(buildMenuForm(session), STATISTICS_MENU_FORM_ID); - } - - return true; + session.sendForm( + builder.content(content.toString()) + .button("gui.back") + .responseHandler((form1, responseData1) -> { + SimpleFormResponse response1 = form.parseResponse(responseData1); + if (response1.isCorrect()) { + buildAndSendStatisticsMenu(session); + } + })); + })); } /** * Finds the item translation key from the Java locale. - * - * @param item the namespaced item to search for. + * + * @param item the namespaced item to search for. * @param language the language to search in * @return the full name of the item */ @@ -230,4 +204,31 @@ public class StatisticsUtils { //todo make Geyser compilable } return translatedItem; } + + private static String translate(String keys, String locale) { + Matcher matcher = CONTENT_PATTERN.matcher(keys); + + StringBuffer buffer = new StringBuffer(); + while (matcher.find()) { + String group = matcher.group(); + matcher.appendReplacement(buffer, translateEntry(group.substring(0, group.length() - 1), locale) + ":"); + } + + if (buffer.length() != 0) { + return matcher.appendTail(buffer).toString(); + } + + String[] keySplitted = keys.split(" - "); + for (int i = 0; i < keySplitted.length; i++) { + keySplitted[i] = translateEntry(keySplitted[i], locale); + } + return String.join(" - ", keySplitted); + } + + private static String translateEntry(String key, String locale) { + if (key.startsWith("geyser.")) { + return LanguageUtils.getPlayerLocaleString(key, locale); + } + return LocaleUtils.getLocaleString(key, locale); + } } From a70d3e2150e8b50c3fd2b74710d6e8fa504a6d07 Mon Sep 17 00:00:00 2001 From: circuit10 Date: Fri, 20 Nov 2020 19:56:39 +0000 Subject: [PATCH 013/766] Fix inconsistencies with movement and position (#699) Movement is now significant better, especially on slabs, stairs, and other half-blocks. Co-authored-by: RednedEpic Co-authored-by: DoctorMacc Co-authored-by: Tim203 Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com> --- bootstrap/spigot/pom.xml | 5 + .../platform/spigot/GeyserSpigotPlugin.java | 99 ++++++++- .../world/GeyserSpigotBlockPlaceListener.java | 15 +- .../GeyserSpigot1_12NativeWorldManager.java | 59 +++++ .../manager/GeyserSpigot1_12WorldManager.java | 141 ++++++++++++ .../GeyserSpigotFallbackWorldManager.java | 62 ++++++ .../GeyserSpigotLegacyNativeWorldManager.java | 79 +++++++ .../GeyserSpigotNativeWorldManager.java | 51 +++++ .../GeyserSpigotWorldManager.java | 118 +++------- connector/pom.xml | 2 + .../geysermc/connector/GeyserConnector.java | 2 + .../configuration/GeyserConfiguration.java | 2 + .../GeyserJacksonConfiguration.java | 3 + .../org/geysermc/connector/entity/Entity.java | 3 +- .../connector/entity/FireworkEntity.java | 1 + .../entity/{ => player}/PlayerEntity.java | 27 ++- .../entity/player/SessionPlayerEntity.java | 67 ++++++ .../connector/entity/type/EntityType.java | 1 + .../network/session/GeyserSession.java | 112 ++++++++-- .../network/session/cache/EntityCache.java | 2 +- .../network/session/cache/TeleportCache.java | 42 +++- .../bedrock/BedrockRespawnTranslator.java | 2 +- ...SetLocalPlayerAsInitializedTranslator.java | 2 +- .../player/BedrockActionTranslator.java | 1 + .../player/BedrockMovePlayerTranslator.java | 163 +++++++++----- .../translators/collision/BoundingBox.java | 52 +++++ .../collision/CollisionManager.java | 208 ++++++++++++++++++ .../collision/CollisionRemapper.java | 57 +++++ .../collision/CollisionTranslator.java | 192 ++++++++++++++++ .../collision/translators/BlockCollision.java | 154 +++++++++++++ .../collision/translators/DoorCollision.java | 92 ++++++++ .../collision/translators/EmptyCollision.java | 35 +++ .../translators/GrassPathCollision.java | 49 +++++ .../collision/translators/OtherCollision.java | 53 +++++ .../translators/ScaffoldingCollision.java | 72 ++++++ .../collision/translators/SnowCollision.java | 103 +++++++++ .../collision/translators/SolidCollision.java | 39 ++++ .../translators/TrapdoorCollision.java | 105 +++++++++ .../java/JavaJoinGameTranslator.java | 2 +- .../entity/JavaEntityEffectTranslator.java | 8 +- .../JavaEntityRemoveEffectTranslator.java | 8 +- .../player/JavaPlayerAbilitiesTranslator.java | 10 +- .../player/JavaPlayerListEntryTranslator.java | 2 +- .../JavaPlayerPositionRotationTranslator.java | 16 +- .../spawn/JavaSpawnPlayerTranslator.java | 2 +- .../world/JavaNotifyClientTranslator.java | 2 +- .../world/block/BlockTranslator.java | 8 + .../geysermc/connector/utils/BlockUtils.java | 4 +- .../connector/utils/DimensionUtils.java | 4 +- .../geysermc/connector/utils/SkinUtils.java | 2 +- connector/src/main/resources/config.yml | 21 +- connector/src/main/resources/languages | 2 +- connector/src/main/resources/mappings | 2 +- 53 files changed, 2117 insertions(+), 248 deletions(-) create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java rename bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/{ => manager}/GeyserSpigotWorldManager.java (59%) rename connector/src/main/java/org/geysermc/connector/entity/{ => player}/PlayerEntity.java (94%) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/EmptyCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/GrassPathCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index f3b9cf88d..adaa7557f 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -29,6 +29,11 @@ 3.2.0 provided + + org.geysermc.adapters + spigot-all + 1.0-SNAPSHOT + ${outputName}-Spigot diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index 741763ec1..39d4f993b 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -25,8 +25,10 @@ package org.geysermc.platform.spigot; +import com.github.steveice10.mc.protocol.MinecraftConstants; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; +import org.geysermc.adapters.spigot.SpigotAdapters; import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; @@ -42,18 +44,23 @@ import org.geysermc.platform.spigot.command.GeyserSpigotCommandExecutor; import org.geysermc.platform.spigot.command.GeyserSpigotCommandManager; import org.geysermc.platform.spigot.command.SpigotCommandSender; import org.geysermc.platform.spigot.world.GeyserSpigotBlockPlaceListener; -import org.geysermc.platform.spigot.world.GeyserSpigotWorldManager; +import org.geysermc.platform.spigot.world.manager.*; +import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.Via; +import us.myles.ViaVersion.api.data.MappingData; +import us.myles.ViaVersion.api.protocol.Protocol; +import us.myles.ViaVersion.api.protocol.ProtocolRegistry; +import us.myles.ViaVersion.api.protocol.ProtocolVersion; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.List; import java.util.UUID; import java.util.logging.Level; public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { - private GeyserSpigotCommandManager geyserCommandManager; private GeyserSpigotConfiguration geyserConfig; private GeyserSpigotLogger geyserLogger; @@ -142,8 +149,48 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // Set if we need to use a different method for getting a player's locale SpigotCommandSender.setUseLegacyLocaleMethod(!isCompatible(Bukkit.getServer().getVersion(), "1.12.0")); - this.geyserWorldManager = new GeyserSpigotWorldManager(isLegacy, use3dBiomes, isViaVersion); - GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(connector, isLegacy, isViaVersion); + if (connector.getConfig().isUseAdapters()) { + try { + String name = Bukkit.getServer().getClass().getPackage().getName(); + String nmsVersion = name.substring(name.lastIndexOf('.') + 1); + SpigotAdapters.registerWorldAdapter(nmsVersion); + if (isViaVersion && isViaVersionNeeded()) { + if (isLegacy) { + // Pre-1.13 + this.geyserWorldManager = new GeyserSpigot1_12NativeWorldManager(); + } else { + // Post-1.13 + this.geyserWorldManager = new GeyserSpigotLegacyNativeWorldManager(this, use3dBiomes); + } + } else { + // No ViaVersion + this.geyserWorldManager = new GeyserSpigotNativeWorldManager(use3dBiomes); + } + geyserLogger.debug("Using NMS adapter: " + this.geyserWorldManager.getClass() + ", " + nmsVersion); + } catch (Exception e) { + if (geyserConfig.isDebugMode()) { + geyserLogger.debug("Error while attempting to find NMS adapter. Most likely, this can be safely ignored. :)"); + e.printStackTrace(); + } + } + } else { + geyserLogger.debug("Not using NMS adapter as it is disabled in the config."); + } + if (this.geyserWorldManager == null) { + // No NMS adapter + if (isLegacy && isViaVersion) { + // Use ViaVersion for converting pre-1.13 block states + this.geyserWorldManager = new GeyserSpigot1_12WorldManager(); + } else if (isLegacy) { + // Not sure how this happens - without ViaVersion, we don't know any block states, so just assume everything is air + this.geyserWorldManager = new GeyserSpigotFallbackWorldManager(); + } else { + // Post-1.13 + this.geyserWorldManager = new GeyserSpigotWorldManager(use3dBiomes); + } + geyserLogger.debug("Using default world manager: " + this.geyserWorldManager.getClass()); + } + GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(connector, this.geyserWorldManager); Bukkit.getServer().getPluginManager().registerEvents(blockPlaceListener, this); @@ -152,8 +199,9 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { @Override public void onDisable() { - if (connector != null) + if (connector != null) { connector.shutdown(); + } } @Override @@ -186,6 +234,11 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { return getDataFolder().toPath(); } + @Override + public BootstrapDumpInfo getDumpInfo() { + return new GeyserSpigotDumpInfo(); + } + public boolean isCompatible(String version, String whichVersion) { int[] currentVersion = parseVersion(version); int[] otherVersion = parseVersion(whichVersion); @@ -213,15 +266,43 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { String t = stringArray[index].replaceAll("\\D", ""); try { temp[index] = Integer.parseInt(t); - } catch(NumberFormatException ex) { + } catch (NumberFormatException ex) { temp[index] = 0; } } return temp; } - @Override - public BootstrapDumpInfo getDumpInfo() { - return new GeyserSpigotDumpInfo(); + /** + * @return the server version before ViaVersion finishes initializing + */ + public ProtocolVersion getServerProtocolVersion() { + String bukkitVersion = Bukkit.getServer().getVersion(); + // Turn "(MC: 1.16.4)" into 1.16.4. + String version = bukkitVersion.split("\\(MC: ")[1].split("\\)")[0]; + return ProtocolVersion.getClosest(version); + } + + /** + * This function should not run unless ViaVersion is installed on the server. + * + * @return true if there is any block mappings difference between the server and client. + */ + private boolean isViaVersionNeeded() { + ProtocolVersion serverVersion = getServerProtocolVersion(); + List> protocolList = ProtocolRegistry.getProtocolPath(MinecraftConstants.PROTOCOL_VERSION, + serverVersion.getVersion()); + if (protocolList == null) { + // No translation needed! + return false; + } + for (int i = protocolList.size() - 1; i >= 0; i--) { + MappingData mappingData = protocolList.get(i).getValue().getMappingData(); + if (mappingData != null) { + return true; + } + } + // All mapping data is null, which means client and server block states are the same + return false; } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index cb59e202b..55a368be4 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -36,13 +36,13 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockTranslator; +import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; @AllArgsConstructor public class GeyserSpigotBlockPlaceListener implements Listener { private final GeyserConnector connector; - private final boolean isLegacy; - private final boolean isViaVersion; + private final GeyserSpigotWorldManager worldManager; @EventHandler public void place(final BlockPlaceEvent event) { @@ -52,14 +52,13 @@ public class GeyserSpigotBlockPlaceListener implements Listener { placeBlockSoundPacket.setSound(SoundEvent.PLACE); placeBlockSoundPacket.setPosition(Vector3f.from(event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ())); placeBlockSoundPacket.setBabySound(false); - String javaBlockId; - if (isLegacy) { - javaBlockId = BlockTranslator.getJavaIdBlockMap().inverse().get(GeyserSpigotWorldManager.getLegacyBlock(session, - event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ(), isViaVersion)); + if (worldManager.isLegacy()) { + placeBlockSoundPacket.setExtraData(BlockTranslator.getBedrockBlockId(worldManager.getBlockAt(session, + event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ()))); } else { - javaBlockId = event.getBlockPlaced().getBlockData().getAsString(); + String javaBlockId = event.getBlockPlaced().getBlockData().getAsString(); + placeBlockSoundPacket.setExtraData(BlockTranslator.getBedrockBlockId(BlockTranslator.getJavaIdBlockMap().getOrDefault(javaBlockId, BlockTranslator.JAVA_AIR_ID))); } - placeBlockSoundPacket.setExtraData(BlockTranslator.getBedrockBlockId(BlockTranslator.getJavaIdBlockMap().getOrDefault(javaBlockId, 0))); placeBlockSoundPacket.setIdentifier(":"); session.sendUpstreamPacket(placeBlockSoundPacket); session.setLastBlockPlacePosition(null); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java new file mode 100644 index 000000000..f58b75cdd --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019-2020 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.platform.spigot.world.manager; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.geysermc.adapters.spigot.SpigotAdapters; +import org.geysermc.adapters.spigot.SpigotWorldAdapter; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.world.block.BlockTranslator; +import us.myles.ViaVersion.api.Via; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage; + +/** + * Used with ViaVersion and pre-1.13. + */ +public class GeyserSpigot1_12NativeWorldManager extends GeyserSpigot1_12WorldManager { + private final SpigotWorldAdapter adapter; + + public GeyserSpigot1_12NativeWorldManager() { + this.adapter = SpigotAdapters.getWorldAdapter(); + // Unlike post-1.13, we can't build up a cache of block states, because block entities need some special conversion + } + + @Override + public int getBlockAt(GeyserSession session, int x, int y, int z) { + Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); + if (player == null) { + return BlockTranslator.JAVA_AIR_ID; + } + // Get block entity storage + BlockStorage storage = Via.getManager().getConnection(player.getUniqueId()).get(BlockStorage.class); + int blockId = adapter.getBlockAt(player.getWorld(), x, y, z); + return getLegacyBlock(storage, blockId, x, y, z); + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java new file mode 100644 index 000000000..b00ddafaa --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2019-2020 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.platform.spigot.world.manager; + +import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.world.block.BlockTranslator; +import us.myles.ViaVersion.api.Pair; +import us.myles.ViaVersion.api.Via; +import us.myles.ViaVersion.api.data.MappingData; +import us.myles.ViaVersion.api.minecraft.Position; +import us.myles.ViaVersion.api.protocol.Protocol; +import us.myles.ViaVersion.api.protocol.ProtocolRegistry; +import us.myles.ViaVersion.api.protocol.ProtocolVersion; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; +import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage; + +import java.util.List; + +/** + * Should be used when ViaVersion is present, no NMS adapter is being used, and we are pre-1.13. + * + * You need ViaVersion to connect to an older server with the Geyser-Spigot plugin. + */ +public class GeyserSpigot1_12WorldManager extends GeyserSpigotWorldManager { + /** + * Specific mapping data for 1.12 to 1.13. Used to convert the 1.12 block into the 1.13 block state. + * (Block IDs did not change between server versions until 1.13 and after) + */ + private final MappingData mappingData1_12to1_13; + + /** + * The list of all protocols from the client's version to 1.13. + */ + private final List> protocolList; + + public GeyserSpigot1_12WorldManager() { + super(false); + this.mappingData1_12to1_13 = ProtocolRegistry.getProtocol(Protocol1_13To1_12_2.class).getMappingData(); + this.protocolList = ProtocolRegistry.getProtocolPath(CLIENT_PROTOCOL_VERSION, + ProtocolVersion.v1_13.getVersion()); + } + + @Override + @SuppressWarnings("deprecation") + public int getBlockAt(GeyserSession session, int x, int y, int z) { + Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); + if (player == null) { + return BlockTranslator.JAVA_AIR_ID; + } + // Get block entity storage + BlockStorage storage = Via.getManager().getConnection(player.getUniqueId()).get(BlockStorage.class); + Block block = player.getWorld().getBlockAt(x, y, z); + // Black magic that gets the old block state ID + int blockId = (block.getType().getId() << 4) | (block.getData() & 0xF); + return getLegacyBlock(storage, blockId, x, y, z); + } + + /** + * + * @param storage ViaVersion's block entity storage (used to fix block entity state differences) + * @param blockId the pre-1.13 block id + * @param x X coordinate of block + * @param y Y coordinate of block + * @param z Z coordinate of block + * @return the block state updated to the latest Minecraft version + */ + @SuppressWarnings("deprecation") + public int getLegacyBlock(BlockStorage storage, int blockId, int x, int y, int z) { + // Convert block state from old version (1.12.2) -> 1.13 -> 1.13.1 -> 1.14 -> 1.15 -> 1.16 -> 1.16.2 + blockId = mappingData1_12to1_13.getNewBlockId(blockId); + // Translate block entity differences - some information was stored in block tags and not block states + if (storage.isWelcome(blockId)) { // No getOrDefault method + BlockStorage.ReplacementData data = storage.get(new Position(x, (short) y, z)); + if (data != null && data.getReplacement() != -1) { + blockId = data.getReplacement(); + } + } + for (int i = protocolList.size() - 1; i >= 0; i--) { + MappingData mappingData = protocolList.get(i).getValue().getMappingData(); + if (mappingData != null) { + blockId = mappingData.getNewBlockStateId(blockId); + } + } + return blockId; + } + + @SuppressWarnings("deprecation") + @Override + public void getBlocksInSection(GeyserSession session, int x, int y, int z, Chunk chunk) { + Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); + if (player == null) { + return; + } + World world = player.getWorld(); + // Get block entity storage + BlockStorage storage = Via.getManager().getConnection(player.getUniqueId()).get(BlockStorage.class); + for (int blockY = 0; blockY < 16; blockY++) { // Cache-friendly iteration order + for (int blockZ = 0; blockZ < 16; blockZ++) { + for (int blockX = 0; blockX < 16; blockX++) { + Block block = world.getBlockAt(x, y, z); + // Black magic that gets the old block state ID + int blockId = (block.getType().getId() << 4) | (block.getData() & 0xF); + chunk.set(blockX, blockY, blockZ, getLegacyBlock(storage, blockId, (x << 4) + blockX, (y << 4) + blockY, (z << 4) + blockZ)); + } + } + } + } + + @Override + public boolean isLegacy() { + return true; + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java new file mode 100644 index 000000000..49c675a1d --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2020 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.platform.spigot.world.manager; + +import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.world.block.BlockTranslator; + +/** + * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)} + * cannot be accurate. Typically, this is when ViaVersion is not installed but a client still manages to connect. + * If this occurs to you somehow, please let us know!! + */ +public class GeyserSpigotFallbackWorldManager extends GeyserSpigotWorldManager { + public GeyserSpigotFallbackWorldManager() { + // Since this is pre-1.13 (and thus pre-1.15), there will never be 3D biomes. + super(false); + } + + @Override + public int getBlockAt(GeyserSession session, int x, int y, int z) { + return BlockTranslator.JAVA_AIR_ID; + } + + @Override + public void getBlocksInSection(GeyserSession session, int x, int y, int z, Chunk chunk) { + // Do nothing, since we can't do anything with the chunk + } + + @Override + public boolean hasMoreBlockDataThanChunkCache() { + return false; + } + + @Override + public boolean isLegacy() { + return true; + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java new file mode 100644 index 000000000..dec9b4141 --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2019-2020 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.platform.spigot.world.manager; + +import com.github.steveice10.mc.protocol.MinecraftConstants; +import it.unimi.dsi.fastutil.ints.Int2IntMap; +import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntList; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.platform.spigot.GeyserSpigotPlugin; +import us.myles.ViaVersion.api.Pair; +import us.myles.ViaVersion.api.data.MappingData; +import us.myles.ViaVersion.api.protocol.Protocol; +import us.myles.ViaVersion.api.protocol.ProtocolRegistry; +import us.myles.ViaVersion.api.protocol.ProtocolVersion; + +import java.util.List; + +/** + * Used when block IDs need to be translated to the latest version + */ +public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorldManager { + + private final Int2IntMap oldToNewBlockId; + + public GeyserSpigotLegacyNativeWorldManager(GeyserSpigotPlugin plugin, boolean use3dBiomes) { + super(use3dBiomes); + IntList allBlockStates = adapter.getAllBlockStates(); + oldToNewBlockId = new Int2IntOpenHashMap(allBlockStates.size()); + ProtocolVersion serverVersion = plugin.getServerProtocolVersion(); + List> protocolList = ProtocolRegistry.getProtocolPath(MinecraftConstants.PROTOCOL_VERSION, + serverVersion.getVersion()); + for (int oldBlockId : allBlockStates) { + int newBlockId = oldBlockId; + // protocolList should *not* be null; we checked for that before initializing this class + for (int i = protocolList.size() - 1; i >= 0; i--) { + MappingData mappingData = protocolList.get(i).getValue().getMappingData(); + if (mappingData != null) { + newBlockId = mappingData.getNewBlockStateId(newBlockId); + } + } + oldToNewBlockId.put(oldBlockId, newBlockId); + } + } + + @Override + public int getBlockAt(GeyserSession session, int x, int y, int z) { + int nativeBlockId = super.getBlockAt(session, x, y, z); + return oldToNewBlockId.getOrDefault(nativeBlockId, nativeBlockId); + } + + @Override + public boolean isLegacy() { + return true; + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java new file mode 100644 index 000000000..f703ecdb5 --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019-2020 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.platform.spigot.world.manager; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.geysermc.adapters.spigot.SpigotAdapters; +import org.geysermc.adapters.spigot.SpigotWorldAdapter; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.world.block.BlockTranslator; + +public class GeyserSpigotNativeWorldManager extends GeyserSpigotWorldManager { + protected final SpigotWorldAdapter adapter; + + public GeyserSpigotNativeWorldManager(boolean use3dBiomes) { + super(use3dBiomes); + adapter = SpigotAdapters.getWorldAdapter(); + } + + @Override + public int getBlockAt(GeyserSession session, int x, int y, int z) { + Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); + if (player == null) { + return BlockTranslator.JAVA_AIR_ID; + } + return adapter.getBlockAt(player.getWorld(), x, y, z); + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java similarity index 59% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotWorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 3493fc25a..cd1774baf 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world; +package org.geysermc.platform.spigot.world.manager; import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.protocol.MinecraftConstants; @@ -34,6 +34,7 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; import org.bukkit.entity.Player; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; @@ -42,38 +43,22 @@ import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.GameRule; import org.geysermc.connector.utils.LanguageUtils; -import us.myles.ViaVersion.api.Pair; -import us.myles.ViaVersion.api.Via; -import us.myles.ViaVersion.api.data.MappingData; -import us.myles.ViaVersion.api.minecraft.Position; -import us.myles.ViaVersion.api.protocol.Protocol; -import us.myles.ViaVersion.api.protocol.ProtocolRegistry; -import us.myles.ViaVersion.api.protocol.ProtocolVersion; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; -import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import java.io.InputStream; -import java.util.List; +/** + * The base world manager to use when there is no supported NMS revision + */ public class GeyserSpigotWorldManager extends GeyserWorldManager { /** * The current client protocol version for ViaVersion usage. */ - private static final int CLIENT_PROTOCOL_VERSION = MinecraftConstants.PROTOCOL_VERSION; + protected static final int CLIENT_PROTOCOL_VERSION = MinecraftConstants.PROTOCOL_VERSION; - /** - * Whether the server is pre-1.13. - */ - private final boolean isLegacy; /** * Whether the server is pre-1.16 and therefore does not support 3D biomes on an API level guaranteed. */ private final boolean use3dBiomes; - /** - * You need ViaVersion to connect to an older server with Geyser. - * However, we still check for ViaVersion in case there's some other way that gets Geyser on a pre-1.13 Bukkit server - */ - private final boolean isViaVersion; /** * Stores a list of {@link Biome} ordinal numbers to Minecraft biome numeric IDs. * @@ -87,10 +72,8 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { */ private final Int2IntMap biomeToIdMap = new Int2IntOpenHashMap(Biome.values().length); - public GeyserSpigotWorldManager(boolean isLegacy, boolean use3dBiomes, boolean isViaVersion) { - this.isLegacy = isLegacy; + public GeyserSpigotWorldManager(boolean use3dBiomes) { this.use3dBiomes = use3dBiomes; - this.isViaVersion = isViaVersion; // Load the values into the biome-to-ID map InputStream biomeStream = FileUtils.getResource("biomes.json"); @@ -116,83 +99,26 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { @Override public int getBlockAt(GeyserSession session, int x, int y, int z) { Player bukkitPlayer; - if ((this.isLegacy && !this.isViaVersion) - || session.getPlayerEntity() == null - || (bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) { + if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) { return BlockTranslator.JAVA_AIR_ID; } World world = bukkitPlayer.getWorld(); - if (isLegacy) { - return getLegacyBlock(session, x, y, z, true); - } - //TODO possibly: detect server version for all versions and use ViaVersion for block state mappings like below - return BlockTranslator.getJavaIdBlockMap().getOrDefault(world.getBlockAt(x, y, z).getBlockData().getAsString(), 0); - } - - public static int getLegacyBlock(GeyserSession session, int x, int y, int z, boolean isViaVersion) { - if (isViaVersion) { - Player bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); - // Get block entity storage - BlockStorage storage = Via.getManager().getConnection(bukkitPlayer.getUniqueId()).get(BlockStorage.class); - return getLegacyBlock(storage, bukkitPlayer.getWorld(), x, y, z); - } else { - return BlockTranslator.JAVA_AIR_ID; - } - } - - @SuppressWarnings("deprecation") - public static int getLegacyBlock(BlockStorage storage, World world, int x, int y, int z) { - Block block = world.getBlockAt(x, y, z); - // Black magic that gets the old block state ID - int blockId = (block.getType().getId() << 4) | (block.getData() & 0xF); - // Convert block state from old version (1.12.2) -> 1.13 -> 1.13.1 -> 1.14 -> 1.15 -> 1.16 -> 1.16.2 - blockId = ProtocolRegistry.getProtocol(Protocol1_13To1_12_2.class).getMappingData().getNewBlockId(blockId); - List> protocolList = ProtocolRegistry.getProtocolPath(CLIENT_PROTOCOL_VERSION, - ProtocolVersion.v1_13.getId()); - // Translate block entity differences - some information was stored in block tags and not block states - if (storage.isWelcome(blockId)) { // No getOrDefault method - BlockStorage.ReplacementData data = storage.get(new Position(x, (short) y, z)); - if (data != null && data.getReplacement() != -1) { - blockId = data.getReplacement(); - } - } - for (int i = protocolList.size() - 1; i >= 0; i--) { - MappingData mappingData = protocolList.get(i).getValue().getMappingData(); - if (mappingData != null) { - blockId = mappingData.getNewBlockStateId(blockId); - } - } - return blockId; + return BlockTranslator.getJavaIdBlockMap().getOrDefault(world.getBlockAt(x, y, z).getBlockData().getAsString(), BlockTranslator.JAVA_AIR_ID); } @Override public void getBlocksInSection(GeyserSession session, int x, int y, int z, Chunk chunk) { Player bukkitPlayer; - if ((this.isLegacy && !this.isViaVersion) - || session.getPlayerEntity() == null - || (bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) { + if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) { return; } World world = bukkitPlayer.getWorld(); - if (this.isLegacy) { - // Get block entity storage - BlockStorage storage = Via.getManager().getConnection(bukkitPlayer.getUniqueId()).get(BlockStorage.class); - for (int blockY = 0; blockY < 16; blockY++) { // Cache-friendly iteration order - for (int blockZ = 0; blockZ < 16; blockZ++) { - for (int blockX = 0; blockX < 16; blockX++) { - chunk.set(blockX, blockY, blockZ, getLegacyBlock(storage, world, (x << 4) + blockX, (y << 4) + blockY, (z << 4) + blockZ)); - } - } - } - } else { - //TODO: see above TODO in getBlockAt - for (int blockY = 0; blockY < 16; blockY++) { // Cache-friendly iteration order - for (int blockZ = 0; blockZ < 16; blockZ++) { - for (int blockX = 0; blockX < 16; blockX++) { - Block block = world.getBlockAt((x << 4) + blockX, (y << 4) + blockY, (z << 4) + blockZ); - int id = BlockTranslator.getJavaIdBlockMap().getOrDefault(block.getBlockData().getAsString(), BlockTranslator.JAVA_AIR_ID); - chunk.set(blockX, blockY, blockZ, id); - } + for (int blockY = 0; blockY < 16; blockY++) { // Cache-friendly iteration order + for (int blockZ = 0; blockZ < 16; blockZ++) { + for (int blockX = 0; blockX < 16; blockX++) { + Block block = world.getBlockAt((x << 4) + blockX, (y << 4) + blockY, (z << 4) + blockZ); + int id = BlockTranslator.getJavaIdBlockMap().getOrDefault(block.getBlockData().getAsString(), BlockTranslator.JAVA_AIR_ID); + chunk.set(blockX, blockY, blockZ, id); } } } @@ -254,4 +180,16 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { public boolean hasPermission(GeyserSession session, String permission) { return Bukkit.getPlayer(session.getPlayerEntity().getUsername()).hasPermission(permission); } + + /** + * This must be set to true if we are pre-1.13, and {@link BlockData#getAsString() does not exist}. + * + * This should be set to true if we are post-1.13 but before the latest version, and we should convert the old block state id + * to the current one. + * + * @return whether there is a difference between client block state and server block state that requires extra processing + */ + public boolean isLegacy() { + return false; + } } diff --git a/connector/pom.xml b/connector/pom.xml index 95794ff25..d7017b0d8 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -257,6 +257,8 @@ - - - - - - - org.reflections - reflections - 0.9.11 - - - org.dom4j - dom4j - 2.1.3 - - - org.codehaus.groovy - groovy-all - 3.0.5 - runtime - pom - - - org.apache.maven.plugins maven-surefire-plugin diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 291f2d7e5..173e41573 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -524,18 +524,6 @@ public class GeyserConnector { return !"DEV".equals(GeyserConnector.VERSION); } - /** - * Whether to use XML reflections in the jar or manually find the reflections. - * Will return true if in production and the platform is not Fabric. - * On Fabric - it complains about being unable to create a default XMLReader. - * On other platforms this should only be true in compiled jars. - * - * @return whether to use XML reflections - */ - public boolean useXmlReflections() { - return !this.getPlatformType().equals(PlatformType.FABRIC) && isProductionEnvironment(); - } - public static GeyserConnector getInstance() { return instance; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 2469f65da..20c40a785 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -35,7 +35,6 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LanguageUtils; -import org.reflections.Reflections; import java.util.HashMap; import java.util.Map; @@ -49,9 +48,7 @@ public class PacketTranslatorRegistry { private static final ObjectArrayList> IGNORED_PACKETS = new ObjectArrayList<>(); static { - Reflections ref = GeyserConnector.getInstance().useXmlReflections() ? FileUtils.getReflections("org.geysermc.connector.network.translators") : new Reflections("org.geysermc.connector.network.translators"); - - for (Class clazz : ref.getTypesAnnotatedWith(Translator.class)) { + for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(Translator.class)) { Class packet = clazz.getAnnotation(Translator.class).packet(); GeyserConnector.getInstance().getLogger().debug("Found annotated translator: " + clazz.getCanonicalName() + " : " + packet.getSimpleName()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index c4d098f79..0fdfc3cc7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -43,7 +43,6 @@ import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.registry.type.ItemMappings; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LocaleUtils; -import org.reflections.Reflections; import java.util.*; import java.util.stream.Collectors; @@ -61,10 +60,8 @@ public abstract class ItemTranslator { static { /* Load item translators */ - Reflections ref = GeyserConnector.getInstance().useXmlReflections() ? FileUtils.getReflections("org.geysermc.connector.network.translators.item") : new Reflections("org.geysermc.connector.network.translators.item"); - Map loadedNbtItemTranslators = new HashMap<>(); - for (Class clazz : ref.getTypesAnnotatedWith(ItemRemapper.class)) { + for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(ItemRemapper.class)) { int priority = clazz.getAnnotation(ItemRemapper.class).priority(); GeyserConnector.getInstance().getLogger().debug("Found annotated item translator: " + clazz.getCanonicalName()); diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 6a0498a79..bd6520b38 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -55,9 +55,9 @@ import java.util.Set; public class Registries { public static final SimpleRegistry BIOMES = SimpleRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT); - public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity", BlockEntityRegistryLoader::new); + public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); - public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.connector.network.translators.collision.translators", "mappings/collision.json"), CollisionRegistryLoader::new); + public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.connector.network.translators.collision.translators.Translator", "mappings/collision.json"), CollisionRegistryLoader::new); public static final VersionedRegistry>> CRAFTING_DATA = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); @@ -77,7 +77,7 @@ public class Registries { public static final SimpleMappedRegistry SOUND_EFFECTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEffectsRegistryLoader::new); - public static final SimpleMappedRegistry> SOUND_HANDLERS = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.sound", SoundHandlerRegistryLoader::new); + public static final SimpleMappedRegistry> SOUND_HANDLERS = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.sound.SoundHandler", SoundHandlerRegistryLoader::new); public static void init() { // no-op diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java index 4f6354af5..9f93b3873 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java @@ -26,9 +26,7 @@ package org.geysermc.connector.registry.loader; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.utils.FileUtils; -import org.reflections.Reflections; import java.lang.annotation.Annotation; import java.util.Map; @@ -46,8 +44,7 @@ public class AnnotatedRegistryLoader implements Regi @Override public Map load(String input) { Map entries = new Object2ObjectOpenHashMap<>(); - Reflections ref = GeyserConnector.getInstance().useXmlReflections() ? FileUtils.getReflections(input) : new Reflections(input); - for (Class clazz : ref.getTypesAnnotatedWith(this.annotation)) { + for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(input)) { try { entries.put(this.mapper.apply(clazz.getAnnotation(this.annotation)), (V) clazz.newInstance()); } catch (InstantiationException | IllegalAccessException ex) { diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java index 70ba8b253..b20e1fe0e 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java @@ -40,7 +40,6 @@ import org.geysermc.connector.network.translators.collision.translators.OtherCol import org.geysermc.connector.network.translators.collision.translators.SolidCollision; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.FileUtils; -import org.reflections.Reflections; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; @@ -55,8 +54,7 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader collisions = new Int2ObjectOpenHashMap<>(); Map, CollisionInfo> annotationMap = new HashMap<>(); - Reflections ref = GeyserConnector.getInstance().useXmlReflections() ? FileUtils.getReflections(input.key()) : new Reflections(input.key()); - for (Class clazz : ref.getTypesAnnotatedWith(CollisionRemapper.class)) { + for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(CollisionRemapper.class.getName())) { GeyserConnector.getInstance().getLogger().debug("Found annotated collision translator: " + clazz.getCanonicalName()); CollisionRemapper collisionRemapper = clazz.getAnnotation(CollisionRemapper.class); diff --git a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java index 3fb5c2ebb..3369f16a5 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java @@ -30,16 +30,15 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import org.geysermc.connector.GeyserConnector; -import org.reflections.Reflections; -import org.reflections.serializers.XmlSerializer; -import org.reflections.util.ConfigurationBuilder; import java.io.*; -import java.net.URL; +import java.lang.annotation.Annotation; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.MessageDigest; +import java.util.Set; import java.util.function.Function; +import java.util.stream.Collectors; public class FileUtils { @@ -193,24 +192,6 @@ public class FileUtils { return sha1; } - /** - * Get the stored reflection data for a given path - * - * @param path The path to get the reflection data for - * @return The created Reflections object - */ - public static Reflections getReflections(String path) { - Reflections reflections = new Reflections(new ConfigurationBuilder().setScanners()); - XmlSerializer serializer = new XmlSerializer(); - URL resource = FileUtils.class.getClassLoader().getResource("META-INF/reflections/" + path + "-reflections.xml"); - try (InputStream inputStream = resource.openConnection().getInputStream()) { - reflections.merge(serializer.read(inputStream)); - } catch (IOException ignored) { - } - - return reflections; - } - /** * An android compatible version of {@link Files#readAllBytes} * @@ -242,4 +223,41 @@ public class FileUtils { throw new RuntimeException("Error while trying to read input stream!"); } } + + /** + * Returns a set of all the classes that are annotated by a given annotation. + * Keep in mind that these are from a set of generated annotations generated + * at compile time by the annotation processor, meaning that arbitrary annotations + * cannot be passed into this method and expected to have a set of classes + * returned back. + * + * @param annotationClass the annotation class + * @return a set of all the classes annotated by the given annotation + */ + public static Set> getGeneratedClassesForAnnotation(Class annotationClass) { + return getGeneratedClassesForAnnotation(annotationClass.getName()); + } + + /** + * Returns a set of all the classes that are annotated by a given annotation. + * Keep in mind that these are from a set of generated annotations generated + * at compile time by the annotation processor, meaning that arbitrary annotations + * cannot be passed into this method and expected to have a set of classes + * returned back. + * + * @param input the fully qualified name of the annotation + * @return a set of all the classes annotated by the given annotation + */ + public static Set> getGeneratedClassesForAnnotation(String input) { + InputStream annotatedClass = FileUtils.getResource(input); + BufferedReader reader = new BufferedReader(new InputStreamReader(annotatedClass)); + return reader.lines().map(className -> { + try { + return Class.forName(className); + } catch (ClassNotFoundException ex) { + GeyserConnector.getInstance().getLogger().error("Failed to find class " + className, ex); + throw new RuntimeException(ex); + } + }).collect(Collectors.toSet()); + } } diff --git a/connector/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/connector/src/main/resources/META-INF/services/javax.annotation.processing.Processor new file mode 100644 index 000000000..463d1efad --- /dev/null +++ b/connector/src/main/resources/META-INF/services/javax.annotation.processing.Processor @@ -0,0 +1,5 @@ +org.geysermc.processor.BlockEntityProcessor +org.geysermc.processor.CollisionRemapperProcessor +org.geysermc.processor.ItemRemapperProcessor +org.geysermc.processor.PacketTranslatorProcessor +org.geysermc.processor.SoundHandlerProcessor \ No newline at end of file diff --git a/pom.xml b/pom.xml index c03efb782..f8ab9165f 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ + ap bootstrap common connector From 697f35f6577f64b9e097d6d99ded58be04f4b0fe Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:09:55 -0400 Subject: [PATCH 489/766] Specify the first and last relevant block runtime IDs for items Improves startup time and processing --- .../populator/ItemRegistryPopulator.java | 74 +++++++++---------- .../registry/type/GeyserMappingItem.java | 5 +- connector/src/main/resources/mappings | 2 +- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 4715b6915..16aa56121 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -49,7 +49,6 @@ import org.geysermc.connector.network.translators.item.StoredItemMappings; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.*; -import org.geysermc.connector.utils.BlockUtils; import org.geysermc.connector.utils.FileUtils; import java.io.ByteArrayInputStream; @@ -268,11 +267,11 @@ public class ItemRegistryPopulator { if (bedrockIdentifier == null) { throw new RuntimeException("Missing Bedrock ID in mappings!: " + bedrockId); } - int stackSize = mappingItem.getStackSize() == null ? 64 : mappingItem.getStackSize(); + int stackSize = mappingItem.getStackSize(); int bedrockBlockId = -1; - Integer blockRuntimeIdNode = entry.getValue().getBlockRuntimeId(); - if (blockRuntimeIdNode != null) { + Integer firstBlockRuntimeId = entry.getValue().getFirstBlockRuntimeId(); + if (firstBlockRuntimeId != null) { int blockIdOverride = bedrockBlockIdOverrides.getOrDefault(bedrockIdentifier, -1); if (blockIdOverride != -1) { // Straight from BDS is our best chance of getting an item that doesn't run into issues @@ -282,52 +281,51 @@ public class ItemRegistryPopulator { int aValidBedrockBlockId = blacklistedIdentifiers.getOrDefault(bedrockIdentifier, -1); if (aValidBedrockBlockId == -1) { // Fallback - bedrockBlockId = blockMappings.getBedrockBlockId(blockRuntimeIdNode); + bedrockBlockId = blockMappings.getBedrockBlockId(firstBlockRuntimeId); } else { // As of 1.16.220, every item requires a block runtime ID attached to it. // This is mostly for identifying different blocks with the same item ID - wool, slabs, some walls. // However, in order for some visuals and crafting to work, we need to send the first matching block state // as indexed by Bedrock's block palette // There are exceptions! But, ideally, the block ID override should take care of those. - String javaBlockIdentifier = BlockRegistries.JAVA_BLOCKS.get(blockRuntimeIdNode).getCleanJavaIdentifier(); NbtMapBuilder requiredBlockStatesBuilder = NbtMap.builder(); String correctBedrockIdentifier = blockMappings.getBedrockBlockStates().get(aValidBedrockBlockId).getString("name"); boolean firstPass = true; - for (Map.Entry blockEntry : BlockRegistries.JAVA_IDENTIFIERS.get().entrySet()) { - String aBlockIdentifier = BlockUtils.getCleanIdentifier(blockEntry.getKey()); - if (aBlockIdentifier.equals(javaBlockIdentifier)) { - int bedrockBlockRuntimeId = blockMappings.getBedrockBlockId(blockEntry.getValue()); - NbtMap blockTag = blockMappings.getBedrockBlockStates().get(bedrockBlockRuntimeId); - String bedrockName = blockTag.getString("name"); - if (!bedrockName.equals(correctBedrockIdentifier)) { - continue; - } - NbtMap states = blockTag.getCompound("states"); + // Block states are all grouped together. In the mappings, we store the first block runtime ID in order, + // and the last, if relevant. We then iterate over all those values and get their Bedrock equivalents + Integer lastBlockRuntimeId = entry.getValue().getLastBlockRuntimeId() == null ? firstBlockRuntimeId : entry.getValue().getLastBlockRuntimeId(); + for (int i = firstBlockRuntimeId; i <= lastBlockRuntimeId; i++) { + int bedrockBlockRuntimeId = blockMappings.getBedrockBlockId(i); + NbtMap blockTag = blockMappings.getBedrockBlockStates().get(bedrockBlockRuntimeId); + String bedrockName = blockTag.getString("name"); + if (!bedrockName.equals(correctBedrockIdentifier)) { + continue; + } + NbtMap states = blockTag.getCompound("states"); - if (firstPass) { - firstPass = false; - if (states.size() == 0) { - // No need to iterate and find all block states - this is the one, as there can't be any others - bedrockBlockId = bedrockBlockRuntimeId; - break; - } - requiredBlockStatesBuilder.putAll(states); - continue; - } - for (Map.Entry nbtEntry : states.entrySet()) { - Object value = requiredBlockStatesBuilder.get(nbtEntry.getKey()); - if (value != null && !nbtEntry.getValue().equals(value)) { // Null means this value has already been removed/deemed as unneeded - // This state can change between different block states, and therefore is not required - // to build a successful block state of this - requiredBlockStatesBuilder.remove(nbtEntry.getKey()); - } - } - if (requiredBlockStatesBuilder.size() == 0) { - // There are no required block states - // E.G. there was only a direction property that is no longer in play - // (States that are important include color for glass) + if (firstPass) { + firstPass = false; + if (states.size() == 0) { + // No need to iterate and find all block states - this is the one, as there can't be any others + bedrockBlockId = bedrockBlockRuntimeId; break; } + requiredBlockStatesBuilder.putAll(states); + continue; + } + for (Map.Entry nbtEntry : states.entrySet()) { + Object value = requiredBlockStatesBuilder.get(nbtEntry.getKey()); + if (value != null && !nbtEntry.getValue().equals(value)) { // Null means this value has already been removed/deemed as unneeded + // This state can change between different block states, and therefore is not required + // to build a successful block state of this + requiredBlockStatesBuilder.remove(nbtEntry.getKey()); + } + } + if (requiredBlockStatesBuilder.size() == 0) { + // There are no required block states + // E.G. there was only a direction property that is no longer in play + // (States that are important include color for glass) + break; } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java b/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java index 9219a8793..da91c412e 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java @@ -35,8 +35,9 @@ import lombok.Data; public class GeyserMappingItem { @JsonProperty("bedrock_identifier") String bedrockIdentifier; @JsonProperty("bedrock_data") int bedrockData; - Integer blockRuntimeId; - @JsonProperty("stack_size") Integer stackSize; + Integer firstBlockRuntimeId; + Integer lastBlockRuntimeId; + @JsonProperty("stack_size") int stackSize = 64; @JsonProperty("tool_type") String toolType; @JsonProperty("tool_tier") String toolTier; } diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 7a67fa9ff..c921aa9b1 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 7a67fa9ff78496f4fc30b8f72d0eff451f1771e2 +Subproject commit c921aa9b12c2a1a471ef5f00aa040924426641dc From 2766038db92d2d171d914d2c95c6c37ee933ccb9 Mon Sep 17 00:00:00 2001 From: David Choo Date: Sun, 18 Jul 2021 10:58:08 -0400 Subject: [PATCH 490/766] Update player bounding box in more scenarios (#2377) Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com> --- .../connector/entity/player/PlayerEntity.java | 17 +-- .../entity/player/SessionPlayerEntity.java | 17 ++- .../network/session/GeyserSession.java | 6 +- .../player/BedrockMovePlayerTranslator.java | 123 +++++++++--------- .../collision/CollisionManager.java | 36 +++-- .../JavaPlayerPositionRotationTranslator.java | 12 +- 6 files changed, 105 insertions(+), 106 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 7b182da38..7c32fa191 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -155,10 +155,6 @@ public class PlayerEntity extends LivingEntity { setRotation(rotation); this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ); - // If this is the player logged in through this Geyser session - if (geyserId == 1) { - session.getCollisionManager().updatePlayerBoundingBox(position); - } setOnGround(isOnGround); MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); @@ -230,18 +226,7 @@ public class PlayerEntity extends LivingEntity { @Override public void setPosition(Vector3f position) { - setPosition(position, true); - } - - /** - * Set the player position and specify if the entity type's offset should be added. Set to false when the player - * sends us a move packet where the offset is already added - * - * @param position the new position of the Bedrock player - * @param includeOffset whether to include the offset - */ - public void setPosition(Vector3f position, boolean includeOffset) { - this.position = includeOffset ? position.add(0, entityType.getOffset(), 0) : position; + super.setPosition(position.add(0, entityType.getOffset(), 0)); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java index 65f2baa66..baf07b55d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java @@ -74,9 +74,9 @@ public class SessionPlayerEntity extends PlayerEntity { } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - session.getCollisionManager().updatePlayerBoundingBox(position); - super.moveAbsolute(session, position, rotation, isOnGround, teleported); + public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { + super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); + session.getCollisionManager().updatePlayerBoundingBox(this.position.down(entityType.getOffset())); } @Override @@ -87,6 +87,17 @@ public class SessionPlayerEntity extends PlayerEntity { super.setPosition(position); } + /** + * Set the player's position without applying an offset or moving the bounding box + * This is used in BedrockMovePlayerTranslator which receives the player's position + * with the offset pre-applied + * + * @param position the new position of the Bedrock player + */ + public void setPositionManual(Vector3f position) { + this.position = position; + } + @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { super.updateBedrockMetadata(entityMetadata, session); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 23f36b5f8..ad2e6d6c6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -1132,9 +1132,9 @@ public class GeyserSession implements CommandSender { } } - public boolean confirmTeleport(Vector3d position) { + public void confirmTeleport(Vector3d position) { if (teleportMap.size() == 0) { - return true; + return; } int teleportID = -1; @@ -1185,8 +1185,6 @@ public class GeyserSession implements CommandSender { teleport.getYaw(), teleport.getPitch(), playerEntity.isOnGround(), true); } } - - return true; } /** diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index 45e35a39c..7970dbd16 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.entity.player.PlayerEntity; +import org.geysermc.connector.entity.player.SessionPlayerEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -54,7 +54,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator= packet.getPosition().getY(); - - entity.setPosition(packet.getPosition(), false); - entity.setOnGround(packet.isOnGround()); - - // Send final movement changes - session.sendDownstreamPacket(movePacket); - - if (notMovingUp) { - int floorY = position.getFloorY(); - // If the client believes the world has extended height, then it also believes the void floor - // still exists, just at a lower spot - boolean extendedWorld = session.getChunkCache().isExtendedHeight(); - if (floorY <= (extendedWorld ? BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y : -38) - && floorY >= (extendedWorld ? BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y : -40)) { - // Work around there being a floor at the bottom of the world and teleport the player below it - // Moving from below to above the void floor works fine - entity.setPosition(entity.getPosition().sub(0, 4f, 0)); - MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); - movePlayerPacket.setRuntimeEntityId(entity.getGeyserId()); - movePlayerPacket.setPosition(entity.getPosition()); - movePlayerPacket.setRotation(entity.getBedrockRotation()); - movePlayerPacket.setMode(MovePlayerPacket.Mode.TELEPORT); - movePlayerPacket.setTeleportationCause(MovePlayerPacket.TeleportationCause.BEHAVIOR); - session.sendUpstreamPacket(movePlayerPacket); - } - } + session.sendDownstreamPacket(playerRotationPacket); + } else { + Vector3d position = session.getCollisionManager().adjustBedrockPosition(packet.getPosition(), packet.isOnGround()); + if (position != null) { // A null return value cancels the packet + if (isValidMove(session, packet.getMode(), entity.getPosition(), packet.getPosition())) { + Packet movePacket; + if (rotationChanged) { + // Send rotation updates as well + movePacket = new ClientPlayerPositionRotationPacket(packet.isOnGround(), position.getX(), position.getY(), position.getZ(), + packet.getRotation().getY(), packet.getRotation().getX()); + entity.setRotation(rotation); } else { - // Not a valid move - session.getConnector().getLogger().debug("Recalculating position..."); - session.getCollisionManager().recalculatePosition(); + // Rotation did not change; don't send an update with rotation + movePacket = new ClientPlayerPositionPacket(packet.isOnGround(), position.getX(), position.getY(), position.getZ()); } + + // Compare positions here for void floor fix below before the player's position variable is set to the packet position + boolean notMovingUp = entity.getPosition().getY() >= packet.getPosition().getY(); + + entity.setPositionManual(packet.getPosition()); + entity.setOnGround(packet.isOnGround()); + + // Send final movement changes + session.sendDownstreamPacket(movePacket); + + if (notMovingUp) { + int floorY = position.getFloorY(); + // If the client believes the world has extended height, then it also believes the void floor + // still exists, just at a lower spot + boolean extendedWorld = session.getChunkCache().isExtendedHeight(); + if (floorY <= (extendedWorld ? BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y : -38) + && floorY >= (extendedWorld ? BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y : -40)) { + // Work around there being a floor at the bottom of the world and teleport the player below it + // Moving from below to above the void floor works fine + entity.setPosition(entity.getPosition().sub(0, 4f, 0)); + MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); + movePlayerPacket.setRuntimeEntityId(entity.getGeyserId()); + movePlayerPacket.setPosition(entity.getPosition()); + movePlayerPacket.setRotation(entity.getBedrockRotation()); + movePlayerPacket.setMode(MovePlayerPacket.Mode.TELEPORT); + movePlayerPacket.setTeleportationCause(MovePlayerPacket.TeleportationCause.BEHAVIOR); + session.sendUpstreamPacket(movePlayerPacket); + } + } + } else { + // Not a valid move + session.getConnector().getLogger().debug("Recalculating position..."); + session.getCollisionManager().recalculatePosition(); } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index e59c33520..a28a39271 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -54,7 +54,7 @@ public class CollisionManager { private final GeyserSession session; @Getter - private BoundingBox playerBoundingBox; + private final BoundingBox playerBoundingBox; /** * Whether the player is inside scaffolding @@ -105,26 +105,16 @@ public class CollisionManager { } /** - * Updates the stored bounding box without passing a position, which currently just changes the height depending on if the player is sneaking. + * Updates the height of the stored bounding box */ public void updatePlayerBoundingBox() { - if (playerBoundingBox == null) { - Vector3f playerPosition; - if (session.getPlayerEntity() == null) { - // Temporary position to prevent NullPointerException - playerPosition = Vector3f.ZERO; - } else { - playerPosition = session.getPlayerEntity().getPosition(); - } - playerBoundingBox = new BoundingBox(playerPosition.getX(), playerPosition.getY() + 0.9, playerPosition.getZ(), - EntityType.PLAYER.getWidth(), EntityType.PLAYER.getHeight(), EntityType.PLAYER.getLength()); - } else { - // According to the Minecraft Wiki, when sneaking: - // - In Bedrock Edition, the height becomes 1.65 blocks, allowing movement through spaces as small as 1.75 (2 - 1⁄4) blocks high. - // - In Java Edition, the height becomes 1.5 blocks. - // Other instances have the player's bounding box become as small as 0.6 or 0.2. - playerBoundingBox.setSizeY(session.getPlayerEntity().getMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT)); - } + // According to the Minecraft Wiki, when sneaking: + // - In Bedrock Edition, the height becomes 1.65 blocks, allowing movement through spaces as small as 1.75 (2 - 1⁄4) blocks high. + // - In Java Edition, the height becomes 1.5 blocks. + // Other instances have the player's bounding box become as small as 0.6 or 0.2. + double playerHeight = session.getPlayerEntity().getMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); + playerBoundingBox.setMiddleY(playerBoundingBox.getMiddleY() - (playerBoundingBox.getSizeY() / 2.0) + (playerHeight / 2.0)); + playerBoundingBox.setSizeY(playerHeight); } /** @@ -265,9 +255,15 @@ public class CollisionManager { if (collision != null) { // Determine, if the player's bounding box *were* at full height, if it would intersect with the block // at the current location. + double originalY = playerBoundingBox.getMiddleY(); + double originalHeight = playerBoundingBox.getSizeY(); + double standingY = originalY - (originalHeight / 2.0) + (EntityType.PLAYER.getHeight() / 2.0); + playerBoundingBox.setSizeY(EntityType.PLAYER.getHeight()); + playerBoundingBox.setMiddleY(standingY); boolean result = collision.checkIntersection(playerBoundingBox); - playerBoundingBox.setSizeY(session.getPlayerEntity().getMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT)); + playerBoundingBox.setSizeY(originalHeight); + playerBoundingBox.setMiddleY(originalY); return result; } return false; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java index 3865ef64b..454d23d69 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java @@ -124,8 +124,18 @@ public class JavaPlayerPositionRotationTranslator extends PacketTranslator Date: Sun, 18 Jul 2021 12:47:02 -0500 Subject: [PATCH 491/766] Fix check for missing item mapping and update mappings submodule --- .../connector/registry/populator/ItemRegistryPopulator.java | 5 +++-- connector/src/main/resources/mappings | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 16aa56121..9c1f3aa2b 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -120,6 +120,7 @@ public class ItemRegistryPopulator { // Used to get the Bedrock namespaced ID (in instances where there are small differences) Object2IntMap bedrockIdentifierToId = new Object2IntOpenHashMap<>(); + bedrockIdentifierToId.defaultReturnValue(Short.MIN_VALUE); List itemNames = new ArrayList<>(); @@ -264,8 +265,8 @@ public class ItemRegistryPopulator { } String bedrockIdentifier = mappingItem.getBedrockIdentifier(); int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier); - if (bedrockIdentifier == null) { - throw new RuntimeException("Missing Bedrock ID in mappings!: " + bedrockId); + if (bedrockId == Short.MIN_VALUE) { + throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier); } int stackSize = mappingItem.getStackSize(); diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index c921aa9b1..8351b0f5b 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit c921aa9b12c2a1a471ef5f00aa040924426641dc +Subproject commit 8351b0f5bb6e9a1d614f84e18c91e82288c34bf6 From b4921132e170d818cb549608016ea1e90273be1e Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 14:43:17 -0500 Subject: [PATCH 492/766] Replace BiMap with an Object2IntBiMap --- .../living/merchant/VillagerEntity.java | 2 +- ...BedrockInventoryTransactionTranslator.java | 2 +- .../player/BedrockActionTranslator.java | 2 +- .../holder/BlockInventoryHolder.java | 2 +- .../chest/DoubleChestInventoryTranslator.java | 2 +- .../java/world/JavaBlockChangeTranslator.java | 2 +- .../connector/registry/BlockRegistries.java | 5 +- .../loader/CollisionRegistryLoader.java | 11 +- .../connector/utils/Object2IntBiMap.java | 191 ++++++++++++++++++ 9 files changed, 205 insertions(+), 14 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java index 3c94f9de2..9aca12ba5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java @@ -114,7 +114,7 @@ public class VillagerEntity extends AbstractMerchantEntity { if (bedPosition != null) { bedId = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); } - String bedRotationZ = BlockRegistries.JAVA_IDENTIFIERS.get().inverse().get(bedId); + String bedRotationZ = BlockRegistries.JAVA_IDENTIFIERS.get().get(bedId); setRotation(rotation); setOnGround(isOnGround); this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 6e02d4c6b..589fa49d0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -232,7 +232,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator= 2 && session.getGameMode() == GameMode.CREATIVE) { // Otherwise insufficient permissions int blockState = session.getBlockMappings().getJavaBlockState(packet.getBlockRuntimeId()); - String blockName = BlockRegistries.JAVA_IDENTIFIERS.get().inverse().getOrDefault(blockState, ""); + String blockName = BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(blockState, ""); // In the future this can be used for structure blocks too, however not all elements // are available in each GUI if (blockName.contains("jigsaw")) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java index c116045cb..2603f2a0f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java @@ -178,7 +178,7 @@ public class BedrockActionTranslator extends PacketTranslator 1 && (javaBlockString[0].equals("minecraft:chest") || javaBlockString[0].equals("minecraft:trapped_chest")) && !javaBlockString[1].contains("type=single")) { inventory.setHolderPosition(session.getLastInteractionBlockPosition()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java index 5abe088a9..d144e99b8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java @@ -101,7 +101,7 @@ public class JavaBlockChangeTranslator extends PacketTranslator BLOCKS = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); @@ -43,7 +42,7 @@ public class BlockRegistries { public static final SimpleMappedRegistry JAVA_BLOCKS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); - public static final MappedRegistry> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(HashBiMap::create)); + public static final MappedRegistry> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(Object2IntBiMap::new)); public static final SimpleMappedRegistry JAVA_CLEAN_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java index b20e1fe0e..fadd1e0d2 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java @@ -26,10 +26,10 @@ package org.geysermc.connector.registry.loader; import com.fasterxml.jackson.databind.node.ArrayNode; -import com.google.common.collect.BiMap; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.AllArgsConstructor; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.collision.BoundingBox; @@ -40,6 +40,7 @@ import org.geysermc.connector.network.translators.collision.translators.OtherCol import org.geysermc.connector.network.translators.collision.translators.SolidCollision; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.FileUtils; +import org.geysermc.connector.utils.Object2IntBiMap; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; @@ -71,16 +72,16 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader javaIdBlockMap = BlockRegistries.JAVA_IDENTIFIERS.get(); + Object2IntBiMap javaIdBlockMap = BlockRegistries.JAVA_IDENTIFIERS.get(); // Map of classes that don't change based on parameters that have already been created Map, BlockCollision> instantiatedCollision = new HashMap<>(); - for (Map.Entry entry : javaIdBlockMap.entrySet()) { - BlockCollision newCollision = instantiateCollision(entry.getKey(), entry.getValue(), annotationMap, instantiatedCollision, collisionList); + for (Object2IntMap.Entry entry : javaIdBlockMap.object2IntEntrySet()) { + BlockCollision newCollision = instantiateCollision(entry.getKey(), entry.getIntValue(), annotationMap, instantiatedCollision, collisionList); if (newCollision != null) { instantiatedCollision.put(newCollision.getClass(), newCollision); } - collisions.put(entry.getValue().intValue(), newCollision); + collisions.put(entry.getIntValue(), newCollision); } return collisions; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java b/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java new file mode 100644 index 000000000..915ce5ac3 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntCollection; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectSet; +import it.unimi.dsi.fastutil.objects.ObjectSets; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.Objects; + +public class Object2IntBiMap implements Object2IntMap { + private final Object2IntMap forwards; + private final Int2ObjectMap backwards; + + public Object2IntBiMap() { + this(16); + } + + public Object2IntBiMap(int expected) { + this(expected, 0.75F); + } + + public Object2IntBiMap(T defaultForwardsValue) { + this(16, 0.75F, defaultForwardsValue, -1); + } + + public Object2IntBiMap(int expected, float loadFactor) { + this(expected, loadFactor, -1); + } + + public Object2IntBiMap(int expected, float loadFactor, int defaultBackwardsValue) { + this(expected, loadFactor, null, defaultBackwardsValue); + } + + public Object2IntBiMap(int expected, float loadFactor, T defaultForwardsValue, int defaultBackwardsValue) { + this.forwards = new Object2IntOpenHashMap<>(expected, loadFactor); + this.backwards = new Int2ObjectOpenHashMap<>(expected, loadFactor); + this.forwards.defaultReturnValue(defaultBackwardsValue); + this.backwards.defaultReturnValue(defaultForwardsValue); + } + + @Override + public int size() { + return this.forwards.size(); + } + + @Override + public boolean isEmpty() { + return this.forwards.isEmpty(); + } + + @Override + public int getInt(Object o) { + return this.forwards.getInt(o); + } + + public T get(int key) { + return this.backwards.get(key); + } + + @Override + public int getOrDefault(Object key, int defaultValue) { + return this.forwards.getOrDefault(key, defaultValue); + } + + public T getOrDefault(int key, T defaultValue) { + return this.backwards.getOrDefault(key, defaultValue); + } + + @Override + public void defaultReturnValue(int i) { + this.forwards.defaultReturnValue(i); + } + + public void defaultReturnValue(T v) { + this.backwards.defaultReturnValue(v); + } + + @Override + public int defaultReturnValue() { + return this.forwards.defaultReturnValue(); + } + + public T backwardsDefaultReturnValue() { + return this.backwards.defaultReturnValue(); + } + + @Override + public ObjectSet> object2IntEntrySet() { + return ObjectSets.unmodifiable(this.forwards.object2IntEntrySet()); + } + + public ObjectSet> int2ObjectEntrySet() { + return ObjectSets.unmodifiable(this.backwards.int2ObjectEntrySet()); + } + + @Override + public ObjectSet keySet() { + return this.forwards.keySet(); + } + + @Override + public IntCollection values() { + return this.forwards.values(); + } + + @Override + public boolean containsKey(Object o) { + return this.forwards.containsKey(o); + } + + @Override + public boolean containsValue(int i) { + return this.backwards.containsKey(i); + } + + @Override + public int put(T key, int value) { + this.backwards.put(value, key); + return this.forwards.put(key, value); + } + + @Override + public void putAll(@NotNull Map m) { + this.forwards.putAll(m); + for (Map.Entry entry : m.entrySet()) { + this.backwards.put((int) entry.getValue(), entry.getKey()); + } + } + + @Override + public int removeInt(Object key) { + if (!this.forwards.containsKey(key)) { + return this.defaultReturnValue(); + } + + int value = this.forwards.getInt(key); + if (!this.backwards.containsKey(value)) { + return this.defaultReturnValue(); + }; + this.backwards.remove(value); + return this.forwards.removeInt(key); + } + + @Override + public int hashCode() { + return this.forwards.hashCode(); + } + + @Override + public String toString() { + return this.forwards.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Object2IntBiMap that = (Object2IntBiMap) o; + return Objects.equals(this.forwards, that.forwards) && Objects.equals(this.backwards, that.backwards); + } +} From 1ad952b5814060957a6b677c3f2773b65cdf6498 Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 15:20:40 -0500 Subject: [PATCH 493/766] Handle locale stuff downloading of main thread and add doc to Object2IntBiMap Technically LocaleUtils is not thread safe and people running Geyser for the first time on slow internet connections may see some untranslated messages. However, we were seeing startup times of about 1+ minutes on these slow connections, and it's better that players see untranslated messages for a short period of time rather than having to wait over a minute for the program to start up. Once the locale is installed, it doesn't need to be redownloaded again (unless there is a game update) and all translated messages will just work once this download is complete without clients needing to relog. --- .../geysermc/connector/utils/LocaleUtils.java | 237 +++++++++--------- .../connector/utils/Object2IntBiMap.java | 9 + 2 files changed, 129 insertions(+), 117 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java index 7e32553b6..bd2bb9370 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java @@ -39,6 +39,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.zip.ZipFile; public class LocaleUtils { @@ -56,53 +57,55 @@ public class LocaleUtils { localesFolder.mkdir(); // Download the latest asset list and cache it - generateAssetCache(); - downloadAndLoadLocale(LanguageUtils.getDefaultLocale()); + generateAssetCache().whenComplete((aVoid, ex) -> downloadAndLoadLocale(LanguageUtils.getDefaultLocale())); } /** * Fetch the latest versions asset cache from Mojang so we can grab the locale files later */ - private static void generateAssetCache() { - try { - // Get the version manifest from Mojang - VersionManifest versionManifest = GeyserConnector.JSON_MAPPER.readValue(WebUtils.getBody("https://launchermeta.mojang.com/mc/game/version_manifest.json"), VersionManifest.class); + private static CompletableFuture generateAssetCache() { + return CompletableFuture.supplyAsync(() -> { + try { + // Get the version manifest from Mojang + VersionManifest versionManifest = GeyserConnector.JSON_MAPPER.readValue(WebUtils.getBody("https://launchermeta.mojang.com/mc/game/version_manifest.json"), VersionManifest.class); - // Get the url for the latest version of the games manifest - String latestInfoURL = ""; - for (Version version : versionManifest.getVersions()) { - if (version.getId().equals(MinecraftConstants.GAME_VERSION)) { - latestInfoURL = version.getUrl(); - break; + // Get the url for the latest version of the games manifest + String latestInfoURL = ""; + for (Version version : versionManifest.getVersions()) { + if (version.getId().equals(MinecraftConstants.GAME_VERSION)) { + latestInfoURL = version.getUrl(); + break; + } } + + // Make sure we definitely got a version + if (latestInfoURL.isEmpty()) { + throw new Exception(LanguageUtils.getLocaleStringLog("geyser.locale.fail.latest_version")); + } + + // Get the individual version manifest + VersionInfo versionInfo = GeyserConnector.JSON_MAPPER.readValue(WebUtils.getBody(latestInfoURL), VersionInfo.class); + + // Get the client jar for use when downloading the en_us locale + GeyserConnector.getInstance().getLogger().debug(GeyserConnector.JSON_MAPPER.writeValueAsString(versionInfo.getDownloads())); + clientJarInfo = versionInfo.getDownloads().get("client"); + GeyserConnector.getInstance().getLogger().debug(GeyserConnector.JSON_MAPPER.writeValueAsString(clientJarInfo)); + + // Get the assets list + JsonNode assets = GeyserConnector.JSON_MAPPER.readTree(WebUtils.getBody(versionInfo.getAssetIndex().getUrl())).get("objects"); + + // Put each asset into an array for use later + Iterator> assetIterator = assets.fields(); + while (assetIterator.hasNext()) { + Map.Entry entry = assetIterator.next(); + Asset asset = GeyserConnector.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class); + ASSET_MAP.put(entry.getKey(), asset); + } + } catch (Exception e) { + GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace()))); } - - // Make sure we definitely got a version - if (latestInfoURL.isEmpty()) { - throw new Exception(LanguageUtils.getLocaleStringLog("geyser.locale.fail.latest_version")); - } - - // Get the individual version manifest - VersionInfo versionInfo = GeyserConnector.JSON_MAPPER.readValue(WebUtils.getBody(latestInfoURL), VersionInfo.class); - - // Get the client jar for use when downloading the en_us locale - GeyserConnector.getInstance().getLogger().debug(GeyserConnector.JSON_MAPPER.writeValueAsString(versionInfo.getDownloads())); - clientJarInfo = versionInfo.getDownloads().get("client"); - GeyserConnector.getInstance().getLogger().debug(GeyserConnector.JSON_MAPPER.writeValueAsString(clientJarInfo)); - - // Get the assets list - JsonNode assets = GeyserConnector.JSON_MAPPER.readTree(WebUtils.getBody(versionInfo.getAssetIndex().getUrl())).get("objects"); - - // Put each asset into an array for use later - Iterator> assetIterator = assets.fields(); - while (assetIterator.hasNext()) { - Map.Entry entry = assetIterator.next(); - Asset asset = GeyserConnector.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class); - ASSET_MAP.put(entry.getKey(), asset); - } - } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace()))); - } + return null; + }); } /** @@ -311,107 +314,107 @@ public class LocaleUtils { public static void init() { // no-op } -} -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class VersionManifest { - @JsonProperty("latest") - private LatestVersion latestVersion; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class VersionManifest { + @JsonProperty("latest") + private LatestVersion latestVersion; - @JsonProperty("versions") - private List versions; -} + @JsonProperty("versions") + private List versions; + } -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class LatestVersion { - @JsonProperty("release") - private String release; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class LatestVersion { + @JsonProperty("release") + private String release; - @JsonProperty("snapshot") - private String snapshot; -} + @JsonProperty("snapshot") + private String snapshot; + } -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class Version { - @JsonProperty("id") - private String id; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class Version { + @JsonProperty("id") + private String id; - @JsonProperty("type") - private String type; + @JsonProperty("type") + private String type; - @JsonProperty("url") - private String url; + @JsonProperty("url") + private String url; - @JsonProperty("time") - private String time; + @JsonProperty("time") + private String time; - @JsonProperty("releaseTime") - private String releaseTime; -} + @JsonProperty("releaseTime") + private String releaseTime; + } -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class VersionInfo { - @JsonProperty("id") - private String id; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class VersionInfo { + @JsonProperty("id") + private String id; - @JsonProperty("type") - private String type; + @JsonProperty("type") + private String type; - @JsonProperty("time") - private String time; + @JsonProperty("time") + private String time; - @JsonProperty("releaseTime") - private String releaseTime; + @JsonProperty("releaseTime") + private String releaseTime; - @JsonProperty("assetIndex") - private AssetIndex assetIndex; + @JsonProperty("assetIndex") + private AssetIndex assetIndex; - @JsonProperty("downloads") - private Map downloads; -} + @JsonProperty("downloads") + private Map downloads; + } -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class VersionDownload { - @JsonProperty("sha1") - private String sha1; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class VersionDownload { + @JsonProperty("sha1") + private String sha1; - @JsonProperty("size") - private int size; + @JsonProperty("size") + private int size; - @JsonProperty("url") - private String url; -} + @JsonProperty("url") + private String url; + } -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class AssetIndex { - @JsonProperty("id") - private String id; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class AssetIndex { + @JsonProperty("id") + private String id; - @JsonProperty("sha1") - private String sha1; + @JsonProperty("sha1") + private String sha1; - @JsonProperty("size") - private int size; + @JsonProperty("size") + private int size; - @JsonProperty("totalSize") - private int totalSize; + @JsonProperty("totalSize") + private int totalSize; - @JsonProperty("url") - private String url; -} + @JsonProperty("url") + private String url; + } -@JsonIgnoreProperties(ignoreUnknown = true) -@Getter -class Asset { - @JsonProperty("hash") - private String hash; + @JsonIgnoreProperties(ignoreUnknown = true) + @Getter + static class Asset { + @JsonProperty("hash") + private String hash; - @JsonProperty("size") - private int size; + @JsonProperty("size") + private int size; + } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java b/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java index 915ce5ac3..27277923b 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java +++ b/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java @@ -37,6 +37,15 @@ import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.Objects; +/** + * A primitive int BiMap implementation built around fastutil to + * reduce boxing and the memory footprint. Protocol has a + * {@link com.nukkitx.protocol.util.Int2ObjectBiMap} class, but it + * does not extend the Map interface making it difficult to utilize + * it in for loops and the registry system. + * + * @param the value + */ public class Object2IntBiMap implements Object2IntMap { private final Object2IntMap forwards; private final Int2ObjectMap backwards; From 95a1cbfa248f137dc54552ba64a8061df314c101 Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 15:43:04 -0500 Subject: [PATCH 494/766] Some more micro optimizations --- .../network/translators/PacketTranslatorRegistry.java | 4 ++-- .../connector/registry/loader/CollisionRegistryLoader.java | 6 +++--- .../registry/populator/RecipeRegistryPopulator.java | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 20c40a785..d8f726223 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -36,11 +36,11 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LanguageUtils; -import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.Map; public class PacketTranslatorRegistry { - private final Map, PacketTranslator> translators = new HashMap<>(); + private final Map, PacketTranslator> translators = new IdentityHashMap<>(); public static final PacketTranslatorRegistry JAVA_TRANSLATOR = new PacketTranslatorRegistry<>(); public static final PacketTranslatorRegistry BEDROCK_TRANSLATOR = new PacketTranslatorRegistry<>(); diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java index fadd1e0d2..e91ecb9df 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java @@ -44,7 +44,7 @@ import org.geysermc.connector.utils.Object2IntBiMap; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.Map; import java.util.regex.Pattern; @@ -54,7 +54,7 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader load(Pair input) { Int2ObjectMap collisions = new Int2ObjectOpenHashMap<>(); - Map, CollisionInfo> annotationMap = new HashMap<>(); + Map, CollisionInfo> annotationMap = new IdentityHashMap<>(); for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(CollisionRemapper.class.getName())) { GeyserConnector.getInstance().getLogger().debug("Found annotated collision translator: " + clazz.getCanonicalName()); @@ -75,7 +75,7 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader javaIdBlockMap = BlockRegistries.JAVA_IDENTIFIERS.get(); // Map of classes that don't change based on parameters that have already been created - Map, BlockCollision> instantiatedCollision = new HashMap<>(); + Map, BlockCollision> instantiatedCollision = new IdentityHashMap<>(); for (Object2IntMap.Entry entry : javaIdBlockMap.object2IntEntrySet()) { BlockCollision newCollision = instantiateCollision(entry.getKey(), entry.getIntValue(), annotationMap, instantiatedCollision, collisionList); if (newCollision != null) { diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java index 97eeccece..a47457d14 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java @@ -67,7 +67,7 @@ public class RecipeRegistryPopulator { } int currentRecipeId = LAST_RECIPE_NET_ID; - for (Map.Entry version : Registries.ITEMS.get().entrySet()) { + for (Int2ObjectMap.Entry version : Registries.ITEMS.get().int2ObjectEntrySet()) { // Make a bit of an assumption here that the last recipe net ID will be equivalent between all versions LAST_RECIPE_NET_ID = currentRecipeId; Map> craftingData = new EnumMap<>(RecipeType.class); @@ -113,8 +113,8 @@ public class RecipeRegistryPopulator { c -> new ObjectArrayList<>()).add(getCraftingDataFromJsonNode(entry, recipes, version.getValue())); } - Registries.CRAFTING_DATA.register(version.getKey(), craftingData); - Registries.RECIPES.register(version.getKey(), recipes); + Registries.CRAFTING_DATA.register(version.getIntKey(), craftingData); + Registries.RECIPES.register(version.getIntKey(), recipes); } } From 15863bdaef6e95fbb3b23dd26e2a7327b080a978 Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 16:24:55 -0500 Subject: [PATCH 495/766] Disable netty's resource leak detector if no level is set --- .../main/java/org/geysermc/connector/GeyserConnector.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 173e41573..98dfbc5ce 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -34,6 +34,7 @@ import com.nukkitx.network.util.EventLoops; import com.nukkitx.protocol.bedrock.BedrockServer; import io.netty.channel.epoll.Epoll; import io.netty.channel.kqueue.KQueue; +import io.netty.util.ResourceLeakDetector; import lombok.Getter; import lombok.Setter; import org.geysermc.common.PlatformType; @@ -125,6 +126,10 @@ public class GeyserConnector { private Metrics metrics; private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) { + if (System.getProperty("io.netty.leakDetection.level") == null) { + ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance + } + long startupTime = System.currentTimeMillis(); instance = this; From ae4e4397e3682d0eddb7f44fcf8ed3aa1918750a Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 17:04:16 -0500 Subject: [PATCH 496/766] Use a CompleteableFuture rather than constructing a new thread for logins --- .../network/session/GeyserSession.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 23f36b5f8..0daf15b60 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -560,8 +560,10 @@ public class GeyserSession implements CommandSender { } loggingIn = true; - // new thread so clients don't timeout - new Thread(() -> { + + // Use a future to prevent timeouts as all the authentication is handled sync + // This will be changed with the new protocol library. + CompletableFuture.supplyAsync(() -> { try { if (password != null && !password.isEmpty()) { AuthenticationService authenticationService; @@ -587,15 +589,14 @@ public class GeyserSession implements CommandSender { protocol = new MinecraftProtocol(validUsername); } - - connectDownstream(); } catch (InvalidCredentialsException | IllegalArgumentException e) { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", username)); disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); } catch (RequestException ex) { ex.printStackTrace(); } - }).start(); + return null; + }).whenComplete((aVoid, ex) -> connectDownstream()); } /** @@ -608,8 +609,10 @@ public class GeyserSession implements CommandSender { } loggingIn = true; - // new thread so clients don't timeout - new Thread(() -> { + + // Use a future to prevent timeouts as all the authentication is handled sync + // This will be changed with the new protocol library. + CompletableFuture.supplyAsync(() -> { try { MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); @@ -629,7 +632,8 @@ public class GeyserSession implements CommandSender { } catch (RequestException ex) { ex.printStackTrace(); } - }).start(); + return null; + }).whenComplete((aVoid, ex) -> connectDownstream()); } /** From 39324ce95dca8e16c2229f34d5c77a7c2c901242 Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 17:41:47 -0500 Subject: [PATCH 497/766] Go back to normal thread for now using MSA auth, and only toggle leak detector on standalone --- .../java/org/geysermc/connector/GeyserConnector.java | 2 +- .../connector/network/session/GeyserSession.java | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 98dfbc5ce..107a48c4d 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -126,7 +126,7 @@ public class GeyserConnector { private Metrics metrics; private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) { - if (System.getProperty("io.netty.leakDetection.level") == null) { + if (platformType == PlatformType.STANDALONE && System.getProperty("io.netty.leakDetection.level") == null) { ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 0daf15b60..f9ae137bf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -609,10 +609,8 @@ public class GeyserSession implements CommandSender { } loggingIn = true; - - // Use a future to prevent timeouts as all the authentication is handled sync - // This will be changed with the new protocol library. - CompletableFuture.supplyAsync(() -> { + // new thread so clients don't timeout + new Thread(() -> { try { MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); @@ -632,8 +630,7 @@ public class GeyserSession implements CommandSender { } catch (RequestException ex) { ex.printStackTrace(); } - return null; - }).whenComplete((aVoid, ex) -> connectDownstream()); + }).start(); } /** @@ -650,7 +647,7 @@ public class GeyserSession implements CommandSender { connectDownstream(); } catch (RequestException e) { if (!(e instanceof AuthPendingException)) { - e.printStackTrace(); + throw new RuntimeException("Failed to log in with Microsoft code!", e); } else { // Wait one second before trying again connector.getGeneralThreadPool().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); From 1a0ac26398a50d49153de3afc16f29f2335d62ba Mon Sep 17 00:00:00 2001 From: Redned Date: Sun, 18 Jul 2021 17:44:08 -0500 Subject: [PATCH 498/766] Move leak detector to standalone bootstrap class --- .../platform/standalone/GeyserStandaloneBootstrap.java | 5 +++++ .../main/java/org/geysermc/connector/GeyserConnector.java | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java index 551b0e584..1a25d2792 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java @@ -30,6 +30,7 @@ import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.introspect.AnnotatedField; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; +import io.netty.util.ResourceLeakDetector; import lombok.Getter; import net.minecrell.terminalconsole.TerminalConsoleAppender; import org.apache.logging.log4j.Level; @@ -80,6 +81,10 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { private static final Map argsConfigKeys = new HashMap<>(); public static void main(String[] args) { + if (System.getProperty("io.netty.leakDetection.level") == null) { + ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance + } + GeyserStandaloneBootstrap bootstrap = new GeyserStandaloneBootstrap(); // Set defaults boolean useGuiOpts = bootstrap.useGui; diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 107a48c4d..173e41573 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -34,7 +34,6 @@ import com.nukkitx.network.util.EventLoops; import com.nukkitx.protocol.bedrock.BedrockServer; import io.netty.channel.epoll.Epoll; import io.netty.channel.kqueue.KQueue; -import io.netty.util.ResourceLeakDetector; import lombok.Getter; import lombok.Setter; import org.geysermc.common.PlatformType; @@ -126,10 +125,6 @@ public class GeyserConnector { private Metrics metrics; private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) { - if (platformType == PlatformType.STANDALONE && System.getProperty("io.netty.leakDetection.level") == null) { - ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance - } - long startupTime = System.currentTimeMillis(); instance = this; From d7fbdaf93d7e30bc62853220daba63d91a2fabe2 Mon Sep 17 00:00:00 2001 From: David Choo Date: Tue, 20 Jul 2021 12:08:48 -0400 Subject: [PATCH 499/766] Fix Squid Animation (#2398) --- .../org/geysermc/connector/entity/Entity.java | 23 ++++-- .../connector/entity/living/SquidEntity.java | 70 ++++++++++++++++++- .../connector/entity/living/WaterEntity.java | 3 - .../entity/living/animal/AxolotlEntity.java | 5 ++ .../entity/player/SessionPlayerEntity.java | 9 +++ .../geysermc/connector/utils/MathUtils.java | 24 +++++++ 6 files changed, 123 insertions(+), 11 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index ad43f2354..04a876f8f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -46,6 +46,7 @@ import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.connector.utils.MathUtils; @Getter @Setter @@ -83,11 +84,11 @@ public class Entity { this.valid = false; setPosition(position); + setAir(getMaxAir()); metadata.put(EntityData.SCALE, 1f); metadata.put(EntityData.COLOR, 0); - metadata.put(EntityData.MAX_AIR_SUPPLY, (short) 300); - metadata.put(EntityData.AIR_SUPPLY, (short) 0); + metadata.put(EntityData.MAX_AIR_SUPPLY, getMaxAir()); metadata.put(EntityData.LEASH_HOLDER_EID, -1L); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight()); metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); @@ -255,11 +256,7 @@ public class Entity { } break; case 1: // Air/bubbles - if ((int) entityMetadata.getValue() == 300) { - metadata.put(EntityData.AIR_SUPPLY, (short) 0); // Otherwise the bubble counter remains in the UI - } else { - metadata.put(EntityData.AIR_SUPPLY, (short) (int) entityMetadata.getValue()); - } + setAir((int) entityMetadata.getValue()); break; case 2: // custom name if (entityMetadata.getValue() instanceof Component) { @@ -334,6 +331,18 @@ public class Entity { metadata.put(EntityData.FREEZING_EFFECT_STRENGTH, amount); } + /** + * Set an int from 0 - this entity's maximum air - (air / maxAir) represents the percentage of bubbles left + * @param amount the amount of air + */ + protected void setAir(int amount) { + metadata.put(EntityData.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); + } + + protected int getMaxAir() { + return 300; + } + /** * x = Pitch, y = HeadYaw, z = Yaw * diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java index df914162d..baef24bb6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java @@ -26,10 +26,78 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.geysermc.connector.entity.Tickable; import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.world.block.BlockStateValues; + +public class SquidEntity extends WaterEntity implements Tickable { + + private float pitch; + private float yaw; + + private float targetPitch; + private float targetYaw; + + private boolean inWater; -public class SquidEntity extends WaterEntity { public SquidEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { super(entityId, geyserId, entityType, position, motion, rotation); + this.yaw = rotation.getX(); + } + + @Override + public void tick(GeyserSession session) { + if (inWater) { + pitch += (targetPitch - pitch) * 0.1f; + yaw += (targetYaw - yaw) * 0.1f; + } else { + pitch += (-90 - pitch) * 0.02f; + } + super.moveAbsolute(session, position, Vector3f.from(yaw, 0, yaw), onGround, false); + } + + @Override + public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { + super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); + checkInWater(session); + } + + @Override + public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + super.moveAbsolute(session, position, rotation, isOnGround, teleported); + checkInWater(session); + } + + @Override + public void setRotation(Vector3f rotation) { + // Let the Java server control yaw when the squid is out of water + if (!inWater) { + yaw = rotation.getX(); + } + } + + @Override + public void setMotion(Vector3f motion) { + super.setMotion(motion); + + double horizontalSpeed = Math.sqrt(motion.getX() * motion.getX() + motion.getZ() * motion.getZ()); + targetPitch = (float) Math.toDegrees(-Math.atan2(horizontalSpeed, motion.getY())); + targetYaw = (float) Math.toDegrees(-Math.atan2(motion.getX(), motion.getZ())); + } + + @Override + public Vector3f getBedrockRotation() { + return Vector3f.from(pitch, yaw, yaw); + } + + private void checkInWater(GeyserSession session) { + if (getMetadata().getFlags().getFlag(EntityFlag.RIDING)) { + inWater = false; + } else { + int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); + inWater = BlockStateValues.getWaterLevel(block) != -1; + } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java index 558b061b3..9b90ba72e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java @@ -26,14 +26,11 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.connector.entity.type.EntityType; public class WaterEntity extends CreatureEntity { public WaterEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { super(entityId, geyserId, entityType, position, motion, rotation); - - metadata.put(EntityData.AIR_SUPPLY, (short) 400); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java index f3d634140..3d2be0ce7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java @@ -62,4 +62,9 @@ public class AxolotlEntity extends AnimalEntity { public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("tropical_fish_bucket"); } + + @Override + protected int getMaxAir() { + return 6000; + } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java index baf07b55d..373ff6f43 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java @@ -119,6 +119,15 @@ public class SessionPlayerEntity extends PlayerEntity { super.setHealth(health); } + @Override + protected void setAir(int amount) { + if (amount == getMaxAir()) { + super.setAir(0); // Hide the bubble counter from the UI for the player + } else { + super.setAir(amount); + } + } + @Override public AttributeData createHealthAttribute() { // Max health must be divisible by two in bedrock diff --git a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java b/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java index 0bb854428..4896e54ce 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java @@ -42,6 +42,7 @@ public class MathUtils { /** * If number is greater than the max, set it to max, and if number is lower than low, set it to low. + * * @param num number to calculate * @param min the lowest value the number can be * @param max the greatest value the number can be @@ -53,6 +54,29 @@ public class MathUtils { if (num > max) { num = max; } + + if (num < min) { + num = min; + } + + return num; + } + + /** + * If number is greater than the max, set it to max, and if number is lower than low, set it to low. + * + * @param num number to calculate + * @param min the lowest value the number can be + * @param max the greatest value the number can be + * @return - min if num is lower than min
+ * - max if num is greater than max
+ * - num otherwise + */ + public static int constrain(int num, int min, int max) { + if (num > max) { + num = max; + } + if (num < min) { num = min; } From 41d15f3ec3d2b43d5c832bd08d38a0a730a9864b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 20 Jul 2021 18:41:09 -0400 Subject: [PATCH 500/766] Optimize squid packet sending Don't send a full MoveEntityAbsolutePacket when we can send a smaller MoveEntityDeltaPacket that only has rotation information. --- .../connector/entity/living/SquidEntity.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java index baef24bb6..bf18b97a0 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java @@ -27,6 +27,7 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.connector.entity.Tickable; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; @@ -49,13 +50,35 @@ public class SquidEntity extends WaterEntity implements Tickable { @Override public void tick(GeyserSession session) { + boolean pitchChanged; + boolean yawChanged; + float oldPitch = pitch; if (inWater) { + float oldYaw = yaw; pitch += (targetPitch - pitch) * 0.1f; yaw += (targetYaw - yaw) * 0.1f; + yawChanged = oldYaw != yaw; } else { pitch += (-90 - pitch) * 0.02f; + yawChanged = false; + } + pitchChanged = oldPitch != pitch; + + if (pitchChanged || yawChanged) { + MoveEntityDeltaPacket packet = new MoveEntityDeltaPacket(); + packet.setRuntimeEntityId(geyserId); + + if (pitchChanged) { + packet.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_PITCH); + packet.setPitch(pitch); + } + if (yawChanged) { + packet.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_YAW); + packet.setYaw(yaw); + } + + session.sendUpstreamPacket(packet); } - super.moveAbsolute(session, position, Vector3f.from(yaw, 0, yaw), onGround, false); } @Override From 8a218455d4b13c13a496936f346d3908c64e5c6b Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Tue, 20 Jul 2021 23:19:51 -0400 Subject: [PATCH 501/766] fix discord badge link (#2403) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e1b51594..f14506f0c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Build Status](https://ci.opencollab.dev/job/Geyser/job/master/badge/icon)](https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/master/) -[![Discord](https://img.shields.io/discord/613163671870242838.svg?color=%237289da&label=discord)](https://discord.gg/geysermc/) +[![Discord](https://img.shields.io/discord/613163671870242838.svg?color=%237289da&label=discord)](https://discord.gg/geysermc) [![HitCount](http://hits.dwyl.com/Geyser/GeyserMC.svg)](http://hits.dwyl.com/Geyser/GeyserMC) [![Crowdin](https://badges.crowdin.net/geyser/localized.svg)](https://translate.geysermc.org/) From 6b84e07c343b81e1890e7344aba0e764df8cbb77 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 21 Jul 2021 13:44:11 -0400 Subject: [PATCH 502/766] Consolidate left/right parrot checks into one boolean The 1.17 update missed a couple of updates. Address the problem by only checking once. Fixes #2402 --- .../connector/entity/player/PlayerEntity.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 7c32fa191..6d4117a80 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -271,8 +271,9 @@ public class PlayerEntity extends LivingEntity { // Parrot occupying shoulder if (entityMetadata.getId() == 19 || entityMetadata.getId() == 20) { CompoundTag tag = (CompoundTag) entityMetadata.getValue(); + boolean isLeft = entityMetadata.getId() == 19; if (tag != null && !tag.isEmpty()) { - if ((entityMetadata.getId() == 19 && leftParrot != null) || (entityMetadata.getId() == 20 && rightParrot != null)) { + if ((isLeft && leftParrot != null) || (!isLeft && rightParrot != null)) { // No need to update a parrot's data when it already exists return; } @@ -282,26 +283,26 @@ public class PlayerEntity extends LivingEntity { parrot.spawnEntity(session); parrot.getMetadata().put(EntityData.VARIANT, tag.get("Variant").getValue()); // Different position whether the parrot is left or right - float offset = (entityMetadata.getId() == 18) ? 0.4f : -0.4f; + float offset = isLeft ? 0.4f : -0.4f; parrot.getMetadata().put(EntityData.RIDER_SEAT_POSITION, Vector3f.from(offset, -0.22, -0.1)); parrot.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, 1); parrot.updateBedrockMetadata(session); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); - EntityLinkData.Type type = (entityMetadata.getId() == 18) ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER; - linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false)); + EntityLinkData.Type type = isLeft ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER; + linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false, false)); // Delay, or else spawned-in players won't get the link // TODO: Find a better solution. This problem also exists with item frames session.getConnector().getGeneralThreadPool().schedule(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS); - if (entityMetadata.getId() == 18) { + if (isLeft) { leftParrot = parrot; } else { rightParrot = parrot; } } else { - Entity parrot = (entityMetadata.getId() == 19 ? leftParrot : rightParrot); + Entity parrot = isLeft ? leftParrot : rightParrot; if (parrot != null) { parrot.despawnEntity(session); - if (entityMetadata.getId() == 19) { + if (isLeft) { leftParrot = null; } else { rightParrot = null; From 8f98162c69c10a58879b1edbd2877ede588cdc7c Mon Sep 17 00:00:00 2001 From: David Choo Date: Wed, 21 Jul 2021 21:48:59 -0400 Subject: [PATCH 503/766] Fix Item drop animation (#2406) --- .../geysermc/connector/entity/ItemEntity.java | 78 +++++++++++++++---- .../entity/JavaEntityVelocityTranslator.java | 7 ++ .../world/block/BlockStateValues.java | 22 ++++++ 3 files changed, 91 insertions(+), 16 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java index 1615ac8d8..3dcfb0d93 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java @@ -28,31 +28,23 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; +import org.geysermc.connector.network.translators.world.block.BlockStateValues; -public class ItemEntity extends Entity { +public class ItemEntity extends ThrowableEntity { protected ItemData item; + private int waterLevel = -1; + public ItemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position.add(0d, entityType.getOffset(), 0d), motion, rotation); - } - - @Override - public void setMotion(Vector3f motion) { - if (isOnGround()) - motion = Vector3f.from(motion.getX(), 0, motion.getZ()); - - super.setMotion(motion); - } - - @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - super.moveAbsolute(session, position.add(0d, this.entityType.getOffset(), 0d), rotation, isOnGround, teleported); + super(entityId, geyserId, entityType, position, motion, rotation); } @Override @@ -63,14 +55,63 @@ public class ItemEntity extends Entity { valid = true; AddItemEntityPacket itemPacket = new AddItemEntityPacket(); itemPacket.setRuntimeEntityId(geyserId); + itemPacket.setUniqueEntityId(geyserId); itemPacket.setPosition(position.add(0d, this.entityType.getOffset(), 0d)); itemPacket.setMotion(motion); - itemPacket.setUniqueEntityId(geyserId); itemPacket.setFromFishing(false); itemPacket.setItemInHand(item); + itemPacket.getMetadata().putAll(metadata); session.sendUpstreamPacket(itemPacket); } + @Override + public void tick(GeyserSession session) { + if (isInWater(session)) { + return; + } + if (!onGround || (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) > 0.00001) { + float gravity = getGravity(session); + motion = motion.down(gravity); + moveAbsoluteImmediate(session, position.add(motion), rotation, onGround, false); + float drag = getDrag(session); + motion = motion.mul(drag, 0.98f, drag); + } + } + + @Override + protected void moveAbsoluteImmediate(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + float offset = entityType.getOffset(); + if (waterLevel == 0) { // Item is in a full block of water + // Move the item entity down so it doesn't float above the water + offset = -entityType.getOffset(); + } + super.moveAbsoluteImmediate(session, position.add(0, offset, 0), Vector3f.ZERO, isOnGround, teleported); + this.position = position; + + int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); + waterLevel = BlockStateValues.getWaterLevel(block); + } + + @Override + protected float getGravity(GeyserSession session) { + if (metadata.getFlags().getFlag(EntityFlag.HAS_GRAVITY) && !onGround && !isInWater(session)) { + // Gravity can change if the item is in water/lava, but + // the server calculates the motion & position for us + return 0.04f; + } + return 0; + } + + @Override + protected float getDrag(GeyserSession session) { + if (onGround) { + Vector3i groundBlockPos = position.toInt().down(1); + int blockState = session.getConnector().getWorldManager().getBlockAt(session, groundBlockPos); + return BlockStateValues.getSlipperiness(blockState) * 0.98f; + } + return 0.98f; + } + @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { if (entityMetadata.getId() == 8) { @@ -81,4 +122,9 @@ public class ItemEntity extends Entity { super.updateBedrockMetadata(entityMetadata, session); } + + @Override + protected boolean isInWater(GeyserSession session) { + return waterLevel != -1; + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java index 1c628503a..3f0b69cdb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java @@ -26,6 +26,7 @@ package org.geysermc.connector.network.translators.java.entity; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.ItemEntity; import org.geysermc.connector.entity.living.animal.horse.AbstractHorseEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -54,6 +55,12 @@ public class JavaEntityVelocityTranslator extends PacketTranslator Date: Wed, 21 Jul 2021 21:14:00 -0500 Subject: [PATCH 504/766] Document the registry system (Closes #2387) --- .../registry/AbstractMappedRegistry.java | 37 +++++++++- .../connector/registry/BlockRegistries.java | 3 + .../connector/registry/MappedRegistry.java | 70 ++++++++++++++++--- .../connector/registry/Registries.java | 3 + .../geysermc/connector/registry/Registry.java | 54 ++++++++++++++ .../registry/SimpleMappedRegistry.java | 49 +++++++++++++ .../connector/registry/SimpleRegistry.java | 46 ++++++++++++ .../connector/registry/VersionedRegistry.java | 55 +++++++++++++++ .../loader/AnnotatedRegistryLoader.java | 20 ++++++ .../loader/BlockEntityRegistryLoader.java | 3 + .../loader/CollisionRegistryLoader.java | 3 + .../registry/loader/EffectRegistryLoader.java | 5 ++ .../loader/MultiResourceRegistryLoader.java | 6 ++ .../registry/loader/NbtRegistryLoader.java | 3 + .../loader/ParticleTypesRegistryLoader.java | 3 + .../registry/loader/RegistryLoader.java | 12 +++- .../registry/loader/RegistryLoaders.java | 18 ++++- .../loader/SoundEffectsRegistryLoader.java | 3 + .../loader/SoundHandlerRegistryLoader.java | 3 + .../registry/loader/SoundRegistryLoader.java | 5 +- .../populator/BlockRegistryPopulator.java | 3 + .../populator/ItemRegistryPopulator.java | 3 + .../populator/RecipeRegistryPopulator.java | 3 + 23 files changed, 394 insertions(+), 16 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java b/connector/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java index 034eef706..c5c7cf87f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java @@ -27,21 +27,54 @@ package org.geysermc.connector.registry; import org.geysermc.connector.registry.loader.RegistryLoader; +import javax.annotation.Nullable; import java.util.Map; -public abstract class AbstractMappedRegistry> extends Registry { - protected AbstractMappedRegistry(I input, RegistryLoader registryLoader) { +/** + * An abstract registry holding a map of various registrations as defined by {@link M}. + * The M represents the map class, which can be anything that extends {@link Map}. The + * {@link K} and {@link V} generics are the key and value respectively. + * + * @param the key + * @param the value + * @param the map + */ +public abstract class AbstractMappedRegistry> extends Registry { + protected AbstractMappedRegistry(I input, RegistryLoader registryLoader) { super(input, registryLoader); } + /** + * Returns the value registered by the given key. + * + * @param key the key + * @return the value registered by the given key. + */ + @Nullable public V get(K key) { return this.mappings.get(key); } + /** + * Returns the value registered by the given key or the default value + * specified if null. + * + * @param key the key + * @param defaultValue the default value + * @return the value registered by the given key or the default value + * specified if null. + */ public V getOrDefault(K key, V defaultValue) { return this.mappings.getOrDefault(key, defaultValue); } + /** + * Registers a new value into this registry with the given key. + * + * @param key the key + * @param value the value + * @return a new value into this registry with the given key. + */ public V register(K key, V value) { return this.mappings.put(key, value); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java index bc92f4b93..0b5b2bf8d 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java @@ -36,6 +36,9 @@ import org.geysermc.connector.registry.populator.BlockRegistryPopulator; import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.registry.type.BlockMappings; +/** + * Holds all the block registries in Geyser. + */ public class BlockRegistries { public static final VersionedRegistry BLOCKS = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); diff --git a/connector/src/main/java/org/geysermc/connector/registry/MappedRegistry.java b/connector/src/main/java/org/geysermc/connector/registry/MappedRegistry.java index 41d831f98..523024ab3 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/MappedRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/MappedRegistry.java @@ -30,28 +30,78 @@ import org.geysermc.connector.registry.loader.RegistryLoader; import java.util.Map; import java.util.function.Supplier; -public class MappedRegistry> extends AbstractMappedRegistry { - protected MappedRegistry(I input, RegistryLoader registryLoader) { +/** + * An public registry holding a map of various registrations as defined by {@link M}. + * The M represents the map class, which can be anything that extends {@link Map}. The + * {@link K} and {@link V} generics are the key and value respectively. + * + * @param the key + * @param the value + * @param the map + */ +public class MappedRegistry> extends AbstractMappedRegistry { + protected MappedRegistry(I input, RegistryLoader registryLoader) { super(input, registryLoader); } - public static > MappedRegistry createEmpty() { - return new MappedRegistry<>(null, input -> null); - } - - public static > MappedRegistry create(RegistryLoader registryLoader) { + /** + * Creates a new mapped registry with the given {@link RegistryLoader}. The + * input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader + * @param the input + * @param the map key + * @param the map value + * @param the returned mappings type, a map in this case + * @return a new registry with the given RegistryLoader + */ + public static > MappedRegistry create(RegistryLoader registryLoader) { return new MappedRegistry<>(null, registryLoader); } - public static > MappedRegistry create(I input, RegistryLoader registryLoader) { + /** + * Creates a new mapped registry with the given {@link RegistryLoader} and input. + * + * @param input the input + * @param registryLoader the registry loader + * @param the input + * @param the map key + * @param the map value + * @param the returned mappings type, a map in this case + * @return a new registry with the given RegistryLoader + */ + public static > MappedRegistry create(I input, RegistryLoader registryLoader) { return new MappedRegistry<>(input, registryLoader); } - public static > MappedRegistry create(Supplier> registryLoader) { + /** + * Creates a new mapped registry with the given {@link RegistryLoader} supplier. + * The input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader supplier + * @param the input + * @param the map key + * @param the map value + * @param the returned mappings type, a map in this case + * @return a new registry with the given RegistryLoader supplier + */ + public static > MappedRegistry create(Supplier> registryLoader) { return new MappedRegistry<>(null, registryLoader.get()); } - public static > MappedRegistry create(I input, Supplier> registryLoader) { + /** + * Creates a new mapped registry with the given {@link RegistryLoader} and input. + * + * @param registryLoader the registry loader + * @param the input + * @param the map key + * @param the map value + * @param the returned mappings type, a map in this case + * @return a new registry with the given RegistryLoader supplier + */ + public static > MappedRegistry create(I input, Supplier> registryLoader) { return new MappedRegistry<>(input, registryLoader.get()); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 6a0498a79..e3adb2e16 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -52,6 +52,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +/** + * Holds all the common registries in Geyser. + */ public class Registries { public static final SimpleRegistry BIOMES = SimpleRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT); diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registry.java b/connector/src/main/java/org/geysermc/connector/registry/Registry.java index ca3d22373..0e999442f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registry.java @@ -29,17 +29,71 @@ import org.geysermc.connector.registry.loader.RegistryLoader; import java.util.function.Consumer; +/** + * A wrapper around a value which is loaded based on the output from the provided + * {@link RegistryLoader}. This class is primarily designed to hold a registration + * of some kind, however no limits are set on what it can hold, as long as the + * specified RegistryLoader returns the same value type that is specified in the + * generic. + * + *

+ * Below, a RegistryLoader is taken in the constructor. RegistryLoaders have two + * generic types: the input, and the output. The input is what it takes in, whether + * it be a string which references to a file, or nothing more than an integer. The + * output is what it generates based on the input, and should be the same type as + * the {@link M} generic specified in the registry. + * + *

+ * Registries can be very simple to create. Here is an example that simply parses a + * number given a string: + * + *

+ * {@code
+ *     public static final SimpleRegistry STRING_TO_INT = SimpleRegistry.create("5", Integer::parseInt);
+ * }
+ * 
+ * + *

+ * This is a simple example which really wouldn't have much of a practical use, + * however it demonstrates a fairly basic use case of how this system works. Typically + * though, the first parameter would be a location of some sort, such as a file path + * where the loader will load the mappings from. The NBT registry is a good reference + * point for something both simple and practical. See {@link Registries#BIOMES} and + * {@link org.geysermc.connector.registry.loader.NbtRegistryLoader}. + * + * @param the value being held by the registry + */ public abstract class Registry { protected final M mappings; + /** + * Creates a new instance of this class with the given input and + * {@link RegistryLoader}. The input specified is what the registry + * loader needs to take in. + * + * @param input the input + * @param registryLoader the registry loader + * @param the input type + */ protected Registry(I input, RegistryLoader registryLoader) { this.mappings = registryLoader.load(input); } + /** + * Gets the underlying value held by this registry. + * + * @return the underlying value held by this registry. + */ public M get() { return this.mappings; } + /** + * Registers what is specified in the given + * {@link Consumer} into the underlying value. + * + * @param consumer the consumer + */ public void register(Consumer consumer) { consumer.accept(this.mappings); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java b/connector/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java index 1188b3590..938450014 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java @@ -30,23 +30,72 @@ import org.geysermc.connector.registry.loader.RegistryLoader; import java.util.Map; import java.util.function.Supplier; +/** + * A variant of {@link AbstractMappedRegistry} with {@link Map} as the defined type. Unlike + * {@link MappedRegistry}, this registry does not support specifying your own Map class, + * and only permits operations the {@link Map} interface does, unless you manually cast. + * + * @param the key + * @param the value + */ public class SimpleMappedRegistry extends AbstractMappedRegistry> { protected SimpleMappedRegistry(I input, RegistryLoader> registryLoader) { super(input, registryLoader); } + /** + * Creates a new mapped registry with the given {@link RegistryLoader}. The + * input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader + * @param the input + * @param the map key + * @param the map value + * @return a new registry with the given RegistryLoader + */ public static SimpleMappedRegistry create(RegistryLoader> registryLoader) { return new SimpleMappedRegistry<>(null, registryLoader); } + /** + * Creates a new mapped registry with the given {@link RegistryLoader} and input. + * + * @param input the input + * @param registryLoader the registry loader + * @param the input + * @param the map key + * @param the map value + * @return a new registry with the given RegistryLoader + */ public static SimpleMappedRegistry create(I input, RegistryLoader> registryLoader) { return new SimpleMappedRegistry<>(input, registryLoader); } + /** + * Creates a new mapped registry with the given {@link RegistryLoader} supplier. + * The input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader supplier + * @param the input + * @param the map key + * @param the map value + * @return a new registry with the given RegistryLoader supplier + */ public static SimpleMappedRegistry create(Supplier>> registryLoader) { return new SimpleMappedRegistry<>(null, registryLoader.get()); } + /** + * Creates a new mapped registry with the given {@link RegistryLoader} and input. + * + * @param registryLoader the registry loader + * @param the input + * @param the map key + * @param the map value + * @return a new registry with the given RegistryLoader supplier + */ public static SimpleMappedRegistry create(I input, Supplier>> registryLoader) { return new SimpleMappedRegistry<>(input, registryLoader.get()); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java b/connector/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java index 1bea97954..16bf24f79 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java @@ -29,23 +29,69 @@ import org.geysermc.connector.registry.loader.RegistryLoader; import java.util.function.Supplier; +/** + * A simple registry with no defined mapping or input type. Designed to allow + * for simple registrations of any given type without restrictions on what + * the input or output can be. + * + * @param the value being held by the registry + */ public class SimpleRegistry extends Registry { private SimpleRegistry(I input, RegistryLoader registryLoader) { super(input, registryLoader); } + /** + * Creates a new registry with the given {@link RegistryLoader} supplier. The + * input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader supplier + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ public static SimpleRegistry create(Supplier> registryLoader) { return new SimpleRegistry<>(null, registryLoader.get()); } + /** + * Creates a new registry with the given {@link RegistryLoader} supplier + * and input. + * + * @param input the input + * @param registryLoader the registry loader supplier + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ public static SimpleRegistry create(I input, Supplier> registryLoader) { return new SimpleRegistry<>(input, registryLoader.get()); } + /** + * Creates a new registry with the given {@link RegistryLoader}. The + * input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ public static SimpleRegistry create(RegistryLoader registryLoader) { return new SimpleRegistry<>(null, registryLoader); } + /** + * Creates a new registry with the given {@link RegistryLoader} and input. + * + * @param input the input + * @param registryLoader the registry loader + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ public static SimpleRegistry create(I input, RegistryLoader registryLoader) { return new SimpleRegistry<>(input, registryLoader); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java b/connector/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java index 7bdc372ed..91b969df3 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java @@ -28,13 +28,32 @@ package org.geysermc.connector.registry; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import org.geysermc.connector.registry.loader.RegistryLoader; +import java.util.Map; import java.util.function.Supplier; +/** + * A versioned, mapped registry. Like {@link SimpleMappedRegistry}, the {@link Map} interface is + * not able to be specified here, but unlike it, it does not have support for specialized + * instances, and ONLY supports {@link Int2ObjectMap} for optimal performance to prevent boxing + * of integers. + * + * @param the value + */ public class VersionedRegistry extends AbstractMappedRegistry> { protected VersionedRegistry(I input, RegistryLoader> registryLoader) { super(input, registryLoader); } + /** + * Gets the closest value for the specified version. Only + * returns versions higher up than the specified if one + * does not exist for the given one. Useful in the event + * that you want to get a resource which is guaranteed for + * older versions, but not on newer ones. + * + * @param version the version + * @return the closest value for the specified version + */ public V forVersion(int version) { V value = null; for (Int2ObjectMap.Entry entry : this.mappings.int2ObjectEntrySet()) { @@ -49,18 +68,54 @@ public class VersionedRegistry extends AbstractMappedRegistry the input + * @param the map value + * @return a new registry with the given RegistryLoader + */ public static VersionedRegistry create(RegistryLoader> registryLoader) { return new VersionedRegistry<>(null, registryLoader); } + /** + * Creates a new versioned registry with the given {@link RegistryLoader} and input. + * + * @param registryLoader the registry loader + * @param the input + * @param the map value + * @return a new registry with the given RegistryLoader + */ public static VersionedRegistry create(I input, RegistryLoader> registryLoader) { return new VersionedRegistry<>(input, registryLoader); } + /** + * Creates a new versioned registry with the given {@link RegistryLoader} supplier. + * The input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader + * @param the input + * @param the map value + * @return a new registry with the given RegistryLoader supplier + */ public static VersionedRegistry< V> create(Supplier>> registryLoader) { return new VersionedRegistry<>(null, registryLoader.get()); } + /** + * Creates a new versioned registry with the given {@link RegistryLoader} supplier and input. + * + * @param registryLoader the registry loader + * @param the input + * @param the map value + * @return a new registry with the given RegistryLoader supplier + */ public static VersionedRegistry< V> create(I input, Supplier>> registryLoader) { return new VersionedRegistry<>(input, registryLoader.get()); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java index 4f6354af5..483bb773b 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java @@ -34,6 +34,26 @@ import java.lang.annotation.Annotation; import java.util.Map; import java.util.function.Function; +/** + * A mapped registry loader which takes in a {@link String} and returns a transformed + * {@link Annotation} as the value. The {@link R} represents the final result as mapped + * by the {@link A}, the annotation. This function exists in this registry loader for + * the purpose of annotations not often being used as a map key. The {@link V} generic + * represents the actual map value of what is expected. The function transformation done + * is used for transforming the key, however the value is not expected to be transformed. + * + *

+ * Keep in mind that this annotation transforming does NOT need to be done, and can be + * replaced with a simple Function.identity() if not desired. + * + *

+ * See {@link BlockEntityRegistryLoader} and {@link SoundHandlerRegistryLoader} as a + * good example of these registry loaders in use. + * + * @param the final result as transformed by the function + * @param the raw annotation itself can be transformed + * @param the value + */ public class AnnotatedRegistryLoader implements RegistryLoader> { private final Class annotation; private final Function mapper; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java index 6824d611d..a58cca7ca 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java @@ -28,6 +28,9 @@ package org.geysermc.connector.registry.loader; import org.geysermc.connector.network.translators.world.block.entity.BlockEntity; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; +/** + * Loads block entities from the given classpath. + */ public class BlockEntityRegistryLoader extends AnnotatedRegistryLoader { public BlockEntityRegistryLoader() { super(BlockEntity.class, BlockEntity::name); diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java index 70ba8b253..3b342fba8 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java @@ -48,6 +48,9 @@ import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; +/** + * Loads collision data from the given resource path. + */ public class CollisionRegistryLoader extends MultiResourceRegistryLoader> { @Override diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java index 5e9e435f3..0dc5345d1 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java @@ -33,6 +33,11 @@ import java.io.InputStream; import java.util.Map; import java.util.WeakHashMap; +/** + * An abstract registry loader for loading effects from a resource path. + * + * @param the value + */ public abstract class EffectRegistryLoader implements RegistryLoader { private static final Map loadedFiles = new WeakHashMap<>(); diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java index a2bb23696..48076d791 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java @@ -27,5 +27,11 @@ package org.geysermc.connector.registry.loader; import it.unimi.dsi.fastutil.Pair; +/** + * A RegistryLoader that loads data from two different locations, yet with the same input type. + * + * @param the input type + * @param the value + */ public abstract class MultiResourceRegistryLoader implements RegistryLoader, V> { } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java index 773ee1038..b8ec65697 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java @@ -32,6 +32,9 @@ import org.geysermc.connector.utils.FileUtils; import java.io.InputStream; +/** + * Loads NBT data from the given resource path. + */ public class NbtRegistryLoader implements RegistryLoader { @Override diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java index 3c3188236..4284506f9 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java @@ -34,6 +34,9 @@ import org.geysermc.connector.registry.type.ParticleMapping; import java.util.Iterator; import java.util.Map; +/** + * Loads particle types from the given resource path. + */ public class ParticleTypesRegistryLoader extends EffectRegistryLoader> { @Override diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java index 495895789..f10b143aa 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java @@ -26,12 +26,22 @@ package org.geysermc.connector.registry.loader; /** - * Represents a registry loader. + * Represents a registry loader. {@link I} is the input value, which can be anything, + * but is commonly a file path or something similar. {@link O} represents the output + * type returned by this, which can also be anything. See {@link NbtRegistryLoader} + * as a good and simple example of how this system works. * * @param the input to load the registry from * @param the output of the registry */ @FunctionalInterface public interface RegistryLoader { + + /** + * Loads an output from the given input. + * + * @param input the input + * @return the output + */ O load(I input); } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java b/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java index 9a9634157..22fe0bb1d 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java @@ -27,10 +27,24 @@ package org.geysermc.connector.registry.loader; import java.util.function.Supplier; +/** + * Holds common {@link RegistryLoader}s or utility methods surrounding them. + */ public class RegistryLoaders { + /** + * The {@link RegistryLoader} responsible for loading NBT. + */ public static NbtRegistryLoader NBT = new NbtRegistryLoader(); - public static RegistryLoader empty(Supplier value) { - return input -> value.get(); + /** + * Wraps the surrounding {@link Supplier} in a {@link RegistryLoader} which does + * not take in any input value. + * + * @param supplier the supplier + * @param the value + * @return a RegistryLoader wrapping the given Supplier + */ + public static RegistryLoader empty(Supplier supplier) { + return input -> supplier.get(); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java index 8103ece8b..22070ee7a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java @@ -39,6 +39,9 @@ import org.geysermc.connector.network.translators.effect.SoundLevelEffect; import java.util.Iterator; import java.util.Map; +/** + * Loads sound effects from the given resource path. + */ public class SoundEffectsRegistryLoader extends EffectRegistryLoader> { @Override diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java index 42c10c2ce..110cd2c3b 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java @@ -30,6 +30,9 @@ import org.geysermc.connector.network.translators.sound.SoundInteractionHandler; import java.util.function.Function; +/** + * Loads sound handlers from the given classpath. + */ public class SoundHandlerRegistryLoader extends AnnotatedRegistryLoader> { public SoundHandlerRegistryLoader() { super(SoundHandler.class, Function.identity()); diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java index 4dc1dab58..b78947189 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java @@ -36,11 +36,14 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +/** + * Loads sounds from the given input. + */ public class SoundRegistryLoader implements RegistryLoader> { @Override public Map load(String input) { - InputStream stream = FileUtils.getResource("mappings/sounds.json"); + InputStream stream = FileUtils.getResource(input); JsonNode soundsTree; try { soundsTree = GeyserConnector.JSON_MAPPER.readTree(stream); diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 305e89a15..c119967fa 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -52,6 +52,9 @@ import java.util.Map; import java.util.function.BiFunction; import java.util.zip.GZIPInputStream; +/** + * Populates the block registries. + */ public class BlockRegistryPopulator { private static final ImmutableMap> STATE_MAPPER; diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 4715b6915..d495121c6 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -57,6 +57,9 @@ import java.io.IOException; import java.io.InputStream; import java.util.*; +/** + * Populates the item registries. + */ public class ItemRegistryPopulator { private static final Map PALETTE_VERSIONS; diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java index 97eeccece..4533ecc6a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java @@ -54,6 +54,9 @@ import java.util.*; import static org.geysermc.connector.utils.InventoryUtils.LAST_RECIPE_NET_ID; +/** + * Populates the recipe registry. + */ public class RecipeRegistryPopulator { public static void populate() { From ef7c6732767151d958e2192dc2bd167a3e0d139e Mon Sep 17 00:00:00 2001 From: Redned Date: Wed, 21 Jul 2021 21:39:30 -0500 Subject: [PATCH 505/766] Properly use CompleteableFuture for MSA auth --- .../network/session/GeyserSession.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index f9ae137bf..df2e3767c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -609,28 +609,31 @@ public class GeyserSession implements CommandSender { } loggingIn = true; + + // This just looks cool + SetTimePacket packet = new SetTimePacket(); + packet.setTime(16000); + sendUpstreamPacket(packet); + // new thread so clients don't timeout - new Thread(() -> { + MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); + + // Use a future to prevent timeouts as all the authentication is handled sync + // This will be changed with the new protocol library. + CompletableFuture.supplyAsync(() -> { try { - MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); - - MsaAuthenticationService.MsCodeResponse response = msaAuthenticationService.getAuthCode(); - LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response); - - // This just looks cool - SetTimePacket packet = new SetTimePacket(); - packet.setTime(16000); - sendUpstreamPacket(packet); - - // Wait for the code to validate - attemptCodeAuthentication(msaAuthenticationService); - } catch (InvalidCredentialsException | IllegalArgumentException e) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", getAuthData().getName())); - disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); - } catch (RequestException ex) { - ex.printStackTrace(); + return msaAuthenticationService.getAuthCode(); + } catch (RequestException e) { + throw new CompletionException(e); } - }).start(); + }).whenComplete((response, ex) -> { + if (ex != null) { + ex.printStackTrace(); + return; + } + LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response); + attemptCodeAuthentication(msaAuthenticationService); + }); } /** From 0e308953026ea63fa5dca864f8af7462c102ce60 Mon Sep 17 00:00:00 2001 From: Redned Date: Wed, 21 Jul 2021 22:18:31 -0500 Subject: [PATCH 506/766] More registry documentation, and remove unneeded clean identifiers registry --- .../connector/registry/BlockRegistries.java | 19 ++++++++- .../connector/registry/Registries.java | 42 +++++++++++++++++++ .../populator/BlockRegistryPopulator.java | 8 +++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java index 19dd40ee4..58735a2b8 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java @@ -39,16 +39,31 @@ import org.geysermc.connector.utils.Object2IntBiMap; * Holds all the block registries in Geyser. */ public class BlockRegistries { + /** + * A versioned registry which holds {@link BlockMappings} for each version. These block mappings contain + * primarily Bedrock version-specific data. + */ public static final VersionedRegistry BLOCKS = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A mapped registry which stores Java to Bedrock block identifiers. + */ public static final SimpleMappedRegistry JAVA_TO_BEDROCK_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new)); + /** + * A mapped registry which stores Java IDs to {@link BlockMapping}, containing miscellaneous information about + * blocks and their behavior in many cases. + */ public static final SimpleMappedRegistry JAVA_BLOCKS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A (bi)mapped registry containing the Java IDs to identifiers. + */ public static final MappedRegistry> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(Object2IntBiMap::new)); - public static final SimpleMappedRegistry JAVA_CLEAN_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); - + /** + * A registry containing all the waterlogged blockstates. + */ public static final SimpleRegistry WATERLOGGED = SimpleRegistry.create(RegistryLoaders.empty(IntOpenHashSet::new)); static { diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 5ad14cb5a..5cd2e4806 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -56,30 +56,72 @@ import java.util.Set; * Holds all the common registries in Geyser. */ public class Registries { + /** + * A registry holding a CompoundTag of all the known biomes. + */ public static final SimpleRegistry BIOMES = SimpleRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT); + /** + * A mapped registry which stores a block entity identifier to its {@link BlockEntityTranslator}. + */ public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); + /** + * A mapped registry containing which holds block IDs to its {@link BlockCollision}. + */ public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.connector.network.translators.collision.translators.Translator", "mappings/collision.json"), CollisionRegistryLoader::new); + /** + * A versioned registry which holds a {@link RecipeType} to a corresponding list of {@link CraftingData}. + */ public static final VersionedRegistry>> CRAFTING_DATA = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A registry holding a CompoundTag of the known entity identifiers. + */ public static final SimpleRegistry ENTITY_IDENTIFIERS = SimpleRegistry.create("bedrock/entity_identifiers.dat", RegistryLoaders.NBT); + /** + * A versioned registry which holds {@link ItemMappings} for each version. These item mappings contain + * primarily Bedrock version-specific data. + */ public static final VersionedRegistry ITEMS = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A mapped registry holding the {@link ParticleType} to a corresponding {@link ParticleMapping}, containing various pieces of + * data primarily for how Bedrock should handle the particle. + */ public static final SimpleMappedRegistry PARTICLES = SimpleMappedRegistry.create("mappings/particles.json", ParticleTypesRegistryLoader::new); + /** + * A registry holding all the potion mixes. + */ public static final SimpleRegistry> POTION_MIXES; + /** + * A versioned registry holding all the recipes, with the net ID being the key, and {@link Recipe} as the value. + */ public static final VersionedRegistry> RECIPES = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A mapped registry holding the available records, with the ID of the record being the key, and the {@link SoundEvent} + * as the value. + */ public static final SimpleMappedRegistry RECORDS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A mapped registry holding sound identifiers to their corresponding {@link SoundMapping}. + */ public static final SimpleMappedRegistry SOUNDS = SimpleMappedRegistry.create("mappings/sounds.json", SoundRegistryLoader::new); + /** + * A mapped registry holding {@link SoundEffect}s to their corresponding {@link Effect}. + */ public static final SimpleMappedRegistry SOUND_EFFECTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEffectsRegistryLoader::new); + /** + * A mapped registry holding {@link SoundHandler}s to their corresponding {@link SoundInteractionHandler}. + */ public static final SimpleMappedRegistry> SOUND_HANDLERS = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.sound.SoundHandler", SoundHandlerRegistryLoader::new); public static void init() { diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index c119967fa..8ebee1918 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -47,7 +47,9 @@ import org.geysermc.connector.utils.FileUtils; import java.io.DataInputStream; import java.io.InputStream; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.function.BiFunction; import java.util.zip.GZIPInputStream; @@ -235,6 +237,8 @@ public class BlockRegistryPopulator { throw new AssertionError("Unable to load Java block mappings", e); } + List cleanIdentifiers = new ArrayList<>(); + int javaRuntimeId = -1; int bellBlockId = -1; int cobwebBlockId = -1; @@ -278,9 +282,9 @@ public class BlockRegistryPopulator { String cleanJavaIdentifier = BlockUtils.getCleanIdentifier(entry.getKey()); String bedrockIdentifier = entry.getValue().get("bedrock_identifier").asText(); - if (!BlockRegistries.JAVA_CLEAN_IDENTIFIERS.get().containsValue(cleanJavaIdentifier)) { + if (!cleanIdentifiers.contains(cleanJavaIdentifier)) { uniqueJavaId++; - BlockRegistries.JAVA_CLEAN_IDENTIFIERS.register(uniqueJavaId, cleanJavaIdentifier); + cleanIdentifiers.add(cleanJavaIdentifier); } builder.javaIdentifier(javaId); From c3f65b176d2eb68b47e6ab7e18d10331b5478369 Mon Sep 17 00:00:00 2001 From: Redned Date: Wed, 21 Jul 2021 22:31:54 -0500 Subject: [PATCH 507/766] Tweak README - Geyser is fine on production and has been for a while :) --- README.md | 2 +- .../registry/populator/BlockRegistryPopulator.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f14506f0c..532e6b2c1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Geyser is an open collaboration project by [CubeCraft Games](https://cubecraft.n ## What is Geyser? Geyser is a proxy, bridging the gap between Minecraft: Bedrock Edition and Minecraft: Java Edition servers. -The ultimate goal of this project is to allow Minecraft: Bedrock Edition users to join Minecraft: Java Edition servers as seamlessly as possible. **Please note, this project is still a work in progress and should not be used on production. Expect bugs!** +The ultimate goal of this project is to allow Minecraft: Bedrock Edition users to join Minecraft: Java Edition servers as seamlessly as possible. However, due to the nature of Geyser translating packets over the network of two different games, *do not expect everything to work perfectly!* Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here! diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 8ebee1918..233e11669 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -47,10 +47,10 @@ import org.geysermc.connector.utils.FileUtils; import java.io.DataInputStream; import java.io.InputStream; -import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; -import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.BiFunction; import java.util.zip.GZIPInputStream; @@ -237,7 +237,7 @@ public class BlockRegistryPopulator { throw new AssertionError("Unable to load Java block mappings", e); } - List cleanIdentifiers = new ArrayList<>(); + Set cleanIdentifiers = new HashSet<>(); int javaRuntimeId = -1; int bellBlockId = -1; From 11f048a065c38e4eb38717d9dfad5d0f4b6a8346 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 22 Jul 2021 09:16:19 -0400 Subject: [PATCH 508/766] Better logic for item updating on item entities Specifically created to address InteractionVisualizer updating all metadata properties when updating the nametag - this commit prevents the item from jumping on updating. It also prevents the entity from being respawned if just the stack size updated. --- .../geysermc/connector/entity/ItemEntity.java | 25 ++++++++++++++++--- .../translators/item/ItemTranslator.java | 2 ++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java index 3dcfb0d93..ba354c525 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java @@ -29,9 +29,11 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; +import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; @@ -115,9 +117,26 @@ public class ItemEntity extends ThrowableEntity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { if (entityMetadata.getId() == 8) { - item = ItemTranslator.translateToBedrock(session, (ItemStack) entityMetadata.getValue()); - despawnEntity(session); - spawnEntity(session); + ItemData item = ItemTranslator.translateToBedrock(session, (ItemStack) entityMetadata.getValue()); + if (this.item == null) { + this.item = item; + spawnEntity(session); + } else if (item.equals(this.item, false, true, true)) { + // Don't bother respawning the entity if items are equal + if (this.item.getCount() != item.getCount()) { + // Just item count updated; let's make this easy + this.item = item; + EntityEventPacket packet = new EntityEventPacket(); + packet.setRuntimeEntityId(geyserId); + packet.setType(EntityEventType.UPDATE_ITEM_STACK_SIZE); + packet.setData(this.item.getCount()); + session.sendUpstreamPacket(packet); + } + } else { + this.item = item; + despawnEntity(session); + spawnEntity(session); + } } super.updateBedrockMetadata(entityMetadata, session); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index 0fdfc3cc7..497ef831f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -44,6 +44,7 @@ import org.geysermc.connector.registry.type.ItemMappings; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LocaleUtils; +import javax.annotation.Nonnull; import java.util.*; import java.util.stream.Collectors; @@ -125,6 +126,7 @@ public abstract class ItemTranslator { return itemStack; } + @Nonnull public static ItemData translateToBedrock(GeyserSession session, ItemStack stack) { if (stack == null) { return ItemData.AIR; From 070ff4655834fe8b810f22a81c9154c508ff3bf0 Mon Sep 17 00:00:00 2001 From: Redned Date: Thu, 22 Jul 2021 08:31:54 -0500 Subject: [PATCH 509/766] Exclude processor file Geyser was attempting to run it's annotation processors on projects that used it as a dependency, so let's just not :) --- connector/pom.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/connector/pom.xml b/connector/pom.xml index e6cc1c302..04cc2c117 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -248,6 +248,16 @@ + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + **/services/javax.annotation.processing.Processor + + + pl.project13.maven git-commit-id-plugin From f16f91f469b3d160e1838f13f62268cc692f9131 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 23 Jul 2021 19:51:46 -0400 Subject: [PATCH 510/766] Check for outdated Java versions older than 16 --- .../geysermc/connector/GeyserConnector.java | 31 +++++++++++++++++++ connector/src/main/resources/languages | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 173e41573..1d5cd3f81 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -379,9 +379,40 @@ public class GeyserConnector { logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn")); } + checkForOutdatedJava(); + newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); } + private void checkForOutdatedJava() { + final int supportedJavaVersion = 16; + // Taken from Paper + String javaVersion = System.getProperty("java.version"); + Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion); + if (!matcher.find()) { + getLogger().debug("Could not parse Java version string " + javaVersion); + return; + } + + String version = matcher.group(1); + int majorVersion; + try { + majorVersion = Integer.parseInt(version); + } catch (NumberFormatException e) { + getLogger().debug("Could not format as an int: " + version); + return; + } + + if (majorVersion < supportedJavaVersion) { + getLogger().warning("*********************************************"); + getLogger().warning(""); + getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_java.header")); + getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_java.message", supportedJavaVersion, javaVersion)); + getLogger().warning(""); + getLogger().warning("*********************************************"); + } + } + public void shutdown() { bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); shuttingDown = true; diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index c8923b1f7..d0cbd4b61 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit c8923b1f71c7f66621729be47dec7f911606c6a1 +Subproject commit d0cbd4b616be6c057115fdb13d75866b8452893e From e8408287631db4f3f236b6b219507e4ff4477de5 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 23 Jul 2021 20:11:50 -0400 Subject: [PATCH 511/766] Update the outdated strings to be more concise --- .../command/defaults/VersionCommand.java | 9 ++++++--- .../connector/network/BedrockProtocol.java | 17 ++++++++++++++++- .../network/UpstreamPacketHandler.java | 9 +++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java index 48026e84e..989ba3306 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java @@ -63,7 +63,8 @@ public class VersionCommand extends GeyserCommand { bedrockVersions = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion(); } - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions)); + sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), + GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) { @@ -72,14 +73,16 @@ public class VersionCommand extends GeyserCommand { Properties gitProp = new Properties(); gitProp.load(FileUtils.getResource("git.properties")); - String buildXML = WebUtils.getBody("https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/" + URLEncoder.encode(gitProp.getProperty("git.branch"), StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber"); + String buildXML = WebUtils.getBody("https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/" + + URLEncoder.encode(gitProp.getProperty("git.branch"), StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber"); if (buildXML.startsWith("")) { int latestBuildNum = Integer.parseInt(buildXML.replaceAll("<(\\\\)?(/)?buildNumber>", "").trim()); int buildNum = Integer.parseInt(gitProp.getProperty("git.build.number")); if (latestBuildNum == buildNum) { sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.no_updates", sender.getLocale())); } else { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.outdated", sender.getLocale(), (latestBuildNum - buildNum), "https://ci.geysermc.org/")); + sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.outdated", + sender.getLocale(), (latestBuildNum - buildNum), "https://ci.geysermc.org/")); } } else { throw new AssertionError("buildNumber missing"); diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java index d5f163c7a..04ef7412c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java @@ -32,6 +32,7 @@ import org.geysermc.connector.GeyserConnector; import java.util.ArrayList; import java.util.List; +import java.util.StringJoiner; /** * Contains information about the supported Bedrock protocols in Geyser. @@ -49,7 +50,9 @@ public class BedrockProtocol { static { if (!GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v440.V440_CODEC); + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v440.V440_CODEC.toBuilder() + .minecraftVersion("1.17.0/1.17.1/1.17.2") + .build()); } SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC); } @@ -67,4 +70,16 @@ public class BedrockProtocol { } return null; } + + /** + * @return a string showing all supported versions for this Geyser instance + */ + public static String getAllSupportedVersions() { + StringJoiner joiner = new StringJoiner(", "); + for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) { + joiner.add(packetCodec.getMinecraftVersion()); + } + + return joiner.toString(); + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 1c95bda6c..9213579ed 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -56,14 +56,15 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { public boolean handle(LoginPacket loginPacket) { BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(loginPacket.getProtocolVersion()); if (packetCodec == null) { + String supportedVersions = BedrockProtocol.getAllSupportedVersions(); if (loginPacket.getProtocolVersion() > BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { // Too early to determine session locale - session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion())); - session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion())); + session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); + session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); return true; } else if (loginPacket.getProtocolVersion() < BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { - session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion())); - session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion())); + session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); + session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); return true; } } From 1b3191fd02b88fca6bac9409c068f56be57a7110 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 23 Jul 2021 20:16:02 -0400 Subject: [PATCH 512/766] Update languages submodule --- connector/src/main/resources/languages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index d0cbd4b61..3221de4b3 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit d0cbd4b616be6c057115fdb13d75866b8452893e +Subproject commit 3221de4b3a7f952638c6256d4e248b7f308d8c24 From da66a01a9a412f9a22ee5896bb54b96b0b0d03e4 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 23 Jul 2021 21:28:28 -0400 Subject: [PATCH 513/766] Fix possible NullPointerException in handling CanBreak/CanDestroy items --- .../connector/network/translators/item/ItemTranslator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index 497ef831f..ec55bc48c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -202,7 +202,7 @@ public abstract class ItemTranslator { if (!block.startsWith("minecraft:")) block = "minecraft:" + block; // Get the Bedrock identifier of the item and replace it. // This will unfortunately be limited - for example, beds and banners will be translated weirdly - canModifyBedrock[i] = BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.get(block).replace("minecraft:", ""); + canModifyBedrock[i] = BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.getOrDefault(block, block).replace("minecraft:", ""); } } return canModifyBedrock; From a93f3119f620cba35b22b394c8121286c39485d8 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 23 Jul 2021 21:42:08 -0400 Subject: [PATCH 514/766] Map bamboo jungle [hills] to their Bedrock ID --- .../java/org/geysermc/connector/utils/BiomeUtils.java | 10 ++++++---- .../java/org/geysermc/connector/utils/ChunkUtils.java | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java index db9edacb4..da557ea57 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java @@ -71,12 +71,14 @@ public class BiomeUtils { private static int biomeID(int[] biomeData, int x, int y, int z) { int biomeId = biomeData[((y >> 2) & 63) << 4 | ((z >> 2) & 3) << 2 | ((x >> 2) & 3)]; - if (biomeId == 0) { - biomeId = 42; // Ocean - } else if (biomeId >= 40 && biomeId <= 43) { // Java has multiple End dimensions that Bedrock doesn't recognize + if (biomeId >= 40 && biomeId <= 43) { // Java has multiple End dimensions that Bedrock doesn't recognize biomeId = 9; - } else if (biomeId >= 170) { // Nether biomes. Dunno why it's like this :microjang: + } else if (biomeId >= 170 && biomeId <= 173) { // 1.16 nether biomes. Dunno why it's like this :microjang: biomeId += 8; + } else if (biomeId == 168) { // Bamboo jungle + biomeId = 48; + } else if (biomeId == 169) { // Bamboo jungle hills + biomeId = 49; } return biomeId; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 4708ed2d2..528fdbdf6 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -107,6 +107,8 @@ public class ChunkUtils { byteBuf.writeBytes(EMPTY_BIOME_DATA); } + byteBuf.writeByte(0); // Border + EMPTY_CHUNK_DATA = new byte[byteBuf.readableBytes()]; byteBuf.readBytes(EMPTY_CHUNK_DATA); } finally { From c6589136bf25fe719234b32541aa85521566d7e3 Mon Sep 17 00:00:00 2001 From: David Choo Date: Sat, 24 Jul 2021 10:35:23 -0400 Subject: [PATCH 515/766] Fix movement against spawners (#2409) --- .../collision/translators/BlockCollision.java | 55 +++++++++---------- .../translators/SpawnerCollision.java | 37 +++++++++++++ 2 files changed, 64 insertions(+), 28 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java index 573a55644..7847869ab 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java @@ -54,6 +54,11 @@ public class BlockCollision { @EqualsAndHashCode.Exclude protected double pushUpTolerance = 1; + /** + * This is used to control the maximum distance a face of a bounding box can push the player away + */ + protected double pushAwayTolerance = CollisionManager.COLLISION_TOLERANCE * 1.1; + public void setPosition(int x, int y, int z) { this.x = x; this.y = y; @@ -95,44 +100,38 @@ public class BlockCollision { // This check doesn't allow players right up against the block, so they must be pushed slightly away if (b.checkIntersection(x, y, z, playerCollision)) { Vector3d relativePlayerPosition = Vector3d.from(playerCollision.getMiddleX() - x, - playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2) - y, + playerCollision.getMiddleY() - y, playerCollision.getMiddleZ() - z); - Vector3d northFacePos = Vector3d.from(b.getMiddleX(), - b.getMiddleY(), - b.getMiddleZ() - (b.getSizeZ() / 2)); - - Vector3d southFacePos = Vector3d.from(b.getMiddleX(), - b.getMiddleY(), - b.getMiddleZ() + (b.getSizeZ() / 2)); - - Vector3d eastFacePos = Vector3d.from(b.getMiddleX() + (b.getSizeX() / 2), - b.getMiddleY(), - b.getMiddleZ()); - - Vector3d westFacePos = Vector3d.from(b.getMiddleX() - (b.getSizeX() / 2), - b.getMiddleY(), - b.getMiddleZ()); - - double translateDistance = northFacePos.getZ() - relativePlayerPosition.getZ() - (playerCollision.getSizeZ() / 2); - if (Math.abs(translateDistance) < CollisionManager.COLLISION_TOLERANCE * 1.1) { - playerCollision.translate(0, 0, translateDistance); - } - - translateDistance = southFacePos.getZ() - relativePlayerPosition.getZ() + (playerCollision.getSizeZ() / 2); - if (Math.abs(translateDistance) < CollisionManager.COLLISION_TOLERANCE * 1.1) { + double northFaceZPos = b.getMiddleZ() - (b.getSizeZ() / 2); + double translateDistance = northFaceZPos - relativePlayerPosition.getZ() - (playerCollision.getSizeZ() / 2); + if (Math.abs(translateDistance) < pushAwayTolerance) { playerCollision.translate(0, 0, translateDistance); } - translateDistance = eastFacePos.getX() - relativePlayerPosition.getX() + (playerCollision.getSizeX() / 2); - if (Math.abs(translateDistance) < CollisionManager.COLLISION_TOLERANCE * 1.1) { + double southFaceZPos = b.getMiddleZ() + (b.getSizeZ() / 2); + translateDistance = southFaceZPos - relativePlayerPosition.getZ() + (playerCollision.getSizeZ() / 2); + if (Math.abs(translateDistance) < pushAwayTolerance) { + playerCollision.translate(0, 0, translateDistance); + } + + double eastFaceXPos = b.getMiddleX() + (b.getSizeX() / 2); + translateDistance = eastFaceXPos - relativePlayerPosition.getX() + (playerCollision.getSizeX() / 2); + if (Math.abs(translateDistance) < pushAwayTolerance) { playerCollision.translate(translateDistance, 0, 0); } - translateDistance = westFacePos.getX() - relativePlayerPosition.getX() - (playerCollision.getSizeX() / 2); - if (Math.abs(translateDistance) < CollisionManager.COLLISION_TOLERANCE * 1.1) { + double westFaceXPos = b.getMiddleX() - (b.getSizeX() / 2); + translateDistance = westFaceXPos - relativePlayerPosition.getX() - (playerCollision.getSizeX() / 2); + if (Math.abs(translateDistance) < pushAwayTolerance) { playerCollision.translate(translateDistance, 0, 0); } + + double bottomFaceYPos = b.getMiddleY() - (b.getSizeY() / 2); + translateDistance = bottomFaceYPos - relativePlayerPosition.getY() - (playerCollision.getSizeY() / 2); + if (Math.abs(translateDistance) < pushAwayTolerance) { + playerCollision.translate(0, translateDistance, 0); + } } // Set the collision size back to normal diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java new file mode 100644 index 000000000..6999a12b7 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.collision.translators; + +import org.geysermc.connector.network.translators.collision.CollisionRemapper; + +@CollisionRemapper(regex = "^spawner$") +public class SpawnerCollision extends SolidCollision { + public SpawnerCollision(String params) { + super(params); + // Increase pushAwayTolerance to work around https://bugs.mojang.com/browse/MCPE-41996 + pushAwayTolerance = 0.0002; + } +} From e73b7f59410fea0ff981f52671943ef03f952bce Mon Sep 17 00:00:00 2001 From: Redned Date: Sat, 24 Jul 2021 12:52:28 -0500 Subject: [PATCH 516/766] Use Minecraft color codes in console/logs, clean up log output and fix #1606 TerminalConsoleAppender lets us use the legacy colors on their own, so don't do our own ANSI handling. --- .../standalone/GeyserStandaloneLogger.java | 19 +++++++------------ .../standalone/src/main/resources/log4j2.xml | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java index 64e5b5e86..5255dc16f 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java @@ -36,7 +36,6 @@ import org.geysermc.connector.common.ChatColor; @Log4j2 public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender { - private boolean colored = true; @Override protected boolean isRunning() { @@ -55,41 +54,37 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey @Override public void severe(String message) { - log.fatal(printConsole(ChatColor.DARK_RED + message, colored)); + log.fatal(ChatColor.DARK_RED + message); } @Override public void severe(String message, Throwable error) { - log.fatal(printConsole(ChatColor.DARK_RED + message, colored), error); + log.fatal(ChatColor.DARK_RED + message, error); } @Override public void error(String message) { - log.error(printConsole(ChatColor.RED + message, colored)); + log.error(ChatColor.RED + message); } @Override public void error(String message, Throwable error) { - log.error(printConsole(ChatColor.RED + message, colored), error); + log.error(ChatColor.RED + message, error); } @Override public void warning(String message) { - log.warn(printConsole(ChatColor.YELLOW + message, colored)); + log.warn(ChatColor.YELLOW + message); } @Override public void info(String message) { - log.info(printConsole(ChatColor.RESET + ChatColor.BOLD + message, colored)); + log.info(ChatColor.RESET + message); } @Override public void debug(String message) { - log.debug(printConsole(ChatColor.GRAY + message, colored)); - } - - public static String printConsole(String message, boolean colors) { - return colors ? ChatColor.toANSI(message + ChatColor.RESET) : ChatColor.stripColors(message + ChatColor.RESET); + log.debug(ChatColor.GRAY + message); } @Override diff --git a/bootstrap/standalone/src/main/resources/log4j2.xml b/bootstrap/standalone/src/main/resources/log4j2.xml index 238a27da5..cd101f306 100644 --- a/bootstrap/standalone/src/main/resources/log4j2.xml +++ b/bootstrap/standalone/src/main/resources/log4j2.xml @@ -8,7 +8,7 @@ - + From 46cd26ffae33c6b2cdad66347b4bcdbd4400bbd7 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 25 Jul 2021 10:11:53 -0400 Subject: [PATCH 517/766] Don't cache non-locale assets in the LocaleUtils asset cache Previously Geyser was storing a reference of every single asset hash provided by the server, including things like sound files. We never used this files, and their existence caused the amount of Asset classes present in Geyser to be over 3000. With this change, we only cache the 118 language files. --- .../main/java/org/geysermc/connector/utils/LocaleUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java index bd2bb9370..533e95d4a 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java @@ -98,6 +98,11 @@ public class LocaleUtils { Iterator> assetIterator = assets.fields(); while (assetIterator.hasNext()) { Map.Entry entry = assetIterator.next(); + if (!entry.getKey().startsWith("minecraft/lang/")) { + // No need to cache non-language assets as we don't use them + continue; + } + Asset asset = GeyserConnector.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class); ASSET_MAP.put(entry.getKey(), asset); } From e0e6605fb630595762cdb79f1d5d64c6ab7f7050 Mon Sep 17 00:00:00 2001 From: David Choo Date: Mon, 26 Jul 2021 13:30:48 -0400 Subject: [PATCH 518/766] Improve annotation processing (#2422) --- .../processor/BlockEntityProcessor.java | 2 +- .../geysermc/processor/ClassProcessor.java | 51 +++++++++++++++---- .../processor/CollisionRemapperProcessor.java | 2 +- .../processor/ItemRemapperProcessor.java | 2 +- .../processor/PacketTranslatorProcessor.java | 2 +- .../processor/SoundHandlerProcessor.java | 2 +- 6 files changed, 47 insertions(+), 14 deletions(-) diff --git a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java index 52a6e3aae..ecb69b604 100644 --- a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java @@ -29,7 +29,7 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -@SupportedAnnotationTypes("org.geysermc.connector.network.translators.world.block.entity.BlockEntity") +@SupportedAnnotationTypes("*") @SupportedSourceVersion(SourceVersion.RELEASE_8) public class BlockEntityProcessor extends ClassProcessor { public BlockEntityProcessor() { diff --git a/ap/src/main/java/org/geysermc/processor/ClassProcessor.java b/ap/src/main/java/org/geysermc/processor/ClassProcessor.java index 3531d8794..409306f1f 100644 --- a/ap/src/main/java/org/geysermc/processor/ClassProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/ClassProcessor.java @@ -35,13 +35,14 @@ import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic; import javax.tools.FileObject; import javax.tools.StandardLocation; +import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -50,7 +51,7 @@ public class ClassProcessor extends AbstractProcessor { private Path outputPath; - private final List locations = new ArrayList<>(); + private final Set locations = new HashSet<>(); public ClassProcessor(String annotationClassName) { this.annotationClassName = annotationClassName; @@ -94,7 +95,7 @@ public class ClassProcessor extends AbstractProcessor { TypeElement typeElement = (TypeElement) element; this.locations.add(typeElement.getQualifiedName().toString()); } - return true; + return false; } public boolean contains(Collection elements, String className) { @@ -126,18 +127,50 @@ public class ClassProcessor extends AbstractProcessor { } public void complete() { - try (BufferedWriter writer = this.createWriter()) { - for (String location : this.locations) { - writer.write(location); - writer.newLine(); + // Read existing annotation list and verify each class still has this annotation + try (BufferedReader reader = this.createReader()) { + if (reader != null) { + reader.lines().forEach(canonicalName -> { + if (!locations.contains(canonicalName)) { + TypeElement element = this.processingEnv.getElementUtils().getTypeElement(canonicalName); + if (element != null && element.getKind() == ElementKind.CLASS && contains(element.getAnnotationMirrors(), this.annotationClassName)) { + locations.add(canonicalName); + } + } + }); } - } catch (IOException ex) { - ex.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } + if (!locations.isEmpty()) { + try (BufferedWriter writer = this.createWriter()) { + for (String location : this.locations) { + writer.write(location); + writer.newLine(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } else { + this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Did not find any classes annotated with " + this.annotationClassName); + } this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Completed processing for " + this.annotationClassName); } + private BufferedReader createReader() throws IOException { + if (this.outputPath != null) { + this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Reading existing " + this.annotationClassName + " list from " + this.outputPath); + return Files.newBufferedReader(this.outputPath); + } + FileObject obj = this.processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", this.annotationClassName); + if (obj != null) { + this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Reading existing " + this.annotationClassName + " list from " + obj.toUri()); + return new BufferedReader(obj.openReader(false)); + } + return null; + } + private BufferedWriter createWriter() throws IOException { if (this.outputPath != null) { this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing " + this.annotationClassName + " to " + this.outputPath); diff --git a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java index 3f9111155..dafed179d 100644 --- a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java @@ -29,7 +29,7 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -@SupportedAnnotationTypes("org.geysermc.connector.network.translators.collision.CollisionRemapper") +@SupportedAnnotationTypes("*") @SupportedSourceVersion(SourceVersion.RELEASE_8) public class CollisionRemapperProcessor extends ClassProcessor { public CollisionRemapperProcessor() { diff --git a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java index cbfd939c4..6f146e720 100644 --- a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java @@ -29,7 +29,7 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -@SupportedAnnotationTypes("org.geysermc.connector.network.translators.ItemRemapper") +@SupportedAnnotationTypes("*") @SupportedSourceVersion(SourceVersion.RELEASE_8) public class ItemRemapperProcessor extends ClassProcessor { public ItemRemapperProcessor() { diff --git a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java index cdfbcbe4a..5225c4839 100644 --- a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java @@ -29,7 +29,7 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -@SupportedAnnotationTypes("org.geysermc.connector.network.translators.Translator") +@SupportedAnnotationTypes("*") @SupportedSourceVersion(SourceVersion.RELEASE_8) public class PacketTranslatorProcessor extends ClassProcessor { public PacketTranslatorProcessor() { diff --git a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java index ee4b2ef45..cd0b4a437 100644 --- a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java @@ -29,7 +29,7 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -@SupportedAnnotationTypes("org.geysermc.connector.network.translators.sound.SoundHandler") +@SupportedAnnotationTypes("*") @SupportedSourceVersion(SourceVersion.RELEASE_8) public class SoundHandlerProcessor extends ClassProcessor { public SoundHandlerProcessor() { From 8c96c3b11d0c00c76039782740a73f588860ed15 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 27 Jul 2021 20:29:27 -0400 Subject: [PATCH 519/766] Biome reworkings - Introduce biome mappings for having a constant reference between Java biome identifier and their Bedrock equivalents - Don't assume biome IDs and instead listen to the server for biome IDs - Ensure that only valid Bedrock biomes are sent. With the caves and cliffs experimental toggle, Bedrock will crash if an invalid biome ID is sent its way. --- .../network/session/GeyserSession.java | 14 ++- .../java/JavaJoinGameTranslator.java | 2 + .../java/world/JavaChunkDataTranslator.java | 6 +- .../translators/world/BiomeTranslator.java | 112 ++++++++++++++++++ .../translators/world/chunk/BlockStorage.java | 2 +- .../connector/registry/Registries.java | 8 +- .../geysermc/connector/registry/Registry.java | 2 +- .../loader/BiomeIdentifierRegistryLoader.java | 73 ++++++++++++ .../geysermc/connector/utils/BiomeUtils.java | 85 ------------- connector/src/main/resources/mappings | 2 +- 10 files changed, 210 insertions(+), 96 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java delete mode 100644 connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 8f71e6fa8..355dcedcb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -58,9 +58,7 @@ import com.nukkitx.protocol.bedrock.data.command.CommandPermission; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -143,6 +141,7 @@ public class GeyserSession implements CommandSender { private final PreferencesCache preferencesCache; private final TagCache tagCache; private WorldCache worldCache; + private final Int2ObjectMap teleportMap = new Int2ObjectOpenHashMap<>(); private final PlayerInventory playerInventory; @@ -188,6 +187,13 @@ public class GeyserSession implements CommandSender { private final Map skullCache = new ConcurrentHashMap<>(); private final Long2ObjectMap storedMaps = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>()); + /** + * Stores the differences between Java and Bedrock biome network IDs. + * If Java's ocean biome is 0, and Bedrock's is 0, it will not be in the list. + * If Java's bamboo biome is 42, and Bedrock's is 48, it will be in this list. + */ + private final Int2IntMap biomeTranslations = new Int2IntOpenHashMap(); + /** * A map of Vector3i positions to Java entities. * Used for translating Bedrock block actions to Java entity actions. @@ -503,7 +509,7 @@ public class GeyserSession implements CommandSender { ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false); BiomeDefinitionListPacket biomeDefinitionListPacket = new BiomeDefinitionListPacket(); - biomeDefinitionListPacket.setDefinitions(Registries.BIOMES.get()); + biomeDefinitionListPacket.setDefinitions(Registries.BIOMES_NBT.get()); upstream.sendPacket(biomeDefinitionListPacket); AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index 6b5f63438..e46a1a89c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -39,6 +39,7 @@ import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.world.BiomeTranslator; import org.geysermc.connector.utils.ChunkUtils; import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.PluginMessageUtils; @@ -66,6 +67,7 @@ public class JavaJoinGameTranslator extends PacketTranslator> 2) & 63) << 4 | ((z >> 2) & 3) << 2 | ((x >> 2) & 3)]; + byte biomeId = (byte) biomeTranslations.getOrDefault(javaId, javaId); + int offset = ((z + (y / 4)) << 4) | x; + Arrays.fill(bedrockData, offset, offset + 4, biomeId); + } + } + } + return bedrockData; + } + + public static BlockStorage toNewBedrockBiome(GeyserSession session, int[] biomeData, int ySection) { + Int2IntMap biomeTranslations = session.getBiomeTranslations(); + // As of 1.17.10: the client expects the same format as a chunk but filled with biomes + BlockStorage storage = new BlockStorage(0); + + int biomeY = ySection << 2; + int javaOffsetY = biomeY << 4; + // Each section of biome corresponding to a chunk section contains 4 * 4 * 4 entries + for (int i = 0; i < 64; i++) { + int javaId = biomeData[javaOffsetY | i]; + int x = i & 3; + int y = (i >> 4) & 3; + int z = (i >> 2) & 3; + // Get the Bedrock biome ID override, or this ID if it's the same + int biomeId = biomeTranslations.getOrDefault(javaId, javaId); + int idx = storage.idFor(biomeId); + // Convert biome coordinates into block coordinates + // Bedrock expects a full 4096 blocks + for (int blockX = x << 2; blockX < (x << 2) + 4; blockX++) { + for (int blockZ = z << 2; blockZ < (z << 2) + 4; blockZ++) { + for (int blockY = y << 2; blockY < (y << 2) + 4; blockY++) { + storage.getBitArray().set(ChunkSection.blockPosition(blockX, blockY, blockZ), idx); + } + } + } + } + + return storage; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java index faf8d6dc8..2d027faba 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java @@ -101,7 +101,7 @@ public class BlockStorage { this.bitArray = newBitArray; } - private int idFor(int runtimeId) { + public int idFor(int runtimeId) { // Set to public so we can reuse the palette ID for biomes int index = this.palette.indexOf(runtimeId); if (index != -1) { return index; diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 5cd2e4806..3447bdfc8 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -36,6 +36,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; import org.geysermc.connector.network.translators.effect.Effect; import org.geysermc.connector.network.translators.sound.SoundHandler; @@ -59,7 +60,12 @@ public class Registries { /** * A registry holding a CompoundTag of all the known biomes. */ - public static final SimpleRegistry BIOMES = SimpleRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT); + public static final SimpleRegistry BIOMES_NBT = SimpleRegistry.create("bedrock/biome_definitions.dat", RegistryLoaders.NBT); + + /** + * A mapped registry which stores Java biome identifiers and their Bedrock biome identifier. + */ + public static final SimpleRegistry> BIOME_IDENTIFIERS = SimpleRegistry.create("mappings/biomes.json", BiomeIdentifierRegistryLoader::new); /** * A mapped registry which stores a block entity identifier to its {@link BlockEntityTranslator}. diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registry.java b/connector/src/main/java/org/geysermc/connector/registry/Registry.java index 0e999442f..135e94342 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registry.java @@ -58,7 +58,7 @@ import java.util.function.Consumer; * however it demonstrates a fairly basic use case of how this system works. Typically * though, the first parameter would be a location of some sort, such as a file path * where the loader will load the mappings from. The NBT registry is a good reference - * point for something both simple and practical. See {@link Registries#BIOMES} and + * point for something both simple and practical. See {@link Registries#BIOMES_NBT} and * {@link org.geysermc.connector.registry.loader.NbtRegistryLoader}. * * @param the value being held by the registry diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java new file mode 100644 index 000000000..c38e3efa9 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019-2021 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.connector.registry.loader; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.utils.FileUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +public class BiomeIdentifierRegistryLoader implements RegistryLoader> { + + @Override + public Object2IntMap load(String input) { + // As of Bedrock Edition 1.17.10 with the experimental toggle, any unmapped biome identifier sent to the client + // crashes the client. Therefore, we need to have a list of all valid Bedrock biome IDs with which we can use from. + // The server sends the corresponding Java network IDs, so we don't need to worry about that now. + + // Reference variable for Jackson to read off of + TypeReference> biomeEntriesType = new TypeReference>() { }; + Map biomeEntries; + + try (InputStream stream = FileUtils.getResource("mappings/biomes.json")) { + biomeEntries = GeyserConnector.JSON_MAPPER.readValue(stream, biomeEntriesType); + } catch (IOException e) { + throw new AssertionError("Unable to load Bedrock runtime biomes", e); + } + + Object2IntMap biomes = new Object2IntOpenHashMap<>(); + for (Map.Entry biome : biomeEntries.entrySet()) { + // Java Edition identifier -> Bedrock integer ID + biomes.put(biome.getKey(), biome.getValue().bedrockId); + } + + return biomes; + } + + private static class BiomeEntry { + /** + * The Bedrock network ID for this biome. + */ + @JsonProperty("bedrock_id") + private int bedrockId; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java deleted file mode 100644 index da557ea57..000000000 --- a/connector/src/main/java/org/geysermc/connector/utils/BiomeUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.connector.utils; - -import org.geysermc.connector.network.translators.world.chunk.BlockStorage; - -import java.util.Arrays; - -// Based off of ProtocolSupport's LegacyBiomeData.java: -// https://github.com/ProtocolSupport/ProtocolSupport/blob/b2cad35977f3fcb65bee57b9e14fc9c975f71d32/src/protocolsupport/protocol/typeremapper/legacy/LegacyBiomeData.java -// Array index formula by https://wiki.vg/Chunk_Format -public class BiomeUtils { - public static byte[] toBedrockBiome(int[] biomeData) { - byte[] bedrockData = new byte[256]; - if (biomeData == null) { - return bedrockData; - } - - for (int y = 0; y < 16; y += 4) { - for (int z = 0; z < 16; z += 4) { - for (int x = 0; x < 16; x += 4) { - byte biomeId = (byte) biomeID(biomeData, x, y, z); - int offset = ((z + (y / 4)) << 4) | x; - Arrays.fill(bedrockData, offset, offset + 4, biomeId); - } - } - } - return bedrockData; - } - - public static BlockStorage toNewBedrockBiome(int[] biomeData, int ySection) { - BlockStorage storage = new BlockStorage(0); - int blockY = ySection << 4; - int i = 0; - // Iterate over biomes like a chunk, grab the biome from Java, and add it to Bedrock's biome palette - // Might be able to be optimized by iterating over Java's biome data section?? Unsure. - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - for (int y = blockY; y < (blockY + 16); y++) { - int biomeId = biomeID(biomeData, x, y, z); - storage.setFullBlock(i, biomeId); - i++; - } - } - } - return storage; - } - - private static int biomeID(int[] biomeData, int x, int y, int z) { - int biomeId = biomeData[((y >> 2) & 63) << 4 | ((z >> 2) & 3) << 2 | ((x >> 2) & 3)]; - if (biomeId >= 40 && biomeId <= 43) { // Java has multiple End dimensions that Bedrock doesn't recognize - biomeId = 9; - } else if (biomeId >= 170 && biomeId <= 173) { // 1.16 nether biomes. Dunno why it's like this :microjang: - biomeId += 8; - } else if (biomeId == 168) { // Bamboo jungle - biomeId = 48; - } else if (biomeId == 169) { // Bamboo jungle hills - biomeId = 49; - } - return biomeId; - } -} diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 8351b0f5b..f109d34a3 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 8351b0f5bb6e9a1d614f84e18c91e82288c34bf6 +Subproject commit f109d34a343da0ade6132661839b893859680d91 From a5beebdffab4e3238e13854b1d5fd0a7ece1f066 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 27 Jul 2021 22:52:07 -0400 Subject: [PATCH 520/766] Add best-fit replacement biomes for custom biomes --- .../translators/world/BiomeTranslator.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java index 326c9a6f7..3f22f8bc9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java @@ -50,9 +50,46 @@ public class BiomeTranslator { CompoundTag biomeTag = (CompoundTag) tag; String javaIdentifier = ((StringTag) biomeTag.get("name")).getValue(); - int bedrockId = Registries.BIOME_IDENTIFIERS.get().getOrDefault(javaIdentifier, 0); + int bedrockId = Registries.BIOME_IDENTIFIERS.get().getOrDefault(javaIdentifier, -1); int javaId = ((IntTag) biomeTag.get("id")).getValue(); + if (bedrockId == -1) { + // There is no matching Bedrock variation for this biome; let's set the closest match based on biome category + String category = ((StringTag) ((CompoundTag) biomeTag.get("element")).get("category")).getValue(); + String replacementBiome; + switch (category) { + case "extreme_hills": + replacementBiome = "minecraft:mountains"; + break; + case "icy": + replacementBiome = "minecraft:ice_spikes"; + break; + case "mushroom": + replacementBiome = "minecraft:mushroom_fields"; + break; + case "nether": + replacementBiome = "minecraft:nether_wastes"; + break; + default: + replacementBiome = "minecraft:ocean"; // Typically ID 0 so a good default + break; + case "taiga": + case "jungle": + case "mesa": + case "plains": + case "savanna": + case "the_end": + case "beach": + case "ocean": + case "desert": + case "river": + case "swamp": + replacementBiome = "minecraft:" + category; + break; + } + bedrockId = Registries.BIOME_IDENTIFIERS.get().getInt(replacementBiome); + } + if (javaId != bedrockId) { // When we see the Java ID, we should instead apply the Bedrock ID biomeTranslations.put(javaId, bedrockId); From 4241b5463f158e473b38807908b724845db5bb42 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 27 Jul 2021 23:01:38 -0400 Subject: [PATCH 521/766] Fix mesa replacement biome --- .../connector/network/translators/world/BiomeTranslator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java index 3f22f8bc9..e76d179bf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java @@ -64,6 +64,9 @@ public class BiomeTranslator { case "icy": replacementBiome = "minecraft:ice_spikes"; break; + case "mesa": + replacementBiome = "minecraft:badlands"; + break; case "mushroom": replacementBiome = "minecraft:mushroom_fields"; break; @@ -75,7 +78,6 @@ public class BiomeTranslator { break; case "taiga": case "jungle": - case "mesa": case "plains": case "savanna": case "the_end": From 5529a1cc1c004b066c5a737f96e7de1749a2acf0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 28 Jul 2021 13:21:18 -0400 Subject: [PATCH 522/766] Fix spectator gamemode movement - Don't allow the player to toggle flight status in spectator mode - Fix weird flight movement when player was previously on the ground - The player is always flying in spectator mode, no exceptions --- .../network/session/GeyserSession.java | 29 ++++++++----------- .../BedrockAdventureSettingsTranslator.java | 7 +++++ .../world/JavaNotifyClientTranslator.java | 14 +++++++-- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 8f71e6fa8..444edcab4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -40,6 +40,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; import com.github.steveice10.mc.protocol.packet.handshake.client.HandshakePacket; +import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; @@ -381,18 +382,6 @@ public class GeyserSession implements CommandSender { */ private boolean flying = false; - /** - * If the current player is in noclip - */ - @Setter - private boolean noClip = false; - - /** - * If the current player can not interact with the world - */ - @Setter - private boolean worldImmutable = false; - /** * Caches current rain status. */ @@ -1282,15 +1271,21 @@ public class GeyserSession implements CommandSender { adventureSettingsPacket.setPlayerPermission(opPermissionLevel >= 2 ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER); // Update the noClip and worldImmutable values based on the current gamemode - noClip = gameMode == GameMode.SPECTATOR; - worldImmutable = gameMode == GameMode.ADVENTURE || gameMode == GameMode.SPECTATOR; + boolean spectator = gameMode == GameMode.SPECTATOR; + boolean worldImmutable = gameMode == GameMode.ADVENTURE || spectator; Set flags = adventureSettingsPacket.getSettings(); - if (canFly) { + if (canFly || spectator) { flags.add(AdventureSetting.MAY_FLY); } - if (flying) { + if (flying || spectator) { + if (spectator && !flying) { + // We're "flying locked" in this gamemode + flying = true; + ClientPlayerAbilitiesPacket abilitiesPacket = new ClientPlayerAbilitiesPacket(true); + sendDownstreamPacket(abilitiesPacket); + } flags.add(AdventureSetting.FLYING); } @@ -1298,7 +1293,7 @@ public class GeyserSession implements CommandSender { flags.add(AdventureSetting.WORLD_IMMUTABLE); } - if (noClip) { + if (spectator) { flags.add(AdventureSetting.NO_CLIP); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index 61cc80910..e868eedeb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -25,6 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; +import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -39,6 +40,12 @@ public class BedrockAdventureSettingsTranslator extends PacketTranslator Date: Wed, 28 Jul 2021 19:44:09 -0400 Subject: [PATCH 523/766] Auth type refactor in internal config (#2410) --- .../bungeecord/GeyserBungeePlugin.java | 5 +++-- .../platform/spigot/GeyserSpigotPlugin.java | 5 +++-- .../velocity/GeyserVelocityPlugin.java | 5 +++-- .../connector/FloodgateKeyLoader.java | 3 ++- .../geysermc/connector/GeyserConnector.java | 19 +++++++++++-------- .../geysermc/connector/common/AuthType.java | 16 ++++++++++++++-- .../configuration/GeyserConfiguration.java | 3 ++- .../GeyserJacksonConfiguration.java | 6 ++++-- .../network/session/GeyserSession.java | 2 +- .../java/JavaJoinGameTranslator.java | 2 +- .../java/JavaPluginMessageTranslator.java | 2 +- .../geysermc/connector/skin/SkinManager.java | 2 +- 12 files changed, 46 insertions(+), 24 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index 84db12341..adfb00e13 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -31,6 +31,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.command.CommandManager; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; @@ -100,13 +101,13 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { return; } - if (geyserConfig.getRemote().getAuthType().equals("floodgate") && getProxy().getPluginManager().getPlugin("floodgate") == null) { + if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && getProxy().getPluginManager().getPlugin("floodgate") == null) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; } else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) { // Floodgate installed means that the user wants Floodgate authentication geyserLogger.debug("Auto-setting to Floodgate authentication."); - geyserConfig.getRemote().setAuthType("floodgate"); + geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE); } geyserConfig.loadFloodgate(this); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index fc810c418..4c67a931b 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -36,6 +36,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.command.CommandManager; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.connector.network.translators.world.WorldManager; @@ -127,14 +128,14 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { return; } - if (geyserConfig.getRemote().getAuthType().equals("floodgate") && Bukkit.getPluginManager().getPlugin("floodgate") == null) { + if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && Bukkit.getPluginManager().getPlugin("floodgate") == null) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); this.getPluginLoader().disablePlugin(this); return; } else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate") != null) { // Floodgate installed means that the user wants Floodgate authentication geyserLogger.debug("Auto-setting to Floodgate authentication."); - geyserConfig.getRemote().setAuthType("floodgate"); + geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE); } geyserConfig.loadFloodgate(this); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java index c7b994d48..df25167e6 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java @@ -36,6 +36,7 @@ import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; @@ -116,13 +117,13 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { } catch (ClassNotFoundException ignored) { } - if (geyserConfig.getRemote().getAuthType().equals("floodgate") && !proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) { + if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && !proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) { geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; } else if (geyserConfig.isAutoconfiguredRemote() && proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) { // Floodgate installed means that the user wants Floodgate authentication geyserLogger.debug("Auto-setting to Floodgate authentication."); - geyserConfig.getRemote().setAuthType("floodgate"); + geyserConfig.getRemote().setAuthType(AuthType.FLOODGATE); } geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile()); diff --git a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java b/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java index 7f5bca8c2..0d257cb7d 100644 --- a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java +++ b/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java @@ -25,6 +25,7 @@ package org.geysermc.connector; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import org.geysermc.connector.utils.LanguageUtils; @@ -33,7 +34,7 @@ import java.nio.file.Path; public class FloodgateKeyLoader { public static Path getKeyPath(GeyserJacksonConfiguration config, Object floodgate, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) { - if (!config.getRemote().getAuthType().equals("floodgate")) { + if (config.getRemote().getAuthType() != AuthType.FLOODGATE) { return geyserDataFolder.resolve(config.getFloodgateKeyFile()); } diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 1d5cd3f81..99ca790ee 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -106,9 +106,6 @@ public class GeyserConnector { @Setter private static boolean shouldStartListener = true; - @Setter - private AuthType defaultAuthType; - private final TimeSyncer timeSyncer; private FloodgateCipher cipher; private FloodgateSkinUploader skinUploader; @@ -192,10 +189,8 @@ public class GeyserConnector { } } - defaultAuthType = AuthType.getByName(config.getRemote().getAuthType()); - TimeSyncer timeSyncer = null; - if (defaultAuthType == AuthType.FLOODGATE) { + if (config.getRemote().getAuthType() == AuthType.FLOODGATE) { timeSyncer = new TimeSyncer(Constants.NTP_SERVER); try { Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath()); @@ -273,7 +268,7 @@ public class GeyserConnector { metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger("")); metrics.addCustomChart(new Metrics.SingleLineChart("players", players::size)); // Prevent unwanted words best we can - metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> AuthType.getByName(config.getRemote().getAuthType()).toString().toLowerCase())); + metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase())); metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName)); metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", LanguageUtils::getDefaultLocale)); metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserConnector.VERSION)); @@ -463,7 +458,6 @@ public class GeyserConnector { } newsHandler.shutdown(); players.clear(); - defaultAuthType = null; this.getCommandManager().getCommands().clear(); bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done")); @@ -555,6 +549,15 @@ public class GeyserConnector { return !"DEV".equals(GeyserConnector.VERSION); } + /** + * Deprecated. Get the AuthType from the GeyserConfiguration through {@link GeyserConnector#getConfig()} + * @return The + */ + @Deprecated + public AuthType getDefaultAuthType() { + return getConfig().getRemote().getAuthType(); + } + public static GeyserConnector getInstance() { return instance; } diff --git a/connector/src/main/java/org/geysermc/connector/common/AuthType.java b/connector/src/main/java/org/geysermc/connector/common/AuthType.java index 253bd6a5e..41810a1ce 100644 --- a/connector/src/main/java/org/geysermc/connector/common/AuthType.java +++ b/connector/src/main/java/org/geysermc/connector/common/AuthType.java @@ -25,8 +25,13 @@ package org.geysermc.connector.common; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; import lombok.Getter; +import java.io.IOException; + @Getter public enum AuthType { OFFLINE, @@ -40,7 +45,7 @@ public enum AuthType { } /** - * Convert the AuthType string (from config) to the enum, OFFLINE on fail + * Convert the AuthType string (from config) to the enum, ONLINE on fail * * @param name AuthType string * @@ -53,6 +58,13 @@ public enum AuthType { return type; } } - return OFFLINE; + return ONLINE; + } + + public static class Deserializer extends JsonDeserializer { + @Override + public AuthType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + return getByName(p.getValueAsString()); + } } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java index 8272805a8..d0195df70 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java @@ -27,6 +27,7 @@ package org.geysermc.connector.configuration; import com.fasterxml.jackson.annotation.JsonIgnore; import org.geysermc.connector.GeyserLogger; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.network.CIDRMatcher; import org.geysermc.connector.utils.LanguageUtils; @@ -135,7 +136,7 @@ public interface GeyserConfiguration { void setPort(int port); - String getAuthType(); + AuthType getAuthType(); boolean isPasswordAuthentication(); diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java index d4ff79b54..05dfdb51a 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.connector.network.CIDRMatcher; @@ -59,7 +60,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration private boolean extendedWorldHeight = false; @JsonProperty("floodgate-key-file") - private String floodgateKeyFile = "public-key.pem"; + private String floodgateKeyFile = "key.pem"; public abstract Path getFloodgateKeyPath(); @@ -194,8 +195,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration private int port = 25565; @Setter + @JsonDeserialize(using = AuthType.Deserializer.class) @JsonProperty("auth-type") - private String authType = "online"; + private AuthType authType = AuthType.ONLINE; @JsonProperty("allow-password-authentication") private boolean passwordAuthentication = true; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 444edcab4..14d6bf375 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -478,7 +478,7 @@ public class GeyserSession implements CommandSender { startGame(); this.remoteAddress = connector.getConfig().getRemote().getAddress(); this.remotePort = connector.getConfig().getRemote().getPort(); - this.remoteAuthType = connector.getDefaultAuthType(); + this.remoteAuthType = connector.getConfig().getRemote().getAuthType(); // Set the hardcoded shield ID to the ID we just defined in StartGamePacket upstream.getSession().getHardcodedBlockingId().set(this.itemMappings.getStoredItems().shield().getBedrockId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index 6b5f63438..6a486f133 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -104,7 +104,7 @@ public class JavaJoinGameTranslator extends PacketTranslator Date: Thu, 29 Jul 2021 14:35:03 -0400 Subject: [PATCH 524/766] Fix experimental toggle'd biomes not accounting for chunk offset --- .../java/world/JavaChunkDataTranslator.java | 14 +++++++++++++- .../org/geysermc/connector/utils/ChunkUtils.java | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java index 45a9e45f5..2ec3a15fc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java @@ -43,6 +43,9 @@ import org.geysermc.connector.network.translators.world.chunk.ChunkSection; import org.geysermc.connector.network.translators.world.BiomeTranslator; import org.geysermc.connector.utils.ChunkUtils; +import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT; +import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD; + @Translator(packet = ServerChunkDataPacket.class) public class JavaChunkDataTranslator extends PacketTranslator { // Caves and cliffs supports 3D biomes by implementing a very similar palette system to blocks @@ -100,8 +103,17 @@ public class JavaChunkDataTranslator extends PacketTranslator> 4; for (int i = 0; i < sectionCount; i++) { - BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i).writeToNetwork(byteBuf); + int biomeYOffset = dimensionOffset + i; + if (biomeYOffset < yOffset) { + // Ignore this biome section since it goes below the height of the Java world + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + continue; + } + BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf); } // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 528fdbdf6..932950240 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -73,9 +73,9 @@ public class ChunkUtils { /** * The minimum height Bedrock Edition will accept. */ - private static final int MINIMUM_ACCEPTED_HEIGHT = 0; + public static final int MINIMUM_ACCEPTED_HEIGHT = 0; private static final int CAVES_AND_CLIFFS_MINIMUM_HEIGHT = -64; - private static final int MINIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? + public static final int MINIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? CAVES_AND_CLIFFS_MINIMUM_HEIGHT : MINIMUM_ACCEPTED_HEIGHT; /** * The maximum chunk height Bedrock Edition will accept, from the lowest point to the highest. From 6f93bbfe216bd53474f07dd8dbaf9f1053b51bb3 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Fri, 30 Jul 2021 16:45:50 -0400 Subject: [PATCH 525/766] Improvements to VillagerEntity (#2412) * initial changes to villager * touchup * don't call getPos() twice * whoops, better --- .../living/merchant/VillagerEntity.java | 68 ++++++++----------- 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java index 9aca12ba5..f64d9f0cd 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java @@ -97,58 +97,50 @@ public class VillagerEntity extends AbstractMerchantEntity { } super.updateBedrockMetadata(entityMetadata, session); } - + @Override public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - if (!metadata.getFlags().getFlag(EntityFlag.SLEEPING)) { + // The bed block position, if it exists + Vector3i bedPosition; + if (!metadata.getFlags().getFlag(EntityFlag.SLEEPING) || (bedPosition = metadata.getPos(EntityData.BED_POSITION, null)) == null) { // No need to worry about extra processing to compensate for sleeping super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); return; } + + // The bed block + int blockId = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); + String fullIdentifier = BlockRegistries.JAVA_IDENTIFIERS.get().get(blockId); - int z = 0; - int bedId = 0; - float bedPositionSubtractorW = 0; - float bedPositionSubtractorN = 0; - Vector3i bedPosition = metadata.getPos(EntityData.BED_POSITION, null); - if (bedPosition != null) { - bedId = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); + // Set the correct position offset and rotation when sleeping + int bedRotation = 0; + float xOffset = 0; + float zOffset = 0; + if (fullIdentifier.contains("facing=south")) { + // bed is facing south + bedRotation = 180; + zOffset = -.5f; + } else if (fullIdentifier.contains("facing=east")) { + // bed is facing east + bedRotation = 90; + xOffset = -.5f; + } else if (fullIdentifier.contains("facing=west")) { + // bed is facing west + bedRotation = 270; + xOffset = .5f; + } else if (fullIdentifier.contains("facing=north")) { + // rotation does not change because north is 0 + zOffset = .5f; } - String bedRotationZ = BlockRegistries.JAVA_IDENTIFIERS.get().get(bedId); + setRotation(rotation); setOnGround(isOnGround); this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ); MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); moveEntityPacket.setRuntimeEntityId(geyserId); - //Sets Villager position and rotation when sleeping - Pattern r = Pattern.compile("facing=([a-z]+)"); - Matcher m = r.matcher(bedRotationZ); - if (m.find()) { - switch (m.group(0)) { - case "facing=south": - //bed is facing south - z = 180; - bedPositionSubtractorW = -.5f; - break; - case "facing=east": - //bed is facing east - z = 90; - bedPositionSubtractorW = -.5f; - break; - case "facing=west": - //bed is facing west - z = 270; - bedPositionSubtractorW = .5f; - break; - case "facing=north": - //rotation does not change because north is 0 - bedPositionSubtractorN = .5f; - break; - } - } - moveEntityPacket.setRotation(Vector3f.from(0, 0, z)); - moveEntityPacket.setPosition(Vector3f.from(position.getX() + bedPositionSubtractorW, position.getY(), position.getZ() + bedPositionSubtractorN)); + moveEntityPacket.setRotation(Vector3f.from(0, 0, bedRotation)); + moveEntityPacket.setPosition(Vector3f.from(position.getX() + xOffset, position.getY(), position.getZ() + zOffset)); moveEntityPacket.setOnGround(isOnGround); moveEntityPacket.setTeleported(false); session.sendUpstreamPacket(moveEntityPacket); From 1d04a61a46bfdbee7fe8d3af70e9a9ba4fb3e296 Mon Sep 17 00:00:00 2001 From: David Choo Date: Fri, 30 Jul 2021 22:35:13 -0400 Subject: [PATCH 526/766] Collision Registry (#2430) * Fix trapdoor collision * Add EqualsAndHashCode to all Collision subclasses and shift code around EqualsAndHashCode are required on subclasses otherwise blocks will be assigned an incorrect collision instance. (Doors and trapdoors are mixed and ladder sometimes gets a DoorCollision instance). Added protected constructor to BlockCollision to make boundingBoxes final. Removed EmptyCollision because I don't think it is useful. Moved conversion from ArrayNode to BoundingBoxes[] from OtherCollision to CollisionRegistryLoader Removed regex from SnowCollision and use default bounding boxes. * Deduplicate BlockCollision instances * Create one set of bounding boxes for all BlockCollisions * Don't depend on the player's block position in DoorCollision * Fix dirt path position corrections Grass paths were renamed to dirt path in 1.17 Fix position correction for y=1, y=2, y=255, and y=256 * Increase pushAwayTolerance depending on distance from origin This should fix position corrections for blocks less than 1 unit in length/width at high coordinates. This includes ladders after x 4096 or z 4096 Not too sure about the math here though * Use ThreadLocal for position Hopefully resolves concurrency issues * Remove comment and add layer check to SnowCollision --- .../connector/entity/FishingHookEntity.java | 11 +- .../collision/CollisionManager.java | 13 +- .../collision/translators/BlockCollision.java | 45 +++++-- ...hCollision.java => DirtPathCollision.java} | 18 +-- .../collision/translators/DoorCollision.java | 18 ++- .../collision/translators/EmptyCollision.java | 35 ------ .../collision/translators/OtherCollision.java | 24 +--- .../translators/ScaffoldingCollision.java | 5 +- .../collision/translators/SnowCollision.java | 39 ++---- .../collision/translators/SolidCollision.java | 9 +- .../translators/SpawnerCollision.java | 2 + .../translators/TrapdoorCollision.java | 42 +++---- .../connector/registry/BlockRegistries.java | 3 +- .../loader/CollisionRegistryLoader.java | 113 ++++++++---------- .../geysermc/connector/utils/BlockUtils.java | 9 +- 15 files changed, 174 insertions(+), 212 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/{GrassPathCollision.java => DirtPathCollision.java} (75%) delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/EmptyCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index 66cfe386d..e798ad468 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -97,10 +97,13 @@ public class FishingHookEntity extends ThrowableEntity { boolean collided = false; for (Vector3i blockPos : collidableBlocks) { int blockID = session.getConnector().getWorldManager().getBlockAt(session, blockPos); - BlockCollision blockCollision = BlockUtils.getCollision(blockID, blockPos.getX(), blockPos.getY(), blockPos.getZ()); - if (blockCollision != null && blockCollision.checkIntersection(boundingBox)) { - // TODO Push bounding box out of collision to improve movement - collided = true; + BlockCollision blockCollision = BlockUtils.getCollision(blockID, blockPos); + if (blockCollision != null) { + if (blockCollision.checkIntersection(boundingBox)) { + // TODO Push bounding box out of collision to improve movement + collided = true; + } + blockCollision.setPosition(null); } int waterLevel = BlockStateValues.getWaterLevel(blockID); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index a28a39271..52754f4a4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -220,23 +220,21 @@ public class CollisionManager { // Used when correction code needs to be run before the main correction for (Vector3i blockPos : collidableBlocks) { - BlockCollision blockCollision = BlockUtils.getCollisionAt( - session, blockPos.getX(), blockPos.getY(), blockPos.getZ() - ); + BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); if (blockCollision != null) { blockCollision.beforeCorrectPosition(playerBoundingBox); + blockCollision.setPosition(null); } } // Main correction code for (Vector3i blockPos : collidableBlocks) { - BlockCollision blockCollision = BlockUtils.getCollisionAt( - session, blockPos.getX(), blockPos.getY(), blockPos.getZ() - ); + BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); if (blockCollision != null) { if (!blockCollision.correctPosition(session, playerBoundingBox)) { return false; } + blockCollision.setPosition(null); } } @@ -251,7 +249,7 @@ public class CollisionManager { */ public boolean isUnderSlab() { Vector3i position = session.getPlayerEntity().getPosition().toInt(); - BlockCollision collision = BlockUtils.getCollisionAt(session, position.getX(), position.getY(), position.getZ()); + BlockCollision collision = BlockUtils.getCollisionAt(session, position); if (collision != null) { // Determine, if the player's bounding box *were* at full height, if it would intersect with the block // at the current location. @@ -262,6 +260,7 @@ public class CollisionManager { playerBoundingBox.setSizeY(EntityType.PLAYER.getHeight()); playerBoundingBox.setMiddleY(standingY); boolean result = collision.checkIntersection(playerBoundingBox); + collision.setPosition(null); playerBoundingBox.setSizeY(originalHeight); playerBoundingBox.setMiddleY(originalY); return result; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java index 7847869ab..8d1b1b925 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java @@ -26,6 +26,7 @@ package org.geysermc.connector.network.translators.collision.translators; import com.nukkitx.math.vector.Vector3d; +import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; import org.geysermc.connector.network.session.GeyserSession; @@ -36,11 +37,10 @@ import org.geysermc.connector.network.translators.collision.BoundingBox; public class BlockCollision { @Getter - protected BoundingBox[] boundingBoxes; + protected final BoundingBox[] boundingBoxes; - protected int x; - protected int y; - protected int z; + @EqualsAndHashCode.Exclude + protected final ThreadLocal position; /** * This is used for the step up logic. @@ -51,7 +51,6 @@ public class BlockCollision { * I didn't just set it for beds because other collision may also be slightly raised off the ground. * If this causes any problems, change this back to 0 and add an exception for beds. */ - @EqualsAndHashCode.Exclude protected double pushUpTolerance = 1; /** @@ -59,10 +58,13 @@ public class BlockCollision { */ protected double pushAwayTolerance = CollisionManager.COLLISION_TOLERANCE * 1.1; - public void setPosition(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; + protected BlockCollision(BoundingBox[] boxes) { + this.boundingBoxes = boxes; + this.position = new ThreadLocal<>(); + } + + public void setPosition(Vector3i newPosition) { + this.position.set(newPosition); } /** @@ -78,6 +80,11 @@ public class BlockCollision { * This functionality is currently only used in 6 or 7 layer snow */ public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { + Vector3i blockPos = this.position.get(); + int x = blockPos.getX(); + int y = blockPos.getY(); + int z = blockPos.getZ(); + double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); for (BoundingBox b : this.boundingBoxes) { double boxMinY = (b.getMiddleY() + y) - (b.getSizeY() / 2); @@ -103,27 +110,34 @@ public class BlockCollision { playerCollision.getMiddleY() - y, playerCollision.getMiddleZ() - z); + // The ULP should give an upper bound on the floating point error + double xULP = Math.ulp((float) Math.max(Math.abs(playerCollision.getMiddleX()) + playerCollision.getSizeX() / 2.0, Math.abs(x) + 1)); + double zULP = Math.ulp((float) Math.max(Math.abs(playerCollision.getMiddleZ()) + playerCollision.getSizeZ() / 2.0, Math.abs(z) + 1)); + + double xPushAwayTolerance = Math.max(pushAwayTolerance, xULP); + double zPushAwayTolerance = Math.max(pushAwayTolerance, zULP); + double northFaceZPos = b.getMiddleZ() - (b.getSizeZ() / 2); double translateDistance = northFaceZPos - relativePlayerPosition.getZ() - (playerCollision.getSizeZ() / 2); - if (Math.abs(translateDistance) < pushAwayTolerance) { + if (Math.abs(translateDistance) < zPushAwayTolerance) { playerCollision.translate(0, 0, translateDistance); } double southFaceZPos = b.getMiddleZ() + (b.getSizeZ() / 2); translateDistance = southFaceZPos - relativePlayerPosition.getZ() + (playerCollision.getSizeZ() / 2); - if (Math.abs(translateDistance) < pushAwayTolerance) { + if (Math.abs(translateDistance) < zPushAwayTolerance) { playerCollision.translate(0, 0, translateDistance); } double eastFaceXPos = b.getMiddleX() + (b.getSizeX() / 2); translateDistance = eastFaceXPos - relativePlayerPosition.getX() + (playerCollision.getSizeX() / 2); - if (Math.abs(translateDistance) < pushAwayTolerance) { + if (Math.abs(translateDistance) < xPushAwayTolerance) { playerCollision.translate(translateDistance, 0, 0); } double westFaceXPos = b.getMiddleX() - (b.getSizeX() / 2); translateDistance = westFaceXPos - relativePlayerPosition.getX() - (playerCollision.getSizeX() / 2); - if (Math.abs(translateDistance) < pushAwayTolerance) { + if (Math.abs(translateDistance) < xPushAwayTolerance) { playerCollision.translate(translateDistance, 0, 0); } @@ -143,6 +157,11 @@ public class BlockCollision { } public boolean checkIntersection(BoundingBox playerCollision) { + Vector3i blockPos = this.position.get(); + int x = blockPos.getX(); + int y = blockPos.getY(); + int z = blockPos.getZ(); + for (BoundingBox b : boundingBoxes) { if (b.checkIntersection(x, y, z, playerCollision)) { return true; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/GrassPathCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java similarity index 75% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/GrassPathCollision.java rename to connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java index 4d59171e5..aa9a082fa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/GrassPathCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java @@ -25,24 +25,26 @@ package org.geysermc.connector.network.translators.collision.translators; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.translators.collision.BoundingBox; +import org.geysermc.connector.network.translators.collision.CollisionManager; import org.geysermc.connector.network.translators.collision.CollisionRemapper; -@CollisionRemapper(regex = "^grass_path$", passDefaultBoxes = true) -public class GrassPathCollision extends BlockCollision { - public GrassPathCollision(String params, BoundingBox[] defaultBoxes) { - super(); - boundingBoxes = defaultBoxes; +@EqualsAndHashCode(callSuper = true) +@CollisionRemapper(regex = "^dirt_path$", passDefaultBoxes = true) +public class DirtPathCollision extends BlockCollision { + public DirtPathCollision(String params, BoundingBox[] defaultBoxes) { + super(defaultBoxes); } // Needs to run before the main correction code or it can move the player into blocks // This is counteracted by the main collision code pushing them out @Override public void beforeCorrectPosition(BoundingBox playerCollision) { - // In Bedrock, grass paths are small blocks so the player must be pushed down + // In Bedrock, dirt paths are solid blocks, so the player must be pushed down. double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); - // If the player is in the buggy area, push them down - if (playerMinY == y + 1) { + double blockMaxY = position.get().getY() + 1; + if (Math.abs(blockMaxY - playerMinY) <= CollisionManager.COLLISION_TOLERANCE) { playerCollision.translate(0, -0.0625, 0); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java index c98269989..cdfeec8cf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java @@ -25,10 +25,13 @@ package org.geysermc.connector.network.translators.collision.translators; +import com.nukkitx.math.vector.Vector3i; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.CollisionRemapper; +@EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "_door$", usesParams = true, passDefaultBoxes = true) public class DoorCollision extends BlockCollision { /** @@ -40,8 +43,7 @@ public class DoorCollision extends BlockCollision { private int facing; public DoorCollision(String params, BoundingBox[] defaultBoxes) { - super(); - boundingBoxes = defaultBoxes; + super(defaultBoxes); if (params.contains("facing=north")) { facing = 1; } else if (params.contains("facing=east")) { @@ -68,18 +70,22 @@ public class DoorCollision extends BlockCollision { // Check for door bug (doors are 0.1875 blocks thick on Java but 0.1825 blocks thick on Bedrock) if (this.checkIntersection(playerCollision)) { + Vector3i blockPos = this.position.get(); + int x = blockPos.getX(); + int z = blockPos.getZ(); + switch (facing) { case 1: // North - playerCollision.setMiddleZ(Math.floor(playerCollision.getMiddleZ()) + 0.5125); + playerCollision.setMiddleZ(z + 0.5125); break; case 2: // East - playerCollision.setMiddleX(Math.floor(playerCollision.getMiddleX()) + 0.5125); + playerCollision.setMiddleX(x + 0.5125); break; case 3: // South - playerCollision.setMiddleZ(Math.floor(playerCollision.getMiddleZ()) + 0.4875); + playerCollision.setMiddleZ(z + 0.4875); break; case 4: // West - playerCollision.setMiddleX(Math.floor(playerCollision.getMiddleX()) + 0.4875); + playerCollision.setMiddleX(x + 0.4875); break; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/EmptyCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/EmptyCollision.java deleted file mode 100644 index 0a8a6a00b..000000000 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/EmptyCollision.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.connector.network.translators.collision.translators; - -import org.geysermc.connector.network.translators.collision.BoundingBox; - -public class EmptyCollision extends BlockCollision { - public EmptyCollision(String params) { - super(); - boundingBoxes = new BoundingBox[0]; - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java index b31dd9190..8a49a28af 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java @@ -25,29 +25,13 @@ package org.geysermc.connector.network.translators.collision.translators; -import com.fasterxml.jackson.databind.node.ArrayNode; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.translators.collision.BoundingBox; -import java.util.Arrays; -import java.util.Comparator; - +@EqualsAndHashCode(callSuper = true) public class OtherCollision extends BlockCollision { - public OtherCollision(ArrayNode collisionList) { - super(); - boundingBoxes = new BoundingBox[collisionList.size()]; - - for (int i = 0; i < collisionList.size(); i++) { - ArrayNode collisionBoxArray = (ArrayNode) collisionList.get(i); - boundingBoxes[i] = new BoundingBox(collisionBoxArray.get(0).asDouble(), - collisionBoxArray.get(1).asDouble(), - collisionBoxArray.get(2).asDouble(), - collisionBoxArray.get(3).asDouble(), - collisionBoxArray.get(4).asDouble(), - collisionBoxArray.get(5).asDouble()); - } - - // Sorting by lowest Y first fixes some bugs - Arrays.sort(boundingBoxes, Comparator.comparingDouble(BoundingBox::getMiddleY)); + public OtherCollision(BoundingBox[] boundingBoxes) { + super(boundingBoxes); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java index ba997d305..06cb0265e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java @@ -25,6 +25,7 @@ package org.geysermc.connector.network.translators.collision.translators; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.CollisionRemapper; @@ -32,11 +33,11 @@ import org.geysermc.connector.network.translators.collision.CollisionRemapper; /** * In order for scaffolding to work on Bedrock, entity flags need to be sent to the player */ +@EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^scaffolding$", usesParams = true, passDefaultBoxes = true) public class ScaffoldingCollision extends BlockCollision { public ScaffoldingCollision(String params, BoundingBox[] defaultBoxes) { - super(); - boundingBoxes = defaultBoxes; + super(defaultBoxes); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java index 37ea4a1ba..471969d89 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java @@ -25,37 +25,20 @@ package org.geysermc.connector.network.translators.collision.translators; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.CollisionRemapper; -import java.util.regex.Pattern; -import java.util.regex.Matcher; - -@CollisionRemapper(regex = "^snow$", usesParams = true) +@EqualsAndHashCode(callSuper = true) +@CollisionRemapper(regex = "^snow$", passDefaultBoxes = true, usesParams = true) public class SnowCollision extends BlockCollision { private final int layers; - public SnowCollision(String params) { - super(); - Pattern layersPattern = Pattern.compile("layers=([0-8])"); - Matcher matcher = layersPattern.matcher(params); - //noinspection ResultOfMethodCallIgnored - matcher.find(); - - // Hitbox is 1 layer less (you sink in 1 layer) - layers = Integer.parseInt(matcher.group(1)); - - if (layers > 1) { - boundingBoxes = new BoundingBox[] { - // Take away 1 because you can go 1 layer into snow layers - new BoundingBox(0.5, ((layers - 1) * 0.125) / 2, 0.5, - 1, (layers - 1) * 0.125, 1) - }; - } else { - // Single layers have no collision - boundingBoxes = new BoundingBox[0]; - } + public SnowCollision(String params, BoundingBox[] defaultBoxes) { + super(defaultBoxes); + int layerCharIndex = params.indexOf("=") + 1; + layers = Integer.parseInt(params.substring(layerCharIndex, layerCharIndex + 1)); pushUpTolerance = 0.125; } @@ -69,7 +52,7 @@ public class SnowCollision extends BlockCollision { // pushed down if (layers == 4 || layers == 8) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); - double boxMaxY = (boundingBoxes[0].getMiddleY() + y) + (boundingBoxes[0].getSizeY() / 2); + double boxMaxY = (boundingBoxes[0].getMiddleY() + position.get().getY()) + (boundingBoxes[0].getSizeY() / 2); // If the player is in the buggy area, push them down if (playerMinY > boxMaxY && playerMinY <= (boxMaxY + 0.125)) { @@ -80,6 +63,10 @@ public class SnowCollision extends BlockCollision { @Override public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { + if (layers == 1) { + // 1 layer of snow does not have collision + return true; + } // Hack to prevent false positives playerCollision.setSizeX(playerCollision.getSizeX() - 0.0001); playerCollision.setSizeY(playerCollision.getSizeY() - 0.0001); @@ -87,7 +74,7 @@ public class SnowCollision extends BlockCollision { if (this.checkIntersection(playerCollision)) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); - double boxMaxY = (boundingBoxes[0].getMiddleY() + y) + (boundingBoxes[0].getSizeY() / 2); + double boxMaxY = (boundingBoxes[0].getMiddleY() + position.get().getY()) + (boundingBoxes[0].getSizeY() / 2); // If the player actually can't step onto it (they can step onto it from other snow layers) if ((boxMaxY - playerMinY) > 0.5) { // Cancel the movement diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java index 05791501d..d96e7d588 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java @@ -25,15 +25,16 @@ package org.geysermc.connector.network.translators.collision.translators; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.CollisionRemapper; +@EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "shulker_box$") // These have no collision in the mappings as it depends on the NBT data public class SolidCollision extends BlockCollision { public SolidCollision(String params) { - super(); - boundingBoxes = new BoundingBox[]{ - new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1) - }; + super(new BoundingBox[] { + new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1) + }); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java index 6999a12b7..867d4b412 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java @@ -25,8 +25,10 @@ package org.geysermc.connector.network.translators.collision.translators; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.translators.collision.CollisionRemapper; +@EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^spawner$") public class SpawnerCollision extends SolidCollision { public SpawnerCollision(String params) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java index 63e97e1d9..a8a35256f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java @@ -25,10 +25,14 @@ package org.geysermc.connector.network.translators.collision.translators; +import com.nukkitx.math.vector.Vector3i; +import lombok.EqualsAndHashCode; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; +import org.geysermc.connector.network.translators.collision.CollisionManager; import org.geysermc.connector.network.translators.collision.CollisionRemapper; +@EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "_trapdoor$", usesParams = true, passDefaultBoxes = true) public class TrapdoorCollision extends BlockCollision { /** @@ -42,8 +46,7 @@ public class TrapdoorCollision extends BlockCollision { private int facing; public TrapdoorCollision(String params, BoundingBox[] defaultBoxes) { - super(); - boundingBoxes = defaultBoxes; + super(defaultBoxes); if (params.contains("open=true")) { if (params.contains("facing=north")) { facing = 1; @@ -68,38 +71,35 @@ public class TrapdoorCollision extends BlockCollision { @Override public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { boolean result = super.correctPosition(session, playerCollision); - // Hack to prevent false positives - playerCollision.setSizeX(playerCollision.getSizeX() - 0.0001); - playerCollision.setSizeY(playerCollision.getSizeY() - 0.0001); - playerCollision.setSizeZ(playerCollision.getSizeZ() - 0.0001); - // Check for door bug (doors are 0.1875 blocks thick on Java but 0.1825 blocks thick on Bedrock) if (this.checkIntersection(playerCollision)) { + Vector3i blockPos = this.position.get(); + int x = blockPos.getX(); + int y = blockPos.getY(); + int z = blockPos.getZ(); + switch (facing) { case 1: // North - playerCollision.setMiddleZ(Math.floor(playerCollision.getMiddleZ()) + 0.5125); + playerCollision.setMiddleZ(z + 0.5125); + break; + case 2: // East + playerCollision.setMiddleX(x + 0.5125); break; case 3: // South - playerCollision.setMiddleZ(Math.floor(playerCollision.getMiddleZ()) + 0.4875); + playerCollision.setMiddleZ(z + 0.4875); break; case 4: // West - playerCollision.setMiddleX(Math.floor(playerCollision.getMiddleX()) + 0.4875); + playerCollision.setMiddleX(x + 0.4875); + break; + case 5: + // Up-facing trapdoors are handled by the step-up check break; case 6: // Down - playerCollision.setMiddleY(Math.floor( - playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2) - ) + 0.0125 + (playerCollision.getSizeY() / 2)); - break; - case 2: - case 5: - // Up-facing and east-facing trapdoors work fine + // (top y of trap door) - (trap door thickness) = top y of player + playerCollision.setMiddleY(y + 1 - (3.0 / 16.0) - playerCollision.getSizeY() / 2.0 - CollisionManager.COLLISION_TOLERANCE); break; } } - - playerCollision.setSizeX(playerCollision.getSizeX() + 0.0001); - playerCollision.setSizeY(playerCollision.getSizeY() + 0.0001); - playerCollision.setSizeZ(playerCollision.getSizeZ() + 0.0001); return result; } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java index 58735a2b8..09069eb5a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java @@ -25,6 +25,7 @@ package org.geysermc.connector.registry; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -54,7 +55,7 @@ public class BlockRegistries { * A mapped registry which stores Java IDs to {@link BlockMapping}, containing miscellaneous information about * blocks and their behavior in many cases. */ - public static final SimpleMappedRegistry JAVA_BLOCKS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + public static final MappedRegistry> JAVA_BLOCKS = MappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); /** * A (bi)mapped registry containing the Java IDs to identifiers. diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java index 56976edb0..049f1d726 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java @@ -29,23 +29,22 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.AllArgsConstructor; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.CollisionRemapper; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.collision.translators.EmptyCollision; import org.geysermc.connector.network.translators.collision.translators.OtherCollision; import org.geysermc.connector.network.translators.collision.translators.SolidCollision; import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.Object2IntBiMap; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; -import java.util.IdentityHashMap; -import java.util.Map; +import java.util.*; import java.util.regex.Pattern; /** @@ -68,35 +67,44 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader collisionList; try { - collisionList = (ArrayNode) GeyserConnector.JSON_MAPPER.readTree(stream); + ArrayNode collisionNode = (ArrayNode) GeyserConnector.JSON_MAPPER.readTree(stream); + collisionList = loadBoundingBoxes(collisionNode); } catch (Exception e) { throw new AssertionError("Unable to load collision data", e); } - Object2IntBiMap javaIdBlockMap = BlockRegistries.JAVA_IDENTIFIERS.get(); + Int2ObjectMap blockMap = BlockRegistries.JAVA_BLOCKS.get(); + + // Map of unique collisions to its instance + Map collisionInstances = new Object2ObjectOpenHashMap<>(); + for (Int2ObjectMap.Entry entry : blockMap.int2ObjectEntrySet()) { + BlockCollision newCollision = instantiateCollision(entry.getValue(), annotationMap, collisionList); - // Map of classes that don't change based on parameters that have already been created - Map, BlockCollision> instantiatedCollision = new IdentityHashMap<>(); - for (Object2IntMap.Entry entry : javaIdBlockMap.object2IntEntrySet()) { - BlockCollision newCollision = instantiateCollision(entry.getKey(), entry.getIntValue(), annotationMap, instantiatedCollision, collisionList); if (newCollision != null) { - instantiatedCollision.put(newCollision.getClass(), newCollision); + // If there's an existing instance equal to this one, use that instead + BlockCollision existingInstance = collisionInstances.get(newCollision); + if (existingInstance != null) { + newCollision = existingInstance; + } else { + collisionInstances.put(newCollision, newCollision); + } } - collisions.put(entry.getIntValue(), newCollision); + + collisions.put(entry.getIntKey(), newCollision); } return collisions; } - private BlockCollision instantiateCollision(String blockID, int numericBlockID, Map, CollisionInfo> annotationMap, Map, BlockCollision> instantiatedCollision, ArrayNode collisionList) { - String[] blockIdParts = blockID.split("\\["); + private BlockCollision instantiateCollision(BlockMapping mapping, Map, CollisionInfo> annotationMap, List collisionList) { + String[] blockIdParts = mapping.getJavaIdentifier().split("\\["); String blockName = blockIdParts[0].replace("minecraft:", ""); String params = ""; - if (blockID.contains("[")) { + if (blockIdParts.length == 2) { params = "[" + blockIdParts[1]; } - int collisionIndex = BlockRegistries.JAVA_BLOCKS.get(numericBlockID).getCollisionIndex(); + int collisionIndex = mapping.getCollisionIndex(); for (Map.Entry, CollisionInfo> collisionRemappers : annotationMap.entrySet()) { Class type = collisionRemappers.getKey(); @@ -105,67 +113,52 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader, BlockCollision> entry : instantiatedCollision.entrySet()) { - if (entry.getValue().equals(collision)) { - collision = entry.getValue(); - break; - } - } - return collision; } catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) { - e.printStackTrace(); - return null; + throw new RuntimeException(e); } } } // Unless some of the low IDs are changed, which is unlikely, the first item should always be empty collision if (collisionIndex == 0) { - if (instantiatedCollision.containsKey(EmptyCollision.class)) { - return instantiatedCollision.get(EmptyCollision.class); - } else { - return new EmptyCollision(params); - } + return null; } // Unless some of the low IDs are changed, which is unlikely, the second item should always be full collision if (collisionIndex == 1) { - if (instantiatedCollision.containsKey(SolidCollision.class)) { - return instantiatedCollision.get(SolidCollision.class); - } else { - return new SolidCollision(params); - } + return new SolidCollision(params); } + return new OtherCollision(collisionList.get(collisionIndex)); + } - BlockCollision collision = new OtherCollision((ArrayNode) collisionList.get(collisionIndex)); - // If there's an existing instance equal to this one, use that instead - for (Map.Entry, BlockCollision> entry : instantiatedCollision.entrySet()) { - if (entry.getValue().equals(collision)) { - collision = entry.getValue(); - break; + private List loadBoundingBoxes(ArrayNode collisionNode) { + List collisions = new ObjectArrayList<>(); + for (int collisionIndex = 0; collisionIndex < collisionNode.size(); collisionIndex++) { + ArrayNode boundingBoxArray = (ArrayNode) collisionNode.get(collisionIndex); + + BoundingBox[] boundingBoxes = new BoundingBox[boundingBoxArray.size()]; + for (int i = 0; i < boundingBoxArray.size(); i++) { + ArrayNode boxProperties = (ArrayNode) boundingBoxArray.get(i); + boundingBoxes[i] = new BoundingBox(boxProperties.get(0).asDouble(), + boxProperties.get(1).asDouble(), + boxProperties.get(2).asDouble(), + boxProperties.get(3).asDouble(), + boxProperties.get(4).asDouble(), + boxProperties.get(5).asDouble()); } - } - return collision; + // Sorting by lowest Y first fixes some bugs + Arrays.sort(boundingBoxes, Comparator.comparingDouble(BoundingBox::getMiddleY)); + collisions.add(boundingBoxes); + } + return collisions; } /** diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index ad7afddb6..ab935d5ca 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -244,16 +244,15 @@ public class BlockUtils { return fullJavaIdentifier.substring(0, stateIndex); } - // Note: these reuse classes, so don't try to store more than once instance or coordinates will get overwritten - public static BlockCollision getCollision(int blockId, int x, int y, int z) { + public static BlockCollision getCollision(int blockId, Vector3i blockPos) { BlockCollision collision = Registries.COLLISIONS.get(blockId); if (collision != null) { - collision.setPosition(x, y, z); + collision.setPosition(blockPos); } return collision; } - public static BlockCollision getCollisionAt(GeyserSession session, int x, int y, int z) { - return getCollision(session.getConnector().getWorldManager().getBlockAt(session, x, y, z), x, y, z); + public static BlockCollision getCollisionAt(GeyserSession session, Vector3i blockPos) { + return getCollision(session.getConnector().getWorldManager().getBlockAt(session, blockPos), blockPos); } } From 002be32bb37a58a6465776f3df9f84a984ce0688 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 31 Jul 2021 12:52:49 -0400 Subject: [PATCH 527/766] Connect Geyser players directly to the server for plugin versions (#2413) - Faster loading times and improved latency; Geyser no longer creates a physical TCP connection to join the server - Less configuration: remote address and port are now irrelevant - Accurate IP addresses without needing Floodgate. Co-authored-by: Redned --- bootstrap/bungeecord/pom.xml | 7 +- .../bungeecord/GeyserBungeeInjector.java | 134 ++++++++++++++ .../bungeecord/GeyserBungeePlugin.java | 19 +- .../platform/spigot/GeyserSpigotInjector.java | 166 ++++++++++++++++++ .../platform/spigot/GeyserSpigotPlugin.java | 15 ++ .../velocity/GeyserVelocityInjector.java | 82 +++++++++ .../velocity/GeyserVelocityPlugin.java | 26 ++- connector/pom.xml | 4 +- .../connector/bootstrap/GeyserBootstrap.java | 6 + .../connector/common/GeyserInjector.java | 91 ++++++++++ .../configuration/GeyserConfiguration.java | 2 + .../GeyserJacksonConfiguration.java | 26 +++ .../network/session/GeyserSession.java | 40 ++++- connector/src/main/resources/config.yml | 10 +- 14 files changed, 617 insertions(+), 11 deletions(-) create mode 100644 bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java create mode 100644 bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java create mode 100644 connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index 839b8982c..f49f5f408 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -17,10 +17,11 @@ 1.4.1-SNAPSHOT compile + - net.md-5 - bungeecord-api - 1.16-R0.5-SNAPSHOT + com.github.SpigotMC.BungeeCord + bungeecord-proxy + a7c6ede provided diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java new file mode 100644 index 000000000..88fbe105a --- /dev/null +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2019-2021 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.platform.bungeecord; + +import com.github.steveice10.packetlib.io.local.LocalServerChannelWrapper; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.local.LocalAddress; +import io.netty.util.AttributeKey; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.config.ListenerInfo; +import net.md_5.bungee.netty.PipelineUtils; +import org.geysermc.connector.bootstrap.GeyserBootstrap; +import org.geysermc.connector.common.GeyserInjector; + +import java.lang.reflect.Method; + +public class GeyserBungeeInjector extends GeyserInjector { + private final ProxyServer proxy; + /** + * Set as a variable so it is only set after the proxy has finished initializing + */ + private ChannelInitializer channelInitializer = null; + + public GeyserBungeeInjector(ProxyServer proxy) { + this.proxy = proxy; + } + + @Override + protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception { + // TODO - allow Geyser to specify its own listener info properties + if (proxy.getConfig().getListeners().size() != 1) { + throw new UnsupportedOperationException("Geyser does not currently support multiple listeners with injection! " + + "Please reach out to us on our Discord at https://discord.gg/GeyserMC so we can hear feedback on your setup."); + } + ListenerInfo listenerInfo = proxy.getConfig().getListeners().stream().findFirst().orElseThrow(IllegalStateException::new); + + Class proxyClass = proxy.getClass(); + // Using the specified EventLoop is required, or else an error will be thrown + EventLoopGroup bossGroup; + EventLoopGroup workerGroup; + try { + EventLoopGroup eventLoops = (EventLoopGroup) proxyClass.getField("eventLoops").get(proxy); + // Netty redirects ServerBootstrap#group(EventLoopGroup) to #group(EventLoopGroup, EventLoopGroup) and uses the same event loop for both. + bossGroup = eventLoops; + workerGroup = eventLoops; + bootstrap.getGeyserLogger().debug("BungeeCord event loop style detected."); + } catch (NoSuchFieldException e) { + // Waterfall uses two separate event loops + // https://github.com/PaperMC/Waterfall/blob/fea7ec356dba6c6ac28819ff11be604af6eb484e/BungeeCord-Patches/0022-Use-a-worker-and-a-boss-event-loop-group.patch + bossGroup = (EventLoopGroup) proxyClass.getField("bossEventLoopGroup").get(proxy); + workerGroup = (EventLoopGroup) proxyClass.getField("workerEventLoopGroup").get(proxy); + bootstrap.getGeyserLogger().debug("Waterfall event loop style detected."); + } + + // Is currently just AttributeKey.valueOf("ListerInfo") but we might as well copy the value itself. + AttributeKey listener = PipelineUtils.LISTENER; + listenerInfo = new ListenerInfo( + listenerInfo.getSocketAddress(), + listenerInfo.getMotd(), + listenerInfo.getMaxPlayers(), + listenerInfo.getTabListSize(), + listenerInfo.getServerPriority(), + listenerInfo.isForceDefault(), + listenerInfo.getForcedHosts(), + listenerInfo.getTabListType(), + listenerInfo.isSetLocalAddress(), + listenerInfo.isPingPassthrough(), + listenerInfo.getQueryPort(), + listenerInfo.isQueryEnabled(), + bootstrap.getGeyserConfig().getRemote().isUseProxyProtocol() // If Geyser is expecting HAProxy, so should the Bungee end + ); + + // This method is what initializes the connection in Java Edition, after Netty is all set. + Method initChannel = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class); + initChannel.setAccessible(true); + + ChannelFuture channelFuture = (new ServerBootstrap() + .channel(LocalServerChannelWrapper.class) + .childHandler(new ChannelInitializer() { + @Override + protected void initChannel(Channel ch) throws Exception { + if (proxy.getConfig().getServers() == null) { + // Proxy hasn't finished loading all plugins - it loads the config after all plugins + // Probably doesn't need to be translatable? + bootstrap.getGeyserLogger().info("Disconnecting player as Bungee has not finished loading"); + ch.close(); + return; + } + + if (channelInitializer == null) { + // Proxy has finished initializing; we can safely grab this variable without fear of plugins modifying it + // (ViaVersion replaces this to inject) + channelInitializer = PipelineUtils.SERVER_CHILD; + } + initChannel.invoke(channelInitializer, ch); + } + }) + .childAttr(listener, listenerInfo) + .group(bossGroup, workerGroup) + .localAddress(LocalAddress.ANY)) + .bind() + .syncUninterruptibly(); + + this.localChannel = channelFuture; + this.serverSocketAddress = channelFuture.channel().localAddress(); + } +} diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index adfb00e13..d97446052 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -40,10 +40,12 @@ import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandExecutor; import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; +import java.net.SocketAddress; import java.nio.file.Path; import java.util.UUID; import java.util.logging.Level; @@ -52,6 +54,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { private GeyserBungeeCommandManager geyserCommandManager; private GeyserBungeeConfiguration geyserConfig; + private GeyserBungeeInjector geyserInjector; private GeyserBungeeLogger geyserLogger; private IGeyserPingPassthrough geyserBungeePingPassthrough; @@ -114,6 +117,9 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this); + this.geyserInjector = new GeyserBungeeInjector(getProxy()); + this.geyserInjector.initializeLocalChannel(this); + this.geyserCommandManager = new GeyserBungeeCommandManager(connector); if (geyserConfig.isLegacyPingPassthrough()) { @@ -127,7 +133,12 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { @Override public void onDisable() { - connector.shutdown(); + if (connector != null) { + connector.shutdown(); + } + if (geyserInjector != null) { + geyserInjector.shutdown(); + } } @Override @@ -159,4 +170,10 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { public BootstrapDumpInfo getDumpInfo() { return new GeyserBungeeDumpInfo(getProxy()); } + + @Nullable + @Override + public SocketAddress getSocketAddress() { + return this.geyserInjector.getServerSocketAddress(); + } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java new file mode 100644 index 000000000..d54414306 --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2019-2021 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.platform.spigot; + +import com.github.steveice10.packetlib.io.local.LocalServerChannelWrapper; +import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.*; +import io.netty.channel.local.LocalAddress; +import org.bukkit.Bukkit; +import org.geysermc.connector.bootstrap.GeyserBootstrap; +import org.geysermc.connector.common.GeyserInjector; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.util.List; + +public class GeyserSpigotInjector extends GeyserInjector { + /** + * Used to determine if ViaVersion is setup to a state where Geyser players will fail at joining if injection is enabled + */ + private final boolean isViaVersion; + /** + * Used to uninject ourselves on shutdown. + */ + private List allServerChannels; + + public GeyserSpigotInjector(boolean isViaVersion) { + this.isViaVersion = isViaVersion; + } + + @Override + @SuppressWarnings("unchecked") + protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception { + Class serverClazz; + try { + serverClazz = Class.forName("net.minecraft.server.MinecraftServer"); + // We're using 1.17+ + } catch (ClassNotFoundException e) { + // We're using pre-1.17 + String prefix = Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit", "net.minecraft.server"); + serverClazz = Class.forName(prefix + ".MinecraftServer"); + } + Method getServer = serverClazz.getDeclaredMethod("getServer"); + Object server = getServer.invoke(null); + Object connection = null; + // Find the class that manages network IO + for (Method m : serverClazz.getDeclaredMethods()) { + if (m.getReturnType() != null) { + // First is Spigot-mapped name, second is Mojang-mapped name which is implemented as future-proofing + if (m.getReturnType().getSimpleName().equals("ServerConnection") || m.getReturnType().getSimpleName().equals("ServerConnectionListener")) { + if (m.getParameterTypes().length == 0) { + connection = m.invoke(server); + } + } + } + } + if (connection == null) { + throw new RuntimeException("Unable to find ServerConnection class!"); + } + + // Find the channel that Minecraft uses to listen to connections + ChannelFuture listeningChannel = null; + for (Field field : connection.getClass().getDeclaredFields()) { + if (field.getType() != List.class) { + continue; + } + field.setAccessible(true); + boolean rightList = ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0] == ChannelFuture.class; + if (!rightList) continue; + + allServerChannels = (List) field.get(connection); + for (ChannelFuture o : allServerChannels) { + listeningChannel = o; + break; + } + } + if (listeningChannel == null) { + throw new RuntimeException("Unable to find listening channel!"); + } + + // Making this a function prevents childHandler from being treated as a non-final variable + ChannelInitializer childHandler = getChildHandler(bootstrap, listeningChannel); + // This method is what initializes the connection in Java Edition, after Netty is all set. + Method initChannel = childHandler.getClass().getDeclaredMethod("initChannel", Channel.class); + initChannel.setAccessible(true); + + ChannelFuture channelFuture = (new ServerBootstrap() + .channel(LocalServerChannelWrapper.class) + .childHandler(new ChannelInitializer() { + @Override + protected void initChannel(Channel ch) throws Exception { + initChannel.invoke(childHandler, ch); + } + }) + .group(new DefaultEventLoopGroup()) + .localAddress(LocalAddress.ANY)) + .bind() + .syncUninterruptibly(); + // We don't need to add to the list, but plugins like ProtocolSupport and ProtocolLib that add to the main pipeline + // will work when we add to the list. + allServerChannels.add(channelFuture); + this.localChannel = channelFuture; + this.serverSocketAddress = channelFuture.channel().localAddress(); + } + + @SuppressWarnings("unchecked") + private ChannelInitializer getChildHandler(GeyserBootstrap bootstrap, ChannelFuture listeningChannel) { + List names = listeningChannel.channel().pipeline().names(); + ChannelInitializer childHandler = null; + for (String name : names) { + ChannelHandler handler = listeningChannel.channel().pipeline().get(name); + try { + Field childHandlerField = handler.getClass().getDeclaredField("childHandler"); + childHandlerField.setAccessible(true); + childHandler = (ChannelInitializer) childHandlerField.get(handler); + // ViaVersion non-Paper-injector workaround so we aren't double-injecting + if (isViaVersion && childHandler instanceof BukkitChannelInitializer) { + childHandler = ((BukkitChannelInitializer) childHandler).getOriginal(); + } + break; + } catch (Exception e) { + if (bootstrap.getGeyserConfig().isDebugMode()) { + e.printStackTrace(); + } + } + } + if (childHandler == null) { + throw new RuntimeException(); + } + return childHandler; + } + + @Override + public void shutdown() { + if (this.allServerChannels != null) { + this.allServerChannels.remove(this.localChannel); + this.allServerChannels = null; + } + super.shutdown(); + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index 4c67a931b..e6b2ee0cb 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -54,6 +54,7 @@ import org.geysermc.platform.spigot.world.manager.*; import java.io.File; import java.io.IOException; +import java.net.SocketAddress; import java.nio.file.Path; import java.util.List; import java.util.UUID; @@ -62,6 +63,7 @@ import java.util.logging.Level; public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { private GeyserSpigotCommandManager geyserCommandManager; private GeyserSpigotConfiguration geyserConfig; + private GeyserSpigotInjector geyserInjector; private GeyserSpigotLogger geyserLogger; private IGeyserPingPassthrough geyserSpigotPingPassthrough; private GeyserSpigotWorldManager geyserWorldManager; @@ -176,6 +178,11 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // Set if we need to use a different method for getting a player's locale SpigotCommandSender.setUseLegacyLocaleMethod(isPre1_12); + // We want to do this late in the server startup process to allow plugins such as ViaVersion and ProtocolLib + // To do their job injecting, then connect into *that* + this.geyserInjector = new GeyserSpigotInjector(isViaVersion); + this.geyserInjector.initializeLocalChannel(this); + if (connector.getConfig().isUseAdapters()) { try { String name = Bukkit.getServer().getClass().getPackage().getName(); @@ -233,6 +240,9 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { if (connector != null) { connector.shutdown(); } + if (geyserInjector != null) { + geyserInjector.shutdown(); + } } @Override @@ -275,6 +285,11 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { return this.minecraftVersion; } + @Override + public SocketAddress getSocketAddress() { + return this.geyserInjector.getServerSocketAddress(); + } + public boolean isCompatible(String version, String whichVersion) { int[] currentVersion = parseVersion(version); int[] otherVersion = parseVersion(whichVersion); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java new file mode 100644 index 000000000..d13427faa --- /dev/null +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2019-2021 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.platform.velocity; + +import com.github.steveice10.packetlib.io.local.LocalServerChannelWrapper; +import com.velocitypowered.api.proxy.ProxyServer; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.*; +import io.netty.channel.local.LocalAddress; +import org.geysermc.connector.bootstrap.GeyserBootstrap; +import org.geysermc.connector.common.GeyserInjector; + +import java.lang.reflect.Field; +import java.util.function.Supplier; + +public class GeyserVelocityInjector extends GeyserInjector { + private final ProxyServer proxy; + + public GeyserVelocityInjector(ProxyServer proxy) { + this.proxy = proxy; + } + + @Override + @SuppressWarnings("unchecked") + protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception { + Field cm = proxy.getClass().getDeclaredField("cm"); + cm.setAccessible(true); + Object connectionManager = cm.get(proxy); + Class connectionManagerClass = connectionManager.getClass(); + + Supplier> serverChannelInitializerHolder = (Supplier>) connectionManagerClass + .getMethod("getServerChannelInitializer") + .invoke(connectionManager); + ChannelInitializer channelInitializer = serverChannelInitializerHolder.get(); + + // Is set on Velocity's end for listening to Java connections - required on ours or else the initial world load process won't finish sometimes + Field serverWriteMarkField = connectionManagerClass.getDeclaredField("SERVER_WRITE_MARK"); + serverWriteMarkField.setAccessible(true); + WriteBufferWaterMark serverWriteMark = (WriteBufferWaterMark) serverWriteMarkField.get(null); + + EventLoopGroup bossGroup = (EventLoopGroup) connectionManagerClass.getMethod("getBossGroup").invoke(connectionManager); + + Field workerGroupField = connectionManagerClass.getDeclaredField("workerGroup"); + workerGroupField.setAccessible(true); + EventLoopGroup workerGroup = (EventLoopGroup) workerGroupField.get(connectionManager); + + ChannelFuture channelFuture = (new ServerBootstrap() + .channel(LocalServerChannelWrapper.class) + .childHandler(channelInitializer) + .group(bossGroup, workerGroup) // Cannot be DefaultEventLoopGroup + .childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, serverWriteMark) // Required or else rare network freezes can occur + .localAddress(LocalAddress.ANY)) + .bind() + .syncUninterruptibly(); + + this.localChannel = channelFuture; + this.serverSocketAddress = channelFuture.channel().localAddress(); + } +} diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java index df25167e6..0802d07c2 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java @@ -28,6 +28,7 @@ package org.geysermc.platform.velocity; import com.google.inject.Inject; import com.velocitypowered.api.command.CommandManager; import com.velocitypowered.api.event.Subscribe; +import com.velocitypowered.api.event.proxy.ListenerBoundEvent; import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; import com.velocitypowered.api.plugin.Plugin; @@ -45,11 +46,13 @@ import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.platform.velocity.command.GeyserVelocityCommandExecutor; import org.geysermc.platform.velocity.command.GeyserVelocityCommandManager; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; +import java.net.SocketAddress; import java.nio.file.Path; import java.nio.file.Paths; import java.util.UUID; @@ -68,6 +71,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { private GeyserVelocityCommandManager geyserCommandManager; private GeyserVelocityConfiguration geyserConfig; + private GeyserVelocityInjector geyserInjector; private GeyserVelocityLogger geyserLogger; private IGeyserPingPassthrough geyserPingPassthrough; @@ -130,6 +134,9 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { this.connector = GeyserConnector.start(PlatformType.VELOCITY, this); + this.geyserInjector = new GeyserVelocityInjector(proxyServer); + // Will be initialized after the proxy has been bound + this.geyserCommandManager = new GeyserVelocityCommandManager(connector); this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(connector)); if (geyserConfig.isLegacyPingPassthrough()) { @@ -141,7 +148,12 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { @Override public void onDisable() { - connector.shutdown(); + if (connector != null) { + connector.shutdown(); + } + if (geyserInjector != null) { + geyserInjector.shutdown(); + } } @Override @@ -174,8 +186,20 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { onDisable(); } + @Subscribe + public void onProxyBound(ListenerBoundEvent event) { + // After this bound, we know that the channel initializer cannot change without it being ineffective for Velocity, too + geyserInjector.initializeLocalChannel(this); + } + @Override public BootstrapDumpInfo getDumpInfo() { return new GeyserVelocityDumpInfo(proxyServer); } + + @Nullable + @Override + public SocketAddress getSocketAddress() { + return this.geyserInjector.getServerSocketAddress(); + } } diff --git a/connector/pom.xml b/connector/pom.xml index 04cc2c117..34a31e89f 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -156,10 +156,10 @@ com.github.GeyserMC PacketLib - 0b75570 + 25eb4c4 compile - + io.netty netty-all diff --git a/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java b/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java index 59dc58c2b..ef0e0068c 100644 --- a/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java +++ b/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java @@ -34,6 +34,7 @@ import org.geysermc.connector.network.translators.world.GeyserWorldManager; import org.geysermc.connector.network.translators.world.WorldManager; import javax.annotation.Nullable; +import java.net.SocketAddress; import java.nio.file.Path; public interface GeyserBootstrap { @@ -114,4 +115,9 @@ public interface GeyserBootstrap { default String getMinecraftServerVersion() { return null; } + + @Nullable + default SocketAddress getSocketAddress() { + return null; + } } diff --git a/connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java b/connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java new file mode 100644 index 000000000..f7da49727 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2019-2021 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.connector.common; + +import io.netty.channel.ChannelFuture; +import lombok.Getter; +import org.geysermc.connector.bootstrap.GeyserBootstrap; + +import java.net.SocketAddress; + +/** + * Used to inject Geyser clients directly into the server, bypassing the need to implement a complete TCP connection, + * by creating a local channel. + */ +public abstract class GeyserInjector { + /** + * The local channel we can use to inject ourselves into the server without creating a TCP connection. + */ + protected ChannelFuture localChannel; + /** + * The LocalAddress to use to connect to the server without connecting over TCP. + */ + @Getter + protected SocketAddress serverSocketAddress; + + /** + * + * @param bootstrap the bootstrap of the Geyser instance. + */ + public void initializeLocalChannel(GeyserBootstrap bootstrap) { + if (!bootstrap.getGeyserConfig().isUseDirectConnection()) { + bootstrap.getGeyserLogger().debug("Disabling direct injection!"); + return; + } + + if (this.localChannel != null) { + bootstrap.getGeyserLogger().warning("Geyser attempted to inject into the server connection handler twice! Please ensure you aren't using /reload or any plugin that (re)loads Geyser after the server has started."); + return; + } + + try { + initializeLocalChannel0(bootstrap); + bootstrap.getGeyserLogger().debug("Local injection succeeded!"); + } catch (Exception e) { + e.printStackTrace(); + // If the injector partially worked, undo it + shutdown(); + } + } + + /** + * The method to implement that is called by {@link #initializeLocalChannel(GeyserBootstrap)} wrapped around a try/catch. + */ + protected abstract void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception; + + public void shutdown() { + if (localChannel != null && localChannel.channel().isOpen()) { + try { + localChannel.channel().close().sync(); + localChannel = null; + } catch (Exception e) { + e.printStackTrace(); + } + } else if (localChannel != null) { + localChannel = null; + } + } +} diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java index d0195df70..a48ce030b 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java @@ -173,6 +173,8 @@ public interface GeyserConfiguration { boolean isUseAdapters(); + boolean isUseDirectConnection(); + int getConfigVersion(); static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) { diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java index 05dfdb51a..b502d81ca 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java @@ -28,6 +28,9 @@ package org.geysermc.connector.configuration; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Getter; import lombok.Setter; @@ -35,7 +38,9 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.connector.network.CIDRMatcher; +import org.geysermc.connector.utils.LanguageUtils; +import java.io.IOException; import java.nio.file.Path; import java.util.Collections; import java.util.List; @@ -45,6 +50,7 @@ import java.util.stream.Collectors; @Getter @JsonIgnoreProperties(ignoreUnknown = true) +@SuppressWarnings("FieldMayBeFinal") // Jackson requires that the fields are not final public abstract class GeyserJacksonConfiguration implements GeyserConfiguration { /** @@ -191,6 +197,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @AsteriskSerializer.Asterisk(isIp = true) private String address = "auto"; + @JsonDeserialize(using = PortDeserializer.class) @Setter private int port = 25565; @@ -243,6 +250,25 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @JsonProperty("use-adapters") private boolean useAdapters = true; + @JsonProperty("use-direct-connection") + private boolean useDirectConnection = true; + @JsonProperty("config-version") private int configVersion = 0; + + /** + * Ensure that the port deserializes in the config as a number no matter what. + */ + protected static class PortDeserializer extends JsonDeserializer { + @Override + public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + System.err.println(LanguageUtils.getLocaleStringLog("geyser.bootstrap.config.invalid_port")); + return 25565; + } + } + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index cea9b3052..c8d60c1ea 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -70,6 +70,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.NonNull; import lombok.Setter; +import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.common.AuthType; @@ -744,7 +745,17 @@ public class GeyserSession implements CommandSender { disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); return; } - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", authData.getName(), protocol.getProfile().getName(), remoteAddress)); + + if (downstream.isInternallyConnecting()) { + // Connected directly to the server + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect_internal", + authData.getName(), protocol.getProfile().getName())); + } else { + // Connected to an IP address + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", + authData.getName(), protocol.getProfile().getName(), remoteAddress)); + } + UUID uuid = protocol.getProfile().getId(); if (uuid == null) { // Set what our UUID *probably* is going to be @@ -774,7 +785,11 @@ public class GeyserSession implements CommandSender { public void disconnected(DisconnectedEvent event) { loggingIn = false; loggedIn = false; - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, event.getReason())); + if (downstream != null && downstream.isInternallyConnecting()) { + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), event.getReason())); + } else { + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, event.getReason())); + } if (event.getCause() != null) { event.getCause().printStackTrace(); } @@ -819,7 +834,26 @@ public class GeyserSession implements CommandSender { if (!daylightCycle) { setDaylightCycle(true); } - downstream.connect(); + boolean internalConnect = false; + if (connector.getBootstrap().getSocketAddress() != null) { + try { + // Only affects Waterfall, but there is no sure way to differentiate between a proxy with this patch and a proxy without this patch + // Patch causing the issue: https://github.com/PaperMC/Waterfall/blob/7e6af4cef64d5d377a6ffd00a534379e6efa94cf/BungeeCord-Patches/0045-Don-t-use-a-bytebuf-for-packet-decoding.patch + // If native compression is enabled, then this line is tripped up if a heap buffer is sent over in such a situation + // as a new direct buffer is not created with that patch (HeapByteBufs throw an UnsupportedOperationException here): + // https://github.com/SpigotMC/BungeeCord/blob/a283aaf724d4c9a815540cd32f3aafaa72df9e05/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java#L43 + // This issue could be mitigated down the line by preventing Bungee from setting compression + downstream.setFlag(BuiltinFlags.USE_ONLY_DIRECT_BUFFERS, connector.getPlatformType() == PlatformType.BUNGEECORD); + + downstream.connectInternal(connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), true); + internalConnect = true; + } catch (Exception e) { + e.printStackTrace(); + } + } + if (!internalConnect) { + downstream.connect(); + } connector.addPlayer(this); } diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 3cbdb2e55..0d87c0c02 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -37,12 +37,13 @@ bedrock: remote: # The IP address of the remote (Java Edition) server # If it is "auto", for standalone version the remote address will be set to 127.0.0.1, - # for plugin versions, Geyser will attempt to find the best address to connect to. + # for plugin versions, it is recommended to keep this as "auto" so Geyser will automatically configure address, port, and auth-type. address: auto # The port of the remote (Java Edition) server # For plugin versions, if address has been set to "auto", the port will also follow the server's listening port. port: 25565 # Authentication type. Can be offline, online, or floodgate (see https://github.com/GeyserMC/Geyser/wiki/Floodgate). + # For plugin versions, it's recommended to keep the `address` field to "auto" so Floodgate support is automatically configured. auth-type: online # Allow for password-based authentication methods through Geyser. Only useful in online mode. # If this is false, users must authenticate to Microsoft using a code provided by Geyser on their desktop. @@ -65,6 +66,7 @@ extended-world-height: false # Floodgate uses encryption to ensure use from authorised sources. # This should point to the public key generated by Floodgate (BungeeCord, Spigot or Velocity) # You can ignore this when not using Floodgate. +# If you're using a plugin version of Floodgate on the same server, the key will automatically be picked up from Floodgate. floodgate-key-file: key.pem # The Xbox/Minecraft Bedrock username is the key for the Java server auth-info. @@ -197,4 +199,10 @@ enable-proxy-connections: false # Turning this off for Spigot will stop NMS from being used but will have a performance impact. use-adapters: true +# Whether to connect directly into the Java server without creating a TCP connection. +# This should only be disabled if a plugin that interfaces with packets or the network does not work correctly with Geyser. +# If enabled on plugin versions, the remote address and port sections are ignored +# If disabled on plugin versions, expect performance decrease and latency increase +use-direct-connection: true + config-version: 4 From a197f60446e1647c89749b63a6680b5892331777 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:54:51 -0400 Subject: [PATCH 528/766] Move use-direct-adapters to system property --- .../java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java | 4 ++-- .../geysermc/connector/configuration/GeyserConfiguration.java | 2 -- .../connector/configuration/GeyserJacksonConfiguration.java | 3 --- connector/src/main/resources/config.yml | 4 ---- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index e6b2ee0cb..d1364826a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -183,7 +183,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { this.geyserInjector = new GeyserSpigotInjector(isViaVersion); this.geyserInjector.initializeLocalChannel(this); - if (connector.getConfig().isUseAdapters()) { + if (Boolean.parseBoolean(System.getProperty("Geyser.UseDirectAdapters", "true"))) { try { String name = Bukkit.getServer().getClass().getPackage().getName(); String nmsVersion = name.substring(name.lastIndexOf('.') + 1); @@ -208,7 +208,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { } } } else { - geyserLogger.debug("Not using NMS adapter as it is disabled in the config."); + geyserLogger.debug("Not using NMS adapter as it is disabled via system property."); } if (this.geyserWorldManager == null) { // No NMS adapter diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java index a48ce030b..bf5b137b3 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java @@ -171,8 +171,6 @@ public interface GeyserConfiguration { int getMtu(); - boolean isUseAdapters(); - boolean isUseDirectConnection(); int getConfigVersion(); diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java index b502d81ca..759652293 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java @@ -247,9 +247,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @JsonProperty("mtu") private int mtu = 1400; - @JsonProperty("use-adapters") - private boolean useAdapters = true; - @JsonProperty("use-direct-connection") private boolean useDirectConnection = true; diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 0d87c0c02..c5698ad93 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -195,10 +195,6 @@ enable-proxy-connections: false # 1400 is the default. # mtu: 1400 -# Whether to use direct server methods to retrieve information such as block states. -# Turning this off for Spigot will stop NMS from being used but will have a performance impact. -use-adapters: true - # Whether to connect directly into the Java server without creating a TCP connection. # This should only be disabled if a plugin that interfaces with packets or the network does not work correctly with Geyser. # If enabled on plugin versions, the remote address and port sections are ignored From 3d50155ee3d7b4bb7ba0f08a3de16eed0fb42af4 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 31 Jul 2021 16:34:24 -0400 Subject: [PATCH 529/766] Handle the server sending invalid biome IDs in chunks Should hopefully address #2400 - the Java client handles invalid biome IDs and simply complains in its logs. --- .../network/translators/world/BiomeTranslator.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java index e76d179bf..143b778c6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java @@ -92,9 +92,12 @@ public class BiomeTranslator { bedrockId = Registries.BIOME_IDENTIFIERS.get().getInt(replacementBiome); } - if (javaId != bedrockId) { - // When we see the Java ID, we should instead apply the Bedrock ID - biomeTranslations.put(javaId, bedrockId); + // When we see the Java ID, we should instead apply the Bedrock ID + biomeTranslations.put(javaId, bedrockId); + + if (javaId == 0) { + // Matches Java behavior when it sees an invalid biome - it just replaces it with ID 0 + biomeTranslations.defaultReturnValue(bedrockId); } } } @@ -132,8 +135,8 @@ public class BiomeTranslator { int x = i & 3; int y = (i >> 4) & 3; int z = (i >> 2) & 3; - // Get the Bedrock biome ID override, or this ID if it's the same - int biomeId = biomeTranslations.getOrDefault(javaId, javaId); + // Get the Bedrock biome ID override + int biomeId = biomeTranslations.get(javaId); int idx = storage.idFor(biomeId); // Convert biome coordinates into block coordinates // Bedrock expects a full 4096 blocks From 20b183ddda529ef91df2a15ae8f2523c9e4aff73 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 1 Aug 2021 19:14:01 -0400 Subject: [PATCH 530/766] Fix horse variant color Our old method broke with the 1.17.10 update. --- .../connector/entity/living/animal/horse/HorseEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java index 094726de1..87155005d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java @@ -40,7 +40,7 @@ public class HorseEntity extends AbstractHorseEntity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { if (entityMetadata.getId() == 19) { - metadata.put(EntityData.VARIANT, entityMetadata.getValue()); + metadata.put(EntityData.VARIANT, ((int) entityMetadata.getValue()) & 255); metadata.put(EntityData.MARK_VARIANT, (((int) entityMetadata.getValue()) >> 8) % 5); } super.updateBedrockMetadata(entityMetadata, session); From 3eb73a56347449d2bbc9813c134087ed3799370e Mon Sep 17 00:00:00 2001 From: David Choo Date: Sun, 1 Aug 2021 22:20:15 -0400 Subject: [PATCH 531/766] Fix powder snow and fish buckets (#2437) --- .../living/animal/TropicalFishEntity.java | 58 ++++++++++- ...BedrockInventoryTransactionTranslator.java | 25 ++--- .../translators/item/StoredItemMappings.java | 2 + .../nbt/TropicalFishBucketTranslator.java | 96 +++++++++++++++++++ .../block/BucketSoundInteractionHandler.java | 19 +++- connector/src/main/resources/mappings | 2 +- 6 files changed, 182 insertions(+), 20 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java index 7a5906dd9..d16eb2ece 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java @@ -26,14 +26,27 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.google.common.collect.ImmutableList; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.connector.entity.living.AbstractFishEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.List; + public class TropicalFishEntity extends AbstractFishEntity { + /** + * A list of variant numbers that are given special names + * The index of the variant in this list is used as part of the locale key + */ + private static final IntList PREDEFINED_VARIANTS = IntList.of(117506305, 117899265, 185008129, 117441793, 118161664, 65536, 50726144, 67764993, 234882305, 67110144, 117441025, 16778497, 101253888, 50660352, 918529, 235340288, 918273, 67108865, 917504, 459008, 67699456, 67371009); + + private static final List VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish"); + private static final List COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black"); + public TropicalFishEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { super(entityId, geyserId, entityType, position, motion, rotation); } @@ -43,11 +56,48 @@ public class TropicalFishEntity extends AbstractFishEntity { if (entityMetadata.getId() == 17) { int varNumber = (int) entityMetadata.getValue(); - metadata.put(EntityData.VARIANT, varNumber & 0xFF); // Shape 0-1 - metadata.put(EntityData.MARK_VARIANT, (varNumber >> 8) & 0xFF); // Pattern 0-5 - metadata.put(EntityData.COLOR, (byte) ((varNumber >> 16) & 0xFF)); // Base color 0-15 - metadata.put(EntityData.COLOR_2, (byte) ((varNumber >> 24) & 0xFF)); // Pattern color 0-15 + metadata.put(EntityData.VARIANT, getShape(varNumber)); // Shape 0-1 + metadata.put(EntityData.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 + metadata.put(EntityData.COLOR, getBaseColor(varNumber)); // Base color 0-15 + metadata.put(EntityData.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15 } super.updateBedrockMetadata(entityMetadata, session); } + + public static int getShape(int variant) { + return Math.min(variant & 0xFF, 1); + } + + public static int getPattern(int variant) { + return Math.min((variant >> 8) & 0xFF, 5); + } + + public static byte getBaseColor(int variant) { + byte color = (byte) ((variant >> 16) & 0xFF); + if (!(0 <= color && color <= 15)) { + return 0; + } + return color; + } + + public static byte getPatternColor(int variant) { + byte color = (byte) ((variant >> 24) & 0xFF); + if (!(0 <= color && color <= 15)) { + return 0; + } + return color; + } + + public static String getVariantName(int variant) { + int id = 6 * getShape(variant) + getPattern(variant); + return VARIANT_NAMES.get(id); + } + + public static String getColorName(byte colorId) { + return COLOR_NAMES.get(colorId); + } + + public static int getPredefinedId(int variant) { + return PREDEFINED_VARIANTS.indexOf(variant); + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 589fa49d0..d519f2682 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -38,7 +38,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlags; import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.connector.entity.CommandBlockMinecartEntity; @@ -149,7 +148,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { - ClientPlayerUseItemPacket itemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); - session.sendDownstreamPacket(itemPacket); - }, 5, TimeUnit.MILLISECONDS)); + // Don't send ClientPlayerUseItemPacket for powder snow buckets + if (packet.getItemInHand().getId() != session.getItemMappings().getStoredItems().powderSnowBucket().getBedrockId()) { + // Special check for crafting tables since clients don't send BLOCK_INTERACT when interacting + int blockState = session.getConnector().getWorldManager().getBlockAt(session, packet.getBlockPosition()); + if (session.isSneaking() || blockState != BlockRegistries.JAVA_IDENTIFIERS.get("minecraft:crafting_table")) { + // Delay the interaction in case the client doesn't intend to actually use the bucket + // See BedrockActionTranslator.java + session.setBucketScheduledFuture(session.getConnector().getGeneralThreadPool().schedule(() -> { + ClientPlayerUseItemPacket itemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); + session.sendDownstreamPacket(itemPacket); + }, 5, TimeUnit.MILLISECONDS)); + } + } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java index 80a50f831..7f8456d6a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java @@ -46,6 +46,7 @@ public class StoredItemMappings { private final ItemMapping fishingRod; private final ItemMapping lodestoneCompass; private final ItemMapping milkBucket; + private final ItemMapping powderSnowBucket; private final ItemMapping egg; private final ItemMapping shield; private final ItemMapping wheat; @@ -60,6 +61,7 @@ public class StoredItemMappings { this.fishingRod = load(itemMappings, "fishing_rod"); this.lodestoneCompass = load(itemMappings, "lodestone_compass"); this.milkBucket = load(itemMappings, "milk_bucket"); + this.powderSnowBucket = load(itemMappings, "powder_snow_bucket"); this.egg = load(itemMappings, "egg"); this.shield = load(itemMappings, "shield"); this.wheat = load(itemMappings, "wheat"); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java new file mode 100644 index 000000000..2cbaea910 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.item.translators.nbt; + +import com.github.steveice10.opennbt.tag.builtin.*; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.Style; +import net.kyori.adventure.text.format.TextDecoration; +import org.geysermc.connector.entity.living.animal.TropicalFishEntity; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.ItemRemapper; +import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; +import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.connector.utils.LocaleUtils; + +import java.util.ArrayList; +import java.util.List; + +@ItemRemapper +public class TropicalFishBucketTranslator extends NbtItemStackTranslator { + + private static final Style LORE_STYLE = Style.style(NamedTextColor.GRAY, TextDecoration.ITALIC); + + @Override + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + // Prevent name from appearing as "Bucket of" + itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); + itemTag.put(new StringTag("CustomName", LocaleUtils.getLocaleString("entity.minecraft.tropical_fish", session.getLocale()))); + // Add Java's client side lore tag + Tag bucketVariantTag = itemTag.get("BucketVariantTag"); + if (bucketVariantTag instanceof IntTag) { + CompoundTag displayTag = itemTag.get("display"); + if (displayTag == null) { + displayTag = new CompoundTag("display"); + itemTag.put(displayTag); + } + + List lore = new ArrayList<>(); + + int varNumber = ((IntTag) bucketVariantTag).getValue(); + int predefinedVariantId = TropicalFishEntity.getPredefinedId(varNumber); + if (predefinedVariantId != -1) { + Component tooltip = Component.translatable("entity.minecraft.tropical_fish.predefined." + predefinedVariantId, LORE_STYLE); + lore.add(0, new StringTag("", MessageTranslator.convertMessage(tooltip, session.getLocale()))); + } else { + Component typeTooltip = Component.translatable("entity.minecraft.tropical_fish.type." + TropicalFishEntity.getVariantName(varNumber), LORE_STYLE); + lore.add(0, new StringTag("", MessageTranslator.convertMessage(typeTooltip, session.getLocale()))); + + byte baseColor = TropicalFishEntity.getBaseColor(varNumber); + byte patternColor = TropicalFishEntity.getPatternColor(varNumber); + Component colorTooltip = Component.translatable("color.minecraft." + TropicalFishEntity.getColorName(baseColor), LORE_STYLE); + if (baseColor != patternColor) { + colorTooltip = colorTooltip.append(Component.text(", ", LORE_STYLE)) + .append(Component.translatable("color.minecraft." + TropicalFishEntity.getColorName(patternColor), LORE_STYLE)); + } + lore.add(1, new StringTag("", MessageTranslator.convertMessage(colorTooltip, session.getLocale()))); + } + + ListTag loreTag = displayTag.get("Lore"); + if (loreTag != null) { + lore.addAll(loreTag.getValue()); + } + displayTag.put(new ListTag("Lore", lore)); + } + } + + @Override + public boolean acceptItem(ItemMapping mapping) { + return mapping.getJavaIdentifier().equals("minecraft:tropical_fish_bucket"); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java b/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java index d8689f51c..fe93361f0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java @@ -32,12 +32,14 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; import org.geysermc.connector.network.translators.sound.SoundHandler; -@SoundHandler(items = "bucket") +@SoundHandler(items = "bucket", ignoreSneakingWhileHolding = true) public class BucketSoundInteractionHandler implements BlockSoundInteractionHandler { @Override public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { - if (session.getBucketScheduledFuture() == null) return; // No bucket was really interacted with + if (session.getBucketScheduledFuture() == null) { + return; // No bucket was really interacted with + } String handItemIdentifier = session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier(); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); soundEventPacket.setPosition(position); @@ -52,22 +54,31 @@ public class BucketSoundInteractionHandler implements BlockSoundInteractionHandl soundEvent = SoundEvent.BUCKET_FILL_WATER; } else if (identifier.contains("lava[")) { soundEvent = SoundEvent.BUCKET_FILL_LAVA; + } else if (identifier.contains("powder_snow")) { + soundEvent = SoundEvent.BUCKET_FILL_POWDER_SNOW; } break; case "minecraft:lava_bucket": soundEvent = SoundEvent.BUCKET_EMPTY_LAVA; break; - case "minecraft:fish_bucket": + case "minecraft:axolotl_bucket": + case "minecraft:cod_bucket": + case "minecraft:salmon_bucket": + case "minecraft:pufferfish_bucket": + case "minecraft:tropical_fish_bucket": soundEvent = SoundEvent.BUCKET_EMPTY_FISH; break; case "minecraft:water_bucket": soundEvent = SoundEvent.BUCKET_EMPTY_WATER; break; + case "minecraft:powder_snow_bucket": + soundEvent = SoundEvent.BUCKET_EMPTY_POWDER_SNOW; + break; } if (soundEvent != null) { soundEventPacket.setSound(soundEvent); session.sendUpstreamPacket(soundEventPacket); + session.setBucketScheduledFuture(null); } - session.setBucketScheduledFuture(null); } } diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index f109d34a3..2efdb453e 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit f109d34a343da0ade6132661839b893859680d91 +Subproject commit 2efdb453e4e76992d63824b5c8b551bebec67b71 From fb5449d0d19f6eef6149deaf013b46df2c602198 Mon Sep 17 00:00:00 2001 From: David Choo Date: Tue, 3 Aug 2021 00:08:47 -0400 Subject: [PATCH 532/766] Fix extended world height client crash with 32+ section chunks (#2441) --- .../org/geysermc/connector/utils/ChunkUtils.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 932950240..2f36beea6 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -135,10 +135,12 @@ public class ChunkUtils { BitSet pistonOrFlowerPaletteIds = new BitSet(); boolean overworld = session.getChunkCache().isExtendedHeight(); + int maxBedrockSectionY = ((overworld ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT) >> 4) - 1; for (int sectionY = 0; sectionY < javaSections.length; sectionY++) { - if (yOffset < ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4) && sectionY < -yOffset) { - // Ignore this chunk since it goes below the accepted height limit + int bedrockSectionY = sectionY + (yOffset - ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4)); + if (bedrockSectionY < 0 || maxBedrockSectionY < bedrockSectionY) { + // Ignore this chunk section since it goes outside the bounds accepted by the Bedrock client continue; } @@ -168,12 +170,12 @@ public class ChunkUtils { // Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) { bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, - Vector3i.from((column.getX() << 4) + (yzx & 0xF), (sectionY << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), + Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), javaId )); } } - sections[sectionY + (yOffset - ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4))] = section; + sections[bedrockSectionY] = section; continue; } @@ -204,7 +206,7 @@ public class ChunkUtils { int paletteId = javaData.get(yzx); if (pistonOrFlowerPaletteIds.get(paletteId)) { bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, - Vector3i.from((column.getX() << 4) + (yzx & 0xF), (sectionY << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), + Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), javaPalette.idToState(paletteId) )); } @@ -246,7 +248,7 @@ public class ChunkUtils { layers = new BlockStorage[]{ layer0, new BlockStorage(BitArrayVersion.V1.createArray(BlockStorage.SIZE, layer1Data), layer1Palette) }; } - sections[sectionY + (yOffset - ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4))] = new ChunkSection(layers); + sections[bedrockSectionY] = new ChunkSection(layers); } CompoundTag[] blockEntities = column.getTileEntities(); From 71e2ec989c6ba740a7c6c3a4efc5a9422c8a8834 Mon Sep 17 00:00:00 2001 From: Luke <32024335+lukeeey@users.noreply.github.com> Date: Sun, 8 Aug 2021 17:36:51 +0100 Subject: [PATCH 533/766] Add donation link to README and FUNDING.yml (#2447) --- .github/FUNDING.yml | 13 +------------ README.md | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 19b655c29..3fdb3cd65 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,12 +1 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: #GeyserMC # Disabled currently -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +open_collective: geysermc \ No newline at end of file diff --git a/README.md b/README.md index 532e6b2c1..5444e8ae7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set - Docs: https://github.com/GeyserMC/Geyser/wiki - Download: https://ci.geysermc.org - Discord: https://discord.gg/geysermc -- ~~Donate: https://patreon.com/GeyserMC~~ Currently disabled. +- Donate: https://opencollective.com/geysermc - Test Server: `test.geysermc.org` port `25565` for Java and `19132` for Bedrock ## What's Left to be Added/Fixed From 0c5b39f35b2ef4d8d2fd8915cedcd23cd6fb69cb Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 11 Aug 2021 20:16:10 -0400 Subject: [PATCH 534/766] Intern strings and other values This should reduce memory usage at startup by preventing multiple identicals objects being present in memory. --- connector/pom.xml | 11 ++++++ .../registry/loader/NbtRegistryLoader.java | 2 +- .../populator/BlockRegistryPopulator.java | 18 +++++----- .../populator/ItemRegistryPopulator.java | 35 ++++++++++--------- 4 files changed, 39 insertions(+), 27 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 34a31e89f..be7b9869f 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -71,6 +71,10 @@ com.nukkitx.network raknet + + com.nukkitx + nbt + @@ -85,6 +89,13 @@ + + com.nukkitx + nbt + + 2.1.0 + compile + com.nukkitx.fastutil fastutil-int-int-maps diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java index b8ec65697..8e1230763 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java @@ -40,7 +40,7 @@ public class NbtRegistryLoader implements RegistryLoader { @Override public NbtMap load(String input) { InputStream stream = FileUtils.getResource(input); - try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)) { + try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream, true, true)) { return (NbtMap) nbtInputStream.readTag(); } catch (Exception e) { throw new AssertionError("Failed to load registrations for " + input, e); diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 233e11669..00e74d143 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -107,7 +107,7 @@ public class BlockRegistryPopulator { for (Map.Entry> palette : STATE_MAPPER.entrySet()) { InputStream stream = FileUtils.getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey())); NbtList blocksTag; - try (NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)))) { + try (NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { NbtMap blockPalette = (NbtMap) nbtInputStream.readTag(); blocksTag = (NbtList) blockPalette.getList("blocks", NbtType.COMPOUND); } catch (Exception e) { @@ -149,10 +149,10 @@ public class BlockRegistryPopulator { Map.Entry entry = blocksIterator.next(); String javaId = entry.getKey(); - NbtMap blockTag = buildBedrockState(entry.getValue(), stateVersion, stateMapper); - int bedrockRuntimeId = blockStateOrderedMap.getOrDefault(blockTag, -1); + int bedrockRuntimeId = blockStateOrderedMap.getOrDefault(buildBedrockState(entry.getValue(), stateVersion, stateMapper), -1); if (bedrockRuntimeId == -1) { - throw new RuntimeException("Unable to find " + javaId + " Bedrock runtime ID! Built compound tag: \n" + blockTag); + throw new RuntimeException("Unable to find " + javaId + " Bedrock runtime ID! Built NBT tag: \n" + + buildBedrockState(entry.getValue(), stateVersion, stateMapper)); } switch (javaId) { @@ -182,11 +182,11 @@ public class BlockRegistryPopulator { // Get the tag needed for non-empty flower pots if (entry.getValue().get("pottable") != null) { - flowerPotBlocks.put(cleanJavaIdentifier, blockTag); + flowerPotBlocks.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId)); } if (!cleanJavaIdentifier.equals(entry.getValue().get("bedrock_identifier").asText())) { - javaIdentifierToBedrockTag.put(cleanJavaIdentifier, blockTag); + javaIdentifierToBedrockTag.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId)); } javaToBedrockBlockMap.put(javaRuntimeId, bedrockRuntimeId); @@ -274,7 +274,7 @@ public class BlockRegistryPopulator { JsonNode pickItemNode = entry.getValue().get("pick_item"); if (pickItemNode != null) { - builder.pickItem(pickItemNode.textValue()); + builder.pickItem(pickItemNode.textValue().intern()); } BlockStateValues.storeBlockStateValues(entry.getKey(), javaRuntimeId, entry.getValue()); @@ -284,7 +284,7 @@ public class BlockRegistryPopulator { if (!cleanIdentifiers.contains(cleanJavaIdentifier)) { uniqueJavaId++; - cleanIdentifiers.add(cleanJavaIdentifier); + cleanIdentifiers.add(cleanJavaIdentifier.intern()); } builder.javaIdentifier(javaId); @@ -295,7 +295,7 @@ public class BlockRegistryPopulator { // Keeping this here since this is currently unchanged between versions if (!cleanJavaIdentifier.equals(bedrockIdentifier)) { - BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier, bedrockIdentifier); + BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier.intern(), bedrockIdentifier.intern()); } if (javaId.startsWith("minecraft:bell[")) { diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 7ba3886cb..967424017 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -249,24 +249,25 @@ public class ItemRegistryPopulator { javaOnlyItems.addAll(palette.getValue().getAdditionalTranslatedItems().keySet()); for (Map.Entry entry : items.entrySet()) { + String javaIdentifier = entry.getKey().intern(); GeyserMappingItem mappingItem; - String replacementItem = palette.getValue().getAdditionalTranslatedItems().get(entry.getKey()); + String replacementItem = palette.getValue().getAdditionalTranslatedItems().get(javaIdentifier); if (replacementItem != null) { mappingItem = items.get(replacementItem); } else { // This items has a mapping specifically for this version of the game mappingItem = entry.getValue(); } - if (entry.getKey().equals("minecraft:sculk_sensor") && GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { + if (javaIdentifier.equals("minecraft:sculk_sensor") && GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { mappingItem.setBedrockIdentifier("minecraft:sculk_sensor"); } - if (usingFurnaceMinecart && entry.getKey().equals("minecraft:furnace_minecart")) { + if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) { javaFurnaceMinecartId = itemIndex; itemIndex++; continue; } - String bedrockIdentifier = mappingItem.getBedrockIdentifier(); + String bedrockIdentifier = mappingItem.getBedrockIdentifier().intern(); int bedrockId = bedrockIdentifierToId.getInt(bedrockIdentifier); if (bedrockId == Short.MIN_VALUE) { throw new RuntimeException("Missing Bedrock ID in mappings: " + bedrockIdentifier); @@ -389,7 +390,7 @@ public class ItemRegistryPopulator { } ItemMapping.ItemMappingBuilder mappingBuilder = ItemMapping.builder() - .javaIdentifier(entry.getKey()) + .javaIdentifier(javaIdentifier) .javaId(itemIndex) .bedrockIdentifier(bedrockIdentifier) .bedrockId(bedrockId) @@ -399,14 +400,14 @@ public class ItemRegistryPopulator { if (mappingItem.getToolType() != null) { if (mappingItem.getToolTier() != null) { - mappingBuilder = mappingBuilder.toolType(mappingItem.getToolType()) - .toolTier(mappingItem.getToolTier()); + mappingBuilder = mappingBuilder.toolType(mappingItem.getToolType().intern()) + .toolTier(mappingItem.getToolTier().intern()); } else { - mappingBuilder = mappingBuilder.toolType(mappingItem.getToolType()) + mappingBuilder = mappingBuilder.toolType(mappingItem.getToolType().intern()) .toolTier(""); } } - if (javaOnlyItems.contains(entry.getKey())) { + if (javaOnlyItems.contains(javaIdentifier)) { // These items don't exist on Bedrock, so set up a variable that indicates they should have custom names mappingBuilder = mappingBuilder.translationString((bedrockBlockId != -1 ? "block." : "item.") + entry.getKey().replace(":", ".")); GeyserConnector.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated."); @@ -414,11 +415,11 @@ public class ItemRegistryPopulator { ItemMapping mapping = mappingBuilder.build(); - if (entry.getKey().contains("boat")) { + if (javaIdentifier.contains("boat")) { boats.add(bedrockId); - } else if (entry.getKey().contains("bucket") && !entry.getKey().contains("milk")) { + } else if (javaIdentifier.contains("bucket") && !javaIdentifier.contains("milk")) { buckets.add(bedrockId); - } else if (entry.getKey().contains("_carpet") && !entry.getKey().contains("moss")) { + } else if (javaIdentifier.contains("_carpet") && !javaIdentifier.contains("moss")) { // This should be the numerical order Java sends as an integer value for llamas carpets.add(ItemData.builder() .id(mapping.getBedrockId()) @@ -426,18 +427,18 @@ public class ItemRegistryPopulator { .count(1) .blockRuntimeId(mapping.getBedrockBlockId()) .build()); - } else if (entry.getKey().startsWith("minecraft:music_disc_")) { + } else if (javaIdentifier.startsWith("minecraft:music_disc_")) { // The Java record level event uses the item ID as the "key" to play the record Registries.RECORDS.register(itemIndex, SoundEvent.valueOf("RECORD_" + - entry.getKey().replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH))); - } else if (entry.getKey().endsWith("_spawn_egg")) { + javaIdentifier.replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH).intern())); + } else if (javaIdentifier.endsWith("_spawn_egg")) { spawnEggs.add(mapping.getBedrockId()); } mappings.put(itemIndex, mapping); - identifierToMapping.put(entry.getKey(), mapping); + identifierToMapping.put(javaIdentifier, mapping); - itemNames.add(entry.getKey()); + itemNames.add(javaIdentifier); itemIndex++; } From b95cd8e0c1cb7c1a5fed23465b7edf93736b96e1 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 12 Aug 2021 10:42:58 -0400 Subject: [PATCH 535/766] Query improvements - Improved detection of query packet - Don't initialize the QueryPacketHandler class until we verified we have query data - Encode strings like the vanilla Minecraft server --- .../network/ConnectorServerEventHandler.java | 9 ++- .../connector/network/QueryPacketHandler.java | 67 +++++++++++-------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index 554ae9504..67fbdbbfd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -28,6 +28,7 @@ package org.geysermc.connector.network; import com.nukkitx.protocol.bedrock.BedrockPong; import com.nukkitx.protocol.bedrock.BedrockServerEventHandler; import com.nukkitx.protocol.bedrock.BedrockServerSession; +import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.socket.DatagramPacket; import org.geysermc.connector.GeyserConnector; @@ -38,6 +39,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.utils.LanguageUtils; +import javax.annotation.Nonnull; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.util.List; @@ -166,7 +168,10 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } @Override - public void onUnhandledDatagram(ChannelHandlerContext ctx, DatagramPacket packet) { - new QueryPacketHandler(connector, packet.sender(), packet.content()); + public void onUnhandledDatagram(@Nonnull ChannelHandlerContext ctx, DatagramPacket packet) { + ByteBuf content = packet.content(); + if (QueryPacketHandler.isQueryPacket(content)) { + new QueryPacketHandler(connector, packet.sender(), content); + } } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java index 2d8f7d17c..656a88c4f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java @@ -27,12 +27,13 @@ package org.geysermc.connector.network; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.connector.network.translators.chat.MessageTranslator; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.ByteBuffer; @@ -46,27 +47,24 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; public class QueryPacketHandler { - public static final byte HANDSHAKE = 0x09; public static final byte STATISTICS = 0x00; - private GeyserConnector connector; - private InetSocketAddress sender; - private byte type; - private int sessionId; + private final GeyserConnector connector; + private final InetSocketAddress sender; + private final byte type; + private final int sessionId; private byte[] token; /** - * The Query packet handler instance + * The Query packet handler instance. The unsigned short magic handshake should already be read at this point, + * and the packet should be verified to have enough buffer space to be a qualified query packet. * * @param connector Geyser Connector * @param sender The Sender IP/Port for the Query * @param buffer The Query data */ public QueryPacketHandler(GeyserConnector connector, InetSocketAddress sender, ByteBuf buffer) { - if (!isQueryPacket(buffer)) - return; - this.connector = connector; this.sender = sender; this.type = buffer.readByte(); @@ -82,8 +80,9 @@ public class QueryPacketHandler { * @param buffer Query data * @return if the packet is a query packet */ - private boolean isQueryPacket(ByteBuf buffer) { - return buffer.readableBytes() >= 2 && buffer.readUnsignedShort() == 0xFEFD; + public static boolean isQueryPacket(ByteBuf buffer) { + // 2 for magic short, 1 for type byte and 4 for session ID int + return buffer.readableBytes() >= (2 + 1 + 4) && buffer.readUnsignedShort() == 0xFEFD; } /** @@ -115,15 +114,18 @@ public class QueryPacketHandler { * Sends the query data to the sender */ private void sendQueryData() { - ByteBuf reply = ByteBufAllocator.DEFAULT.ioBuffer(64); + byte[] gameData = getGameData(); + byte[] playerData = getPlayers(); + + ByteBuf reply = ByteBufAllocator.DEFAULT.ioBuffer(1 + 4 + gameData.length + playerData.length); reply.writeByte(STATISTICS); reply.writeInt(sessionId); // Game Info - reply.writeBytes(getGameData()); + reply.writeBytes(gameData); // Players - reply.writeBytes(getPlayers()); + reply.writeBytes(playerData); sendPacket(reply); } @@ -164,13 +166,13 @@ public class QueryPacketHandler { // If passthrough protocol name is enabled let's get the protocol name from the ping response. if (connector.getConfig().isPassthroughProtocolName() && pingInfo != null) { - map = String.valueOf((pingInfo.getVersion().getName())); + map = pingInfo.getVersion().getName(); } else { map = GeyserConnector.NAME; } // Create a hashmap of all game data needed in the query - Map gameData = new HashMap(); + Map gameData = new HashMap<>(); gameData.put("hostname", motd); gameData.put("gametype", "SMP"); gameData.put("game_id", "MINECRAFT"); @@ -183,18 +185,14 @@ public class QueryPacketHandler { gameData.put("hostip", connector.getConfig().getBedrock().getAddress()); try { - // Blank Buffer Bytes - query.write("GeyserMC".getBytes()); - query.write((byte) 0x00); + writeString(query, "GeyserMC"); query.write((byte) 0x80); query.write((byte) 0x00); // Fills the game data - for(Map.Entry entry : gameData.entrySet()) { - query.write(entry.getKey().getBytes()); - query.write((byte) 0x00); - query.write(entry.getValue().getBytes()); - query.write((byte) 0x00); + for (Map.Entry entry : gameData.entrySet()) { + writeString(query, entry.getKey()); + writeString(query, entry.getValue()); } // Final byte to show the end of the game data @@ -221,14 +219,13 @@ public class QueryPacketHandler { try { // Start the player section - query.write("player_".getBytes()); - query.write(new byte[] { 0x00, 0x00 }); + writeString(query, "player_"); + query.write((byte) 0x00); // Fill player names if (pingInfo != null) { for (String username : pingInfo.getPlayerList()) { - query.write(username.getBytes()); - query.write((byte) 0x00); + writeString(query, username); } } @@ -241,6 +238,18 @@ public class QueryPacketHandler { } } + /** + * Partially mimics {@link java.io.DataOutputStream#writeBytes(String)} which is what the Minecraft server uses as of 1.17.1. + */ + private void writeString(OutputStream stream, String value) throws IOException { + int length = value.length(); + for (int i = 0; i < length; i++) { + stream.write((byte) value.charAt(i)); + } + // Padding to indicate the end of the string + stream.write((byte) 0x00); + } + /** * Sends a packet to the sender * From e20247b6d677426ce479976b59c898077c81b731 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 12 Aug 2021 14:16:19 -0400 Subject: [PATCH 536/766] Allow enum fields to be set through standalone command line --- .../platform/standalone/GeyserStandaloneBootstrap.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java index 1a25d2792..f875127cc 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java @@ -315,6 +315,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { * @param parentObject The object to alter * @param value The new value of the property */ + @SuppressWarnings("unchecked") // Required for enum usage private static void setConfigOption(BeanPropertyDefinition property, Object parentObject, Object value) { Object parsedValue = value; @@ -323,6 +324,8 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { parsedValue = Integer.valueOf((String) parsedValue); } else if (boolean.class.equals(property.getRawPrimaryType())) { parsedValue = Boolean.valueOf((String) parsedValue); + } else if (Enum.class.isAssignableFrom(property.getRawPrimaryType())) { + parsedValue = Enum.valueOf((Class) property.getRawPrimaryType(), ((String) parsedValue).toUpperCase(Locale.ROOT)); } // Force the value to be set From 919e84c23f9dad98fd41e09230b30858d77493f0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 12 Aug 2021 14:35:26 -0400 Subject: [PATCH 537/766] Don't try to connect to the remote server with invalid credentials Fixes #2458 --- .../connector/network/session/GeyserSession.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index c8d60c1ea..f814a787a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -590,9 +590,17 @@ public class GeyserSession implements CommandSender { disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); } catch (RequestException ex) { ex.printStackTrace(); + disconnect(ex.getMessage()); } return null; - }).whenComplete((aVoid, ex) -> connectDownstream()); + }).whenComplete((aVoid, ex) -> { + if (this.closed) { + // Client disconnected during the authentication attempt + return; + } + + connectDownstream(); + }); } /** From 25ff3661e3e9223d0c919db4ba6af1469b486733 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 13 Aug 2021 13:37:06 -0400 Subject: [PATCH 538/766] Update version strings to add 1.17.11 This version has been supported; let's make it clear that it is. --- .../geysermc/connector/command/defaults/VersionCommand.java | 2 +- .../java/org/geysermc/connector/network/BedrockProtocol.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java index 989ba3306..c85759154 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java @@ -60,7 +60,7 @@ public class VersionCommand extends GeyserCommand { if (supportedCodecs.size() > 1) { bedrockVersions = supportedCodecs.get(0).getMinecraftVersion() + " - " + supportedCodecs.get(supportedCodecs.size() - 1).getMinecraftVersion(); } else { - bedrockVersions = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion(); + bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion(); } sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java index 04ef7412c..660f1d039 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java @@ -54,7 +54,9 @@ public class BedrockProtocol { .minecraftVersion("1.17.0/1.17.1/1.17.2") .build()); } - SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC); + SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder() + .minecraftVersion("1.17.10/1.17.11") + .build()); } /** From 1afa22d5cf4406eddd2b7fcc2d666af893bf288b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 13 Aug 2021 13:42:35 -0400 Subject: [PATCH 539/766] Fix NPE with area effect cloud particles --- .../org/geysermc/connector/utils/EffectUtils.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java index 8d69fa691..b79476e9c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java @@ -27,9 +27,11 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import lombok.NonNull; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.Registries; +import org.geysermc.connector.registry.type.ParticleMapping; + +import javax.annotation.Nonnull; /** * Util for particles and effects. @@ -42,8 +44,13 @@ public class EffectUtils { * @param type the Java particle to search for * @return the Bedrock integer ID of the particle, or -1 if it does not exist */ - public static int getParticleId(GeyserSession session, @NonNull ParticleType type) { - LevelEventType levelEventType = Registries.PARTICLES.get(type).getLevelEventType(); + public static int getParticleId(GeyserSession session, @Nonnull ParticleType type) { + ParticleMapping mapping = Registries.PARTICLES.get(type); + if (mapping == null) { + return -1; + } + + LevelEventType levelEventType = mapping.getLevelEventType(); if (levelEventType == null) { return -1; } From 9f4c2ce5fce8a4226288f2392ea7c427eb55e64c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 13 Aug 2021 23:56:44 -0400 Subject: [PATCH 540/766] Fix rare StackOverflowError in DeclareCommands This behavior is exhibited with the NanoLimbo software version 1.2.2. --- .../translators/java/JavaDeclareCommandsTranslator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 835432376..4780360dd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -295,6 +295,11 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator Date: Sat, 14 Aug 2021 00:39:09 -0400 Subject: [PATCH 541/766] Update README.md (#2470) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5444e8ae7..ce786545a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,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.17.0 - 1.17.10 and Minecraft Java 1.17.1. +### Currently supporting Minecraft Bedrock 1.17.0 - 1.17.11 and Minecraft Java 1.17.1. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. From 5d90ba91f77d7d45c4b8aeae45ccb39f9ecaca9a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 14 Aug 2021 12:52:35 -0400 Subject: [PATCH 542/766] Move LoginSuccessPacket handling to its own translator --- .../network/session/GeyserSession.java | 21 ------- .../java/JavaLoginSuccessTranslator.java | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 21 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index f814a787a..1c5675dc4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -25,7 +25,6 @@ package org.geysermc.connector.network.session; -import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.exception.request.AuthPendingException; import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException; import com.github.steveice10.mc.auth.exception.request.RequestException; @@ -45,7 +44,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; -import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.event.session.*; import com.github.steveice10.packetlib.packet.Packet; @@ -94,7 +92,6 @@ import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.BlockMappings; import org.geysermc.connector.registry.type.ItemMappings; import org.geysermc.connector.skin.FloodgateSkinUploader; -import org.geysermc.connector.skin.SkinManager; import org.geysermc.connector.utils.*; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.util.FormBuilder; @@ -808,24 +805,6 @@ public class GeyserSession implements CommandSender { @Override public void packetReceived(PacketReceivedEvent event) { if (!closed) { - // Required, or else Floodgate players break with Bukkit chunk caching - if (event.getPacket() instanceof LoginSuccessPacket) { - GameProfile profile = ((LoginSuccessPacket) event.getPacket()).getProfile(); - playerEntity.setUsername(profile.getName()); - playerEntity.setUuid(profile.getId()); - - // Check if they are not using a linked account - if (remoteAuthType == AuthType.OFFLINE || playerEntity.getUuid().getMostSignificantBits() == 0) { - SkinManager.handleBedrockSkin(playerEntity, clientData); - } - - if (remoteAuthType == AuthType.FLOODGATE) { - // We'll send the skin upload a bit after the handshake packet (aka this packet), - // because otherwise the global server returns the data too fast. - getAuthData().upload(connector); - } - } - PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(event.getPacket().getClass(), event.getPacket(), GeyserSession.this); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java new file mode 100644 index 000000000..214ea5deb --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java; + +import com.github.steveice10.mc.auth.data.GameProfile; +import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket; +import org.geysermc.connector.common.AuthType; +import org.geysermc.connector.entity.player.PlayerEntity; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.skin.SkinManager; + +@Translator(packet = LoginSuccessPacket.class) +public class JavaLoginSuccessTranslator extends PacketTranslator { + + @Override + public void translate(LoginSuccessPacket packet, GeyserSession session) { + PlayerEntity playerEntity = session.getPlayerEntity(); + AuthType remoteAuthType = session.getRemoteAuthType(); + + // Required, or else Floodgate players break with Spigot chunk caching + GameProfile profile = packet.getProfile(); + playerEntity.setUsername(profile.getName()); + playerEntity.setUuid(profile.getId()); + + // Check if they are not using a linked account + if (remoteAuthType == AuthType.OFFLINE || playerEntity.getUuid().getMostSignificantBits() == 0) { + SkinManager.handleBedrockSkin(playerEntity, session.getClientData()); + } + + if (remoteAuthType == AuthType.FLOODGATE) { + // We'll send the skin upload a bit after the handshake packet (aka this packet), + // because otherwise the global server returns the data too fast. + session.getAuthData().upload(session.getConnector()); + } + } +} From ce748990a4ba67589d75c3b78eef89c994463b88 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 15 Aug 2021 14:57:02 -0400 Subject: [PATCH 543/766] Javadoc fix and tiny teleport optimization --- .../geysermc/connector/network/session/GeyserSession.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 1c5675dc4..74ff369de 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -187,9 +187,7 @@ public class GeyserSession implements CommandSender { private final Long2ObjectMap storedMaps = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>()); /** - * Stores the differences between Java and Bedrock biome network IDs. - * If Java's ocean biome is 0, and Bedrock's is 0, it will not be in the list. - * If Java's bamboo biome is 42, and Bedrock's is 48, it will be in this list. + * Stores the map between Java and Bedrock biome network IDs. */ private final Int2IntMap biomeTranslations = new Int2IntOpenHashMap(); @@ -1166,9 +1164,9 @@ public class GeyserSession implements CommandSender { } } - ObjectIterator> it = teleportMap.int2ObjectEntrySet().iterator(); - if (teleportID != -1) { + ObjectIterator> it = teleportMap.int2ObjectEntrySet().iterator(); + // Confirm the current teleport and any earlier ones while (it.hasNext()) { TeleportCache entry = it.next().getValue(); From ac17963baa98917141206f63bc4d4778cbc4179e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 11:53:56 -0400 Subject: [PATCH 544/766] Player effect cache cleanup Only cache effects and not their values unless we actually use the value. --- .../session/cache/EntityEffectCache.java | 132 +++-- .../entity/JavaEntityEffectTranslator.java | 6 +- .../JavaEntityRemoveEffectTranslator.java | 4 +- .../geysermc/connector/utils/BlockUtils.java | 515 +++++++++--------- .../connector/utils/DimensionUtils.java | 17 +- 5 files changed, 352 insertions(+), 322 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java index 1edcc4db0..7cf296be2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java @@ -1,54 +1,78 @@ -/* - * Copyright (c) 2019-2021 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.connector.network.session.cache; - -import com.github.steveice10.mc.protocol.data.game.entity.Effect; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import lombok.Getter; - -public class EntityEffectCache { - - @Getter - private final Object2IntMap entityEffects = new Object2IntOpenHashMap<>(); - - public void addEffect(Effect effect, int effectAmplifier) { - if (effect != null) { - entityEffects.putIfAbsent(effect, effectAmplifier + 1); - } - } - - public void removeEffect(Effect effect) { - if (entityEffects.containsKey(effect)) { - int effectLevel = entityEffects.getInt(effect); - entityEffects.remove(effect, effectLevel); - } - } - - public int getEffectLevel(Effect effect) { - return entityEffects.getOrDefault(effect, 0); - } -} +/* + * Copyright (c) 2019-2021 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.connector.network.session.cache; + +import com.github.steveice10.mc.protocol.data.game.entity.Effect; +import lombok.Getter; + +import java.util.EnumSet; +import java.util.Set; + +public class EntityEffectCache { + /** + * Used to clear effects on dimension switch. + */ + @Getter + private final Set entityEffects = EnumSet.noneOf(Effect.class); + + /* Used to track mining speed */ + @Getter + private int conduitPower; + @Getter + private int haste; + @Getter + private int miningFatigue; + + public void setEffect(Effect effect, int effectAmplifier) { + switch (effect) { + case CONDUIT_POWER: + conduitPower = effectAmplifier + 1; + break; + case FASTER_DIG: + haste = effectAmplifier + 1; + break; + case SLOWER_DIG: + miningFatigue = effectAmplifier + 1; + break; + } + entityEffects.add(effect); + } + + public void removeEffect(Effect effect) { + switch (effect) { + case CONDUIT_POWER: + conduitPower = 0; + break; + case FASTER_DIG: + haste = 0; + break; + case SLOWER_DIG: + miningFatigue = 0; + break; + } + entityEffects.remove(effect); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java index ff7e5de1b..627b3f2e9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java @@ -38,10 +38,12 @@ public class JavaEntityEffectTranslator extends PacketTranslator entityEffects = session.getEffectCache().getEntityEffects(); + for (Effect effect : entityEffects) { MobEffectPacket mobEffectPacket = new MobEffectPacket(); mobEffectPacket.setEvent(MobEffectPacket.Event.REMOVE); - mobEffectPacket.setRuntimeEntityId(session.getPlayerEntity().getGeyserId()); + mobEffectPacket.setRuntimeEntityId(player.getGeyserId()); mobEffectPacket.setEffectId(EntityUtils.toBedrockEffectId(effect)); session.sendUpstreamPacket(mobEffectPacket); } // Effects are re-sent from server - session.getEffectCache().getEntityEffects().clear(); + entityEffects.clear(); //let java server handle portal travel sound StopSoundPacket stopSoundPacket = new StopSoundPacket(); From f4437e45a87c738a81f846ef0a35bab2b3fa0259 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 14:00:12 -0400 Subject: [PATCH 545/766] Attempt to make Geyser build --- .../network/translators/java/JavaDeclareCommandsTranslator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 4780360dd..0aec21840 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -211,6 +211,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator Date: Mon, 16 Aug 2021 14:03:00 -0400 Subject: [PATCH 546/766] Attempt to make Geyser build --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index bf14f0d12..11a3415ac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,7 @@ pipeline { stages { stage ('Build') { steps { + sh 'rm /var/lib/jenkins/.m2/repository/org/geysermc/bootstrap-standalone/1.4.1-SNAPSHOT/maven-metadata-local.xml' sh 'git submodule update --init --recursive' sh 'mvn clean package' } From 36ad5612ede68201c42dbc24988998c039bf3238 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 14:04:13 -0400 Subject: [PATCH 547/766] Support Brigadier long argument types in commands Fixes #2476 --- Jenkinsfile | 1 - connector/pom.xml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11a3415ac..bf14f0d12 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,6 @@ pipeline { stages { stage ('Build') { steps { - sh 'rm /var/lib/jenkins/.m2/repository/org/geysermc/bootstrap-standalone/1.4.1-SNAPSHOT/maven-metadata-local.xml' sh 'git submodule update --init --recursive' sh 'mvn clean package' } diff --git a/connector/pom.xml b/connector/pom.xml index be7b9869f..d32e01806 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -147,7 +147,7 @@ com.github.GeyserMC MCProtocolLib - e427237 + e17787a compile From eca0691db0a7c70e331bf5718fbd695ca01e487d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 19:49:04 -0400 Subject: [PATCH 548/766] Suspend publishing while it prevents successful Jenkins builds --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf14f0d12..c4e5d05cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - stage ('Deploy') { + /*stage ('Deploy') { when { branch "master" } @@ -48,7 +48,7 @@ pipeline { serverId: "opencollab-artifactory" ) } - } + }*/ } post { From 7ae91a40ecc2ecaf82ed33e8cafa2aa46ab7b458 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 20:39:29 -0400 Subject: [PATCH 549/766] Ensure every packet is ran on the same thread per player (#2473) This removes a lot of concurrency checking that needs to be done, because there should be no way two packets can be handled at the same time. --- connector/pom.xml | 6 +- .../network/ConnectorServerEventHandler.java | 5 +- .../network/UpstreamPacketHandler.java | 12 ++-- .../network/session/GeyserSession.java | 72 +++++++------------ .../network/session/cache/EntityCache.java | 21 +++--- .../translators/PacketTranslatorRegistry.java | 8 ++- .../bedrock/BedrockAnimateTranslator.java | 2 +- .../BedrockContainerCloseTranslator.java | 40 +++++------ ...BedrockInventoryTransactionTranslator.java | 36 +++++----- .../BedrockItemStackRequestTranslator.java | 2 +- .../entity/BedrockEntityEventTranslator.java | 12 ++-- .../java/JavaRespawnTranslator.java | 8 +-- .../JavaPlayerChangeHeldItemTranslator.java | 14 ++-- .../window/JavaCloseWindowTranslator.java | 7 +- .../java/window/JavaOpenWindowTranslator.java | 58 ++++++++------- .../java/window/JavaSetSlotTranslator.java | 58 ++++++++------- .../window/JavaWindowItemsTranslator.java | 30 ++++---- .../window/JavaWindowPropertyTranslator.java | 16 ++--- .../entity/SkullBlockEntityTranslator.java | 2 +- .../connector/utils/InventoryUtils.java | 22 +++--- 20 files changed, 198 insertions(+), 233 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index d32e01806..5e311b5b7 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -13,8 +13,8 @@ 4.8.0 8.5.2 - 2.10.2 - 4.1.59.Final + 2.12.4 + 4.1.66.Final @@ -167,7 +167,7 @@ com.github.GeyserMC PacketLib - 25eb4c4 + 86c9c38 compile diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index 67fbdbbfd..ccaaac082 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -30,7 +30,9 @@ import com.nukkitx.protocol.bedrock.BedrockServerEventHandler; import com.nukkitx.protocol.bedrock.BedrockServerSession; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.socket.DatagramPacket; +import io.netty.util.concurrent.DefaultThreadFactory; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.ping.GeyserPingInfo; import org.geysermc.connector.configuration.GeyserConfiguration; @@ -56,6 +58,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { private static final int MAGIC_RAKNET_LENGTH = 338; private final GeyserConnector connector; + private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(new DefaultThreadFactory("Geyser player thread")); public ConnectorServerEventHandler(GeyserConnector connector) { this.connector = connector; @@ -162,7 +165,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { public void onSessionCreation(BedrockServerSession bedrockServerSession) { bedrockServerSession.setLogging(true); bedrockServerSession.setCompressionLevel(connector.getConfig().getBedrock().getCompressionLevel()); - bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession))); + bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession, eventLoopGroup.next()))); // Set the packet codec to default just in case we need to send disconnect packets. bedrockServerSession.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC); } diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 9213579ed..d008b98ab 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -52,6 +52,11 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { return PacketTranslatorRegistry.BEDROCK_TRANSLATOR.translate(packet.getClass(), packet, session); } + @Override + boolean defaultHandler(BedrockPacket packet) { + return translateAndDefault(packet); + } + @Override public boolean handle(LoginPacket loginPacket) { BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(loginPacket.getProtocolVersion()); @@ -156,7 +161,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(ModalFormResponsePacket packet) { - session.getFormCache().handleResponse(packet); + session.getEventLoop().execute(() -> session.getFormCache().handleResponse(packet)); return true; } @@ -209,11 +214,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { return translateAndDefault(packet); } - @Override - boolean defaultHandler(BedrockPacket packet) { - return translateAndDefault(packet); - } - @Override public boolean handle(ResourcePackChunkRequestPacket packet) { ResourcePackChunkDataPacket data = new ResourcePackChunkDataPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 74ff369de..6bd3fca90 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -57,9 +57,9 @@ import com.nukkitx.protocol.bedrock.data.command.CommandPermission; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; +import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIterator; @@ -102,7 +102,10 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; import java.util.*; -import java.util.concurrent.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @Getter @@ -110,6 +113,10 @@ public class GeyserSession implements CommandSender { private final GeyserConnector connector; private final UpstreamSession upstream; + /** + * The loop where all packets and ticking is processed to prevent concurrency issues. + */ + private final EventLoop eventLoop; private TcpClientSession downstream; @Setter private AuthData authData; @@ -158,11 +165,6 @@ public class GeyserSession implements CommandSender { @Getter(AccessLevel.NONE) private final AtomicInteger itemNetId = new AtomicInteger(2); - @Getter(AccessLevel.NONE) - private final Object inventoryLock = new Object(); - @Getter(AccessLevel.NONE) - private CompletableFuture inventoryFuture; - @Setter private ScheduledFuture craftingGridFuture; @@ -183,8 +185,8 @@ public class GeyserSession implements CommandSender { @Setter private ItemMappings itemMappings; - private final Map skullCache = new ConcurrentHashMap<>(); - private final Long2ObjectMap storedMaps = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>()); + private final Map skullCache = new Object2ObjectOpenHashMap<>(); + private final Long2ObjectMap storedMaps = new Long2ObjectOpenHashMap<>(); /** * Stores the map between Java and Bedrock biome network IDs. @@ -426,9 +428,10 @@ public class GeyserSession implements CommandSender { private MinecraftProtocol protocol; - public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession) { + public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { this.connector = connector; this.upstream = new UpstreamSession(bedrockServerSession); + this.eventLoop = eventLoop; this.advancementsCache = new AdvancementsCache(this); this.bookEditCache = new BookEditCache(this); @@ -447,7 +450,6 @@ public class GeyserSession implements CommandSender { this.playerInventory = new PlayerInventory(); this.openInventory = null; - this.inventoryFuture = CompletableFuture.completedFuture(null); this.craftingRecipes = new Int2ObjectOpenHashMap<>(); this.unlockedRecipes = new ObjectOpenHashSet<>(); this.lastRecipeNetId = new AtomicInteger(1); @@ -664,7 +666,7 @@ public class GeyserSession implements CommandSender { boolean floodgate = this.remoteAuthType == AuthType.FLOODGATE; // Start ticking - tickThread = connector.getGeneralThreadPool().scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); + tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); downstream = new TcpClientSession(this.remoteAddress, this.remotePort, protocol); disableSrvResolving(); @@ -1095,39 +1097,6 @@ public class GeyserSession implements CommandSender { upstream.sendPacket(startGamePacket); } - /** - * Adds a new inventory task. - * Inventory tasks are executed one at a time, in order. - * - * @param task the task to run - */ - public void addInventoryTask(Runnable task) { - synchronized (inventoryLock) { - inventoryFuture = inventoryFuture.thenRun(task).exceptionally(throwable -> { - GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause()); - return null; - }); - } - } - - /** - * Adds a new inventory task with a delay. - * The delay is achieved by scheduling with the Geyser general thread pool. - * Inventory tasks are executed one at a time, in order. - * - * @param task the delayed task to run - * @param delayMillis delay in milliseconds - */ - public void addInventoryTask(Runnable task, long delayMillis) { - synchronized (inventoryLock) { - Executor delayedExecutor = command -> GeyserConnector.getInstance().getGeneralThreadPool().schedule(command, delayMillis, TimeUnit.MILLISECONDS); - inventoryFuture = inventoryFuture.thenRunAsync(task, delayedExecutor).exceptionally(throwable -> { - GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause()); - return null; - }); - } - } - /** * @return the next Bedrock item network ID to use for a new item */ @@ -1229,7 +1198,18 @@ public class GeyserSession implements CommandSender { * @param packet the java edition packet from MCProtocolLib */ public void sendDownstreamPacket(Packet packet) { - if (downstream != null && (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == LoginPluginResponsePacket.class)) { + if (!closed && this.downstream != null) { + EventLoop eventLoop = this.downstream.getChannel().eventLoop(); + if (eventLoop.inEventLoop()) { + sendDownstreamPacket0(packet); + } else { + eventLoop.execute(() -> sendDownstreamPacket0(packet)); + } + } + } + + private void sendDownstreamPacket0(Packet packet) { + if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == LoginPluginResponsePacket.class) { downstream.send(packet); } else { connector.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java index 4d6750bc0..a9d856b9e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java @@ -26,6 +26,8 @@ package org.geysermc.connector.network.session.cache; import it.unimi.dsi.fastutil.longs.*; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Getter; import org.geysermc.connector.entity.Tickable; @@ -44,15 +46,15 @@ public class EntityCache { private final GeyserSession session; @Getter - private Long2ObjectMap entities = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>()); + private final Long2ObjectMap entities = new Long2ObjectOpenHashMap<>(); /** * A list of all entities that must be ticked. */ - private final List tickableEntities = Collections.synchronizedList(new ArrayList<>()); - private Long2LongMap entityIdTranslations = Long2LongMaps.synchronize(new Long2LongOpenHashMap()); - private Map playerEntities = Collections.synchronizedMap(new HashMap<>()); - private Map bossBars = Collections.synchronizedMap(new HashMap<>()); - private final Long2LongMap cachedPlayerEntityLinks = Long2LongMaps.synchronize(new Long2LongOpenHashMap()); + private final List tickableEntities = new ObjectArrayList<>(); + private final Long2LongMap entityIdTranslations = new Long2LongOpenHashMap(); + private final Map playerEntities = new Object2ObjectOpenHashMap<>(); + private final Map bossBars = new Object2ObjectOpenHashMap<>(); + private final Long2LongMap cachedPlayerEntityLinks = new Long2LongOpenHashMap(); @Getter private final AtomicLong nextEntityId = new AtomicLong(2L); @@ -156,13 +158,6 @@ public class EntityCache { bossBars.values().forEach(BossBar::updateBossBar); } - public void clear() { - entities = null; - entityIdTranslations = null; - playerEntities = null; - bossBars = null; - } - public long getCachedPlayerEntityLink(long playerId) { return cachedPlayerEntityLinks.remove(playerId); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index d8f726223..c486c2521 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListDa import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateLightPacket; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.protocol.bedrock.BedrockPacket; +import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; @@ -89,7 +90,12 @@ public class PacketTranslatorRegistry { try { PacketTranslator

translator = (PacketTranslator

) translators.get(clazz); if (translator != null) { - translator.translate(packet, session); + EventLoop eventLoop = session.getEventLoop(); + if (eventLoop.inEventLoop()) { + translator.translate(packet, session); + } else { + eventLoop.execute(() -> translator.translate(packet, session)); + } return true; } else { if ((GeyserConnector.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index 6e97a5182..0bae5261c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -48,7 +48,7 @@ public class BedrockAnimateTranslator extends PacketTranslator { switch (packet.getAction()) { case SWING_ARM: // Delay so entity damage can be processed first - session.getConnector().getGeneralThreadPool().schedule(() -> + session.getEventLoop().schedule(() -> session.sendDownstreamPacket(new ClientPlayerSwingArmPacket(Hand.MAIN_HAND)), 25, TimeUnit.MILLISECONDS diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java index 21bc1e437..88c2206d5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java @@ -39,29 +39,27 @@ public class BedrockContainerCloseTranslator extends PacketTranslator { - byte windowId = packet.getId(); + byte windowId = packet.getId(); - //Client wants close confirmation - session.sendUpstreamPacket(packet); - session.setClosingInventory(false); + //Client wants close confirmation + session.sendUpstreamPacket(packet); + session.setClosingInventory(false); - if (windowId == -1 && session.getOpenInventory() instanceof MerchantContainer) { - // 1.16.200 - window ID is always -1 sent from Bedrock - windowId = (byte) session.getOpenInventory().getId(); + if (windowId == -1 && session.getOpenInventory() instanceof MerchantContainer) { + // 1.16.200 - window ID is always -1 sent from Bedrock + windowId = (byte) session.getOpenInventory().getId(); + } + + Inventory openInventory = session.getOpenInventory(); + if (openInventory != null) { + if (windowId == openInventory.getId()) { + ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId); + session.sendDownstreamPacket(closeWindowPacket); + InventoryUtils.closeInventory(session, windowId, false); + } else if (openInventory.isPending()) { + InventoryUtils.displayInventory(session, openInventory); + openInventory.setPending(false); } - - Inventory openInventory = session.getOpenInventory(); - if (openInventory != null) { - if (windowId == openInventory.getId()) { - ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId); - session.sendDownstreamPacket(closeWindowPacket); - InventoryUtils.closeInventory(session, windowId, false); - } else if (openInventory.isPending()) { - InventoryUtils.displayInventory(session, openInventory); - openInventory.setPending(false); - } - } - }); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index d519f2682..f901e128c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -83,26 +83,24 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { - if (session.getPlayerInventory().getHeldItemSlot() != containerAction.getSlot() || - session.getPlayerInventory().getItemInHand().isEmpty()) { - return; - } + if (session.getPlayerInventory().getHeldItemSlot() != containerAction.getSlot() || + session.getPlayerInventory().getItemInHand().isEmpty()) { + return; + } - boolean dropAll = worldAction.getToItem().getCount() > 1; - ClientPlayerActionPacket dropAllPacket = new ClientPlayerActionPacket( - dropAll ? PlayerAction.DROP_ITEM_STACK : PlayerAction.DROP_ITEM, - BlockUtils.POSITION_ZERO, - BlockFace.DOWN - ); - session.sendDownstreamPacket(dropAllPacket); + boolean dropAll = worldAction.getToItem().getCount() > 1; + ClientPlayerActionPacket dropAllPacket = new ClientPlayerActionPacket( + dropAll ? PlayerAction.DROP_ITEM_STACK : PlayerAction.DROP_ITEM, + BlockUtils.POSITION_ZERO, + BlockFace.DOWN + ); + session.sendDownstreamPacket(dropAllPacket); - if (dropAll) { - session.getPlayerInventory().setItemInHand(GeyserItemStack.EMPTY); - } else { - session.getPlayerInventory().getItemInHand().sub(1); - } - }); + if (dropAll) { + session.getPlayerInventory().setItemInHand(GeyserItemStack.EMPTY); + } else { + session.getPlayerInventory().getItemInHand().sub(1); + } } } break; @@ -222,7 +220,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { + session.setBucketScheduledFuture(session.getEventLoop().schedule(() -> { ClientPlayerUseItemPacket itemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); session.sendDownstreamPacket(itemPacket); }, 5, TimeUnit.MILLISECONDS)); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java index bdbb88eee..b5e0dd2ce 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java @@ -45,6 +45,6 @@ public class BedrockItemStackRequestTranslator extends PacketTranslator translator.translateRequests(session, inventory, packet.getRequests())); + translator.translateRequests(session, inventory, packet.getRequests()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index 6267597fd..ced40ca28 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -37,6 +37,8 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import java.util.concurrent.TimeUnit; + @Translator(packet = EntityEventPacket.class) public class BedrockEntityEventTranslator extends PacketTranslator { @@ -48,12 +50,10 @@ public class BedrockEntityEventTranslator extends PacketTranslator { - ClientSelectTradePacket selectTradePacket = new ClientSelectTradePacket(packet.getData()); - session.sendDownstreamPacket(selectTradePacket); - }); + ClientSelectTradePacket selectTradePacket = new ClientSelectTradePacket(packet.getData()); + session.sendDownstreamPacket(selectTradePacket); - session.addInventoryTask(() -> { + session.getEventLoop().schedule(() -> { Entity villager = session.getPlayerEntity(); Inventory openInventory = session.getOpenInventory(); if (openInventory instanceof MerchantContainer) { @@ -66,7 +66,7 @@ public class BedrockEntityEventTranslator extends PacketTranslator entity.setHealth(entity.getMaxHealth()); entity.getAttributes().put(GeyserAttributeType.HEALTH, entity.createHealthAttribute()); - session.addInventoryTask(() -> { - session.setInventoryTranslator(InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR); - session.setOpenInventory(null); - session.setClosingInventory(false); - }); + session.setInventoryTranslator(InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR); + session.setOpenInventory(null); + session.setClosingInventory(false); SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket(); playerGameTypePacket.setGamemode(packet.getGamemode().ordinal()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java index 68df63e2b..58ab3bfcd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java @@ -36,14 +36,12 @@ public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { - PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); - hotbarPacket.setContainerId(0); - hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); - hotbarPacket.setSelectHotbarSlot(true); - session.sendUpstreamPacket(hotbarPacket); + PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); + hotbarPacket.setContainerId(0); + hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); + hotbarPacket.setSelectHotbarSlot(true); + session.sendUpstreamPacket(hotbarPacket); - session.getPlayerInventory().setHeldItemSlot(packet.getSlot()); - }); + session.getPlayerInventory().setHeldItemSlot(packet.getSlot()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java index 9efdee7fc..3c984c0a2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java @@ -36,9 +36,8 @@ public class JavaCloseWindowTranslator extends PacketTranslator - // Sometimes the server can request a window close of ID 0... when the window isn't even open - // Don't confirm in this instance - InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId()))); + // Sometimes the server can request a window close of ID 0... when the window isn't even open + // Don't confirm in this instance + InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId())); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java index 79abcc957..c562226c6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java @@ -31,48 +31,46 @@ import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; import org.geysermc.connector.utils.LocaleUtils; -import org.geysermc.connector.network.translators.chat.MessageTranslator; @Translator(packet = ServerOpenWindowPacket.class) public class JavaOpenWindowTranslator extends PacketTranslator { @Override public void translate(ServerOpenWindowPacket packet, GeyserSession session) { - session.addInventoryTask(() -> { - if (packet.getWindowId() == 0) { - return; - } + if (packet.getWindowId() == 0) { + return; + } - InventoryTranslator newTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(packet.getType()); - Inventory openInventory = session.getOpenInventory(); - //No translator exists for this window type. Close all windows and return. - if (newTranslator == null) { - if (openInventory != null) { - InventoryUtils.closeInventory(session, openInventory.getId(), true); - } - ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(packet.getWindowId()); - session.sendDownstreamPacket(closeWindowPacket); - return; - } - - String name = MessageTranslator.convertMessageLenient(packet.getName(), session.getLocale()); - name = LocaleUtils.getLocaleString(name, session.getLocale()); - - Inventory newInventory = newTranslator.createInventory(name, packet.getWindowId(), packet.getType(), session.getPlayerInventory()); + InventoryTranslator newTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(packet.getType()); + Inventory openInventory = session.getOpenInventory(); + //No translator exists for this window type. Close all windows and return. + if (newTranslator == null) { if (openInventory != null) { - // If the window type is the same, don't close. - // In rare cases, inventories can do funny things where it keeps the same window type up but change the contents. - if (openInventory.getWindowType() != packet.getType()) { - // Sometimes the server can double-open an inventory with the same ID - don't confirm in that instance. - InventoryUtils.closeInventory(session, openInventory.getId(), openInventory.getId() != packet.getWindowId()); - } + InventoryUtils.closeInventory(session, openInventory.getId(), true); } + ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(packet.getWindowId()); + session.sendDownstreamPacket(closeWindowPacket); + return; + } - session.setInventoryTranslator(newTranslator); - InventoryUtils.openInventory(session, newInventory); - }); + String name = MessageTranslator.convertMessageLenient(packet.getName(), session.getLocale()); + name = LocaleUtils.getLocaleString(name, session.getLocale()); + + Inventory newInventory = newTranslator.createInventory(name, packet.getWindowId(), packet.getType(), session.getPlayerInventory()); + if (openInventory != null) { + // If the window type is the same, don't close. + // In rare cases, inventories can do funny things where it keeps the same window type up but change the contents. + if (openInventory.getWindowType() != packet.getType()) { + // Sometimes the server can double-open an inventory with the same ID - don't confirm in that instance. + InventoryUtils.closeInventory(session, openInventory.getId(), openInventory.getId() != packet.getWindowId()); + } + } + + session.setInventoryTranslator(newTranslator); + InventoryUtils.openInventory(session, newInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java index b0ce8994e..0d1f6f8d2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java @@ -59,39 +59,37 @@ public class JavaSetSlotTranslator extends PacketTranslator @Override public void translate(ServerSetSlotPacket packet, GeyserSession session) { - session.addInventoryTask(() -> { - if (packet.getWindowId() == 255) { //cursor - GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); - session.getPlayerInventory().setCursor(newItem, session); - InventoryUtils.updateCursor(session); - return; + if (packet.getWindowId() == 255) { //cursor + GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); + session.getPlayerInventory().setCursor(newItem, session); + InventoryUtils.updateCursor(session); + return; + } + + //TODO: support window id -2, should update player inventory + Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); + if (inventory == null) + return; + + inventory.setStateId(packet.getStateId()); + + InventoryTranslator translator = session.getInventoryTranslator(); + if (translator != null) { + if (session.getCraftingGridFuture() != null) { + session.getCraftingGridFuture().cancel(false); } + session.setCraftingGridFuture(session.getEventLoop().schedule(() -> updateCraftingGrid(session, packet, inventory, translator), 150, TimeUnit.MILLISECONDS)); - //TODO: support window id -2, should update player inventory - Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); - if (inventory == null) - return; - - inventory.setStateId(packet.getStateId()); - - InventoryTranslator translator = session.getInventoryTranslator(); - if (translator != null) { - if (session.getCraftingGridFuture() != null) { - session.getCraftingGridFuture().cancel(false); - } - session.setCraftingGridFuture(session.getConnector().getGeneralThreadPool().schedule(() -> session.addInventoryTask(() -> updateCraftingGrid(session, packet, inventory, translator)), 150, TimeUnit.MILLISECONDS)); - - GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); - if (packet.getWindowId() == 0 && !(translator instanceof PlayerInventoryTranslator)) { - // In rare cases, the window ID can still be 0 but Java treats it as valid - session.getPlayerInventory().setItem(packet.getSlot(), newItem, session); - InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR.updateSlot(session, session.getPlayerInventory(), packet.getSlot()); - } else { - inventory.setItem(packet.getSlot(), newItem, session); - translator.updateSlot(session, inventory, packet.getSlot()); - } + GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); + if (packet.getWindowId() == 0 && !(translator instanceof PlayerInventoryTranslator)) { + // In rare cases, the window ID can still be 0 but Java treats it as valid + session.getPlayerInventory().setItem(packet.getSlot(), newItem, session); + InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR.updateSlot(session, session.getPlayerInventory(), packet.getSlot()); + } else { + inventory.setItem(packet.getSlot(), newItem, session); + translator.updateSlot(session, inventory, packet.getSlot()); } - }); + } } private static void updateCraftingGrid(GeyserSession session, ServerSetSlotPacket packet, Inventory inventory, InventoryTranslator translator) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java index 4b121229f..7f8cea595 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java @@ -39,25 +39,23 @@ public class JavaWindowItemsTranslator extends PacketTranslator { - Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); - if (inventory == null) - return; + Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); + if (inventory == null) + return; - inventory.setStateId(packet.getStateId()); + inventory.setStateId(packet.getStateId()); - for (int i = 0; i < packet.getItems().length; i++) { - GeyserItemStack newItem = GeyserItemStack.from(packet.getItems()[i]); - inventory.setItem(i, newItem, session); - } + for (int i = 0; i < packet.getItems().length; i++) { + GeyserItemStack newItem = GeyserItemStack.from(packet.getItems()[i]); + inventory.setItem(i, newItem, session); + } - InventoryTranslator translator = session.getInventoryTranslator(); - if (translator != null) { - translator.updateInventory(session, inventory); - } + InventoryTranslator translator = session.getInventoryTranslator(); + if (translator != null) { + translator.updateInventory(session, inventory); + } - session.getPlayerInventory().setCursor(GeyserItemStack.from(packet.getCarriedItem()), session); - InventoryUtils.updateCursor(session); - }); + session.getPlayerInventory().setCursor(GeyserItemStack.from(packet.getCarriedItem()), session); + InventoryUtils.updateCursor(session); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java index c31a39029..c5dcc76ca 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java @@ -38,15 +38,13 @@ public class JavaWindowPropertyTranslator extends PacketTranslator { - Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); - if (inventory == null) - return; + Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); + if (inventory == null) + return; - InventoryTranslator translator = session.getInventoryTranslator(); - if (translator != null) { - translator.updateProperty(session, inventory, packet.getRawProperty(), packet.getValue()); - } - }); + InventoryTranslator translator = session.getInventoryTranslator(); + if (translator != null) { + translator.updateProperty(session, inventory, packet.getRawProperty(), packet.getValue()); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index e7139f20c..72dee2d94 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -147,7 +147,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements if (session.getUpstream().isInitialized()) { player.spawnEntity(session); - SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.getConnector().getGeneralThreadPool().schedule(() -> { + SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.getEventLoop().schedule(() -> { // Delay to minimize split-second "player" pop-in player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); player.updateBedrockMetadata(session); diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java index c9ddd8ed9..2f4f2456e 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java @@ -37,7 +37,6 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.ChatColor; import org.geysermc.connector.inventory.Container; import org.geysermc.connector.inventory.GeyserItemStack; @@ -80,17 +79,16 @@ public class InventoryUtils { if (translator != null) { translator.prepareInventory(session, inventory); if (translator instanceof DoubleChestInventoryTranslator && !((Container) inventory).isUsingRealBlock()) { - GeyserConnector.getInstance().getGeneralThreadPool().schedule(() -> - session.addInventoryTask(() -> { - Inventory openInv = session.getOpenInventory(); - if (openInv != null && openInv.getId() == inventory.getId()) { - translator.openInventory(session, inventory); - translator.updateInventory(session, inventory); - } else if (openInv != null && openInv.isPending()) { - // Presumably, this inventory is no longer relevant, and the client doesn't care about it - displayInventory(session, openInv); - } - }), 200, TimeUnit.MILLISECONDS); + session.getEventLoop().schedule(() -> { + Inventory openInv = session.getOpenInventory(); + if (openInv != null && openInv.getId() == inventory.getId()) { + translator.openInventory(session, inventory); + translator.updateInventory(session, inventory); + } else if (openInv != null && openInv.isPending()) { + // Presumably, this inventory is no longer relevant, and the client doesn't care about it + displayInventory(session, openInv); + } + }, 200, TimeUnit.MILLISECONDS); } else { translator.openInventory(session, inventory); translator.updateInventory(session, inventory); From 61d95200e3dd465186732388252d1ffcaa076349 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 20:43:22 -0400 Subject: [PATCH 550/766] Update Java on the CI to prepare for Java 16 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c4e5d05cf..325fb977b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any tools { maven 'Maven 3' - jdk 'Java 8' + jdk 'Java 16' } options { buildDiscarder(logRotator(artifactNumToKeepStr: '20')) From 76399881a3a7ef7714b979929cba4e4e4fabadcd Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 16 Aug 2021 22:33:14 -0400 Subject: [PATCH 551/766] Use legacy DefaultEventLoopGroup constructor; label Geyser <-> Spigot connection thread --- .../org/geysermc/platform/spigot/GeyserSpigotInjector.java | 3 ++- .../connector/network/ConnectorServerEventHandler.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java index d54414306..14065c52e 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java @@ -30,6 +30,7 @@ import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.local.LocalAddress; +import io.netty.util.concurrent.DefaultThreadFactory; import org.bukkit.Bukkit; import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.common.GeyserInjector; @@ -117,7 +118,7 @@ public class GeyserSpigotInjector extends GeyserInjector { initChannel.invoke(childHandler, ch); } }) - .group(new DefaultEventLoopGroup()) + .group(new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser Spigot connection thread"))) .localAddress(LocalAddress.ANY)) .bind() .syncUninterruptibly(); diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index ccaaac082..35db999ce 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -58,7 +58,8 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { private static final int MAGIC_RAKNET_LENGTH = 338; private final GeyserConnector connector; - private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(new DefaultThreadFactory("Geyser player thread")); + // There is a constructor that doesn't require inputting threads, but older Netty versions don't have it + private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser player thread")); public ConnectorServerEventHandler(GeyserConnector connector) { this.connector = connector; From 3d04a957d02ea33a3aad0cfd704a56fa008d43ed Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Tue, 17 Aug 2021 20:57:46 -0400 Subject: [PATCH 552/766] Ensure that exceptions in player event loop are handled Any stray exception means that the entire event loop comes crashing down. --- .../network/UpstreamPacketHandler.java | 2 +- .../network/session/GeyserSession.java | 32 ++++++++++++++-- .../translators/PacketTranslatorRegistry.java | 38 ++++++++++--------- .../bedrock/BedrockAnimateTranslator.java | 2 +- ...BedrockInventoryTransactionTranslator.java | 2 +- .../entity/BedrockEntityEventTranslator.java | 2 +- .../java/window/JavaSetSlotTranslator.java | 2 +- .../entity/SkullBlockEntityTranslator.java | 2 +- .../connector/utils/InventoryUtils.java | 2 +- 9 files changed, 57 insertions(+), 27 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index d008b98ab..84bb63b95 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -161,7 +161,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(ModalFormResponsePacket packet) { - session.getEventLoop().execute(() -> session.getFormCache().handleResponse(packet)); + session.executeInEventLoop(() -> session.getFormCache().handleResponse(packet)); return true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 6bd3fca90..a77d370c5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -115,6 +115,7 @@ public class GeyserSession implements CommandSender { private final UpstreamSession upstream; /** * The loop where all packets and ticking is processed to prevent concurrency issues. + * If this is manually called, ensure that any exceptions are properly handled. */ private final EventLoop eventLoop; private TcpClientSession downstream; @@ -804,9 +805,8 @@ public class GeyserSession implements CommandSender { @Override public void packetReceived(PacketReceivedEvent event) { - if (!closed) { - PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(event.getPacket().getClass(), event.getPacket(), GeyserSession.this); - } + Packet packet = event.getPacket(); + PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(packet.getClass(), packet, GeyserSession.this); } @Override @@ -874,6 +874,32 @@ public class GeyserSession implements CommandSender { disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.close", getClientData().getLanguageCode())); } + /** + * Executes a task and prints a stack trace if an error occurs. + */ + public void executeInEventLoop(Runnable runnable) { + eventLoop.execute(() -> { + try { + runnable.run(); + } catch (Throwable e) { + e.printStackTrace(); + } + }); + } + + /** + * Schedules a task and prints a stack trace if an error occurs. + */ + public ScheduledFuture scheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit) { + return eventLoop.schedule(() -> { + try { + runnable.run(); + } catch (Throwable e) { + e.printStackTrace(); + } + }, duration, timeUnit); + } + /** * Called every 50 milliseconds - one Minecraft tick. */ diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index c486c2521..a04773dbf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -87,27 +87,31 @@ public class PacketTranslatorRegistry { @SuppressWarnings("unchecked") public

boolean translate(Class clazz, P packet, GeyserSession session) { if (!session.getUpstream().isClosed() && !session.isClosed()) { - try { - PacketTranslator

translator = (PacketTranslator

) translators.get(clazz); - if (translator != null) { - EventLoop eventLoop = session.getEventLoop(); - if (eventLoop.inEventLoop()) { - translator.translate(packet, session); - } else { - eventLoop.execute(() -> translator.translate(packet, session)); - } - return true; + PacketTranslator

translator = (PacketTranslator

) translators.get(clazz); + if (translator != null) { + EventLoop eventLoop = session.getEventLoop(); + if (eventLoop.inEventLoop()) { + translate0(session, translator, packet); } else { - if ((GeyserConnector.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { - // Other debug logs already take care of Bedrock packets for us if on standalone - GeyserConnector.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet)); - } + eventLoop.execute(() -> translate0(session, translator, packet)); + } + return true; + } else { + if ((GeyserConnector.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { + // Other debug logs already take care of Bedrock packets for us if on standalone + GeyserConnector.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet)); } - } catch (Throwable ex) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); - ex.printStackTrace(); } } return false; } + + private

void translate0(GeyserSession session, PacketTranslator

translator, P packet) { + try { + translator.translate(packet, session); + } catch (Throwable ex) { + GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); + ex.printStackTrace(); + } + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index 0bae5261c..4d915b619 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -48,7 +48,7 @@ public class BedrockAnimateTranslator extends PacketTranslator { switch (packet.getAction()) { case SWING_ARM: // Delay so entity damage can be processed first - session.getEventLoop().schedule(() -> + session.scheduleInEventLoop(() -> session.sendDownstreamPacket(new ClientPlayerSwingArmPacket(Hand.MAIN_HAND)), 25, TimeUnit.MILLISECONDS diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index f901e128c..72cbdbd52 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -220,7 +220,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { + session.setBucketScheduledFuture(session.scheduleInEventLoop(() -> { ClientPlayerUseItemPacket itemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); session.sendDownstreamPacket(itemPacket); }, 5, TimeUnit.MILLISECONDS)); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index ced40ca28..e5c2590da 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -53,7 +53,7 @@ public class BedrockEntityEventTranslator extends PacketTranslator { + session.scheduleInEventLoop(() -> { Entity villager = session.getPlayerEntity(); Inventory openInventory = session.getOpenInventory(); if (openInventory instanceof MerchantContainer) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java index 0d1f6f8d2..68fc2df39 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java @@ -78,7 +78,7 @@ public class JavaSetSlotTranslator extends PacketTranslator if (session.getCraftingGridFuture() != null) { session.getCraftingGridFuture().cancel(false); } - session.setCraftingGridFuture(session.getEventLoop().schedule(() -> updateCraftingGrid(session, packet, inventory, translator), 150, TimeUnit.MILLISECONDS)); + session.setCraftingGridFuture(session.scheduleInEventLoop(() -> updateCraftingGrid(session, packet, inventory, translator), 150, TimeUnit.MILLISECONDS)); GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); if (packet.getWindowId() == 0 && !(translator instanceof PlayerInventoryTranslator)) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index 72dee2d94..491f54381 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -147,7 +147,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements if (session.getUpstream().isInitialized()) { player.spawnEntity(session); - SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.getEventLoop().schedule(() -> { + SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.scheduleInEventLoop(() -> { // Delay to minimize split-second "player" pop-in player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); player.updateBedrockMetadata(session); diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java index 2f4f2456e..d5978a7f5 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java @@ -79,7 +79,7 @@ public class InventoryUtils { if (translator != null) { translator.prepareInventory(session, inventory); if (translator instanceof DoubleChestInventoryTranslator && !((Container) inventory).isUsingRealBlock()) { - session.getEventLoop().schedule(() -> { + session.scheduleInEventLoop(() -> { Inventory openInv = session.getOpenInventory(); if (openInv != null && openInv.getId() == inventory.getId()) { translator.openInventory(session, inventory); From 57c0185b452b213aa8cc49c35f75bbc2adaa2f3e Mon Sep 17 00:00:00 2001 From: David Choo Date: Tue, 17 Aug 2021 22:44:33 -0400 Subject: [PATCH 553/766] Prevent projectiles from blocking the player's vision (#2472) Prevent Snowballs, Eggs, and other throwable projectiles from blocking the player's screen --- bootstrap/standalone/pom.xml | 6 +- .../org/geysermc/connector/entity/Entity.java | 15 +++- .../connector/entity/ThrowableItemEntity.java | 76 +++++++++++++++++++ .../connector/entity/ThrownPotionEntity.java | 2 +- .../entity/living/ArmorStandEntity.java | 19 ++--- .../connector/entity/type/EntityType.java | 8 +- .../network/session/GeyserSession.java | 31 ++++---- 7 files changed, 123 insertions(+), 34 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index 64aa54745..e338f9533 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -43,17 +43,17 @@ org.jline jline-terminal - 3.9.0 + 3.20.0 org.jline jline-terminal-jna - 3.9.0 + 3.20.0 org.jline jline-reader - 3.9.0 + 3.20.0 org.apache.logging.log4j diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index 04a876f8f..eb9b8ec1c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -249,10 +249,7 @@ public class Entity { // Swimming is ignored here and instead we rely on the pose metadata.getFlags().setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80); - // Armour stands are handled in their own class - if (!this.is(ArmorStandEntity.class)) { - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, (xd & 0x20) == 0x20); - } + setInvisible(session, (xd & 0x20) == 0x20); } break; case 1: // Air/bubbles @@ -343,6 +340,16 @@ public class Entity { return 300; } + /** + * Set a boolean - whether the entity is invisible or visible + * + * @param session the Geyser session + * @param value true if the entity is invisible + */ + protected void setInvisible(GeyserSession session, boolean value) { + metadata.getFlags().setFlag(EntityFlag.INVISIBLE, value); + } + /** * x = Pitch, y = HeadYaw, z = Yaw * diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java new file mode 100644 index 000000000..38a6204d4 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity; + +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +/** + * Used as a class for any projectile entity that looks like an item + */ +public class ThrowableItemEntity extends ThrowableEntity { + /** + * Number of ticks since the entity was spawned by the Java server + */ + private int age; + private boolean invisible; + + public ThrowableItemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { + super(entityId, geyserId, entityType, position, motion, rotation); + metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); + invisible = false; + } + + private void checkVisibility(GeyserSession session) { + if (invisible != metadata.getFlags().getFlag(EntityFlag.INVISIBLE)) { + if (!invisible) { + Vector3f playerPos = session.getPlayerEntity().getPosition(); + // Prevent projectiles from blocking the player's screen + if (age >= 4 || position.distanceSquared(playerPos) > 16) { + metadata.getFlags().setFlag(EntityFlag.INVISIBLE, false); + updateBedrockMetadata(session); + } + } else { + metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); + updateBedrockMetadata(session); + } + } + age++; + } + + @Override + public void tick(GeyserSession session) { + checkVisibility(session); + super.tick(session); + } + + @Override + protected void setInvisible(GeyserSession session, boolean value) { + invisible = value; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java index 735bf274c..578a460b6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java @@ -41,7 +41,7 @@ import org.geysermc.connector.registry.type.ItemMapping; import java.util.EnumSet; -public class ThrownPotionEntity extends ThrowableEntity { +public class ThrownPotionEntity extends ThrowableItemEntity { private static final EnumSet NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD); public ThrownPotionEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java index a616f9269..d447f6379 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java @@ -116,15 +116,7 @@ public class ArmorStandEntity extends LivingEntity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 0 && entityMetadata.getType() == MetadataType.BYTE) { - byte xd = (byte) entityMetadata.getValue(); - - // Check if the armour stand is invisible and store accordingly - if (primaryEntity) { - isInvisible = (xd & 0x20) == 0x20; - updateSecondEntityStatus(false); - } - } else if (entityMetadata.getId() == 2) { + if (entityMetadata.getId() == 2) { updateSecondEntityStatus(false); } else if (entityMetadata.getId() == 15 && entityMetadata.getType() == MetadataType.BYTE) { byte xd = (byte) entityMetadata.getValue(); @@ -242,6 +234,15 @@ public class ArmorStandEntity extends LivingEntity { } } + @Override + protected void setInvisible(GeyserSession session, boolean value) { + // Check if the armour stand is invisible and store accordingly + if (primaryEntity) { + isInvisible = value; + updateSecondEntityStatus(false); + } + } + @Override public void setHelmet(ItemData helmet) { super.setHelmet(helmet); diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index 582e2cbfa..094cb4d61 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -107,7 +107,7 @@ public enum EntityType { PRIMED_TNT(TNTEntity.class, 65, 0.98f, 0.98f, 0.98f, 0f, "minecraft:tnt"), FALLING_BLOCK(FallingBlockEntity.class, 66, 0.98f, 0.98f), MOVING_BLOCK(Entity.class, 67, 0f), - THROWN_EXP_BOTTLE(ThrowableEntity.class, 68, 0.25f, 0.25f, 0f, 0f, "minecraft:xp_bottle"), + THROWN_EXP_BOTTLE(ThrowableItemEntity.class, 68, 0.25f, 0.25f, 0f, 0f, "minecraft:xp_bottle"), EXPERIENCE_ORB(ExpOrbEntity.class, 69, 0f, 0f, 0f, 0f, "minecraft:xp_orb"), EYE_OF_ENDER(Entity.class, 70, 0.25f, 0.25f, 0f, 0f, "minecraft:eye_of_ender_signal"), END_CRYSTAL(EnderCrystalEntity.class, 71, 2.0f, 2.0f, 2.0f, 0f, "minecraft:ender_crystal"), @@ -121,13 +121,13 @@ public enum EntityType { DRAGON_FIREBALL(ItemedFireballEntity.class, 79, 1.0f), ARROW(TippedArrowEntity.class, 80, 0.25f, 0.25f), SPECTRAL_ARROW(AbstractArrowEntity.class, 80, 0.25f, 0.25f, 0.25f, 0f, "minecraft:arrow"), - SNOWBALL(ThrowableEntity.class, 81, 0.25f), - THROWN_EGG(ThrowableEntity.class, 82, 0.25f, 0.25f, 0.25f, 0f, "minecraft:egg"), + SNOWBALL(ThrowableItemEntity.class, 81, 0.25f), + THROWN_EGG(ThrowableItemEntity.class, 82, 0.25f, 0.25f, 0.25f, 0f, "minecraft:egg"), PAINTING(PaintingEntity.class, 83, 0f), MINECART(MinecartEntity.class, 84, 0.7f, 0.98f, 0.98f, 0.35f), FIREBALL(ItemedFireballEntity.class, 85, 1.0f), THROWN_POTION(ThrownPotionEntity.class, 86, 0.25f, 0.25f, 0.25f, 0f, "minecraft:splash_potion"), - THROWN_ENDERPEARL(ThrowableEntity.class, 87, 0.25f, 0.25f, 0.25f, 0f, "minecraft:ender_pearl"), + THROWN_ENDERPEARL(ThrowableItemEntity.class, 87, 0.25f, 0.25f, 0.25f, 0f, "minecraft:ender_pearl"), LEASH_KNOT(LeashKnotEntity.class, 88, 0.5f, 0.375f), WITHER_SKULL(WitherSkullEntity.class, 89, 0.3125f), BOAT(BoatEntity.class, 90, 0.6f, 1.6f, 1.6f, 0.35f), diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index a77d370c5..5d7330794 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -75,6 +75,7 @@ import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ItemFrameEntity; +import org.geysermc.connector.entity.ThrowableEntity; import org.geysermc.connector.entity.Tickable; import org.geysermc.connector.entity.attribute.GeyserAttributeType; import org.geysermc.connector.entity.player.SessionPlayerEntity; @@ -904,21 +905,25 @@ public class GeyserSession implements CommandSender { * Called every 50 milliseconds - one Minecraft tick. */ protected void tick() { - // Check to see if the player's position needs updating - a position update should be sent once every 3 seconds - if (spawned && (System.currentTimeMillis() - lastMovementTimestamp) > 3000) { - // Recalculate in case something else changed position - Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround()); - // A null return value cancels the packet - if (position != null) { - ClientPlayerPositionPacket packet = new ClientPlayerPositionPacket(playerEntity.isOnGround(), - position.getX(), position.getY(), position.getZ()); - sendDownstreamPacket(packet); + try { + // Check to see if the player's position needs updating - a position update should be sent once every 3 seconds + if (spawned && (System.currentTimeMillis() - lastMovementTimestamp) > 3000) { + // Recalculate in case something else changed position + Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround()); + // A null return value cancels the packet + if (position != null) { + ClientPlayerPositionPacket packet = new ClientPlayerPositionPacket(playerEntity.isOnGround(), + position.getX(), position.getY(), position.getZ()); + sendDownstreamPacket(packet); + } + lastMovementTimestamp = System.currentTimeMillis(); } - lastMovementTimestamp = System.currentTimeMillis(); - } - for (Tickable entity : entityCache.getTickableEntities()) { - entity.tick(this); + for (Tickable entity : entityCache.getTickableEntities()) { + entity.tick(this); + } + } catch (Throwable throwable) { + throwable.printStackTrace(); } } From 6d624210b937612f8b92fa166609a8569abb1255 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Tue, 17 Aug 2021 22:50:00 -0400 Subject: [PATCH 554/766] Re-enable deploying on master branch --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 325fb977b..0b77fa9c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - /*stage ('Deploy') { + stage ('Deploy') { when { branch "master" } @@ -48,7 +48,7 @@ pipeline { serverId: "opencollab-artifactory" ) } - }*/ + } } post { From 52fa0679c9856473f04e3e397e916767b5651a79 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Tue, 17 Aug 2021 23:00:12 -0400 Subject: [PATCH 555/766] Revert "Re-enable deploying on master branch" This reverts commit 6d624210b937612f8b92fa166609a8569abb1255. --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b77fa9c4..325fb977b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - stage ('Deploy') { + /*stage ('Deploy') { when { branch "master" } @@ -48,7 +48,7 @@ pipeline { serverId: "opencollab-artifactory" ) } - } + }*/ } post { From 89dde2aec37abcf58c369794560be3028682a0e4 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:37:14 -0400 Subject: [PATCH 556/766] Do a null check on downstream channel when sending packets --- .../connector/network/session/GeyserSession.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 5d7330794..aa3d33ca8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -57,6 +57,7 @@ import com.nukkitx.protocol.bedrock.data.command.CommandPermission; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; +import io.netty.channel.Channel; import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; @@ -75,7 +76,6 @@ import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.entity.ThrowableEntity; import org.geysermc.connector.entity.Tickable; import org.geysermc.connector.entity.attribute.GeyserAttributeType; import org.geysermc.connector.entity.player.SessionPlayerEntity; @@ -1230,7 +1230,14 @@ public class GeyserSession implements CommandSender { */ public void sendDownstreamPacket(Packet packet) { if (!closed && this.downstream != null) { - EventLoop eventLoop = this.downstream.getChannel().eventLoop(); + Channel channel = this.downstream.getChannel(); + if (channel == null) { + // Channel is set to null when downstream is disconnected - there is a short window for this to happen + // as downstream doesn't call GeyserSession#disconnect + return; + } + + EventLoop eventLoop = channel.eventLoop(); if (eventLoop.inEventLoop()) { sendDownstreamPacket0(packet); } else { From 85404f0ed58dfd37bef8088931f4bcf86bab0c43 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Fri, 20 Aug 2021 05:39:05 -0400 Subject: [PATCH 557/766] Rearrange connector pom (#2455) * rearrange and add comments * fix pom * fix pom again --- connector/pom.xml | 72 ++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 5e311b5b7..371a09a52 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -56,39 +56,12 @@ compile - org.java-websocket - Java-WebSocket - 1.5.1 + com.google.guava + guava + 29.0-jre compile - - com.github.CloudburstMC.Protocol - bedrock-v448 - 690a545d - compile - - - com.nukkitx.network - raknet - - - com.nukkitx - nbt - - - - - com.nukkitx.network - raknet - 1.6.26-20210217.205834-2 - compile - - - io.netty - * - - - + com.nukkitx nbt @@ -132,12 +105,41 @@ ${fastutil.version} compile + - com.google.guava - guava - 29.0-jre + org.java-websocket + Java-WebSocket + 1.5.1 compile + + com.github.CloudburstMC.Protocol + bedrock-v448 + 690a545d + compile + + + com.nukkitx.network + raknet + + + com.nukkitx + nbt + + + + + com.nukkitx.network + raknet + 1.6.26-20210217.205834-2 + compile + + + io.netty + * + + + com.github.GeyserMC MCAuthLib @@ -223,7 +225,6 @@ compile osx-x86_64 - net.kyori @@ -249,6 +250,7 @@ ${adventure.version} compile + junit junit From ab540b19512956dc42e34df13350703e2cca8004 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 21 Aug 2021 09:54:52 -0400 Subject: [PATCH 558/766] Ensure more entity tasks are run on the player session --- .../connector/entity/PaintingEntity.java | 39 ++++++++----------- .../entity/player/BedrockEmoteTranslator.java | 20 +++++++--- .../spawn/JavaSpawnPaintingTranslator.java | 20 +++------- 3 files changed, 36 insertions(+), 43 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java index dd119f1a9..3e2ff7ead 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java @@ -27,24 +27,19 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; - -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; - import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.PaintingType; -@Getter @Setter -@Accessors(chain = true) public class PaintingEntity extends Entity { private static final double OFFSET = -0.46875; - private PaintingType paintingName; - private int direction; + private final PaintingType paintingName; + private final int direction; - public PaintingEntity(long entityId, long geyserId, Vector3f position) { + public PaintingEntity(long entityId, long geyserId, Vector3f position, PaintingType paintingName, int direction) { super(entityId, geyserId, EntityType.PAINTING, position, Vector3f.ZERO, Vector3f.ZERO); + this.paintingName = paintingName; + this.direction = direction; } @Override @@ -53,7 +48,7 @@ public class PaintingEntity extends Entity { addPaintingPacket.setUniqueEntityId(geyserId); addPaintingPacket.setRuntimeEntityId(geyserId); addPaintingPacket.setMotive(paintingName.getBedrockName()); - addPaintingPacket.setPosition(fixOffset(true)); + addPaintingPacket.setPosition(fixOffset()); addPaintingPacket.setDirection(direction); session.sendUpstreamPacket(addPaintingPacket); @@ -67,19 +62,17 @@ public class PaintingEntity extends Entity { // Do nothing, as head look messes up paintings } - public Vector3f fixOffset(boolean toBedrock) { - if (toBedrock) { - Vector3f position = super.position; - position = position.add(0.5, 0.5, 0.5); - double widthOffset = paintingName.getWidth() > 1 ? 0.5 : 0; - double heightOffset = paintingName.getHeight() > 1 && paintingName.getHeight() != 3 ? 0.5 : 0; + private Vector3f fixOffset() { + Vector3f position = super.position; + position = position.add(0.5, 0.5, 0.5); + double widthOffset = paintingName.getWidth() > 1 ? 0.5 : 0; + double heightOffset = paintingName.getHeight() > 1 && paintingName.getHeight() != 3 ? 0.5 : 0; - switch (direction) { - case 0: return position.add(widthOffset, heightOffset, OFFSET); - case 1: return position.add(-OFFSET, heightOffset, widthOffset); - case 2: return position.add(-widthOffset, heightOffset, -OFFSET); - case 3: return position.add(OFFSET, heightOffset, -widthOffset); - } + switch (direction) { + case 0: return position.add(widthOffset, heightOffset, OFFSET); + case 1: return position.add(-OFFSET, heightOffset, widthOffset); + case 2: return position.add(-widthOffset, heightOffset, -OFFSET); + case 3: return position.add(OFFSET, heightOffset, -widthOffset); } return position; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java index fb7c7a147..890dc0c8c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java @@ -56,13 +56,21 @@ public class BedrockEmoteTranslator extends PacketTranslator { for (GeyserSession otherSession : session.getConnector().getPlayers()) { if (otherSession != session) { if (otherSession.isClosed()) continue; - Entity otherEntity = otherSession.getEntityCache().getEntityByJavaId(javaId); - if (otherEntity == null) continue; - EmotePacket otherEmotePacket = new EmotePacket(); - otherEmotePacket.setEmoteId(packet.getEmoteId()); - otherEmotePacket.setRuntimeEntityId(otherEntity.getGeyserId()); - otherSession.sendUpstreamPacket(otherEmotePacket); + if (otherSession.getEventLoop().inEventLoop()) { + playEmote(otherSession, javaId, packet.getEmoteId()); + } else { + session.executeInEventLoop(() -> playEmote(otherSession, javaId, packet.getEmoteId())); + } } } } + + private void playEmote(GeyserSession otherSession, long javaId, String emoteId) { + Entity otherEntity = otherSession.getEntityCache().getEntityByJavaId(javaId); // Must be ran on same thread + if (otherEntity == null) return; + EmotePacket otherEmotePacket = new EmotePacket(); + otherEmotePacket.setEmoteId(emoteId); + otherEmotePacket.setRuntimeEntityId(otherEntity.getGeyserId()); + otherSession.sendUpstreamPacket(otherEmotePacket); + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java index 1abe9937d..fea6fd3d4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java @@ -25,16 +25,14 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import org.geysermc.connector.GeyserConnector; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; +import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.PaintingEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.PaintingType; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; -import com.nukkitx.math.vector.Vector3f; - @Translator(packet = ServerSpawnPaintingPacket.class) public class JavaSpawnPaintingTranslator extends PacketTranslator { @@ -42,16 +40,10 @@ public class JavaSpawnPaintingTranslator extends PacketTranslator { // #slowdownbrother, just don't execute it directly - PaintingEntity entity = new PaintingEntity( - packet.getEntityId(), - session.getEntityCache().getNextEntityId().incrementAndGet(), - position - ) - .setPaintingName(PaintingType.getByPaintingType(packet.getPaintingType())) - .setDirection(packet.getDirection().ordinal()); + PaintingEntity entity = new PaintingEntity(packet.getEntityId(), + session.getEntityCache().getNextEntityId().incrementAndGet(), + position, PaintingType.getByPaintingType(packet.getPaintingType()), packet.getDirection().ordinal()); - session.getEntityCache().spawnEntity(entity); - }); + session.getEntityCache().spawnEntity(entity); } } From a1d167d5f1926825ba78702b4e541026ba2a1f6e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 21 Aug 2021 19:38:13 -0400 Subject: [PATCH 559/766] Ensure skull operations are done on the player thread --- .../entity/player/SkullPlayerEntity.java | 8 +-- .../network/session/GeyserSession.java | 4 +- .../entity/SkullBlockEntityTranslator.java | 55 +++++++++++-------- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java index 60b7c70e3..61b5af38e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java @@ -34,7 +34,6 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; import lombok.Getter; -import lombok.Setter; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; @@ -43,17 +42,16 @@ import org.geysermc.connector.network.session.GeyserSession; * custom player skulls in Bedrock. */ public class SkullPlayerEntity extends PlayerEntity { - /** * Stores the block state that the skull is associated with. Used to determine if the block in the skull's position * has changed */ @Getter - @Setter - private int blockState; + private final int blockState; - public SkullPlayerEntity(GameProfile gameProfile, long geyserId, Vector3f position, Vector3f rotation) { + public SkullPlayerEntity(GameProfile gameProfile, long geyserId, Vector3f position, Vector3f rotation, int blockState) { super(gameProfile, 0, geyserId, position, Vector3f.ZERO, rotation); + this.blockState = blockState; setPlayerList(false); //Set bounding box to almost nothing so the skull is able to be broken and not cause entity to cast a shadow diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index aa3d33ca8..2034c5c7e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -883,7 +883,7 @@ public class GeyserSession implements CommandSender { try { runnable.run(); } catch (Throwable e) { - e.printStackTrace(); + connector.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); } }); } @@ -896,7 +896,7 @@ public class GeyserSession implements CommandSender { try { runnable.run(); } catch (Throwable e) { - e.printStackTrace(); + connector.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); } }, duration, timeUnit); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index 491f54381..c5551651b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -123,36 +123,45 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements Vector3i blockPosition = Vector3i.from(posX, posY, posZ); Vector3f entityPosition = Vector3f.from(x, y, z); Vector3f entityRotation = Vector3f.from(rotation, 0, rotation); - long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); getProfile(tag).whenComplete((gameProfile, throwable) -> { if (gameProfile == null) { - session.getConnector().getLogger().debug("Custom skull with invalid SkullOwner tag: " + blockPosition.toString() + " " + tag.toString()); + session.getConnector().getLogger().debug("Custom skull with invalid SkullOwner tag: " + blockPosition + " " + tag); return; } - SkullPlayerEntity existingSkull = session.getSkullCache().get(blockPosition); - if (existingSkull != null) { - // Ensure that two skulls can't spawn on the same point - existingSkull.despawnEntity(session, blockPosition); - } - - SkullPlayerEntity player = new SkullPlayerEntity(gameProfile, geyserId, entityPosition, entityRotation); - player.setBlockState(blockState); - - // Cache entity - session.getSkullCache().put(blockPosition, player); - - // Only send to session if we are initialized, otherwise it will happen then. - if (session.getUpstream().isInitialized()) { - player.spawnEntity(session); - - SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.scheduleInEventLoop(() -> { - // Delay to minimize split-second "player" pop-in - player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); - player.updateBedrockMetadata(session); - }, 250, TimeUnit.MILLISECONDS))); + if (session.getEventLoop().inEventLoop()) { + spawnPlayer(session, gameProfile, blockPosition, entityPosition, entityRotation, blockState); + } else { + session.executeInEventLoop(() -> spawnPlayer(session, gameProfile, blockPosition, entityPosition, entityRotation, blockState)); } }); } + + private static void spawnPlayer(GeyserSession session, GameProfile profile, Vector3i blockPosition, + Vector3f entityPosition, Vector3f entityRotation, int blockState) { + long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); + + SkullPlayerEntity existingSkull = session.getSkullCache().get(blockPosition); + if (existingSkull != null) { + // Ensure that two skulls can't spawn on the same point + existingSkull.despawnEntity(session, blockPosition); + } + + SkullPlayerEntity player = new SkullPlayerEntity(profile, geyserId, entityPosition, entityRotation, blockState); + + // Cache entity + session.getSkullCache().put(blockPosition, player); + + // Only send to session if we are initialized, otherwise it will happen then. + if (session.getUpstream().isInitialized()) { + player.spawnEntity(session); + + SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.scheduleInEventLoop(() -> { + // Delay to minimize split-second "player" pop-in + player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); + player.updateBedrockMetadata(session); + }, 250, TimeUnit.MILLISECONDS))); + } + } } From 77119316f51214d485b3f0cef35751592ebf86a0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 24 Aug 2021 09:31:19 -0400 Subject: [PATCH 560/766] Check for closed immediately before processing a packet --- .../geysermc/connector/network/session/GeyserSession.java | 5 ++++- .../network/translators/PacketTranslatorRegistry.java | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 2034c5c7e..73e0d9c2e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -220,7 +220,10 @@ public class GeyserSession implements CommandSender { @Setter private boolean spawned; - private boolean closed; + /** + * Accessed on the initial Java and Bedrock packet processing threads + */ + private volatile boolean closed; @Setter private GameMode gameMode = GameMode.SURVIVAL; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index a04773dbf..7bd0e66ac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -107,6 +107,10 @@ public class PacketTranslatorRegistry { } private

void translate0(GeyserSession session, PacketTranslator

translator, P packet) { + if (session.isClosed()) { + return; + } + try { translator.translate(packet, session); } catch (Throwable ex) { From d26aed0a87a96640b403cb58011043878566156c Mon Sep 17 00:00:00 2001 From: Jens Collaert <63231928+Jens-Co@users.noreply.github.com> Date: Tue, 24 Aug 2021 21:11:38 +0200 Subject: [PATCH 561/766] Allow uploading logs with mclo.gs link into dump (#2453) --- .../bungeecord/GeyserBungeePlugin.java | 13 +++++++ .../connector/bootstrap/GeyserBootstrap.java | 11 ++++-- .../command/defaults/DumpCommand.java | 11 ++++-- .../org/geysermc/connector/dump/DumpInfo.java | 19 +++++++++- .../geysermc/connector/utils/WebUtils.java | 37 +++++++++++++++++++ 5 files changed, 83 insertions(+), 8 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index d97446052..7c7be5b90 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -47,6 +47,7 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.UUID; import java.util.logging.Level; @@ -171,6 +172,18 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { return new GeyserBungeeDumpInfo(getProxy()); } + @Override + public Path getLogsPath() { + boolean isBungeeCord = getProxy().getName().equals("BungeeCord"); + Path getFork; + if (isBungeeCord) { + getFork = Paths.get("proxy.log.0"); + } else { + getFork = Paths.get("logs/latest.log"); + } + return getFork; + } + @Nullable @Override public SocketAddress getSocketAddress() { diff --git a/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java b/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java index ef0e0068c..51b64dd7f 100644 --- a/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java +++ b/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java @@ -25,17 +25,18 @@ package org.geysermc.connector.bootstrap; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.command.CommandManager; +import org.geysermc.connector.configuration.GeyserConfiguration; +import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.connector.network.translators.world.GeyserWorldManager; import org.geysermc.connector.network.translators.world.WorldManager; +import org.geysermc.connector.ping.IGeyserPingPassthrough; import javax.annotation.Nullable; import java.net.SocketAddress; import java.nio.file.Path; +import java.nio.file.Paths; public interface GeyserBootstrap { @@ -120,4 +121,8 @@ public interface GeyserBootstrap { default SocketAddress getSocketAddress() { return null; } + + default Path getLogsPath() { + return Paths.get("logs/latest.log"); + } } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java index 05f32ae2b..07a690298 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java @@ -65,6 +65,7 @@ public class DumpCommand extends GeyserCommand { boolean showSensitive = false; boolean offlineDump = false; + boolean addLog = false; if (args.length >= 1) { for (String arg : args) { switch (arg) { @@ -74,7 +75,9 @@ public class DumpCommand extends GeyserCommand { case "offline": offlineDump = true; break; - + case "logs": + addLog = true; + break; } } } @@ -85,9 +88,9 @@ public class DumpCommand extends GeyserCommand { String dumpData = ""; try { if (offlineDump) { - dumpData = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new DumpInfo()); + dumpData = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new DumpInfo(addLog)); } else { - dumpData = MAPPER.writeValueAsString(new DumpInfo()); + dumpData = MAPPER.writeValueAsString(new DumpInfo(addLog)); } } catch (IOException e) { sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collect_error", sender.getLocale())); @@ -141,6 +144,6 @@ public class DumpCommand extends GeyserCommand { @Override public List getSubCommands() { - return Arrays.asList("offline", "full"); + return Arrays.asList("offline", "full", "logs"); } } diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index fee4ac7a4..123dcc3fa 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -41,6 +41,7 @@ import org.geysermc.connector.network.BedrockProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.FileUtils; +import org.geysermc.connector.utils.WebUtils; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.FloodgateInfoHolder; @@ -64,9 +65,10 @@ public class DumpInfo { private final Object2IntMap userPlatforms; private final HashInfo hashInfo; private final RamInfo ramInfo; + private LogsInfo logsInfo; private final BootstrapDumpInfo bootstrapInfo; - public DumpInfo() { + public DumpInfo(boolean addLog) { this.versionInfo = new VersionInfo(); try { @@ -99,6 +101,10 @@ public class DumpInfo { this.ramInfo = new DumpInfo.RamInfo(); + if (addLog) { + this.logsInfo = new LogsInfo(); + } + this.userPlatforms = new Object2IntOpenHashMap<>(); for (GeyserSession session : GeyserConnector.getInstance().getPlayers()) { DeviceOs device = session.getClientData().getDeviceOs(); @@ -188,6 +194,17 @@ public class DumpInfo { } } + @Getter + public static class LogsInfo { + private String link; + + public LogsInfo() { + try { + this.link = WebUtils.postLogs(GeyserConnector.getInstance().getBootstrap().getLogsPath()); + } catch (IOException ignored) {} + } + } + @AllArgsConstructor @Getter public static class HashInfo { diff --git a/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java b/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java index cf9f0e1fb..e46f9126f 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java @@ -31,10 +31,14 @@ import org.geysermc.connector.GeyserConnector; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import java.util.stream.Collectors; public class WebUtils { @@ -132,4 +136,37 @@ public class WebUtils { return content.toString(); } + + /** + * Get the server log file and uploads it to mclo.gs + * + * @param log File to fetch + */ + public static String postLogs(Path log) throws IOException { + // Connect to api + URL url = new URL("https://api.mclo.gs/1/log"); + URLConnection con = url.openConnection(); + HttpURLConnection http = (HttpURLConnection) con; + http.setRequestMethod("POST"); + http.setDoOutput(true); + // Convert log to application/x-www-form-urlencoded + String content = "content=" + URLEncoder.encode(new BufferedReader(new InputStreamReader(Files.newInputStream(log.toRealPath()))).lines().collect(Collectors.joining("\n")), StandardCharsets.UTF_8.toString()); + byte[] out = content.getBytes(StandardCharsets.UTF_8); + int length = out.length; + + // Send log to api + http.setFixedLengthStreamingMode(length); + http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); + http.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); + http.connect(); + try (OutputStream os = http.getOutputStream()) { + os.write(out); + } + String is = new BufferedReader(new InputStreamReader(http.getInputStream())) + .lines() + .collect(Collectors.joining()); + JsonNode jn = GeyserConnector.JSON_MAPPER.readTree(is); + // Handle response + return jn.get("url").textValue(); + } } From 9fb509010abb6d2b7ce395492965dc0bb895c630 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Tue, 24 Aug 2021 21:34:50 +0100 Subject: [PATCH 562/766] Use more generic method for posting logs --- .../org/geysermc/connector/dump/DumpInfo.java | 17 ++++-- .../geysermc/connector/utils/WebUtils.java | 57 +++++++++---------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index 123dcc3fa..c006c28b2 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -26,6 +26,7 @@ package org.geysermc.connector.dump; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.protocol.MinecraftConstants; import com.google.common.hash.Hashing; import com.google.common.io.ByteSource; @@ -47,10 +48,9 @@ import org.geysermc.floodgate.util.FloodgateInfoHolder; import java.io.File; import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.UnknownHostException; +import java.net.*; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; @Getter @@ -200,8 +200,13 @@ public class DumpInfo { public LogsInfo() { try { - this.link = WebUtils.postLogs(GeyserConnector.getInstance().getBootstrap().getLogsPath()); - } catch (IOException ignored) {} + Map fields = new HashMap<>(); + fields.put("content", String.join("\n", java.nio.file.Files.readAllLines(GeyserConnector.getInstance().getBootstrap().getLogsPath()))); + + JsonNode logData = GeyserConnector.JSON_MAPPER.readTree(WebUtils.postForm("https://api.mclo.gs/1/log", fields)); + + this.link = logData.get("url").textValue(); + } catch (IOException ignored) { } } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java b/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java index e46f9126f..b736a282c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java @@ -31,14 +31,12 @@ import org.geysermc.connector.GeyserConnector; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; -import java.net.URLConnection; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; -import java.util.stream.Collectors; +import java.util.Map; public class WebUtils { @@ -90,6 +88,14 @@ public class WebUtils { } } + /** + * Post a string to the given URL + * + * @param reqURL URL to post to + * @param postContent String data to post + * @return String returned by the server + * @throws IOException + */ public static String post(String reqURL, String postContent) throws IOException { URL url = new URL(reqURL); HttpURLConnection con = (HttpURLConnection) url.openConnection(); @@ -138,35 +144,28 @@ public class WebUtils { } /** - * Get the server log file and uploads it to mclo.gs + * Post fields to a URL as a form * - * @param log File to fetch + * @param reqURL URL to post to + * @param fields Form data to post + * @return String returned by the server + * @throws IOException */ - public static String postLogs(Path log) throws IOException { - // Connect to api - URL url = new URL("https://api.mclo.gs/1/log"); - URLConnection con = url.openConnection(); - HttpURLConnection http = (HttpURLConnection) con; - http.setRequestMethod("POST"); - http.setDoOutput(true); - // Convert log to application/x-www-form-urlencoded - String content = "content=" + URLEncoder.encode(new BufferedReader(new InputStreamReader(Files.newInputStream(log.toRealPath()))).lines().collect(Collectors.joining("\n")), StandardCharsets.UTF_8.toString()); - byte[] out = content.getBytes(StandardCharsets.UTF_8); - int length = out.length; + public static String postForm(String reqURL, Map fields) throws IOException { + URL url = new URL(reqURL); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("POST"); + con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); + con.setDoOutput(true); - // Send log to api - http.setFixedLengthStreamingMode(length); - http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); - http.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); - http.connect(); - try (OutputStream os = http.getOutputStream()) { - os.write(out); + try (OutputStream out = con.getOutputStream()) { + // Write the form data to the output + for (Map.Entry field : fields.entrySet()) { + out.write((field.getKey() + "=" + URLEncoder.encode(field.getValue(), StandardCharsets.UTF_8.toString()) + "&").getBytes(StandardCharsets.UTF_8)); + } } - String is = new BufferedReader(new InputStreamReader(http.getInputStream())) - .lines() - .collect(Collectors.joining()); - JsonNode jn = GeyserConnector.JSON_MAPPER.readTree(is); - // Handle response - return jn.get("url").textValue(); + + return connectionToString(con); } } From 65e85eb8534fe169989465e554be794ba7abc368 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Wed, 25 Aug 2021 11:31:12 +0100 Subject: [PATCH 563/766] Fix bungeecord dump logs after 9fb5090 --- .../bungeecord/GeyserBungeePlugin.java | 9 +-------- .../org/geysermc/connector/dump/DumpInfo.java | 3 ++- .../geysermc/connector/utils/FileUtils.java | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index 7c7be5b90..548ec7210 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -174,14 +174,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { @Override public Path getLogsPath() { - boolean isBungeeCord = getProxy().getName().equals("BungeeCord"); - Path getFork; - if (isBungeeCord) { - getFork = Paths.get("proxy.log.0"); - } else { - getFork = Paths.get("logs/latest.log"); - } - return getFork; + return Paths.get(getProxy().getName().equals("BungeeCord") ? "proxy.log.0" : "logs/latest.log"); } @Nullable diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index c006c28b2..d6a5f0725 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -52,6 +52,7 @@ import java.net.*; import java.util.HashMap; import java.util.Map; import java.util.Properties; +import java.util.stream.Collectors; @Getter public class DumpInfo { @@ -201,7 +202,7 @@ public class DumpInfo { public LogsInfo() { try { Map fields = new HashMap<>(); - fields.put("content", String.join("\n", java.nio.file.Files.readAllLines(GeyserConnector.getInstance().getBootstrap().getLogsPath()))); + fields.put("content", FileUtils.readAllLines(GeyserConnector.getInstance().getBootstrap().getLogsPath()).collect(Collectors.joining("\n"))); JsonNode logData = GeyserConnector.JSON_MAPPER.readTree(WebUtils.postForm("https://api.mclo.gs/1/log", fields)); diff --git a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java index 3369f16a5..091c90a90 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java @@ -35,10 +35,12 @@ import java.io.*; import java.lang.annotation.Annotation; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; import java.security.MessageDigest; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; +import java.util.stream.Stream; public class FileUtils { @@ -220,7 +222,21 @@ public class FileUtils { } return bytes; } catch (IOException e) { - throw new RuntimeException("Error while trying to read input stream!"); + throw new RuntimeException("Error while trying to read input stream!", e); + } + } + + /** + * Read the lines of a file and return it as a stream + * + * @param path File path to read + * @return The lines as a stream + */ + public static Stream readAllLines(Path path) { + try { + return new BufferedReader(new InputStreamReader(java.nio.file.Files.newInputStream(path))).lines(); + } catch (IOException e) { + throw new RuntimeException("Error while trying to read file!", e); } } From 26a778fd77af6f28c58d92688820613269e23312 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Wed, 25 Aug 2021 15:53:20 +0100 Subject: [PATCH 564/766] Remove exact refrence to imported class in FileUtils (Thanks @Konicai) --- .../src/main/java/org/geysermc/connector/utils/FileUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java index 091c90a90..00f24472b 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java @@ -234,7 +234,7 @@ public class FileUtils { */ public static Stream readAllLines(Path path) { try { - return new BufferedReader(new InputStreamReader(java.nio.file.Files.newInputStream(path))).lines(); + return new BufferedReader(new InputStreamReader(Files.newInputStream(path))).lines(); } catch (IOException e) { throw new RuntimeException("Error while trying to read file!", e); } From 3c18eb44aa185c69f01fcb8dc0e23b2c47dc2992 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 26 Aug 2021 21:43:53 -0400 Subject: [PATCH 565/766] Use instance of ThreadLocalRandom for particle offsets Random instances are synchronized meaning this was a potential deadlock situation. --- .../geysermc/connector/network/QueryPacketHandler.java | 3 +-- .../java/world/JavaSpawnParticleTranslator.java | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java index 656a88c4f..8d3aeb435 100644 --- a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java @@ -43,7 +43,6 @@ import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import java.util.Random; import java.util.concurrent.ThreadLocalRandom; public class QueryPacketHandler { @@ -265,7 +264,7 @@ public class QueryPacketHandler { public void regenerateToken() { byte[] token = new byte[16]; for (int i = 0; i < 16; i++) { - token[i] = (byte) new Random().nextInt(255); + token[i] = (byte) ThreadLocalRandom.current().nextInt(255); } this.token = token; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java index fcf6d3a63..14f433c92 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java @@ -43,11 +43,11 @@ import org.geysermc.connector.registry.type.ParticleMapping; import org.geysermc.connector.utils.DimensionUtils; import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; @Translator(packet = ServerSpawnParticlePacket.class) public class JavaSpawnParticleTranslator extends PacketTranslator { - private final Random random = new Random(); @Override public void translate(ServerSpawnParticlePacket packet, GeyserSession session) { @@ -58,10 +58,11 @@ public class JavaSpawnParticleTranslator extends PacketTranslator Date: Fri, 27 Aug 2021 18:08:49 -0400 Subject: [PATCH 566/766] Small optimizations; use array for Java -> Bedrock block mappings Java runtime IDs are in order starting from 0; an array is all that is needed to map Java IDs to Bedrock IDs. --- .../populator/BlockRegistryPopulator.java | 8 +++++--- .../connector/registry/type/BlockMappings.java | 7 +++++-- .../org/geysermc/connector/utils/ChunkUtils.java | 15 +++++++++------ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 00e74d143..7235e786b 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -32,6 +32,8 @@ import com.nukkitx.protocol.bedrock.v440.Bedrock_v440; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -137,7 +139,7 @@ public class BlockRegistryPopulator { BiFunction stateMapper = STATE_MAPPER.getOrDefault(palette.getKey(), (i, s) -> null); - Int2IntMap javaToBedrockBlockMap = new Int2IntOpenHashMap(); + IntList javaToBedrockBlockMap = new IntArrayList(); Int2IntMap bedrockToJavaBlockMap = new Int2IntOpenHashMap(); Map flowerPotBlocks = new Object2ObjectOpenHashMap<>(); @@ -189,7 +191,7 @@ public class BlockRegistryPopulator { javaIdentifierToBedrockTag.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId)); } - javaToBedrockBlockMap.put(javaRuntimeId, bedrockRuntimeId); + javaToBedrockBlockMap.add(bedrockRuntimeId); } if (commandBlockRuntimeId == -1) { @@ -218,7 +220,7 @@ public class BlockRegistryPopulator { BlockRegistries.BLOCKS.register(PALETTE_VERSIONS.getInt(palette.getKey()), builder.blockStateVersion(stateVersion) .emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) - .javaToBedrockBlockMap(javaToBedrockBlockMap) + .javaToBedrockBlockMap(javaToBedrockBlockMap.toIntArray()) .bedrockToJavaBlockMap(bedrockToJavaBlockMap) .javaIdentifierToBedrockTag(javaIdentifierToBedrockTag) .itemFrames(itemFrames) diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java index 0cadcf232..09b3db08e 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java @@ -45,7 +45,7 @@ public class BlockMappings { ChunkSection emptyChunkSection; - Int2IntMap javaToBedrockBlockMap; + int[] javaToBedrockBlockMap; Int2IntMap bedrockToJavaBlockMap; NbtList bedrockBlockStates; @@ -62,7 +62,10 @@ public class BlockMappings { Map flowerPotBlocks; public int getBedrockBlockId(int state) { - return this.javaToBedrockBlockMap.get(state); + if (state >= this.javaToBedrockBlockMap.length) { + return bedrockAirId; + } + return this.javaToBedrockBlockMap[state]; } public int getJavaBlockState(int bedrockId) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 2f36beea6..392eb965a 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -257,8 +257,9 @@ public class ChunkUtils { while (i < blockEntities.length) { CompoundTag tag = blockEntities[i]; String tagName; - if (tag.contains("id")) { - tagName = (String) tag.get("id").getValue(); + Tag idTag = tag.get("id"); + if (idTag != null) { + tagName = (String) idTag.getValue(); } else { tagName = "Empty"; // Sometimes legacy tags have their ID be a StringTag with empty value @@ -277,18 +278,20 @@ public class ChunkUtils { } String id = BlockEntityUtils.getBedrockBlockEntityId(tagName); - Position pos = new Position((int) tag.get("x").getValue(), (int) tag.get("y").getValue(), (int) tag.get("z").getValue()); + int x = (int) tag.get("x").getValue(); + int y = (int) tag.get("y").getValue(); + int z = (int) tag.get("z").getValue(); // Get Java blockstate ID from block entity position int blockState = 0; - Chunk section = column.getChunks()[(pos.getY() >> 4) - yOffset]; + Chunk section = column.getChunks()[(y >> 4) - yOffset]; if (section != null) { - blockState = section.get(pos.getX() & 0xF, pos.getY() & 0xF, pos.getZ() & 0xF); + blockState = section.get(x & 0xF, y & 0xF, z & 0xF); } if (tagName.equals("minecraft:lectern") && BlockStateValues.getLecternBookStates().get(blockState)) { // If getLecternBookStates is false, let's just treat it like a normal block entity - bedrockBlockEntities[i] = session.getConnector().getWorldManager().getLecternDataAt(session, pos.getX(), pos.getY(), pos.getZ(), true); + bedrockBlockEntities[i] = session.getConnector().getWorldManager().getLecternDataAt(session, x, y, z, true); i++; continue; } From e95d9d3b75f1eb9a93627bac69c51b2f6630712f Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 29 Aug 2021 10:33:33 -0400 Subject: [PATCH 567/766] Use closest matching color for unmapped RGB fireworks Also remove Bukkit-specific firework colors as those were pure workarounds. Fixes #2505 --- .../connector/entity/FireworkEntity.java | 4 +- .../nbt/FireworkBaseTranslator.java | 8 +- .../connector/utils/FireworkColor.java | 139 ++++++++++-------- 3 files changed, 85 insertions(+), 66 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java index 4a05dfc03..42c98703b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java @@ -100,7 +100,7 @@ public class FireworkEntity extends Entity { int i = 0; for (int color : oldColors) { - colors[i++] = FireworkColor.fromJavaID(color).getBedrockID(); + colors[i++] = FireworkColor.fromJavaRGB(color); } effectBuilder.putByteArray("FireworkColor", colors); @@ -112,7 +112,7 @@ public class FireworkEntity extends Entity { int i = 0; for (int color : oldColors) { - colors[i++] = FireworkColor.fromJavaID(color).getBedrockID(); + colors[i++] = FireworkColor.fromJavaRGB(color); } effectBuilder.putByteArray("FireworkFade", colors); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java index dff40ea75..99fe7c813 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java @@ -51,7 +51,7 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { int i = 0; for (int color : oldColors) { - colors[i++] = FireworkColor.fromJavaID(color).getBedrockID(); + colors[i++] = FireworkColor.fromJavaRGB(color); } newExplosionData.put(new ByteArrayTag("FireworkColor", colors)); @@ -63,7 +63,7 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { int i = 0; for (int color : oldColors) { - colors[i++] = FireworkColor.fromJavaID(color).getBedrockID(); + colors[i++] = FireworkColor.fromJavaRGB(color); } newExplosionData.put(new ByteArrayTag("FireworkFade", colors)); @@ -93,7 +93,7 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { int i = 0; for (byte color : oldColors) { - colors[i++] = FireworkColor.fromBedrockID(color).getJavaID(); + colors[i++] = FireworkColor.fromBedrockId(color); } newExplosionData.put(new IntArrayTag("Colors", colors)); @@ -105,7 +105,7 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { int i = 0; for (byte color : oldColors) { - colors[i++] = FireworkColor.fromBedrockID(color).getJavaID(); + colors[i++] = FireworkColor.fromBedrockId(color); } newExplosionData.put(new IntArrayTag("FadeColors", colors)); diff --git a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java b/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java index 8846e477c..9a20295e5 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java @@ -25,76 +25,95 @@ package org.geysermc.connector.utils; -import lombok.Getter; +import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.util.HSVLike; public enum FireworkColor { - // Vanilla colors - BLACK((byte) 0, 1973019), - RED((byte) 1, 11743532), - GREEN((byte) 2, 3887386), - BROWN((byte) 3, 5320730), - BLUE((byte) 4, 2437522), - PURPLE((byte) 5, 8073150), - CYAN((byte) 6, 2651799), - LIGHT_GRAY((byte) 7, 11250603), - GRAY((byte) 8, 4408131), - PINK((byte) 9, 14188952), - LIME((byte) 10, 4312372), - YELLOW((byte) 11, 14602026), - LIGHT_BLUE((byte) 12, 6719955), - MAGENTA((byte) 13, 12801229), - ORANGE((byte) 14, 15435844), - WHITE((byte) 15, 15790320), - - // Bukkit colors - // https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Color.html - BUKKIT_WHITE((byte) 15, 0xFFFFFF), - BUKKIT_SILVER((byte) 7, 0xC0C0C0), - BUKKIT_GRAY((byte) 8, 0x808080), - BUKKIT_BLACK((byte) 0, 0x000000), - BUKKIT_RED((byte) 1, 0xFF0000), - BUKKIT_MAROON((byte) 1, 0x800000), // No perfect map but this is as close as it can be - BUKKIT_YELLOW((byte) 11, 0xFFFF00), - BUKKIT_OLIVE((byte) 2, 0x808000), // No perfect map but this is as close as it can be - BUKKIT_LIME((byte) 10, 0x00FF00), - BUKKIT_GREEN((byte) 2, 0x008000), - BUKKIT_AQUA((byte) 12, 0x00FFFF), - BUKKIT_TEAL((byte) 6, 0x008080), - BUKKIT_BLUE((byte) 4, 0x0000FF), - BUKKIT_NAVY((byte) 4, 0x000080), // No perfect map but this is as close as it can be - BUKKIT_FUCHSIA((byte) 9, 0xFF00FF), // No perfect map but this is as close as it can be - BUKKIT_PURPLE((byte) 5, 0x800080), - BUKKIT_ORANGE((byte) 14, 0xFFA500); + BLACK(1973019), + RED(11743532), + GREEN(3887386), + BROWN(5320730), + BLUE(2437522), + PURPLE(8073150), + CYAN(2651799), + LIGHT_GRAY(11250603), + GRAY(4408131), + PINK(14188952), + LIME(4312372), + YELLOW(14602026), + LIGHT_BLUE(6719955), + MAGENTA(12801229), + ORANGE(15435844), + WHITE(15790320); private static final FireworkColor[] VALUES = values(); - @Getter - private final byte bedrockID; - @Getter - private final int javaID; + private final TextColor color; - FireworkColor(byte bedrockID, int javaID) { - this.bedrockID = bedrockID; - this.javaID = javaID; + FireworkColor(int rgbValue) { + this.color = TextColor.color(rgbValue); } - public static FireworkColor fromJavaID(int id) { - for (FireworkColor color : VALUES) { - if (color.javaID == id) { - return color; + private static HSVLike toHSV(int rgbValue) { + int r = (rgbValue & (255 << 16)) >> 16; + int g = (rgbValue & (255 << 8)) >> 8; + int b = rgbValue & 255; + return HSVLike.fromRGB(r, g, b); + } + + public static byte fromJavaRGB(int rgbValue) { + HSVLike hsv = toHSV(rgbValue); + return (byte) nearestTo(hsv).ordinal(); + } + + // The following two methods were adapted from the Adventure project: + // https://github.com/KyoriPowered/adventure/blob/09edf74409feb52d9147a5a811910de0721acf95/api/src/main/java/net/kyori/adventure/text/format/NamedTextColor.java#L193-L237 + /** + * Find the named colour nearest to the provided colour. + * + * @param any colour to match + * @return nearest named colour. will always return a value + * @since 4.0.0 + */ + public static FireworkColor nearestTo(final HSVLike any) { + float matchedDistance = Float.MAX_VALUE; + FireworkColor match = VALUES[0]; + for (final FireworkColor potential : VALUES) { + final float distance = distance(any, potential.color.asHSV()); + if (distance < matchedDistance) { + match = potential; + matchedDistance = distance; + } + if (distance == 0) { + break; // same colour! whoo! + } + } + return match; + } + + /** + * Returns a distance metric to the other colour. + * + *

This value is unitless and should only be used to compare with other text colours.

+ * + * @param other colour to compare to + * @return distance metric + */ + private static float distance(final HSVLike self, final HSVLike other) { + // weight hue more heavily than saturation and brightness. kind of magic numbers, but is fine for our use case of downsampling to a set of colors + final float hueDistance = 3 * Math.min(Math.abs(self.h() - other.h()), 1f - Math.abs(self.h() - other.h())); + final float saturationDiff = self.s() - other.s(); + final float valueDiff = self.v() - other.v(); + return hueDistance * hueDistance + saturationDiff * saturationDiff + valueDiff * valueDiff; + } + + public static int fromBedrockId(int id) { + for (FireworkColor fireworkColor : VALUES) { + if (fireworkColor.ordinal() == id) { + return fireworkColor.color.value(); } } - return WHITE; - } - - public static FireworkColor fromBedrockID(int id) { - for (FireworkColor color : VALUES) { - if (color.bedrockID == id) { - return color; - } - } - - return WHITE; + return WHITE.color.value(); } } From ea8f4b854b710092599f5aa805625355f8c2174e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 29 Aug 2021 10:36:34 -0400 Subject: [PATCH 568/766] Formatting fixes in the FireworkColor class --- .../geysermc/connector/utils/FireworkColor.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java b/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java index 9a20295e5..5a4f0ae0b 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java @@ -69,13 +69,13 @@ public enum FireworkColor { // The following two methods were adapted from the Adventure project: // https://github.com/KyoriPowered/adventure/blob/09edf74409feb52d9147a5a811910de0721acf95/api/src/main/java/net/kyori/adventure/text/format/NamedTextColor.java#L193-L237 /** - * Find the named colour nearest to the provided colour. + * Find the firework color nearest to the provided color. * - * @param any colour to match - * @return nearest named colour. will always return a value + * @param any color to match + * @return nearest named color. will always return a value * @since 4.0.0 */ - public static FireworkColor nearestTo(final HSVLike any) { + private static FireworkColor nearestTo(final HSVLike any) { float matchedDistance = Float.MAX_VALUE; FireworkColor match = VALUES[0]; for (final FireworkColor potential : VALUES) { @@ -92,11 +92,11 @@ public enum FireworkColor { } /** - * Returns a distance metric to the other colour. + * Returns a distance metric to the other color. * - *

This value is unitless and should only be used to compare with other text colours.

+ *

This value is unitless and should only be used to compare with other firework colors.

* - * @param other colour to compare to + * @param other color to compare to * @return distance metric */ private static float distance(final HSVLike self, final HSVLike other) { From b9541505af68ac7b7c093206ac7b1ba88957a5a6 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:55:01 -0400 Subject: [PATCH 569/766] Bump version to try and fix deploying; other nitpicks --- Jenkinsfile | 4 +- ap/pom.xml | 4 +- bootstrap/bungeecord/pom.xml | 4 +- bootstrap/pom.xml | 4 +- bootstrap/spigot/pom.xml | 4 +- bootstrap/sponge/pom.xml | 4 +- bootstrap/standalone/pom.xml | 4 +- bootstrap/velocity/pom.xml | 4 +- common/pom.xml | 2 +- connector/pom.xml | 8 ++-- .../network/UpstreamPacketHandler.java | 2 +- .../network/translators/PacketTranslator.java | 2 +- .../translators/PacketTranslatorRegistry.java | 2 +- .../BedrockAdventureSettingsTranslator.java | 2 +- .../bedrock/BedrockAnimateTranslator.java | 2 +- .../BedrockBlockEntityDataTranslator.java | 2 +- .../BedrockBlockPickRequestTranslator.java | 2 +- .../bedrock/BedrockBookEditTranslator.java | 2 +- .../BedrockCommandBlockUpdateTranslator.java | 2 +- .../BedrockCommandRequestTranslator.java | 2 +- .../BedrockContainerCloseTranslator.java | 2 +- .../bedrock/BedrockEmoteListTranslator.java | 2 +- .../BedrockEntityPickRequestTranslator.java | 2 +- .../bedrock/BedrockFilterTextTranslator.java | 2 +- ...BedrockInventoryTransactionTranslator.java | 2 +- .../BedrockItemFrameDropItemTranslator.java | 2 +- .../BedrockItemStackRequestTranslator.java | 2 +- .../BedrockLecternUpdateTranslator.java | 2 +- .../BedrockMapInfoRequestTranslator.java | 2 +- .../BedrockMobEquipmentTranslator.java | 2 +- .../BedrockMoveEntityAbsoluteTranslator.java | 2 +- .../BedrockNetworkStackLatencyTranslator.java | 2 +- ...drockPacketViolationWarningTranslator.java | 2 +- .../bedrock/BedrockPlayerInputTranslator.java | 2 +- ...tionTrackingDBClientRequestTranslator.java | 2 +- .../bedrock/BedrockRespawnTranslator.java | 2 +- ...edrockServerSettingsRequestTranslator.java | 2 +- ...SetLocalPlayerAsInitializedTranslator.java | 2 +- .../bedrock/BedrockShowCreditsTranslator.java | 2 +- .../bedrock/BedrockTextTranslator.java | 2 +- .../entity/BedrockEntityEventTranslator.java | 2 +- .../player/BedrockActionTranslator.java | 2 +- .../entity/player/BedrockEmoteTranslator.java | 2 +- .../player/BedrockInteractTranslator.java | 2 +- .../player/BedrockMovePlayerTranslator.java | 2 +- .../player/BedrockRiderJumpTranslator.java | 2 +- .../BedrockSetPlayerGameTypeTranslator.java | 2 +- .../BedrockLevelSoundEventTranslator.java | 2 +- .../java/JavaAdvancementsTabTranslator.java | 2 +- .../java/JavaAdvancementsTranslator.java | 2 +- .../java/JavaBossBarTranslator.java | 2 +- .../translators/java/JavaChatTranslator.java | 2 +- .../java/JavaDeclareCommandsTranslator.java | 2 +- .../java/JavaDeclareRecipesTranslator.java | 2 +- .../java/JavaDeclareTagsTranslator.java | 2 +- .../java/JavaDifficultyTranslator.java | 2 +- .../java/JavaDisconnectPacket.java | 2 +- .../java/JavaJoinGameTranslator.java | 2 +- .../java/JavaKeepAliveTranslator.java | 2 +- .../java/JavaLoginDisconnectTranslator.java | 2 +- .../JavaLoginPluginRequestTranslator.java | 2 +- .../java/JavaLoginSuccessTranslator.java | 2 +- .../translators/java/JavaPingPacket.java | 2 +- .../java/JavaPluginMessageTranslator.java | 2 +- .../java/JavaRespawnTranslator.java | 2 +- .../java/JavaStatisticsTranslator.java | 2 +- .../java/JavaUnlockRecipesTranslator.java | 2 +- .../entity/JavaEntityAnimationTranslator.java | 2 +- .../entity/JavaEntityAttachTranslator.java | 2 +- .../JavaEntityCollectItemTranslator.java | 2 +- .../entity/JavaEntityEffectTranslator.java | 2 +- .../entity/JavaEntityEquipmentTranslator.java | 2 +- .../entity/JavaEntityHeadLookTranslator.java | 2 +- .../entity/JavaEntityMetadataTranslator.java | 2 +- .../JavaEntityPositionRotationTranslator.java | 2 +- .../entity/JavaEntityPositionTranslator.java | 2 +- .../JavaEntityPropertiesTranslator.java | 2 +- .../JavaEntityRemoveEffectTranslator.java | 2 +- .../entity/JavaEntityRotationTranslator.java | 2 +- .../JavaEntitySetPassengersTranslator.java | 2 +- .../entity/JavaEntityStatusTranslator.java | 2 +- .../entity/JavaEntityTeleportTranslator.java | 2 +- .../entity/JavaEntityVelocityTranslator.java | 2 +- .../entity/JavaRemoveEntitiesTranslator.java | 2 +- .../player/JavaPlayerAbilitiesTranslator.java | 2 +- .../player/JavaPlayerActionAckTranslator.java | 2 +- .../JavaPlayerChangeHeldItemTranslator.java | 2 +- .../player/JavaPlayerHealthTranslator.java | 2 +- .../player/JavaPlayerListEntryTranslator.java | 2 +- .../JavaPlayerPositionRotationTranslator.java | 2 +- .../JavaPlayerSetExperienceTranslator.java | 2 +- .../spawn/JavaSpawnEntityTranslator.java | 2 +- .../spawn/JavaSpawnExpOrbTranslator.java | 2 +- .../JavaSpawnLivingEntityTranslator.java | 2 +- .../spawn/JavaSpawnPaintingTranslator.java | 2 +- .../spawn/JavaSpawnPlayerTranslator.java | 2 +- .../JavaDisplayScoreboardTranslator.java | 2 +- .../JavaScoreboardObjectiveTranslator.java | 2 +- .../java/scoreboard/JavaTeamTranslator.java | 2 +- .../scoreboard/JavaUpdateScoreTranslator.java | 2 +- .../java/title/JavaClearTitlesTranslator.java | 2 +- .../title/JavaSetActionBarTextTranslator.java | 2 +- .../title/JavaSetSubtitleTextTranslator.java | 2 +- .../title/JavaSetTitleTextTranslator.java | 2 +- .../JavaSetTitlesAnimationTranslator.java | 2 +- .../window/JavaCloseWindowTranslator.java | 2 +- .../window/JavaOpenHorseWindowTranslator.java | 2 +- .../java/window/JavaOpenWindowTranslator.java | 2 +- .../java/window/JavaSetSlotTranslator.java | 2 +- .../window/JavaWindowItemsTranslator.java | 2 +- .../window/JavaWindowPropertyTranslator.java | 2 +- .../world/JavaBlockBreakAnimTranslator.java | 2 +- .../java/world/JavaBlockChangeTranslator.java | 2 +- .../java/world/JavaBlockValueTranslator.java | 2 +- .../java/world/JavaChunkDataTranslator.java | 2 +- .../java/world/JavaExplosionTranslator.java | 2 +- .../java/world/JavaMapDataTranslator.java | 2 +- .../world/JavaMultiBlockChangeTranslator.java | 2 +- .../world/JavaNotifyClientTranslator.java | 2 +- .../world/JavaPlayBuiltinSoundTranslator.java | 2 +- .../java/world/JavaPlayEffectTranslator.java | 2 +- .../java/world/JavaPlaySoundTranslator.java | 2 +- .../world/JavaSpawnParticleTranslator.java | 2 +- .../world/JavaSpawnPositionTranslator.java | 2 +- .../java/world/JavaStopSoundTranslator.java | 2 +- .../java/world/JavaTradeListTranslator.java | 2 +- .../java/world/JavaUnloadChunkTranslator.java | 2 +- .../world/JavaUpdateTileEntityTranslator.java | 2 +- .../java/world/JavaUpdateTimeTranslator.java | 2 +- .../JavaUpdateViewDistanceTranslator.java | 2 +- .../JavaUpdateViewPositionTranslator.java | 2 +- .../java/world/JavaVehicleMoveTranslator.java | 2 +- .../connector/utils/LoginEncryptionUtils.java | 48 ++++++++++++++----- pom.xml | 2 +- 134 files changed, 181 insertions(+), 155 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 325fb977b..0b77fa9c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - /*stage ('Deploy') { + stage ('Deploy') { when { branch "master" } @@ -48,7 +48,7 @@ pipeline { serverId: "opencollab-artifactory" ) } - }*/ + } } post { diff --git a/ap/pom.xml b/ap/pom.xml index 7e263c0d1..f8cc2dd1b 100644 --- a/ap/pom.xml +++ b/ap/pom.xml @@ -6,9 +6,9 @@ org.geysermc geyser-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT ap - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT \ No newline at end of file diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index f49f5f408..b01ac7984 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT bootstrap-bungeecord @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT compile diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index 6bbd1a0b6..c54d489fa 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT bootstrap-parent pom @@ -34,7 +34,7 @@ org.geysermc ap - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT provided diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index 4277dc235..cc2a73ffd 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT bootstrap-spigot @@ -21,7 +21,7 @@ org.geysermc connector - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT compile diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml index 77f4fe78a..4991e8aaf 100644 --- a/bootstrap/sponge/pom.xml +++ b/bootstrap/sponge/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT bootstrap-sponge @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT compile diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index e338f9533..e39097b4a 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT bootstrap-standalone @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT compile diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml index 5c12b6a46..1e74bafbc 100644 --- a/bootstrap/velocity/pom.xml +++ b/bootstrap/velocity/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT bootstrap-velocity @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT compile diff --git a/common/pom.xml b/common/pom.xml index 2dfa63a42..edf31c2b8 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT common diff --git a/connector/pom.xml b/connector/pom.xml index 371a09a52..6b955ca21 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT connector @@ -21,13 +21,13 @@ org.geysermc ap - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT provided org.geysermc common - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT compile @@ -115,7 +115,7 @@ com.github.CloudburstMC.Protocol bedrock-v448 - 690a545d + 6ce2f6e compile diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 84bb63b95..6915e4575 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -80,7 +80,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { session.setBlockMappings(BlockRegistries.BLOCKS.forVersion(loginPacket.getProtocolVersion())); session.setItemMappings(Registries.ITEMS.forVersion(loginPacket.getProtocolVersion())); - LoginEncryptionUtils.encryptPlayerConnection(connector, session, loginPacket); + LoginEncryptionUtils.encryptPlayerConnection(session, loginPacket); PlayStatusPacket playStatus = new PlayStatusPacket(); playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java index 8bb3eb330..f59f747d2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java @@ -29,6 +29,6 @@ import org.geysermc.connector.network.session.GeyserSession; public abstract class PacketTranslator { - public abstract void translate(T packet, GeyserSession session); + public abstract void translate(GeyserSession session, T packet); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 7bd0e66ac..49f299d59 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -112,7 +112,7 @@ public class PacketTranslatorRegistry { } try { - translator.translate(packet, session); + translator.translate(session, packet); } catch (Throwable ex) { GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); ex.printStackTrace(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index e868eedeb..a9ae9db6d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockAdventureSettingsTranslator extends PacketTranslator { @Override - public void translate(AdventureSettingsPacket packet, GeyserSession session) { + public void translate(GeyserSession session, AdventureSettingsPacket packet) { boolean isFlying = packet.getSettings().contains(AdventureSetting.FLYING); if (!isFlying && session.getGameMode() == GameMode.SPECTATOR) { // We should always be flying in spectator mode diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index 4d915b619..53912bf4e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit; public class BedrockAnimateTranslator extends PacketTranslator { @Override - public void translate(AnimatePacket packet, GeyserSession session) { + public void translate(GeyserSession session, AnimatePacket packet) { // Stop the player sending animations before they have fully spawned into the server if (!session.isSpawned()) { return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java index f9db86d8b..a5575bb82 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.utils.SignUtils; public class BedrockBlockEntityDataTranslator extends PacketTranslator { @Override - public void translate(BlockEntityDataPacket packet, GeyserSession session) { + public void translate(GeyserSession session, BlockEntityDataPacket packet) { NbtMap tag = packet.getData(); if (tag.getString("id").equals("Sign")) { // This is the reason why this all works - Bedrock sends packets every time you update the sign, Java only wants the final packet diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java index 3a3a4bbed..add16e9ca 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class BedrockBlockPickRequestTranslator extends PacketTranslator { @Override - public void translate(BlockPickRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, BlockPickRequestPacket packet) { Vector3i vector = packet.getBlockPosition(); int blockToPick = session.getConnector().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java index 67dcb40c8..53e945c52 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java @@ -49,7 +49,7 @@ public class BedrockBookEditTranslator extends PacketTranslator private static final int MAXIMUM_TITLE_LENGTH = 128 * 4; @Override - public void translate(BookEditPacket packet, GeyserSession session) { + public void translate(GeyserSession session, BookEditPacket packet) { if (packet.getText() != null && !packet.getText().isEmpty() && packet.getText().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PAGE_LENGTH) { session.getConnector().getLogger().warning("Page length greater than server allowed!"); return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java index 634ba0c56..f8f503387 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockCommandBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(CommandBlockUpdatePacket packet, GeyserSession session) { + public void translate(GeyserSession session, CommandBlockUpdatePacket packet) { String command = packet.getCommand(); boolean outputTracked = packet.isOutputTracked(); if (packet.isBlock()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java index a9ed15cef..b73048d33 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class BedrockCommandRequestTranslator extends PacketTranslator { @Override - public void translate(CommandRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, CommandRequestPacket packet) { String command = packet.getCommand().replace("/", ""); CommandManager commandManager = GeyserConnector.getInstance().getCommandManager(); if (session.getConnector().getPlatformType() == PlatformType.STANDALONE && command.trim().startsWith("geyser ") && commandManager.getCommands().containsKey(command.split(" ")[1])) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java index 88c2206d5..935dde462 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class BedrockContainerCloseTranslator extends PacketTranslator { @Override - public void translate(ContainerClosePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ContainerClosePacket packet) { byte windowId = packet.getId(); //Client wants close confirmation diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java index 2519aa447..4a005082a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockEmoteListTranslator extends PacketTranslator { @Override - public void translate(EmoteListPacket packet, GeyserSession session) { + public void translate(GeyserSession session, EmoteListPacket packet) { if (session.getConnector().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java index 3910fd7ff..c6677dbdc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class BedrockEntityPickRequestTranslator extends PacketTranslator { @Override - public void translate(EntityPickRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, EntityPickRequestPacket packet) { if (session.getGameMode() != GameMode.CREATIVE) return; // Apparently Java behavior Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId()); if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java index 3b017dfbd..681ca432c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java @@ -41,7 +41,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockFilterTextTranslator extends PacketTranslator { @Override - public void translate(FilterTextPacket packet, GeyserSession session) { + public void translate(GeyserSession session, FilterTextPacket packet) { if (session.getOpenInventory() instanceof CartographyContainer) { // We don't want to be able to rename in the cartography table return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 72cbdbd52..45135d90c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -70,7 +70,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { @Override - public void translate(ItemFrameDropItemPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ItemFrameDropItemPacket packet) { Entity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition()); if (entity != null) { ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java index b5e0dd2ce..80d5e8098 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator; public class BedrockItemStackRequestTranslator extends PacketTranslator { @Override - public void translate(ItemStackRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ItemStackRequestPacket packet) { Inventory inventory = session.getOpenInventory(); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java index f693ade96..ea30099f0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java @@ -45,7 +45,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class BedrockLecternUpdateTranslator extends PacketTranslator { @Override - public void translate(LecternUpdatePacket packet, GeyserSession session) { + public void translate(GeyserSession session, LecternUpdatePacket packet) { if (packet.isDroppingBook()) { // Bedrock drops the book outside of the GUI. Java drops it in the GUI // So, we enter the GUI and then drop it! :) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java index b997644c7..4b4c5b20d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit; public class BedrockMapInfoRequestTranslator extends PacketTranslator { @Override - public void translate(MapInfoRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, MapInfoRequestPacket packet) { long mapId = packet.getUniqueMapId(); ClientboundMapItemDataPacket mapPacket = session.getStoredMaps().remove(mapId); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java index 3102c622f..4e53e0c4e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; public class BedrockMobEquipmentTranslator extends PacketTranslator { @Override - public void translate(MobEquipmentPacket packet, GeyserSession session) { + public void translate(GeyserSession session, MobEquipmentPacket packet) { if (!session.isSpawned() || packet.getHotbarSlot() > 8 || packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) { // For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java index fbfaafb43..00fa6a1f3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator { @Override - public void translate(MoveEntityAbsolutePacket packet, GeyserSession session) { + public void translate(GeyserSession session, MoveEntityAbsolutePacket packet) { session.setLastVehicleMoveTimestamp(System.currentTimeMillis()); float y = packet.getPosition().getY(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java index cd9265c0e..345c69d66 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java @@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit; public class BedrockNetworkStackLatencyTranslator extends PacketTranslator { @Override - public void translate(NetworkStackLatencyPacket packet, GeyserSession session) { + public void translate(GeyserSession session, NetworkStackLatencyPacket packet) { long pingId; // so apparently, as of 1.16.200 // PS4 divides the network stack latency timestamp FOR US!!! diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java index b69cedcb5..110a3f547 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockPacketViolationWarningTranslator extends PacketTranslator { @Override - public void translate(PacketViolationWarningPacket packet, GeyserSession session) { + public void translate(GeyserSession session, PacketViolationWarningPacket packet) { // Not translated since this is something that the developers need to know session.getConnector().getLogger().error("Packet violation warning sent from client! " + packet.toString()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java index 1d9eb0221..27289b5d2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java @@ -46,7 +46,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockPlayerInputTranslator extends PacketTranslator { @Override - public void translate(PlayerInputPacket packet, GeyserSession session) { + public void translate(GeyserSession session, PlayerInputPacket packet) { ClientSteerVehiclePacket clientSteerVehiclePacket = new ClientSteerVehiclePacket( packet.getInputMotion().getX(), packet.getInputMotion().getY(), packet.isJumping(), packet.isSneaking() ); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index da760cdd9..b8f09103d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.utils.LoadstoneTracker; public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator { @Override - public void translate(PositionTrackingDBClientRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, PositionTrackingDBClientRequestPacket packet) { PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket(); broadcastPacket.setTrackingId(packet.getTrackingId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java index 2964bd65c..1257ec0d9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockRespawnTranslator extends PacketTranslator { @Override - public void translate(RespawnPacket packet, GeyserSession session) { + public void translate(GeyserSession session, RespawnPacket packet) { if (packet.getState() == RespawnPacket.State.CLIENT_READY) { // Previously we only sent the respawn packet before the server finished loading // The message included was 'Otherwise when immediate respawn is on the client never loads' diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java index 501ed4468..2b2ec2917 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit; @Translator(packet = ServerSettingsRequestPacket.class) public class BedrockServerSettingsRequestTranslator extends PacketTranslator { @Override - public void translate(ServerSettingsRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSettingsRequestPacket packet) { CustomForm window = SettingsUtils.buildForm(session); int windowId = session.getFormCache().addForm(window); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index ac6f543d3..c52513c4d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.skin.SkullSkinManager; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator { @Override - public void translate(SetLocalPlayerAsInitializedPacket packet, GeyserSession session) { + public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) { if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) { if (!session.getUpstream().isInitialized()) { session.getUpstream().setInitialized(true); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java index c6c292225..0252817ef 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; public class BedrockShowCreditsTranslator extends PacketTranslator { @Override - public void translate(ShowCreditsPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ShowCreditsPacket packet) { if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) { ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java index 9253372a9..775a40114 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class BedrockTextTranslator extends PacketTranslator { @Override - public void translate(TextPacket packet, GeyserSession session) { + public void translate(GeyserSession session, TextPacket packet) { String message = packet.getMessage(); if (MessageTranslator.isTooLong(message, session)) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index e5c2590da..b85f57586 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -43,7 +43,7 @@ import java.util.concurrent.TimeUnit; public class BedrockEntityEventTranslator extends PacketTranslator { @Override - public void translate(EntityEventPacket packet, GeyserSession session) { + public void translate(GeyserSession session, EntityEventPacket packet) { switch (packet.getType()) { case EATING_ITEM: // Resend the packet so we get the eating sounds diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java index 2603f2a0f..ab652434c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java @@ -54,7 +54,7 @@ import java.util.ArrayList; public class BedrockActionTranslator extends PacketTranslator { @Override - public void translate(PlayerActionPacket packet, GeyserSession session) { + public void translate(GeyserSession session, PlayerActionPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); // Send book update before any player action diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java index 890dc0c8c..a20c3872c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.utils.BlockUtils; public class BedrockEmoteTranslator extends PacketTranslator { @Override - public void translate(EmotePacket packet, GeyserSession session) { + public void translate(GeyserSession session, EmotePacket packet) { if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now ClientPlayerActionPacket swapHandsPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java index 10384d43c..cb101c231 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java @@ -46,7 +46,7 @@ import org.geysermc.connector.utils.InteractiveTagManager; public class BedrockInteractTranslator extends PacketTranslator { @Override - public void translate(InteractPacket packet, GeyserSession session) { + public void translate(GeyserSession session, InteractPacket packet) { Entity entity; if (packet.getRuntimeEntityId() == session.getPlayerEntity().getGeyserId()) { //Player is not in entity cache diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index 7970dbd16..6882e6e0c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -53,7 +53,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator { @Override - public void translate(RiderJumpPacket packet, GeyserSession session) { + public void translate(GeyserSession session, RiderJumpPacket packet) { Entity vehicle = session.getRidingVehicleEntity(); if (vehicle instanceof AbstractHorseEntity) { ClientPlayerStatePacket playerStatePacket = new ClientPlayerStatePacket((int) vehicle.getEntityId(), PlayerState.START_HORSE_JUMP, packet.getJumpStrength()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java index b8afe76c8..1022d838d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator; public class BedrockSetPlayerGameTypeTranslator extends PacketTranslator { @Override - public void translate(SetPlayerGameTypePacket packet, GeyserSession session) { + public void translate(GeyserSession session, SetPlayerGameTypePacket packet) { // no SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket(); playerGameTypePacket.setGamemode(session.getGameMode().ordinal()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java index c87692b8c..8b19a00eb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.utils.CooldownUtils; public class BedrockLevelSoundEventTranslator extends PacketTranslator { @Override - public void translate(LevelSoundEventPacket packet, GeyserSession session) { + public void translate(GeyserSession session, LevelSoundEventPacket packet) { // lol what even :thinking: session.sendUpstreamPacket(packet); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java index aa22ae465..6a6d541c6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.Translator; @Translator(packet = ServerAdvancementTabPacket.class) public class JavaAdvancementsTabTranslator extends PacketTranslator { @Override - public void translate(ServerAdvancementTabPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerAdvancementTabPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId()); advancementsCache.buildAndShowListForm(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java index 2e1057e0e..01de50c21 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java @@ -42,7 +42,7 @@ import java.util.Map; public class JavaAdvancementsTranslator extends PacketTranslator { @Override - public void translate(ServerAdvancementsPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerAdvancementsPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); if (packet.isReset()) { advancementsCache.getStoredAdvancements().clear(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java index 0dd7cb950..b74c84444 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java @@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerBossBarPacke @Translator(packet = ServerBossBarPacket.class) public class JavaBossBarTranslator extends PacketTranslator { @Override - public void translate(ServerBossBarPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerBossBarPacket packet) { BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); switch (packet.getAction()) { case ADD: diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java index a59880509..e059517d7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class JavaChatTranslator extends PacketTranslator { @Override - public void translate(ServerChatPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerChatPacket packet) { TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 0aec21840..e4116c6aa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -96,7 +96,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion()); // Get the last known network ID (first used for the pregenerated recipes) and increment from there. int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java index 368693bf2..c72ab4543 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaDeclareTagsTranslator extends PacketTranslator { @Override - public void translate(ServerDeclareTagsPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerDeclareTagsPacket packet) { session.getTagCache().loadPacket(packet); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java index 48447fe8a..b6299cc35 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; public class JavaDifficultyTranslator extends PacketTranslator { @Override - public void translate(ServerDifficultyPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerDifficultyPacket packet) { SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket(); setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal()); session.sendUpstreamPacket(setDifficultyPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java index cf6688db9..3a9ca3787 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class JavaDisconnectPacket extends PacketTranslator { @Override - public void translate(ServerDisconnectPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerDisconnectPacket packet) { session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index a84464c10..da21b7c22 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -52,7 +52,7 @@ public class JavaJoinGameTranslator extends PacketTranslator SKIN_PART_VALUES = Arrays.asList(SkinPart.values()); @Override - public void translate(ServerJoinGamePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerJoinGamePacket packet) { PlayerEntity entity = session.getPlayerEntity(); entity.setEntityId(packet.getEntityId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java index 8506389f3..6798b191c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaKeepAliveTranslator extends PacketTranslator { @Override - public void translate(ServerKeepAlivePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerKeepAlivePacket packet) { if (!session.getConnector().getConfig().isForwardPlayerPing()) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java index 3433edcc2..814082d05 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class JavaLoginDisconnectTranslator extends PacketTranslator { @Override - public void translate(LoginDisconnectPacket packet, GeyserSession session) { + public void translate(GeyserSession session, LoginDisconnectPacket packet) { // The client doesn't manually get disconnected so we have to do it ourselves session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java index 9680188be..2ed285208 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java @@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestP @Translator(packet = LoginPluginRequestPacket.class) public class JavaLoginPluginRequestTranslator extends PacketTranslator { @Override - public void translate(LoginPluginRequestPacket packet, GeyserSession session) { + public void translate(GeyserSession session, LoginPluginRequestPacket packet) { // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. // Note: Fabric Networking API v1 will not let the client log in without sending this session.sendDownstreamPacket( diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java index 214ea5deb..d7675bd07 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.skin.SkinManager; public class JavaLoginSuccessTranslator extends PacketTranslator { @Override - public void translate(LoginSuccessPacket packet, GeyserSession session) { + public void translate(GeyserSession session, LoginSuccessPacket packet) { PlayerEntity playerEntity = session.getPlayerEntity(); AuthType remoteAuthType = session.getRemoteAuthType(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java index c324a81c4..c2dc3454d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaPingPacket extends PacketTranslator { @Override - public void translate(ServerPingPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPingPacket packet) { session.sendDownstreamPacket(new ClientPongPacket(packet.getId())); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index 013730878..15f1f960b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -41,7 +41,7 @@ import java.nio.charset.StandardCharsets; @Translator(packet = ServerPluginMessagePacket.class) public class JavaPluginMessageTranslator extends PacketTranslator { @Override - public void translate(ServerPluginMessagePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPluginMessagePacket packet) { // The only plugin messages it has to listen for are Floodgate plugin messages if (session.getRemoteAuthType() != AuthType.FLOODGATE) { return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java index 0af30c4fd..8df47c7b0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java @@ -43,7 +43,7 @@ import org.geysermc.connector.utils.DimensionUtils; public class JavaRespawnTranslator extends PacketTranslator { @Override - public void translate(ServerRespawnPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerRespawnPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); entity.setHealth(entity.getMaxHealth()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java index 247808041..15c6452ed 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.utils.StatisticsUtils; public class JavaStatisticsTranslator extends PacketTranslator { @Override - public void translate(ServerStatisticsPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerStatisticsPacket packet) { session.updateStatistics(packet.getStatistics()); if (session.isWaitingForStatistics()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUnlockRecipesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUnlockRecipesTranslator.java index 0a0ba4d2d..d7c4053e6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUnlockRecipesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUnlockRecipesTranslator.java @@ -40,7 +40,7 @@ import java.util.Arrays; public class JavaUnlockRecipesTranslator extends PacketTranslator { @Override - public void translate(ServerUnlockRecipesPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerUnlockRecipesPacket packet) { if (packet.getAction() == UnlockRecipesAction.REMOVE) { session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes())); } else { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java index 255c4f466..57bacc658 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.utils.DimensionUtils; public class JavaEntityAnimationTranslator extends PacketTranslator { @Override - public void translate(ServerEntityAnimationPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityAnimationPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java index b7ca66fe2..20f5c4e57 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityAttachTranslator extends PacketTranslator { @Override - public void translate(ServerEntityAttachPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityAttachPacket packet) { Entity holderId; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java index 4711e54e3..70b93472f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java @@ -44,7 +44,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityCollectItemTranslator extends PacketTranslator { @Override - public void translate(ServerEntityCollectItemPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityCollectItemPacket packet) { // Collected entity is the other entity Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId()); if (collectedEntity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java index 627b3f2e9..d99b11a49 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.utils.EntityUtils; public class JavaEntityEffectTranslator extends PacketTranslator { @Override - public void translate(ServerEntityEffectPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java index d3a1c52bc..5dc015418 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.network.translators.item.ItemTranslator; public class JavaEntityEquipmentTranslator extends PacketTranslator { @Override - public void translate(ServerEntityEquipmentPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityEquipmentPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java index 71801e4db..5120e8c3a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityHeadLookTranslator extends PacketTranslator { @Override - public void translate(ServerEntityHeadLookPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityHeadLookPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java index 73047d0c4..c67becaef 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.utils.LanguageUtils; public class JavaEntityMetadataTranslator extends PacketTranslator { @Override - public void translate(ServerEntityMetadataPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityMetadataPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java index 7f915e47d..733725936 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityPositionRotationTranslator extends PacketTranslator { @Override - public void translate(ServerEntityPositionRotationPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityPositionRotationPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java index 999b5f0e9..67f8fe1b6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityPositionTranslator extends PacketTranslator { @Override - public void translate(ServerEntityPositionPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityPositionPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java index 642ba3bb8..c3937a1e3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityPropertiesTranslator extends PacketTranslator { @Override - public void translate(ServerEntityPropertiesPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityPropertiesPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java index 4a55f51a8..131fa2505 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.utils.EntityUtils; public class JavaEntityRemoveEffectTranslator extends PacketTranslator { @Override - public void translate(ServerEntityRemoveEffectPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityRemoveEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java index 62fe65857..71e005899 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityRotationTranslator extends PacketTranslator { @Override - public void translate(ServerEntityRotationPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityRotationPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java index 66d3e3880..3e9fa0755 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java @@ -43,7 +43,7 @@ import java.util.Arrays; public class JavaEntitySetPassengersTranslator extends PacketTranslator { @Override - public void translate(ServerEntitySetPassengersPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntitySetPassengersPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java index af1cfc45b..aaa42d12d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java @@ -43,7 +43,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaEntityStatusTranslator extends PacketTranslator { @Override - public void translate(ServerEntityStatusPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityStatusPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java index 62d2ed214..35dcacfec 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java @@ -37,7 +37,7 @@ import com.nukkitx.math.vector.Vector3f; public class JavaEntityTeleportTranslator extends PacketTranslator { @Override - public void translate(ServerEntityTeleportPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityTeleportPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java index 3f0b69cdb..28d0d977f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java @@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; public class JavaEntityVelocityTranslator extends PacketTranslator { @Override - public void translate(ServerEntityVelocityPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerEntityVelocityPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java index e05763ee1..0b1e021e2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaRemoveEntitiesTranslator extends PacketTranslator { @Override - public void translate(ServerRemoveEntitiesPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerRemoveEntitiesPacket packet) { for (int entityId : packet.getEntityIds()) { Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java index f97e91edb..4b0152fcb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaPlayerAbilitiesTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerAbilitiesPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerAbilitiesPacket packet) { session.setCanFly(packet.isCanFly()); session.setFlying(packet.isFlying()); session.sendAdventureSettings(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java index f7572dd82..8c9aa0142 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.utils.ChunkUtils; public class JavaPlayerActionAckTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerActionAckPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerActionAckPacket packet) { ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) { LevelEventPacket stopBreak = new LevelEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java index 58ab3bfcd..27e16ee12 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerChangeHeldItemPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerChangeHeldItemPacket packet) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java index 05bdfd95b..20403a610 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java @@ -41,7 +41,7 @@ import java.util.List; public class JavaPlayerHealthTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerHealthPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerHealthPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); int health = (int) Math.ceil(packet.getHealth()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java index b8a7972c8..b5a358035 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.skin.SkinManager; @Translator(packet = ServerPlayerListEntryPacket.class) public class JavaPlayerListEntryTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerListEntryPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerListEntryPacket packet) { if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java index 454d23d69..6b1778464 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java @@ -50,7 +50,7 @@ import org.geysermc.connector.utils.LanguageUtils; public class JavaPlayerPositionRotationTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerPositionRotationPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerPositionRotationPacket packet) { if (!session.isLoggedIn()) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java index 52cd0b587..8a8636eb5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java @@ -40,7 +40,7 @@ import java.util.Arrays; public class JavaPlayerSetExperienceTranslator extends PacketTranslator { @Override - public void translate(ServerPlayerSetExperiencePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayerSetExperiencePacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java index 7bce03d72..e53358ac2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java @@ -46,7 +46,7 @@ import java.lang.reflect.InvocationTargetException; public class JavaSpawnEntityTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnEntityPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnEntityPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java index a158751c8..6fd0e6094 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java @@ -39,7 +39,7 @@ import com.nukkitx.math.vector.Vector3f; public class JavaSpawnExpOrbTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnExpOrbPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnExpOrbPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Entity entity = new ExpOrbEntity( diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java index 96d93fabd..46d47e808 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java @@ -42,7 +42,7 @@ import java.lang.reflect.InvocationTargetException; public class JavaSpawnLivingEntityTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnLivingEntityPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnLivingEntityPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getHeadYaw()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java index fea6fd3d4..1d5ee4736 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.utils.PaintingType; public class JavaSpawnPaintingTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnPaintingPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnPaintingPacket packet) { Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); PaintingEntity entity = new PaintingEntity(packet.getEntityId(), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java index 4cb967234..6df3666b6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.skin.SkinManager; public class JavaSpawnPlayerTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnPlayerPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnPlayerPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java index dc2112b6a..a92cc628e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java @@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerD public class JavaDisplayScoreboardTranslator extends PacketTranslator { @Override - public void translate(ServerDisplayScoreboardPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerDisplayScoreboardPacket packet) { session.getWorldCache().getScoreboard() .displayObjective(packet.getName(), packet.getPosition()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index 87c842ff9..d898edf9c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -41,7 +41,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerS public class JavaScoreboardObjectiveTranslator extends PacketTranslator { @Override - public void translate(ServerScoreboardObjectivePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerScoreboardObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); Objective objective = scoreboard.getObjective(packet.getName()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index 1774f12c9..6ec4813d4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -47,7 +47,7 @@ public class JavaTeamTranslator extends PacketTranslator { private static final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger(); @Override - public void translate(ServerTeamPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerTeamPacket packet) { if (LOGGER.isDebug()) { LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java index b7054b1e2..daf4d3832 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java @@ -47,7 +47,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator { @Override - public void translate(ServerClearTitlesPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerClearTitlesPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); // TODO handle packet.isResetTimes() titlePacket.setType(SetTitlePacket.Type.CLEAR); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java index ebbfdffe2..516568b37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class JavaSetActionBarTextTranslator extends PacketTranslator { @Override - public void translate(ServerSetActionBarTextPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSetActionBarTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java index 5411962a1..ee246ea11 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class JavaSetSubtitleTextTranslator extends PacketTranslator { @Override - public void translate(ServerSetSubtitleTextPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSetSubtitleTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java index 5e8d05572..199d05e3b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.chat.MessageTranslator; public class JavaSetTitleTextTranslator extends PacketTranslator { @Override - public void translate(ServerSetTitleTextPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSetTitleTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java index 69a0b2ba7..7514eef4c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaSetTitlesAnimationTranslator extends PacketTranslator { @Override - public void translate(ServerSetTitlesAnimationPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSetTitlesAnimationPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.TIMES); titlePacket.setText(""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java index 3c984c0a2..419f4fc50 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class JavaCloseWindowTranslator extends PacketTranslator { @Override - public void translate(ServerCloseWindowPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerCloseWindowPacket packet) { // Sometimes the server can request a window close of ID 0... when the window isn't even open // Don't confirm in this instance InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java index 5016b6150..ecd74332b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java @@ -98,7 +98,7 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator { @Override - public void translate(ServerOpenWindowPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerOpenWindowPacket packet) { if (packet.getWindowId() == 0) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java index 68fc2df39..27f932c98 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java @@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit; public class JavaSetSlotTranslator extends PacketTranslator { @Override - public void translate(ServerSetSlotPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSetSlotPacket packet) { if (packet.getWindowId() == 255) { //cursor GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); session.getPlayerInventory().setCursor(newItem, session); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java index 7f8cea595..542001dfb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class JavaWindowItemsTranslator extends PacketTranslator { @Override - public void translate(ServerWindowItemsPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerWindowItemsPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java index c5dcc76ca..512c797d2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.utils.InventoryUtils; public class JavaWindowPropertyTranslator extends PacketTranslator { @Override - public void translate(ServerWindowPropertyPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerWindowPropertyPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java index 4a3f60a8d..1a2b5e469 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java @@ -41,7 +41,7 @@ import org.geysermc.connector.utils.BlockUtils; public class JavaBlockBreakAnimTranslator extends PacketTranslator { @Override - public void translate(ServerBlockBreakAnimPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerBlockBreakAnimPacket packet) { int state = session.getConnector().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); int breakTime = (int) (65535 / Math.ceil(BlockUtils.getBreakTime(session, BlockRegistries.JAVA_BLOCKS.get(state), ItemMapping.AIR, new CompoundTag(""), false) * 20)); LevelEventPacket levelEventPacket = new LevelEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java index d144e99b8..78ee1238e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.utils.ChunkUtils; public class JavaBlockChangeTranslator extends PacketTranslator { @Override - public void translate(ServerBlockChangePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerBlockChangePacket packet) { Position pos = packet.getRecord().getPosition(); boolean updatePlacement = session.getConnector().getPlatformType() != PlatformType.SPIGOT && // Spigot simply listens for the block place event session.getConnector().getWorldManager().getBlockAt(session, pos) != packet.getRecord().getBlock(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java index bb703f2ee..892a41070 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java @@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit; public class JavaBlockValueTranslator extends PacketTranslator { @Override - public void translate(ServerBlockValuePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerBlockValuePacket packet) { BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java index 2ec3a15fc..2cadf157f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java @@ -52,7 +52,7 @@ public class JavaChunkDataTranslator extends PacketTranslator { @Override - public void translate(ServerExplosionPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerExplosionPacket packet) { for (ExplodedBlockRecord record : packet.getExploded()) { Vector3f pos = Vector3f.from(packet.getX() + record.getX(), packet.getY() + record.getY(), packet.getZ() + record.getZ()); ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, pos.toInt()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java index 8a67080a4..984d85d04 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java @@ -41,7 +41,7 @@ import org.geysermc.connector.utils.MapColor; @Translator(packet = ServerMapDataPacket.class) public class JavaMapDataTranslator extends PacketTranslator { @Override - public void translate(ServerMapDataPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerMapDataPacket packet) { ClientboundMapItemDataPacket mapItemDataPacket = new ClientboundMapItemDataPacket(); boolean shouldStore = false; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java index de1eea0bd..2a4115af7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java @@ -37,7 +37,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMultiB public class JavaMultiBlockChangeTranslator extends PacketTranslator { @Override - public void translate(ServerMultiBlockChangePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerMultiBlockChangePacket packet) { for (BlockChangeRecord record : packet.getRecords()) { ChunkUtils.updateBlock(session, record.getBlock(), record.getPosition()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java index f6eb375e6..1cdc09a75 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java @@ -49,7 +49,7 @@ import org.geysermc.connector.utils.LocaleUtils; public class JavaNotifyClientTranslator extends PacketTranslator { @Override - public void translate(ServerNotifyClientPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerNotifyClientPacket packet) { PlayerEntity entity = session.getPlayerEntity(); switch (packet.getNotification()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java index ec7adc034..f5ae7ff07 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java @@ -44,7 +44,7 @@ import org.geysermc.connector.registry.type.SoundMapping; public class JavaPlayBuiltinSoundTranslator extends PacketTranslator { @Override - public void translate(ServerPlayBuiltinSoundPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayBuiltinSoundPacket packet) { String packetSound = packet.getSound().getName(); SoundMapping soundMapping = Registries.SOUNDS.get(packetSound); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java index 4ba1f2d41..aca7a1f93 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java @@ -48,7 +48,7 @@ import java.util.Locale; public class JavaPlayEffectTranslator extends PacketTranslator { @Override - public void translate(ServerPlayEffectPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlayEffectPacket packet) { // Separate case since each RecordEffectData in Java is an individual track in Bedrock if (packet.getEffect() == SoundEffect.RECORD) { RecordEffectData recordEffectData = (RecordEffectData) packet.getData(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java index 8741bf241..1f1ac0d12 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.registry.type.SoundMapping; public class JavaPlaySoundTranslator extends PacketTranslator { @Override - public void translate(ServerPlaySoundPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerPlaySoundPacket packet) { String packetSound; if (packet.getSound() instanceof BuiltinSound) { packetSound = ((BuiltinSound) packet.getSound()).getName(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java index 14f433c92..df17ceada 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java @@ -50,7 +50,7 @@ import java.util.function.Function; public class JavaSpawnParticleTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnParticlePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnParticlePacket packet) { Function particleCreateFunction = createParticle(session, packet.getParticle()); if (particleCreateFunction != null) { if (packet.getAmount() == 0) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java index 7c0a2a0ff..16e507440 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.utils.DimensionUtils; public class JavaSpawnPositionTranslator extends PacketTranslator { @Override - public void translate(ServerSpawnPositionPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerSpawnPositionPacket packet) { SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket(); spawnPositionPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); spawnPositionPacket.setSpawnForced(true); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java index ebcf2234e..93241310f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.registry.type.SoundMapping; public class JavaStopSoundTranslator extends PacketTranslator { @Override - public void translate(ServerStopSoundPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerStopSoundPacket packet) { // Runs if all sounds are stopped if (packet.getSound() == null) { StopSoundPacket stopPacket = new StopSoundPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java index cce48f5cc..8b05d0469 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java @@ -51,7 +51,7 @@ import java.util.List; public class JavaTradeListTranslator extends PacketTranslator { @Override - public void translate(ServerTradeListPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerTradeListPacket packet) { Inventory openInventory = session.getOpenInventory(); if (!(openInventory instanceof MerchantContainer && openInventory.getId() == packet.getWindowId())) { return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java index 6d3efc1cb..3d428327a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java @@ -37,7 +37,7 @@ import java.util.Iterator; public class JavaUnloadChunkTranslator extends PacketTranslator { @Override - public void translate(ServerUnloadChunkPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerUnloadChunkPacket packet) { session.getChunkCache().removeChunk(packet.getX(), packet.getZ()); //Checks if a skull is in an unloaded chunk then removes it diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java index 056e0092d..25c4684b1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java @@ -45,7 +45,7 @@ import org.geysermc.connector.utils.BlockEntityUtils; public class JavaUpdateTileEntityTranslator extends PacketTranslator { @Override - public void translate(ServerUpdateTileEntityPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerUpdateTileEntityPacket packet) { String id = BlockEntityUtils.getBedrockBlockEntityId(packet.getType().name()); if (packet.getNbt().isEmpty()) { // Fixes errors in servers sending empty NBT BlockEntityUtils.updateBlockEntity(session, NbtMap.EMPTY, packet.getPosition()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java index 461d8139d..3564177e1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaUpdateTimeTranslator extends PacketTranslator { @Override - public void translate(ServerUpdateTimePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerUpdateTimePacket packet) { // Bedrock sends a GameRulesChangedPacket if there is no daylight cycle // Java just sends a negative long if there is no daylight cycle long time = packet.getTime(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java index 23dc2dbc5..155af39b6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java @@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdate public class JavaUpdateViewDistanceTranslator extends PacketTranslator { @Override - public void translate(ServerUpdateViewDistancePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerUpdateViewDistancePacket packet) { session.setRenderDistance(packet.getViewDistance()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java index d304e1108..a4ce170bf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java @@ -37,7 +37,7 @@ import com.nukkitx.math.vector.Vector3i; public class JavaUpdateViewPositionTranslator extends PacketTranslator { @Override - public void translate(ServerUpdateViewPositionPacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerUpdateViewPositionPacket packet) { if (!session.isSpawned() && session.getLastChunkPosition() == null) { ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4)); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java index 013c503d0..2f984517c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.Translator; public class JavaVehicleMoveTranslator extends PacketTranslator { @Override - public void translate(ServerVehicleMovePacket packet, GeyserSession session) { + public void translate(GeyserSession session, ServerVehicleMovePacket packet) { Entity entity = session.getRidingVehicleEntity(); if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index d3d5fa67d..b9da1a439 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -31,6 +31,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.JsonNodeType; import com.github.steveice10.mc.auth.service.MsaAuthenticationService; import com.nimbusds.jose.JWSObject; +import com.nimbusds.jose.shaded.json.JSONObject; +import com.nimbusds.jose.shaded.json.JSONValue; import com.nukkitx.network.util.Preconditions; import com.nukkitx.protocol.bedrock.packet.LoginPacket; import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; @@ -49,6 +51,7 @@ import org.geysermc.cumulus.response.SimpleFormResponse; import javax.crypto.SecretKey; import java.io.IOException; +import java.net.URI; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PublicKey; @@ -62,28 +65,49 @@ public class LoginEncryptionUtils { private static boolean HAS_SENT_ENCRYPTION_MESSAGE = false; private static boolean validateChainData(JsonNode data) throws Exception { + if (data.size() != 3) { + return false; + } + ECPublicKey lastKey = null; boolean validChain = false; for (JsonNode node : data) { JWSObject jwt = JWSObject.parse(node.asText()); - if (!validChain) { - validChain = EncryptionUtils.verifyJwt(jwt, EncryptionUtils.getMojangPublicKey()); + // x509 cert is expected in every claim + URI x5u = jwt.getHeader().getX509CertURL(); + if (x5u == null) { + return false; } - if (lastKey != null) { - if (!EncryptionUtils.verifyJwt(jwt, lastKey)) return false; + ECPublicKey expectedKey = EncryptionUtils.generateKey(jwt.getHeader().getX509CertURL().toString()); + // First key is self-signed + if (lastKey == null) { + lastKey = expectedKey; + } else if (!lastKey.equals(expectedKey)) { + return false; } - JsonNode payloadNode = JSON_MAPPER.readTree(jwt.getPayload().toString()); - JsonNode ipkNode = payloadNode.get("identityPublicKey"); - Preconditions.checkState(ipkNode != null && ipkNode.getNodeType() == JsonNodeType.STRING, "identityPublicKey node is missing in chain"); - lastKey = EncryptionUtils.generateKey(ipkNode.asText()); + if (!EncryptionUtils.verifyJwt(jwt, lastKey)) { + return false; + } + + if (lastKey.equals(EncryptionUtils.getMojangPublicKey())) { + validChain = true; + } + + Object payload = JSONValue.parse(jwt.getPayload().toString()); + Preconditions.checkArgument(payload instanceof JSONObject, "Payload is not an object"); + + Object identityPublicKey = ((JSONObject) payload).get("identityPublicKey"); + Preconditions.checkArgument(identityPublicKey instanceof String, "identityPublicKey node is missing in chain"); + lastKey = EncryptionUtils.generateKey((String) identityPublicKey); } + return validChain; } - public static void encryptPlayerConnection(GeyserConnector connector, GeyserSession session, LoginPacket loginPacket) { + public static void encryptPlayerConnection(GeyserSession session, LoginPacket loginPacket) { JsonNode certData; try { certData = JSON_MAPPER.readTree(loginPacket.getChainData().toByteArray()); @@ -96,11 +120,13 @@ public class LoginEncryptionUtils { throw new RuntimeException("Certificate data is not valid"); } - encryptConnectionWithCert(connector, session, loginPacket.getSkinData().toString(), certChainData); + encryptConnectionWithCert(session, loginPacket.getSkinData().toString(), certChainData); } - private static void encryptConnectionWithCert(GeyserConnector connector, GeyserSession session, String clientData, JsonNode certChainData) { + private static void encryptConnectionWithCert(GeyserSession session, String clientData, JsonNode certChainData) { try { + GeyserConnector connector = session.getConnector(); + boolean validChain = validateChainData(certChainData); connector.getLogger().debug(String.format("Is player data valid? %s", validChain)); diff --git a/pom.xml b/pom.xml index f8ab9165f..43baad6ea 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.geysermc geyser-parent - 1.4.1-SNAPSHOT + 1.4.2-SNAPSHOT pom Geyser Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers. From ab2f5b326fe590e09167e8b45b4b165ac06ecd13 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:12:17 -0400 Subject: [PATCH 570/766] Clear chunk on dimension switch This should resolve chunks being leftover in instances such as server switches in proxies. --- .../network/session/cache/ChunkCache.java | 15 ++++++++++++++- .../geysermc/connector/utils/DimensionUtils.java | 1 + .../connector/utils/LoginEncryptionUtils.java | 15 +++++++++++---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java index 4fa746444..4c2d8c36f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java @@ -67,7 +67,7 @@ public class ChunkCache { chunks.put(chunkPosition, geyserColumn); } - public GeyserColumn getChunk(int chunkX, int chunkZ) { + public GeyserColumn getChunk(int chunkX, int chunkZ) { long chunkPosition = MathUtils.chunkPositionToLong(chunkX, chunkZ); return chunks.getOrDefault(chunkPosition, null); } @@ -136,6 +136,19 @@ public class ChunkCache { chunks.remove(chunkPosition); } + /** + * Manually clears all entries in the chunk cache. + * The server is responsible for clearing chunk entries if out of render distance (for example) or switching dimensions, + * but it is the client that must clear chunks in the event of proxy switches. + */ + public void clear() { + if (!cache) { + return; + } + + chunks.clear(); + } + public int getChunkMinY() { return minY >> 4; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index 942220ddb..b9d6ac40e 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -60,6 +60,7 @@ public class DimensionUtils { int bedrockDimension = javaToBedrock(javaDimension); Entity player = session.getPlayerEntity(); + session.getChunkCache().clear(); session.getEntityCache().removeAllEntities(); session.getItemFrameCache().clear(); session.getLecternCache().clear(); diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java index b9da1a439..a189544b7 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java @@ -57,6 +57,7 @@ import java.security.KeyPairGenerator; import java.security.PublicKey; import java.security.interfaces.ECPublicKey; import java.security.spec.ECGenParameterSpec; +import java.util.Iterator; import java.util.UUID; public class LoginEncryptionUtils { @@ -70,8 +71,10 @@ public class LoginEncryptionUtils { } ECPublicKey lastKey = null; - boolean validChain = false; - for (JsonNode node : data) { + boolean mojangSigned = false; + Iterator iterator = data.iterator(); + while (iterator.hasNext()) { + JsonNode node = iterator.next(); JWSObject jwt = JWSObject.parse(node.asText()); // x509 cert is expected in every claim @@ -92,8 +95,12 @@ public class LoginEncryptionUtils { return false; } + if (mojangSigned) { + return !iterator.hasNext(); + } + if (lastKey.equals(EncryptionUtils.getMojangPublicKey())) { - validChain = true; + mojangSigned = true; } Object payload = JSONValue.parse(jwt.getPayload().toString()); @@ -104,7 +111,7 @@ public class LoginEncryptionUtils { lastKey = EncryptionUtils.generateKey((String) identityPublicKey); } - return validChain; + return mojangSigned; } public static void encryptPlayerConnection(GeyserSession session, LoginPacket loginPacket) { From b89cc1aef058af13cc32671a717bd8ba05be579f Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 31 Aug 2021 19:49:55 -0400 Subject: [PATCH 571/766] Refactor lodestones to be more memory efficient - Most importantly, redesign lodestone caches to be per-player. - Redesign lodestone caches with the expectation that a client will never re-request the same value. - Re-use lodestone IDs in a WeakHashMap to be re-used but successfully garbage-collected. --- .../connector/inventory/GeyserItemStack.java | 16 +- .../connector/inventory/Inventory.java | 18 ++- .../network/session/GeyserSession.java | 2 + .../network/session/cache/LodestoneCache.java | 148 ++++++++++++++++++ ...tionTrackingDBClientRequestTranslator.java | 22 ++- .../item/translators/CompassTranslator.java | 47 +----- .../nbt/LodestoneCompassTranslator.java | 55 +++++++ .../connector/utils/DimensionUtils.java | 1 + .../connector/utils/LoadstoneTracker.java | 83 ---------- connector/src/main/resources/mappings | 2 +- 10 files changed, 240 insertions(+), 154 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java delete mode 100644 connector/src/main/java/org/geysermc/connector/utils/LoadstoneTracker.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java b/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java index b80757fbd..c2c17016c 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java @@ -33,6 +33,8 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.registry.type.ItemMapping; +import javax.annotation.Nonnull; + @Data public class GeyserItemStack { public static final GeyserItemStack EMPTY = new GeyserItemStack(0, 0, null); @@ -42,26 +44,18 @@ public class GeyserItemStack { private CompoundTag nbt; private int netId; - public GeyserItemStack(int javaId) { - this(javaId, 1); - } - - public GeyserItemStack(int javaId, int amount) { - this(javaId, amount, null); - } - - public GeyserItemStack(int javaId, int amount, CompoundTag nbt) { + private GeyserItemStack(int javaId, int amount, CompoundTag nbt) { this(javaId, amount, nbt, 1); } - public GeyserItemStack(int javaId, int amount, CompoundTag nbt, int netId) { + private GeyserItemStack(int javaId, int amount, CompoundTag nbt, int netId) { this.javaId = javaId; this.amount = amount; this.nbt = nbt; this.netId = netId; } - public static GeyserItemStack from(ItemStack itemStack) { + public static @Nonnull GeyserItemStack from(ItemStack itemStack) { return itemStack == null ? EMPTY : new GeyserItemStack(itemStack.getId(), itemStack.getAmount(), itemStack.getNbt()); } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java index a40161767..a9c8029a9 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java @@ -26,6 +26,9 @@ package org.geysermc.connector.inventory; import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.opennbt.tag.builtin.ByteTag; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3i; import lombok.Getter; import lombok.NonNull; @@ -93,7 +96,7 @@ public class Inventory { public GeyserItemStack getItem(int slot) { if (slot > this.size) { - GeyserConnector.getInstance().getLogger().debug("Tried to get an item out of bounds! " + this.toString()); + GeyserConnector.getInstance().getLogger().debug("Tried to get an item out of bounds! " + this); return GeyserItemStack.EMPTY; } return items[slot]; @@ -101,12 +104,23 @@ public class Inventory { public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { if (slot > this.size) { - session.getConnector().getLogger().debug("Tried to set an item out of bounds! " + this.toString()); + session.getConnector().getLogger().debug("Tried to set an item out of bounds! " + this); return; } GeyserItemStack oldItem = items[slot]; updateItemNetId(oldItem, newItem, session); items[slot] = newItem; + + // Lodestone caching + if (newItem.getJavaId() == session.getItemMappings().getStoredItems().compass().getJavaId()) { + CompoundTag nbt = newItem.getNbt(); + if (nbt != null) { + Tag lodestoneTag = nbt.get("LodestoneTracked"); + if (lodestoneTag instanceof ByteTag) { + session.getLodestoneCache().cacheInventoryItem(newItem); + } + } + } } protected static void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSession session) { diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 73e0d9c2e..7d500ef20 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -146,6 +146,7 @@ public class GeyserSession implements CommandSender { private EntityCache entityCache; private EntityEffectCache effectCache; private final FormCache formCache; + private final LodestoneCache lodestoneCache; private final PreferencesCache preferencesCache; private final TagCache tagCache; private WorldCache worldCache; @@ -444,6 +445,7 @@ public class GeyserSession implements CommandSender { this.entityCache = new EntityCache(this); this.effectCache = new EntityEffectCache(); this.formCache = new FormCache(this); + this.lodestoneCache = new LodestoneCache(); this.preferencesCache = new PreferencesCache(this); this.tagCache = new TagCache(); this.worldCache = new WorldCache(this); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java new file mode 100644 index 000000000..5ad07bcd2 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.session.cache; + +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.IntTag; +import com.github.steveice10.opennbt.tag.builtin.StringTag; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import org.geysermc.connector.inventory.GeyserItemStack; + +import javax.annotation.Nullable; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * A temporary cache for lodestone information. + * Bedrock requests the lodestone position information separately from the item. + */ +public class LodestoneCache { + /** + * A list of any GeyserItemStacks that are lodestones. Used mainly to minimize Bedrock's "pop-in" effect + * when a new item has been created; instead we can re-use already existing IDs + */ + private final Map activeLodestones = new WeakHashMap<>(); + private final Int2ObjectMap lodestones = new Int2ObjectOpenHashMap<>(); + /** + * An ID to increment for each lodestone + */ + private int id = 1; + + public void cacheInventoryItem(GeyserItemStack itemStack) { + CompoundTag tag = itemStack.getNbt(); + CompoundTag lodestonePos = tag.get("LodestonePos"); + if (lodestonePos == null) { + // invalid + return; + } + + // Get all info needed for tracking + int x = ((IntTag) lodestonePos.get("X")).getValue(); + int y = ((IntTag) lodestonePos.get("Y")).getValue(); + int z = ((IntTag) lodestonePos.get("Z")).getValue(); + String dim = ((StringTag) tag.get("LodestoneDimension")).getValue(); + + for (LodestonePos pos : this.activeLodestones.values()) { + if (pos.equals(x, y, z, dim)) { + this.activeLodestones.put(itemStack, pos); + return; + } + } + + for (Int2ObjectMap.Entry entry : this.lodestones.int2ObjectEntrySet()) { + LodestonePos pos = entry.getValue(); + if (pos.equals(x, y, z, dim)) { + // Use this existing position instead + this.activeLodestones.put(itemStack, pos); + return; + } + } + + this.activeLodestones.put(itemStack, new LodestonePos(id++, x, y, z, dim)); + } + + public int store(CompoundTag tag) { + CompoundTag lodestonePos = tag.get("LodestonePos"); + if (lodestonePos == null) { + // invalid + return 0; + } + + // Get all info needed for tracking + int x = ((IntTag) lodestonePos.get("X")).getValue(); + int y = ((IntTag) lodestonePos.get("Y")).getValue(); + int z = ((IntTag) lodestonePos.get("Z")).getValue(); + String dim = ((StringTag) tag.get("LodestoneDimension")).getValue(); + + for (LodestonePos pos : this.activeLodestones.values()) { + if (pos.equals(x, y, z, dim)) { + // No need to add this into the lodestones map as it should not be re-requested + return pos.id; + } + } + + for (Int2ObjectMap.Entry entry : this.lodestones.int2ObjectEntrySet()) { + if (entry.getValue().equals(x, y, z, dim)) { + // Use this existing position instead + return entry.getIntKey(); + } + } + + // Start at 1 as 0 does not work + this.lodestones.put(id, new LodestonePos(id, x, y, z, dim)); + return id++; + } + + public @Nullable LodestonePos getPos(int id) { + // We should not need to check the activeLodestones map as Bedrock should already be aware of this ID + return this.lodestones.remove(id); + } + + public void clear() { + // Just in case... + this.activeLodestones.clear(); + this.lodestones.clear(); + } + + @Getter + @AllArgsConstructor + @EqualsAndHashCode + public static class LodestonePos { + private final int id; + private final int x; + private final int y; + private final int z; + private final String dimension; + + boolean equals(int x, int y, int z, String dimension) { + return this.x == x && this.y == y && this.z == z && this.dimension.equals(dimension); + } + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index b8f09103d..224e12e3d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -30,24 +30,24 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.LodestoneCache; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.DimensionUtils; -import org.geysermc.connector.utils.LoadstoneTracker; @Translator(packet = PositionTrackingDBClientRequestPacket.class) public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, PositionTrackingDBClientRequestPacket packet) { + System.out.println(packet.toString()); PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket(); broadcastPacket.setTrackingId(packet.getTrackingId()); - // Fetch the stored Loadstone - LoadstoneTracker.LoadstonePos pos = LoadstoneTracker.getPos(packet.getTrackingId()); + // Fetch the stored lodestone + LodestoneCache.LodestonePos pos = session.getLodestoneCache().getPos(packet.getTrackingId()); + System.out.println(pos); // If we don't have data for that ID tell the client its not found if (pos == null) { @@ -58,22 +58,20 @@ public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTran broadcastPacket.setAction(PositionTrackingDBServerBroadcastPacket.Action.UPDATE); - // Build the nbt data for the update + // Build the NBT data for the update NbtMapBuilder builder = NbtMap.builder(); builder.putInt("dim", DimensionUtils.javaToBedrock(pos.getDimension())); - builder.putString("id", String.format("%08X", packet.getTrackingId())); + builder.putString("id", "0x" + String.format("%08X", packet.getTrackingId())); builder.putByte("version", (byte) 1); // Not sure what this is for builder.putByte("status", (byte) 0); // Not sure what this is for // Build the position for the update - IntList posList = new IntArrayList(); - posList.add(pos.getX()); - posList.add(pos.getY()); - posList.add(pos.getZ()); - builder.putList("pos", NbtType.INT, posList); + builder.putList("pos", NbtType.INT, pos.getX(), pos.getY(), pos.getZ()); broadcastPacket.setTag(builder.build()); + System.out.println(broadcastPacket); + session.sendUpstreamPacket(broadcastPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java index e35e5c252..13780ac49 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java @@ -34,7 +34,6 @@ import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.registry.type.ItemMappings; -import org.geysermc.connector.utils.LoadstoneTracker; import java.util.List; import java.util.stream.Collectors; @@ -61,25 +60,7 @@ public class CompassTranslator extends ItemTranslator { if (lodestoneTag instanceof ByteTag) { // Get the fake lodestonecompass entry mapping = mappings.getStoredItems().lodestoneCompass(); - - // Get the loadstone pos - CompoundTag loadstonePos = itemStack.getNbt().get("LodestonePos"); - if (loadstonePos != null) { - // Get all info needed for tracking - int x = ((IntTag) loadstonePos.get("X")).getValue(); - int y = ((IntTag) loadstonePos.get("Y")).getValue(); - int z = ((IntTag) loadstonePos.get("Z")).getValue(); - String dim = ((StringTag) itemStack.getNbt().get("LodestoneDimension")).getValue(); - - // Store the info - int trackID = LoadstoneTracker.store(x, y, z, dim); - - // Set the bedrock tracking id - itemStack.getNbt().put(new IntTag("trackingHandle", trackID)); - } else { - // The loadstone was removed just set the tracking id to 0 - itemStack.getNbt().put(new IntTag("trackingHandle", 0)); - } + // NBT will be translated in nbt/LodestoneCompassTranslator } return super.translateToBedrock(itemStack, mapping, mappings); @@ -87,36 +68,12 @@ public class CompassTranslator extends ItemTranslator { @Override public ItemStack translateToJava(ItemData itemData, ItemMapping mapping, ItemMappings mappings) { - boolean isLoadstone = false; if (mapping.getBedrockIdentifier().equals("minecraft:lodestone_compass")) { // Revert the entry back to the compass mapping = mappings.getStoredItems().compass(); - - isLoadstone = true; } - ItemStack itemStack = super.translateToJava(itemData, mapping, mappings); - - if (isLoadstone) { - // Get the tracking id - int trackingID = ((IntTag) itemStack.getNbt().get("trackingHandle")).getValue(); - - // Fetch the tracking info from the id - LoadstoneTracker.LoadstonePos pos = LoadstoneTracker.getPos(trackingID); - if (pos != null) { - // Build the new NBT data for the fetched tracking info - itemStack.getNbt().put(new StringTag("LodestoneDimension", pos.getDimension())); - - CompoundTag posTag = new CompoundTag("LodestonePos"); - posTag.put(new IntTag("X", pos.getX())); - posTag.put(new IntTag("Y", pos.getY())); - posTag.put(new IntTag("Z", pos.getZ())); - - itemStack.getNbt().put(posTag); - } - } - - return itemStack; + return super.translateToJava(itemData, mapping, mappings); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java new file mode 100644 index 000000000..2696a39cf --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.item.translators.nbt; + +import com.github.steveice10.opennbt.tag.builtin.*; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.ItemRemapper; +import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; +import org.geysermc.connector.registry.type.ItemMapping; + +@ItemRemapper +public class LodestoneCompassTranslator extends NbtItemStackTranslator { + + @Override + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + Tag lodestoneTag = itemTag.get("LodestoneTracked"); + if (lodestoneTag instanceof ByteTag) { + int trackId = session.getLodestoneCache().store(itemTag); + // Set the bedrock tracking id - will return 0 if invalid + itemTag.put(new IntTag("trackingHandle", trackId)); + } + } + + // NBT does not need to be translated from Bedrock Edition to Java Edition. + // translateToJava is called in three places: extra recipe loading, creative menu, and stonecutters + // Lodestone compasses cannot be touched in any of those places. + + @Override + public boolean acceptItem(ItemMapping mapping) { + return mapping.getJavaIdentifier().equals("minecraft:compass"); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index b9d6ac40e..71522423c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -64,6 +64,7 @@ public class DimensionUtils { session.getEntityCache().removeAllEntities(); session.getItemFrameCache().clear(); session.getLecternCache().clear(); + session.getLodestoneCache().clear(); session.getSkullCache().clear(); Vector3f pos = Vector3f.from(0, Short.MAX_VALUE, 0); diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoadstoneTracker.java b/connector/src/main/java/org/geysermc/connector/utils/LoadstoneTracker.java deleted file mode 100644 index bd41c34a3..000000000 --- a/connector/src/main/java/org/geysermc/connector/utils/LoadstoneTracker.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.connector.utils; - -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -public class LoadstoneTracker { - - private static final Int2ObjectMap LOADSTONES = new Int2ObjectOpenHashMap<>(); - - /** - * Store the given coordinates and dimensions - * - * @param x The X position of the Loadstone - * @param y The Y position of the Loadstone - * @param z The Z position of the Loadstone - * @param dim The dimension containing of the Loadstone - * @return The id in the Map - */ - public static int store(int x, int y, int z, String dim) { - LoadstonePos pos = new LoadstonePos(x, y, z, dim); - - if (!LOADSTONES.containsValue(pos)) { - // Start at 1 as 0 seems to not work - LOADSTONES.put(LOADSTONES.size() + 1, pos); - } - - for (Int2ObjectMap.Entry loadstone : LOADSTONES.int2ObjectEntrySet()) { - if (loadstone.getValue().equals(pos)) { - return loadstone.getIntKey(); - } - } - - return 0; - } - - /** - * Get the loadstone data - * - * @param id The ID to get the data for - * @return The stored data - */ - public static LoadstonePos getPos(int id) { - return LOADSTONES.get(id); - } - - @Getter - @AllArgsConstructor - @EqualsAndHashCode - public static class LoadstonePos { - int x; - int y; - int z; - String dimension; - } -} \ No newline at end of file diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 2efdb453e..3a2f75a27 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 2efdb453e4e76992d63824b5c8b551bebec67b71 +Subproject commit 3a2f75a2760923ec1aa7aaf70a2f00d566ef069e From 7fe7dc1d70a0e481f6a896ca76475f43d669dafe Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 31 Aug 2021 19:52:10 -0400 Subject: [PATCH 572/766] Remove debug code --- .../BedrockPositionTrackingDBClientRequestTranslator.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index 224e12e3d..957f99538 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -41,13 +41,11 @@ public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTran @Override public void translate(GeyserSession session, PositionTrackingDBClientRequestPacket packet) { - System.out.println(packet.toString()); PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket(); broadcastPacket.setTrackingId(packet.getTrackingId()); // Fetch the stored lodestone LodestoneCache.LodestonePos pos = session.getLodestoneCache().getPos(packet.getTrackingId()); - System.out.println(pos); // If we don't have data for that ID tell the client its not found if (pos == null) { @@ -70,8 +68,6 @@ public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTran builder.putList("pos", NbtType.INT, pos.getX(), pos.getY(), pos.getZ()); broadcastPacket.setTag(builder.build()); - System.out.println(broadcastPacket); - session.sendUpstreamPacket(broadcastPacket); } } From 0069566803bf14ba2c8116ffc9f2d56da88afcc2 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 31 Aug 2021 19:57:56 -0400 Subject: [PATCH 573/766] Dependency update; re-use Thread.MAX_PRIORITY for Spigot; other network optimizations --- .../geysermc/platform/spigot/GeyserSpigotInjector.java | 3 ++- connector/pom.xml | 4 ++-- .../connector/network/session/GeyserSession.java | 9 ++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java index 14065c52e..5b6e259f5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java @@ -118,7 +118,8 @@ public class GeyserSpigotInjector extends GeyserInjector { initChannel.invoke(childHandler, ch); } }) - .group(new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser Spigot connection thread"))) + // Set to MAX_PRIORITY as MultithreadEventLoopGroup#newDefaultThreadFactory which DefaultEventLoopGroup implements does by default + .group(new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser Spigot connection thread", Thread.MAX_PRIORITY))) .localAddress(LocalAddress.ANY)) .bind() .syncUninterruptibly(); diff --git a/connector/pom.xml b/connector/pom.xml index 6b955ca21..81c9acdf8 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -115,7 +115,7 @@ com.github.CloudburstMC.Protocol bedrock-v448 - 6ce2f6e + 6b48673 compile @@ -169,7 +169,7 @@ com.github.GeyserMC PacketLib - 86c9c38 + 9d4b476 compile diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 7d500ef20..bfa9af7cf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -838,7 +838,7 @@ public class GeyserSession implements CommandSender { // This issue could be mitigated down the line by preventing Bungee from setting compression downstream.setFlag(BuiltinFlags.USE_ONLY_DIRECT_BUFFERS, connector.getPlatformType() == PlatformType.BUNGEECORD); - downstream.connectInternal(connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), true); + downstream.connectInternal(connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress()); internalConnect = true; } catch (Exception e) { e.printStackTrace(); @@ -1237,8 +1237,11 @@ public class GeyserSession implements CommandSender { if (!closed && this.downstream != null) { Channel channel = this.downstream.getChannel(); if (channel == null) { - // Channel is set to null when downstream is disconnected - there is a short window for this to happen - // as downstream doesn't call GeyserSession#disconnect + // Channel is only null before the connection has initialized + connector.getLogger().warning("Tried to send a packet to the Java server too early!"); + if (connector.getConfig().isDebugMode()) { + Thread.dumpStack(); + } return; } From 3be9a76222a57e8a9861530a4174379cc4595b84 Mon Sep 17 00:00:00 2001 From: Luke <32024335+lukeeey@users.noreply.github.com> Date: Wed, 1 Sep 2021 15:33:01 +0100 Subject: [PATCH 574/766] Remove FUNDING.yml as it's not available organization-wide --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 3fdb3cd65..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -open_collective: geysermc \ No newline at end of file From 206368e448d2dfd769bae0f57c923b1acecf496d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 2 Sep 2021 19:42:50 -0400 Subject: [PATCH 575/766] JavaExplosionTranslator: clean up vector usage --- .../java/world/JavaExplosionTranslator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java index 5f913c91f..721e40c8e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java @@ -28,6 +28,7 @@ package org.geysermc.connector.network.translators.java.world; import com.github.steveice10.mc.protocol.data.game.world.block.ExplodedBlockRecord; import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerExplosionPacket; import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; @@ -45,8 +46,8 @@ public class JavaExplosionTranslator extends PacketTranslator= 2.0f ? LevelEventType.PARTICLE_HUGE_EXPLODE : LevelEventType.PARTICLE_EXPLOSION); levelEventPacket.setData(0); - levelEventPacket.setPosition(pos.toFloat()); + levelEventPacket.setPosition(pos); session.sendUpstreamPacket(levelEventPacket); LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); @@ -63,10 +64,10 @@ public class JavaExplosionTranslator extends PacketTranslator 0f || packet.getPushY() > 0f || packet.getPushZ() > 0f) { + if (packet.getPushX() != 0f || packet.getPushY() != 0f || packet.getPushZ() != 0f) { SetEntityMotionPacket motionPacket = new SetEntityMotionPacket(); motionPacket.setRuntimeEntityId(session.getPlayerEntity().getGeyserId()); motionPacket.setMotion(Vector3f.from(packet.getPushX(), packet.getPushY(), packet.getPushZ())); From 64b078801243fadbac529cfc5c4092ac5b105b4f Mon Sep 17 00:00:00 2001 From: Redned Date: Sat, 4 Sep 2021 12:36:09 -0500 Subject: [PATCH 576/766] Use an array for java blocks and replace rarely used map in BlockMappings --- ...BedrockInventoryTransactionTranslator.java | 6 +- .../connector/registry/ArrayRegistry.java | 151 ++++++++++++++++++ .../connector/registry/BlockRegistries.java | 5 +- .../geysermc/connector/registry/Registry.java | 13 +- .../loader/CollisionRegistryLoader.java | 9 +- .../populator/BlockRegistryPopulator.java | 18 ++- .../registry/type/BlockMappings.java | 9 +- 7 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 45135d90c..1f909806b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -232,11 +232,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator= 2 && session.getGameMode() == GameMode.CREATIVE) { // Otherwise insufficient permissions - int blockState = session.getBlockMappings().getJavaBlockState(packet.getBlockRuntimeId()); - String blockName = BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(blockState, ""); - // In the future this can be used for structure blocks too, however not all elements - // are available in each GUI - if (blockName.contains("jigsaw")) { + if (session.getBlockMappings().getJigsawStateIds().contains(packet.getBlockRuntimeId())) { ContainerOpenPacket openPacket = new ContainerOpenPacket(); openPacket.setBlockPosition(packet.getBlockPosition()); openPacket.setId((byte) 1); diff --git a/connector/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java b/connector/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java new file mode 100644 index 000000000..bb97ddb12 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2019-2021 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.connector.registry; + +import org.geysermc.connector.registry.loader.RegistryLoader; + +import javax.annotation.Nullable; +import java.util.function.Supplier; + +/** + * An array registry that stores mappings as an array defined by {@link M}. + * The M represents the value that is to be stored as part of this array. + * + * @param the mapping type + */ +public class ArrayRegistry extends Registry { + + /** + * Creates a new array registry of this class with the given input and + * {@link RegistryLoader}. The input specified is what the registry + * loader needs to take in. + * + * @param input the input + * @param registryLoader the registry loader + */ + protected ArrayRegistry(I input, RegistryLoader registryLoader) { + super(input, registryLoader); + } + + /** + * Returns the value registered by the given index. + * + * @param index the index + * @return the value registered by the given index. + */ + @Nullable + public M get(int index) { + if (index >= this.mappings.length) { + return null; + } + + return this.mappings[index]; + } + + /** + * Returns the value registered by the given index or the default value + * specified if null. + * + * @param index the index + * @param defaultValue the default value + * @return the value registered by the given key or the default value + * specified if null. + */ + public M getOrDefault(int index, M defaultValue) { + M value = this.get(index); + if (value == null) { + return defaultValue; + } + + return value; + } + + /** + * Registers a new value into this registry with the given index. + * + * @param index the index + * @param value the value + * @return a new value into this registry with the given index. + */ + public M register(int index, M value) { + return this.mappings[index] = value; + } + + /** + * Creates a new array registry with the given {@link RegistryLoader} supplier. The + * input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader supplier + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ + public static ArrayRegistry create(Supplier> registryLoader) { + return new ArrayRegistry<>(null, registryLoader.get()); + } + + /** + * Creates a new array registry with the given {@link RegistryLoader} supplier + * and input. + * + * @param input the input + * @param registryLoader the registry loader supplier + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ + public static ArrayRegistry create(I input, Supplier> registryLoader) { + return new ArrayRegistry<>(input, registryLoader.get()); + } + + /** + * Creates a new array registry with the given {@link RegistryLoader}. The + * input type is not specified here, meaning the loader return type is either + * predefined, or the registry is populated at a later point. + * + * @param registryLoader the registry loader + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ + public static ArrayRegistry create(RegistryLoader registryLoader) { + return new ArrayRegistry<>(null, registryLoader); + } + + /** + * Creates a new array registry with the given {@link RegistryLoader} and input. + * + * @param input the input + * @param registryLoader the registry loader + * @param the input type + * @param the returned mappings type + * @return a new registry with the given RegistryLoader supplier + */ + public static ArrayRegistry create(I input, RegistryLoader registryLoader) { + return new ArrayRegistry<>(input, registryLoader); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java index 09069eb5a..275353300 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java @@ -25,7 +25,6 @@ package org.geysermc.connector.registry; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; @@ -52,10 +51,10 @@ public class BlockRegistries { public static final SimpleMappedRegistry JAVA_TO_BEDROCK_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new)); /** - * A mapped registry which stores Java IDs to {@link BlockMapping}, containing miscellaneous information about + * A registry which stores Java IDs to {@link BlockMapping}, containing miscellaneous information about * blocks and their behavior in many cases. */ - public static final MappedRegistry> JAVA_BLOCKS = MappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + public static final ArrayRegistry JAVA_BLOCKS = ArrayRegistry.create(RegistryLoaders.empty(() -> new BlockMapping[] {})); /** * A (bi)mapped registry containing the Java IDs to identifiers. diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registry.java b/connector/src/main/java/org/geysermc/connector/registry/Registry.java index 135e94342..dfa0e3397 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registry.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registry.java @@ -64,7 +64,7 @@ import java.util.function.Consumer; * @param the value being held by the registry */ public abstract class Registry { - protected final M mappings; + protected M mappings; /** * Creates a new instance of this class with the given input and @@ -88,6 +88,17 @@ public abstract class Registry { return this.mappings; } + /** + * Sets the underlying value held by this registry. + * Clears any existing data associated with the previous + * value. + * + * @param mappings the underlying value held by this registry + */ + public void set(M mappings) { + this.mappings = mappings; + } + /** * Registers what is specified in the given * {@link Consumer} into the underlying value. diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java index 049f1d726..49ccfd831 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java @@ -75,12 +75,13 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader blockMap = BlockRegistries.JAVA_BLOCKS.get(); + BlockMapping[] blockMappings = BlockRegistries.JAVA_BLOCKS.get(); // Map of unique collisions to its instance Map collisionInstances = new Object2ObjectOpenHashMap<>(); - for (Int2ObjectMap.Entry entry : blockMap.int2ObjectEntrySet()) { - BlockCollision newCollision = instantiateCollision(entry.getValue(), annotationMap, collisionList); + for (int i = 0; i < blockMappings.length; i++) { + BlockMapping blockMapping = blockMappings[i]; + BlockCollision newCollision = instantiateCollision(blockMapping, annotationMap, collisionList); if (newCollision != null) { // If there's an existing instance equal to this one, use that instead @@ -92,7 +93,7 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader stateMapper = STATE_MAPPER.getOrDefault(palette.getKey(), (i, s) -> null); IntList javaToBedrockBlockMap = new IntArrayList(); - Int2IntMap bedrockToJavaBlockMap = new Int2IntOpenHashMap(); Map flowerPotBlocks = new Object2ObjectOpenHashMap<>(); Object2IntMap itemFrames = new Object2IntOpenHashMap<>(); + IntSet jigsawStateIds = new IntOpenHashSet(); + BlockMappings.BlockMappingsBuilder builder = BlockMappings.builder(); while (blocksIterator.hasNext()) { javaRuntimeId++; @@ -169,15 +170,16 @@ public class BlockRegistryPopulator { break; } + if (javaId.contains("jigsaw")) { + jigsawStateIds.add(bedrockRuntimeId); + } + boolean waterlogged = entry.getKey().contains("waterlogged=true") || javaId.contains("minecraft:bubble_column") || javaId.contains("minecraft:kelp") || javaId.contains("seagrass"); if (waterlogged) { - bedrockToJavaBlockMap.putIfAbsent(bedrockRuntimeId | 1 << 31, javaRuntimeId); int finalJavaRuntimeId = javaRuntimeId; BlockRegistries.WATERLOGGED.register(set -> set.add(finalJavaRuntimeId)); - } else { - bedrockToJavaBlockMap.putIfAbsent(bedrockRuntimeId, javaRuntimeId); } String cleanJavaIdentifier = BlockUtils.getCleanIdentifier(entry.getKey()); @@ -221,10 +223,10 @@ public class BlockRegistryPopulator { BlockRegistries.BLOCKS.register(PALETTE_VERSIONS.getInt(palette.getKey()), builder.blockStateVersion(stateVersion) .emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) .javaToBedrockBlockMap(javaToBedrockBlockMap.toIntArray()) - .bedrockToJavaBlockMap(bedrockToJavaBlockMap) .javaIdentifierToBedrockTag(javaIdentifierToBedrockTag) .itemFrames(itemFrames) .flowerPotBlocks(flowerPotBlocks) + .jigsawStateIds(jigsawStateIds) .build()); } } @@ -239,6 +241,8 @@ public class BlockRegistryPopulator { throw new AssertionError("Unable to load Java block mappings", e); } + BlockRegistries.JAVA_BLOCKS.set(new BlockMapping[blocksJson.size()]); // Set array size to number of blockstates + Set cleanIdentifiers = new HashSet<>(); int javaRuntimeId = -1; diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java index 09b3db08e..6fb28d7ab 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java @@ -27,7 +27,7 @@ package org.geysermc.connector.registry.type; import com.nukkitx.nbt.NbtList; import com.nukkitx.nbt.NbtMap; -import it.unimi.dsi.fastutil.ints.Int2IntMap; +import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Builder; import lombok.Value; @@ -46,7 +46,6 @@ public class BlockMappings { ChunkSection emptyChunkSection; int[] javaToBedrockBlockMap; - Int2IntMap bedrockToJavaBlockMap; NbtList bedrockBlockStates; @@ -61,6 +60,8 @@ public class BlockMappings { Object2IntMap itemFrames; Map flowerPotBlocks; + IntSet jigsawStateIds; + public int getBedrockBlockId(int state) { if (state >= this.javaToBedrockBlockMap.length) { return bedrockAirId; @@ -68,10 +69,6 @@ public class BlockMappings { return this.javaToBedrockBlockMap[state]; } - public int getJavaBlockState(int bedrockId) { - return this.bedrockToJavaBlockMap.get(bedrockId); - } - public int getItemFrame(NbtMap tag) { return this.itemFrames.getOrDefault(tag, -1); } From 9f77d47f14e6423f17fd71ec3800ccbcd83dd82c Mon Sep 17 00:00:00 2001 From: Redned Date: Sat, 4 Sep 2021 12:45:32 -0500 Subject: [PATCH 577/766] Set int array directly for BlockMappings and change naming --- .../registry/populator/BlockRegistryPopulator.java | 8 +++----- .../geysermc/connector/registry/type/BlockMappings.java | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 724f87165..6de39efab 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -30,8 +30,6 @@ import com.google.common.collect.ImmutableMap; import com.nukkitx.nbt.*; import com.nukkitx.protocol.bedrock.v440.Bedrock_v440; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; @@ -139,7 +137,7 @@ public class BlockRegistryPopulator { BiFunction stateMapper = STATE_MAPPER.getOrDefault(palette.getKey(), (i, s) -> null); - IntList javaToBedrockBlockMap = new IntArrayList(); + int[] javaToBedrockBlocks = new int[BLOCKS_JSON.size()]; Map flowerPotBlocks = new Object2ObjectOpenHashMap<>(); Object2IntMap itemFrames = new Object2IntOpenHashMap<>(); @@ -193,7 +191,7 @@ public class BlockRegistryPopulator { javaIdentifierToBedrockTag.put(cleanJavaIdentifier.intern(), blocksTag.get(bedrockRuntimeId)); } - javaToBedrockBlockMap.add(bedrockRuntimeId); + javaToBedrockBlocks[javaRuntimeId] = bedrockRuntimeId; } if (commandBlockRuntimeId == -1) { @@ -222,7 +220,7 @@ public class BlockRegistryPopulator { BlockRegistries.BLOCKS.register(PALETTE_VERSIONS.getInt(palette.getKey()), builder.blockStateVersion(stateVersion) .emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) - .javaToBedrockBlockMap(javaToBedrockBlockMap.toIntArray()) + .javaToBedrockBlocks(javaToBedrockBlocks) .javaIdentifierToBedrockTag(javaIdentifierToBedrockTag) .itemFrames(itemFrames) .flowerPotBlocks(flowerPotBlocks) diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java index 6fb28d7ab..7cdc91341 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java @@ -45,7 +45,7 @@ public class BlockMappings { ChunkSection emptyChunkSection; - int[] javaToBedrockBlockMap; + int[] javaToBedrockBlocks; NbtList bedrockBlockStates; @@ -63,10 +63,10 @@ public class BlockMappings { IntSet jigsawStateIds; public int getBedrockBlockId(int state) { - if (state >= this.javaToBedrockBlockMap.length) { + if (state >= this.javaToBedrockBlocks.length) { return bedrockAirId; } - return this.javaToBedrockBlockMap[state]; + return this.javaToBedrockBlocks[state]; } public int getItemFrame(NbtMap tag) { From c1e66f306c84bf3385ea8da3472e7d33a0d53e4b Mon Sep 17 00:00:00 2001 From: Redned Date: Sat, 4 Sep 2021 13:52:02 -0500 Subject: [PATCH 578/766] Play sound when totem is used --- .../java/entity/JavaEntityStatusTranslator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java index aaa42d12d..45d801c3d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java @@ -39,6 +39,8 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import java.util.concurrent.ThreadLocalRandom; + @Translator(packet = ServerEntityStatusPacket.class) public class JavaEntityStatusTranslator extends PacketTranslator { @@ -158,6 +160,13 @@ public class JavaEntityStatusTranslator extends PacketTranslator Date: Tue, 7 Sep 2021 11:56:23 -0400 Subject: [PATCH 579/766] Re-use patterns in MinecraftTranslationRegistry --- .../java/org/geysermc/connector/GeyserConnector.java | 2 ++ .../network/translators/chat/MessageTranslator.java | 4 ++++ .../chat/MinecraftTranslationRegistry.java | 12 +++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 99ca790ee..234a3b1ca 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -44,6 +44,7 @@ import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.metrics.Metrics; import org.geysermc.connector.network.ConnectorServerEventHandler; import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.network.translators.PacketTranslatorRegistry; @@ -150,6 +151,7 @@ public class GeyserConnector { Registries.init(); ItemTranslator.init(); + MessageTranslator.init(); LocaleUtils.init(); ResourcePack.loadPacks(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index d04ce29d4..7bbf47947 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -270,4 +270,8 @@ public class MessageTranslator { return false; } + + public static void init() { + // no-op + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java index a003fc912..75d488ef1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java @@ -27,11 +27,10 @@ package org.geysermc.connector.network.translators.chat; import net.kyori.adventure.key.Key; import net.kyori.adventure.translation.Translator; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.connector.utils.LocaleUtils; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.text.MessageFormat; import java.util.Locale; import java.util.regex.Matcher; @@ -42,18 +41,21 @@ import java.util.regex.Pattern; * Used in MessageTranslator.java as part of the KyoriPowered/Adventure library */ public class MinecraftTranslationRegistry implements Translator { + private final Pattern stringReplacement = Pattern.compile("%s"); + private final Pattern positionalStringReplacement = Pattern.compile("%([0-9]+)\\$s"); + @Override public @Nonnull Key name() { return Key.key("geyser", "minecraft_translations"); } @Override - public @Nullable MessageFormat translate(@NonNull String key, @NonNull Locale locale) { + public @Nullable MessageFormat translate(@Nonnull String key, @Nonnull Locale locale) { // Get the locale string String localeString = LocaleUtils.getLocaleString(key, locale.toString()); // Replace the `%s` with numbered inserts `{0}` - Pattern p = Pattern.compile("%s"); + Pattern p = stringReplacement; Matcher m = p.matcher(localeString); StringBuffer sb = new StringBuffer(); int i = 0; @@ -63,7 +65,7 @@ public class MinecraftTranslationRegistry implements Translator { m.appendTail(sb); // Replace the `%x$s` with numbered inserts `{x}` - p = Pattern.compile("%([0-9]+)\\$s"); + p = positionalStringReplacement; m = p.matcher(sb.toString()); sb = new StringBuffer(); while (m.find()) { From 95ba2a10ad1eb493949cbcba5dd6c4880519f748 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 8 Sep 2021 10:13:46 -0400 Subject: [PATCH 580/766] Properly error if Microsoft authentication sends an error --- connector/pom.xml | 2 +- .../org/geysermc/connector/network/session/GeyserSession.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 81c9acdf8..e6bb897dd 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -143,7 +143,7 @@ com.github.GeyserMC MCAuthLib - 0e48a094f2 + 6c99331 compile diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index bfa9af7cf..9a9b06393 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -658,7 +658,8 @@ public class GeyserSession implements CommandSender { connectDownstream(); } catch (RequestException e) { if (!(e instanceof AuthPendingException)) { - throw new RuntimeException("Failed to log in with Microsoft code!", e); + connector.getLogger().error("Failed to log in with Microsoft code!", e); + disconnect(e.toString()); } else { // Wait one second before trying again connector.getGeneralThreadPool().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); From 52ad5c37ee9847092dc072db30479324f2e95f6b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 8 Sep 2021 13:46:46 -0400 Subject: [PATCH 581/766] Uncomment MTU in config It doesn't change anything if uncommented and just serves to confuse people. --- connector/src/main/resources/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index c5698ad93..7936425a3 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -193,7 +193,7 @@ enable-proxy-connections: false # The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation. # 1400 is the default. -# mtu: 1400 +mtu: 1400 # Whether to connect directly into the Java server without creating a TCP connection. # This should only be disabled if a plugin that interfaces with packets or the network does not work correctly with Geyser. From 6dd4629fcd4f59dddf0b5bb7e787b026a73bfd10 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 8 Sep 2021 13:59:32 -0400 Subject: [PATCH 582/766] Utilize multiple threads for Bedrock networking if possible --- .../java/org/geysermc/connector/GeyserConnector.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 234a3b1ca..0c9217147 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -34,6 +34,8 @@ import com.nukkitx.network.util.EventLoops; import com.nukkitx.protocol.bedrock.BedrockServer; import io.netty.channel.epoll.Epoll; import io.netty.channel.kqueue.KQueue; +import io.netty.util.NettyRuntime; +import io.netty.util.internal.SystemPropertyUtil; import lombok.Getter; import lombok.Setter; import org.geysermc.common.PlatformType; @@ -233,10 +235,16 @@ public class GeyserConnector { RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu(); logger.debug("Setting MTU to " + config.getMtu()); + Integer bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads"); + if (bedrockThreadCount == null) { + // Copy the code from Netty's default thread count fallback + bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2)); + } + boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol(); bedrockServer = new BedrockServer( new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()), - 1, + bedrockThreadCount, EventLoops.commonGroup(), enableProxyProtocol ); From 1199d5033876a1676cc5fd5ee8868b5bf89fe346 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:24:30 -0400 Subject: [PATCH 583/766] Allow single quotes to appear in translations in chat --- .../network/translators/chat/MinecraftTranslationRegistry.java | 3 ++- .../network/translators/chat/MessageTranslatorTest.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java index 75d488ef1..3f8edc657 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java @@ -74,6 +74,7 @@ public class MinecraftTranslationRegistry implements Translator { } m.appendTail(sb); - return new MessageFormat(sb.toString(), locale); + // replace single quote instances which get lost in MessageFormat otherwise + return new MessageFormat(sb.toString().replace("'", "''"), locale); } } diff --git a/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java b/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java index efa1a8b3d..dd358cc6d 100644 --- a/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java +++ b/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java @@ -57,6 +57,9 @@ public class MessageTranslatorTest { // Disabled due to not having an GeyserConnector instance, hence it fails //messages.put("{\"translate\":\"death.attack.player\",\"with\":[{\"text\":\"rtm516\",\"insertion\":\"rtm516\"},{\"text\":\"*invincible_rt\",\"insertion\":\"*invincible_rt\"}]}", // "rtm516 was slain by *invincible_rt"); + //// Test translation with the ' character (which MessageFormat requires special handling for) + //messages.put("{\"translate\":\"commands.give.success.single\",\"with\":[{\"text\":\"1\"},{\"color\":\"yellow\",\"hoverEvent\":{\"action\":\"show_item\",\"contents\":{\"id\":\"minecraft:player_head\",\"tag\":\"{SkullOwner:\\\"Camotoy\\\"}\"}},\"translate\":\"chat.square_brackets\",\"with\":[{\"extra\":[{\"translate\":\"block.minecraft.player_head.named\",\"with\":[{\"text\":\"Camotoy\"}]}],\"text\":\"\"}]},{\"insertion\":\"DoctorMad9952\",\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/tell DoctorMad9952 \"},\"hoverEvent\":{\"action\":\"show_entity\",\"contents\":{\"type\":\"minecraft:player\",\"id\":\"8d712993-d208-3dac-b4d8-f2ce7e7d2b75\",\"name\":{\"text\":\"DoctorMad9952\"}}},\"extra\":[{\"text\":\"DoctorMad9952\"}],\"text\":\"\"}]}", + // "Gave 1 §r§e[Camotoy's Head]§r to DoctorMad9952"); } @Test From a1bdf6dbdafe0aeb6b27b8ff3501db18292741b8 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 10 Sep 2021 01:42:05 +0200 Subject: [PATCH 584/766] Implemented Floodgate's player transfer plugin message --- .../java/JavaPluginMessageTranslator.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index 15f1f960b..6b49c764b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -28,6 +28,9 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; import com.google.common.base.Charsets; +import com.nukkitx.protocol.bedrock.packet.TransferPacket; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -40,6 +43,8 @@ import java.nio.charset.StandardCharsets; @Translator(packet = ServerPluginMessagePacket.class) public class JavaPluginMessageTranslator extends PacketTranslator { + private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); + @Override public void translate(GeyserSession session, ServerPluginMessagePacket packet) { // The only plugin messages it has to listen for are Floodgate plugin messages @@ -75,6 +80,27 @@ public class JavaPluginMessageTranslator extends PacketTranslator Date: Thu, 9 Sep 2021 21:20:25 -0400 Subject: [PATCH 585/766] Smooth Pistons (#1542) With proper piston collision for players as well. --- .../platform/spigot/GeyserSpigotPlugin.java | 3 + .../spigot/world/GeyserPistonListener.java | 132 +++ .../manager/GeyserSpigot1_12WorldManager.java | 14 +- .../manager/GeyserSpigotWorldManager.java | 6 +- .../connector/entity/FishingHookEntity.java | 2 +- .../network/session/GeyserSession.java | 3 + .../network/session/cache/PistonCache.java | 187 ++++ .../player/BedrockMovePlayerTranslator.java | 14 +- .../translators/collision/BoundingBox.java | 126 ++- .../collision/CollisionManager.java | 168 +++- .../collision/translators/BlockCollision.java | 46 +- .../java/world/JavaBlockValueTranslator.java | 108 +-- .../world/block/BlockStateValues.java | 121 ++- .../world/block/entity/PistonBlockEntity.java | 832 ++++++++++++++++++ .../entity/PistonBlockEntityTranslator.java | 16 +- .../populator/BlockRegistryPopulator.java | 43 + .../connector/registry/type/BlockMapping.java | 6 + .../registry/type/BlockMappings.java | 1 + .../org/geysermc/connector/utils/Axis.java | 50 ++ .../geysermc/connector/utils/BlockUtils.java | 11 + .../geysermc/connector/utils/ChunkUtils.java | 36 +- .../connector/utils/DimensionUtils.java | 1 + .../geysermc/connector/utils/Direction.java | 80 ++ .../connector/utils/PistonBehavior.java | 47 + 24 files changed, 1911 insertions(+), 142 deletions(-) create mode 100644 bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java create mode 100644 connector/src/main/java/org/geysermc/connector/utils/Axis.java create mode 100644 connector/src/main/java/org/geysermc/connector/utils/Direction.java create mode 100644 connector/src/main/java/org/geysermc/connector/utils/PistonBehavior.java diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index d1364826a..4d19de0b3 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -48,6 +48,7 @@ import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.platform.spigot.command.GeyserSpigotCommandExecutor; import org.geysermc.platform.spigot.command.GeyserSpigotCommandManager; import org.geysermc.platform.spigot.command.SpigotCommandSender; +import org.geysermc.platform.spigot.world.GeyserPistonListener; import org.geysermc.platform.spigot.world.GeyserSpigot1_11CraftingListener; import org.geysermc.platform.spigot.world.GeyserSpigotBlockPlaceListener; import org.geysermc.platform.spigot.world.manager.*; @@ -227,6 +228,8 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(connector, this.geyserWorldManager); Bukkit.getServer().getPluginManager().registerEvents(blockPlaceListener, this); + Bukkit.getServer().getPluginManager().registerEvents(new GeyserPistonListener(connector, this.geyserWorldManager), this); + if (isPre1_12) { // Register events needed to send all recipes to the client Bukkit.getServer().getPluginManager().registerEvents(new GeyserSpigot1_11CraftingListener(connector), this); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java new file mode 100644 index 000000000..73d0300ff --- /dev/null +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2019-2021 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.platform.spigot.world; + +import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValueType; +import com.nukkitx.math.vector.Vector3i; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPistonEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.PistonCache; +import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntity; +import org.geysermc.connector.utils.Direction; +import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; + +import java.util.List; + +public class GeyserPistonListener implements Listener { + private final GeyserConnector connector; + private final GeyserSpigotWorldManager worldManager; + + public GeyserPistonListener(GeyserConnector connector, GeyserSpigotWorldManager worldManager) { + this.connector = connector; + this.worldManager = worldManager; + } + + // The handlers' parent class cannot be registered + @EventHandler(priority = EventPriority.MONITOR) + public void onPistonExtend(BlockPistonExtendEvent event) { + onPistonAction(event); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPistonRetract(BlockPistonRetractEvent event) { + onPistonAction(event); + } + + private void onPistonAction(BlockPistonEvent event) { + if (event.isCancelled()) { + return; + } + + World world = event.getBlock().getWorld(); + boolean isExtend = event instanceof BlockPistonExtendEvent; + + Location location = event.getBlock().getLocation(); + Vector3i position = getVector(location); + PistonValueType type = isExtend ? PistonValueType.PUSHING : PistonValueType.PULLING; + boolean sticky = event.isSticky(); + + Object2IntMap attachedBlocks = new Object2IntOpenHashMap<>(); + boolean blocksFilled = false; + + for (GeyserSession session : connector.getPlayers()) { + Player player = Bukkit.getPlayer(session.getPlayerEntity().getUuid()); + if (player == null || !player.getWorld().equals(world)) { + continue; + } + + int dX = Math.abs(location.getBlockX() - player.getLocation().getBlockX()) >> 4; + int dZ = Math.abs(location.getBlockZ() - player.getLocation().getBlockZ()) >> 4; + if ((dX * dX + dZ * dZ) > session.getRenderDistance() * session.getRenderDistance()) { + // Ignore pistons outside the player's render distance + continue; + } + + // Trying to grab the blocks from the world like other platforms would result in the moving piston block + // being returned instead. + if (!blocksFilled) { + // Blocks currently require a player for 1.12, so let's just leech off one player to get all blocks + // and call it a day for the rest of the sessions (mostly to save on execution time) + List blocks = isExtend ? ((BlockPistonExtendEvent) event).getBlocks() : ((BlockPistonRetractEvent) event).getBlocks(); + for (Block block : blocks) { + Location attachedLocation = block.getLocation(); + attachedBlocks.put(getVector(attachedLocation), worldManager.getBlockNetworkId(player, block, + attachedLocation.getBlockX(), attachedLocation.getBlockY(), attachedLocation.getBlockZ())); + } + blocksFilled = true; + } + + int pistonBlockId = worldManager.getBlockNetworkId(player, event.getBlock(), location.getBlockX(), location.getBlockY(), location.getBlockZ()); + // event.getDirection() is unreliable + Direction orientation = BlockStateValues.getPistonOrientation(pistonBlockId); + + session.executeInEventLoop(() -> { + PistonCache pistonCache = session.getPistonCache(); + PistonBlockEntity blockEntity = pistonCache.getPistons().computeIfAbsent(position, pos -> + new PistonBlockEntity(session, position, orientation, sticky, !isExtend)); + blockEntity.setAction(type, attachedBlocks); + }); + } + } + + private Vector3i getVector(Location location) { + return Vector3i.from(location.getX(), location.getY(), location.getZ()); + } +} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java index e32b52f24..6d856edff 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java @@ -66,7 +66,6 @@ public class GeyserSpigot1_12WorldManager extends GeyserSpigotWorldManager { } @Override - @SuppressWarnings("deprecation") public int getBlockAt(GeyserSession session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { @@ -76,12 +75,19 @@ public class GeyserSpigot1_12WorldManager extends GeyserSpigotWorldManager { // Prevent nasty async errors if a player is loading in return BlockStateValues.JAVA_AIR_ID; } + + Block block = player.getWorld().getBlockAt(x, y, z); + return getBlockNetworkId(player, block, x, y, z); + } + + @Override + @SuppressWarnings("deprecation") + public int getBlockNetworkId(Player player, Block block, int x, int y, int z) { // Get block entity storage BlockStorage storage = Via.getManager().getConnectionManager().getConnectedClient(player.getUniqueId()).get(BlockStorage.class); - Block block = player.getWorld().getBlockAt(x, y, z); // Black magic that gets the old block state ID - int blockId = (block.getType().getId() << 4) | (block.getData() & 0xF); - return getLegacyBlock(storage, blockId, x, y, z); + int oldBlockId = (block.getType().getId() << 4) | (block.getData() & 0xF); + return getLegacyBlock(storage, oldBlockId, x, y, z); } /** diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java index be6342172..516cf13dc 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -77,7 +77,11 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { return BlockStateValues.JAVA_AIR_ID; } - return BlockRegistries.JAVA_IDENTIFIERS.getOrDefault(world.getBlockAt(x, y, z).getBlockData().getAsString(), BlockStateValues.JAVA_AIR_ID); + return getBlockNetworkId(bukkitPlayer, world.getBlockAt(x, y, z), x, y, z); + } + + public int getBlockNetworkId(Player player, Block block, int x, int y, int z) { + return BlockRegistries.JAVA_IDENTIFIERS.getOrDefault(block.getBlockData().getAsString(), BlockStateValues.JAVA_AIR_ID); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index e798ad468..91c3d401a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -103,7 +103,7 @@ public class FishingHookEntity extends ThrowableEntity { // TODO Push bounding box out of collision to improve movement collided = true; } - blockCollision.setPosition(null); + blockCollision.reset(); } int waterLevel = BlockStateValues.getWaterLevel(blockID); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 9a9b06393..707fc9717 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -147,6 +147,7 @@ public class GeyserSession implements CommandSender { private EntityEffectCache effectCache; private final FormCache formCache; private final LodestoneCache lodestoneCache; + private final PistonCache pistonCache; private final PreferencesCache preferencesCache; private final TagCache tagCache; private WorldCache worldCache; @@ -446,6 +447,7 @@ public class GeyserSession implements CommandSender { this.effectCache = new EntityEffectCache(); this.formCache = new FormCache(this); this.lodestoneCache = new LodestoneCache(); + this.pistonCache = new PistonCache(this); this.preferencesCache = new PreferencesCache(this); this.tagCache = new TagCache(); this.worldCache = new WorldCache(this); @@ -912,6 +914,7 @@ public class GeyserSession implements CommandSender { */ protected void tick() { try { + pistonCache.tick(); // Check to see if the player's position needs updating - a position update should be sent once every 3 seconds if (spawned && (System.currentTimeMillis() - lastMovementTimestamp) > 3000) { // Recalculate in case something else changed position diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java new file mode 100644 index 000000000..aa929759c --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.session.cache; + +import com.nukkitx.math.vector.Vector3d; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; +import org.geysermc.connector.entity.player.SessionPlayerEntity; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.collision.BoundingBox; +import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntity; +import org.geysermc.connector.utils.Axis; + +import java.util.Map; + +@Getter +public class PistonCache { + @Getter(AccessLevel.PRIVATE) + private final GeyserSession session; + + /** + * Maps the position of a piston to its block entity + */ + private final Map pistons = new Object2ObjectOpenHashMap<>(); + + /** + * Maps the position of a moving block to the piston moving it + * Positions in this map represent the starting position of the block + */ + private final Map movingBlocksMap = new Object2ObjectOpenHashMap<>(); + + private Vector3d playerDisplacement = Vector3d.ZERO; + + @Setter + private Vector3f playerMotion = Vector3f.ZERO; + + /** + * Stores whether a player has/will collide with any moving blocks. + */ + @Setter + private boolean playerCollided = false; + + /** + * Stores whether a player has/will collide with any slime blocks. + * This is used to prevent movement from being corrected when players + * are about to hit a slime block. + */ + @Setter + private boolean playerSlimeCollision = false; + + /** + * Stores whether a player is standing on a honey block. + * This is used to ignore movement from Bedrock to prevent them from + * falling off. + */ + @Setter + private boolean playerAttachedToHoney = false; + + public PistonCache(GeyserSession session) { + this.session = session; + } + + public void tick() { + resetPlayerMovement(); + if (!pistons.isEmpty()) { + pistons.values().forEach(PistonBlockEntity::updateMovement); + sendPlayerMovement(); + sendPlayerMotion(); + // Update blocks after movement, so that players don't get stuck inside blocks + pistons.values().forEach(PistonBlockEntity::updateBlocks); + + pistons.entrySet().removeIf((entry) -> entry.getValue().canBeRemoved()); + + if (pistons.isEmpty() && !movingBlocksMap.isEmpty()) { + session.getConnector().getLogger().error("The moving block map has de-synced!"); + for (Map.Entry entry : movingBlocksMap.entrySet()) { + session.getConnector().getLogger().error("Moving Block at " + entry.getKey() + " was previously owned by the piston at " + entry.getValue().getPosition()); + } + } + } + } + + private void resetPlayerMovement() { + playerDisplacement = Vector3d.ZERO; + playerMotion = Vector3f.ZERO; + playerCollided = false; + playerSlimeCollision = false; + playerAttachedToHoney = false; + } + + private void sendPlayerMovement() { + if (!playerDisplacement.equals(Vector3d.ZERO) && playerMotion.equals(Vector3f.ZERO)) { + SessionPlayerEntity playerEntity = session.getPlayerEntity(); + boolean isOnGround = playerDisplacement.getY() > 0 || playerEntity.isOnGround(); + Vector3d position = session.getCollisionManager().getPlayerBoundingBox().getBottomCenter(); + playerEntity.moveAbsolute(session, position.toFloat(), playerEntity.getRotation(), isOnGround, true); + } + } + + private void sendPlayerMotion() { + if (!playerMotion.equals(Vector3f.ZERO)) { + SessionPlayerEntity playerEntity = session.getPlayerEntity(); + playerEntity.setMotion(playerMotion); + + SetEntityMotionPacket setEntityMotionPacket = new SetEntityMotionPacket(); + setEntityMotionPacket.setRuntimeEntityId(playerEntity.getGeyserId()); + setEntityMotionPacket.setMotion(playerMotion); + session.sendUpstreamPacket(setEntityMotionPacket); + } + } + + /** + * Add to the player's displacement and move the player's bounding box + * The total displacement is capped to a range of -0.51 to 0.51 per tick + * + * @param displacement The displacement to apply to the player's bounding box + */ + public void displacePlayer(Vector3d displacement) { + Vector3d totalDisplacement = playerDisplacement.add(displacement); + // Clamp to range -0.51 to 0.51 + totalDisplacement = totalDisplacement.max(-0.51d, -0.51d, -0.51d).min(0.51d, 0.51d, 0.51d); + + Vector3d delta = totalDisplacement.sub(playerDisplacement); + // Check if the piston is pushing a player into collision + delta = session.getCollisionManager().correctPlayerMovement(delta, true); + + session.getCollisionManager().getPlayerBoundingBox().translate(delta.getX(), delta.getY(), delta.getZ()); + + playerDisplacement = totalDisplacement; + } + + /** + * @param blockPos The block position to test + * @param boundingBox The bounding box that moves + * @param axis The axis to apply the offset + * @param offset The current maximum distance the bounding box can travel + * @return The new maximum distance the bounding box can travel without colliding with the tested moving block + */ + public double computeCollisionOffset(Vector3i blockPos, BoundingBox boundingBox, Axis axis, double offset) { + PistonBlockEntity piston = movingBlocksMap.get(blockPos); + if (piston != null) { + return piston.computeCollisionOffset(blockPos, boundingBox, axis, offset); + } + return offset; + } + + public boolean checkCollision(Vector3i blockPos, BoundingBox boundingBox) { + PistonBlockEntity piston = movingBlocksMap.get(blockPos); + if (piston != null) { + return piston.checkCollision(blockPos, boundingBox); + } + return false; + } + + public void clear() { + pistons.clear(); + movingBlocksMap.clear(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index 6882e6e0c..8645d7a87 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -92,9 +92,9 @@ public class BedrockMovePlayerTranslator extends PacketTranslator 0) { + double min = axis.choose(getMin().add(boxOffset)); + double max = axis.choose(otherBoundingBox.getMax()); + if ((min - max) >= -2.0 * CollisionManager.COLLISION_TOLERANCE) { + offset = Math.min(min - max, offset); + } + } else if (offset < 0) { + double min = axis.choose(otherBoundingBox.getMin()); + double max = axis.choose(getMax().add(boxOffset)); + if ((min - max) >= -2.0 * CollisionManager.COLLISION_TOLERANCE) { + offset = Math.max(max - min, offset); + } + } + return offset; + } + + /** + * Get the distance required to move this bounding box to one of otherBoundingBox's sides + * + * @param otherBoundingBox The stationary bounding box + * @param side The side of otherBoundingBox to snap this bounding box to + * @return The distance to move in the direction of {@code side} + */ + public double getIntersectionSize(BoundingBox otherBoundingBox, Direction side) { + switch (side) { + case DOWN: + return getMax().getY() - otherBoundingBox.getMin().getY(); + case UP: + return otherBoundingBox.getMax().getY() - getMin().getY(); + case NORTH: + return getMax().getZ() - otherBoundingBox.getMin().getZ(); + case SOUTH: + return otherBoundingBox.getMax().getZ() - getMin().getZ(); + case WEST: + return getMax().getX() - otherBoundingBox.getMin().getX(); + case EAST: + return otherBoundingBox.getMax().getX() - getMin().getX(); + } + return 0; + } + + @SneakyThrows(CloneNotSupportedException.class) + @Override + public BoundingBox clone() { + BoundingBox clone = (BoundingBox) super.clone(); + clone.middleX = middleX; + clone.middleY = middleY; + clone.middleZ = middleZ; + + clone.sizeX = sizeX; + clone.sizeY = sizeY; + clone.sizeZ = sizeZ; + return clone; + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index 52754f4a4..8ec42d4a9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -31,17 +31,19 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlags; -import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; +import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.PistonCache; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; +import org.geysermc.connector.network.translators.collision.translators.ScaffoldingCollision; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.connector.utils.Axis; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -79,6 +81,14 @@ public class CollisionManager { */ private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.#####", new DecimalFormatSymbols(Locale.ENGLISH)); + private static final double PLAYER_STEP_UP = 0.6; + + /** + * The maximum squared distance between a Bedrock players' movement and our predicted movement before + * the player is teleported to the correct position + */ + private static final double INCORRECT_MOVEMENT_THRESHOLD = 0.08; + public CollisionManager(GeyserSession session) { this.session = session; this.playerBoundingBox = new BoundingBox(0, 0, 0, 0.6, 1.8, 0.6); @@ -119,13 +129,18 @@ public class CollisionManager { /** * Adjust the Bedrock position before sending to the Java server to account for inaccuracies in movement between - * the two versions. + * the two versions. Will also send corrected movement packets back to Bedrock if they collide with pistons. * * @param bedrockPosition the current Bedrock position of the client * @param onGround whether the Bedrock player is on the ground * @return the position to send to the Java server, or null to cancel sending the packet */ public Vector3d adjustBedrockPosition(Vector3f bedrockPosition, boolean onGround) { + PistonCache pistonCache = session.getPistonCache(); + // Bedrock clients tend to fall off of honey blocks, so we need to teleport them to the new position + if (pistonCache.isPlayerAttachedToHoney()) { + return null; + } // We need to parse the float as a string since casting a float to a double causes us to // lose precision and thus, causes players to get stuck when walking near walls double javaY = bedrockPosition.getY() - EntityType.PLAYER.getOffset(); @@ -133,18 +148,33 @@ public class CollisionManager { Vector3d position = Vector3d.from(Double.parseDouble(Float.toString(bedrockPosition.getX())), javaY, Double.parseDouble(Float.toString(bedrockPosition.getZ()))); - updatePlayerBoundingBox(position); - + Vector3d startingPos = playerBoundingBox.getBottomCenter(); + Vector3d movement = position.sub(startingPos); + Vector3d adjustedMovement = correctPlayerMovement(movement, false); + playerBoundingBox.translate(adjustedMovement.getX(), adjustedMovement.getY(), adjustedMovement.getZ()); + playerBoundingBox.translate(pistonCache.getPlayerMotion().getX(), pistonCache.getPlayerMotion().getY(), pistonCache.getPlayerMotion().getZ()); // Correct player position if (!correctPlayerPosition()) { // Cancel the movement if it needs to be cancelled recalculatePosition(); return null; } + // The server can't complain about our movement if we never send it + // TODO get rid of this and handle teleports smoothly + if (pistonCache.isPlayerCollided()) { + return null; + } - position = Vector3d.from(playerBoundingBox.getMiddleX(), - playerBoundingBox.getMiddleY() - (playerBoundingBox.getSizeY() / 2), - playerBoundingBox.getMiddleZ()); + position = playerBoundingBox.getBottomCenter(); + + boolean newOnGround = adjustedMovement.getY() != movement.getY() && movement.getY() < 0 || onGround; + // Send corrected position to Bedrock if they differ by too much to prevent de-syncs + if (onGround != newOnGround || movement.distanceSquared(adjustedMovement) > INCORRECT_MOVEMENT_THRESHOLD) { + PlayerEntity playerEntity = session.getPlayerEntity(); + if (pistonCache.getPlayerMotion().equals(Vector3f.ZERO) && !pistonCache.isPlayerSlimeCollision()) { + playerEntity.moveAbsolute(session, position.toFloat(), playerEntity.getRotation(), newOnGround, true); + } + } if (!onGround) { // Trim the position to prevent rounding errors that make Java think we are clipping into a block @@ -178,17 +208,20 @@ public class CollisionManager { box.getMiddleY() - (box.getSizeY() / 2), box.getMiddleZ()); + // Expand volume by 1 in each direction to include moving blocks + double pistonExpand = session.getPistonCache().getPistons().isEmpty() ? 0 : 1; + // Loop through all blocks that could collide - int minCollisionX = (int) Math.floor(position.getX() - ((box.getSizeX() / 2) + COLLISION_TOLERANCE)); - int maxCollisionX = (int) Math.floor(position.getX() + (box.getSizeX() / 2) + COLLISION_TOLERANCE); + int minCollisionX = (int) Math.floor(position.getX() - ((box.getSizeX() / 2) + COLLISION_TOLERANCE + pistonExpand)); + int maxCollisionX = (int) Math.floor(position.getX() + (box.getSizeX() / 2) + COLLISION_TOLERANCE + pistonExpand); // Y extends 0.5 blocks down because of fence hitboxes - int minCollisionY = (int) Math.floor(position.getY() - 0.5); + int minCollisionY = (int) Math.floor(position.getY() - 0.5 - COLLISION_TOLERANCE - pistonExpand / 2.0); - int maxCollisionY = (int) Math.floor(position.getY() + box.getSizeY()); + int maxCollisionY = (int) Math.floor(position.getY() + box.getSizeY() + pistonExpand); - int minCollisionZ = (int) Math.floor(position.getZ() - ((box.getSizeZ() / 2) + COLLISION_TOLERANCE)); - int maxCollisionZ = (int) Math.floor(position.getZ() + (box.getSizeZ() / 2) + COLLISION_TOLERANCE); + int minCollisionZ = (int) Math.floor(position.getZ() - ((box.getSizeZ() / 2) + COLLISION_TOLERANCE + pistonExpand)); + int maxCollisionZ = (int) Math.floor(position.getZ() + (box.getSizeZ() / 2) + COLLISION_TOLERANCE + pistonExpand); for (int y = minCollisionY; y < maxCollisionY + 1; y++) { for (int x = minCollisionX; x < maxCollisionX + 1; x++) { @@ -223,7 +256,7 @@ public class CollisionManager { BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); if (blockCollision != null) { blockCollision.beforeCorrectPosition(playerBoundingBox); - blockCollision.setPosition(null); + blockCollision.reset(); } } @@ -234,7 +267,7 @@ public class CollisionManager { if (!blockCollision.correctPosition(session, playerBoundingBox)) { return false; } - blockCollision.setPosition(null); + blockCollision.reset(); } } @@ -243,6 +276,106 @@ public class CollisionManager { return true; } + public Vector3d correctPlayerMovement(Vector3d movement, boolean checkWorld) { + if (!checkWorld && session.getPistonCache().getPistons().isEmpty()) { // There is nothing to check + return movement; + } + return correctMovement(movement, playerBoundingBox, session.getPlayerEntity().isOnGround(), PLAYER_STEP_UP, checkWorld); + } + + public Vector3d correctMovement(Vector3d movement, BoundingBox boundingBox, boolean onGround, double stepUp, boolean checkWorld) { + Vector3d adjustedMovement = movement; + if (!movement.equals(Vector3d.ZERO)) { + adjustedMovement = correctMovementForCollisions(movement, boundingBox, checkWorld); + } + + boolean verticalCollision = adjustedMovement.getY() != movement.getY(); + boolean horizontalCollision = adjustedMovement.getX() != movement.getX() || adjustedMovement.getZ() != movement.getZ(); + boolean falling = movement.getY() < 0; + onGround = onGround || (verticalCollision && falling); + if (onGround && horizontalCollision) { + Vector3d horizontalMovement = Vector3d.from(movement.getX(), 0, movement.getZ()); + Vector3d stepUpMovement = correctMovementForCollisions(horizontalMovement.up(stepUp), boundingBox, checkWorld); + + BoundingBox stretchedBoundingBox = boundingBox.clone(); + stretchedBoundingBox.extend(horizontalMovement); + double maxStepUp = correctMovementForCollisions(Vector3d.from(0, stepUp, 0), stretchedBoundingBox, checkWorld).getY(); + if (maxStepUp < stepUp) { // The player collided with a block above them + boundingBox.translate(0, maxStepUp, 0); + Vector3d adjustedStepUpMovement = correctMovementForCollisions(horizontalMovement, boundingBox, checkWorld); + boundingBox.translate(0, -maxStepUp, 0); + + if (squaredHorizontalLength(adjustedStepUpMovement) > squaredHorizontalLength(stepUpMovement)) { + stepUpMovement = adjustedStepUpMovement.up(maxStepUp); + } + } + + if (squaredHorizontalLength(stepUpMovement) > squaredHorizontalLength(adjustedMovement)) { + boundingBox.translate(stepUpMovement.getX(), stepUpMovement.getY(), stepUpMovement.getZ()); + // Apply the player's remaining vertical movement + double verticalMovement = correctMovementForCollisions(Vector3d.from(0, movement.getY() - stepUpMovement.getY(), 0), boundingBox, checkWorld).getY(); + boundingBox.translate(-stepUpMovement.getX(), -stepUpMovement.getY(), -stepUpMovement.getZ()); + + stepUpMovement = stepUpMovement.up(verticalMovement); + adjustedMovement = stepUpMovement; + } + } + return adjustedMovement; + } + + private double squaredHorizontalLength(Vector3d vector) { + return vector.getX() * vector.getX() + vector.getZ() * vector.getZ(); + } + + private Vector3d correctMovementForCollisions(Vector3d movement, BoundingBox boundingBox, boolean checkWorld) { + double movementX = movement.getX(); + double movementY = movement.getY(); + double movementZ = movement.getZ(); + + BoundingBox movementBoundingBox = boundingBox.clone(); + movementBoundingBox.extend(movement); + + List collidableBlocks = getCollidableBlocks(movementBoundingBox); + + if (Math.abs(movementY) > CollisionManager.COLLISION_TOLERANCE) { + movementY = computeCollisionOffset(boundingBox, Axis.Y, movementY, collidableBlocks, checkWorld); + boundingBox.translate(0, movementY, 0); + } + boolean checkZFirst = Math.abs(movementZ) > Math.abs(movementX); + if (checkZFirst && Math.abs(movementZ) > CollisionManager.COLLISION_TOLERANCE) { + movementZ = computeCollisionOffset(boundingBox, Axis.Z, movementZ, collidableBlocks, checkWorld); + boundingBox.translate(0, 0, movementZ); + } + if (Math.abs(movementX) > CollisionManager.COLLISION_TOLERANCE) { + movementX = computeCollisionOffset(boundingBox, Axis.X, movementX, collidableBlocks, checkWorld); + boundingBox.translate(movementX, 0, 0); + } + if (!checkZFirst && Math.abs(movementZ) > CollisionManager.COLLISION_TOLERANCE) { + movementZ = computeCollisionOffset(boundingBox, Axis.Z, movementZ, collidableBlocks, checkWorld); + boundingBox.translate(0, 0, movementZ); + } + + boundingBox.translate(-movementX, -movementY, -movementZ); + return Vector3d.from(movementX, movementY, movementZ); + } + + private double computeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset, List collidableBlocks, boolean checkWorld) { + for (Vector3i blockPos : collidableBlocks) { + if (checkWorld) { + BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); + if (blockCollision != null && !(blockCollision instanceof ScaffoldingCollision)) { + offset = blockCollision.computeCollisionOffset(boundingBox, axis, offset); + blockCollision.reset(); + } + } + offset = session.getPistonCache().computeCollisionOffset(blockPos, boundingBox, axis, offset); + if (Math.abs(offset) < COLLISION_TOLERANCE) { + return 0; + } + } + return offset; + } + /** * @return true if the block located at the player's floor position plus 1 would intersect with the player, * were they not sneaking @@ -260,7 +393,8 @@ public class CollisionManager { playerBoundingBox.setSizeY(EntityType.PLAYER.getHeight()); playerBoundingBox.setMiddleY(standingY); boolean result = collision.checkIntersection(playerBoundingBox); - collision.setPosition(null); + result |= session.getPistonCache().checkCollision(position, playerBoundingBox); + collision.reset(); playerBoundingBox.setSizeY(originalHeight); playerBoundingBox.setMiddleY(originalY); return result; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java index 8d1b1b925..0b23973e8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java @@ -30,8 +30,9 @@ import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.CollisionManager; import org.geysermc.connector.network.translators.collision.BoundingBox; +import org.geysermc.connector.network.translators.collision.CollisionManager; +import org.geysermc.connector.utils.Axis; @EqualsAndHashCode public class BlockCollision { @@ -42,6 +43,13 @@ public class BlockCollision { @EqualsAndHashCode.Exclude protected final ThreadLocal position; + /** + * Store a Vector3d to allow the collision to be offset by a fractional amount + * This is used only in {@link #checkIntersection(BoundingBox)} and {@link #computeCollisionOffset(BoundingBox, Axis, double)} + */ + @EqualsAndHashCode.Exclude + protected final ThreadLocal positionOffset; + /** * This is used for the step up logic. * Usually, the player can only step up a block if they are on the same Y level as its bottom face or higher @@ -61,12 +69,22 @@ public class BlockCollision { protected BlockCollision(BoundingBox[] boxes) { this.boundingBoxes = boxes; this.position = new ThreadLocal<>(); + this.positionOffset = new ThreadLocal<>(); } public void setPosition(Vector3i newPosition) { this.position.set(newPosition); } + public void setPositionOffset(Vector3d newOffset) { + this.positionOffset.set(newOffset); + } + + public void reset() { + this.position.set(null); + this.positionOffset.set(null); + } + /** * Overridden in classes like SnowCollision and GrassPathCollision when correction code needs to be run before the * main correction @@ -156,17 +174,33 @@ public class BlockCollision { return true; } - public boolean checkIntersection(BoundingBox playerCollision) { + private Vector3d getFullPos() { Vector3i blockPos = this.position.get(); - int x = blockPos.getX(); - int y = blockPos.getY(); - int z = blockPos.getZ(); + Vector3d blockOffset = this.positionOffset.get(); + if (blockOffset != null && blockOffset != Vector3d.ZERO) { + return blockOffset.add(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + } + return blockPos.toDouble(); + } + public boolean checkIntersection(BoundingBox playerCollision) { + Vector3d blockPos = getFullPos(); for (BoundingBox b : boundingBoxes) { - if (b.checkIntersection(x, y, z, playerCollision)) { + if (b.checkIntersection(blockPos, playerCollision)) { return true; } } return false; } + + public double computeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset) { + Vector3d blockPos = getFullPos(); + for (BoundingBox b : boundingBoxes) { + offset = b.getMaxOffset(blockPos, boundingBox, axis, offset); + if (Math.abs(offset) < CollisionManager.COLLISION_TOLERANCE) { + return 0; + } + } + return offset; + } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java index 892a41070..2f46ed6e6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java @@ -33,13 +33,16 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; +import it.unimi.dsi.fastutil.objects.Object2IntMaps; +import org.geysermc.common.PlatformType; import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.PistonCache; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.network.translators.world.block.entity.NoteblockBlockEntityTranslator; - -import java.util.concurrent.TimeUnit; +import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntity; +import org.geysermc.connector.utils.Direction; @Translator(packet = ServerBlockValuePacket.class) public class JavaBlockValueTranslator extends PacketTranslator { @@ -60,15 +63,41 @@ public class JavaBlockValueTranslator extends PacketTranslator new PistonBlockEntity(session, pos, direction, true, true)); + if (blockEntity.getAction() != action) { + blockEntity.setAction(action, Object2IntMaps.emptyMap()); + } + } } else { - retractPiston(session, position, 1.0f, 1.0f); + PistonBlockEntity blockEntity = pistonCache.getPistons().computeIfAbsent(position, pos -> { + int blockId = session.getConnector().getWorldManager().getBlockAt(session, position); + boolean sticky = BlockStateValues.isStickyPiston(blockId); + boolean extended = action != PistonValueType.PUSHING; + return new PistonBlockEntity(session, pos, direction, sticky, extended); + }); + blockEntity.setAction(action); } } else if (packet.getValue() instanceof MobSpawnerValue) { blockEventPacket.setEventType(1); @@ -111,65 +140,4 @@ public class JavaBlockValueTranslator extends PacketTranslator - extendPiston(session, position, (progress >= 1.0f) ? 1.0f : progress + 0.5f, progress), - 20, TimeUnit.MILLISECONDS); - } - } - - /** - * Emulate a piston retracting. - * @param session GeyserSession - * @param position Block position - * @param progress Current progress of piston - * @param lastProgress Last progress of piston - */ - private void retractPiston(GeyserSession session, Vector3i position, float progress, float lastProgress) { - BlockEntityDataPacket blockEntityDataPacket = new BlockEntityDataPacket(); - blockEntityDataPacket.setBlockPosition(position); - byte state = (byte) ((progress == 0.0f && lastProgress == 0.0f) ? 0 : 3); - blockEntityDataPacket.setData(buildPistonTag(position, progress, lastProgress, state)); - session.sendUpstreamPacket(blockEntityDataPacket); - if (lastProgress != 0.0f) { - session.getConnector().getGeneralThreadPool().schedule(() -> - retractPiston(session, position, (progress <= 0.0f) ? 0.0f : progress - 0.5f, progress), - 20, TimeUnit.MILLISECONDS); - } - } - - /** - * Build a piston tag - * @param position Piston position - * @param progress Current progress of piston - * @param lastProgress Last progress of piston - * @param state - * @return Bedrock CompoundTag of piston - */ - private NbtMap buildPistonTag(Vector3i position, float progress, float lastProgress, byte state) { - NbtMapBuilder builder = NbtMap.builder() - .putInt("x", position.getX()) - .putInt("y", position.getY()) - .putInt("z", position.getZ()) - .putFloat("Progress", progress) - .putFloat("LastProgress", lastProgress) - .putString("id", "PistonArm") - .putByte("NewState", state) - .putByte("State", state); - return builder.build(); - } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java index d66f8592d..2c297613f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java @@ -27,7 +27,12 @@ package org.geysermc.connector.network.translators.world.block; import com.fasterxml.jackson.databind.JsonNode; import it.unimi.dsi.fastutil.ints.*; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.registry.type.BlockMapping; +import org.geysermc.connector.utils.Direction; +import org.geysermc.connector.utils.PistonBehavior; import java.util.Map; import java.util.function.BiFunction; @@ -43,8 +48,12 @@ public class BlockStateValues { private static final Int2ObjectMap FLOWER_POT_VALUES = new Int2ObjectOpenHashMap<>(); private static final Int2BooleanMap LECTERN_BOOK_STATES = new Int2BooleanOpenHashMap(); private static final Int2IntMap NOTEBLOCK_PITCHES = new Int2IntOpenHashMap(); - private static final Int2BooleanMap IS_STICKY_PISTON = new Int2BooleanOpenHashMap(); private static final Int2BooleanMap PISTON_VALUES = new Int2BooleanOpenHashMap(); + private static final Int2BooleanMap IS_STICKY_PISTON = new Int2BooleanOpenHashMap(); + private static final Object2IntMap PISTON_HEADS = new Object2IntOpenHashMap<>(); + private static final Int2ObjectMap PISTON_ORIENTATION = new Int2ObjectOpenHashMap<>(); + private static final IntSet ALL_PISTON_HEADS = new IntOpenHashSet(); + private static final IntSet MOVING_PISTONS = new IntOpenHashSet(); private static final Int2ByteMap SKULL_VARIANTS = new Int2ByteOpenHashMap(); private static final Int2ByteMap SKULL_ROTATIONS = new Int2ByteOpenHashMap(); private static final Int2IntMap SKULL_WALL_DIRECTIONS = new Int2IntOpenHashMap(); @@ -57,6 +66,8 @@ public class BlockStateValues { public static int JAVA_COBWEB_ID; public static int JAVA_FURNACE_ID; public static int JAVA_FURNACE_LIT_ID; + public static int JAVA_HONEY_BLOCK_ID; + public static int JAVA_SLIME_BLOCK_ID; public static int JAVA_SPAWNER_ID; public static int JAVA_WATER_ID; @@ -115,10 +126,20 @@ public class BlockStateValues { return; } - if (javaId.contains("piston")) { - // True if extended, false if not - PISTON_VALUES.put(javaBlockState, javaId.contains("extended=true")); + if (javaId.contains("piston[")) { // minecraft:moving_piston, minecraft:sticky_piston, minecraft:piston + if (javaId.startsWith("minecraft:moving_piston")) { + MOVING_PISTONS.add(javaBlockState); + } else { + PISTON_VALUES.put(javaBlockState, javaId.contains("extended=true")); + } IS_STICKY_PISTON.put(javaBlockState, javaId.contains("sticky")); + PISTON_ORIENTATION.put(javaBlockState, getBlockDirection(javaId)); + return; + } else if (javaId.startsWith("minecraft:piston_head")) { + ALL_PISTON_HEADS.add(javaBlockState); + if (javaId.contains("short=false")) { + PISTON_HEADS.put(getBlockDirection(javaId), javaBlockState); + } return; } @@ -249,6 +270,81 @@ public class BlockStateValues { return IS_STICKY_PISTON.get(blockState); } + public static boolean isPistonHead(int state) { + return ALL_PISTON_HEADS.contains(state); + } + + /** + * Get the Java Block State for a piston head for a specific direction + * This is used in PistonBlockEntity to get the BlockCollision for the piston head. + * + * @param direction Direction the piston head points in + * @return Block state for the piston head + */ + public static int getPistonHead(Direction direction) { + return PISTON_HEADS.getOrDefault(direction, BlockStateValues.JAVA_AIR_ID); + } + + /** + * Check if a block is a minecraft:moving_piston + * This is used in ChunkUtils to prevent them from being placed as it causes + * pistons to flicker and it is not needed + * + * @param state Block state of the block + * @return True if the block is a moving_piston + */ + public static boolean isMovingPiston(int state) { + return MOVING_PISTONS.contains(state); + } + + /** + * This is used in GeyserPistonEvents.java and accepts minecraft:piston, + * minecraft:sticky_piston, and minecraft:moving_piston. + * + * @param state The block state of the piston base + * @return The direction in which the piston faces + */ + public static Direction getPistonOrientation(int state) { + return PISTON_ORIENTATION.get(state); + } + + /** + * Checks if a block sticks to other blocks + * (Slime and honey blocks) + * + * @param state The block state + * @return True if the block sticks to adjacent blocks + */ + public static boolean isBlockSticky(int state) { + return state == JAVA_SLIME_BLOCK_ID || state == JAVA_HONEY_BLOCK_ID; + } + + /** + * Check if two blocks are attached to each other. + * + * @param stateA The block state of block a + * @param stateB The block state of block b + * @return True if the blocks are attached to each other + */ + public static boolean isBlockAttached(int stateA, int stateB) { + boolean aSticky = isBlockSticky(stateA); + boolean bSticky = isBlockSticky(stateB); + if (aSticky && bSticky) { + // Only matching sticky blocks are attached together + // Honey + Honey & Slime + Slime + return stateA == stateB; + } + return aSticky || bSticky; + } + + /** + * @param state The block state of the block + * @return true if a piston can break the block + */ + public static boolean canPistonDestroyBlock(int state) { + return BlockRegistries.JAVA_BLOCKS.getOrDefault(state, BlockMapping.AIR).getPistonBehavior() == PistonBehavior.DESTROY; + } + /** * Skull variations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. * This gives a byte variant ID that Bedrock can use. @@ -323,4 +419,21 @@ public class BlockStateValues { } return 0.6f; } + + private static Direction getBlockDirection(String javaId) { + if (javaId.contains("down")) { + return Direction.DOWN; + } else if (javaId.contains("up")) { + return Direction.UP; + } else if (javaId.contains("south")) { + return Direction.SOUTH; + } else if (javaId.contains("west")) { + return Direction.WEST; + } else if (javaId.contains("north")) { + return Direction.NORTH; + } else if (javaId.contains("east")) { + return Direction.EAST; + } + throw new IllegalStateException(); + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java new file mode 100644 index 000000000..99d9da30d --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java @@ -0,0 +1,832 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.world.block.entity; + +import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValueType; +import com.nukkitx.math.vector.Vector3d; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.nbt.NbtMap; +import com.nukkitx.nbt.NbtMapBuilder; +import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.Getter; +import org.geysermc.common.PlatformType; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.PistonCache; +import org.geysermc.connector.network.translators.collision.BoundingBox; +import org.geysermc.connector.network.translators.collision.CollisionManager; +import org.geysermc.connector.network.translators.collision.translators.BlockCollision; +import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.registry.Registries; +import org.geysermc.connector.registry.type.BlockMapping; +import org.geysermc.connector.utils.*; + +import java.util.LinkedList; +import java.util.Map; +import java.util.Queue; +import java.util.Set; + +public class PistonBlockEntity { + private final GeyserSession session; + @Getter + private final Vector3i position; + private final Direction orientation; + private final boolean sticky; + + @Getter + private PistonValueType action; + + /** + * A map of attached block positions to Java ids. + */ + private final Object2IntMap attachedBlocks = new Object2IntOpenHashMap<>(); + /** + * A flattened array of the positions of attached blocks, stored in XYZ order. + */ + private int[] flattenedAttachedBlocks = new int[0]; + + private boolean placedFinalBlocks = true; + + /** + * The position of the piston head + */ + private float progress; + private float lastProgress; + + private long timeSinceCompletion = 0; + + private static final BoundingBox SOLID_BOUNDING_BOX = new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1); + private static final BoundingBox HONEY_BOUNDING_BOX; + + /** + * The number of ticks to wait after a piston finishes its movement before + * it can be removed + */ + private static final int REMOVAL_DELAY = 5; + + static { + // Create a ~1 x ~0.5 x ~1 bounding box above the honey block + BlockCollision blockCollision = Registries.COLLISIONS.get(BlockStateValues.JAVA_HONEY_BLOCK_ID); + if (blockCollision == null) { + throw new RuntimeException("Failed to find honey block collision"); + } + BoundingBox blockBoundingBox = blockCollision.getBoundingBoxes()[0]; + + double honeyHeight = blockBoundingBox.getMax().getY(); + double boundingBoxHeight = 1.5 - honeyHeight; + HONEY_BOUNDING_BOX = new BoundingBox(0.5, honeyHeight + boundingBoxHeight / 2, 0.5, blockBoundingBox.getSizeX(), boundingBoxHeight, blockBoundingBox.getSizeZ()); + } + + public PistonBlockEntity(GeyserSession session, Vector3i position, Direction orientation, boolean sticky, boolean extended) { + this.session = session; + this.position = position; + this.orientation = orientation; + this.sticky = sticky; + + if (extended) { + // Fully extended + this.action = PistonValueType.PUSHING; + this.progress = 1.0f; + } else { + // Fully retracted + this.action = PistonValueType.PULLING; + this.progress = 0.0f; + } + this.lastProgress = this.progress; + } + + /** + * Set whether the piston is pulling or pushing blocks + * + * @param action PULLING or PUSHING or CANCELED_MID_PUSH + */ + public void setAction(PistonValueType action) { + if (this.action == action) { + return; + } + placeFinalBlocks(); + removeMovingBlocks(); + + this.action = action; + if (action == PistonValueType.PUSHING || (action == PistonValueType.PULLING && sticky)) { + // Blocks only move when pushing or pulling with sticky pistons + findAffectedBlocks(); + removeBlocks(); + createMovingBlocks(); + } else { + removePistonHead(); + } + placedFinalBlocks = false; + + // Set progress and lastProgress to allow 0 tick pistons to animate + switch (action) { + case PUSHING: + progress = 0; + break; + case PULLING: + case CANCELLED_MID_PUSH: + progress = 1; + break; + } + lastProgress = progress; + + BlockEntityUtils.updateBlockEntity(session, buildPistonTag(), position); + } + + public void setAction(PistonValueType action, Object2IntMap attachedBlocks) { + // Don't check if this.action == action, since on some Paper versions BlockPistonRetractEvent is called multiple times + // with the first 1-2 events being empty. + placeFinalBlocks(); + removeMovingBlocks(); + + this.action = action; + if (action == PistonValueType.PUSHING || (action == PistonValueType.PULLING && sticky)) { + // Blocks only move when pushing or pulling with sticky pistons + if (attachedBlocks.size() <= 12) { + this.attachedBlocks.putAll(attachedBlocks); + flattenPositions(); + } + removeBlocks(); + createMovingBlocks(); + } else { + removePistonHead(); + } + placedFinalBlocks = false; + + // Set progress and lastProgress to allow 0 tick pistons to animate + switch (action) { + case PUSHING: + progress = 0; + break; + case PULLING: + case CANCELLED_MID_PUSH: + progress = 1; + break; + } + lastProgress = progress; + + BlockEntityUtils.updateBlockEntity(session, buildPistonTag(), position); + } + + /** + * Update the position of the piston head, moving blocks, and players. + */ + public void updateMovement() { + if (isDone()) { + timeSinceCompletion++; + return; + } else { + timeSinceCompletion = 0; + } + updateProgress(); + pushPlayer(); + BlockEntityUtils.updateBlockEntity(session, buildPistonTag(), position); + } + + /** + * Place attached blocks in their final position when done pushing or pulling + */ + public void updateBlocks() { + if (isDone()) { + // Update blocks only once + if (timeSinceCompletion == 0) { + placeFinalBlocks(); + } + // Give a few ticks for player collisions to be fully resolved + if (timeSinceCompletion >= REMOVAL_DELAY) { + removeMovingBlocks(); + } + } + } + + private void removePistonHead() { + Vector3i blockInFront = position.add(orientation.getUnitVector()); + int blockId = session.getConnector().getWorldManager().getBlockAt(session, blockInFront); + if (BlockStateValues.isPistonHead(blockId)) { + ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, blockInFront); + } else if (session.getConnector().getPlatformType() == PlatformType.SPIGOT && blockId == BlockStateValues.JAVA_AIR_ID) { + // Spigot removes the piston head from the cache, but we need to send the block update ourselves + ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, blockInFront); + } + } + + /** + * Find the blocks that will be pushed or pulled by the piston + */ + private void findAffectedBlocks() { + Set blocksChecked = new ObjectOpenHashSet<>(); + Queue blocksToCheck = new LinkedList<>(); + + Vector3i directionOffset = orientation.getUnitVector(); + Vector3i movement = getMovement(); + blocksChecked.add(position); // Don't check the piston itself + if (action == PistonValueType.PULLING) { + blocksChecked.add(getPistonHeadPos()); // Don't check the piston head + blocksToCheck.add(position.add(directionOffset.mul(2))); + } else if (action == PistonValueType.PUSHING) { + removePistonHead(); // Remove lingering piston heads + blocksToCheck.add(position.add(directionOffset)); + } + + boolean moveBlocks = true; + while (!blocksToCheck.isEmpty() && attachedBlocks.size() <= 12) { + Vector3i blockPos = blocksToCheck.remove(); + // Skip blocks we've already checked + if (!blocksChecked.add(blockPos)) { + continue; + } + int blockId = session.getConnector().getWorldManager().getBlockAt(session, blockPos); + if (blockId == BlockStateValues.JAVA_AIR_ID) { + continue; + } + if (canMoveBlock(blockId, action == PistonValueType.PUSHING)) { + attachedBlocks.put(blockPos, blockId); + if (BlockStateValues.isBlockSticky(blockId)) { + // For honey blocks and slime blocks check the blocks adjacent to it + for (Direction direction : Direction.VALUES) { + Vector3i offset = direction.getUnitVector(); + // Only check blocks that aren't being pushed by the current block + if (offset.equals(movement)) { + continue; + } + Vector3i adjacentPos = blockPos.add(offset); + // Ignore the piston block itself + if (adjacentPos.equals(position)) { + continue; + } + // Ignore the piston head + if (action == PistonValueType.PULLING && position.add(directionOffset).equals(adjacentPos)) { + continue; + } + int adjacentBlockId = session.getConnector().getWorldManager().getBlockAt(session, adjacentPos); + if (adjacentBlockId != BlockStateValues.JAVA_AIR_ID && BlockStateValues.isBlockAttached(blockId, adjacentBlockId) && canMoveBlock(adjacentBlockId, false)) { + // If it is another slime/honey block we need to check its adjacent blocks + if (BlockStateValues.isBlockSticky(adjacentBlockId)) { + blocksToCheck.add(adjacentPos); + } else { + attachedBlocks.put(adjacentPos, adjacentBlockId); + blocksChecked.add(adjacentPos); + blocksToCheck.add(adjacentPos.add(movement)); + } + } + } + } + // Check next block in line + blocksToCheck.add(blockPos.add(movement)); + } else if (!BlockStateValues.canPistonDestroyBlock(blockId)) { + // Block can't be moved or destroyed, so it blocks all block movement + moveBlocks = false; + break; + } + } + if (!moveBlocks || attachedBlocks.size() > 12) { + attachedBlocks.clear(); + } else { + flattenPositions(); + } + } + + private boolean canMoveBlock(int javaId, boolean isPushing) { + if (javaId == BlockStateValues.JAVA_AIR_ID) { + return true; + } + // Pistons can only be moved if they aren't extended + if (PistonBlockEntityTranslator.isBlock(javaId)) { + return !BlockStateValues.getPistonValues().get(javaId); + } + BlockMapping block = BlockRegistries.JAVA_BLOCKS.getOrDefault(javaId, BlockMapping.AIR); + // Bedrock, End portal frames, etc. can't be moved + if (block.getHardness() == -1.0d) { + return false; + } + switch (block.getPistonBehavior()) { + case BLOCK: + case DESTROY: + return false; + case PUSH_ONLY: // Glazed terracotta can only be pushed + return isPushing; + } + // Pistons can't move block entities + return !block.isBlockEntity(); + } + + /** + * Get the unit vector for the direction of movement + * + * @return The movement of the blocks + */ + private Vector3i getMovement() { + if (action == PistonValueType.PULLING) { + return orientation.reversed().getUnitVector(); + } + return orientation.getUnitVector(); // PUSHING and CANCELLED_MID_PUSH + } + + /** + * Replace all attached blocks with air + */ + private void removeBlocks() { + for (Vector3i blockPos : attachedBlocks.keySet()) { + ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, blockPos); + } + if (action != PistonValueType.PUSHING) { + removePistonHead(); + } + } + + /** + * Push the player + * If the player is pushed, the displacement is added to playerDisplacement in PistonCache + * If the player contacts a slime block, playerMotion in PistonCache is updated + */ + public void pushPlayer() { + Vector3i direction = orientation.getUnitVector(); + double blockMovement = lastProgress; + if (action == PistonValueType.PULLING || action == PistonValueType.CANCELLED_MID_PUSH) { + blockMovement = 1f - lastProgress; + } + + BoundingBox playerBoundingBox = session.getCollisionManager().getPlayerBoundingBox(); + // Shrink the collision in the other axes slightly, to avoid false positives when pressed up against the side of blocks + Vector3d shrink = Vector3i.ONE.sub(direction.abs()).toDouble().mul(CollisionManager.COLLISION_TOLERANCE * 2); + playerBoundingBox.setSizeX(playerBoundingBox.getSizeX() - shrink.getX()); + playerBoundingBox.setSizeY(playerBoundingBox.getSizeY() - shrink.getY()); + playerBoundingBox.setSizeZ(playerBoundingBox.getSizeZ() - shrink.getZ()); + + // Resolve collision with the piston head + int pistonHeadId = BlockStateValues.getPistonHead(orientation); + pushPlayerBlock(pistonHeadId, getPistonHeadPos().toDouble(), blockMovement, playerBoundingBox); + + // Resolve collision with any attached moving blocks, but skip slime blocks + // This prevents players from being launched by slime blocks covered by other blocks + for (Object2IntMap.Entry entry : attachedBlocks.object2IntEntrySet()) { + int blockId = entry.getIntValue(); + if (blockId != BlockStateValues.JAVA_SLIME_BLOCK_ID) { + Vector3d blockPos = entry.getKey().toDouble(); + pushPlayerBlock(blockId, blockPos, blockMovement, playerBoundingBox); + } + } + // Resolve collision with slime blocks + for (Object2IntMap.Entry entry : attachedBlocks.object2IntEntrySet()) { + int blockId = entry.getIntValue(); + if (blockId == BlockStateValues.JAVA_SLIME_BLOCK_ID) { + Vector3d blockPos = entry.getKey().toDouble(); + pushPlayerBlock(blockId, blockPos, blockMovement, playerBoundingBox); + } + } + + // Undo shrink + playerBoundingBox.setSizeX(playerBoundingBox.getSizeX() + shrink.getX()); + playerBoundingBox.setSizeY(playerBoundingBox.getSizeY() + shrink.getY()); + playerBoundingBox.setSizeZ(playerBoundingBox.getSizeZ() + shrink.getZ()); + } + + /** + * Checks if a player is attached to the top of a honey block + * + * @param blockPos The position of the honey block + * @param playerBoundingBox The player's bounding box + * @return True if the player attached, otherwise false + */ + private boolean isPlayerAttached(Vector3d blockPos, BoundingBox playerBoundingBox) { + if (orientation.isVertical()) { + return false; + } + return session.getPlayerEntity().isOnGround() && HONEY_BOUNDING_BOX.checkIntersection(blockPos, playerBoundingBox); + } + + /** + * Launches a player if the player is on the pushing side of the slime block + * + * @param blockPos The position of the slime block + * @param playerPos The player's position + */ + private void applySlimeBlockMotion(Vector3d blockPos, Vector3d playerPos) { + Direction movementDirection = orientation; + // Invert direction when pulling + if (action == PistonValueType.PULLING) { + movementDirection = movementDirection.reversed(); + } + + Vector3f movement = getMovement().toFloat(); + Vector3f motion = session.getPistonCache().getPlayerMotion(); + double motionX = motion.getX(); + double motionY = motion.getY(); + double motionZ = motion.getZ(); + blockPos = blockPos.add(0.5, 0.5, 0.5); // Move to the center of the slime block + switch (movementDirection) { + case DOWN: + if (playerPos.getY() < blockPos.getY()) { + motionY = movement.getY(); + } + break; + case UP: + if (playerPos.getY() > blockPos.getY()) { + motionY = movement.getY(); + } + break; + case NORTH: + if (playerPos.getZ() < blockPos.getZ()) { + motionZ = movement.getZ(); + } + break; + case SOUTH: + if (playerPos.getZ() > blockPos.getZ()) { + motionZ = movement.getZ(); + } + break; + case WEST: + if (playerPos.getX() < blockPos.getX()) { + motionX = movement.getX(); + } + break; + case EAST: + if (playerPos.getX() > blockPos.getX()) { + motionX = movement.getX(); + } + break; + } + session.getPistonCache().setPlayerMotion(Vector3f.from(motionX, motionY, motionZ)); + } + + private double getBlockIntersection(BlockCollision blockCollision, Vector3d blockPos, Vector3d extend, BoundingBox boundingBox, Direction direction) { + Direction oppositeDirection = direction.reversed(); + double maxIntersection = 0; + for (BoundingBox b : blockCollision.getBoundingBoxes()) { + b = b.clone(); + b.extend(extend); + b.translate(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + if (b.checkIntersection(Vector3d.ZERO, boundingBox)) { + double intersection = boundingBox.getIntersectionSize(b, direction); + double oppositeIntersection = boundingBox.getIntersectionSize(b, oppositeDirection); + if (intersection < oppositeIntersection) { + maxIntersection = Math.max(intersection, maxIntersection); + } + } + } + return maxIntersection; + } + + private void pushPlayerBlock(int javaId, Vector3d startingPos, double blockMovement, BoundingBox playerBoundingBox) { + PistonCache pistonCache = session.getPistonCache(); + Vector3d movement = getMovement().toDouble(); + // Check if the player collides with the movingBlock block entity + Vector3d finalBlockPos = startingPos.add(movement); + if (SOLID_BOUNDING_BOX.checkIntersection(finalBlockPos, playerBoundingBox)) { + pistonCache.setPlayerCollided(true); + + if (javaId == BlockStateValues.JAVA_SLIME_BLOCK_ID) { + pistonCache.setPlayerSlimeCollision(true); + applySlimeBlockMotion(finalBlockPos, Vector3d.from(playerBoundingBox.getMiddleX(), playerBoundingBox.getMiddleY(), playerBoundingBox.getMiddleZ())); + } + } + + Vector3d blockPos = startingPos.add(movement.mul(blockMovement)); + if (javaId == BlockStateValues.JAVA_HONEY_BLOCK_ID && isPlayerAttached(blockPos, playerBoundingBox)) { + pistonCache.setPlayerCollided(true); + pistonCache.setPlayerAttachedToHoney(true); + + double delta = Math.abs(progress - lastProgress); + pistonCache.displacePlayer(movement.mul(delta)); + } else { + // Move the player out of collision + BlockCollision blockCollision = Registries.COLLISIONS.get(javaId); + if (blockCollision != null) { + Vector3d extend = movement.mul(Math.min(1 - blockMovement, 0.5)); + Direction movementDirection = orientation; + if (action == PistonValueType.PULLING) { + movementDirection = orientation.reversed(); + } + + double intersection = getBlockIntersection(blockCollision, blockPos, extend, playerBoundingBox, movementDirection); + if (intersection > 0) { + pistonCache.setPlayerCollided(true); + pistonCache.displacePlayer(movement.mul(intersection + 0.01d)); + + if (javaId == BlockStateValues.JAVA_SLIME_BLOCK_ID) { + pistonCache.setPlayerSlimeCollision(true); + applySlimeBlockMotion(blockPos, Vector3d.from(playerBoundingBox.getMiddleX(), playerBoundingBox.getMiddleY(), playerBoundingBox.getMiddleZ())); + } + } + } + } + } + + private BlockCollision getCollision(Vector3i blockPos) { + int blockId = getAttachedBlockId(blockPos); + if (blockId != BlockStateValues.JAVA_AIR_ID) { + double movementProgress = progress; + if (action == PistonValueType.PULLING || action == PistonValueType.CANCELLED_MID_PUSH) { + movementProgress = 1f - progress; + } + Vector3d offset = getMovement().toDouble().mul(movementProgress); + return BlockUtils.getCollision(blockId, blockPos, offset); + } + return null; + } + + /** + * Compute the maximum movement of a bounding box that won't collide with the moving block attached to this piston + * + * @param blockPos The position of the moving block + * @param boundingBox The bounding box of the moving entity + * @param axis The axis of movement + * @param movement The movement in the axis + * @return The adjusted movement + */ + public double computeCollisionOffset(Vector3i blockPos, BoundingBox boundingBox, Axis axis, double movement) { + BlockCollision blockCollision = getCollision(blockPos); + if (blockCollision != null) { + double adjustedMovement = blockCollision.computeCollisionOffset(boundingBox, axis, movement); + blockCollision.reset(); + if (getAttachedBlockId(blockPos) == BlockStateValues.JAVA_SLIME_BLOCK_ID && adjustedMovement != movement) { + session.getPistonCache().setPlayerSlimeCollision(true); + } + return adjustedMovement; + } + return movement; + } + + public boolean checkCollision(Vector3i blockPos, BoundingBox boundingBox) { + BlockCollision blockCollision = getCollision(blockPos); + if (blockCollision != null) { + boolean result = blockCollision.checkIntersection(boundingBox); + blockCollision.reset(); + return result; + } + return false; + } + + private int getAttachedBlockId(Vector3i blockPos) { + if (blockPos.equals(getPistonHeadPos())) { + return BlockStateValues.getPistonHead(orientation); + } else { + return attachedBlocks.getOrDefault(blockPos, BlockStateValues.JAVA_AIR_ID); + } + } + + /** + * Create moving block entities for each attached block + */ + private void createMovingBlocks() { + // Map the final position of each block to this block entity + Map movingBlockMap = session.getPistonCache().getMovingBlocksMap(); + attachedBlocks.forEach((blockPos, javaId) -> movingBlockMap.put(blockPos, this)); + movingBlockMap.put(getPistonHeadPos(), this); + + Vector3i movement = getMovement(); + BoundingBox playerBoundingBox = session.getCollisionManager().getPlayerBoundingBox().clone(); + if (orientation == Direction.UP) { + // Extend the bounding box down, to catch collisions when the player is falling down + playerBoundingBox.extend(0, -256, 0); + playerBoundingBox.setSizeX(playerBoundingBox.getSizeX() + 0.5); + playerBoundingBox.setSizeZ(playerBoundingBox.getSizeZ() + 0.5); + } + attachedBlocks.forEach((blockPos, javaId) -> { + Vector3i newPos = blockPos.add(movement); + if (SOLID_BOUNDING_BOX.checkIntersection(blockPos.toDouble(), playerBoundingBox) || + SOLID_BOUNDING_BOX.checkIntersection(newPos.toDouble(), playerBoundingBox)) { + session.getPistonCache().setPlayerCollided(true); + if (javaId == BlockStateValues.JAVA_SLIME_BLOCK_ID) { + session.getPistonCache().setPlayerSlimeCollision(true); + } + // Don't place moving blocks that collide with the player + // because of https://bugs.mojang.com/browse/MCPE-96035 + return; + } + // Place a moving block at the new location of the block + UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); + updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); + updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); + updateBlockPacket.setBlockPosition(newPos); + updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockMovingBlockId()); + updateBlockPacket.setDataLayer(0); + session.sendUpstreamPacket(updateBlockPacket); + // Update moving block with correct details + BlockEntityUtils.updateBlockEntity(session, buildMovingBlockTag(newPos, javaId, position), newPos); + }); + } + + /** + * Place blocks that don't collide with the player into their final position + * otherwise the player will fall off the block. + * The Java server will handle updating the blocks that do collide later. + */ + private void placeFinalBlocks() { + // Prevent blocks from being placed multiple times since it is called in + // setAction and updateBlocks + if (placedFinalBlocks) { + return; + } + placedFinalBlocks = true; + Vector3i movement = getMovement(); + attachedBlocks.forEach((blockPos, javaId) -> { + blockPos = blockPos.add(movement); + // Send a final block entity packet to detach blocks + BlockEntityUtils.updateBlockEntity(session, buildMovingBlockTag(blockPos, javaId, Direction.DOWN.getUnitVector()), blockPos); + // Don't place blocks that collide with the player + if (!SOLID_BOUNDING_BOX.checkIntersection(blockPos.toDouble(), session.getCollisionManager().getPlayerBoundingBox())) { + ChunkUtils.updateBlock(session, javaId, blockPos); + } + }); + if (action == PistonValueType.PUSHING) { + Vector3i pistonHeadPos = getPistonHeadPos().add(movement); + if (!SOLID_BOUNDING_BOX.checkIntersection(pistonHeadPos.toDouble(), session.getCollisionManager().getPlayerBoundingBox())) { + ChunkUtils.updateBlock(session, BlockStateValues.getPistonHead(orientation), pistonHeadPos); + } + } + } + + /** + * Remove moving blocks from the piston cache + */ + private void removeMovingBlocks() { + Map movingBlockMap = session.getPistonCache().getMovingBlocksMap(); + attachedBlocks.forEach((blockPos, javaId) -> movingBlockMap.remove(blockPos)); + attachedBlocks.clear(); + movingBlockMap.remove(getPistonHeadPos()); + flattenedAttachedBlocks = new int[0]; + } + + /** + * Flatten the positions of attached blocks into a 1D array + */ + private void flattenPositions() { + flattenedAttachedBlocks = new int[3 * attachedBlocks.size()]; + int i = 0; + for (Vector3i position : attachedBlocks.keySet()) { + flattenedAttachedBlocks[3 * i] = position.getX(); + flattenedAttachedBlocks[3 * i + 1] = position.getY(); + flattenedAttachedBlocks[3 * i + 2] = position.getZ(); + i++; + } + } + + /** + * Get the Bedrock state of the piston + * + * @return 0 - Fully retracted, 1 - Extending, 2 - Fully extended, 3 - Retracting + */ + private byte getState() { + switch (action) { + case PUSHING: + return (byte) (isDone() ? 2 : 1); + case PULLING: + return (byte) (isDone() ? 0 : 3); + default: + if (progress == 1.0f) { + return 2; + } + return (byte) (isDone() ? 0 : 2); + } + } + + /** + * @return The starting position of the piston head + */ + private Vector3i getPistonHeadPos() { + if (action == PistonValueType.PUSHING) { + return position; + } + return position.add(orientation.getUnitVector()); + } + + /** + * Update the progress or position of the piston head + */ + private void updateProgress() { + switch (action) { + case PUSHING: + lastProgress = progress; + progress += 0.5f; + if (progress >= 1.0f) { + progress = 1.0f; + } + break; + case CANCELLED_MID_PUSH: + case PULLING: + lastProgress = progress; + progress -= 0.5f; + if (progress <= 0.0f) { + progress = 0.0f; + } + break; + } + } + + /** + * @return True if the piston has finished its movement, otherwise false + */ + public boolean isDone() { + switch (action) { + case PUSHING: + return progress == 1.0f && lastProgress == 1.0f; + case PULLING: + case CANCELLED_MID_PUSH: + return progress == 0.0f && lastProgress == 0.0f; + } + return true; + } + + public boolean canBeRemoved() { + return isDone() && timeSinceCompletion > REMOVAL_DELAY; + } + + /** + * Create a piston data tag with the data in this block entity + * + * @return A piston data tag + */ + private NbtMap buildPistonTag() { + NbtMapBuilder builder = NbtMap.builder() + .putString("id", "PistonArm") + .putIntArray("AttachedBlocks", flattenedAttachedBlocks) + .putFloat("Progress", progress) + .putFloat("LastProgress", lastProgress) + .putByte("NewState", getState()) + .putByte("State", getState()) + .putByte("Sticky", (byte) (sticky ? 1 : 0)) + .putByte("isMovable", (byte) 0) + .putInt("x", position.getX()) + .putInt("y", position.getY()) + .putInt("z", position.getZ()); + return builder.build(); + } + + /** + * Create a piston data tag that has fully extended/retracted + * + * @param position The position for the base of the piston + * @param extended Whether the piston is extended or retracted + * @param sticky Whether the piston is a sticky piston or a regular piston + * @return A piston data tag for a fully extended/retracted piston + */ + public static NbtMap buildStaticPistonTag(Vector3i position, boolean extended, boolean sticky) { + NbtMapBuilder builder = NbtMap.builder() + .putString("id", "PistonArm") + .putFloat("Progress", extended ? 1.0f : 0.0f) + .putFloat("LastProgress", extended ? 1.0f : 0.0f) + .putByte("NewState", (byte) (extended ? 2 : 0)) + .putByte("State", (byte) (extended ? 2 : 0)) + .putByte("Sticky", (byte) (sticky ? 1 : 0)) + .putByte("isMovable", (byte) 0) + .putInt("x", position.getX()) + .putInt("y", position.getY()) + .putInt("z", position.getZ()); + return builder.build(); + } + + /** + * Create a moving block tag of a block that will be moved by a piston + * + * @param position The ending position of the block (The location of the movingBlock block entity) + * @param javaId The Java Id of the block that is moving + * @param pistonPosition The position for the base of the piston that's moving the block + * @return A moving block data tag + */ + private NbtMap buildMovingBlockTag(Vector3i position, int javaId, Vector3i pistonPosition) { + // Get Bedrock block state data + NbtMap movingBlock = session.getBlockMappings().getBedrockBlockStates().get(session.getBlockMappings().getBedrockBlockId(javaId)); + NbtMapBuilder builder = NbtMap.builder() + .putString("id", "MovingBlock") + .putCompound("movingBlock", movingBlock) + .putByte("isMovable", (byte) 1) + .putInt("pistonPosX", pistonPosition.getX()) + .putInt("pistonPosY", pistonPosition.getY()) + .putInt("pistonPosZ", pistonPosition.getZ()) + .putInt("x", position.getX()) + .putInt("y", position.getY()) + .putInt("z", position.getZ()); + if (PistonBlockEntityTranslator.isBlock(javaId)) { + builder.putCompound("movingEntity", PistonBlockEntityTranslator.getTag(javaId, position)); + } + return builder.build(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java index f6211703b..e06a60121 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java @@ -27,7 +27,6 @@ package org.geysermc.connector.network.translators.world.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtMapBuilder; import org.geysermc.connector.network.translators.world.block.BlockStateValues; /** @@ -52,19 +51,8 @@ public class PistonBlockEntityTranslator { * @return Bedrock tag of piston. */ public static NbtMap getTag(int blockState, Vector3i position) { - NbtMapBuilder tagBuilder = NbtMap.builder() - .putInt("x", position.getX()) - .putInt("y", position.getY()) - .putInt("z", position.getZ()) - .putByte("isMovable", (byte) 1) - .putString("id", "PistonArm"); - boolean extended = BlockStateValues.getPistonValues().get(blockState); - // 1f if extended, otherwise 0f - tagBuilder.putFloat("Progress", (extended) ? 1.0f : 0.0f); - // 1 if sticky, 0 if not - tagBuilder.putByte("Sticky", (byte) ((BlockStateValues.isStickyPiston(blockState)) ? 1 : 0)); - - return tagBuilder.build(); + boolean sticky = BlockStateValues.isStickyPiston(blockState); + return PistonBlockEntity.buildStaticPistonTag(position, extended, sticky); } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 6de39efab..6393a9c7a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -44,6 +44,7 @@ import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.registry.type.BlockMappings; import org.geysermc.connector.utils.BlockUtils; import org.geysermc.connector.utils.FileUtils; +import org.geysermc.connector.utils.PistonBehavior; import java.io.DataInputStream; import java.io.InputStream; @@ -133,6 +134,7 @@ public class BlockRegistryPopulator { int commandBlockRuntimeId = -1; int javaRuntimeId = -1; int waterRuntimeId = -1; + int movingBlockRuntimeId = -1; Iterator> blocksIterator = BLOCKS_JSON.fields(); BiFunction stateMapper = STATE_MAPPER.getOrDefault(palette.getKey(), (i, s) -> null); @@ -166,6 +168,8 @@ public class BlockRegistryPopulator { case "minecraft:command_block[conditional=false,facing=north]": commandBlockRuntimeId = bedrockRuntimeId; break; + case "minecraft:moving_piston[facing=north,type=normal]": + movingBlockRuntimeId = bedrockRuntimeId; } if (javaId.contains("jigsaw")) { @@ -209,6 +213,11 @@ public class BlockRegistryPopulator { } builder.bedrockAirId(airRuntimeId); + if (movingBlockRuntimeId == -1) { + throw new AssertionError("Unable to find moving block in palette"); + } + builder.bedrockMovingBlockId(movingBlockRuntimeId); + // Loop around again to find all item frame runtime IDs for (Object2IntMap.Entry entry : blockStateOrderedMap.object2IntEntrySet()) { String name = entry.getKey().getString("name"); @@ -248,6 +257,8 @@ public class BlockRegistryPopulator { int cobwebBlockId = -1; int furnaceRuntimeId = -1; int furnaceLitRuntimeId = -1; + int honeyBlockRuntimeId = -1; + int slimeBlockRuntimeId = -1; int spawnerRuntimeId = -1; int uniqueJavaId = -1; int waterRuntimeId = -1; @@ -281,6 +292,24 @@ public class BlockRegistryPopulator { builder.pickItem(pickItemNode.textValue().intern()); } + if (javaId.equals("minecraft:obsidian") || javaId.equals("minecraft:crying_obsidian") || javaId.startsWith("minecraft:respawn_anchor")) { + builder.pistonBehavior(PistonBehavior.BLOCK); + } else { + JsonNode pistonBehaviorNode = entry.getValue().get("piston_behavior"); + if (pistonBehaviorNode != null) { + builder.pistonBehavior(PistonBehavior.getByName(pistonBehaviorNode.textValue())); + } else { + builder.pistonBehavior(PistonBehavior.NORMAL); + } + } + + JsonNode hasBlockEntityNode = entry.getValue().get("has_block_entity"); + if (hasBlockEntityNode != null) { + builder.isBlockEntity(hasBlockEntityNode.booleanValue()); + } else { + builder.isBlockEntity(false); + } + BlockStateValues.storeBlockStateValues(entry.getKey(), javaRuntimeId, entry.getValue()); String cleanJavaIdentifier = BlockUtils.getCleanIdentifier(entry.getKey()); @@ -320,6 +349,10 @@ public class BlockRegistryPopulator { } else if ("minecraft:water[level=0]".equals(javaId)) { waterRuntimeId = javaRuntimeId; + } else if (javaId.equals("minecraft:honey_block")) { + honeyBlockRuntimeId = javaRuntimeId; + } else if (javaId.equals("minecraft:slime_block")) { + slimeBlockRuntimeId = javaRuntimeId; } } if (bellBlockId == -1) { @@ -342,6 +375,16 @@ public class BlockRegistryPopulator { } BlockStateValues.JAVA_FURNACE_LIT_ID = furnaceLitRuntimeId; + if (honeyBlockRuntimeId == -1) { + throw new AssertionError("Unable to find honey block in palette"); + } + BlockStateValues.JAVA_HONEY_BLOCK_ID = honeyBlockRuntimeId; + + if (slimeBlockRuntimeId == -1) { + throw new AssertionError("Unable to find slime block in palette"); + } + BlockStateValues.JAVA_SLIME_BLOCK_ID = slimeBlockRuntimeId; + if (spawnerRuntimeId == -1) { throw new AssertionError("Unable to find spawner in palette"); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java index 1602372b9..f9a074e91 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java @@ -28,7 +28,9 @@ package org.geysermc.connector.registry.type; import lombok.Builder; import lombok.Value; import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.connector.utils.PistonBehavior; +import javax.annotation.Nonnull; import javax.annotation.Nullable; @Builder @@ -51,6 +53,10 @@ public class BlockMapping { int collisionIndex; @Nullable String pickItem; + @Nonnull + PistonBehavior pistonBehavior; + boolean isBlockEntity; + /** * @return the identifier without the additional block states */ diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java index 7cdc91341..0c92d6a4c 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java @@ -40,6 +40,7 @@ import java.util.Map; public class BlockMappings { int bedrockAirId; int bedrockWaterId; + int bedrockMovingBlockId; int blockStateVersion; diff --git a/connector/src/main/java/org/geysermc/connector/utils/Axis.java b/connector/src/main/java/org/geysermc/connector/utils/Axis.java new file mode 100644 index 000000000..4294744be --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/Axis.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils; + +import com.nukkitx.math.vector.Vector3d; + +public enum Axis { + X, Y, Z; + + public static final Axis[] VALUES = values(); + + /** + * @param vector The vector + * @return The component of the vector in this axis + */ + public double choose(Vector3d vector) { + switch (this) { + case X: + return vector.getX(); + case Y: + return vector.getY(); + case Z: + return vector.getZ(); + } + return -1; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index b557f62e5..db2271e5c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -27,6 +27,7 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3i; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.PlayerInventory; @@ -247,6 +248,16 @@ public class BlockUtils { BlockCollision collision = Registries.COLLISIONS.get(blockId); if (collision != null) { collision.setPosition(blockPos); + collision.setPositionOffset(null); + } + return collision; + } + + public static BlockCollision getCollision(int blockId, Vector3i blockPos, Vector3d blockOffset) { + BlockCollision collision = Registries.COLLISIONS.get(blockId); + if (collision != null) { + collision.setPosition(blockPos); + collision.setPositionOffset(blockOffset); } return collision; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 392eb965a..993555a10 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -367,25 +367,29 @@ public class ChunkUtils { skull.despawnEntity(session, position); } - int blockId = session.getBlockMappings().getBedrockBlockId(blockState); + // Prevent moving_piston from being placed + // It's used for extending piston heads, but it isn't needed on Bedrock and causes pistons to flicker + if (!BlockStateValues.isMovingPiston(blockState)) { + int blockId = session.getBlockMappings().getBedrockBlockId(blockState); - UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); - updateBlockPacket.setDataLayer(0); - updateBlockPacket.setBlockPosition(position); - updateBlockPacket.setRuntimeId(blockId); - updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); - updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); - session.sendUpstreamPacket(updateBlockPacket); + UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); + updateBlockPacket.setDataLayer(0); + updateBlockPacket.setBlockPosition(position); + updateBlockPacket.setRuntimeId(blockId); + updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); + updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); + session.sendUpstreamPacket(updateBlockPacket); - UpdateBlockPacket waterPacket = new UpdateBlockPacket(); - waterPacket.setDataLayer(1); - waterPacket.setBlockPosition(position); - if (BlockRegistries.WATERLOGGED.get().contains(blockState)) { - waterPacket.setRuntimeId(session.getBlockMappings().getBedrockWaterId()); - } else { - waterPacket.setRuntimeId(session.getBlockMappings().getBedrockAirId()); + UpdateBlockPacket waterPacket = new UpdateBlockPacket(); + waterPacket.setDataLayer(1); + waterPacket.setBlockPosition(position); + if (BlockRegistries.WATERLOGGED.get().contains(blockState)) { + waterPacket.setRuntimeId(session.getBlockMappings().getBedrockWaterId()); + } else { + waterPacket.setRuntimeId(session.getBlockMappings().getBedrockAirId()); + } + session.sendUpstreamPacket(waterPacket); } - session.sendUpstreamPacket(waterPacket); BlockStateValues.getLecternBookStates().compute(blockState, (key, newLecternHasBook) -> { // Determine if this block is a lectern diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index 71522423c..0e4de64e4 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -65,6 +65,7 @@ public class DimensionUtils { session.getItemFrameCache().clear(); session.getLecternCache().clear(); session.getLodestoneCache().clear(); + session.getPistonCache().clear(); session.getSkullCache().clear(); Vector3f pos = Vector3f.from(0, Short.MAX_VALUE, 0); diff --git a/connector/src/main/java/org/geysermc/connector/utils/Direction.java b/connector/src/main/java/org/geysermc/connector/utils/Direction.java new file mode 100644 index 000000000..7cde4a0ac --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/Direction.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils; + +import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValue; +import com.nukkitx.math.vector.Vector3i; +import lombok.Getter; + +import javax.annotation.Nonnull; + +public enum Direction { + DOWN(1, Vector3i.from(0, -1, 0), Axis.Y, PistonValue.DOWN), + UP(0, Vector3i.UNIT_Y, Axis.Y, PistonValue.UP), + NORTH(3, Vector3i.from(0, 0, -1), Axis.Z, PistonValue.NORTH), + SOUTH(2, Vector3i.UNIT_Z, Axis.Z, PistonValue.SOUTH), + WEST(5, Vector3i.from(-1, 0, 0), Axis.X, PistonValue.WEST), + EAST(4, Vector3i.UNIT_X, Axis.X, PistonValue.EAST); + + public static final Direction[] VALUES = values(); + + private final int reversedId; + @Getter + private final Vector3i unitVector; + @Getter + private final Axis axis; + @Getter + private final PistonValue pistonValue; + + Direction(int reversedId, Vector3i unitVector, Axis axis, PistonValue pistonValue) { + this.reversedId = reversedId; + this.unitVector = unitVector; + this.axis = axis; + this.pistonValue = pistonValue; + } + + public Direction reversed() { + return VALUES[reversedId]; + } + + public boolean isVertical() { + return axis == Axis.Y; + } + + public boolean isHorizontal() { + return axis == Axis.X || axis == Axis.Z; + } + + @Nonnull + public static Direction fromPistonValue(PistonValue pistonValue) { + for (Direction direction : VALUES) { + if (direction.pistonValue == pistonValue) { + return direction; + } + } + throw new IllegalStateException(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/PistonBehavior.java b/connector/src/main/java/org/geysermc/connector/utils/PistonBehavior.java new file mode 100644 index 000000000..67579e2ad --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/PistonBehavior.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils; + +import java.util.Locale; + +public enum PistonBehavior { + NORMAL, + BLOCK, + DESTROY, + PUSH_ONLY; + + public static final PistonBehavior[] VALUES = values(); + + public static PistonBehavior getByName(String name) { + String upperCase = name.toUpperCase(Locale.ROOT); + for (PistonBehavior type : VALUES) { + if (type.name().equals(upperCase)) { + return type; + } + } + return NORMAL; + } +} From f22d286ea1aa45292b4d74f0980db4dffbb392bf Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 9 Sep 2021 21:27:38 -0400 Subject: [PATCH 586/766] Add world border translation (#1839) As Bedrock does not have world border support, this PR translates what the Java server sends us for a world border into particles and fog, while also preventing the Bedrock client from moving outside of the world border. Co-authored-by: Luke <32024335+lukeeey@users.noreply.github.com> Co-authored-by: ofunny --- .../geysermc/connector/entity/BoatEntity.java | 7 + .../network/ConnectorServerEventHandler.java | 4 +- .../network/session/GeyserSession.java | 27 ++ .../network/session/cache/WorldBorder.java | 291 ++++++++++++++++++ ...BedrockInventoryTransactionTranslator.java | 11 + .../BedrockMoveEntityAbsoluteTranslator.java | 18 ++ .../player/BedrockMovePlayerTranslator.java | 4 + .../JavaInitializeBorderTranslator.java | 51 +++ .../border/JavaSetBorderCenterPacket.java | 45 +++ .../JavaSetBorderLerpSizeTranslator.java | 47 +++ .../border/JavaSetBorderSizeTranslator.java | 46 +++ .../JavaSetBorderWarningDelayTranslator.java | 44 +++ ...avaSetBorderWarningDistanceTranslator.java | 44 +++ .../connector/utils/LanguageUtils.java | 37 ++- 14 files changed, 661 insertions(+), 15 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index bc7ad2330..4cc9fea0e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -81,6 +81,13 @@ public class BoatEntity extends Entity { session.sendUpstreamPacket(moveEntityPacket); } + /** + * Move the boat without making the adjustments needed to translate from Java + */ + public void moveAbsoluteWithoutAdjustments(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + super.moveAbsolute(session, position, Vector3f.from(rotation.getX(), 0, rotation.getX()), isOnGround, teleported); + } + @Override public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { super.moveRelative(session, relX, relY, relZ, Vector3f.from(rotation.getX(), 0, rotation.getX()), isOnGround); diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index 35db999ce..94dd0b744 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -88,7 +88,9 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { @Override public BedrockPong onQuery(InetSocketAddress inetSocketAddress) { - connector.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.network.pinged", inetSocketAddress)); + if (connector.getConfig().isDebugMode()) { + connector.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.network.pinged", inetSocketAddress)); + } GeyserConfiguration config = connector.getConfig(); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 707fc9717..cfc877716 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -154,6 +154,12 @@ public class GeyserSession implements CommandSender { private final Int2ObjectMap teleportMap = new Int2ObjectOpenHashMap<>(); + private final WorldBorder worldBorder; + /** + * Whether simulated fog has been sent to the client or not. + */ + private boolean isInWorldBorderWarningArea = false; + private final PlayerInventory playerInventory; @Setter private Inventory openInventory; @@ -452,6 +458,8 @@ public class GeyserSession implements CommandSender { this.tagCache = new TagCache(); this.worldCache = new WorldCache(this); + this.worldBorder = new WorldBorder(this); + this.collisionManager = new CollisionManager(this); this.playerEntity = new SessionPlayerEntity(this); @@ -928,6 +936,25 @@ public class GeyserSession implements CommandSender { lastMovementTimestamp = System.currentTimeMillis(); } + if (worldBorder.isResizing()) { + worldBorder.resize(); + } + + if (!worldBorder.isWithinWarningBoundaries()) { + // Show particles representing where the world border is + worldBorder.drawWall(); + // Set the mood + if (!isInWorldBorderWarningArea) { + isInWorldBorderWarningArea = true; + WorldBorder.sendFog(this, "minecraft:fog_crimson_forest"); + } + } else if (isInWorldBorderWarningArea) { + // Clear fog as we are outside the world border now + WorldBorder.removeFog(this); + isInWorldBorderWarningArea = false; + } + + for (Tickable entity : entityCache.getTickableEntities()) { entity.tick(this); } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java new file mode 100644 index 000000000..d3f8362d7 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.session.cache; + +import com.nukkitx.math.GenericMath; +import com.nukkitx.math.vector.Vector2f; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.LevelEventType; +import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; +import com.nukkitx.protocol.bedrock.packet.PlayerFogPacket; +import lombok.Getter; +import lombok.Setter; +import org.geysermc.connector.entity.player.PlayerEntity; +import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +import javax.annotation.Nonnull; +import java.util.Collections; + +public class WorldBorder { + private static final double DEFAULT_WORLD_BORDER_SIZE = 5.9999968E7D; + + @Getter @Setter + private @Nonnull Vector2f center = Vector2f.ZERO; + /** + * The diameter in blocks of the world border before it got changed or similar to newDiameter if not changed. + */ + @Getter @Setter + private double oldDiameter = DEFAULT_WORLD_BORDER_SIZE; + /** + * The diameter in blocks of the new world border. + */ + @Getter @Setter + private double newDiameter = DEFAULT_WORLD_BORDER_SIZE; + /** + * The speed to apply an expansion/shrinking of the world border. + * When a client joins they get the actual border oldDiameter and the time left to reach the newDiameter. + */ + @Getter @Setter + private long speed = 0; + /** + * The time in seconds before a shrinking world border would hit a not moving player. + * Creates the same visual warning effect as warningBlocks. + */ + @Getter @Setter + private int warningDelay = 15; + /** + * Block length before you reach the border to show warning particles. + */ + @Getter @Setter + private int warningBlocks = 5; + + @Getter + private boolean resizing; + private double currentDiameter; + + /* + * Boundaries of the actual world border. + * (The will get updated on expanding or shrinking) + */ + private double minX = 0.0D; + private double minZ = 0.0D; + private double maxX = 0.0D; + private double maxZ = 0.0D; + + /* + * The boundaries for the for the warning visuals. + */ + private double warningMaxX = 0.0D; + private double warningMaxZ = 0.0D; + private double warningMinX = 0.0D; + private double warningMinZ = 0.0D; + + /** + * To track when to send wall particle packets. + */ + private int currentWallTick; + + /** + * If the world border is resizing, this variable saves how many ticks have progressed in the resizing + */ + private long lastUpdatedWorldBorderTime = 0; + + private final GeyserSession session; + + public WorldBorder(GeyserSession session) { + this.session = session; + } + + /** + * @return true as long the entity is within the world limits. + */ + public boolean isInsideBorderBoundaries() { + Vector3f entityPosition = session.getPlayerEntity().getPosition(); + return entityPosition.getX() > minX && entityPosition.getX() < maxX && entityPosition.getZ() > minZ && entityPosition.getZ() < maxZ; + } + + /** + * Confirms that the entity is within world border boundaries when they move. + * Otherwise, if {@code adjustPosition} is true, this function will push the player back. + * + * @return if this player was indeed against the world border. Will return false if no world border was defined for us. + */ + public boolean isPassingIntoBorderBoundaries(Vector3f newPosition, boolean adjustPosition) { + boolean isInWorldBorder = isPassingIntoBorderBoundaries(newPosition); + if (isInWorldBorder && adjustPosition) { + PlayerEntity playerEntity = session.getPlayerEntity(); + // Move the player back, but allow gravity to take place + // Teleported = true makes going back better, but disconnects the player from their mounted entity + playerEntity.moveAbsolute(session, + Vector3f.from(playerEntity.getPosition().getX(), (newPosition.getY() - EntityType.PLAYER.getOffset()), playerEntity.getPosition().getZ()), + playerEntity.getRotation(), playerEntity.isOnGround(), session.getRidingVehicleEntity() == null); + } + return isInWorldBorder; + } + + public boolean isPassingIntoBorderBoundaries(Vector3f newEntityPosition) { + int entityX = GenericMath.floor(newEntityPosition.getX()); + int entityZ = GenericMath.floor(newEntityPosition.getZ()); + Vector3f currentEntityPosition = session.getPlayerEntity().getPosition(); + // Make sure we can't move out of the world border, but if we're out of the world border, we can move in + return (entityX == (int) minX && currentEntityPosition.getX() > newEntityPosition.getX()) || + (entityX == (int) maxX && currentEntityPosition.getX() < newEntityPosition.getX()) || + (entityZ == (int) minZ && currentEntityPosition.getZ() > newEntityPosition.getZ()) || + (entityZ == (int) maxZ && currentEntityPosition.getZ() < newEntityPosition.getZ()); + } + + /** + * Same as {@link #isInsideBorderBoundaries()} but using the warning boundaries. + * + * @return true as long the entity is within the world limits and not in the warning zone at the edge to the border. + */ + public boolean isWithinWarningBoundaries() { + Vector3f entityPosition = session.getPlayerEntity().getPosition(); + return entityPosition.getX() > warningMinX && entityPosition.getX() < warningMaxX && entityPosition.getZ() > warningMinZ && entityPosition.getZ() < warningMaxZ; + } + + /** + * Updates the world border's minimum and maximum properties + */ + public void update() { + /* + * Setting the correct boundary of our world border's square. + */ + double radius; + if (resizing) { + radius = this.currentDiameter / 2.0D; + } else { + radius = this.newDiameter / 2.0D; + } + this.minX = center.getX() - radius; + this.minZ = center.getY() - radius; // Mapping 2D vector to 3D coordinates >> Y becomes Z + this.maxX = center.getX() + radius; + this.maxZ = center.getY() + radius; // Mapping 2D vector to 3D coordinates >> Y becomes Z + + /* + * Caching the warning boundaries. + */ + this.warningMinX = this.minX + this.warningBlocks; + this.warningMinZ = this.minZ + this.warningBlocks; + this.warningMaxX = this.maxX - this.warningBlocks; + this.warningMaxZ = this.maxZ - this.warningBlocks; + } + + public void resize() { + if (this.lastUpdatedWorldBorderTime >= this.speed) { + // Diameter has now updated to the new diameter + this.resizing = false; + this.lastUpdatedWorldBorderTime = 0; + } else if (resizing) { + this.currentDiameter = this.oldDiameter + ((double) this.lastUpdatedWorldBorderTime / (double) this.speed) * (this.newDiameter - this.oldDiameter); + this.lastUpdatedWorldBorderTime += 50; + } + update(); + } + + public void setResizing(boolean resizing) { + this.resizing = resizing; + if (!resizing) { + this.lastUpdatedWorldBorderTime = 0; + } + } + + private static final LevelEventType WORLD_BORDER_PARTICLE = LevelEventType.PARTICLE_DENY_BLOCK; + + /** + * Draws a wall of particles where the world border resides + */ + public void drawWall() { + if (currentWallTick++ != 20) { + // Only draw a wall once every second + return; + } + currentWallTick = 0; + Vector3f entityPosition = session.getPlayerEntity().getPosition(); + float particlePosX = entityPosition.getX(); + float particlePosY = entityPosition.getY(); + float particlePosZ = entityPosition.getZ(); + + if (entityPosition.getX() > warningMaxX) { + drawWall(Vector3f.from(maxX, particlePosY, particlePosZ), true); + } + if (entityPosition.getX() < warningMinX) { + drawWall(Vector3f.from(minX, particlePosY, particlePosZ), true); + } + if (entityPosition.getZ() > warningMaxZ) { + drawWall(Vector3f.from(particlePosX, particlePosY, maxZ), false); + } + if (entityPosition.getZ() < warningMinZ) { + drawWall(Vector3f.from(particlePosX, particlePosY, minZ), false); + } + } + + private void drawWall(Vector3f position, boolean drawWallX) { + int initialY = (int) (position.getY() - EntityType.PLAYER.getOffset() - 1); + for (int y = initialY; y < (initialY + 5); y++) { + if (drawWallX) { + float x = position.getX(); + for (int z = (int) position.getZ() - 3; z < ((int) position.getZ() + 3); z++) { + if (z < minZ) { + continue; + } + if (z > maxZ) { + break; + } + + sendWorldBorderParticle(x, y, z); + } + } else { + float z = position.getZ(); + for (int x = (int) position.getX() - 3; x < ((int) position.getX() + 3); x++) { + if (x < minX) { + continue; + } + if (x > maxX) { + break; + } + + sendWorldBorderParticle(x, y, z); + } + } + } + } + + private void sendWorldBorderParticle(float x, float y, float z) { + LevelEventPacket effectPacket = new LevelEventPacket(); + effectPacket.setPosition(Vector3f.from(x, y, z)); + effectPacket.setType(WORLD_BORDER_PARTICLE); + session.getUpstream().sendPacket(effectPacket); + } + + /** + * Send the following fog IDs to the client + */ + public static void sendFog(GeyserSession session, String... fogNameSpaces) { + PlayerFogPacket packet = new PlayerFogPacket(); + Collections.addAll(packet.getFogStack(), fogNameSpaces); + session.sendUpstreamPacket(packet); + } + + /** + * Clear any additional fog sent to the client + */ + public static void removeFog(GeyserSession session) { + session.sendUpstreamPacket(new PlayerFogPacket()); + } + +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 1f909806b..2de4e4cad 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -144,6 +144,12 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ServerInitializeBorderPacket packet) { + WorldBorder worldBorder = session.getWorldBorder(); + worldBorder.setCenter(Vector2f.from(packet.getNewCenterX(), packet.getNewCenterZ())); + worldBorder.setOldDiameter(packet.getOldSize()); + worldBorder.setNewDiameter(packet.getNewSize()); + worldBorder.setSpeed(packet.getLerpTime()); + worldBorder.setWarningDelay(packet.getWarningTime()); + worldBorder.setWarningBlocks(packet.getWarningBlocks()); + worldBorder.setResizing(packet.getLerpTime() > 0); + + worldBorder.update(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java new file mode 100644 index 000000000..034c7cf6d --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java.world.border; + +import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderCenterPacket; +import com.nukkitx.math.vector.Vector2f; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.WorldBorder; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +@Translator(packet = ServerSetBorderCenterPacket.class) +public class JavaSetBorderCenterPacket extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ServerSetBorderCenterPacket packet) { + WorldBorder worldBorder = session.getWorldBorder(); + worldBorder.setCenter(Vector2f.from(packet.getNewCenterX(), packet.getNewCenterZ())); + + worldBorder.update(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java new file mode 100644 index 000000000..b54a67b31 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java.world.border; + +import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderLerpSizePacket; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.WorldBorder; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +@Translator(packet = ServerSetBorderLerpSizePacket.class) +public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ServerSetBorderLerpSizePacket packet) { + WorldBorder worldBorder = session.getWorldBorder(); + worldBorder.setOldDiameter(packet.getOldSize()); + worldBorder.setNewDiameter(packet.getNewSize()); + worldBorder.setSpeed(packet.getLerpTime()); + worldBorder.setResizing(true); + + worldBorder.update(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java new file mode 100644 index 000000000..3b90019ad --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java.world.border; + +import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderSizePacket; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.WorldBorder; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +@Translator(packet = ServerSetBorderSizePacket.class) +public class JavaSetBorderSizeTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ServerSetBorderSizePacket packet) { + WorldBorder worldBorder = session.getWorldBorder(); + worldBorder.setOldDiameter(packet.getSize()); + worldBorder.setNewDiameter(packet.getSize()); + worldBorder.setResizing(false); + + worldBorder.update(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java new file mode 100644 index 000000000..b3b718b30 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java.world.border; + +import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderWarningDelayPacket; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.WorldBorder; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +@Translator(packet = ServerSetBorderWarningDelayPacket.class) +public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ServerSetBorderWarningDelayPacket packet) { + WorldBorder worldBorder = session.getWorldBorder(); + worldBorder.setWarningDelay(packet.getWarningDelay()); + + worldBorder.update(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java new file mode 100644 index 000000000..21d1d9209 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java.world.border; + +import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderWarningDistancePacket; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.WorldBorder; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; + +@Translator(packet = ServerSetBorderWarningDistancePacket.class) +public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ServerSetBorderWarningDistancePacket packet) { + WorldBorder worldBorder = session.getWorldBorder(); + worldBorder.setWarningBlocks(packet.getWarningBlocks()); + + worldBorder.update(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java index 5f5c1f17f..340a5e58c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java @@ -117,20 +117,26 @@ public class LanguageUtils { if (formatString == null) { properties = LOCALE_MAPPINGS.get(getDefaultLocale()); formatString = properties.getProperty(key); + + // Try and get the key from en_US (this should only ever happen in development) + if (formatString == null) { + properties = LOCALE_MAPPINGS.get("en_US"); + formatString = properties.getProperty(key); + + // Final fallback + if (formatString == null) { + return key; + } + } } - // Try and get the key from en_US (this should only ever happen in development) - if (formatString == null) { - properties = LOCALE_MAPPINGS.get("en_US"); - formatString = properties.getProperty(key); + String message = formatString.replace("&", "\u00a7"); + if (values == null || values.length == 0) { + // Nothing to replace + return message; } - // Final fallback - if (formatString == null) { - return key; - } - - return MessageFormat.format(formatString.replace("'", "''").replace("&", "\u00a7"), values); + return MessageFormat.format(message.replace("'", "''"), values); } /** @@ -140,12 +146,15 @@ public class LanguageUtils { * @return The formatted locale */ public static String formatLocale(String locale) { - try { - String[] parts = locale.toLowerCase().split("_"); - return parts[0] + "_" + parts[1].toUpperCase(); - } catch (Exception e) { + // Currently, all valid Geyser locales follow the same pattern of ll_CC, where ll is the language and + // CC is the country + if (locale.length() != 5 || locale.indexOf('_') != 2) { + // Invalid locale return locale; } + String language = locale.substring(0, 2); + String country = locale.substring(3); + return language.toLowerCase(Locale.ENGLISH) + "_" + country.toUpperCase(Locale.ENGLISH); } /** From 93f5298ee313a807ee06a58d9ea9bf8a61fb19d9 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 4 Sep 2021 14:55:22 -0400 Subject: [PATCH 587/766] Introduce specialized maps for block state operations By introducing fixed maps, we are able to reduce the overhead of needing to store arbitrary numbers; fixed maps start at one number and must be sequential. This commit also reduces some overhead of lecterns in block updating as we are able to utilize our own maps to reduce object boxing and removing the function of Map#compute of trying to re-insert a value. --- .../network/session/GeyserSession.java | 14 +- .../java/world/JavaUnloadChunkTranslator.java | 14 +- .../world/block/BlockStateValues.java | 25 ++- .../connector/registry/BlockRegistries.java | 2 +- .../geysermc/connector/utils/ChunkUtils.java | 26 +-- .../connector/utils/DimensionUtils.java | 4 +- .../collections/FixedInt2BooleanMap.java | 114 +++++++++++ .../utils/collections/FixedInt2ByteMap.java | 115 +++++++++++ .../utils/collections/FixedInt2IntMap.java | 115 +++++++++++ .../utils/collections/LecternHasBookMap.java | 73 +++++++ .../{ => collections}/Object2IntBiMap.java | 2 +- .../utils/collections/package-info.java | 34 ++++ .../collections/GeyserCollectionsTest.java | 179 ++++++++++++++++++ 13 files changed, 667 insertions(+), 50 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java create mode 100644 connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java create mode 100644 connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java create mode 100644 connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java rename connector/src/main/java/org/geysermc/connector/utils/{ => collections}/Object2IntBiMap.java (99%) create mode 100644 connector/src/main/java/org/geysermc/connector/utils/collections/package-info.java create mode 100644 connector/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index cfc877716..df152da6a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -214,7 +214,7 @@ public class GeyserSession implements CommandSender { * See {@link org.geysermc.connector.network.translators.world.WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} * for more information. */ - private final Set lecternCache = new ObjectOpenHashSet<>(); + private final Set lecternCache; @Setter private boolean droppingLecternBook; @@ -474,6 +474,13 @@ public class GeyserSession implements CommandSender { this.spawned = false; this.loggedIn = false; + if (connector.getWorldManager().shouldExpectLecternHandled()) { + // Unneeded on these platforms + this.lecternCache = null; + } else { + this.lecternCache = new ObjectOpenHashSet<>(); + } + if (connector.getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.NO_EMOTES) { this.emotes = new HashSet<>(); // Make a copy to prevent ConcurrentModificationException @@ -603,12 +610,15 @@ public class GeyserSession implements CommandSender { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", username)); disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); } catch (RequestException ex) { - ex.printStackTrace(); disconnect(ex.getMessage()); } return null; }).whenComplete((aVoid, ex) -> { + if (ex != null) { + disconnect(ex.toString()); + } if (this.closed) { + connector.getLogger().error("", ex); // Client disconnected during the authentication attempt return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java index 3d428327a..d651eceae 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java @@ -50,12 +50,14 @@ public class JavaUnloadChunkTranslator extends PacketTranslator> 4) == packet.getX() && (position.getZ() >> 4) == packet.getZ()) { - iterator.remove(); + if (!session.getConnector().getWorldManager().shouldExpectLecternHandled()) { + // Do the same thing with lecterns + iterator = session.getLecternCache().iterator(); + while (iterator.hasNext()) { + Vector3i position = iterator.next(); + if ((position.getX() >> 4) == packet.getX() && (position.getZ() >> 4) == packet.getZ()) { + iterator.remove(); + } } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java index 2c297613f..fe60bd4de 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java @@ -33,31 +33,31 @@ import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.utils.Direction; import org.geysermc.connector.utils.PistonBehavior; - -import java.util.Map; -import java.util.function.BiFunction; +import org.geysermc.connector.utils.collections.FixedInt2ByteMap; +import org.geysermc.connector.utils.collections.FixedInt2IntMap; +import org.geysermc.connector.utils.collections.LecternHasBookMap; /** * Used for block entities if the Java block state contains Bedrock block information. */ public class BlockStateValues { - private static final Int2IntMap BANNER_COLORS = new Int2IntOpenHashMap(); - private static final Int2ByteMap BED_COLORS = new Int2ByteOpenHashMap(); + private static final Int2IntMap BANNER_COLORS = new FixedInt2IntMap(); + private static final Int2ByteMap BED_COLORS = new FixedInt2ByteMap(); private static final Int2ByteMap COMMAND_BLOCK_VALUES = new Int2ByteOpenHashMap(); private static final Int2ObjectMap DOUBLE_CHEST_VALUES = new Int2ObjectOpenHashMap<>(); private static final Int2ObjectMap FLOWER_POT_VALUES = new Int2ObjectOpenHashMap<>(); - private static final Int2BooleanMap LECTERN_BOOK_STATES = new Int2BooleanOpenHashMap(); - private static final Int2IntMap NOTEBLOCK_PITCHES = new Int2IntOpenHashMap(); + private static final LecternHasBookMap LECTERN_BOOK_STATES = new LecternHasBookMap(); + private static final Int2IntMap NOTEBLOCK_PITCHES = new FixedInt2IntMap(); private static final Int2BooleanMap PISTON_VALUES = new Int2BooleanOpenHashMap(); private static final Int2BooleanMap IS_STICKY_PISTON = new Int2BooleanOpenHashMap(); private static final Object2IntMap PISTON_HEADS = new Object2IntOpenHashMap<>(); private static final Int2ObjectMap PISTON_ORIENTATION = new Int2ObjectOpenHashMap<>(); private static final IntSet ALL_PISTON_HEADS = new IntOpenHashSet(); private static final IntSet MOVING_PISTONS = new IntOpenHashSet(); - private static final Int2ByteMap SKULL_VARIANTS = new Int2ByteOpenHashMap(); + private static final Int2ByteMap SKULL_VARIANTS = new FixedInt2ByteMap(); private static final Int2ByteMap SKULL_ROTATIONS = new Int2ByteOpenHashMap(); private static final Int2IntMap SKULL_WALL_DIRECTIONS = new Int2IntOpenHashMap(); - private static final Int2ByteMap SHULKERBOX_DIRECTIONS = new Int2ByteOpenHashMap(); + private static final Int2ByteMap SHULKERBOX_DIRECTIONS = new FixedInt2ByteMap(); private static final Int2IntMap WATER_LEVEL = new Int2IntOpenHashMap(); public static final int JAVA_AIR_ID = 0; @@ -237,12 +237,9 @@ public class BlockStateValues { } /** - * This returns a Map interface so IntelliJ doesn't complain about {@link Int2BooleanMap#compute(int, BiFunction)} - * not returning null. - * * @return the lectern book state map pointing to book present state */ - public static Map getLecternBookStates() { + public static LecternHasBookMap getLecternBookStates() { return LECTERN_BOOK_STATES; } @@ -407,7 +404,7 @@ public class BlockStateValues { * @return The block's slipperiness */ public static float getSlipperiness(int state) { - String blockIdentifier = BlockRegistries.JAVA_BLOCKS.get(state).getJavaIdentifier(); + String blockIdentifier = BlockRegistries.JAVA_BLOCKS.getOrDefault(state, BlockMapping.AIR).getJavaIdentifier(); switch (blockIdentifier) { case "minecraft:slime_block": return 0.8f; diff --git a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java index 275353300..191b45952 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java @@ -33,7 +33,7 @@ import org.geysermc.connector.registry.loader.RegistryLoaders; import org.geysermc.connector.registry.populator.BlockRegistryPopulator; import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.registry.type.BlockMappings; -import org.geysermc.connector.utils.Object2IntBiMap; +import org.geysermc.connector.utils.collections.Object2IntBiMap; /** * Holds all the block registries in Geyser. diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 993555a10..854c367ec 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -51,7 +51,6 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.entity.ItemFrameEntity; import org.geysermc.connector.entity.player.SkullPlayerEntity; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; @@ -391,30 +390,7 @@ public class ChunkUtils { session.sendUpstreamPacket(waterPacket); } - BlockStateValues.getLecternBookStates().compute(blockState, (key, newLecternHasBook) -> { - // Determine if this block is a lectern - if (newLecternHasBook != null) { - boolean lecternCachedHasBook = session.getLecternCache().contains(position); - if (!session.getConnector().getWorldManager().shouldExpectLecternHandled() && lecternCachedHasBook != newLecternHasBook) { - // Refresh the block entirely - it either has a book or no longer has a book - NbtMap newLecternTag; - if (newLecternHasBook) { - newLecternTag = session.getConnector().getWorldManager().getLecternDataAt(session, position.getX(), position.getY(), position.getZ(), false); - } else { - session.getLecternCache().remove(position); - newLecternTag = LecternInventoryTranslator.getBaseLecternTag(position.getX(), position.getY(), position.getZ(), 0).build(); - } - BlockEntityUtils.updateBlockEntity(session, newLecternTag, position); - } else { - // As of right now, no tag can be added asynchronously - session.getConnector().getWorldManager().getLecternDataAt(session, position.getX(), position.getY(), position.getZ(), false); - } - } else { - // Lectern has been destroyed, if it existed - session.getLecternCache().remove(position); - } - return newLecternHasBook; - }); + BlockStateValues.getLecternBookStates().handleBlockChange(session, blockState, position); // Iterates through all Bedrock-only block entity translators and determines if a manual block entity packet // needs to be sent diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index 0e4de64e4..886bb416f 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -63,7 +63,9 @@ public class DimensionUtils { session.getChunkCache().clear(); session.getEntityCache().removeAllEntities(); session.getItemFrameCache().clear(); - session.getLecternCache().clear(); + if (session.getLecternCache() != null) { + session.getLecternCache().clear(); + } session.getLodestoneCache().clear(); session.getPistonCache().clear(); session.getSkullCache().clear(); diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java b/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java new file mode 100644 index 000000000..0e31e4be6 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils.collections; + +import it.unimi.dsi.fastutil.ints.AbstractInt2BooleanMap; +import it.unimi.dsi.fastutil.objects.ObjectSet; + +public class FixedInt2BooleanMap extends AbstractInt2BooleanMap { + protected boolean[] value; + protected int start = -1; + + @Override + public int size() { + return value.length; + } + + @Override + public ObjectSet int2BooleanEntrySet() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean get(int i) { + return getOrDefault(i, defRetValue); + } + + @Override + public boolean getOrDefault(int key, boolean defaultValue) { + int offset = key - start; + if (offset < 0 || offset >= value.length) { + return defaultValue; + } + + return value[offset]; + } + + @Override + public boolean put(int key, boolean value) { + if (start == -1) { + start = key; + this.value = new boolean[] {value}; + } else { + int offset = key - start; + if (offset >= 0 && offset < this.value.length) { + boolean curr = this.value[offset]; + this.value[offset] = value; + return curr; + } else if (offset != this.value.length) { + throw new IndexOutOfBoundsException("Expected: " + (this.value.length + start) + ", got " + key); + } + + boolean[] newValue = new boolean[offset + 1]; + System.arraycopy(this.value, 0, newValue, 0, this.value.length); + this.value = newValue; + this.value[offset] = value; + } + + return this.defRetValue; + } + + @Override + public boolean containsKey(int k) { + int offset = k - start; + return offset >= 0 && offset < value.length; + } + + @Override + public boolean containsValue(boolean v) { + for (boolean b : value) { + if (b == v) { + return true; + } + } + + return false; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder("{"); + int index = start; + for (boolean b : value) { + builder.append(index++).append("=>").append(b); + if (index < value.length + start) { + // Add commas while there are still more entries in the list + builder.append(", "); + } + } + return builder.append('}').toString(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java b/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java new file mode 100644 index 000000000..5aa4bc528 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils.collections; + +import it.unimi.dsi.fastutil.ints.AbstractInt2ByteMap; +import it.unimi.dsi.fastutil.ints.Int2ByteMap; +import it.unimi.dsi.fastutil.objects.ObjectSet; + +public class FixedInt2ByteMap extends AbstractInt2ByteMap { + protected byte[] value; + protected int start = -1; + + @Override + public int size() { + return value.length; + } + + @Override + public ObjectSet int2ByteEntrySet() { + throw new UnsupportedOperationException(); + } + + @Override + public byte get(int i) { + return getOrDefault(i, defRetValue); + } + + @Override + public byte getOrDefault(int key, byte defaultValue) { + int offset = key - start; + if (offset < 0 || offset >= value.length) { + return defaultValue; + } + + return value[offset]; + } + + @Override + public byte put(int key, byte value) { + if (start == -1) { + start = key; + this.value = new byte[] {value}; + } else { + int offset = key - start; + if (offset >= 0 && offset < this.value.length) { + byte curr = this.value[offset]; + this.value[offset] = value; + return curr; + } else if (offset != this.value.length) { + throw new IndexOutOfBoundsException("Expected: " + (this.value.length + start) + ", got " + key); + } + + byte[] newValue = new byte[offset + 1]; + System.arraycopy(this.value, 0, newValue, 0, this.value.length); + this.value = newValue; + this.value[offset] = value; + } + + return this.defRetValue; + } + + @Override + public boolean containsKey(int k) { + int offset = k - start; + return offset >= 0 && offset < value.length; + } + + @Override + public boolean containsValue(byte v) { + for (byte i : value) { + if (i == v) { + return true; + } + } + + return false; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder("{"); + int index = start; + for (byte b : value) { + builder.append(index++).append("=>").append(b); + if (index < value.length + start) { + // Add commas while there are still more entries in the list + builder.append(", "); + } + } + return builder.append('}').toString(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java b/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java new file mode 100644 index 000000000..77e6740bc --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils.collections; + +import it.unimi.dsi.fastutil.ints.AbstractInt2IntMap; +import it.unimi.dsi.fastutil.ints.Int2IntMap; +import it.unimi.dsi.fastutil.objects.ObjectSet; + +public class FixedInt2IntMap extends AbstractInt2IntMap { + protected int[] value; + protected int start = -1; + + @Override + public int size() { + return value.length; + } + + @Override + public ObjectSet int2IntEntrySet() { + throw new UnsupportedOperationException(); + } + + @Override + public int get(int i) { + return getOrDefault(i, defRetValue); + } + + @Override + public int getOrDefault(int key, int defaultValue) { + int offset = key - start; + if (offset < 0 || offset >= value.length) { + return defaultValue; + } + + return value[offset]; + } + + @Override + public int put(int key, int value) { + if (start == -1) { + start = key; + this.value = new int[] {value}; + } else { + int offset = key - start; + if (offset >= 0 && offset < this.value.length) { + int curr = this.value[offset]; + this.value[offset] = value; + return curr; + } else if (offset != this.value.length) { + throw new IndexOutOfBoundsException("Expected: " + (this.value.length + start) + ", got " + key); + } + + int[] newValue = new int[offset + 1]; + System.arraycopy(this.value, 0, newValue, 0, this.value.length); + this.value = newValue; + this.value[offset] = value; + } + + return this.defRetValue; + } + + @Override + public boolean containsKey(int k) { + int offset = k - start; + return offset >= 0 && offset < value.length; + } + + @Override + public boolean containsValue(int v) { + for (int i : value) { + if (i == v) { + return true; + } + } + + return false; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder("{"); + int index = start; + for (int i : value) { + builder.append(index++).append("=>").append(i); + if (index < value.length + start) { + // Add commas while there are still more entries in the list + builder.append(", "); + } + } + return builder.append('}').toString(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java b/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java new file mode 100644 index 000000000..3252963e4 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils.collections; + +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.nbt.NbtMap; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; +import org.geysermc.connector.network.translators.world.WorldManager; +import org.geysermc.connector.utils.BlockEntityUtils; + +/** + * Map that takes advantage of its internals for fast operations on block states to determine if they are lecterns. + */ +public class LecternHasBookMap extends FixedInt2BooleanMap { + + /** + * Update a potential lectern within the world. This is a map method so it can use the internal fields to + * optimize lectern determining. + */ + public void handleBlockChange(GeyserSession session, int blockState, Vector3i position) { + WorldManager worldManager = session.getConnector().getWorldManager(); + + int offset = blockState - this.start; + if (offset < 0 || offset > this.value.length) { + // Block state is out of bounds of this map - lectern has been destroyed, if it existed + if (!worldManager.shouldExpectLecternHandled()) { + session.getLecternCache().remove(position); + } + return; + } + + boolean newLecternHasBook; + if (worldManager.shouldExpectLecternHandled()) { + // As of right now, no tag can be added asynchronously + worldManager.getLecternDataAt(session, position.getX(), position.getY(), position.getZ(), false); + } else if ((newLecternHasBook = this.value[offset]) != this.get(worldManager.getBlockAt(session, position))) { + // If the lectern block was updated, or it previously had a book + NbtMap newLecternTag; + // newLecternHasBook = the new lectern block state's "has book" toggle. + if (newLecternHasBook) { + newLecternTag = worldManager.getLecternDataAt(session, position.getX(), position.getY(), position.getZ(), false); + } else { + session.getLecternCache().remove(position); + newLecternTag = LecternInventoryTranslator.getBaseLecternTag(position.getX(), position.getY(), position.getZ(), 0).build(); + } + BlockEntityUtils.updateBlockEntity(session, newLecternTag, position); + } + } +} diff --git a/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java b/connector/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java rename to connector/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java index 27277923b..29364437c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Object2IntBiMap.java +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.connector.utils.collections; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/package-info.java b/connector/src/main/java/org/geysermc/connector/utils/collections/package-info.java new file mode 100644 index 000000000..3400f3f2a --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/package-info.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019-2021 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 + */ + +/** + * Contains useful collections for use in Geyser. + * + * Of note are the fixed int maps. Designed for use with block states that are positive and sequential, they do not allow keys to be + * added that are not greater by one versus the previous key. Because of this, speedy operations of {@link java.util.Map#get(java.lang.Object)} + * and {@link java.util.Map#containsKey(java.lang.Object)} can be performed by simply checking the bounds of the map + * size and its "start" integer. + */ +package org.geysermc.connector.utils.collections; \ No newline at end of file diff --git a/connector/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java b/connector/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java new file mode 100644 index 000000000..acd8bcbd0 --- /dev/null +++ b/connector/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils.collections; + +import org.junit.Assert; +import org.junit.Test; + +public class GeyserCollectionsTest { + private final byte[] bytes = new byte[] {(byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 2, (byte) 1}; + private final boolean[] booleans = new boolean[] {true, false, false, true}; + private final int[] ints = new int[] {76, 3006, 999, 2323, 888, 0, 111, 999}; + + private final int[] startBlockRanges = new int[] {0, 70, 600, 450, 787, 1980}; + + @Test + public void testBytes() { + for (int startRange : startBlockRanges) { + testBytes(startRange, new FixedInt2ByteMap()); + } + } + + private void testBytes(final int start, final FixedInt2ByteMap map) { + int index = start; + for (byte b : bytes) { + map.put(index++, b); + } + + int lastKey = index; + + // Easy, understandable out-of-bounds checks + Assert.assertFalse("Map contains key bigger by one!", map.containsKey(lastKey)); + Assert.assertTrue("Map doesn't contain final key!", map.containsKey(lastKey - 1)); + + // Ensure the first and last values do not throw an exception on get, and test getOrDefault + map.get(start - 1); + map.get(lastKey); + Assert.assertEquals(map.getOrDefault(start - 1, Byte.MAX_VALUE), Byte.MAX_VALUE); + Assert.assertEquals(map.getOrDefault(lastKey, Byte.MAX_VALUE), Byte.MAX_VALUE); + Assert.assertEquals(map.getOrDefault(lastKey, Byte.MIN_VALUE), Byte.MIN_VALUE); + + Assert.assertEquals(map.size(), bytes.length); + + for (int i = start; i < bytes.length; i++) { + Assert.assertTrue(map.containsKey(i)); + Assert.assertEquals(map.get(i), bytes[i - start]); + } + + for (int i = start - 1; i >= (start - 6); i--) { + // Lower than expected check + Assert.assertFalse(i + " is in a map that starts with " + start, map.containsKey(i)); + } + + for (int i = bytes.length + start; i < bytes.length + 5 + start; i++) { + // Higher than expected check + Assert.assertFalse(i + " is in a map that ends with " + (start + bytes.length), map.containsKey(i)); + } + + for (byte b : bytes) { + Assert.assertTrue(map.containsValue(b)); + } + } + + @Test + public void testBooleans() { + for (int startRange : startBlockRanges) { + testBooleans(startRange, new FixedInt2BooleanMap()); + } + } + + private void testBooleans(final int start, final FixedInt2BooleanMap map) { + int index = start; + for (boolean b : booleans) { + map.put(index++, b); + } + + int lastKey = index; + + // Easy, understandable out-of-bounds checks + Assert.assertFalse("Map contains key bigger by one!", map.containsKey(lastKey)); + Assert.assertTrue("Map doesn't contain final key!", map.containsKey(lastKey - 1)); + + // Ensure the first and last values do not throw an exception on get + map.get(start - 1); + map.get(lastKey); + Assert.assertTrue(map.getOrDefault(lastKey, true)); + + Assert.assertEquals(map.size(), booleans.length); + + for (int i = start; i < booleans.length; i++) { + Assert.assertTrue(map.containsKey(i)); + Assert.assertEquals(map.get(i), booleans[i - start]); + } + + for (int i = start - 1; i >= (start - 6); i--) { + // Lower than expected check + Assert.assertFalse(i + " is in a map that starts with " + start, map.containsKey(i)); + } + + for (int i = booleans.length + start; i < booleans.length + start + 5; i++) { + // Higher than expected check + Assert.assertFalse(i + " is in a map that ends with " + (start + booleans.length), map.containsKey(i)); + } + + for (boolean b : booleans) { + Assert.assertTrue(map.containsValue(b)); + } + } + + @Test + public void testInts() { + for (int startRange : startBlockRanges) { + testInts(startRange, new FixedInt2IntMap()); + } + } + + private void testInts(final int start, final FixedInt2IntMap map) { + int index = start; + for (int i : ints) { + map.put(index++, i); + } + + int lastKey = index; + + // Easy, understandable out-of-bounds checks + Assert.assertFalse("Map contains key bigger by one!", map.containsKey(lastKey)); + Assert.assertTrue("Map doesn't contain final key!", map.containsKey(lastKey - 1)); + + // Ensure the first and last values do not throw an exception on get, and test getOrDefault + map.get(start - 1); + map.get(lastKey); + Assert.assertEquals(map.getOrDefault(start - 1, Integer.MAX_VALUE), Integer.MAX_VALUE); + Assert.assertEquals(map.getOrDefault(lastKey, Integer.MAX_VALUE), Integer.MAX_VALUE); + Assert.assertEquals(map.getOrDefault(lastKey, Integer.MIN_VALUE), Integer.MIN_VALUE); + + Assert.assertEquals(map.size(), ints.length); + + for (int i = start; i < ints.length; i++) { + Assert.assertTrue(map.containsKey(i)); + Assert.assertEquals(map.get(i), ints[i - start]); + } + + for (int i = start - 1; i >= (start - 6); i--) { + // Lower than expected check + Assert.assertFalse(i + " is in a map that starts with " + start, map.containsKey(i)); + } + + for (int i = ints.length + start; i < ints.length + 5 + start; i++) { + // Higher than expected check + Assert.assertFalse(i + " is in a map that ends with " + (start + ints.length), map.containsKey(i)); + } + + for (int i : ints) { + Assert.assertTrue(map.containsValue(i)); + } + } +} From bc0cfde8f9ac442001913b3bd06f00868ab9d0be Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 14:10:56 -0400 Subject: [PATCH 588/766] Set the minimum Java version to 16; drop Bedrock 1.17.0 (#2477) --- .github/workflows/pullrequest.yml | 4 +- ap/pom.xml | 4 +- bootstrap/bungeecord/pom.xml | 6 +- .../command/BungeeCommandSender.java | 3 +- bootstrap/pom.xml | 4 +- bootstrap/spigot/pom.xml | 6 +- .../spigot/command/SpigotCommandSender.java | 3 +- .../GeyserSpigot1_11CraftingListener.java | 6 +- .../manager/GeyserSpigotWorldManager.java | 6 +- bootstrap/sponge/pom.xml | 6 +- bootstrap/standalone/pom.xml | 6 +- .../standalone/GeyserStandaloneBootstrap.java | 26 +- .../platform/standalone/gui/GraphPanel.java | 3 +- bootstrap/velocity/pom.xml | 6 +- common/pom.xml | 2 +- connector/pom.xml | 6 +- .../geysermc/connector/GeyserConnector.java | 31 - .../command/defaults/DumpCommand.java | 12 +- .../EmoteOffhandWorkaroundOption.java | 13 +- .../connector/entity/EnderCrystalEntity.java | 3 +- .../org/geysermc/connector/entity/Entity.java | 8 +- .../connector/entity/LivingEntity.java | 50 +- .../connector/entity/PaintingEntity.java | 14 +- .../entity/living/ArmorStandEntity.java | 24 +- .../entity/living/animal/AxolotlEntity.java | 8 +- .../living/animal/tameable/CatEntity.java | 25 +- .../raid/SpellcasterIllagerEntity.java | 20 +- .../connector/entity/player/PlayerEntity.java | 13 +- .../connector/network/BedrockProtocol.java | 7 - .../network/ConnectorServerEventHandler.java | 4 +- .../session/cache/EntityEffectCache.java | 24 +- .../bedrock/BedrockAnimateTranslator.java | 11 +- .../BedrockCommandBlockUpdateTranslator.java | 20 +- .../BedrockEntityPickRequestTranslator.java | 71 +- ...BedrockInventoryTransactionTranslator.java | 34 +- .../BedrockLecternUpdateTranslator.java | 3 +- .../entity/BedrockEntityEventTranslator.java | 9 +- .../translators/chat/MessageTranslator.java | 2 +- .../translators/collision/BoundingBox.java | 37 +- .../collision/CollisionManager.java | 13 +- .../collision/translators/DoorCollision.java | 16 +- .../inventory/InventoryTranslator.java | 31 +- .../inventory/click/ClickPlan.java | 15 +- .../translators/AnvilInventoryTranslator.java | 46 +- .../BrewingInventoryTranslator.java | 38 +- .../CartographyInventoryTranslator.java | 46 +- .../GrindstoneInventoryTranslator.java | 46 +- .../translators/LoomInventoryTranslator.java | 58 +- .../MerchantInventoryTranslator.java | 46 +- .../PlayerInventoryTranslator.java | 16 +- .../SmithingInventoryTranslator.java | 46 +- .../StonecutterInventoryTranslator.java | 16 +- .../translators/item/ItemTranslator.java | 9 +- .../translators/nbt/BookPagesTranslator.java | 8 +- .../nbt/EnchantmentTranslator.java | 3 +- .../translators/java/JavaChatTranslator.java | 20 +- .../java/JavaDeclareCommandsTranslator.java | 80 +- .../java/JavaDeclareRecipesTranslator.java | 14 +- .../entity/JavaEntityEquipmentTranslator.java | 27 +- .../JavaEntitySetPassengersTranslator.java | 8 +- .../entity/JavaEntityStatusTranslator.java | 3 +- .../player/JavaPlayerListEntryTranslator.java | 8 +- .../JavaScoreboardObjectiveTranslator.java | 11 +- .../java/scoreboard/JavaTeamTranslator.java | 30 +- .../world/JavaBlockBreakAnimTranslator.java | 44 +- .../java/world/JavaBlockValueTranslator.java | 30 +- .../world/JavaNotifyClientTranslator.java | 8 +- .../java/world/JavaPlayEffectTranslator.java | 101 +- .../world/JavaSpawnParticleTranslator.java | 11 +- .../java/world/JavaTradeListTranslator.java | 3 +- .../translators/world/BiomeTranslator.java | 42 +- .../world/block/BlockStateValues.java | 37 +- .../world/block/entity/PistonBlockEntity.java | 53 +- .../entity/SignBlockEntityTranslator.java | 71 +- .../entity/SkullBlockEntityTranslator.java | 20 +- .../loader/SoundEffectsRegistryLoader.java | 9 +- .../populator/BlockRegistryPopulator.java | 47 +- .../populator/ItemRegistryPopulator.java | 22 - .../connector/scoreboard/Objective.java | 26 +- .../connector/scoreboard/Scoreboard.java | 8 +- .../geysermc/connector/scoreboard/Team.java | 17 +- .../connector/skin/FloodgateSkinUploader.java | 16 +- .../geysermc/connector/skin/SkinProvider.java | 20 +- .../org/geysermc/connector/utils/Axis.java | 14 +- .../geysermc/connector/utils/BlockUtils.java | 49 +- .../geysermc/connector/utils/ChunkUtils.java | 3 +- .../connector/utils/DimensionUtils.java | 13 +- .../geysermc/connector/utils/EntityUtils.java | 90 +- .../geysermc/connector/utils/SignUtils.java | 54 +- .../bedrock/block_palette.1_17_0.nbt | Bin 40439 -> 0 bytes .../bedrock/creative_items.1_17_0.json | 5135 ----------------- .../bedrock/runtime_item_states.1_17_0.json | 4154 ------------- pom.xml | 14 +- 93 files changed, 668 insertions(+), 10637 deletions(-) delete mode 100644 connector/src/main/resources/bedrock/block_palette.1_17_0.nbt delete mode 100644 connector/src/main/resources/bedrock/creative_items.1_17_0.json delete mode 100644 connector/src/main/resources/bedrock/runtime_item_states.1_17_0.json diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 78a3ce299..9621fa1d0 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -15,10 +15,10 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - name: Set up JDK 1.8 + - name: Set up JDK 16 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 16 - name: submodules-init uses: snickerbockers/submodules-init@v4 - name: Build with Maven diff --git a/ap/pom.xml b/ap/pom.xml index f8cc2dd1b..912c6731b 100644 --- a/ap/pom.xml +++ b/ap/pom.xml @@ -6,9 +6,9 @@ org.geysermc geyser-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT ap - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT \ No newline at end of file diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index b01ac7984..bef37d453 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT bootstrap-bungeecord @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT compile @@ -49,7 +49,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.3.0-SNAPSHOT package diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java index 807cf4786..1f3a875b2 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java @@ -57,8 +57,7 @@ public class BungeeCommandSender implements CommandSender { @Override public String getLocale() { - if (handle instanceof ProxiedPlayer) { - ProxiedPlayer player = (ProxiedPlayer) handle; + if (handle instanceof ProxiedPlayer player) { String locale = player.getLocale().getLanguage() + "_" + player.getLocale().getCountry(); return LanguageUtils.formatLocale(locale); } diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index c54d489fa..38489fa25 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT bootstrap-parent pom @@ -34,7 +34,7 @@ org.geysermc ap - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT provided diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index cc2a73ffd..dd6b28473 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT bootstrap-spigot @@ -21,7 +21,7 @@ org.geysermc connector - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT compile @@ -66,7 +66,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.3.0-SNAPSHOT package diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java index c1c2b2c72..16533623a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java @@ -97,8 +97,7 @@ public class SpigotCommandSender implements CommandSender { * @return the locale of the Spigot player */ private String getSpigotLocale() { - if (handle instanceof Player) { - Player player = (Player) handle; + if (handle instanceof Player player) { if (USE_LEGACY_METHOD) { try { // sigh diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index 4f24af19c..f7a9d6df7 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -109,8 +109,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { if (output == null || output.getId() == 0) continue; // If items make air we don't want that boolean isNotAllAir = false; // Check for all-air recipes - if (recipe instanceof ShapedRecipe) { - ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; + if (recipe instanceof ShapedRecipe shapedRecipe) { int size = shapedRecipe.getShape().length * shapedRecipe.getShape()[0].length(); Ingredient[] ingredients = new Ingredient[size]; ItemData[] input = new ItemData[size]; @@ -134,8 +133,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { craftingDataPacket.getCraftingData().add(CraftingData.fromShaped(uuid.toString(), shapedRecipe.getShape()[0].length(), shapedRecipe.getShape().length, Arrays.asList(input), Collections.singletonList(output), uuid, "crafting_table", 0, netId++)); - } else if (recipe instanceof ShapelessRecipe) { - ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe; + } else if (recipe instanceof ShapelessRecipe shapelessRecipe) { Ingredient[] ingredients = new Ingredient[shapelessRecipe.getIngredientList().size()]; ItemData[] input = new ItemData[shapelessRecipe.getIngredientList().size()]; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 516cf13dc..a0e97c51a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -99,14 +99,13 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z); - if (!(block.getState() instanceof Lectern)) { + if (!(block.getState() instanceof Lectern lectern)) { session.getConnector().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString()); return; } - Lectern lectern = (Lectern) block.getState(); ItemStack itemStack = lectern.getInventory().getItem(0); - if (itemStack == null || !(itemStack.getItemMeta() instanceof BookMeta)) { + if (itemStack == null || !(itemStack.getItemMeta() instanceof BookMeta bookMeta)) { if (!isChunkLoad) { // We need to update the lectern since it's not going to be updated otherwise BlockEntityUtils.updateBlockEntity(session, LecternInventoryTranslator.getBaseLecternTag(x, y, z, 0).build(), Vector3i.from(x, y, z)); @@ -115,7 +114,6 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { return; } - BookMeta bookMeta = (BookMeta) itemStack.getItemMeta(); // On the count: allow the book to show/open even there are no pages. We know there is a book here, after all, and this matches Java behavior boolean hasBookPages = bookMeta.getPageCount() > 0; NbtMapBuilder lecternTag = LecternInventoryTranslator.getBaseLecternTag(x, y, z, hasBookPages ? bookMeta.getPageCount() : 1); diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml index 4991e8aaf..a5582bbe0 100644 --- a/bootstrap/sponge/pom.xml +++ b/bootstrap/sponge/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT bootstrap-sponge @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT compile @@ -48,7 +48,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.3.0-SNAPSHOT package diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index e39097b4a..64a6f6fee 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT bootstrap-standalone @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT compile @@ -89,7 +89,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.3.0-SNAPSHOT com.github.edwgiz diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java index f875127cc..6a612f17d 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java @@ -98,32 +98,26 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { // Allows gui and nogui without options, for backwards compatibility String arg = args[i]; switch (arg) { - case "--gui": - case "gui": - useGuiOpts = true; - break; - case "--nogui": - case "nogui": - useGuiOpts = false; - break; - case "--config": - case "-c": + case "--gui", "gui" -> useGuiOpts = true; + case "--nogui", "nogui" -> useGuiOpts = false; + case "--config", "-c" -> { if (i >= args.length - 1) { System.err.println(MessageFormat.format(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.config_not_specified"), "-c")); return; } - configFilenameOpt = args[i+1]; i++; + configFilenameOpt = args[i + 1]; + i++; System.out.println(MessageFormat.format(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.config_specified"), configFilenameOpt)); - break; - case "--help": - case "-h": + } + case "--help", "-h" -> { System.out.println(MessageFormat.format(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.usage"), "[java -jar] Geyser.jar [opts]")); System.out.println(" " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.options")); System.out.println(" -c, --config [file] " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.config")); System.out.println(" -h, --help " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.help")); System.out.println(" --gui, --nogui " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.gui")); return; - default: + } + default -> { // We have likely added a config option argument if (arg.startsWith("--")) { // Split the argument by an = @@ -159,9 +153,9 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { } } } - System.err.println(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.unrecognised", arg)); return; + } } } bootstrap.onEnable(useGuiOpts, configFilenameOpt); diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java index 68adfde52..9cfa9399d 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java @@ -68,11 +68,10 @@ public final class GraphPanel extends JPanel { @Override protected void paintComponent(Graphics graphics) { super.paintComponent(graphics); - if (!(graphics instanceof Graphics2D)) { + if (!(graphics instanceof final Graphics2D g)) { graphics.drawString("Graphics is not Graphics2D, unable to render", 0, 0); return; } - final Graphics2D g = (Graphics2D) graphics; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int length = values.size(); diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml index 1e74bafbc..33df2be80 100644 --- a/bootstrap/velocity/pom.xml +++ b/bootstrap/velocity/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT bootstrap-velocity @@ -14,7 +14,7 @@ org.geysermc connector - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT compile @@ -48,7 +48,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.3.0-SNAPSHOT package diff --git a/common/pom.xml b/common/pom.xml index edf31c2b8..a3e86ff9b 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT common diff --git a/connector/pom.xml b/connector/pom.xml index e6bb897dd..0a15c759d 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT connector @@ -21,13 +21,13 @@ org.geysermc ap - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT provided org.geysermc common - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT compile diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 0c9217147..7e22792fa 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -384,40 +384,9 @@ public class GeyserConnector { logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn")); } - checkForOutdatedJava(); - newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); } - private void checkForOutdatedJava() { - final int supportedJavaVersion = 16; - // Taken from Paper - String javaVersion = System.getProperty("java.version"); - Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion); - if (!matcher.find()) { - getLogger().debug("Could not parse Java version string " + javaVersion); - return; - } - - String version = matcher.group(1); - int majorVersion; - try { - majorVersion = Integer.parseInt(version); - } catch (NumberFormatException e) { - getLogger().debug("Could not format as an int: " + version); - return; - } - - if (majorVersion < supportedJavaVersion) { - getLogger().warning("*********************************************"); - getLogger().warning(""); - getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_java.header")); - getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_java.message", supportedJavaVersion, javaVersion)); - getLogger().warning(""); - getLogger().warning("*********************************************"); - } - } - public void shutdown() { bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); shuttingDown = true; diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java index 07a690298..0a1c81114 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java @@ -69,15 +69,9 @@ public class DumpCommand extends GeyserCommand { if (args.length >= 1) { for (String arg : args) { switch (arg) { - case "full": - showSensitive = true; - break; - case "offline": - offlineDump = true; - break; - case "logs": - addLog = true; - break; + case "full" -> showSensitive = true; + case "offline" -> offlineDump = true; + case "logs" -> addLog = true; } } } diff --git a/connector/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java b/connector/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java index 954e3d32a..c28048046 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java @@ -40,14 +40,11 @@ public enum EmoteOffhandWorkaroundOption { @Override public EmoteOffhandWorkaroundOption deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { String value = p.getValueAsString(); - switch (value) { - case "no-emotes": - return NO_EMOTES; - case "emotes-and-offhand": - return EMOTES_AND_OFFHAND; - default: - return DISABLED; - } + return switch (value) { + case "no-emotes" -> NO_EMOTES; + case "emotes-and-offhand" -> EMOTES_AND_OFFHAND; + default -> DISABLED; + }; } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java index 596ccf089..e4b60980f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java @@ -48,8 +48,7 @@ public class EnderCrystalEntity extends Entity { // Show beam // Usually performed client-side on Bedrock except for Ender Dragon respawn event if (entityMetadata.getId() == 8) { - if (entityMetadata.getValue() instanceof Position) { - Position pos = (Position) entityMetadata.getValue(); + if (entityMetadata.getValue() instanceof Position pos) { metadata.put(EntityData.BLOCK_TARGET, Vector3i.from(pos.getX(), pos.getY(), pos.getZ())); } else { metadata.put(EntityData.BLOCK_TARGET, Vector3i.ZERO); diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index eb9b8ec1c..f8bf9693d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -256,11 +256,9 @@ public class Entity { setAir((int) entityMetadata.getValue()); break; case 2: // custom name - if (entityMetadata.getValue() instanceof Component) { - Component message = (Component) entityMetadata.getValue(); - if (message != null) - // Always translate even if it's a TextMessage since there could be translatable parameters - metadata.put(EntityData.NAMETAG, MessageTranslator.convertMessage(message, session.getLocale())); + if (entityMetadata.getValue() instanceof Component message) { + // Always translate even if it's a TextMessage since there could be translatable parameters + metadata.put(EntityData.NAMETAG, MessageTranslator.convertMessage(message, session.getLocale())); } break; case 3: // is custom name visible diff --git a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java index 5ba66f71a..44a9859d5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java @@ -84,21 +84,21 @@ public class LivingEntity extends Entity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { switch (entityMetadata.getId()) { - case 8: // blocking + case 8 -> { // blocking byte xd = (byte) entityMetadata.getValue(); //blocking gets triggered when using a bow, but if we set USING_ITEM for all items, it may look like //you're "mining" with ex. a shield. ItemMapping shield = session.getItemMappings().getStoredItems().shield(); boolean isUsingShield = (getHand().getId() == shield.getBedrockId() || - getHand().equals(ItemData.AIR) && getOffHand().getId() == shield.getBedrockId()); + getHand().equals(ItemData.AIR) && getOffHand().getId() == shield.getBedrockId()); metadata.getFlags().setFlag(EntityFlag.USING_ITEM, (xd & 0x01) == 0x01 && !isUsingShield); metadata.getFlags().setFlag(EntityFlag.BLOCKING, (xd & 0x01) == 0x01); // Riptide spin attack metadata.getFlags().setFlag(EntityFlag.DAMAGE_NEARBY_MOBS, (xd & 0x04) == 0x04); - break; - case 9: + } + case 9 -> { this.health = (float) entityMetadata.getValue(); AttributeData healthData = createHealthAttribute(); @@ -106,14 +106,10 @@ public class LivingEntity extends Entity { attributesPacket.setRuntimeEntityId(geyserId); attributesPacket.setAttributes(Collections.singletonList(healthData)); session.sendUpstreamPacket(attributesPacket); - break; - case 10: - metadata.put(EntityData.EFFECT_COLOR, entityMetadata.getValue()); - break; - case 11: - metadata.put(EntityData.EFFECT_AMBIENT, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); - break; - case 14: // Bed Position + } + case 10 -> metadata.put(EntityData.EFFECT_COLOR, entityMetadata.getValue()); + case 11 -> metadata.put(EntityData.EFFECT_AMBIENT, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); + case 14 -> { // Bed Position Position bedPosition = (Position) entityMetadata.getValue(); if (bedPosition != null) { metadata.put(EntityData.BED_POSITION, Vector3i.from(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ())); @@ -128,7 +124,7 @@ public class LivingEntity extends Entity { // Player is no longer sleeping metadata.put(EntityData.PLAYER_FLAGS, (byte) 0); } - break; + } } super.updateBedrockMetadata(entityMetadata, session); @@ -249,28 +245,16 @@ public class LivingEntity extends Entity { */ protected void updateAttribute(Attribute javaAttribute, List newAttributes) { switch (javaAttribute.getType()) { - case GENERIC_MAX_HEALTH: + case GENERIC_MAX_HEALTH -> { this.maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); newAttributes.add(createHealthAttribute()); - break; - case GENERIC_ATTACK_DAMAGE: - newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.ATTACK_DAMAGE)); - break; - case GENERIC_FLYING_SPEED: - newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FLYING_SPEED)); - break; - case GENERIC_MOVEMENT_SPEED: - newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.MOVEMENT_SPEED)); - break; - case GENERIC_FOLLOW_RANGE: - newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FOLLOW_RANGE)); - break; - case GENERIC_KNOCKBACK_RESISTANCE: - newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.KNOCKBACK_RESISTANCE)); - break; - case HORSE_JUMP_STRENGTH: - newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.HORSE_JUMP_STRENGTH)); - break; + } + case GENERIC_ATTACK_DAMAGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.ATTACK_DAMAGE)); + case GENERIC_FLYING_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FLYING_SPEED)); + case GENERIC_MOVEMENT_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.MOVEMENT_SPEED)); + case GENERIC_FOLLOW_RANGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FOLLOW_RANGE)); + case GENERIC_KNOCKBACK_RESISTANCE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.KNOCKBACK_RESISTANCE)); + case HORSE_JUMP_STRENGTH -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.HORSE_JUMP_STRENGTH)); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java index 3e2ff7ead..b620e598b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java @@ -68,12 +68,12 @@ public class PaintingEntity extends Entity { double widthOffset = paintingName.getWidth() > 1 ? 0.5 : 0; double heightOffset = paintingName.getHeight() > 1 && paintingName.getHeight() != 3 ? 0.5 : 0; - switch (direction) { - case 0: return position.add(widthOffset, heightOffset, OFFSET); - case 1: return position.add(-OFFSET, heightOffset, widthOffset); - case 2: return position.add(-widthOffset, heightOffset, -OFFSET); - case 3: return position.add(OFFSET, heightOffset, -widthOffset); - } - return position; + return switch (direction) { + case 0 -> position.add(widthOffset, heightOffset, OFFSET); + case 1 -> position.add(-OFFSET, heightOffset, widthOffset); + case 2 -> position.add(-widthOffset, heightOffset, -OFFSET); + case 3 -> position.add(OFFSET, heightOffset, -widthOffset); + default -> position; + }; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java index d447f6379..6a87097a1 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java @@ -161,42 +161,42 @@ public class ArmorStandEntity extends LivingEntity { EntityFlag negativeYToggle = null; EntityFlag negativeZToggle = null; switch (entityMetadata.getId()) { - case 16: // Head + case 16 -> { // Head dataLeech = EntityData.MARK_VARIANT; negativeXToggle = EntityFlag.INTERESTED; negativeYToggle = EntityFlag.CHARGED; negativeZToggle = EntityFlag.POWERED; - break; - case 17: // Body + } + case 17 -> { // Body dataLeech = EntityData.VARIANT; negativeXToggle = EntityFlag.IN_LOVE; negativeYToggle = EntityFlag.CELEBRATING; negativeZToggle = EntityFlag.CELEBRATING_SPECIAL; - break; - case 18: // Left arm + } + case 18 -> { // Left arm dataLeech = EntityData.TRADE_TIER; negativeXToggle = EntityFlag.CHARGING; negativeYToggle = EntityFlag.CRITICAL; negativeZToggle = EntityFlag.DANCING; - break; - case 19: // Right arm + } + case 19 -> { // Right arm dataLeech = EntityData.MAX_TRADE_TIER; negativeXToggle = EntityFlag.ELDER; negativeYToggle = EntityFlag.EMOTING; negativeZToggle = EntityFlag.IDLING; - break; - case 20: // Left leg + } + case 20 -> { // Left leg dataLeech = EntityData.SKIN_ID; negativeXToggle = EntityFlag.IS_ILLAGER_CAPTAIN; negativeYToggle = EntityFlag.IS_IN_UI; negativeZToggle = EntityFlag.LINGERING; - break; - case 21: // Right leg + } + case 21 -> { // Right leg dataLeech = EntityData.HURT_DIRECTION; negativeXToggle = EntityFlag.IS_PREGNANT; negativeYToggle = EntityFlag.SHEARED; negativeZToggle = EntityFlag.STALKING; - break; + } } if (dataLeech != null) { // Indicate that rotation should be checked diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java index 3d2be0ce7..0968cecb0 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java @@ -44,12 +44,8 @@ public class AxolotlEntity extends AnimalEntity { if (entityMetadata.getId() == 17) { int variant = (int) entityMetadata.getValue(); switch (variant) { - case 1: // Java - "Wild" (brown) - variant = 3; - break; - case 3: // Java - cyan - variant = 1; - break; + case 1 -> variant = 3; // Java - "Wild" (brown) + case 3 -> variant = 1; // Java - cyan } metadata.put(EntityData.VARIANT, variant); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java index 904f563f9..f22124409 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java @@ -59,23 +59,14 @@ public class CatEntity extends TameableEntity { } if (entityMetadata.getId() == 19) { // Different colors in Java and Bedrock for some reason - int variantColor; - switch ((int) entityMetadata.getValue()) { - case 0: - variantColor = 8; - break; - case 8: - variantColor = 0; - break; - case 9: - variantColor = 10; - break; - case 10: - variantColor = 9; - break; - default: - variantColor = (int) entityMetadata.getValue(); - } + int metadataValue = (int) entityMetadata.getValue(); + int variantColor = switch (metadataValue) { + case 0 -> 8; + case 8 -> 0; + case 9 -> 10; + case 10 -> 9; + default -> metadataValue; + }; metadata.put(EntityData.VARIANT, variantColor); } if (entityMetadata.getId() == 20) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java index 7e92a7569..693220dda 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java @@ -49,19 +49,13 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { int spellType = (int) (byte) entityMetadata.getValue(); // Summon vex, attack, or wololo metadata.getFlags().setFlag(EntityFlag.CASTING, spellType == 1 || spellType == 2 || spellType == 3); - int rgbData = 0; - // Set the spell color based on Java values - switch (spellType) { - case 1: - rgbData = SUMMON_VEX_PARTICLE_COLOR; - break; - case 2: - rgbData = ATTACK_PARTICLE_COLOR; - break; - case 3: - rgbData = WOLOLO_PARTICLE_COLOR; - break; - } + int rgbData = switch (spellType) { + // Set the spell color based on Java values + case 1 -> SUMMON_VEX_PARTICLE_COLOR; + case 2 -> ATTACK_PARTICLE_COLOR; + case 3 -> WOLOLO_PARTICLE_COLOR; + default -> 0; + }; metadata.put(EntityData.EVOKER_SPELL_COLOR, rgbData); } super.updateBedrockMetadata(entityMetadata, session); diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 6d4117a80..d5170d2fc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -316,17 +316,12 @@ public class PlayerEntity extends LivingEntity { protected void setDimensions(Pose pose) { float height; switch (pose) { - case SNEAKING: - height = 1.5f; - break; - case FALL_FLYING: - case SPIN_ATTACK: - case SWIMMING: - height = 0.6f; - break; - default: + case SNEAKING -> height = 1.5f; + case FALL_FLYING, SPIN_ATTACK, SWIMMING -> height = 0.6f; + default -> { super.setDimensions(pose); return; + } } metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java index 660f1d039..3efb7a849 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java @@ -26,9 +26,7 @@ package org.geysermc.connector.network; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; -import com.nukkitx.protocol.bedrock.v440.Bedrock_v440; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; -import org.geysermc.connector.GeyserConnector; import java.util.ArrayList; import java.util.List; @@ -49,11 +47,6 @@ public class BedrockProtocol { public static final List SUPPORTED_BEDROCK_CODECS = new ArrayList<>(); static { - if (!GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v440.V440_CODEC.toBuilder() - .minecraftVersion("1.17.0/1.17.1/1.17.2") - .build()); - } SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder() .minecraftVersion("1.17.10/1.17.11") .build()); diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index 94dd0b744..dcc3cb50b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -129,10 +129,10 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } // Fallbacks to prevent errors and allow Bedrock to see the server - if (pong.getMotd() == null || pong.getMotd().trim().isEmpty()) { + if (pong.getMotd() == null || pong.getMotd().isBlank()) { pong.setMotd(GeyserConnector.NAME); } - if (pong.getSubMotd() == null || pong.getSubMotd().trim().isEmpty()) { + if (pong.getSubMotd() == null || pong.getSubMotd().isBlank()) { // Sub-MOTD cannot be empty as of 1.16.210.59 pong.setSubMotd(GeyserConnector.NAME); } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java index 7cf296be2..e165ea545 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java @@ -48,30 +48,18 @@ public class EntityEffectCache { public void setEffect(Effect effect, int effectAmplifier) { switch (effect) { - case CONDUIT_POWER: - conduitPower = effectAmplifier + 1; - break; - case FASTER_DIG: - haste = effectAmplifier + 1; - break; - case SLOWER_DIG: - miningFatigue = effectAmplifier + 1; - break; + case CONDUIT_POWER -> conduitPower = effectAmplifier + 1; + case FASTER_DIG -> haste = effectAmplifier + 1; + case SLOWER_DIG -> miningFatigue = effectAmplifier + 1; } entityEffects.add(effect); } public void removeEffect(Effect effect) { switch (effect) { - case CONDUIT_POWER: - conduitPower = 0; - break; - case FASTER_DIG: - haste = 0; - break; - case SLOWER_DIG: - miningFatigue = 0; - break; + case CONDUIT_POWER -> conduitPower = 0; + case FASTER_DIG -> haste = 0; + case SLOWER_DIG -> miningFatigue = 0; } entityEffects.remove(effect); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java index 53912bf4e..229cba6e7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java @@ -46,26 +46,25 @@ public class BedrockAnimateTranslator extends PacketTranslator { } switch (packet.getAction()) { - case SWING_ARM: + case SWING_ARM -> // Delay so entity damage can be processed first session.scheduleInEventLoop(() -> session.sendDownstreamPacket(new ClientPlayerSwingArmPacket(Hand.MAIN_HAND)), 25, TimeUnit.MILLISECONDS ); - break; // These two might need to be flipped, but my recommendation is getting moving working first - case ROW_LEFT: + case ROW_LEFT -> { // Packet value is a float of how long one has been rowing, so we convert that into a boolean session.setSteeringLeft(packet.getRowingTime() > 0.0); ClientSteerBoatPacket steerLeftPacket = new ClientSteerBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); session.sendDownstreamPacket(steerLeftPacket); - break; - case ROW_RIGHT: + } + case ROW_RIGHT -> { session.setSteeringRight(packet.getRowingTime() > 0.0); ClientSteerBoatPacket steerRightPacket = new ClientSteerBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); session.sendDownstreamPacket(steerRightPacket); - break; + } } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java index f8f503387..4a87776b1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -42,18 +42,14 @@ public class BedrockCommandBlockUpdateTranslator extends PacketTranslator // The green one + CommandBlockMode.SEQUENCE; + case REPEATING -> // The purple one + CommandBlockMode.AUTO; + default -> // NORMAL, the orange one + CommandBlockMode.REDSTONE; + }; boolean isConditional = packet.isConditional(); boolean automatic = !packet.isRedstoneMode(); // Automatic = Always Active option in Java ClientUpdateCommandBlockPacket commandBlockPacket = new ClientUpdateCommandBlockPacket( diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java index c6677dbdc..c1febb795 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java @@ -50,59 +50,30 @@ public class BedrockEntityPickRequestTranslator extends PacketTranslator { // Include type of boat in the name int variant = entity.getMetadata().getInt(EntityData.VARIANT); - String typeOfBoat; - switch (variant) { - case 1: - typeOfBoat = "spruce"; - break; - case 2: - typeOfBoat = "birch"; - break; - case 3: - typeOfBoat = "jungle"; - break; - case 4: - typeOfBoat = "acacia"; - break; - case 5: - typeOfBoat = "dark_oak"; - break; - default: - typeOfBoat = "oak"; - break; - } + String typeOfBoat = switch (variant) { + case 1 -> "spruce"; + case 2 -> "birch"; + case 3 -> "jungle"; + case 4 -> "acacia"; + case 5 -> "dark_oak"; + default -> "oak"; + }; itemName = typeOfBoat + "_boat"; - break; - case LEASH_KNOT: - itemName = "lead"; - break; - case MINECART_CHEST: - case MINECART_COMMAND_BLOCK: - case MINECART_FURNACE: - case MINECART_HOPPER: - case MINECART_TNT: - // Move MINECART to the end of the name - itemName = entity.getEntityType().toString().toLowerCase().replace("minecart_", "") + "_minecart"; - break; - case MINECART_SPAWNER: - // Turns into a normal minecart - itemName = "minecart"; - break; - case ARMOR_STAND: - case END_CRYSTAL: - //case ITEM_FRAME: Not an entity in Bedrock Edition - //case GLOW_ITEM_FRAME: - case MINECART: - case PAINTING: - // No spawn egg, just an item - itemName = entity.getEntityType().toString().toLowerCase(); - break; - default: - itemName = entity.getEntityType().toString().toLowerCase() + "_spawn_egg"; - break; + } + case LEASH_KNOT -> itemName = "lead"; + case MINECART_CHEST, MINECART_COMMAND_BLOCK, MINECART_FURNACE, MINECART_HOPPER, MINECART_TNT -> + // Move MINECART to the end of the name + itemName = entity.getEntityType().toString().toLowerCase().replace("minecart_", "") + "_minecart"; + case MINECART_SPAWNER -> itemName = "minecart"; // Turns into a normal minecart + //case ITEM_FRAME -> Not an entity in Bedrock Edition + //case GLOW_ITEM_FRAME -> + case ARMOR_STAND, END_CRYSTAL, MINECART, PAINTING -> + // No spawn egg, just an item + itemName = entity.getEntityType().toString().toLowerCase(); + default -> itemName = entity.getEntityType().toString().toLowerCase() + "_spawn_egg"; } String fullItemName = "minecraft:" + itemName; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 2de4e4cad..469b70ea0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -108,7 +108,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { // Check to make sure the client isn't spamming interaction // Based on Nukkit 1.0, with changes to ensure holding down still works boolean hasAlreadyClicked = System.currentTimeMillis() - session.getLastInteractionTime() < 110.0 && @@ -155,17 +155,14 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator playerPosition = playerPosition.sub(0, (EntityType.PLAYER.getOffset() - 1.27f), 0); - break; - case SWIMMING: - case FALL_FLYING: // Elytra - case SPIN_ATTACK: // Trident spin attack + case SWIMMING, + FALL_FLYING, // Elytra + SPIN_ATTACK -> // Trident spin attack playerPosition = playerPosition.sub(0, (EntityType.PLAYER.getOffset() - 0.4f), 0); - break; - case SLEEPING: + case SLEEPING -> playerPosition = playerPosition.sub(0, (EntityType.PLAYER.getOffset() - 0.2f), 0); - break; } // else, we don't have to modify the position float diffX = playerPosition.getX() - packet.getBlockPosition().getX(); @@ -248,15 +245,14 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { if (packet.getActions().size() == 1 && packet.getLegacySlots().size() > 0) { InventoryActionData actionData = packet.getActions().get(0); LegacySetItemSlotData slotData = packet.getLegacySlots().get(0); @@ -286,8 +282,8 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { int blockState = session.getGameMode() == GameMode.CREATIVE ? session.getConnector().getWorldManager().getBlockAt(session, packet.getBlockPosition()) : session.getBreakingBlock(); @@ -301,11 +297,11 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator MAXIMUM_BLOCK_DESTROYING_DISTANCE) { restoreCorrectBlock(session, packet.getBlockPosition(), packet); @@ -331,7 +327,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { // Resend the packet so we get the eating sounds session.sendUpstreamPacket(packet); return; - case COMPLETE_TRADE: + } + case COMPLETE_TRADE -> { ClientSelectTradePacket selectTradePacket = new ClientSelectTradePacket(packet.getData()); session.sendDownstreamPacket(selectTradePacket); session.scheduleInEventLoop(() -> { Entity villager = session.getPlayerEntity(); Inventory openInventory = session.getOpenInventory(); - if (openInventory instanceof MerchantContainer) { - MerchantContainer merchantInventory = (MerchantContainer) openInventory; + if (openInventory instanceof MerchantContainer merchantInventory) { VillagerTrade[] trades = merchantInventory.getVillagerTrades(); if (trades != null && packet.getData() >= 0 && packet.getData() < trades.length) { VillagerTrade trade = merchantInventory.getVillagerTrades()[packet.getData()]; @@ -68,6 +68,7 @@ public class BedrockEntityEventTranslator extends PacketTranslator Math.abs((middleX + offset.getX()) - otherBox.getMiddleX()) * 2 < (sizeX + otherBox.getSizeX()); + case Y -> Math.abs((middleY + offset.getY()) - otherBox.getMiddleY()) * 2 < (sizeY + otherBox.getSizeY()); + case Z -> Math.abs((middleZ + offset.getZ()) - otherBox.getMiddleZ()) * 2 < (sizeZ + otherBox.getSizeZ()); + }; } /** @@ -141,21 +137,14 @@ public class BoundingBox implements Cloneable { * @return The distance to move in the direction of {@code side} */ public double getIntersectionSize(BoundingBox otherBoundingBox, Direction side) { - switch (side) { - case DOWN: - return getMax().getY() - otherBoundingBox.getMin().getY(); - case UP: - return otherBoundingBox.getMax().getY() - getMin().getY(); - case NORTH: - return getMax().getZ() - otherBoundingBox.getMin().getZ(); - case SOUTH: - return otherBoundingBox.getMax().getZ() - getMin().getZ(); - case WEST: - return getMax().getX() - otherBoundingBox.getMin().getX(); - case EAST: - return otherBoundingBox.getMax().getX() - getMin().getX(); - } - return 0; + return switch (side) { + case DOWN -> getMax().getY() - otherBoundingBox.getMin().getY(); + case UP -> otherBoundingBox.getMax().getY() - getMin().getY(); + case NORTH -> getMax().getZ() - otherBoundingBox.getMin().getZ(); + case SOUTH -> otherBoundingBox.getMax().getZ() - getMin().getZ(); + case WEST -> getMax().getX() - otherBoundingBox.getMin().getX(); + case EAST -> otherBoundingBox.getMax().getX() - getMin().getX(); + }; } @SneakyThrows(CloneNotSupportedException.class) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index 8ec42d4a9..943682f5c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -31,8 +31,8 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlags; -import com.nukkitx.protocol.bedrock.packet.*; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; +import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; +import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.entity.player.PlayerEntity; @@ -420,13 +420,8 @@ public class CollisionManager { boolean flagsChanged; boolean isSneakingWithScaffolding = (touchingScaffolding || onScaffolding) && session.isSneaking(); - if (session.getUpstream().getProtocolVersion() < Bedrock_v448.V448_CODEC.getProtocolVersion()) { - // Now no longer sent with BDS as of 1.17.10 - flagsChanged = flags.setFlag(EntityFlag.FALL_THROUGH_SCAFFOLDING, isSneakingWithScaffolding); - } else { - flagsChanged = flags.setFlag(EntityFlag.OVER_DESCENDABLE_BLOCK, onScaffolding); - flagsChanged |= flags.setFlag(EntityFlag.IN_ASCENDABLE_BLOCK, touchingScaffolding); - } + flagsChanged = flags.setFlag(EntityFlag.OVER_DESCENDABLE_BLOCK, onScaffolding); + flagsChanged |= flags.setFlag(EntityFlag.IN_ASCENDABLE_BLOCK, touchingScaffolding); flagsChanged |= flags.setFlag(EntityFlag.OVER_SCAFFOLDING, isSneakingWithScaffolding); flagsChanged |= flags.setFlag(EntityFlag.IN_SCAFFOLDING, touchingScaffolding); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java index cdfeec8cf..8fb3e6981 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java @@ -75,18 +75,10 @@ public class DoorCollision extends BlockCollision { int z = blockPos.getZ(); switch (facing) { - case 1: // North - playerCollision.setMiddleZ(z + 0.5125); - break; - case 2: // East - playerCollision.setMiddleX(x + 0.5125); - break; - case 3: // South - playerCollision.setMiddleZ(z + 0.4875); - break; - case 4: // West - playerCollision.setMiddleX(x + 0.4875); - break; + case 1 -> playerCollision.setMiddleZ(z + 0.5125); // North + case 2 -> playerCollision.setMiddleX(x + 0.5125); // East + case 3 -> playerCollision.setMiddleZ(z + 0.4875); // South + case 4 -> playerCollision.setMiddleX(x + 0.4875); // West } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java index 5c7a08834..b6a00982a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java @@ -159,21 +159,14 @@ public abstract class InventoryTranslator { // Some special request that shouldn't be processed normally response = translateSpecialRequest(session, inventory, request); } else { - switch (firstAction.getType()) { - case CRAFT_RECIPE: - response = translateCraftingRequest(session, inventory, request); - break; - case CRAFT_RECIPE_AUTO: - response = translateAutoCraftingRequest(session, inventory, request); - break; - case CRAFT_CREATIVE: - // This is also used for pulling items out of creative - response = translateCreativeRequest(session, inventory, request); - break; - default: - response = translateRequest(session, inventory, request); - break; - } + response = switch (firstAction.getType()) { + case CRAFT_RECIPE -> translateCraftingRequest(session, inventory, request); + case CRAFT_RECIPE_AUTO -> translateAutoCraftingRequest(session, inventory, request); + case CRAFT_CREATIVE -> + // This is also used for pulling items out of creative + translateCreativeRequest(session, inventory, request); + default -> translateRequest(session, inventory, request); + }; } } else { response = rejectRequest(request); @@ -572,7 +565,7 @@ public abstract class InventoryTranslator { } switch (recipe.getType()) { - case CRAFTING_SHAPED: + case CRAFTING_SHAPED -> { ShapedRecipeData shapedData = (ShapedRecipeData) recipe.getData(); ingredients = shapedData.getIngredients(); recipeWidth = shapedData.getWidth(); @@ -580,8 +573,8 @@ public abstract class InventoryTranslator { if (shapedData.getWidth() > gridDimensions || shapedData.getHeight() > gridDimensions) { return rejectRequest(request); } - break; - case CRAFTING_SHAPELESS: + } + case CRAFTING_SHAPELESS -> { ShapelessRecipeData shapelessData = (ShapelessRecipeData) recipe.getData(); ingredients = shapelessData.getIngredients(); recipeWidth = gridDimensions; @@ -589,7 +582,7 @@ public abstract class InventoryTranslator { if (ingredients.length > gridSize) { return rejectRequest(request); } - break; + } } break; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java index 997193091..1aec8bff2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java @@ -179,31 +179,30 @@ public class ClickPlan { private void simulateAction(ClickAction action) { GeyserItemStack cursor = simulating ? getCursor() : session.getPlayerInventory().getCursor(); switch (action.click) { - case LEFT_OUTSIDE: + case LEFT_OUTSIDE -> { setCursor(GeyserItemStack.EMPTY); return; - case RIGHT_OUTSIDE: + } + case RIGHT_OUTSIDE -> { if (!cursor.isEmpty()) { cursor.sub(1); } return; + } } GeyserItemStack clicked = simulating ? getItem(action.slot) : inventory.getItem(action.slot); if (translator.getSlotType(action.slot) == SlotType.OUTPUT) { switch (action.click) { - case LEFT: - case RIGHT: + case LEFT, RIGHT -> { if (cursor.isEmpty() && !clicked.isEmpty()) { setCursor(clicked.copy()); } else if (InventoryUtils.canStack(cursor, clicked)) { cursor.add(clicked.getAmount()); } reduceCraftingGrid(false); - break; - case LEFT_SHIFT: - reduceCraftingGrid(true); - break; + } + case LEFT_SHIFT -> reduceCraftingGrid(true); } } else { switch (action.click) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java index 1f36eaabe..9aef64b36 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java @@ -43,42 +43,32 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case ANVIL_INPUT: - return 0; - case ANVIL_MATERIAL: - return 1; - case ANVIL_RESULT: - case CREATIVE_OUTPUT: - return 2; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case ANVIL_INPUT -> 0; + case ANVIL_MATERIAL -> 1; + case ANVIL_RESULT, CREATIVE_OUTPUT -> 2; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - return new BedrockContainerSlot(ContainerSlotType.ANVIL_INPUT, 1); - case 1: - return new BedrockContainerSlot(ContainerSlotType.ANVIL_MATERIAL, 2); - case 2: - return new BedrockContainerSlot(ContainerSlotType.ANVIL_RESULT, 50); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0 -> new BedrockContainerSlot(ContainerSlotType.ANVIL_INPUT, 1); + case 1 -> new BedrockContainerSlot(ContainerSlotType.ANVIL_MATERIAL, 2); + case 2 -> new BedrockContainerSlot(ContainerSlotType.ANVIL_RESULT, 50); + default -> super.javaSlotToBedrockContainer(slot); + }; } @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 1; - case 1: - return 2; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 1; + case 1 -> 2; + case 2 -> 50; + default -> super.javaSlotToBedrock(slot); + }; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java index c54722849..17baff323 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java @@ -82,33 +82,23 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 1; - case 1: - return 2; - case 2: - return 3; - case 3: - return 0; - case 4: - return 4; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 1; + case 1 -> 2; + case 2 -> 3; + case 3 -> 0; + case 4 -> 4; + default -> super.javaSlotToBedrock(slot); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - case 1: - case 2: - return new BedrockContainerSlot(ContainerSlotType.BREWING_RESULT, javaSlotToBedrock(slot)); - case 3: - return new BedrockContainerSlot(ContainerSlotType.BREWING_INPUT, 0); - case 4: - return new BedrockContainerSlot(ContainerSlotType.BREWING_FUEL, 4); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0, 1, 2 -> new BedrockContainerSlot(ContainerSlotType.BREWING_RESULT, javaSlotToBedrock(slot)); + case 3 -> new BedrockContainerSlot(ContainerSlotType.BREWING_INPUT, 0); + case 4 -> new BedrockContainerSlot(ContainerSlotType.BREWING_FUEL, 4); + default -> super.javaSlotToBedrockContainer(slot); + }; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java index 76bf21bd3..ef00f9343 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java @@ -59,42 +59,32 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case CARTOGRAPHY_INPUT: - return 0; - case CARTOGRAPHY_ADDITIONAL: - return 1; - case CARTOGRAPHY_RESULT: - case CREATIVE_OUTPUT: - return 2; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case CARTOGRAPHY_INPUT -> 0; + case CARTOGRAPHY_ADDITIONAL -> 1; + case CARTOGRAPHY_RESULT, CREATIVE_OUTPUT -> 2; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - return new BedrockContainerSlot(ContainerSlotType.CARTOGRAPHY_INPUT, 12); - case 1: - return new BedrockContainerSlot(ContainerSlotType.CARTOGRAPHY_ADDITIONAL, 13); - case 2: - return new BedrockContainerSlot(ContainerSlotType.CARTOGRAPHY_RESULT, 50); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0 -> new BedrockContainerSlot(ContainerSlotType.CARTOGRAPHY_INPUT, 12); + case 1 -> new BedrockContainerSlot(ContainerSlotType.CARTOGRAPHY_ADDITIONAL, 13); + case 2 -> new BedrockContainerSlot(ContainerSlotType.CARTOGRAPHY_RESULT, 50); + default -> super.javaSlotToBedrockContainer(slot); + }; } @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 12; - case 1: - return 13; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 12; + case 1 -> 13; + case 2 -> 50; + default -> super.javaSlotToBedrock(slot); + }; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java index 65364e147..a71594153 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java @@ -38,41 +38,31 @@ public class GrindstoneInventoryTranslator extends AbstractBlockInventoryTransla @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case GRINDSTONE_INPUT: - return 0; - case GRINDSTONE_ADDITIONAL: - return 1; - case GRINDSTONE_RESULT: - case CREATIVE_OUTPUT: - return 2; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case GRINDSTONE_INPUT -> 0; + case GRINDSTONE_ADDITIONAL -> 1; + case GRINDSTONE_RESULT, CREATIVE_OUTPUT -> 2; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - return new BedrockContainerSlot(ContainerSlotType.GRINDSTONE_INPUT, 16); - case 1: - return new BedrockContainerSlot(ContainerSlotType.GRINDSTONE_ADDITIONAL, 17); - case 2: - return new BedrockContainerSlot(ContainerSlotType.GRINDSTONE_RESULT, 50); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0 -> new BedrockContainerSlot(ContainerSlotType.GRINDSTONE_INPUT, 16); + case 1 -> new BedrockContainerSlot(ContainerSlotType.GRINDSTONE_ADDITIONAL, 17); + case 2 -> new BedrockContainerSlot(ContainerSlotType.GRINDSTONE_RESULT, 50); + default -> super.javaSlotToBedrockContainer(slot); + }; } @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 16; - case 1: - return 17; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 16; + case 1 -> 17; + case 2 -> 50; + default -> super.javaSlotToBedrock(slot); + }; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java index ec8f33f2e..c6909ec9f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java @@ -125,10 +125,9 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // TODO: I anticipate this will be changed in the future to use something non-deprecated. Keep an eye out. StackRequestActionData data = request.getActions()[1]; - if (!(data instanceof CraftResultsDeprecatedStackRequestActionData)) { + if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { return rejectRequest(request); } - CraftResultsDeprecatedStackRequestActionData craftData = (CraftResultsDeprecatedStackRequestActionData) data; // Get the patterns compound tag List newBlockEntityTag = craftData.getResultItems()[0].getTag().getList("Patterns", NbtType.COMPOUND); @@ -177,48 +176,35 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case LOOM_INPUT: - return 0; - case LOOM_DYE: - return 1; - case LOOM_MATERIAL: - return 2; - case LOOM_RESULT: - case CREATIVE_OUTPUT: - return 3; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case LOOM_INPUT -> 0; + case LOOM_DYE -> 1; + case LOOM_MATERIAL -> 2; + case LOOM_RESULT, CREATIVE_OUTPUT -> 3; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - return new BedrockContainerSlot(ContainerSlotType.LOOM_INPUT, 9); - case 1: - return new BedrockContainerSlot(ContainerSlotType.LOOM_DYE, 10); - case 2: - return new BedrockContainerSlot(ContainerSlotType.LOOM_MATERIAL, 11); - case 3: - return new BedrockContainerSlot(ContainerSlotType.LOOM_RESULT, 50); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0 -> new BedrockContainerSlot(ContainerSlotType.LOOM_INPUT, 9); + case 1 -> new BedrockContainerSlot(ContainerSlotType.LOOM_DYE, 10); + case 2 -> new BedrockContainerSlot(ContainerSlotType.LOOM_MATERIAL, 11); + case 3 -> new BedrockContainerSlot(ContainerSlotType.LOOM_RESULT, 50); + default -> super.javaSlotToBedrockContainer(slot); + }; } @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 9; - case 1: - return 10; - case 2: - return 11; - case 3: - return 50; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 9; + case 1 -> 10; + case 2 -> 11; + case 3 -> 50; + default -> super.javaSlotToBedrock(slot); + }; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java index 736568868..63531ba8a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java @@ -56,42 +56,32 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 4; - case 1: - return 5; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 4; + case 1 -> 5; + case 2 -> 50; + default -> super.javaSlotToBedrock(slot); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - return new BedrockContainerSlot(ContainerSlotType.TRADE2_INGREDIENT1, 4); - case 1: - return new BedrockContainerSlot(ContainerSlotType.TRADE2_INGREDIENT2, 5); - case 2: - return new BedrockContainerSlot(ContainerSlotType.TRADE2_RESULT, 50); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0 -> new BedrockContainerSlot(ContainerSlotType.TRADE2_INGREDIENT1, 4); + case 1 -> new BedrockContainerSlot(ContainerSlotType.TRADE2_INGREDIENT2, 5); + case 2 -> new BedrockContainerSlot(ContainerSlotType.TRADE2_RESULT, 50); + default -> super.javaSlotToBedrockContainer(slot); + }; } @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case TRADE2_INGREDIENT1: - return 0; - case TRADE2_INGREDIENT2: - return 1; - case TRADE2_RESULT: - case CREATIVE_OUTPUT: - return 2; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case TRADE2_INGREDIENT1 -> 0; + case TRADE2_INGREDIENT2 -> 1; + case TRADE2_RESULT, CREATIVE_OUTPUT -> 2; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java index adde2b26f..f52a3053d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java @@ -218,8 +218,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { IntSet affectedSlots = new IntOpenHashSet(); for (StackRequestActionData action : request.getActions()) { switch (action.getType()) { - case TAKE: - case PLACE: { + case TAKE, PLACE -> { TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action; if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) { return rejectRequest(request); @@ -265,9 +264,8 @@ public class PlayerInventoryTranslator extends InventoryTranslator { affectedSlots.add(sourceSlot); affectedSlots.add(destSlot); } - break; } - case SWAP: { + case SWAP -> { SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action; if (!(checkNetId(session, inventory, swapAction.getSource()) && checkNetId(session, inventory, swapAction.getDestination()))) { return rejectRequest(request); @@ -306,9 +304,8 @@ public class PlayerInventoryTranslator extends InventoryTranslator { affectedSlots.add(sourceSlot); affectedSlots.add(destSlot); } - break; } - case DROP: { + case DROP -> { DropStackRequestActionData dropAction = (DropStackRequestActionData) action; if (!checkNetId(session, inventory, dropAction.getSource())) { return rejectRequest(request); @@ -334,9 +331,8 @@ public class PlayerInventoryTranslator extends InventoryTranslator { session.sendDownstreamPacket(creativeDropPacket); sourceItem.sub(dropAction.getCount()); - break; } - case DESTROY: { + case DESTROY -> { // Only called when a creative client wants to destroy an item... I think - Camotoy DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action; if (!checkNetId(session, inventory, destroyAction.getSource())) { @@ -356,11 +352,11 @@ public class PlayerInventoryTranslator extends InventoryTranslator { // Just sync up the item on our end, since the server doesn't care what's in our cursor playerInv.getCursor().sub(destroyAction.getCount()); } - break; } - default: + default -> { session.getConnector().getLogger().error("Unknown crafting state induced by " + session.getName()); return rejectRequest(request); + } } } for (int slot : affectedSlots) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java index dbe04f68b..8b30be406 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java @@ -38,41 +38,31 @@ public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslato @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case SMITHING_TABLE_INPUT: - return 0; - case SMITHING_TABLE_MATERIAL: - return 1; - case SMITHING_TABLE_RESULT: - case CREATIVE_OUTPUT: - return 2; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case SMITHING_TABLE_INPUT -> 0; + case SMITHING_TABLE_MATERIAL -> 1; + case SMITHING_TABLE_RESULT, CREATIVE_OUTPUT -> 2; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override public BedrockContainerSlot javaSlotToBedrockContainer(int slot) { - switch (slot) { - case 0: - return new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_INPUT, 51); - case 1: - return new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_MATERIAL, 52); - case 2: - return new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_RESULT, 50); - } - return super.javaSlotToBedrockContainer(slot); + return switch (slot) { + case 0 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_INPUT, 51); + case 1 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_MATERIAL, 52); + case 2 -> new BedrockContainerSlot(ContainerSlotType.SMITHING_TABLE_RESULT, 50); + default -> super.javaSlotToBedrockContainer(slot); + }; } @Override public int javaSlotToBedrock(int slot) { - switch (slot) { - case 0: - return 51; - case 1: - return 52; - case 2: - return 50; - } - return super.javaSlotToBedrock(slot); + return switch (slot) { + case 0 -> 51; + case 1 -> 52; + case 2 -> 50; + default -> super.javaSlotToBedrock(slot); + }; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java index e4dea7265..d6bbe7d5d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java @@ -61,10 +61,9 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // TODO: Also surely to change in the future StackRequestActionData data = request.getActions()[1]; - if (!(data instanceof CraftResultsDeprecatedStackRequestActionData)) { + if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { return rejectRequest(request); } - CraftResultsDeprecatedStackRequestActionData craftData = (CraftResultsDeprecatedStackRequestActionData) data; StonecutterContainer container = (StonecutterContainer) inventory; // Get the ID of the item we are cutting @@ -94,14 +93,11 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl @Override public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) { - switch (slotInfoData.getContainer()) { - case STONECUTTER_INPUT: - return 0; - case STONECUTTER_RESULT: - case CREATIVE_OUTPUT: - return 1; - } - return super.bedrockSlotToJava(slotInfoData); + return switch (slotInfoData.getContainer()) { + case STONECUTTER_INPUT -> 0; + case STONECUTTER_RESULT, CREATIVE_OUTPUT -> 1; + default -> super.bedrockSlotToJava(slotInfoData); + }; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index ec55bc48c..9fcf984cd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -299,8 +299,7 @@ public abstract class ItemTranslator { return ((StringTag) tag).getValue(); } - if (tag instanceof ListTag) { - ListTag listTag = (ListTag) tag; + if (tag instanceof ListTag listTag) { List tagList = new ArrayList<>(); for (Tag value : listTag) { @@ -313,8 +312,7 @@ public abstract class ItemTranslator { return new NbtList(type, tagList); } - if (tag instanceof CompoundTag) { - CompoundTag compoundTag = (CompoundTag) tag; + if (tag instanceof CompoundTag compoundTag) { return translateNbtToBedrock(compoundTag); } @@ -390,8 +388,7 @@ public abstract class ItemTranslator { return new ListTag(name, tags); } - if (object instanceof NbtMap) { - NbtMap map = (NbtMap) object; + if (object instanceof NbtMap map) { return translateToJavaNBT(name, map); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java index 208db0987..f1bf69f64 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java @@ -49,11 +49,9 @@ public class BookPagesTranslator extends NbtItemStackTranslator { List pages = new ArrayList<>(); ListTag pagesTag = itemTag.get("pages"); for (Tag tag : pagesTag.getValue()) { - if (!(tag instanceof StringTag)) + if (!(tag instanceof StringTag textTag)) continue; - StringTag textTag = (StringTag) tag; - CompoundTag pageTag = new CompoundTag(""); pageTag.put(new StringTag("photoname", "")); pageTag.put(new StringTag("text", MessageTranslator.convertMessageLenient(textTag.getValue()))); @@ -72,11 +70,9 @@ public class BookPagesTranslator extends NbtItemStackTranslator { List pages = new ArrayList<>(); ListTag pagesTag = itemTag.get("pages"); for (Tag tag : pagesTag.getValue()) { - if (!(tag instanceof CompoundTag)) + if (!(tag instanceof CompoundTag pageTag)) continue; - CompoundTag pageTag = (CompoundTag) tag; - StringTag textTag = pageTag.get("text"); pages.add(new StringTag("", textTag.getValue())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java index 58caad3f1..6d7ab4de6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java @@ -82,10 +82,9 @@ public class EnchantmentTranslator extends NbtItemStackTranslator { List enchantments = new ArrayList<>(); List storedEnchantments = new ArrayList<>(); for (Tag value : enchantmentTag.getValue()) { - if (!(value instanceof CompoundTag)) + if (!(value instanceof CompoundTag tagValue)) continue; - CompoundTag tagValue = (CompoundTag) value; ShortTag bedrockId = tagValue.get("id"); if (bedrockId == null) continue; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java index e059517d7..57e473267 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java @@ -41,20 +41,12 @@ public class JavaChatTranslator extends PacketTranslator { textPacket.setPlatformChatId(""); textPacket.setSourceName(""); textPacket.setXuid(session.getAuthData().getXboxUUID()); - switch (packet.getType()) { - case CHAT: - textPacket.setType(TextPacket.Type.CHAT); - break; - case SYSTEM: - textPacket.setType(TextPacket.Type.SYSTEM); - break; - case NOTIFICATION: - textPacket.setType(TextPacket.Type.TIP); - break; - default: - textPacket.setType(TextPacket.Type.RAW); - break; - } + textPacket.setType(switch (packet.getType()) { + case CHAT -> TextPacket.Type.CHAT; + case SYSTEM -> TextPacket.Type.SYSTEM; + case NOTIFICATION -> TextPacket.Type.TIP; + default -> TextPacket.Type.RAW; + }); textPacket.setNeedsTranslation(false); textPacket.setMessage(MessageTranslator.convertMessage(packet.getMessage(), session.getLocale())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index e4116c6aa..996619eac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -204,67 +204,25 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator=", "==", etc - return CommandParam.OPERATOR; - - case BLOCK_STATE: - return BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.get().keySet().toArray(new String[0]); - - case ITEM_STACK: - return session.getItemMappings().getItemNames(); - - case ITEM_ENCHANTMENT: - return Enchantment.JavaEnchantment.ALL_JAVA_IDENTIFIERS; - - case ENTITY_SUMMON: - return EntityType.ALL_JAVA_IDENTIFIERS; - - case COLOR: - return VALID_COLORS; - - case SCOREBOARD_SLOT: - return VALID_SCOREBOARD_SLOTS; - - default: - return CommandParam.STRING; - } + return switch (parser) { + case FLOAT, ROTATION, DOUBLE -> CommandParam.FLOAT; + case INTEGER, LONG -> CommandParam.INT; + case ENTITY, GAME_PROFILE -> CommandParam.TARGET; + case BLOCK_POS -> CommandParam.BLOCK_POSITION; + case COLUMN_POS, VEC3 -> CommandParam.POSITION; + case MESSAGE -> CommandParam.MESSAGE; + case NBT, NBT_COMPOUND_TAG, NBT_TAG, NBT_PATH -> CommandParam.JSON; + case RESOURCE_LOCATION, FUNCTION -> CommandParam.FILE_PATH; + case BOOL -> ENUM_BOOLEAN; + case OPERATION -> CommandParam.OPERATOR; // ">=", "==", etc + case BLOCK_STATE -> BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.get().keySet().toArray(new String[0]); + case ITEM_STACK -> session.getItemMappings().getItemNames(); + case ITEM_ENCHANTMENT -> Enchantment.JavaEnchantment.ALL_JAVA_IDENTIFIERS; + case ENTITY_SUMMON -> EntityType.ALL_JAVA_IDENTIFIERS; + case COLOR -> VALID_COLORS; + case SCOREBOARD_SLOT -> VALID_SCOREBOARD_SLOTS; + default -> CommandParam.STRING; + }; } @Getter diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java index fd534759b..8d01470e0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java @@ -82,7 +82,7 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator { ShapelessRecipeData shapelessRecipeData = (ShapelessRecipeData) recipe.getData(); ItemData output = ItemTranslator.translateToBedrock(session, shapelessRecipeData.getResult()); // Strip NBT - tools won't appear in the recipe book otherwise @@ -94,9 +94,8 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator { ShapedRecipeData shapedRecipeData = (ShapedRecipeData) recipe.getData(); ItemData output = ItemTranslator.translateToBedrock(session, shapedRecipeData.getResult()); // See above @@ -106,12 +105,11 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator { StoneCuttingRecipeData stoneCuttingData = (StoneCuttingRecipeData) recipe.getData(); ItemStack ingredient = stoneCuttingData.getIngredient().getOptions()[0]; List data = unsortedStonecutterData.get(ingredient.getId()); @@ -121,14 +119,12 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator { List craftingData = recipeTypes.get(recipe.getType()); if (craftingData != null) { craftingDataPacket.getCraftingData().addAll(craftingData); } - break; } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java index 5dc015418..f297f1a38 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java @@ -50,7 +50,7 @@ public class JavaEntityEquipmentTranslator extends PacketTranslator { livingEntity.setHelmet(item); armorUpdated = true; - break; - case CHESTPLATE: + } + case CHESTPLATE -> { livingEntity.setChestplate(item); armorUpdated = true; - break; - case LEGGINGS: + } + case LEGGINGS -> { livingEntity.setLeggings(item); armorUpdated = true; - break; - case BOOTS: + } + case BOOTS -> { livingEntity.setBoots(item); armorUpdated = true; - break; - case MAIN_HAND: + } + case MAIN_HAND -> { livingEntity.setHand(item); mainHandUpdated = true; - break; - case OFF_HAND: + } + case OFF_HAND -> { livingEntity.setOffHand(item); offHandUpdated = true; - break; + } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java index 3e9fa0755..da282648b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java @@ -124,14 +124,10 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator { entity.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 181.0f); entity.updateBedrockMetadata(session); - break; + } } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java index 45d801c3d..8eafdd8bb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java @@ -211,8 +211,7 @@ public class JavaEntityStatusTranslator extends PacketTranslator { PlayerEntity playerEntity; boolean self = entry.getProfile().getId().equals(session.getPlayerEntity().getUuid()); @@ -90,8 +90,8 @@ public class JavaPlayerListEntryTranslator extends PacketTranslator { // As the player entity is no longer present, we can remove the entry PlayerEntity entity = session.getEntityCache().removePlayerEntity(entry.getProfile().getId()); if (entity != null) { @@ -105,7 +105,7 @@ public class JavaPlayerListEntryTranslator extends PacketTranslator objective.setDisplayName(MessageTranslator.convertMessage(packet.getDisplayName())) + .setType(packet.getType().ordinal()); + case REMOVE -> scoreboard.unregisterObjective(packet.getName()); } if (objective == null || !objective.isActive()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index 6ec4813d4..d8d2273b9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -57,15 +57,13 @@ public class JavaTeamTranslator extends PacketTranslator { Scoreboard scoreboard = session.getWorldCache().getScoreboard(); Team team = scoreboard.getTeam(packet.getTeamName()); switch (packet.getAction()) { - case CREATE: - scoreboard.registerNewTeam(packet.getTeamName(), toPlayerSet(packet.getPlayers())) - .setName(MessageTranslator.convertMessage(packet.getDisplayName())) - .setColor(packet.getColor()) - .setNameTagVisibility(packet.getNameTagVisibility()) - .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) - .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); - break; - case UPDATE: + case CREATE -> scoreboard.registerNewTeam(packet.getTeamName(), toPlayerSet(packet.getPlayers())) + .setName(MessageTranslator.convertMessage(packet.getDisplayName())) + .setColor(packet.getColor()) + .setNameTagVisibility(packet.getNameTagVisibility()) + .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) + .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); + case UPDATE -> { if (team == null) { LOGGER.debug(LanguageUtils.getLocaleStringLog( "geyser.network.translator.team.failed_not_registered", @@ -80,8 +78,8 @@ public class JavaTeamTranslator extends PacketTranslator { .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())) .setUpdateType(UpdateType.UPDATE); - break; - case ADD_PLAYER: + } + case ADD_PLAYER -> { if (team == null) { LOGGER.debug(LanguageUtils.getLocaleStringLog( "geyser.network.translator.team.failed_not_registered", @@ -90,8 +88,8 @@ public class JavaTeamTranslator extends PacketTranslator { return; } team.addEntities(packet.getPlayers()); - break; - case REMOVE_PLAYER: + } + case REMOVE_PLAYER -> { if (team == null) { LOGGER.debug(LanguageUtils.getLocaleStringLog( "geyser.network.translator.team.failed_not_registered", @@ -100,10 +98,8 @@ public class JavaTeamTranslator extends PacketTranslator { return; } team.removeEntities(packet.getPlayers()); - break; - case REMOVE: - scoreboard.removeTeam(packet.getTeamName()); - break; + } + case REMOVE -> scoreboard.removeTeam(packet.getTeamName()); } // ScoreboardUpdater will handle it for us if the packets per second diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java index 1a2b5e469..da2e74604 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java @@ -53,40 +53,20 @@ public class JavaBlockBreakAnimTranslator extends PacketTranslator levelEventPacket.setData(breakTime); + case STAGE_2 -> levelEventPacket.setData(breakTime * 2); + case STAGE_3 -> levelEventPacket.setData(breakTime * 3); + case STAGE_4 -> levelEventPacket.setData(breakTime * 4); + case STAGE_5 -> levelEventPacket.setData(breakTime * 5); + case STAGE_6 -> levelEventPacket.setData(breakTime * 6); + case STAGE_7 -> levelEventPacket.setData(breakTime * 7); + case STAGE_8 -> levelEventPacket.setData(breakTime * 8); + case STAGE_9 -> levelEventPacket.setData(breakTime * 9); + case STAGE_10 -> levelEventPacket.setData(breakTime * 10); + case RESET -> { levelEventPacket.setType(LevelEventType.BLOCK_STOP_BREAK); levelEventPacket.setData(0); - break; + } } session.sendUpstreamPacket(levelEventPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java index 2f46ed6e6..4f4215cf7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java @@ -52,8 +52,7 @@ public class JavaBlockValueTranslator extends PacketTranslator 0 ? 1 : 0); session.sendUpstreamPacket(blockEventPacket); @@ -62,9 +61,9 @@ public class JavaBlockValueTranslator extends PacketTranslator 0; // north + case 4 -> 1; // east + case 5 -> 3;// west + default -> bellValue.getValue(); // south (2) is identical + }; builder.putInt("Direction", bedrockRingDirection); builder.putByte("Ringing", (byte) 1); builder.putInt("Ticks", 0); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java index 1cdc09a75..282712172 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java @@ -125,16 +125,16 @@ public class JavaNotifyClientTranslator extends PacketTranslator { ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); - break; - case FIRST_TIME: + } + case FIRST_TIME -> { ShowCreditsPacket showCreditsPacket = new ShowCreditsPacket(); showCreditsPacket.setStatus(ShowCreditsPacket.Status.START_CREDITS); showCreditsPacket.setRuntimeEntityId(entity.getGeyserId()); session.sendUpstreamPacket(showCreditsPacket); - break; + } } break; case AFFECTED_BY_ELDER_GUARDIAN: diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java index aca7a1f93..e29fd437f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java @@ -80,34 +80,28 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH); ComposterEffectData composterEffectData = (ComposterEffectData) packet.getData(); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); switch (composterEffectData) { - case FILL: - soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL); - break; - case FILL_SUCCESS: - soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL_LAYER); - break; + case FILL -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL); + case FILL_SUCCESS -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL_LAYER); } soundEventPacket.setPosition(pos); soundEventPacket.setIdentifier(""); @@ -115,9 +109,8 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE); effectPacket.setPosition(pos.add(-0.5f, 0.7f, -0.5f)); @@ -129,9 +122,8 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE); effectPacket.setPosition(pos.add(-0.5f, 0, -0.5f)); @@ -143,9 +135,8 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE); effectPacket.setPosition(pos.add(-0.5f, 0.3125f, -0.5f)); @@ -157,53 +148,50 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_SHOOT); SmokeEffectData smokeEffectData = (SmokeEffectData) packet.getData(); int data = 0; switch (smokeEffectData) { - case DOWN: + case DOWN -> { data = 4; pos = pos.add(0, -0.9f, 0); - break; - case UP: + } + case UP -> { data = 4; pos = pos.add(0, 0.5f, 0); - break; - case NORTH: + } + case NORTH -> { data = 1; pos = pos.add(0, -0.2f, -0.7f); - break; - case SOUTH: + } + case SOUTH -> { data = 7; pos = pos.add(0, -0.2f, 0.7f); - break; - case WEST: + } + case WEST -> { data = 3; pos = pos.add(-0.7f, -0.2f, 0); - break; - case EAST: + } + case EAST -> { data = 5; pos = pos.add(0.7f, -0.2f, 0); - break; - + } } effectPacket.setPosition(pos); effectPacket.setData(data); - break; } + //TODO: Block break particles when under fire - case BREAK_BLOCK: { + case BREAK_BLOCK -> { effectPacket.setType(LevelEventType.PARTICLE_DESTROY_BLOCK); BreakBlockEffectData breakBlockEffectData = (BreakBlockEffectData) packet.getData(); effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEffectData.getBlockState())); - break; } - case BREAK_SPLASH_POTION: { + case BREAK_SPLASH_POTION -> { effectPacket.setType(LevelEventType.PARTICLE_POTION_SPLASH); effectPacket.setPosition(pos.add(0, -0.5f, 0)); @@ -218,25 +206,21 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); - break; } - case MOB_SPAWN: { + case MOB_SPAWN -> { effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java - break; } - case BONEMEAL_GROW_WITH_SOUND: // Note that there is no particle without sound in Bedrock. If you wanted to implement the sound, send a PlaySoundPacket with "item.bone_meal.use" and volume and pitch at 1.0F - case BONEMEAL_GROW: { + // Note that there is no particle without sound in Bedrock. If you wanted to implement the sound, send a PlaySoundPacket with "item.bone_meal.use" and volume and pitch at 1.0F + case BONEMEAL_GROW_WITH_SOUND, BONEMEAL_GROW -> { effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH); BonemealGrowEffectData growEffectData = (BonemealGrowEffectData) packet.getData(); effectPacket.setData(growEffectData.getParticleCount()); - break; } - case ENDERDRAGON_FIREBALL_EXPLODE: { + case ENDERDRAGON_FIREBALL_EXPLODE -> { effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); // TODO DragonFireballEffectData fireballEffectData = (DragonFireballEffectData) packet.getData(); @@ -250,19 +234,16 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_GENERIC_SPAWN); effectPacket.setData(61); - break; } - case EVAPORATE: { + case EVAPORATE -> { effectPacket.setType(LevelEventType.PARTICLE_EVAPORATE_WATER); effectPacket.setPosition(pos.add(-0.5f, 0.5f, -0.5f)); - break; } - case END_GATEWAY_SPAWN: { + case END_GATEWAY_SPAWN -> { effectPacket.setType(LevelEventType.PARTICLE_EXPLOSION); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); @@ -273,30 +254,24 @@ public class JavaPlayEffectTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP); - break; } - case ELECTRIC_SPARK: { + case ELECTRIC_SPARK -> { // Matches with a Bedrock server but doesn't seem to match up with Java effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK); - break; } - case WAX_ON: { + case WAX_ON -> { effectPacket.setType(LevelEventType.PARTICLE_WAX_ON); - break; } - case WAX_OFF: { + case WAX_OFF -> { effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF); - break; } - case SCRAPE: { + case SCRAPE -> { effectPacket.setType(LevelEventType.PARTICLE_SCRAPE); - break; } - default: { + default -> { GeyserConnector.getInstance().getLogger().debug("Unhandled particle effect: " + particleEffect.name()); return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java index df17ceada..3efd8e468 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java @@ -82,7 +82,7 @@ public class JavaSpawnParticleTranslator extends PacketTranslator createParticle(GeyserSession session, Particle particle) { switch (particle.getType()) { - case BLOCK: { + case BLOCK -> { int blockState = session.getBlockMappings().getBedrockBlockId(((BlockParticleData) particle.getData()).getBlockState()); return (position) -> { LevelEventPacket packet = new LevelEventPacket(); @@ -92,7 +92,7 @@ public class JavaSpawnParticleTranslator extends PacketTranslator { int blockState = session.getBlockMappings().getBedrockBlockId(((FallingDustParticleData) particle.getData()).getBlockState()); return (position) -> { LevelEventPacket packet = new LevelEventPacket(); @@ -104,7 +104,7 @@ public class JavaSpawnParticleTranslator extends PacketTranslator { ItemStack javaItem = ((ItemParticleData) particle.getData()).getItemStack(); ItemData bedrockItem = ItemTranslator.translateToBedrock(session, javaItem); int data = bedrockItem.getId() << 16 | bedrockItem.getDamage(); @@ -116,8 +116,7 @@ public class JavaSpawnParticleTranslator extends PacketTranslator { //TODO DustParticleData data = (DustParticleData) particle.getData(); int r = (int) (data.getRed() * 255); int g = (int) (data.getGreen() * 255); @@ -131,7 +130,7 @@ public class JavaSpawnParticleTranslator extends PacketTranslator { ParticleMapping particleMapping = Registries.PARTICLES.get(particle.getType()); if (particleMapping == null) { //TODO ensure no particle can be null return null; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java index 8b05d0469..556f8b95d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java @@ -53,12 +53,11 @@ public class JavaTradeListTranslator extends PacketTranslator "minecraft:mountains"; + case "icy" -> "minecraft:ice_spikes"; + case "mesa" -> "minecraft:badlands"; + case "mushroom" -> "minecraft:mushroom_fields"; + case "nether" -> "minecraft:nether_wastes"; + default -> "minecraft:ocean"; // Typically ID 0 so a good default + case "taiga", "jungle", "plains", "savanna", "the_end", "beach", "ocean", "desert", "river", "swamp" -> "minecraft:" + category; + }; bedrockId = Registries.BIOME_IDENTIFIERS.get().getInt(replacementBiome); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java index fe60bd4de..bf62b83aa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java @@ -155,21 +155,12 @@ public class BlockStateValues { if (javaId.contains("wall_skull") || javaId.contains("wall_head")) { String direction = javaId.substring(javaId.lastIndexOf("facing=") + 7); - int rotation = 0; - switch (direction.substring(0, direction.length() - 1)) { - case "north": - rotation = 180; - break; - case "south": - rotation = 0; - break; - case "west": - rotation = 90; - break; - case "east": - rotation = 270; - break; - } + int rotation = switch (direction.substring(0, direction.length() - 1)) { + case "north" -> 180; + case "west" -> 90; + case "east" -> 270; + default -> 0; // Also south + }; SKULL_WALL_DIRECTIONS.put(javaBlockState, rotation); } @@ -405,16 +396,12 @@ public class BlockStateValues { */ public static float getSlipperiness(int state) { String blockIdentifier = BlockRegistries.JAVA_BLOCKS.getOrDefault(state, BlockMapping.AIR).getJavaIdentifier(); - switch (blockIdentifier) { - case "minecraft:slime_block": - return 0.8f; - case "minecraft:ice": - case "minecraft:packed_ice": - return 0.98f; - case "minecraft:blue_ice": - return 0.989f; - } - return 0.6f; + return switch (blockIdentifier) { + case "minecraft:slime_block" -> 0.8f; + case "minecraft:ice", "minecraft:packed_ice" -> 0.98f; + case "minecraft:blue_ice" -> 0.989f; + default -> 0.6f; + }; } private static Direction getBlockDirection(String javaId) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java index 99d9da30d..c22287a4b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java @@ -147,13 +147,8 @@ public class PistonBlockEntity { // Set progress and lastProgress to allow 0 tick pistons to animate switch (action) { - case PUSHING: - progress = 0; - break; - case PULLING: - case CANCELLED_MID_PUSH: - progress = 1; - break; + case PUSHING -> progress = 0; + case PULLING, CANCELLED_MID_PUSH -> progress = 1; } lastProgress = progress; @@ -182,13 +177,8 @@ public class PistonBlockEntity { // Set progress and lastProgress to allow 0 tick pistons to animate switch (action) { - case PUSHING: - progress = 0; - break; - case PULLING: - case CANCELLED_MID_PUSH: - progress = 1; - break; + case PUSHING -> progress = 0; + case PULLING, CANCELLED_MID_PUSH -> progress = 1; } lastProgress = progress; @@ -326,15 +316,11 @@ public class PistonBlockEntity { if (block.getHardness() == -1.0d) { return false; } - switch (block.getPistonBehavior()) { - case BLOCK: - case DESTROY: - return false; - case PUSH_ONLY: // Glazed terracotta can only be pushed - return isPushing; - } - // Pistons can't move block entities - return !block.isBlockEntity(); + return switch (block.getPistonBehavior()) { + case BLOCK, DESTROY -> false; + case PUSH_ONLY -> isPushing; // Glazed terracotta can only be pushed + default -> !block.isBlockEntity(); // Pistons can't move block entities + }; } /** @@ -723,21 +709,20 @@ public class PistonBlockEntity { */ private void updateProgress() { switch (action) { - case PUSHING: + case PUSHING -> { lastProgress = progress; progress += 0.5f; if (progress >= 1.0f) { progress = 1.0f; } - break; - case CANCELLED_MID_PUSH: - case PULLING: + } + case CANCELLED_MID_PUSH, PULLING -> { lastProgress = progress; progress -= 0.5f; if (progress <= 0.0f) { progress = 0.0f; } - break; + } } } @@ -745,14 +730,10 @@ public class PistonBlockEntity { * @return True if the piston has finished its movement, otherwise false */ public boolean isDone() { - switch (action) { - case PUSHING: - return progress == 1.0f && lastProgress == 1.0f; - case PULLING: - case CANCELLED_MID_PUSH: - return progress == 0.0f && lastProgress == 0.0f; - } - return true; + return switch (action) { + case PUSHING -> progress == 1.0f && lastProgress == 1.0f; + case PULLING, CANCELLED_MID_PUSH -> progress == 0.0f && lastProgress == 0.0f; + }; } public boolean canBeRemoved() { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java index 0551386c5..6e3cfc45b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java @@ -41,59 +41,24 @@ public class SignBlockEntityTranslator extends BlockEntityTranslator { */ private int getBedrockSignColor(String javaColor) { //TODO create a DyeColor class and combine with FireworkColor??? - int dyeColor; - switch (javaColor) { - case "white": - dyeColor = 16383998; - break; - case "orange": - dyeColor = 16351261; - break; - case "magenta": - dyeColor = 13061821; - break; - case "light_blue": - dyeColor = 3847130; - break; - case "yellow": - dyeColor = 16701501; - break; - case "lime": - dyeColor = 8439583; - break; - case "pink": - dyeColor = 15961002; - break; - case "gray": - dyeColor = 4673362; - break; - case "light_gray": - dyeColor = 10329495; - break; - case "cyan": - dyeColor = 1481884; - break; - case "purple": - dyeColor = 8991416; - break; - case "blue": - dyeColor = 3949738; - break; - case "brown": - dyeColor = 8606770; - break; - case "green": - dyeColor = 6192150; - break; - case "red": - dyeColor = 11546150; - break; - case "black": - default: - // The proper Java color is 1908001, but this does not render well with glow text. - dyeColor = 0; - break; - } + int dyeColor = switch (javaColor) { + case "white" -> 16383998; + case "orange" -> 16351261; + case "magenta" -> 13061821; + case "light_blue" -> 3847130; + case "yellow" -> 16701501; + case "lime" -> 8439583; + case "pink" -> 15961002; + case "gray" -> 4673362; + case "light_gray" -> 10329495; + case "cyan" -> 1481884; + case "purple" -> 8991416; + case "blue" -> 3949738; + case "brown" -> 8606770; + case "green" -> 6192150; + case "red" -> 11546150; + default -> 0; // The proper Java color is 1908001, but this does not render well with glow text. + }; // Add the transparency of the color, too. return dyeColor | (255 << 24); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index c5551651b..90458ca71 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -99,22 +99,10 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements y += 0.25f; rotation = BlockStateValues.getSkullWallDirections().get(blockState); switch ((int) rotation) { - case 180: - // North - z += 0.24f; - break; - case 0: - // South - z -= 0.24f; - break; - case 90: - // West - x += 0.24f; - break; - case 270: - // East - x -= 0.24f; - break; + case 180 -> z += 0.24f; // North + case 0 -> z -= 0.24f; // South + case 90 -> x += 0.24f; // West + case 270 -> x -= 0.24f; // East } } else { rotation = (180f + (floorRotation * 22.5f)) % 360; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java index 22070ee7a..4e44ac095 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java @@ -58,22 +58,20 @@ public class SoundEffectsRegistryLoader extends EffectRegistryLoader { javaEffect = SoundEffect.valueOf(entry.getKey()); LevelEventType levelEventType = LevelEventType.valueOf(node.get("name").asText()); int data = node.has("data") ? node.get("data").intValue() : 0; effect = new SoundLevelEffect(levelEventType, data); - break; } - case "soundEvent": { + case "soundEvent" -> { javaEffect = SoundEffect.valueOf(entry.getKey()); SoundEvent soundEvent = SoundEvent.valueOf(node.get("name").asText()); String identifier = node.has("identifier") ? node.get("identifier").asText() : ""; int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1; effect = new SoundEventEffect(soundEvent, identifier, extraData); - break; } - case "playSound": { + case "playSound" -> { javaEffect = SoundEffect.valueOf(entry.getKey()); String name = node.get("name").asText(); float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f; @@ -82,7 +80,6 @@ public class SoundEffectsRegistryLoader extends EffectRegistryLoader> stateMapperBuilder = ImmutableMap.>builder() .put("1_17_10", (bedrockIdentifier, statesBuilder) -> null); - if (!GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - stateMapperBuilder.put("1_17_0", (bedrockIdentifier, statesBuilder) -> { - if (bedrockIdentifier.contains("candle")) { - // Replace candles with sea pickles or cake - if (bedrockIdentifier.contains("cake")) { - statesBuilder.remove("lit"); - statesBuilder.putInt("bite_counter", 0); - return "minecraft:cake"; - } else { - statesBuilder.put("cluster_count", statesBuilder.remove("candles")); - statesBuilder.putBoolean("dead_bit", ((byte) (statesBuilder.remove("lit"))) != 0); - return "minecraft:sea_pickle"; - } - } - return null; - }); - } STATE_MAPPER = stateMapperBuilder.build(); PALETTE_VERSIONS = new Object2IntOpenHashMap<>(); - if (!GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - PALETTE_VERSIONS.put("1_17_0", Bedrock_v440.V440_CODEC.getProtocolVersion()); - } PALETTE_VERSIONS.put("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion()); } @@ -159,17 +138,10 @@ public class BlockRegistryPopulator { } switch (javaId) { - case "minecraft:air": - airRuntimeId = bedrockRuntimeId; - break; - case "minecraft:water[level=0]": - waterRuntimeId = bedrockRuntimeId; - break; - case "minecraft:command_block[conditional=false,facing=north]": - commandBlockRuntimeId = bedrockRuntimeId; - break; - case "minecraft:moving_piston[facing=north,type=normal]": - movingBlockRuntimeId = bedrockRuntimeId; + case "minecraft:air" -> airRuntimeId = bedrockRuntimeId; + case "minecraft:water[level=0]" -> waterRuntimeId = bedrockRuntimeId; + case "minecraft:command_block[conditional=false,facing=north]" -> commandBlockRuntimeId = bedrockRuntimeId; + case "minecraft:moving_piston[facing=north,type=normal]" -> movingBlockRuntimeId = bedrockRuntimeId; } if (javaId.contains("jigsaw")) { @@ -414,14 +386,9 @@ public class BlockRegistryPopulator { Map.Entry stateEntry = statesIterator.next(); JsonNode stateValue = stateEntry.getValue(); switch (stateValue.getNodeType()) { - case BOOLEAN: - statesBuilder.putBoolean(stateEntry.getKey(), stateValue.booleanValue()); - continue; - case STRING: - statesBuilder.putString(stateEntry.getKey(), stateValue.textValue()); - continue; - case NUMBER: - statesBuilder.putInt(stateEntry.getKey(), stateValue.intValue()); + case BOOLEAN -> statesBuilder.putBoolean(stateEntry.getKey(), stateValue.booleanValue()); + case STRING -> statesBuilder.putString(stateEntry.getKey(), stateValue.textValue()); + case NUMBER -> statesBuilder.putInt(stateEntry.getKey(), stateValue.intValue()); } } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 967424017..6657442e9 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -35,7 +35,6 @@ 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.v440.Bedrock_v440; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -67,27 +66,6 @@ public class ItemRegistryPopulator { if (GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { PALETTE_VERSIONS.put("1_17_10.caves_and_cliffs", new PaletteVersion(Bedrock_v448.V448_CODEC.getProtocolVersion(), Collections.emptyMap())); } else { - PALETTE_VERSIONS.put("1_17_0", new PaletteVersion(Bedrock_v440.V440_CODEC.getProtocolVersion(), new Object2ObjectOpenHashMap() { - { - put("minecraft:candle", "minecraft:sea_pickle"); - put("minecraft:white_candle", "minecraft:sea_pickle"); - put("minecraft:orange_candle", "minecraft:sea_pickle"); - put("minecraft:magenta_candle", "minecraft:sea_pickle"); - put("minecraft:light_blue_candle", "minecraft:sea_pickle"); - put("minecraft:yellow_candle", "minecraft:sea_pickle"); - put("minecraft:lime_candle", "minecraft:sea_pickle"); - put("minecraft:pink_candle", "minecraft:sea_pickle"); - put("minecraft:gray_candle", "minecraft:sea_pickle"); - put("minecraft:light_gray_candle", "minecraft:sea_pickle"); - put("minecraft:cyan_candle", "minecraft:sea_pickle"); - put("minecraft:purple_candle", "minecraft:sea_pickle"); - put("minecraft:blue_candle", "minecraft:sea_pickle"); - put("minecraft:brown_candle", "minecraft:sea_pickle"); - put("minecraft:green_candle", "minecraft:sea_pickle"); - put("minecraft:red_candle", "minecraft:sea_pickle"); - put("minecraft:black_candle", "minecraft:sea_pickle"); - } - })); PALETTE_VERSIONS.put("1_17_10", new PaletteVersion(Bedrock_v448.V448_CODEC.getProtocolVersion(), Collections.emptyMap())); } } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java index f4b895350..72f70b9d8 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java @@ -76,25 +76,19 @@ public final class Objective { } private static String translateDisplaySlot(ScoreboardPosition displaySlot) { - switch (displaySlot) { - case BELOW_NAME: - return "belowname"; - case PLAYER_LIST: - return "list"; - default: - return "sidebar"; - } + return switch (displaySlot) { + case BELOW_NAME -> "belowname"; + case PLAYER_LIST -> "list"; + default -> "sidebar"; + }; } private static ScoreboardPosition correctDisplaySlot(ScoreboardPosition displaySlot) { - switch (displaySlot) { - case BELOW_NAME: - return ScoreboardPosition.BELOW_NAME; - case PLAYER_LIST: - return ScoreboardPosition.PLAYER_LIST; - default: - return ScoreboardPosition.SIDEBAR; - } + return switch (displaySlot) { + case BELOW_NAME -> ScoreboardPosition.BELOW_NAME; + case PLAYER_LIST -> ScoreboardPosition.PLAYER_LIST; + default -> ScoreboardPosition.SIDEBAR; + }; } public void registerScore(String id, int score) { diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index f3d435706..de27db0bf 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -240,12 +240,8 @@ public final class Scoreboard { Team current = teamIterator.next(); switch (current.getUpdateType()) { - case ADD: - case UPDATE: - current.markUpdated(); - break; - case REMOVE: - teamIterator.remove(); + case ADD, UPDATE -> current.markUpdated(); + case REMOVE -> teamIterator.remove(); } } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java index 9fe9f8cf2..efefb339a 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java @@ -181,17 +181,12 @@ public final class Team { } public boolean isVisibleFor(String entity) { - switch (nameTagVisibility) { - case HIDE_FOR_OTHER_TEAMS: - return hasEntity(entity); - case HIDE_FOR_OWN_TEAM: - return !hasEntity(entity); - case ALWAYS: - return true; - case NEVER: - return false; - } - return true; + return switch (nameTagVisibility) { + case HIDE_FOR_OTHER_TEAMS -> hasEntity(entity); + case HIDE_FOR_OWN_TEAM -> !hasEntity(entity); + case ALWAYS -> true; + case NEVER -> false; + }; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java index 8c07cccbc..cf76c529a 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java +++ b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java @@ -132,18 +132,10 @@ public final class FloodgateSkinUploader { case LOG_MESSAGE: String logMessage = node.get("message").asText(); switch (node.get("priority").asInt()) { - case -1: - logger.debug("Got a message from skin uploader: " + logMessage); - break; - case 0: - logger.info("Got a message from skin uploader: " +logMessage); - break; - case 1: - logger.error("Got a message from skin uploader: " + logMessage); - break; - default: - logger.info(logMessage); - break; + case -1 -> logger.debug("Got a message from skin uploader: " + logMessage); + case 0 -> logger.info("Got a message from skin uploader: " + logMessage); + case 1 -> logger.error("Got a message from skin uploader: " + logMessage); + default -> logger.info(logMessage); } break; case NEWS_ADDED: diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java index 6574c9350..4b97ba5fb 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java @@ -679,11 +679,11 @@ public class SkinProvider { } public static String toRequestedType(CapeUrlType type, UUID uuid, String username) { - switch (type) { - case UUID: return uuid.toString().replace("-", ""); - case UUID_DASHED: return uuid.toString(); - default: return username; - } + return switch (type) { + case UUID -> uuid.toString().replace("-", ""); + case UUID_DASHED -> uuid.toString(); + default -> username; + }; } } @@ -715,11 +715,11 @@ public class SkinProvider { } public static String toRequestedType(CapeUrlType type, UUID uuid, String username) { - switch (type) { - case UUID: return uuid.toString().replace("-", ""); - case UUID_DASHED: return uuid.toString(); - default: return username; - } + return switch (type) { + case UUID -> uuid.toString().replace("-", ""); + case UUID_DASHED -> uuid.toString(); + default -> username; + }; } } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/Axis.java b/connector/src/main/java/org/geysermc/connector/utils/Axis.java index 4294744be..1075f8d2c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Axis.java +++ b/connector/src/main/java/org/geysermc/connector/utils/Axis.java @@ -37,14 +37,10 @@ public enum Axis { * @return The component of the vector in this axis */ public double choose(Vector3d vector) { - switch (this) { - case X: - return vector.getX(); - case Y: - return vector.getY(); - case Z: - return vector.getZ(); - } - return -1; + return switch (this) { + case X -> vector.getX(); + case Y -> vector.getY(); + case Z -> vector.getZ(); + }; } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index db2271e5c..fd877a522 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -67,23 +67,16 @@ public class BlockUtils { private static double toolBreakTimeBonus(String toolType, String toolTier, boolean isShearsEffective) { if (toolType.equals("shears")) return isShearsEffective ? 5.0 : 15.0; if (toolType.equals("")) return 1.0; - switch (toolTier) { + return switch (toolTier) { // https://minecraft.gamepedia.com/Breaking#Speed - case "wooden": - return 2.0; - case "stone": - return 4.0; - case "iron": - return 6.0; - case "diamond": - return 8.0; - case "netherite": - return 9.0; - case "golden": - return 12.0; - default: - return 1.0; - } + case "wooden" -> 2.0; + case "stone" -> 4.0; + case "iron" -> 6.0; + case "diamond" -> 8.0; + case "netherite" -> 9.0; + case "golden" -> 12.0; + default -> 1.0; + }; } private static boolean canToolTierBreakBlock(GeyserSession session, BlockMapping blockMapping, String toolTier) { @@ -208,21 +201,15 @@ public class BlockUtils { * @return the block position with the block face accounted for */ public static Vector3i getBlockPosition(Vector3i blockPos, int face) { - switch (face) { - case 0: - return blockPos.sub(0, 1, 0); - case 1: - return blockPos.add(0, 1, 0); - case 2: - return blockPos.sub(0, 0, 1); - case 3: - return blockPos.add(0, 0, 1); - case 4: - return blockPos.sub(1, 0, 0); - case 5: - return blockPos.add(1, 0, 0); - } - return blockPos; + return switch (face) { + case 0 -> blockPos.sub(0, 1, 0); + case 1 -> blockPos.add(0, 1, 0); + case 2 -> blockPos.sub(0, 0, 1); + case 3 -> blockPos.add(0, 0, 1); + case 4 -> blockPos.sub(1, 0, 0); + case 5 -> blockPos.add(1, 0, 0); + default -> blockPos; + }; } /** diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 854c367ec..3b2614d77 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -263,8 +263,7 @@ public class ChunkUtils { tagName = "Empty"; // Sometimes legacy tags have their ID be a StringTag with empty value for (Tag subTag : tag) { - if (subTag instanceof StringTag) { - StringTag stringTag = (StringTag) subTag; + if (subTag instanceof StringTag stringTag) { if (stringTag.getValue().isEmpty()) { tagName = stringTag.getName(); break; diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index 886bb416f..632e17280 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -111,14 +111,11 @@ public class DimensionUtils { * @return Converted Bedrock edition dimension ID */ public static int javaToBedrock(String javaDimension) { - switch (javaDimension) { - case NETHER: - return BEDROCK_NETHER_ID; - case THE_END: - return 2; - default: - return 0; - } + return switch (javaDimension) { + case NETHER -> BEDROCK_NETHER_ID; + case THE_END -> 2; + default -> 0; + }; } /** diff --git a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java index b5b0d24ca..5c4929a91 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java @@ -44,26 +44,15 @@ public final class EntityUtils { * @return The numeric ID for the Bedrock edition effect */ public static int toBedrockEffectId(Effect effect) { - switch (effect) { - case GLOWING: - case LUCK: - case UNLUCK: - case DOLPHINS_GRACE: - // All Java-exclusive effects as of 1.16.2 - return 0; - case LEVITATION: - return 24; - case CONDUIT_POWER: - return 26; - case SLOW_FALLING: - return 27; - case BAD_OMEN: - return 28; - case HERO_OF_THE_VILLAGE: - return 29; - default: - return effect.ordinal() + 1; - } + return switch (effect) { + case GLOWING, LUCK, UNLUCK, DOLPHINS_GRACE -> 0; // All Java-exclusive effects as of 1.16.2 + case LEVITATION -> 24; + case CONDUIT_POWER -> 26; + case SLOW_FALLING -> 27; + case BAD_OMEN -> 28; + case HERO_OF_THE_VILLAGE -> 29; + default -> effect.ordinal() + 1; + }; } /** @@ -84,46 +73,20 @@ public final class EntityUtils { float height = mount.getMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); float mountedHeightOffset = height * 0.75f; switch (mount.getEntityType()) { - case CHICKEN: - case SPIDER: - mountedHeightOffset = height * 0.5f; - break; - case DONKEY: - case MULE: - mountedHeightOffset -= 0.25f; - break; - case LLAMA: - mountedHeightOffset = height * 0.67f; - break; - case MINECART: - case MINECART_HOPPER: - case MINECART_TNT: - case MINECART_CHEST: - case MINECART_FURNACE: - case MINECART_SPAWNER: - case MINECART_COMMAND_BLOCK: - mountedHeightOffset = 0; - break; - case BOAT: - mountedHeightOffset = -0.1f; - break; - case HOGLIN: - case ZOGLIN: + case CHICKEN, SPIDER -> mountedHeightOffset = height * 0.5f; + case DONKEY, MULE -> mountedHeightOffset -= 0.25f; + case LLAMA -> mountedHeightOffset = height * 0.67f; + case MINECART, MINECART_HOPPER, MINECART_TNT, MINECART_CHEST, MINECART_FURNACE, MINECART_SPAWNER, + MINECART_COMMAND_BLOCK -> mountedHeightOffset = 0; + case BOAT -> mountedHeightOffset = -0.1f; + case HOGLIN, ZOGLIN -> { boolean isBaby = mount.getMetadata().getFlags().getFlag(EntityFlag.BABY); mountedHeightOffset = height - (isBaby ? 0.2f : 0.15f); - break; - case PIGLIN: - mountedHeightOffset = height * 0.92f; - break; - case RAVAGER: - mountedHeightOffset = 2.1f; - break; - case SKELETON_HORSE: - mountedHeightOffset -= 0.1875f; - break; - case STRIDER: - mountedHeightOffset = height - 0.19f; - break; + } + case PIGLIN -> mountedHeightOffset = height * 0.92f; + case RAVAGER -> mountedHeightOffset = 2.1f; + case SKELETON_HORSE -> mountedHeightOffset -= 0.1875f; + case STRIDER -> mountedHeightOffset = height - 0.19f; } return mountedHeightOffset; } @@ -207,15 +170,8 @@ public final class EntityUtils { yOffset += EntityType.PLAYER.getOffset(); } switch (mount.getEntityType()) { - case MINECART: - case MINECART_HOPPER: - case MINECART_TNT: - case MINECART_CHEST: - case MINECART_FURNACE: - case MINECART_SPAWNER: - case MINECART_COMMAND_BLOCK: - case BOAT: - yOffset -= mount.getEntityType().getHeight() * 0.5f; + case MINECART, MINECART_HOPPER, MINECART_TNT, MINECART_CHEST, MINECART_FURNACE, MINECART_SPAWNER, + MINECART_COMMAND_BLOCK, BOAT -> yOffset -= mount.getEntityType().getHeight() * 0.5f; } Vector3f offset = Vector3f.from(xOffset, yOffset, zOffset); passenger.getMetadata().put(EntityData.RIDER_SEAT_POSITION, offset); diff --git a/connector/src/main/java/org/geysermc/connector/utils/SignUtils.java b/connector/src/main/java/org/geysermc/connector/utils/SignUtils.java index f396fce9e..b324c745d 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/SignUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/SignUtils.java @@ -48,52 +48,14 @@ public class SignUtils { * @return width of the character */ public static int getCharacterWidth(char c) { - switch (c) { - case '!': - case ',': - case '.': - case ':': - case ';': - case 'i': - case '|': - case '¡': - return 2; - - case '\'': - case 'l': - case 'ì': - case 'í': - return 3; - - case ' ': - case 'I': - case '[': - case ']': - case 't': - case '×': - case 'ï': - return 4; - - case '"': - case '(': - case ')': - case '*': - case '<': - case '>': - case 'f': - case 'k': - case '{': - case '}': - return 5; - - case '@': - case '~': - case '®': - return 7; - - default: - return 6; - } + return switch (c) { + case '!', ',', '.', ':', ';', 'i', '|', '¡' -> 2; + case '\'', 'l', 'ì', 'í' -> 3; + case ' ', 'I', '[', ']', 't', '×', 'ï' -> 4; + case '"', '(', ')', '*', '<', '>', 'f', 'k', '{', '}' -> 5; + case '@', '~', '®' -> 7; + default -> 6; + }; } } diff --git a/connector/src/main/resources/bedrock/block_palette.1_17_0.nbt b/connector/src/main/resources/bedrock/block_palette.1_17_0.nbt deleted file mode 100644 index c4f908b5e7e20bfb446ca1a46521a5cff25a426a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40439 zcmeFZby$>N_cyA72qGZeC?F^`bcY}*DM)vhhz#9`qQsCQozf*KT_ViTEnU(e-7&&KXwnL1MTxCgtCh7?mUW#ec+U8Ev^## z#8Gha(u(W+my6-o4L_=<*Vl~nF;5mHGLmr!EV$%8A4p{A8)t^zAvb$Qv`a>q@wPqw z{%sLNz>{B`j8gdR<5se&D;7G9FivvOI_@AuW`ygtucyJCjuSIa5l`*n{pG3aOS^jA zCdH|hk(s1c@CO|+~I&m90)5;FJ9mhR*N=E&iVxgPo>V$?liZy9X0umtgMbpX!GS6W=2VXT!#D2; zmE*aXKUnV&8;$bGphv399!pYBL^zwL)oP8{#$@R77uZ(1X_Fo_@I9;!^x7~#yx?Om z@F3THfrB%zs)Q=!QHAW*JaUUa@Emfoe^66E+%TasWk`daz zLAKyI6z0sQoz-a^CA6RAEV?cO_=b*_2-i0<<&f=JC)-|zVcqke?l!CO;Lm@`aKnrv zVw0@NS|e(*leZ5Uo5(53(a>b2C_ZYPd8)EH!RUp&_?6lEpeE}<7JK;Z$R+^}@$-cz zH`ig37+H8!PtBJ1oYWo&_$vQKYwv&V^XpVFA5b43!S@bKB%9s+o84!GN#D-`Yd!znAXoO5ic07JzjTaKa6&+BRzjEG=qKlC}sPD?Oa{D7nT&(7cWdyyk7*!Q_>KJI%_fi?sVlA(Mw!H>9C1jXDhp z3o5VUT+_Ixvu9SN+-yz+=TtTpdHP(E?9&dWbEa0Qs@IPNoADrp`x;H?sT0E?K7H#p za51ZcZyD}1Y5YWfog^NkwIOEu#lK_xX3tMc zN=jd9%qh7S9l_e|n@{y5+|SEhxjka~z0&No(Qz=^hw)$!xp<1hyEj+LSt&yvn7^4L z@fPs(J&mj1WzXGMh&#t08Lb6c>T=DO+Yds`l({~K^$+?gevhbcWNfN8b4P1vT+M#MQn@rRJlrRC@$~A^ zI#iT&&Y<-yruFf>GHtU}s-H*dF-68IMFuG(S@(g-S3- z77s#Rh>HCI%vHxn|2yfJ|G#o&{7#XU_BCjTb<=WeCa;5e7GX?Fi;|#iXVARz7hC=L z8f)D{`DO+UHmDFi{9Sf$%?VY7z5QE7|69fWTZJNb{#@n1{&N+&@vrI?Xb8$%mfuxg zo9OPK5mTM?%B__JTR=!y=lkG~j$7fcTy(xeRhh95``*Nn5qE}rJkFDiMsR9e3=+$1#@k&3LKeWw^HAy(5DtJTGXZz|4B*Y=iC zD(Gf!``NbW!(Q{`yEl5<@^1|Apg>D&(w6DVB9a1+$alu8OthG;sRZwgofe#T?#E$u zcm=BctGVQDY9Y>aa%i2~THD)|OyumB`!^DUx4i?*uQ!@la5B7P@p?P(x|8N%L%f}}-3h3bzJD}z-9_{8f}_*5 zxg35g^a|Yf-?!3aRbDu8bm&+=!82=25n)JmwX~a%QN2UpzP%81Z=vdZjlAtO-6pwt zWO7iYjrsjDUuq(Ak+wB3XR>kk(S_>*9*z$(ptpoWXoCdm#2O#8?GTQ(KS*~#^3-XK zFS2Xn5gebQjlK^Mz4ASJXfoxraWLU!Y(Mg&YE_fX&I8kgW$p!$8l>;A2`CsPuj9oO&3t%oL!C3;^4 zJtD#VUq=C>_RfZD&@`@lGxa0T+QxqNC&}@+Gsjq!lJc;NcirxXS=uyWjxK)0ckXf1 zF!oGvm@u{m*mUAJVt!k~AkSgo@8DpoRc)|O=EL7iqx{NY)f$j+j}Xv9#=(aVHOl^s3Hed z;FQG`oZ6eRYs8hzA`9!hcV>-7mK9E}3LtYeCt5CNb&bsh-ELc#8U{_)J0;A%-B)=} zs$~3jaYoUDt=L#^Zrsi+%T}TC%)K^g2AtPP=u){c#xJQ@SaF^$PHc%*v^aVv?0;EcLKx#pe zDp4c|ARTqbon-TCRQ-0J_1^h%JcHz89oQRo$`-ehyq$QDIFDWylI9<{gh>iejX1U7 zkK00!aXbg=d<-E<<^l6OKpLtIS4VSMl3Nwp$2uIj6i4Q!oY*@Ver;dhbw^r2QEH ziieu6ztQHHcGB7#38TZ$kAJEjWmPolFAX2j)!T`zyVo&k9i_!2je5zHW(;rc8FH?* zpD6@4|8~pG9>C)+Gr`EfXV{_0IpmrF<6 zvuDeK2hZ{$qhm*YkK|ESScEn#i4;b7MIIpTHVy|?kCGP)>Fdo+d9td6HP)XNOv z%w($L*1j@CoY39yG)Iwa*&DO`(`PKRWPDEhA^o}qaJ4gZ9qb4=!#{Bve0HME8TEWv z9bFW!KI+3|QchGBT5tXXbV=u=WAqa-X?KI9r6TE~Vi0pBK@Q9TfH$=et&{Fw!7}juhki{&uo`RM+1bG$DY4Z7C z-nh2|gAgG=k2?|}a(KzY9P1IM7!Ni<4tc5OUZ7jpfwuB|HSt>D{un00oV%9OY%duV zqr2;js^Ut=jaR6-t-1uP;PZ9SI60w?hEzoo6Tg0>LN%$1B_|Aj2&}fXB!1pv2z8R7 z%2NSX4Dq__oGcaN7~`OGJ@F7}){Wu`{W?0Qgp;1nSeeOqcV21p#d9FYp?Rqm?_nN4 z&Kyc}EKvQx3H+^B6$k06bx21ni`L|4H&DcQr1gMxW8Huxu zwZ%4fX8EI~F0%JehYGMJ^vmgb-Wg4QDY)M6eqGsPc_y6GxpvlVr^#B9bC4l~PPujU zenj%RiMwGki|2miYU63%F8_qZFGa31-5fO8ILX;a+;Ky_~+)nSm# zc!)ENFMOicI}YY}T(E~m(|@2rU3V3DWQxXN($m8g?lCC&13_LZJdNvvBgJaTDrpAgLVo)yVUTpejl zGh4iTT*98QOBY;i{`%32q{4h2CNAl2!kpF-^~A$S=W?FuZspc&CdkVMkwGP|s4sMe zs^)}7`i$Ag;TJo6IPQKS!9;8d&clZKIqq776IrChOtXnp!v(glREyiqCl`kpxg>sH{A?4~9s5L@aY}4VJ%dh? z+^x6i^*fA1kS3sH6LAGu9o) ztijyf6vwWS_#!8zq)Z*2Q@-Vc6)i1r2Y2l16`PKC#V=#(@1wCB&Q8A^*uEpwqy^A$ zM{nD)Y6Kk2iHD)Ccq-HPZeTQYvZfs0LXV$r|+%Gb`fnPyIhP}92%VW`qG|6Qu z{WlA1cz)B5g-8_01K=$REy=+g~;NMVM^;tecnpsWQ zRT%IqcRs4`nzE~XL!m%X*%tWh@*#dr!G1%;_pE}|4zU|BJI3$~VSYpb zGkoT^LBc+-v(h>8+Q;RZf)F#(^&~^LaZ+q;h7cP5Ll0RMg>)qESf5L-r zW#XTg;Rt*hO55c%M!3#08lA!VGPMM}-yweNrwOyG zO>h;t#8V?|H;YUZ*nju4jguscF+ArXFLW9`-$XX3Mi*Qx#Fwx&^`VnfD$+*J59SSh z$Xix`pT#&T2>82XBNMf;vDCb9HIQTl$F~ZOvDCL-=1p3?sO6j0#9kbil= zRJm>;=*Qj2#y2+H-B1uhlBs%tH_B{3feKzRjanTpQ6yjdf*=UV2ZSxTx zWUY1t!n8fJ;zxfYv2PTSub+yE5X&2T*D0)NA1_-GPd=8o1Jf~`&uqRv9y6;Wmd+2M z1|hhQATI{}+hUl7B5Ta0?+}a?xA-F@!-Qz>`~Jl8-_2CU40z!3?BPWo;jQ4zZJ1^H zMNa$(*U@DzMa8H4dx=yWYIx~XkPMN79 zRD=aV6zG~3&tKn!$eTuIsn#;uU_< z7RhK*|FC^D3V{6sw({=Qr+AU7obfU=aAS%I!uP>~^=1nD2%6ieh5Rbidx~DagB}mQ zyyN2A789KtUc+&olmD`4qtHbxW%bOqv4hG`@#?s3u-n_IaVo*7`sP^O%lR~wCq-TG ztF6KHE0?mP9DUd8Pr}#@<&(v^?4--D4SD+%#==Rr2_Sk`E^1JnUXnCTVcAF*H?^;O z%f9dH^?bRBXR3YI$du0mJy*0X7FOJqH&X%ceQirKPARXa3xZ|~)fgsA?G_p`36zpE z&ZQ4#rqmb`)n>g<8q|XsSH2$Io!xSu(N_EI*Pe&O?yhg1Z)kMC>tIqLNQ8Tc<&>HK zGK)J>xW}zGEJqnnS=cF0<>7>)fxZxSEqy8%{i03>%}y41obsh_;F<5I-k;JRxFZD@ zn7AP+{?mKP@v8Hzr)WJ^BVQ@dMTO96C4FpWtoM2L?wR8qp1EXpg0|=HyXW?HxRaE( zi$D=86_HOD^0~QEZ0V1J-Bqw%pZQwJ&$kwxTnUM#8FnnLIzP0DLVTcbmVrRxUh}Pf7351$vzVYJswO? zXAH-{^$yM?5hW3{iT6Cq@k*(5DOiEug2E4H`hJ1P!Dyr}&k2pSMSei$Zf z8J#O<^@DR)ISF*bJi=okwAYH(ukEFkxd^tezuRxnjfZYMgrJHxL7&REIHco%9r=~X z?SiED9YwN#kIAHKQI2v{pZGS1-b)Il6q;nL2ytN(M0Q1_Fjz6J)DN3`%86i>1<)s- zb2EcG@Kq9^V1C2heuUn&YI$Jnn)%K4{^1&!@t<*KydH_}80B{+!-lN)iPjYb&}VJ_ zv;pR&?2L6O!u@w>s8tKgu5!wsHb8entsZ){4O;@)vA?j5Ti^aINApdU-&?p@#}TCav^)J?elu0x<751raxf+||=VhTs*kKhF4rr5OS zOQW-$psdy=F^}=fiaon)N(kxl=E&8Z@Km0w@-RNf5}zxy{HIM!W8eWf_Xv4MOQVXF zubE-NLshexX(4dJF}1|+Wk&rRRj5Vt+sx#C=@JX!#9YAyp9dx*lZae5bO2BxLLv3&{A>Tm~= z29l*Abnc&5O@XvP=*;6c=u8n45IXD79lBdG6zp_%4F`1Z0(IHx?2}LE-eDxN)7cgw z>23v1vD3K{Tw63RNu#U$YAzya42mSbh?^-V#sB7UZBe@`9iX(_tQgl6RKs);H@`rN z&l`5lWpqVn8t6*(tSWk$)o-t~RS4H3NR>K}r>!PjlEU1$ofd~XZ!z*C=_FK6^6LOp zt~Gp1Agcw#m1>BCUKrOVy#?@2p8{TI+;)rRU+`A@Ij9bs+unUJ@On6e#&RRP+c6&& znAizTfH?0Na|=LPEg&@3B<&VW9q{+tn>8PibrmgiTDrT+sVto4q{A^JW6N*@)_EgcnOt!`!(}bOLsbamW9n)>mY`tG7u?`J>Bn{4Od=hri*JBdiQwO zNHxUJhL-!ZM9!k*TY4|D#QHp})22U>1vQCN(Z% z-{Wf&ib*q-Bv*kIEc1pAN2HiP>JIs6lHB`yn@U+GGRKTV;+dX=HgC%sgL%d&K(YI4 zR*J&j9PsjdRRy>d-*9wM=8Db)`i+UNxmVJ3C?B|v=ep)XI_Tj4-KD6TDA&>wiXr`{~bEP=DNoLG(1+pK;)-lc(?Nx*qx*nC^^JwPrO0^ zav%+%advATIi5^BNP69@d2LFmWYir))R43)k3G@p%eJo7wcpEW9)rBYWcPA&j8Kk!sn?Bt-`DXOIEc&!$oS`J^7uJPVa)y>#$2}n0 z6D&+%{49p^EKGLH*TiLqF+}_yu0u30e$o&>26*_P5u~I_XD`Ja4IvfbXsq7z z5F62U@4#4bK!6Y-6$Uj?Y?Grzw1u6RC?39`N1%s0nJWGiXF&vn9hoXFIdCJ;`xg+K zajo%d{Tq^AgdU~Do`fF1fCh+6e+RtQ zK=|=^YXC3R9N-0Vze(B}1jZdVqDF?#_5QkC50m~K-%c}YTuTtp^tg38pn4y!x%6+* zXXNY|tza8VZT4LiHs;AzKMu~lsSrBb>7R|*G;JX;b3HH)mJm)XZOfz9*EVhI<74Ht zS9uUi)>x0PaBq4rm_cUC7EaK5ylWa9g-j@G`=v9jz2vBEdU(&CRbGOX)ABAqN&cf) zvPvI*lCMu<$$-Ygv`7^0CAWsbnL`;q_AVk8Vi5%I1M4_**yM>e$q2=IB2*0k6V|+AG5gUz$;IfH&TjTYhJu^XzLeYSS-T!LqbJ21nHS7v zKXP|1Enyal15~p;4z;0JN#BzaAn~03(H`7W4BU*41aB;Btr2ZXOTC+Mz42>h2B9Ke z3D(Y>`vZ%0WWn(!px*NxA_JzBlpc?_02UQUHU;l!{W=Kmki^?IUAigj%DMkSvYyPN zbP(_^-37%it9@wt3mK{YUx=RA&Y*av>G*j%a(pmi%Q`8Uw%%og9cf3<3kW0!qh}tz*{ya#PDa~wVzVCzPfkY18gjFDR#3C!ZlDbJ?0ak_LW2{2giWvo zbE;0cnZ?3P6{q#>dz^JbvA~LxLqa)C4r(|LvN;*ut>4h~V=&wWLcCi#D@A9n4uqHs zSo=Wo@uUtkoZm`IH$NUT?i;flGVXsj15#h(4|oSUfWX^20A7J6z?;(MH^Kf9zlHFW zy)c`D&K%>~qWZoJIvBGKE=1ppJu7`$9wDr2cLK`G&$v12xSQu=L=3)ry1GnU{rbb+{ z+cxd$)ZQKM=`%sSbc;U^2vTWnzSEKi4vki_qn3OddN_+_84Ck=tg{&AgPR%KiOU9J z2>9MFhG?$HVH1G7F@fX7LT(4Sa7m2DC!|AkY$1ato`mYVD0mW zg>Y@g%Yexr{|>CZr8%(nJT-uqat`qJ&DU&_Hn@*(2}25(AvC79+AXTb;jMNvP#uWN z-V1I)$nXaUjU7h2MNJPJ4R~-pq_yq?Db!kCGvTkf@m0EGNE)J7wU33(-EAX=q&o9N9(!`cJ6n2dzG>*zNrjOO%DQ(j0EY)y z_s41ZCYdF63dry2IK0vf;Q#Mp9m|CuAISp7CgA zrZPGlbe73?=z)*OL1!C@O;7i663EN#2QpF-yrxpW#2?E@g?%%X8aHN_kqYNGllr6V zRDYG7r0uV=e`(qGdmQ|)vj6y(vQyB%YX@$N-Ls5A;F?5iC@o2RJYodTQ!hfB z_$c7P4CDb1#@G&cFjaqC9$?8oQceI~oGqoSFES^LLvMi+43$QovcEGW!vh-5rFVBx z!gAN>Besdiz{+LZIu{upU(9v60s7)RQ14g;W09Xc;OT!eG;qd;|D5kp74>s(w@j7b znb-X1SwShT0FFcX&p$^Rpr{iT0J_hh;G`RXlN81s znYF7hx>_&^bfMb6p9y3-2nuAnuxX5GCJtH!VE-uMycbL)kyJpqZhdh))rbU9rQnT>x&GqhIe~M z!S2k=Kr0)oR<10k${G4n&tE+Frnw}4ced9F$h&#nr)RFt2G2R`CyTSv4ZO9~z5`Rk zWM{MroSwiV`H-m*FNWJ&c1@o$j-f`+{kHyblFBV1faRyZC$H$h`dm?E3hh2f;Wn?)Jujm!}*UcZzB7APC<9yx`$> z3^S2Jx$?G5p_ssxpI{5XmjJGOY`3u#%9VG<4-EptCWrXrs}7&CAKd1kbG5o2G5nc1 z72P)cmO*A`>ARYlYngE{XT3*hTROFpw&_n?2rH+l6=f`0buJ!odS-$cFt*p)2r^wO zO@mFm+{@ZJE_<|1fy%Qw3bJx~V(^n>Ka3>w@A*A4U;h3bq&ROu+pBFuKF<)i(<7SKF>ck6pM1HGd}W5PAHas zOAP0{*=uq_!GSnV6Z$Z6LjLgt&M%8!$q7Zn`01a3t1sQTE8tv=*0^shYxEHTO22v) zNqgeIcQzz!eFFCd^H=Eem@P2wTOM~?DjtqQWKtUydFseK)}RKVQaz=>o3S(o-V9GU z@Mb7RfFl#SWx6y!x@Nlc<&GQY{#$zB&E$Onj?DNP;C1`}3U?BInHNv!GproUEW6F6 zdWh_M9HK&lz=*jG=;#+#9L=h*&82=(+4nelgkmPOhfT1D_0Rd{3UY z)Ni?^k(3VuNGrVUmPS;u0iZISIMaY0l8NjJ(rcXx5IrNbey68hjDEc!9?8uVI2zduWI8DqN$p{6fLpf2~ zR^&2pcrf@aD<2}-6z36}v2F2rTlJjX(wvO;5a8OeBGAE#-y=oDmwHUcpAC@_ih%v6 z)q8^fi2J^MRk-EDzpAz1%Z4L!lG231%I3*`Czh-t`nCcH6ubw40^1)$8Lm(h8~pmI z(r-0BKH9p6G%~Dg4qA_6Nh&Ld6|kq;VcF8#Hi#jVM_1NuVl&8HQzme`>>F@twTnJ! z>w;~&c0-1?E^z5sO?AMnxWK9Bh$R6&Eli(60h?wWp+6hUZ6>+r8hZD^a(hj>#K+LP z6e}HhdC=I?`XfR^C^vfY2IfaYLsAh*6YMdn zD4{Qeb1|cYzFJ@A0}y&v(w;n&(64_YCk8^#tHOZCG62x41ny~kY*2rr$d zHYq(JH}Ktq$j9Jv=s26Ek1{Y^I0^89+a6p)4E%hQ-!JtG`1y3Uz|Y6$s{y=JbAT7M zaU<>eyK&> zOgq%xyE>WYs|xFu|16~z(Xs95%VFhpP|=E|XsTyZ2%8>^%l^1!+oQI4>|mMy1*uc< zbIqnfXGu-R_LOLrRlbas7mS@GUq6-=nNywH_Ug$L??p0d^gNJro z<_}6X>LBMhSLBI%$cdl!q(D_OH_3^4`_fcR&~PY-`8&R-a!RsM5ZAtw&0J_tLXdZA z8Qe#bYgwBvbGvWp=Vsi`yxp?Pa4EeE>qB9J`NebUgme>7ANcMo3nsN0OlrX#u=Z0s za_Gf_J8}Vd+is8OWRHajOeB%i!8L<`ckM1H4tZun(}NHJD)YTPu>hL184 zN}9p0Rk0@zNVBCrkY=7zAk7p%;c`;bEDQ8l0c?H$Ghv$Tk~TKIh0U^)#|Ygs76w=TlNh41=rj4? z@j@{+yRUrPcQAZy;VbfrSAiV2Eow{>0%08>cK=tryt- z?K@X$!`Bt_LVv%cF-Ywrzsg#s7LjdmAIs&{INV(Z<5u&Cl@OiA%7T-q&af5IhumueJA>)cDpsp96j zNbz`Ji(E!a3leUw`dco-RlQOoZ2x4Q{>eQ3TQX1TUf{gt87%Oh%+o)ar++d}|74#2 zzsfxQhh3U~GEbL2zJsF%HX!dnD#00g2Lxgh*got%W zPLep2hu#4vNhTog_8eZGvUf9Z(4bC|G~Yn9ZZ}c-P!ddqKWeHU%x&AQqV!Q~QwC6K zvxd?~zM~jL-7E*NVH-u=st0hB2Ec%=Iskk607T!a0B|}LMFsgrQ$LVs0*6Xi`aq(I z4kTg9P)BNjBTKvk&e*7O3l;}~BQ;pyT!}OiAQjrio#tp09N zk8pDND6Dmo?V0>9GSi;^OoA`Tvc2ZS=aEfM&sxu1AsW%i>-x*ZXz=1ap5MF$A4{y( z@QJF}IK+qzyx4K$OW#RF?+xg2MXql$td&YcJiS%1_X*;6WxC+bdIjOz788 zY}(>4P};UiUPxQ5ZxFU|P}x-w!Lx_5pYPui%m}#OfzJ>i9{z+jKp;b`meBMh{z(Z1 z$?>q8pMZ}JE6K3*m5|XloHTJ!Xc7AFU^My{Dpa@qJx#mNjt0(rZj2&t6rH>n@*4c9 z*H_>j%}+C9xcO#16E?MB8h!G~{e|YlenA@I4*!Hk)3kY`6b*Yw;f9hZyPemq#!gb$ zepMXeETd-qgr!dlzOV80Lm{)*@Qz{;Oxnkx*@)9CIvAs6ORK1A#CGt&?wE#{G)@CH z42?#;5s}uGW%%W!P1~Fss_)~$x_2F0eSnZ!5^!?Ibm@6OBX3X<6!^JSf8qVOSf=}v z%03n`q1P3#2<0iNMW>IGRupMQKl$cPFEWmG+E+>aWmJ*(mgs*9;dx+I_R1IJ_oiJ$&5>U!{plV@%rlk6#)g^^dC~nLy}wT~F4&W^3DHh3 zQmZwMMWzkUt zs&!QjGe1G$PM5!OktO8uf33cRG=F;Lo9ot!-tOF$L$~^3Rg*W($3F2_e8JhK)0FyB zK>McCB6_=euT`2}F5P1h%e17&0y(x~$Z0WR!AmpW2lH3tBo#(tNGDtudyRv9$Lo8r z{6v))q?MntyCV3|Rvhszn0|_M`e6n>T1^X9UM^ovq`eG1Tb1cyPHOC09rj2q8HEW= zny`ntSUny}o8;kx)9u8bE|y6-J&myUzjkCTWhRB63(Yl_t6oc(wPxB^vhU7wu_5|Wl8uq90ePv?SGH&gj1njyf?2a*gq0V3v6)xh_iSop5;fjmvSGxnXG{i z3LFAZz(0NGXe!AxX-$_++<9d)&aoD?g7l=|3l$g=dy31=-o2vtEMlAO`sw5)a@~b` zerBdbf4RH*8aZ+7<7Bs?G|s&%p!usp+y8Odt?E^GDwg&T|0$;;vKmnU8cWQej$=*X zswkvxyt6?@JdPBiVf=Gx(ZsQc>{OtAQTt@k|JH+5_w?`Wf;3MYyu$A^KENXa4ZNR? zxN~>YhkB!T1nu^5Q~1%!Z~t3fM(wRj?gPj@aa5z6yE`hkXAL3y>z+{td=00=O0@;o zMRwQ6^6|;TmQUX-8-gGAImzsK6M&YhrL#zUy?FB?OIsOFm}gE8@eD02@UAnTdV1#z ze_h8%;dIX7r2qur{QN|3m+mDy*I@?_k6nZvV!@kceH68q&QY*1H)C+1wKFgQj3-8=qK?jIZ(?`RWT@&|M^mD zdbc>YxMt5l#Q=)dkXje<+4%v>x|r&aPeB&)%cpHw`MQ1)Zv&0kr0rm2fC}z@eyWhz z$&qe)-Y8D?B&-DHVMsYY)%why%hNZBbfn?lwkc*9CwidD^)u^xX)7Q4$QEzz(}G{6 zkOaSR5qMv+r~QEnLc7oHlCs_=gVWF3RU>9<+55WPK3F^mMh^bx($E%r_Q8qCp6Tm< zq-}#&qCg}78sq>Z0&s)^SpdXP08k77FC_pqDZ2cx_fIru&U6AwB2ORv(311U-8(89 z$m!CgCNA;%P+1QnHO^b4NY%}&n18195ql(xCAZ(x)bYbTfXws4^=T!k`AKmc4VVIj zC?P-1YhF;-4%HQZmULN?->BQiI;vlMf&A3g=+!WWO(@F4>zlil=4l;Ll^>Y177GAl z{#lN}k)@lqhfYL%MwwEEv$a#j_LimRcxnAXUWqa_@$q=CQJ0N2Z`J_bTq$^+A6jRB z9tf@bEb`-2EU5LP#46$hO2rrY(q>z!D%p^&+{iVJqoaV z??=qS6tmoOtDw?uC5u#zk{pX;`Q;fS2dcQSL40T%EqXY8_!9>z=v)8A@9jxDl;3{| z?Cz}~aXAEVy&KM&Zr=-E+}|2@gMReD8|UZRmNuU2sNwhbpQgq!@ztht#eMNmnJ)153u++J}^+GO{i2g%^E_P?MX;x(1t9g&1#y=Dz zWG-RU!#B>y#F|LBX>fW;sW#yn3oFUZ^SdyWOXOYH4#6QY$s9ePHA#ZEz`gwd%jveb zk;z`8KX?aJ7!AA?esUXd@7zT(5(;RHy+5&}eebT}I`5;?@z9Xhz+Hue3zP40)1`LD zLr99_&O7Ty7Xkv7!^-GL?Jqki0d04E_M~WyAU=V4-V$aXn!GY1*{zEPs#VTc6ofU` zkdJ*1vZ+}Pafm*6=NlMJmOV3ic6Mx7q@hvtro3RBjbN}_^nKEOw(FtMz8jL zgS*UaYMpUAKVHzrb{pc>Yrh#wKfUCB2RAtG$0Tu^cuKFWf0SImnTF50UG67STGM?+ z-m(BeTA{=KZxI)q%I2tH^hT3MBhChr=hk%%zg7y@&oA0!hnKSrjFh03O_^tws`>_R zat^#-K5(~E+J2dEH_o}cE-p)NsPWN^<2J*3tRwsL51}x(Uk=arnkXSmv#(nj;9hn$ zS?*RiaYQ@0^Pd(Bc=Xj8+&(IVxb*-gv9mamPMfkKyosfQ@4}~ z#r2Z)Z%!_-Vh@ny>bN7moE! zzPXR651t>ySEm{KxkVlz-Wf746r+mRch~CyUGv=Ajbi0LRWuviE+t}d&J+ASmHXXy zHf%;I#LGS|IeNO{ge%2k+!&g)|E8#Z;*P1h{Bi_FY3!THMqSxq)Yv zub)i9&+D#sc!qO2NJQVPCY{e^C-8~#%oJ7P@ozupg6Lf|3@S%Q%`aGmyJUoR=Xm?Q zLe5MRTBv_p)5%O>Tr8LFr`&i%PR!PHXDwCEm--uGh$M#1b5`GyV6x5Thjf2(tNF7e z0ck!o$Xl0!(0im$of@Jo?CMTyGgBb+t?(1HqG1dDsx^3*s$b@Dj2CVB_= zc(?ETu~qTbgB2@>tPwn~L+l0*R`xjn^0dbAzOnuY@cGVK=XQ2D>~XgXsUj?3JGbN> zcjbXQWQ3JKHI;w#ITy38H{M(8G{JkXycoqJK+iZXxn&4*u}DRoB1tGRgI}6+|GK4} z+x4dvVI4#cEKPWFor_D~`{{QfgFmgzc7p0*&!BP)bYemHmKY;q(-qKcn0G462^n?vH!G_g&u1 zfFlY-2h2cE6(hn1|I8OvRxiSOfoS4h&8^XV@Vys3d&;q8>kF&lu61Dg<_Jrb^HleF^Y5p%-nm>f zqBEZh&-=TMS-!><2z02V7B$)qMBIxe^qc8~x<^i#gI^E86hr-bfVUf$eH=1PfLye> z7iMcXO5ZG`csp~(4+ER`;mCx;7sk6^5UtDdnAuS*w4Y^)174UGFLgWb-YK5>YHMg@ z@#Qgge14$cWLE-@^tW-HR-O;KiitD{wtXMHnyq)U;HY&O#p2=us}Q9e1s!zWc_rDX z%X8tw#;CKIT&5fe9W=EHbM_3CC-E7HSij(@-5isIrSPgx<-)(&l*9Wd^EQS}Cy53Z zN|4VVcXj~%LFvUuSSo7ux%8axfYnDxgFC?LbLnlORv$W;;dMi9IQKbrx(tc1ReHDz z?D$p*>)2vR<0&e_Pw|?PKC%{%^Xq7P5DtdH1RA zW|7IHsa=jzG@I+}!xT=w;hZ26zZn&w=Q5T+`auWyfQFSRe~y~S5WX=4gcIC>GCUKe zt6?smLSZB`XyUqNp@}!7tHwRhju7LD$;|qj;7v(0AfC}|P1wdM%w{P2v13l20yNAz zw|m@S@bbonGkF5|O83X0TE;CatO34n8}oh&w+xOy4XRhVR{yhCGu(fAHFqac`4i~I zDoXlrfQA(jT9{X@LEbuNfNluC`ZjEC4*Fo0@@O$b`s7CB3~6K2=VvNlw&G{WqyNrU z&o+!CI!BhoZ@FJk6io5|c_A}Okb=1#dFEwK2qB3-3ox|K$*gmz@zkbI8_T=XJpz-=+7kx`E6%}i)`O>kLeCUrU**G$IDRq z)hrSFrR2|U6oS&OFCnYL-O_?yBZ4|UuHME#w*!49M2d<+Jh{H&Jt=T`zdGSs30XOF zHk^gb8Djtay$<_UVlqjpitl6#-)|%C%f68d-Mevi-&FkIuU}8Ql38o{q(I4R`Ox~L zA8FCECecVy*GY28V`-uJ)hW)Re>;B4)JgPfm*a5b=2@1k<1!@;eS>8Uu{Q?R7(o%d@O~cnnd79d-hj;f>ZXkN!8%jU%wq&#)ajduIK2F_-R%Nj~Pqv@%#E_)##dcukc(z5Bl+j z_cD)M&m2`}S4OUA%CVb_0xPeM)8!r%&8fTG;@T1*1uw%IzLFL6OVCm{dZ5i{;}8| zWMKo#`ukYjEA~y#vDi$}%;JxqC=I))@F!iLxEme2ixu3n( z9t1CuU6PUu0A~m*ms_DVWF@^KWlhBylkXvRWiKeU+aBw=9amYi3+8Se4Q^Pn2-M`4 zZwx!Ob?nz*vopEJGRRY!Z$;-~Db``Le?eAB7tJkZkViZ^Qvxpy244%Q_mjD6T6!J@ zlDrpibz!{Wo884ahO=KfpqRs3NaMUIzB_shr5_jk^fw_p8?^debZvS=T48uP2(mXRT0uB?{l8cro3{dMZehDEAh zVWzAfh(&rRb%UF{TXrZ;SP+(3cJWVgBTjf5k||5XlE0s?ApkCW_HD2O4FPC|)fNiQ^~b(j1| zE`+9aJy3b}yGq;cN$sZvTG4OmjLm!ucr3+zMNx^=J<$Hm=YUi_=ZVDSwSb-C_c!LsvQ%-E{F=ZEE$i~O;dYbM<;CsE8uNMbgcnz626I5I2m^Vuqc2npc1zoj$A zEn`Crp)l7$074h{d541n;4HOVIb*ys*9*q^aavY z$Bmg7V$#~m=glq-`})m6N)>?*=_d{lPN%Q2f`UKFoPWGMN5VNr%7H99>-uaxez9Up z8jdBi)spq%i-V%lAW>`# z?3xyTQ1gjPOSy(8#N7e^Gmn6)neQ*frHPS3zEMI_RW`U&n-{bSZP;9GR=XV%Bkf3` zIaL{R>OW6@uIAq4*h`#QYthXAv0W9(!jWm%b@qj5p6>k^>rE~}9!93wJk$2Y+~b3VZwM#y+%s;F_I~(R;}4)vVL3NtWR&*9AAYEm4NArd#^bO(kW^3mU#Xo_5lAl(I6Ja?0%U zBbOngW18g-!&Na(77Oev8>H;`t+Ew?@jc8H*L8hunKBiD?3(SW8xVK2SKUUV5g`ul z+DxYd`?HOI=8||Wh+Xjkhj)0r1pJ=v5#u7Hmva%{XT;?U|eVXPbLQJ%jmN0GVk1y zlGkUg>@Z&zoPE_)#(rGRB;5$a0uZYtzf%jZjLjyPdxFcDFn5>z)_7Z^T`my4UUgi}E%rbYF$LTzjwkUPkPKh-797p!Z@I zVcg|QyWRH^Vi!Z)Z2?#%v5V%N?t75% zkjxy}>3a-EKodjv!??>mrXrwzq5HBxNmJ|sb|he{{~!yBe*}l(<=P9;j4>)38+CE` zGcG1O!?K5@yUN^O`F}DcJ4`uS9nr=X{pPQCk!nf;ce?JVDJR?ia=$(|B}JVPhVHTa zsZ_+Dhc62q&%s%lg#PfXom+8!r`9gFW^C;1)047IV=mxqixD{6%GdzTwknfw#X@2t zSDDlk8ldY;?m6f>z^T?FJ%1r2a33o{&f@B@^r+Kwv&|tDP3IX4+0bG8u~~Q?IvQ)@ z-e5+`64$QXVq?o+<@b z`8Ak-_;@X*syFkT*I(opy~hXfJJ5DxlS=}#YK~${Ce3|# zs?>UJtFG@^muc&33QdoKvFA!m-hYXtPi=eYaMb^A@}tvz>E-x!;qsIP#oS2$PAsUPmt)ul*qQ?rIVYg}FesUu`urmBmv-8^gN`nA*E<~U-kh%1y9146f#8O#Lo%TD6qEAk zlxf+{tsP1f(5KhCpj&aeIeId@H6V24`a^7zSpG^&{Y2oj!T1Pw#xoXu)9iYj6QmpShDLl=O zBtf^X3!2AZ2hZ+4H#|&u!Xj|g&2iqop<-{ADz#9WbCWe8tF`Mq4d4#NK7TDaE)kV` z;6x(UQ=mM4(O@d_ZKyz5@n}z}p(IzUBs_ONJBhf>zY<9Xs7&eGVF! z*Ioc&yp|Dj*Rcwn8oZebGyGq{IU>lS_r%_U9K~X?)OR6%4-Z-zMHO?!&eCqiN|PSH zj6ERjDh`F2F4>tp@}qnzqm6Q-jhv)9Yi9q2Yp*IuS$mxQe`vPz*Z%LU<@h&Or>&*x zlGDCZBeK5Rqq&Wy5S{v&s3XqjM1S3#52OFSeKMrGho4IFJWXCB#sr#C;~H1tfg4-> znhAl#mQL~?m}~nH=7{R zNlkW4(=`b-Q*jw${6Aq)I(}CJ&A$;*tfZNGr;c7iAmNuwx~r=Rno%X%EQd#-t4;l} z6|TOzb@n5}X(i66Mp7H!|Mwmj90BMJpnbD}M^3GIX*uia2;Lr{b7@I)It^zR^c@~LR zO|?VAU@iu<=6y3$3u~a_0;*PX5$@%y_LNZlj&GtjKrslWh{si&Uo^5*)#7uUo9*j+ zOq&HnZic<@F|-(s2?RcA(*E7zgK2Z(r$BzO#6GR97*cRhQIJ2+v~??B{}B#^J-L1K z?W7XEl6|PUM)0w5Pyw!IRgEG5dw2jC1Hga}fGYrB2>=L(>AV0S6Q+|;5?c9Ns}&N4 zdqbGwkvWWia!2XY6!>)LUolVU&U|O+X!q{L(kzJoV%|LOi!{$1j)g2ceX2{b z1={JC=kl3Qy-}A-zLL%jO9>xsx&(hqi4mS39|L2^H9py*kTu4-Ml&m;#rxHJq!_9= zsoO80c5s|xq*bYF?iVD}cVIap1;`t!>Nb&&>-II<&hzN_ zAt7@s=?+#r8kICa3BCQ`cngaDP_wkcd_!_C(cC6*;BaLGn1-bl?K7UcK6gJ4Dw0J< zD$9t0tp#=Vj2{|W9QN4OP9G;Ex;K7H(2$=rtuwq@{KapM!pP|~;aadWh0ze0XU#pE zHD(r36!`n0smZTRgG2Nt+eywYT6Rxh9u`t1J9f@#Tl|2MJ|&tzeHH1Dl0I}3fbK)e z-Ewqw{gOno9rwTY!u$41THlIER9Z-|nHW~kkz*$;{eJWX)(Ev4D9w{U?)LB7g<+q0 z@|AMQ!*EMgItOv^1_jS64ds4Nq+k;iiM9bnc58)Nvp98WSdtBZ=TOszlUvKP{V9P& zQeiRt>htDY>WnVtpxF}U(Rr_I5=@3K>WY30a?=A6`MGYC~o)<;uT7+b#VxHtC)3f#HQUk!Oq%kMAKJawaw}QxtZ6A zc&gi#yEwZmyaig)F7uC0G{P0Od$SUlyZZ3kvM~EYK5}W3w-`FmlhZ8j6sklyo!c|C z-UsT{tiI5&f>UX5AblMFq783oIS@yz!$`VgD&$7zo8^VaFl~}+< z=C`-qsYg*O>4eQ^Uo_1*rz|H7R9BP)W{b03R`Pno+|~LDLj1RGALm@{ZD66*>Kuj{ z2j_M&^AU~^Ox#iuzC{b5B&1*tG4^+y^S9sipe-)uyu2X;H=P*uo5c49Ti*xYa2=Q6 zkg56h1cXtyt+zi7*R^JHxpwXjz`y~A`3`YOpC4mH;uNgtT7NO%m69p^>DLp02YJI) z=1fXWqdW>zx)C7j`^Px5;$4$ zLt}4GtFI56O}}-M@&RHU+)hM%kH8m07u6!>B5>M>pj?b+IbBUAq-0*Kg#ls!W?+C6 zfNKCGA5k(FKYMd319jk8*f^Atk8TN>1rI%oNJ*V#NJxMPAp!#Wg4B7n@a~(!(UY1d z`wXuQ8%j#!Zoorv0`RmP-4}q|D@_H*>L2rbMNYLvF*C0*NHF=>H0?9bCUE`UV@O*e zoDJhfE(t00-)bM44nkaiFD~$A9~}}fSzNi=t7L7}Ab+xPiJ5dMM98b5j~}F!zpAsFMUS2Vz#|w)*2-s!xuVvN`q(9{z~AUG?Hsve8xq&E-J+zl zSY;7BqCV3x=tEcUSpUWVKLbB|fAyv{s)Kw&UG;U?h4OQT4Dw#R-zU7vL__~JF*04d zmioqcv%El^Mc6f6kYvH=B)LBWYmNG&L+ zLNtUAGCzFd)y@ssLIs(>I8vB_Ri9bMCQHJhfi8-T4co?E^VpE|+%et0n<>SyyL?r$ z>xPrAF`h_*0!LdXx zfO=5?xPFC-=SZ?;HC(&bDNrT2ED~1qJene+00?tr9^&ht9aX&uJN~rjtZm_M%%oY! zxv}Srb}f)>-oZ==jBf;eaT#;!-#Q9Y-AvqbMlLhjym~=e!E1wyKEgfu0lTdB_(stuc>$s zbCebpyU@Vq`!bRx9UDB$9Zd@$)L=rz0_mMvc19syJ#^ZYhYa2CP)dJGUYnRC+NeT$ z1}glEE4*))T3srd_c?d?7_lePI@{Bia9jgpT3$E(WB!6y#OLujSg@)`pH=oWmYlOH zd?xZb(@e3v9C2_OTo7B@FsY7gIyy%f^-K0xDtMa7obuqCOb2^rQ+M0(y336V8m;L- zb*^H+kUXwEV;B3$W5b4h1C`xiibUBZ3@xpEFSMYs>xta8hV(UscrBRrmqWDX9Geut z_E?mfAR!NvSR);;Q6`KAxGc>S$tRLQ2J82uUr1_oXM0ok-v3rejxLB6(!99LL0>S} zz<99PTlpIzW!^5;yjKZow2^IhzyFIaw6odPIDM)_^2B!&hxvV$|UY+FiYb#wEV zmS;Wn0!ik@K{EvgO~q849pL|bxz66=oWObpWr(N!DRaSrb48;(I%GLJZpeX*OCiMC zJ-+C-p2qz8M6`W)eSpJE31+xs^c%4Nl>lqz6MB|In#B!?@%%yyq$#^7Gp?bj`caPg z>jGh-n1PKJBBq4CiW*O2K5hi7k*L$j3?WSXfvl4)%}QtfZV;M`>Yye_(KDu|Spf*h z=#i`mWBCk2bu7aD*S!@Bp7KThb|hz7ZYo&oW zA*PB}tu4amjk>v_N`nPQXu|CIaVk0S%N**j2_cs%;J$RQcjGjz`7+{mXk;S&TpmMA zJN1s}mbv%$Lo{@2(;W(SB!~^!AJk4M7Zip{gl5g?Gk~eAzWGQ&R(2LNgE8G3iI?$#QQ5@E4{U!8Da0A; z*{Jmz!6|&xm-@K)!y`ZBqX}&+om6E6(0}V?!oie9<*<6(eQHV3pUq00`AdqMuPjqG ziz4fnMjdZCK%|*;vL6ImIyJ^MMm?x8;bJ&8E)&W%eNkp#Dv7ZVOI<3GaZK8x!br~1h##^5rV3VrE+t|I_ zLg|baZ3BA@s?Q&v5a(NtY~sn9DkUPRfbQdw01DA1g4QYHV%&J^l?N;2(JC;}nZ*{> zhf6)%4fNyxuz_#;lgG=fr;Z0BW*~qNG}@Qh)WV!k5ug!R)XNF~Cyi!^ue|3g90n}B zhe}UIf-gs#n5OwTg8&jG^U_y0!+S@r$~yxI>M~SlsDQrJewC8iU7XACnlV@ zFR*T)es~4@K9s*w|LaH#jK2$lU%w&I$?dgQc(~+={*QR74j$DqZ6GS=Kd)YZ@EN(H z^$*WTS+6vF{CJ7@*Y&T$x7z#~YDXlpexFif&}wSe=zOAZ^;J_$qy7BlfzF^`5nmYjJ}O z0Kega$+d_9n0OR?qT@+G_6&1v` zc^k6+IWYp{DRIrAU!9MidmhFLHZ-lrKS_DV?bi<97-GQT7U)WS>gR;mXLfUTd{)6Z zzxdc{6hC%I^d9&R@Al+i?dJ9B+#p)M=N#{R6mjUmaw4T4=6n;}XGG!AA8Dk>OSJeH z;v1z2N$UbkZftr#wH(f{@RRozAL6CcC{nR5|M2>VKB04jsc=x(7Csfu%G(G5 zsj#pW1XH+#?w6SZU6yco*TFSUH|f||(?XtE%chqhe_IcCCJcFI+$Q!$HpA*#YCX&a z8yr%6A6GEe;3txS8{N{Ik)(wg$Q|jjL{UPPUdJ5U(|hNW;3?XGa4t-kI4p|ZlQX*Q z&r#mZ7vD);xk8^yGuG`%%_`0x-ATO<4^GKMcVV>r8#TE`fBs{hU_0jMCE zAhIS2ittmKdpn_kdMUrpM;e=bAmYkQ5v7EmJ;v@I1E+y=y_O$m0lX5$}h!5)5&2yN%lU-pKy?YXdZkv@xaM_?WT2AQ8W}6Cp53;Q`K8 zUl8X-X3B@P(-}+b@DTO`LS%McoS8PZ>uKp!3eYLK9FuH`{CvEW_g;>tVDwOWjE@-s z8!z-z1Yw0R+Hs5(L5YkM{xw*iL)Ks5$@VXD(j0F(HK{S1ra9=0jy%lTpV@+)D){FZ z+WN6aQJon%iPlOFsx$7h;D52*!&C|VrVMPCExF6F?~#UGD%<~DDm0t+wGVmV1t-|W zvSF*G=*Pke;wTSW!jC1R5t*msn)8|+{;*W5#c4I!kU^r^EQWp}y_3*(7>b^v`TR2t zHEG7rqrWSWSA-XJrp=Z|O*(}%+4<1dWrSMtbagepn-tRiB7R8t-alus#_{H|@z-Km zfXz~ngb_K+dAI$M*uTdZ`fwo!4OSk@=>hKc)9ghHb`;txR`9_9 z?*j)rpkjQ*q7=)x9)PP)C}wXh9D! z5Y8t>lQFTrGcsfOtN}R12Mwy1@{SS$8uVoR1wM!wu$;`DF{;{40?rp7oP&SPK&~zI zJY2d>7o?5WWEn(W$hPY;zhMK;_Ay2q^}v{Nh+USNQufeQ-^ z8QTvyumP?IpKy!?2Dm;yDr|u3!K?ip;PFF0A_Z+P2{^EwK^=Z3M`elp(m>_A?Ge908s~EqaGG9!09wN$f%V^(7x&H=Cvd? zh~wb5a|EI?{O!qoR}*$8XIlN!KG=qQJpVzLlh@S-r^!Y3pV64{n21&i*s{r%u{ zq8xox-T2PNBS8CA0KRm<%`mHnM>%x{2#VmO&Wxhw8(rY}PEiA~{j46vpUw{N-4TQ3 zh|2PNZ7+;hUPB3R)sTjS;=Ptz86ocdL>|8lCAW=%-b5wk34vdxciv(S*|{g%8O}wu zv*y`BtEC*IVf;?FG_D{c@Zp+ ziF(3zjVVEgLUJCZHa?8)Y@{bO&I)vqxxE?EHk|8t^4f)eC|^Zq;AyN9iwhOuut4gk zWYW+UflClZMaG(bq`gm-D&ZaQSqyQz$itSVvuKhPP)ZMQx?SioK1M|&679$32#%vL zBd|4hWv2coAu}Uj;Uwd1HM3BLJ!2HzWhPHia6mqBt^Me~wF;pOxN+U$L`&Xcu23y& zNLW3mD=5CP`%oJ+c7>i$OtPzZMi!Azs=71vRW( zwP{0-P(kLecTLQ|hR^C%lN|99KFDk}apg?CGB22*NQJ%Jb9!wXsiMTez?oRs*R?Cb z!-t0vY440cN`0W1gB1DP&)&nNIzn^e!67%7eeV0;g^qc~r-yaEK^+tYi}q;Ek9P!k z?}YfLP%O)GA8yn>LR)UKUvo~WosQ1n&o#*#k>M?$&4}fp8j(>kC%cvDk=k9zKbA># zi>kA{5V>X!U0?bAUIXbw%LkQwvBHwP-9<$ZX-Vzn-$xwmf*MG%?57@P6{e7&MUokj z<|&dHD#0s&8oNkphh`jVx6Zh4b04iZtdoKYmbOCY_x3a3ek?_}B)P@%oR*y4E~Yu$ zjC!S#l6+Qn+LG^DVZ(m}mcHk0oqa89cg~)zls~dW8_|0_{1!Y@;d>79{A;ha-Tdhp z7Mt_xzg`wS%p92A`ulHG2_@ltK9#+@v!#+6ROO+D!H&mjm_NE3%7=87l0dHCkss zo#m9zp-!PAz0bi)4*ZC-t)}@@qP40%LG6IOd|~#v_K$8pzV2ucI~daC0I z<<-^88u}O}X7+c%wWnKmXxljhy{1lA@cxTIB4v(m8MS3Nr>@WJ_>gQ)X0O&XH9znC z$|-iN-^*iIeC)Ct$k~xnx9V1&Q~a?=H^-$yQ(MKrX^czL!{(;OB@(KCw(9H>%?aWq zsaB(9xR)~>-9G6K{GOXy_|6wRpb~-sZvgtrz=JEeBJdnbe~*TNY4xUue=@=iY}Zf} zyAT3)t~FD9g1T8Q|KfFA-=_6_i?bQi zQ`GFp3evxsyrpx9>PCIngDvdZk?vKuZ9Dg}3yT}*Bd*q(58J1vCx&(hr)g8F4y-a@ME_W<0|kk94PWBz zYI{V`zTt$^@)ixcEuB#EOaNAD;$0`6qA9jsh5UHK zb;9)_F6rv-rId`TIVLp?KQmG!PAblio`9jJt?TVuaJoRv6Q(8@m$d!Rwl2K%P)Mgj zHW?nTui`W}Kk1hHF3gUMeo%G6FA$<|`D;~U98gELfMS7B5`dZ?0hBC^LI%{72cUj0 zy5%}*I*`$8wZW*p!iCBeq5}ptINDoIK=l=7L+Q zWl-H`QkA5+G?RT@QU74bT|bzA@mro*$x80x6P}nhvr=`=`=)%R1J?%+tF6g}ccE)m z3^Jecif@Zt>guXZnRr|hZ45X2`|+nMN^VOnZgVN;0*gW^Ozh}rpgSt%$-*%R*pD9H zWYyEt-QTARe!xbCTaZ*f(tEfzKX+(8Ox)P`c00S*8b?GC&rb}WG_{<^+ke9oZKCFq zQ~rAIFqOvg^y^_deVo)-;MW6?+O`LN-A|`)wf|LI6qK*?Q%G4pqAIM7^iK7*vGnc5 z#Qw%gwI6b_n2rWTn4>D5K?MROuG4Uk$S0=vDlHAe+6iXKDB9Zwm1f!^e{@ty&+;hF5+bx zlMJja&2i>AI>F!Q5OT>;rshR#nXcQgpZXA9e+s#i3gKl*X~}7XI6kM41#y>7+y4#d ze6^k*Bkhc%Y^8kOWbwVYceAO`FYhHj8oZYDk)Rl!m~O;ti_!b+;R1tMMa_wDgGK#w zcW=$2)oxcSebclLdxF=4XsoK929)O~92PY0_k z#M)k$7u_#QBOz=@mu1L&PGzI;iFQR<(vkfotwv^u%h2H(+dy@39E7dbt|`W5OhSk) zlcaKahVM)>@8=njYbB-|W8W=OaJrCoA3s+LC2JH^9WQ+9N=xTgV+2tU_|r>bq>vPDubM=RZS;dj2- zWU76ffOq+L4X%S2jz)+@>`#we|6@y5T${VZXNY9v+P=d|@s%YmBj?)?S_Vqq#jp<-4^6npD;>+~52vpZpwR2vm*YTjuRl?dzo?W40ynV&eQ2V`cF|gD+TEND{f$ldy2w6sa9Cc~BmFXV1UySGazKUXq19 zxW$QHp2$CIXMMOJkYq{KG+#B39AbMkEj%vzE&wUvr!>Mr2etRo8#9V4mNshdrv@{^ z$9J!N2>ipk1YLQbtgf+Ol7)F)IX-Le(tF8I3P0|+&-`dznvf}DZuRDB`oYra)WCI$ zr26YmQ=F1FFC^ub1yNnI5mUZ;`CSr3R{7Y4b^K{_dHsZRQ4jM@_YtY!H!d2>0g{RL zm;PVTZ$4<)44_gZ?(ffiT1C5(ie?|-^(|QtmV<^9rps zidiyCW1P7*wlAHzWAo!7TKBSLBZ~>wL zh+Gos1{8Lq;M~Atf(*j|EF~;bz43-O>GaD4w``wOH^h*|eN$~p>X-a9**fkU?BCS) z2EF6CdqMK(!x)-Ori(qr!gYY{z(p2wc0J#gE=x8LJ%1)?)#lwoZ~pm>e+L@slj<7XmNb0M*96bj zd=bCv&zI^P2Lq*im=edD=5NUx+TbJvUCwBR_tTOal9(6rMcCt%OxD;xtI|k~A|eGz ziru2R>v+@ZB_Y?gzB9AJnH_%<^+anLg()SFiS5?~qx7kr>xkT4 z=`!W8X}L^&;)Z0iU1sZ-;autCR!64&?2z%6e9nVRA42)awVy^a>#c>PjRj!n252;? zf|8>)aYS|?;wIHn+>VD4aIx3oJ_W*ff6~e2mAZ|^k0ZUpghfiKwF^`mc1Jf!H~hu2 zK6lx?mY6(wsh(iRiyUE`JSV#O~#!j+C3VGV&$va&vl8G&0E((hN)ewKS#E%rKnC=0yniVz_ zqrs$sy{xr#^nL3ExeopNrMW7Gr)uL2Z|j+Mqme^dD{wMegHwW$-qyagrjh19*dwS4 z=vA7B>c)#+Dprebsqzw$7~7cJQnWU++-rP#O0sqszd*8fBSji! z92WuNu`%^ZQIh7RkuG|8nmFH z7Bhiif%k;-bxrTGFJd*tLg_M7CeibGPun(cmoW3smUAO$sE6>a#SQ;F^ZV20B+rYnC3wP{bkq*9G{+f&=i5B;Yj~Jh zxvyw|mhehP9xmBPAB2kH-LLR^{hW4ByU*p?IyUdYOI^{IWdU)44}M!e1ghJ3{SLlOWp4QIP?m^pcKyTo0v{d-dWM>1WKz_tA^fd$g}sqHrHGQqsXCh*vbxqu2V8016X!@L4W{%HfPxj2& zZQCt6H$dYMbwB?^+t8|U=VwyhMJpSFoWaz*p-)o#cwu-35dhumg_!&BybSBY*+xFZ zOF&`fDVdYUUQYv2_YaT6MsE70pkxo?EKPki1yjie#@@`jklreT&zl3z8FUxfG*y9; zl}FYG1U>TB?TZVWN_J$dq~V3dXdmbD1MM=BA%Cz^)zTv!olOHIr?X>n;|xsm?4%av z)N*3Xrd}(2RPJZ}ZT!W9GXUy#L462^w{6i(Tok5YcgT*ogy&ROQ1pU-zu6>T^BU7> zntEc~@z!yU*PqW!^mZrwDNA24c5-9f3o3f!WchT{;b3gM$A(e4zTZT9?2Vnn8SKPA z?2}QKdGPY?Wu<(2{#(V5OGLeBg;ujh;L$fXRgT}o8Iy(?G7^U^hujpxU8z>W{`AtJ zNHa}wqCfTve}^F59acKtMaFr%lO50Pt&YgpBAOCO2N8t}y%V5p zGiKU}zC?(Je}toXU$VCJto}jB@q@>Cc4VpJ-9qv(ZWJRSZ>ufe_Z-v5r0Ec?9be>U zw)_iG2MKo6KN4N*3&;?65kxmq$Dm9G^r2lQjHeede(*fE^~m$(QsxD`sGOG_)PXyE z_B!4R;N$jSs-tY@`tgV>5$PgP`qg=z`WFnywl8PvjPR!tdEwG21)0@YYW1A5Bpjh* zahYc=@VB>4-d!ATo<6yVf~Sl>55JP{FGM2k0iWrmC7I(Y`59=~UeUF9>6GiM=@aHR zKezI01xv>?UQTah5F;Ig=hch1u5s2D%yhMsptF1^KpOn8(OQ&lu^i8eZ=N8wd>ICR zX&oQ?BB`Lq>+W?=lZZ*W^~i~4MC>x>u|;nf<4NVa&Vr(8e;%S%OW{bxwg2ruA2Wbt=;{yE~KM+#ob z@%|GI#gI+omK?KlO8Rgvec5JtsW8uq9qq6P6?|q-601|k%39dFEbMM^TWU=*HA$7S zn4puae@?5(IDV*9qIvNOr=MR`GrOgaS!E{aAsxYGFqY%Pe zjjx^!lZz||+!oCzEwBIdUl4RdzG-;b1hfTF$}fsc@-wlBZI1k* zw-EM%a5KN0za^E)8%KNZt-j{_vW3xHD12G@cSHr^yQ~c}a`F~N9ZDlqWMuOm!feK< zS2ZH0aaD3Zmt(RbDtyiw08&o7Uiti``elO&+3-B$J8IdRn>Sq5w7gP-j3^k9HbJfM z0?nbma-Z%j=CUujuUYf=jBB}Gc^f}8N#^G^xZT|bQ7m;zcXC&*Xd z%|mrAc>CHGWb3+@a-OWPT9i9q6b2!fKkSMXE^aQir%WZXUQAUN>^0CKPLQs4@(~Qs zQhjBOjH+po`ZBudY(=!-b1!8W9m$?3Ei-S+@xI{Nd4=wrBX8H7{XqRTBd2KRdLMdX z(P~VRILUV{K70;|Sl*=}LuT?kjaVk61>pN>gbptX8M0{hafA-F1V6SEWsjIQ*Q;ys zH(syEkPXAuDO<)PTwld;{tQEi6g`cw*oZh zq_8Z*ucpHD+7RV@qQ{jkZKY~%Y~vq8IY&^m(aC{m4s{i7I?}S|ly)8yx!Q1;9J+Ua zPS&4%`F5JM^h(-Z73IRnBg;3t-rLF%Wm#HioWz1O8_so2&TcEwcMl7yOa3)}>AC!i ziB89qsRI#wX%hR`%BA~j%PWbA*Si-5gGsbLbi_%LSNn>s5C!CnZ^3khX`z?#S-~J+^37N)o-y zrjm&fPGh#pW@ed+jjQx2tfl!z&cI@Vsv01n?ihz3SMDBK6&?-CY0qTTr=tGmMJK&u z{5QK>Qfd}1YP$o^Hs~|ow%_5AthU#JLJq4F4=Xaxo+qUjWr)0`L(4a~Svlz#42qpnOlg{W0+lYh0+^<*nryO1t0h zi}y_4tK>YzR(vtpL`mY8`@(e)oSg(P<9{$o`Et=oW|t_!ol6~7q|=qIORr2~JY`koIxFuv3uRki z(x?u3MtKS5F1L7xEqnQyGRqQM{gH$7kzmFWS1yfxfi(f1l*wFShsm63W6KdsV+2Ba|pPLou&hm8}SWa z#Eg6}x$%!CdLCR2lv-543<$dq4b|76R=0(K5h#_i-|H|y8mex0PP&-)_9A`Bd7Bt^ z^5?9vNuA&Ob1X|@en2b49`6MNnEXsG#zcaxq6U%_>UO`Le-|&8-2*=|6Ng>zD3MB8 zw#sVEj;l~h*^fA{5~#p5=Qo(4U~F- zQc(OOB7B)6xvi+~$12bLiKUdr;Kd4d@iYU}?*fb4i@ZcsR%2SRt8uQ{@xkl|yP7|y zCK(~RW}Mu$&r9lMuT9`08?PfE`}kECUEJUOV} z2xedtEN?M*J$BEA0a^g;VSow%Q5c{A;5iJC0kG*t@MiQ?V>NejM)YlcO`pm*Vz}y@ z8|m+_re<>`mgxOvoa;dpdiV*lhQyVkp<{^E$Bv{GdPmrp{rQFZa_zWqy9SW?rb85?@Vi>b@C`Y7q87=jfG{kDNx_iATxz)?#lhKG*+LwIGmHG_rX-PsGuiOkw+?Tt{ z@QD80)*l|HW2=7h%x%cUeMu1W2hp1aMdKwwDF7p=0Q3T2g$BSn09Y6R+yhXCsqyl2 zc^oPN>T??}o!T!!$nfNr@zC{*D;JN*-8DXT1N zrTR6=$P0CP_rBL(NYn+0`)r@)M}K_EU658)k)$N&qA^IH8^UaaH*OwRfnpl;tYq~Q z_pmDXXQ+)rw^asz7))94$x3p4`Yw16S?~vS-2Yi<9`rHht(k%qtK?Cy;){u~2|AM8 zHy%E=c9Ku&`?bkoGzw%Y2rOp-#(JMYel%1MtX2UdTo>mV1q$556aOq${Zjz8P^FS% zo7Q@FzMAUB?*ZN3jY3z9YtFT~aM3*3<+d#xok-8$8!pQQ_;r3AI!RD|u~66l3w3wk zQg~8>?MyT1^L56<=6#~WLK4$#!_?*vj-%4rw4z&6ws-D1lRgaG{IvDuGWd*K{Ng;N zOvbAz?z3}?jh{D7v<8{%t=jiDW1U|7E{WQ|7&6bWOPc6D*g^i|U{bzlYZ61`Co|t= zl3+1&Ff_IvQ{t}m>cx`#)*dTdf&H|L7M00dcu7-37;BUBNE9N+y{_a!&n|ut>(VLn z{TIznmgegQH)PA2Gd8s^Ul=doc^b?ggg(kU8PnPewv(W_uh(X@VDLGxU6pNxJ`uQ@ VAIS)7nt6Z^COkccFUEfK{{iHuH@W}- diff --git a/connector/src/main/resources/bedrock/creative_items.1_17_0.json b/connector/src/main/resources/bedrock/creative_items.1_17_0.json deleted file mode 100644 index 2226e8272..000000000 --- a/connector/src/main/resources/bedrock/creative_items.1_17_0.json +++ /dev/null @@ -1,5135 +0,0 @@ -{ - "items" : [ - { - "id" : "minecraft:planks", - "blockRuntimeId" : 5640 - }, - { - "id" : "minecraft:planks", - "blockRuntimeId" : 5641 - }, - { - "id" : "minecraft:planks", - "blockRuntimeId" : 5642 - }, - { - "id" : "minecraft:planks", - "blockRuntimeId" : 5643 - }, - { - "id" : "minecraft:planks", - "blockRuntimeId" : 5644 - }, - { - "id" : "minecraft:planks", - "blockRuntimeId" : 5645 - }, - { - "id" : "minecraft:crimson_planks", - "blockRuntimeId" : 3799 - }, - { - "id" : "minecraft:warped_planks", - "blockRuntimeId" : 7352 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1278 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1279 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1280 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1281 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1282 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1283 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1290 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1285 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1286 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1284 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1287 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1291 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1288 - }, - { - "id" : "minecraft:cobblestone_wall", - "blockRuntimeId" : 1289 - }, - { - "id" : "minecraft:blackstone_wall", - "blockRuntimeId" : 497 - }, - { - "id" : "minecraft:polished_blackstone_wall", - "blockRuntimeId" : 5884 - }, - { - "id" : "minecraft:polished_blackstone_brick_wall", - "blockRuntimeId" : 5681 - }, - { - "id" : "minecraft:cobbled_deepslate_wall", - "blockRuntimeId" : 1115 - }, - { - "id" : "minecraft:deepslate_tile_wall", - "blockRuntimeId" : 4247 - }, - { - "id" : "minecraft:polished_deepslate_wall", - "blockRuntimeId" : 6059 - }, - { - "id" : "minecraft:deepslate_brick_wall", - "blockRuntimeId" : 4064 - }, - { - "id" : "minecraft:fence", - "blockRuntimeId" : 4723 - }, - { - "id" : "minecraft:fence", - "blockRuntimeId" : 4724 - }, - { - "id" : "minecraft:fence", - "blockRuntimeId" : 4725 - }, - { - "id" : "minecraft:fence", - "blockRuntimeId" : 4726 - }, - { - "id" : "minecraft:fence", - "blockRuntimeId" : 4727 - }, - { - "id" : "minecraft:fence", - "blockRuntimeId" : 4728 - }, - { - "id" : "minecraft:nether_brick_fence", - "blockRuntimeId" : 5552 - }, - { - "id" : "minecraft:crimson_fence", - "blockRuntimeId" : 3777 - }, - { - "id" : "minecraft:warped_fence", - "blockRuntimeId" : 7330 - }, - { - "id" : "minecraft:fence_gate", - "blockRuntimeId" : 4729 - }, - { - "id" : "minecraft:spruce_fence_gate", - "blockRuntimeId" : 6764 - }, - { - "id" : "minecraft:birch_fence_gate", - "blockRuntimeId" : 400 - }, - { - "id" : "minecraft:jungle_fence_gate", - "blockRuntimeId" : 5158 - }, - { - "id" : "minecraft:acacia_fence_gate", - "blockRuntimeId" : 44 - }, - { - "id" : "minecraft:dark_oak_fence_gate", - "blockRuntimeId" : 3930 - }, - { - "id" : "minecraft:crimson_fence_gate", - "blockRuntimeId" : 3778 - }, - { - "id" : "minecraft:warped_fence_gate", - "blockRuntimeId" : 7331 - }, - { - "id" : "minecraft:normal_stone_stairs", - "blockRuntimeId" : 5571 - }, - { - "id" : "minecraft:stone_stairs", - "blockRuntimeId" : 7035 - }, - { - "id" : "minecraft:mossy_cobblestone_stairs", - "blockRuntimeId" : 5533 - }, - { - "id" : "minecraft:oak_stairs", - "blockRuntimeId" : 5580 - }, - { - "id" : "minecraft:spruce_stairs", - "blockRuntimeId" : 6796 - }, - { - "id" : "minecraft:birch_stairs", - "blockRuntimeId" : 432 - }, - { - "id" : "minecraft:jungle_stairs", - "blockRuntimeId" : 5190 - }, - { - "id" : "minecraft:acacia_stairs", - "blockRuntimeId" : 76 - }, - { - "id" : "minecraft:dark_oak_stairs", - "blockRuntimeId" : 3962 - }, - { - "id" : "minecraft:stone_brick_stairs", - "blockRuntimeId" : 6941 - }, - { - "id" : "minecraft:mossy_stone_brick_stairs", - "blockRuntimeId" : 5541 - }, - { - "id" : "minecraft:sandstone_stairs", - "blockRuntimeId" : 6533 - }, - { - "id" : "minecraft:smooth_sandstone_stairs", - "blockRuntimeId" : 6657 - }, - { - "id" : "minecraft:red_sandstone_stairs", - "blockRuntimeId" : 6460 - }, - { - "id" : "minecraft:smooth_red_sandstone_stairs", - "blockRuntimeId" : 6649 - }, - { - "id" : "minecraft:granite_stairs", - "blockRuntimeId" : 4914 - }, - { - "id" : "minecraft:polished_granite_stairs", - "blockRuntimeId" : 6229 - }, - { - "id" : "minecraft:diorite_stairs", - "blockRuntimeId" : 4425 - }, - { - "id" : "minecraft:polished_diorite_stairs", - "blockRuntimeId" : 6221 - }, - { - "id" : "minecraft:andesite_stairs", - "blockRuntimeId" : 144 - }, - { - "id" : "minecraft:polished_andesite_stairs", - "blockRuntimeId" : 5657 - }, - { - "id" : "minecraft:brick_stairs", - "blockRuntimeId" : 856 - }, - { - "id" : "minecraft:nether_brick_stairs", - "blockRuntimeId" : 5553 - }, - { - "id" : "minecraft:red_nether_brick_stairs", - "blockRuntimeId" : 6448 - }, - { - "id" : "minecraft:end_brick_stairs", - "blockRuntimeId" : 4669 - }, - { - "id" : "minecraft:quartz_stairs", - "blockRuntimeId" : 6392 - }, - { - "id" : "minecraft:smooth_quartz_stairs", - "blockRuntimeId" : 6641 - }, - { - "id" : "minecraft:purpur_stairs", - "blockRuntimeId" : 6370 - }, - { - "id" : "minecraft:prismarine_stairs", - "blockRuntimeId" : 6292 - }, - { - "id" : "minecraft:dark_prismarine_stairs", - "blockRuntimeId" : 3986 - }, - { - "id" : "minecraft:prismarine_bricks_stairs", - "blockRuntimeId" : 6284 - }, - { - "id" : "minecraft:crimson_stairs", - "blockRuntimeId" : 3819 - }, - { - "id" : "minecraft:warped_stairs", - "blockRuntimeId" : 7372 - }, - { - "id" : "minecraft:blackstone_stairs", - "blockRuntimeId" : 489 - }, - { - "id" : "minecraft:polished_blackstone_stairs", - "blockRuntimeId" : 5876 - }, - { - "id" : "minecraft:polished_blackstone_brick_stairs", - "blockRuntimeId" : 5673 - }, - { - "id" : "minecraft:cut_copper_stairs", - "blockRuntimeId" : 3872 - }, - { - "id" : "minecraft:exposed_cut_copper_stairs", - "blockRuntimeId" : 4705 - }, - { - "id" : "minecraft:weathered_cut_copper_stairs", - "blockRuntimeId" : 7499 - }, - { - "id" : "minecraft:oxidized_cut_copper_stairs", - "blockRuntimeId" : 5611 - }, - { - "id" : "minecraft:waxed_cut_copper_stairs", - "blockRuntimeId" : 7443 - }, - { - "id" : "minecraft:waxed_exposed_cut_copper_stairs", - "blockRuntimeId" : 7457 - }, - { - "id" : "minecraft:waxed_weathered_cut_copper_stairs", - "blockRuntimeId" : 7485 - }, - { - "id" : "minecraft:waxed_oxidized_cut_copper_stairs", - "blockRuntimeId" : 7471 - }, - { - "id" : "minecraft:cobbled_deepslate_stairs", - "blockRuntimeId" : 1107 - }, - { - "id" : "minecraft:deepslate_tile_stairs", - "blockRuntimeId" : 4239 - }, - { - "id" : "minecraft:polished_deepslate_stairs", - "blockRuntimeId" : 6051 - }, - { - "id" : "minecraft:deepslate_brick_stairs", - "blockRuntimeId" : 4056 - }, - { - "id" : "minecraft:wooden_door" - }, - { - "id" : "minecraft:spruce_door" - }, - { - "id" : "minecraft:birch_door" - }, - { - "id" : "minecraft:jungle_door" - }, - { - "id" : "minecraft:acacia_door" - }, - { - "id" : "minecraft:dark_oak_door" - }, - { - "id" : "minecraft:iron_door" - }, - { - "id" : "minecraft:crimson_door" - }, - { - "id" : "minecraft:warped_door" - }, - { - "id" : "minecraft:trapdoor", - "blockRuntimeId" : 7117 - }, - { - "id" : "minecraft:spruce_trapdoor", - "blockRuntimeId" : 6820 - }, - { - "id" : "minecraft:birch_trapdoor", - "blockRuntimeId" : 456 - }, - { - "id" : "minecraft:jungle_trapdoor", - "blockRuntimeId" : 5214 - }, - { - "id" : "minecraft:acacia_trapdoor", - "blockRuntimeId" : 100 - }, - { - "id" : "minecraft:dark_oak_trapdoor", - "blockRuntimeId" : 3970 - }, - { - "id" : "minecraft:iron_trapdoor", - "blockRuntimeId" : 5073 - }, - { - "id" : "minecraft:crimson_trapdoor", - "blockRuntimeId" : 3846 - }, - { - "id" : "minecraft:warped_trapdoor", - "blockRuntimeId" : 7399 - }, - { - "id" : "minecraft:iron_bars", - "blockRuntimeId" : 5038 - }, - { - "id" : "minecraft:glass", - "blockRuntimeId" : 4820 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6842 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6850 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6849 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6857 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6854 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6856 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6843 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6846 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6847 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6855 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6851 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6845 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6853 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6852 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6844 - }, - { - "id" : "minecraft:stained_glass", - "blockRuntimeId" : 6848 - }, - { - "id" : "minecraft:tinted_glass", - "blockRuntimeId" : 7106 - }, - { - "id" : "minecraft:glass_pane", - "blockRuntimeId" : 4821 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6858 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6866 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6865 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6873 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6870 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6872 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6859 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6862 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6863 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6871 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6867 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6861 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6869 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6868 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6860 - }, - { - "id" : "minecraft:stained_glass_pane", - "blockRuntimeId" : 6864 - }, - { - "id" : "minecraft:ladder", - "blockRuntimeId" : 5262 - }, - { - "id" : "minecraft:scaffolding", - "blockRuntimeId" : 6553 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6977 - }, - { - "id" : "minecraft:double_stone_slab4", - "blockRuntimeId" : 7027 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6980 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6998 - }, - { - "id" : "minecraft:wooden_slab", - "blockRuntimeId" : 7647 - }, - { - "id" : "minecraft:wooden_slab", - "blockRuntimeId" : 7648 - }, - { - "id" : "minecraft:wooden_slab", - "blockRuntimeId" : 7649 - }, - { - "id" : "minecraft:wooden_slab", - "blockRuntimeId" : 7650 - }, - { - "id" : "minecraft:wooden_slab", - "blockRuntimeId" : 7651 - }, - { - "id" : "minecraft:wooden_slab", - "blockRuntimeId" : 7652 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6982 - }, - { - "id" : "minecraft:double_stone_slab4", - "blockRuntimeId" : 7025 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6978 - }, - { - "id" : "minecraft:double_stone_slab4", - "blockRuntimeId" : 7028 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6999 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6993 - }, - { - "id" : "minecraft:double_stone_slab4", - "blockRuntimeId" : 7029 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7010 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7015 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7016 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7013 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7014 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7012 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7011 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6981 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6984 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 7000 - }, - { - "id" : "minecraft:double_stone_slab3", - "blockRuntimeId" : 7009 - }, - { - "id" : "minecraft:double_stone_slab", - "blockRuntimeId" : 6983 - }, - { - "id" : "minecraft:double_stone_slab4", - "blockRuntimeId" : 7026 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6994 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6995 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6996 - }, - { - "id" : "minecraft:double_stone_slab2", - "blockRuntimeId" : 6997 - }, - { - "id" : "minecraft:crimson_slab", - "blockRuntimeId" : 3817 - }, - { - "id" : "minecraft:warped_slab", - "blockRuntimeId" : 7370 - }, - { - "id" : "minecraft:blackstone_slab", - "blockRuntimeId" : 487 - }, - { - "id" : "minecraft:polished_blackstone_slab", - "blockRuntimeId" : 5874 - }, - { - "id" : "minecraft:polished_blackstone_brick_slab", - "blockRuntimeId" : 5671 - }, - { - "id" : "minecraft:cut_copper_slab", - "blockRuntimeId" : 3870 - }, - { - "id" : "minecraft:exposed_cut_copper_slab", - "blockRuntimeId" : 4703 - }, - { - "id" : "minecraft:weathered_cut_copper_slab", - "blockRuntimeId" : 7497 - }, - { - "id" : "minecraft:oxidized_cut_copper_slab", - "blockRuntimeId" : 5609 - }, - { - "id" : "minecraft:waxed_cut_copper_slab", - "blockRuntimeId" : 7441 - }, - { - "id" : "minecraft:waxed_exposed_cut_copper_slab", - "blockRuntimeId" : 7455 - }, - { - "id" : "minecraft:waxed_weathered_cut_copper_slab", - "blockRuntimeId" : 7483 - }, - { - "id" : "minecraft:waxed_oxidized_cut_copper_slab", - "blockRuntimeId" : 7469 - }, - { - "id" : "minecraft:cobbled_deepslate_slab", - "blockRuntimeId" : 1105 - }, - { - "id" : "minecraft:polished_deepslate_slab", - "blockRuntimeId" : 6049 - }, - { - "id" : "minecraft:deepslate_tile_slab", - "blockRuntimeId" : 4237 - }, - { - "id" : "minecraft:deepslate_brick_slab", - "blockRuntimeId" : 4054 - }, - { - "id" : "minecraft:brick_block", - "blockRuntimeId" : 855 - }, - { - "id" : "minecraft:chiseled_nether_bricks", - "blockRuntimeId" : 1090 - }, - { - "id" : "minecraft:cracked_nether_bricks", - "blockRuntimeId" : 3728 - }, - { - "id" : "minecraft:quartz_bricks", - "blockRuntimeId" : 6390 - }, - { - "id" : "minecraft:stonebrick", - "blockRuntimeId" : 7043 - }, - { - "id" : "minecraft:stonebrick", - "blockRuntimeId" : 7044 - }, - { - "id" : "minecraft:stonebrick", - "blockRuntimeId" : 7045 - }, - { - "id" : "minecraft:stonebrick", - "blockRuntimeId" : 7046 - }, - { - "id" : "minecraft:end_bricks", - "blockRuntimeId" : 4677 - }, - { - "id" : "minecraft:prismarine", - "blockRuntimeId" : 6283 - }, - { - "id" : "minecraft:polished_blackstone_bricks", - "blockRuntimeId" : 5843 - }, - { - "id" : "minecraft:cracked_polished_blackstone_bricks", - "blockRuntimeId" : 3729 - }, - { - "id" : "minecraft:gilded_blackstone", - "blockRuntimeId" : 4819 - }, - { - "id" : "minecraft:chiseled_polished_blackstone", - "blockRuntimeId" : 1091 - }, - { - "id" : "minecraft:deepslate_tiles", - "blockRuntimeId" : 4409 - }, - { - "id" : "minecraft:cracked_deepslate_tiles", - "blockRuntimeId" : 3727 - }, - { - "id" : "minecraft:deepslate_bricks", - "blockRuntimeId" : 4226 - }, - { - "id" : "minecraft:cracked_deepslate_bricks", - "blockRuntimeId" : 3726 - }, - { - "id" : "minecraft:chiseled_deepslate", - "blockRuntimeId" : 1089 - }, - { - "id" : "minecraft:cobblestone", - "blockRuntimeId" : 1277 - }, - { - "id" : "minecraft:mossy_cobblestone", - "blockRuntimeId" : 5532 - }, - { - "id" : "minecraft:cobbled_deepslate", - "blockRuntimeId" : 1102 - }, - { - "id" : "minecraft:smooth_stone", - "blockRuntimeId" : 6665 - }, - { - "id" : "minecraft:sandstone", - "blockRuntimeId" : 6529 - }, - { - "id" : "minecraft:sandstone", - "blockRuntimeId" : 6530 - }, - { - "id" : "minecraft:sandstone", - "blockRuntimeId" : 6531 - }, - { - "id" : "minecraft:sandstone", - "blockRuntimeId" : 6532 - }, - { - "id" : "minecraft:red_sandstone", - "blockRuntimeId" : 6456 - }, - { - "id" : "minecraft:red_sandstone", - "blockRuntimeId" : 6457 - }, - { - "id" : "minecraft:red_sandstone", - "blockRuntimeId" : 6458 - }, - { - "id" : "minecraft:red_sandstone", - "blockRuntimeId" : 6459 - }, - { - "id" : "minecraft:coal_block", - "blockRuntimeId" : 1100 - }, - { - "id" : "minecraft:dried_kelp_block", - "blockRuntimeId" : 4533 - }, - { - "id" : "minecraft:gold_block", - "blockRuntimeId" : 4900 - }, - { - "id" : "minecraft:iron_block", - "blockRuntimeId" : 5039 - }, - { - "id" : "minecraft:copper_block", - "blockRuntimeId" : 3636 - }, - { - "id" : "minecraft:exposed_copper", - "blockRuntimeId" : 4701 - }, - { - "id" : "minecraft:weathered_copper", - "blockRuntimeId" : 7495 - }, - { - "id" : "minecraft:oxidized_copper", - "blockRuntimeId" : 5607 - }, - { - "id" : "minecraft:waxed_copper", - "blockRuntimeId" : 7439 - }, - { - "id" : "minecraft:waxed_exposed_copper", - "blockRuntimeId" : 7453 - }, - { - "id" : "minecraft:waxed_weathered_copper", - "blockRuntimeId" : 7481 - }, - { - "id" : "minecraft:waxed_oxidized_copper", - "blockRuntimeId" : 7467 - }, - { - "id" : "minecraft:cut_copper", - "blockRuntimeId" : 3869 - }, - { - "id" : "minecraft:exposed_cut_copper", - "blockRuntimeId" : 4702 - }, - { - "id" : "minecraft:weathered_cut_copper", - "blockRuntimeId" : 7496 - }, - { - "id" : "minecraft:oxidized_cut_copper", - "blockRuntimeId" : 5608 - }, - { - "id" : "minecraft:waxed_cut_copper", - "blockRuntimeId" : 7440 - }, - { - "id" : "minecraft:waxed_exposed_cut_copper", - "blockRuntimeId" : 7454 - }, - { - "id" : "minecraft:waxed_weathered_cut_copper", - "blockRuntimeId" : 7482 - }, - { - "id" : "minecraft:waxed_oxidized_cut_copper", - "blockRuntimeId" : 7468 - }, - { - "id" : "minecraft:emerald_block", - "blockRuntimeId" : 4666 - }, - { - "id" : "minecraft:diamond_block", - "blockRuntimeId" : 4423 - }, - { - "id" : "minecraft:lapis_block", - "blockRuntimeId" : 5270 - }, - { - "id" : "minecraft:raw_iron_block", - "blockRuntimeId" : 6412 - }, - { - "id" : "minecraft:raw_copper_block", - "blockRuntimeId" : 6410 - }, - { - "id" : "minecraft:raw_gold_block", - "blockRuntimeId" : 6411 - }, - { - "id" : "minecraft:quartz_block", - "blockRuntimeId" : 6378 - }, - { - "id" : "minecraft:quartz_block", - "blockRuntimeId" : 6380 - }, - { - "id" : "minecraft:quartz_block", - "blockRuntimeId" : 6379 - }, - { - "id" : "minecraft:quartz_block", - "blockRuntimeId" : 6381 - }, - { - "id" : "minecraft:prismarine", - "blockRuntimeId" : 6281 - }, - { - "id" : "minecraft:prismarine", - "blockRuntimeId" : 6282 - }, - { - "id" : "minecraft:slime", - "blockRuntimeId" : 6618 - }, - { - "id" : "minecraft:honey_block", - "blockRuntimeId" : 5017 - }, - { - "id" : "minecraft:honeycomb_block", - "blockRuntimeId" : 5018 - }, - { - "id" : "minecraft:hay_block", - "blockRuntimeId" : 4989 - }, - { - "id" : "minecraft:bone_block", - "blockRuntimeId" : 672 - }, - { - "id" : "minecraft:nether_brick", - "blockRuntimeId" : 5551 - }, - { - "id" : "minecraft:red_nether_brick", - "blockRuntimeId" : 6447 - }, - { - "id" : "minecraft:netherite_block", - "blockRuntimeId" : 5568 - }, - { - "id" : "minecraft:lodestone", - "blockRuntimeId" : 5438 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7659 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7667 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7666 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7674 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7671 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7673 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7660 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7663 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7664 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7672 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7668 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7662 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7670 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7669 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7661 - }, - { - "id" : "minecraft:wool", - "blockRuntimeId" : 7665 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 923 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 931 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 930 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 938 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 935 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 937 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 924 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 927 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 928 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 936 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 932 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 926 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 934 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 933 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 925 - }, - { - "id" : "minecraft:carpet", - "blockRuntimeId" : 929 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3619 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3627 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3626 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3634 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3631 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3633 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3620 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3623 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3624 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3632 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3628 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3622 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3630 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3629 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3621 - }, - { - "id" : "minecraft:concrete_powder", - "blockRuntimeId" : 3625 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3603 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3611 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3610 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3618 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3615 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3617 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3604 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3607 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3608 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3616 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3612 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3606 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3614 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3613 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3605 - }, - { - "id" : "minecraft:concrete", - "blockRuntimeId" : 3609 - }, - { - "id" : "minecraft:clay", - "blockRuntimeId" : 1099 - }, - { - "id" : "minecraft:hardened_clay", - "blockRuntimeId" : 4988 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6874 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6882 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6881 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6889 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6886 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6888 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6875 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6878 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6879 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6887 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6883 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6877 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6885 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6884 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6876 - }, - { - "id" : "minecraft:stained_hardened_clay", - "blockRuntimeId" : 6880 - }, - { - "id" : "minecraft:white_glazed_terracotta", - "blockRuntimeId" : 7544 - }, - { - "id" : "minecraft:silver_glazed_terracotta", - "blockRuntimeId" : 6600 - }, - { - "id" : "minecraft:gray_glazed_terracotta", - "blockRuntimeId" : 4925 - }, - { - "id" : "minecraft:black_glazed_terracotta", - "blockRuntimeId" : 478 - }, - { - "id" : "minecraft:brown_glazed_terracotta", - "blockRuntimeId" : 864 - }, - { - "id" : "minecraft:red_glazed_terracotta", - "blockRuntimeId" : 6424 - }, - { - "id" : "minecraft:orange_glazed_terracotta", - "blockRuntimeId" : 5601 - }, - { - "id" : "minecraft:yellow_glazed_terracotta", - "blockRuntimeId" : 7676 - }, - { - "id" : "minecraft:lime_glazed_terracotta", - "blockRuntimeId" : 5407 - }, - { - "id" : "minecraft:green_glazed_terracotta", - "blockRuntimeId" : 4931 - }, - { - "id" : "minecraft:cyan_glazed_terracotta", - "blockRuntimeId" : 3880 - }, - { - "id" : "minecraft:light_blue_glazed_terracotta", - "blockRuntimeId" : 5379 - }, - { - "id" : "minecraft:blue_glazed_terracotta", - "blockRuntimeId" : 665 - }, - { - "id" : "minecraft:purple_glazed_terracotta", - "blockRuntimeId" : 6352 - }, - { - "id" : "minecraft:magenta_glazed_terracotta", - "blockRuntimeId" : 5461 - }, - { - "id" : "minecraft:pink_glazed_terracotta", - "blockRuntimeId" : 5622 - }, - { - "id" : "minecraft:purpur_block", - "blockRuntimeId" : 6358 - }, - { - "id" : "minecraft:purpur_block", - "blockRuntimeId" : 6360 - }, - { - "id" : "minecraft:nether_wart_block", - "blockRuntimeId" : 5567 - }, - { - "id" : "minecraft:warped_wart_block", - "blockRuntimeId" : 7421 - }, - { - "id" : "minecraft:shroomlight", - "blockRuntimeId" : 6583 - }, - { - "id" : "minecraft:crimson_nylium", - "blockRuntimeId" : 3798 - }, - { - "id" : "minecraft:warped_nylium", - "blockRuntimeId" : 7351 - }, - { - "id" : "minecraft:basalt", - "blockRuntimeId" : 214 - }, - { - "id" : "minecraft:polished_basalt", - "blockRuntimeId" : 5665 - }, - { - "id" : "minecraft:smooth_basalt", - "blockRuntimeId" : 6640 - }, - { - "id" : "minecraft:soul_soil", - "blockRuntimeId" : 6710 - }, - { - "id" : "minecraft:dirt", - "blockRuntimeId" : 4433 - }, - { - "id" : "minecraft:dirt", - "blockRuntimeId" : 4434 - }, - { - "id" : "minecraft:farmland", - "blockRuntimeId" : 4715 - }, - { - "id" : "minecraft:grass", - "blockRuntimeId" : 4922 - }, - { - "id" : "minecraft:grass_path", - "blockRuntimeId" : 4923 - }, - { - "id" : "minecraft:podzol", - "blockRuntimeId" : 5646 - }, - { - "id" : "minecraft:mycelium", - "blockRuntimeId" : 5550 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6934 - }, - { - "id" : "minecraft:iron_ore", - "blockRuntimeId" : 5072 - }, - { - "id" : "minecraft:gold_ore", - "blockRuntimeId" : 4901 - }, - { - "id" : "minecraft:diamond_ore", - "blockRuntimeId" : 4424 - }, - { - "id" : "minecraft:lapis_ore", - "blockRuntimeId" : 5271 - }, - { - "id" : "minecraft:redstone_ore", - "blockRuntimeId" : 6470 - }, - { - "id" : "minecraft:coal_ore", - "blockRuntimeId" : 1101 - }, - { - "id" : "minecraft:emerald_ore", - "blockRuntimeId" : 4667 - }, - { - "id" : "minecraft:quartz_ore", - "blockRuntimeId" : 6391 - }, - { - "id" : "minecraft:nether_gold_ore", - "blockRuntimeId" : 5561 - }, - { - "id" : "minecraft:ancient_debris", - "blockRuntimeId" : 143 - }, - { - "id" : "minecraft:copper_ore", - "blockRuntimeId" : 3637 - }, - { - "id" : "minecraft:deepslate_iron_ore", - "blockRuntimeId" : 4232 - }, - { - "id" : "minecraft:deepslate_gold_ore", - "blockRuntimeId" : 4231 - }, - { - "id" : "minecraft:deepslate_diamond_ore", - "blockRuntimeId" : 4229 - }, - { - "id" : "minecraft:deepslate_lapis_ore", - "blockRuntimeId" : 4233 - }, - { - "id" : "minecraft:deepslate_redstone_ore", - "blockRuntimeId" : 4234 - }, - { - "id" : "minecraft:deepslate_emerald_ore", - "blockRuntimeId" : 4230 - }, - { - "id" : "minecraft:deepslate_coal_ore", - "blockRuntimeId" : 4227 - }, - { - "id" : "minecraft:deepslate_copper_ore", - "blockRuntimeId" : 4228 - }, - { - "id" : "minecraft:gravel", - "blockRuntimeId" : 4924 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6935 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6937 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6939 - }, - { - "id" : "minecraft:blackstone", - "blockRuntimeId" : 484 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6936 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6938 - }, - { - "id" : "minecraft:stone", - "blockRuntimeId" : 6940 - }, - { - "id" : "minecraft:polished_blackstone", - "blockRuntimeId" : 5668 - }, - { - "id" : "minecraft:deepslate", - "blockRuntimeId" : 4049 - }, - { - "id" : "minecraft:polished_deepslate", - "blockRuntimeId" : 6046 - }, - { - "id" : "minecraft:sand", - "blockRuntimeId" : 6527 - }, - { - "id" : "minecraft:sand", - "blockRuntimeId" : 6528 - }, - { - "id" : "minecraft:cactus", - "blockRuntimeId" : 890 - }, - { - "id" : "minecraft:log", - "blockRuntimeId" : 5439 - }, - { - "id" : "minecraft:stripped_oak_log", - "blockRuntimeId" : 7073 - }, - { - "id" : "minecraft:log", - "blockRuntimeId" : 5440 - }, - { - "id" : "minecraft:stripped_spruce_log", - "blockRuntimeId" : 7076 - }, - { - "id" : "minecraft:log", - "blockRuntimeId" : 5441 - }, - { - "id" : "minecraft:stripped_birch_log", - "blockRuntimeId" : 7058 - }, - { - "id" : "minecraft:log", - "blockRuntimeId" : 5442 - }, - { - "id" : "minecraft:stripped_jungle_log", - "blockRuntimeId" : 7070 - }, - { - "id" : "minecraft:log2", - "blockRuntimeId" : 5451 - }, - { - "id" : "minecraft:stripped_acacia_log", - "blockRuntimeId" : 7055 - }, - { - "id" : "minecraft:log2", - "blockRuntimeId" : 5452 - }, - { - "id" : "minecraft:stripped_dark_oak_log", - "blockRuntimeId" : 7067 - }, - { - "id" : "minecraft:crimson_stem", - "blockRuntimeId" : 3843 - }, - { - "id" : "minecraft:stripped_crimson_stem", - "blockRuntimeId" : 7064 - }, - { - "id" : "minecraft:warped_stem", - "blockRuntimeId" : 7396 - }, - { - "id" : "minecraft:stripped_warped_stem", - "blockRuntimeId" : 7082 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7551 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7557 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7552 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7558 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7553 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7559 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7554 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7560 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7555 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7561 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7556 - }, - { - "id" : "minecraft:wood", - "blockRuntimeId" : 7562 - }, - { - "id" : "minecraft:crimson_hyphae", - "blockRuntimeId" : 3795 - }, - { - "id" : "minecraft:stripped_crimson_hyphae", - "blockRuntimeId" : 7061 - }, - { - "id" : "minecraft:warped_hyphae", - "blockRuntimeId" : 7348 - }, - { - "id" : "minecraft:stripped_warped_hyphae", - "blockRuntimeId" : 7079 - }, - { - "id" : "minecraft:leaves", - "blockRuntimeId" : 5315 - }, - { - "id" : "minecraft:leaves", - "blockRuntimeId" : 5316 - }, - { - "id" : "minecraft:leaves", - "blockRuntimeId" : 5317 - }, - { - "id" : "minecraft:leaves", - "blockRuntimeId" : 5318 - }, - { - "id" : "minecraft:leaves2", - "blockRuntimeId" : 5331 - }, - { - "id" : "minecraft:leaves2", - "blockRuntimeId" : 5332 - }, - { - "id" : "minecraft:azalea_leaves", - "blockRuntimeId" : 169 - }, - { - "id" : "minecraft:azalea_leaves_flowered", - "blockRuntimeId" : 173 - }, - { - "id" : "minecraft:sapling", - "blockRuntimeId" : 6541 - }, - { - "id" : "minecraft:sapling", - "blockRuntimeId" : 6542 - }, - { - "id" : "minecraft:sapling", - "blockRuntimeId" : 6543 - }, - { - "id" : "minecraft:sapling", - "blockRuntimeId" : 6544 - }, - { - "id" : "minecraft:sapling", - "blockRuntimeId" : 6545 - }, - { - "id" : "minecraft:sapling", - "blockRuntimeId" : 6546 - }, - { - "id" : "minecraft:bee_nest", - "blockRuntimeId" : 236 - }, - { - "id" : "minecraft:wheat_seeds" - }, - { - "id" : "minecraft:pumpkin_seeds" - }, - { - "id" : "minecraft:melon_seeds" - }, - { - "id" : "minecraft:beetroot_seeds" - }, - { - "id" : "minecraft:wheat" - }, - { - "id" : "minecraft:beetroot" - }, - { - "id" : "minecraft:potato" - }, - { - "id" : "minecraft:poisonous_potato" - }, - { - "id" : "minecraft:carrot" - }, - { - "id" : "minecraft:golden_carrot" - }, - { - "id" : "minecraft:apple" - }, - { - "id" : "minecraft:golden_apple" - }, - { - "id" : "minecraft:enchanted_golden_apple" - }, - { - "id" : "minecraft:melon_block", - "blockRuntimeId" : 5474 - }, - { - "id" : "minecraft:melon_slice" - }, - { - "id" : "minecraft:glistering_melon_slice" - }, - { - "id" : "minecraft:sweet_berries" - }, - { - "id" : "minecraft:glow_berries" - }, - { - "id" : "minecraft:pumpkin", - "blockRuntimeId" : 6300 - }, - { - "id" : "minecraft:carved_pumpkin", - "blockRuntimeId" : 948 - }, - { - "id" : "minecraft:lit_pumpkin", - "blockRuntimeId" : 5426 - }, - { - "id" : "minecraft:honeycomb" - }, - { - "id" : "minecraft:tallgrass", - "blockRuntimeId" : 7103 - }, - { - "id" : "minecraft:double_plant", - "blockRuntimeId" : 4453 - }, - { - "id" : "minecraft:tallgrass", - "blockRuntimeId" : 7102 - }, - { - "id" : "minecraft:double_plant", - "blockRuntimeId" : 4452 - }, - { - "id" : "minecraft:nether_sprouts" - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3641 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3639 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3640 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3638 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3642 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3646 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3644 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3645 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3643 - }, - { - "id" : "minecraft:coral", - "blockRuntimeId" : 3647 - }, - { - "id" : "minecraft:coral_fan", - "blockRuntimeId" : 3661 - }, - { - "id" : "minecraft:coral_fan", - "blockRuntimeId" : 3659 - }, - { - "id" : "minecraft:coral_fan", - "blockRuntimeId" : 3660 - }, - { - "id" : "minecraft:coral_fan", - "blockRuntimeId" : 3658 - }, - { - "id" : "minecraft:coral_fan", - "blockRuntimeId" : 3662 - }, - { - "id" : "minecraft:coral_fan_dead", - "blockRuntimeId" : 3671 - }, - { - "id" : "minecraft:coral_fan_dead", - "blockRuntimeId" : 3669 - }, - { - "id" : "minecraft:coral_fan_dead", - "blockRuntimeId" : 3670 - }, - { - "id" : "minecraft:coral_fan_dead", - "blockRuntimeId" : 3668 - }, - { - "id" : "minecraft:coral_fan_dead", - "blockRuntimeId" : 3672 - }, - { - "id" : "minecraft:kelp" - }, - { - "id" : "minecraft:seagrass", - "blockRuntimeId" : 6579 - }, - { - "id" : "minecraft:crimson_roots", - "blockRuntimeId" : 3816 - }, - { - "id" : "minecraft:warped_roots", - "blockRuntimeId" : 7369 - }, - { - "id" : "minecraft:yellow_flower", - "blockRuntimeId" : 7675 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6413 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6414 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6415 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6416 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6417 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6418 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6419 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6420 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6421 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6422 - }, - { - "id" : "minecraft:red_flower", - "blockRuntimeId" : 6423 - }, - { - "id" : "minecraft:double_plant", - "blockRuntimeId" : 4450 - }, - { - "id" : "minecraft:double_plant", - "blockRuntimeId" : 4451 - }, - { - "id" : "minecraft:double_plant", - "blockRuntimeId" : 4454 - }, - { - "id" : "minecraft:double_plant", - "blockRuntimeId" : 4455 - }, - { - "id" : "minecraft:wither_rose", - "blockRuntimeId" : 7550 - }, - { - "id" : "minecraft:white_dye" - }, - { - "id" : "minecraft:light_gray_dye" - }, - { - "id" : "minecraft:gray_dye" - }, - { - "id" : "minecraft:black_dye" - }, - { - "id" : "minecraft:brown_dye" - }, - { - "id" : "minecraft:red_dye" - }, - { - "id" : "minecraft:orange_dye" - }, - { - "id" : "minecraft:yellow_dye" - }, - { - "id" : "minecraft:lime_dye" - }, - { - "id" : "minecraft:green_dye" - }, - { - "id" : "minecraft:cyan_dye" - }, - { - "id" : "minecraft:light_blue_dye" - }, - { - "id" : "minecraft:blue_dye" - }, - { - "id" : "minecraft:purple_dye" - }, - { - "id" : "minecraft:magenta_dye" - }, - { - "id" : "minecraft:pink_dye" - }, - { - "id" : "minecraft:ink_sac" - }, - { - "id" : "minecraft:glow_ink_sac" - }, - { - "id" : "minecraft:cocoa_beans" - }, - { - "id" : "minecraft:lapis_lazuli" - }, - { - "id" : "minecraft:bone_meal" - }, - { - "id" : "minecraft:vine", - "blockRuntimeId" : 7256 - }, - { - "id" : "minecraft:weeping_vines", - "blockRuntimeId" : 7510 - }, - { - "id" : "minecraft:twisting_vines", - "blockRuntimeId" : 7184 - }, - { - "id" : "minecraft:waterlily", - "blockRuntimeId" : 7438 - }, - { - "id" : "minecraft:deadbush", - "blockRuntimeId" : 4048 - }, - { - "id" : "minecraft:bamboo", - "blockRuntimeId" : 177 - }, - { - "id" : "minecraft:snow", - "blockRuntimeId" : 6666 - }, - { - "id" : "minecraft:ice", - "blockRuntimeId" : 5031 - }, - { - "id" : "minecraft:packed_ice", - "blockRuntimeId" : 5621 - }, - { - "id" : "minecraft:blue_ice", - "blockRuntimeId" : 671 - }, - { - "id" : "minecraft:snow_layer", - "blockRuntimeId" : 6667 - }, - { - "id" : "minecraft:pointed_dripstone", - "blockRuntimeId" : 5652 - }, - { - "id" : "minecraft:dripstone_block", - "blockRuntimeId" : 4534 - }, - { - "id" : "minecraft:moss_carpet", - "blockRuntimeId" : 5531 - }, - { - "id" : "minecraft:moss_block", - "blockRuntimeId" : 5530 - }, - { - "id" : "minecraft:dirt_with_roots", - "blockRuntimeId" : 4435 - }, - { - "id" : "minecraft:hanging_roots", - "blockRuntimeId" : 4953 - }, - { - "id" : "minecraft:big_dripleaf", - "blockRuntimeId" : 328 - }, - { - "id" : "minecraft:small_dripleaf_block", - "blockRuntimeId" : 6632 - }, - { - "id" : "minecraft:spore_blossom", - "blockRuntimeId" : 6719 - }, - { - "id" : "minecraft:azalea", - "blockRuntimeId" : 168 - }, - { - "id" : "minecraft:flowering_azalea", - "blockRuntimeId" : 4764 - }, - { - "id" : "minecraft:glow_lichen", - "blockRuntimeId" : 4897 - }, - { - "id" : "minecraft:amethyst_block", - "blockRuntimeId" : 136 - }, - { - "id" : "minecraft:budding_amethyst", - "blockRuntimeId" : 889 - }, - { - "id" : "minecraft:amethyst_cluster", - "blockRuntimeId" : 137 - }, - { - "id" : "minecraft:large_amethyst_bud", - "blockRuntimeId" : 5272 - }, - { - "id" : "minecraft:medium_amethyst_bud", - "blockRuntimeId" : 5468 - }, - { - "id" : "minecraft:small_amethyst_bud", - "blockRuntimeId" : 6619 - }, - { - "id" : "minecraft:tuff", - "blockRuntimeId" : 7171 - }, - { - "id" : "minecraft:calcite", - "blockRuntimeId" : 913 - }, - { - "id" : "minecraft:chicken" - }, - { - "id" : "minecraft:porkchop" - }, - { - "id" : "minecraft:beef" - }, - { - "id" : "minecraft:mutton" - }, - { - "id" : "minecraft:rabbit" - }, - { - "id" : "minecraft:cod" - }, - { - "id" : "minecraft:salmon" - }, - { - "id" : "minecraft:tropical_fish" - }, - { - "id" : "minecraft:pufferfish" - }, - { - "id" : "minecraft:brown_mushroom", - "blockRuntimeId" : 870 - }, - { - "id" : "minecraft:red_mushroom", - "blockRuntimeId" : 6430 - }, - { - "id" : "minecraft:crimson_fungus", - "blockRuntimeId" : 3794 - }, - { - "id" : "minecraft:warped_fungus", - "blockRuntimeId" : 7347 - }, - { - "id" : "minecraft:brown_mushroom_block", - "blockRuntimeId" : 885 - }, - { - "id" : "minecraft:red_mushroom_block", - "blockRuntimeId" : 6445 - }, - { - "id" : "minecraft:brown_mushroom_block", - "blockRuntimeId" : 886 - }, - { - "id" : "minecraft:brown_mushroom_block", - "blockRuntimeId" : 871 - }, - { - "id" : "minecraft:egg" - }, - { - "id" : "minecraft:sugar_cane" - }, - { - "id" : "minecraft:sugar" - }, - { - "id" : "minecraft:rotten_flesh" - }, - { - "id" : "minecraft:bone" - }, - { - "id" : "minecraft:web", - "blockRuntimeId" : 7509 - }, - { - "id" : "minecraft:spider_eye" - }, - { - "id" : "minecraft:mob_spawner", - "blockRuntimeId" : 5523 - }, - { - "id" : "minecraft:monster_egg", - "blockRuntimeId" : 5524 - }, - { - "id" : "minecraft:monster_egg", - "blockRuntimeId" : 5525 - }, - { - "id" : "minecraft:monster_egg", - "blockRuntimeId" : 5526 - }, - { - "id" : "minecraft:monster_egg", - "blockRuntimeId" : 5527 - }, - { - "id" : "minecraft:monster_egg", - "blockRuntimeId" : 5528 - }, - { - "id" : "minecraft:monster_egg", - "blockRuntimeId" : 5529 - }, - { - "id" : "minecraft:infested_deepslate", - "blockRuntimeId" : 5032 - }, - { - "id" : "minecraft:dragon_egg", - "blockRuntimeId" : 4532 - }, - { - "id" : "minecraft:turtle_egg", - "blockRuntimeId" : 7172 - }, - { - "id" : "minecraft:chicken_spawn_egg" - }, - { - "id" : "minecraft:bee_spawn_egg" - }, - { - "id" : "minecraft:cow_spawn_egg" - }, - { - "id" : "minecraft:pig_spawn_egg" - }, - { - "id" : "minecraft:sheep_spawn_egg" - }, - { - "id" : "minecraft:wolf_spawn_egg" - }, - { - "id" : "minecraft:polar_bear_spawn_egg" - }, - { - "id" : "minecraft:ocelot_spawn_egg" - }, - { - "id" : "minecraft:cat_spawn_egg" - }, - { - "id" : "minecraft:mooshroom_spawn_egg" - }, - { - "id" : "minecraft:bat_spawn_egg" - }, - { - "id" : "minecraft:parrot_spawn_egg" - }, - { - "id" : "minecraft:rabbit_spawn_egg" - }, - { - "id" : "minecraft:llama_spawn_egg" - }, - { - "id" : "minecraft:horse_spawn_egg" - }, - { - "id" : "minecraft:donkey_spawn_egg" - }, - { - "id" : "minecraft:mule_spawn_egg" - }, - { - "id" : "minecraft:skeleton_horse_spawn_egg" - }, - { - "id" : "minecraft:zombie_horse_spawn_egg" - }, - { - "id" : "minecraft:tropical_fish_spawn_egg" - }, - { - "id" : "minecraft:cod_spawn_egg" - }, - { - "id" : "minecraft:pufferfish_spawn_egg" - }, - { - "id" : "minecraft:salmon_spawn_egg" - }, - { - "id" : "minecraft:dolphin_spawn_egg" - }, - { - "id" : "minecraft:turtle_spawn_egg" - }, - { - "id" : "minecraft:panda_spawn_egg" - }, - { - "id" : "minecraft:fox_spawn_egg" - }, - { - "id" : "minecraft:creeper_spawn_egg" - }, - { - "id" : "minecraft:enderman_spawn_egg" - }, - { - "id" : "minecraft:silverfish_spawn_egg" - }, - { - "id" : "minecraft:skeleton_spawn_egg" - }, - { - "id" : "minecraft:wither_skeleton_spawn_egg" - }, - { - "id" : "minecraft:stray_spawn_egg" - }, - { - "id" : "minecraft:slime_spawn_egg" - }, - { - "id" : "minecraft:spider_spawn_egg" - }, - { - "id" : "minecraft:zombie_spawn_egg" - }, - { - "id" : "minecraft:zombie_pigman_spawn_egg" - }, - { - "id" : "minecraft:husk_spawn_egg" - }, - { - "id" : "minecraft:drowned_spawn_egg" - }, - { - "id" : "minecraft:squid_spawn_egg" - }, - { - "id" : "minecraft:glow_squid_spawn_egg" - }, - { - "id" : "minecraft:cave_spider_spawn_egg" - }, - { - "id" : "minecraft:witch_spawn_egg" - }, - { - "id" : "minecraft:guardian_spawn_egg" - }, - { - "id" : "minecraft:elder_guardian_spawn_egg" - }, - { - "id" : "minecraft:endermite_spawn_egg" - }, - { - "id" : "minecraft:magma_cube_spawn_egg" - }, - { - "id" : "minecraft:strider_spawn_egg" - }, - { - "id" : "minecraft:hoglin_spawn_egg" - }, - { - "id" : "minecraft:piglin_spawn_egg" - }, - { - "id" : "minecraft:zoglin_spawn_egg" - }, - { - "id" : "minecraft:piglin_brute_spawn_egg" - }, - { - "id" : "minecraft:goat_spawn_egg" - }, - { - "id" : "minecraft:axolotl_spawn_egg" - }, - { - "id" : "minecraft:ghast_spawn_egg" - }, - { - "id" : "minecraft:blaze_spawn_egg" - }, - { - "id" : "minecraft:shulker_spawn_egg" - }, - { - "id" : "minecraft:vindicator_spawn_egg" - }, - { - "id" : "minecraft:evoker_spawn_egg" - }, - { - "id" : "minecraft:vex_spawn_egg" - }, - { - "id" : "minecraft:villager_spawn_egg" - }, - { - "id" : "minecraft:wandering_trader_spawn_egg" - }, - { - "id" : "minecraft:zombie_villager_spawn_egg" - }, - { - "id" : "minecraft:phantom_spawn_egg" - }, - { - "id" : "minecraft:pillager_spawn_egg" - }, - { - "id" : "minecraft:ravager_spawn_egg" - }, - { - "id" : "minecraft:obsidian", - "blockRuntimeId" : 5600 - }, - { - "id" : "minecraft:crying_obsidian", - "blockRuntimeId" : 3868 - }, - { - "id" : "minecraft:bedrock", - "blockRuntimeId" : 234 - }, - { - "id" : "minecraft:soul_sand", - "blockRuntimeId" : 6709 - }, - { - "id" : "minecraft:netherrack", - "blockRuntimeId" : 5569 - }, - { - "id" : "minecraft:magma", - "blockRuntimeId" : 5467 - }, - { - "id" : "minecraft:nether_wart" - }, - { - "id" : "minecraft:end_stone", - "blockRuntimeId" : 4694 - }, - { - "id" : "minecraft:chorus_flower", - "blockRuntimeId" : 1092 - }, - { - "id" : "minecraft:chorus_plant", - "blockRuntimeId" : 1098 - }, - { - "id" : "minecraft:chorus_fruit" - }, - { - "id" : "minecraft:popped_chorus_fruit" - }, - { - "id" : "minecraft:sponge", - "blockRuntimeId" : 6717 - }, - { - "id" : "minecraft:sponge", - "blockRuntimeId" : 6718 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3648 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3649 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3650 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3651 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3652 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3653 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3654 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3655 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3656 - }, - { - "id" : "minecraft:coral_block", - "blockRuntimeId" : 3657 - }, - { - "id" : "minecraft:leather_helmet" - }, - { - "id" : "minecraft:chainmail_helmet" - }, - { - "id" : "minecraft:iron_helmet" - }, - { - "id" : "minecraft:golden_helmet" - }, - { - "id" : "minecraft:diamond_helmet" - }, - { - "id" : "minecraft:netherite_helmet" - }, - { - "id" : "minecraft:leather_chestplate" - }, - { - "id" : "minecraft:chainmail_chestplate" - }, - { - "id" : "minecraft:iron_chestplate" - }, - { - "id" : "minecraft:golden_chestplate" - }, - { - "id" : "minecraft:diamond_chestplate" - }, - { - "id" : "minecraft:netherite_chestplate" - }, - { - "id" : "minecraft:leather_leggings" - }, - { - "id" : "minecraft:chainmail_leggings" - }, - { - "id" : "minecraft:iron_leggings" - }, - { - "id" : "minecraft:golden_leggings" - }, - { - "id" : "minecraft:diamond_leggings" - }, - { - "id" : "minecraft:netherite_leggings" - }, - { - "id" : "minecraft:leather_boots" - }, - { - "id" : "minecraft:chainmail_boots" - }, - { - "id" : "minecraft:iron_boots" - }, - { - "id" : "minecraft:golden_boots" - }, - { - "id" : "minecraft:diamond_boots" - }, - { - "id" : "minecraft:netherite_boots" - }, - { - "id" : "minecraft:wooden_sword" - }, - { - "id" : "minecraft:stone_sword" - }, - { - "id" : "minecraft:iron_sword" - }, - { - "id" : "minecraft:golden_sword" - }, - { - "id" : "minecraft:diamond_sword" - }, - { - "id" : "minecraft:netherite_sword" - }, - { - "id" : "minecraft:wooden_axe" - }, - { - "id" : "minecraft:stone_axe" - }, - { - "id" : "minecraft:iron_axe" - }, - { - "id" : "minecraft:golden_axe" - }, - { - "id" : "minecraft:diamond_axe" - }, - { - "id" : "minecraft:netherite_axe" - }, - { - "id" : "minecraft:wooden_pickaxe" - }, - { - "id" : "minecraft:stone_pickaxe" - }, - { - "id" : "minecraft:iron_pickaxe" - }, - { - "id" : "minecraft:golden_pickaxe" - }, - { - "id" : "minecraft:diamond_pickaxe" - }, - { - "id" : "minecraft:netherite_pickaxe" - }, - { - "id" : "minecraft:wooden_shovel" - }, - { - "id" : "minecraft:stone_shovel" - }, - { - "id" : "minecraft:iron_shovel" - }, - { - "id" : "minecraft:golden_shovel" - }, - { - "id" : "minecraft:diamond_shovel" - }, - { - "id" : "minecraft:netherite_shovel" - }, - { - "id" : "minecraft:wooden_hoe" - }, - { - "id" : "minecraft:stone_hoe" - }, - { - "id" : "minecraft:iron_hoe" - }, - { - "id" : "minecraft:golden_hoe" - }, - { - "id" : "minecraft:diamond_hoe" - }, - { - "id" : "minecraft:netherite_hoe" - }, - { - "id" : "minecraft:bow" - }, - { - "id" : "minecraft:crossbow" - }, - { - "id" : "minecraft:arrow" - }, - { - "id" : "minecraft:arrow", - "damage" : 6 - }, - { - "id" : "minecraft:arrow", - "damage" : 7 - }, - { - "id" : "minecraft:arrow", - "damage" : 8 - }, - { - "id" : "minecraft:arrow", - "damage" : 9 - }, - { - "id" : "minecraft:arrow", - "damage" : 10 - }, - { - "id" : "minecraft:arrow", - "damage" : 11 - }, - { - "id" : "minecraft:arrow", - "damage" : 12 - }, - { - "id" : "minecraft:arrow", - "damage" : 13 - }, - { - "id" : "minecraft:arrow", - "damage" : 14 - }, - { - "id" : "minecraft:arrow", - "damage" : 15 - }, - { - "id" : "minecraft:arrow", - "damage" : 16 - }, - { - "id" : "minecraft:arrow", - "damage" : 17 - }, - { - "id" : "minecraft:arrow", - "damage" : 18 - }, - { - "id" : "minecraft:arrow", - "damage" : 19 - }, - { - "id" : "minecraft:arrow", - "damage" : 20 - }, - { - "id" : "minecraft:arrow", - "damage" : 21 - }, - { - "id" : "minecraft:arrow", - "damage" : 22 - }, - { - "id" : "minecraft:arrow", - "damage" : 23 - }, - { - "id" : "minecraft:arrow", - "damage" : 24 - }, - { - "id" : "minecraft:arrow", - "damage" : 25 - }, - { - "id" : "minecraft:arrow", - "damage" : 26 - }, - { - "id" : "minecraft:arrow", - "damage" : 27 - }, - { - "id" : "minecraft:arrow", - "damage" : 28 - }, - { - "id" : "minecraft:arrow", - "damage" : 29 - }, - { - "id" : "minecraft:arrow", - "damage" : 30 - }, - { - "id" : "minecraft:arrow", - "damage" : 31 - }, - { - "id" : "minecraft:arrow", - "damage" : 32 - }, - { - "id" : "minecraft:arrow", - "damage" : 33 - }, - { - "id" : "minecraft:arrow", - "damage" : 34 - }, - { - "id" : "minecraft:arrow", - "damage" : 35 - }, - { - "id" : "minecraft:arrow", - "damage" : 36 - }, - { - "id" : "minecraft:arrow", - "damage" : 37 - }, - { - "id" : "minecraft:arrow", - "damage" : 38 - }, - { - "id" : "minecraft:arrow", - "damage" : 39 - }, - { - "id" : "minecraft:arrow", - "damage" : 40 - }, - { - "id" : "minecraft:arrow", - "damage" : 41 - }, - { - "id" : "minecraft:arrow", - "damage" : 42 - }, - { - "id" : "minecraft:arrow", - "damage" : 43 - }, - { - "id" : "minecraft:shield" - }, - { - "id" : "minecraft:cooked_chicken" - }, - { - "id" : "minecraft:cooked_porkchop" - }, - { - "id" : "minecraft:cooked_beef" - }, - { - "id" : "minecraft:cooked_mutton" - }, - { - "id" : "minecraft:cooked_rabbit" - }, - { - "id" : "minecraft:cooked_cod" - }, - { - "id" : "minecraft:cooked_salmon" - }, - { - "id" : "minecraft:bread" - }, - { - "id" : "minecraft:mushroom_stew" - }, - { - "id" : "minecraft:beetroot_soup" - }, - { - "id" : "minecraft:rabbit_stew" - }, - { - "id" : "minecraft:baked_potato" - }, - { - "id" : "minecraft:cookie" - }, - { - "id" : "minecraft:pumpkin_pie" - }, - { - "id" : "minecraft:cake" - }, - { - "id" : "minecraft:dried_kelp" - }, - { - "id" : "minecraft:fishing_rod" - }, - { - "id" : "minecraft:carrot_on_a_stick" - }, - { - "id" : "minecraft:warped_fungus_on_a_stick" - }, - { - "id" : "minecraft:snowball" - }, - { - "id" : "minecraft:shears" - }, - { - "id" : "minecraft:flint_and_steel" - }, - { - "id" : "minecraft:lead" - }, - { - "id" : "minecraft:clock" - }, - { - "id" : "minecraft:compass" - }, - { - "id" : "minecraft:empty_map" - }, - { - "id" : "minecraft:empty_map", - "damage" : 2 - }, - { - "id" : "minecraft:saddle" - }, - { - "id" : "minecraft:leather_horse_armor" - }, - { - "id" : "minecraft:iron_horse_armor" - }, - { - "id" : "minecraft:golden_horse_armor" - }, - { - "id" : "minecraft:diamond_horse_armor" - }, - { - "id" : "minecraft:trident" - }, - { - "id" : "minecraft:turtle_helmet" - }, - { - "id" : "minecraft:elytra" - }, - { - "id" : "minecraft:totem_of_undying" - }, - { - "id" : "minecraft:glass_bottle" - }, - { - "id" : "minecraft:experience_bottle" - }, - { - "id" : "minecraft:potion" - }, - { - "id" : "minecraft:potion", - "damage" : 1 - }, - { - "id" : "minecraft:potion", - "damage" : 2 - }, - { - "id" : "minecraft:potion", - "damage" : 3 - }, - { - "id" : "minecraft:potion", - "damage" : 4 - }, - { - "id" : "minecraft:potion", - "damage" : 5 - }, - { - "id" : "minecraft:potion", - "damage" : 6 - }, - { - "id" : "minecraft:potion", - "damage" : 7 - }, - { - "id" : "minecraft:potion", - "damage" : 8 - }, - { - "id" : "minecraft:potion", - "damage" : 9 - }, - { - "id" : "minecraft:potion", - "damage" : 10 - }, - { - "id" : "minecraft:potion", - "damage" : 11 - }, - { - "id" : "minecraft:potion", - "damage" : 12 - }, - { - "id" : "minecraft:potion", - "damage" : 13 - }, - { - "id" : "minecraft:potion", - "damage" : 14 - }, - { - "id" : "minecraft:potion", - "damage" : 15 - }, - { - "id" : "minecraft:potion", - "damage" : 16 - }, - { - "id" : "minecraft:potion", - "damage" : 17 - }, - { - "id" : "minecraft:potion", - "damage" : 18 - }, - { - "id" : "minecraft:potion", - "damage" : 19 - }, - { - "id" : "minecraft:potion", - "damage" : 20 - }, - { - "id" : "minecraft:potion", - "damage" : 21 - }, - { - "id" : "minecraft:potion", - "damage" : 22 - }, - { - "id" : "minecraft:potion", - "damage" : 23 - }, - { - "id" : "minecraft:potion", - "damage" : 24 - }, - { - "id" : "minecraft:potion", - "damage" : 25 - }, - { - "id" : "minecraft:potion", - "damage" : 26 - }, - { - "id" : "minecraft:potion", - "damage" : 27 - }, - { - "id" : "minecraft:potion", - "damage" : 28 - }, - { - "id" : "minecraft:potion", - "damage" : 29 - }, - { - "id" : "minecraft:potion", - "damage" : 30 - }, - { - "id" : "minecraft:potion", - "damage" : 31 - }, - { - "id" : "minecraft:potion", - "damage" : 32 - }, - { - "id" : "minecraft:potion", - "damage" : 33 - }, - { - "id" : "minecraft:potion", - "damage" : 34 - }, - { - "id" : "minecraft:potion", - "damage" : 35 - }, - { - "id" : "minecraft:potion", - "damage" : 36 - }, - { - "id" : "minecraft:potion", - "damage" : 37 - }, - { - "id" : "minecraft:potion", - "damage" : 38 - }, - { - "id" : "minecraft:potion", - "damage" : 39 - }, - { - "id" : "minecraft:potion", - "damage" : 40 - }, - { - "id" : "minecraft:potion", - "damage" : 41 - }, - { - "id" : "minecraft:potion", - "damage" : 42 - }, - { - "id" : "minecraft:splash_potion" - }, - { - "id" : "minecraft:splash_potion", - "damage" : 1 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 2 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 3 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 4 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 5 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 6 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 7 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 8 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 9 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 10 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 11 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 12 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 13 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 14 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 15 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 16 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 17 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 18 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 19 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 20 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 21 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 22 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 23 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 24 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 25 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 26 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 27 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 28 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 29 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 30 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 31 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 32 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 33 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 34 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 35 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 36 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 37 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 38 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 39 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 40 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 41 - }, - { - "id" : "minecraft:splash_potion", - "damage" : 42 - }, - { - "id" : "minecraft:lingering_potion" - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 1 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 2 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 3 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 4 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 5 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 6 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 7 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 8 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 9 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 10 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 11 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 12 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 13 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 14 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 15 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 16 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 17 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 18 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 19 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 20 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 21 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 22 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 23 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 24 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 25 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 26 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 27 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 28 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 29 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 30 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 31 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 32 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 33 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 34 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 35 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 36 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 37 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 38 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 39 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 40 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 41 - }, - { - "id" : "minecraft:lingering_potion", - "damage" : 42 - }, - { - "id" : "minecraft:spyglass" - }, - { - "id" : "minecraft:stick" - }, - { - "id" : "minecraft:bed" - }, - { - "id" : "minecraft:bed", - "damage" : 8 - }, - { - "id" : "minecraft:bed", - "damage" : 7 - }, - { - "id" : "minecraft:bed", - "damage" : 15 - }, - { - "id" : "minecraft:bed", - "damage" : 12 - }, - { - "id" : "minecraft:bed", - "damage" : 14 - }, - { - "id" : "minecraft:bed", - "damage" : 1 - }, - { - "id" : "minecraft:bed", - "damage" : 4 - }, - { - "id" : "minecraft:bed", - "damage" : 5 - }, - { - "id" : "minecraft:bed", - "damage" : 13 - }, - { - "id" : "minecraft:bed", - "damage" : 9 - }, - { - "id" : "minecraft:bed", - "damage" : 3 - }, - { - "id" : "minecraft:bed", - "damage" : 11 - }, - { - "id" : "minecraft:bed", - "damage" : 10 - }, - { - "id" : "minecraft:bed", - "damage" : 2 - }, - { - "id" : "minecraft:bed", - "damage" : 6 - }, - { - "id" : "minecraft:torch", - "blockRuntimeId" : 7111 - }, - { - "id" : "minecraft:soul_torch", - "blockRuntimeId" : 6711 - }, - { - "id" : "minecraft:sea_pickle", - "blockRuntimeId" : 6571 - }, - { - "id" : "minecraft:lantern", - "blockRuntimeId" : 5268 - }, - { - "id" : "minecraft:soul_lantern", - "blockRuntimeId" : 6707 - }, - { - "id" : "minecraft:crafting_table", - "blockRuntimeId" : 3730 - }, - { - "id" : "minecraft:cartography_table", - "blockRuntimeId" : 947 - }, - { - "id" : "minecraft:fletching_table", - "blockRuntimeId" : 4761 - }, - { - "id" : "minecraft:smithing_table", - "blockRuntimeId" : 6633 - }, - { - "id" : "minecraft:beehive", - "blockRuntimeId" : 260 - }, - { - "id" : "minecraft:campfire" - }, - { - "id" : "minecraft:soul_campfire" - }, - { - "id" : "minecraft:furnace", - "blockRuntimeId" : 4813 - }, - { - "id" : "minecraft:blast_furnace", - "blockRuntimeId" : 659 - }, - { - "id" : "minecraft:smoker", - "blockRuntimeId" : 6634 - }, - { - "id" : "minecraft:respawn_anchor", - "blockRuntimeId" : 6522 - }, - { - "id" : "minecraft:brewing_stand" - }, - { - "id" : "minecraft:anvil", - "blockRuntimeId" : 152 - }, - { - "id" : "minecraft:anvil", - "blockRuntimeId" : 156 - }, - { - "id" : "minecraft:anvil", - "blockRuntimeId" : 160 - }, - { - "id" : "minecraft:grindstone", - "blockRuntimeId" : 4937 - }, - { - "id" : "minecraft:enchanting_table", - "blockRuntimeId" : 4668 - }, - { - "id" : "minecraft:bookshelf", - "blockRuntimeId" : 684 - }, - { - "id" : "minecraft:lectern", - "blockRuntimeId" : 5339 - }, - { - "id" : "minecraft:cauldron" - }, - { - "id" : "minecraft:composter", - "blockRuntimeId" : 3594 - }, - { - "id" : "minecraft:chest", - "blockRuntimeId" : 1083 - }, - { - "id" : "minecraft:trapped_chest", - "blockRuntimeId" : 7133 - }, - { - "id" : "minecraft:ender_chest", - "blockRuntimeId" : 4695 - }, - { - "id" : "minecraft:barrel", - "blockRuntimeId" : 201 - }, - { - "id" : "minecraft:undyed_shulker_box", - "blockRuntimeId" : 7216 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6584 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6592 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6591 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6599 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6596 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6598 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6585 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6588 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6589 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6597 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6593 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6587 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6595 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6594 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6586 - }, - { - "id" : "minecraft:shulker_box", - "blockRuntimeId" : 6590 - }, - { - "id" : "minecraft:armor_stand" - }, - { - "id" : "minecraft:noteblock", - "blockRuntimeId" : 5579 - }, - { - "id" : "minecraft:jukebox", - "blockRuntimeId" : 5113 - }, - { - "id" : "minecraft:music_disc_13" - }, - { - "id" : "minecraft:music_disc_cat" - }, - { - "id" : "minecraft:music_disc_blocks" - }, - { - "id" : "minecraft:music_disc_chirp" - }, - { - "id" : "minecraft:music_disc_far" - }, - { - "id" : "minecraft:music_disc_mall" - }, - { - "id" : "minecraft:music_disc_mellohi" - }, - { - "id" : "minecraft:music_disc_stal" - }, - { - "id" : "minecraft:music_disc_strad" - }, - { - "id" : "minecraft:music_disc_ward" - }, - { - "id" : "minecraft:music_disc_11" - }, - { - "id" : "minecraft:music_disc_wait" - }, - { - "id" : "minecraft:music_disc_pigstep" - }, - { - "id" : "minecraft:glowstone_dust" - }, - { - "id" : "minecraft:glowstone", - "blockRuntimeId" : 4899 - }, - { - "id" : "minecraft:redstone_lamp", - "blockRuntimeId" : 6469 - }, - { - "id" : "minecraft:sealantern", - "blockRuntimeId" : 6582 - }, - { - "id" : "minecraft:oak_sign" - }, - { - "id" : "minecraft:spruce_sign" - }, - { - "id" : "minecraft:birch_sign" - }, - { - "id" : "minecraft:jungle_sign" - }, - { - "id" : "minecraft:acacia_sign" - }, - { - "id" : "minecraft:dark_oak_sign" - }, - { - "id" : "minecraft:crimson_sign" - }, - { - "id" : "minecraft:warped_sign" - }, - { - "id" : "minecraft:painting" - }, - { - "id" : "minecraft:frame" - }, - { - "id" : "minecraft:honey_bottle" - }, - { - "id" : "minecraft:flower_pot" - }, - { - "id" : "minecraft:bowl" - }, - { - "id" : "minecraft:bucket" - }, - { - "id" : "minecraft:milk_bucket" - }, - { - "id" : "minecraft:water_bucket" - }, - { - "id" : "minecraft:lava_bucket" - }, - { - "id" : "minecraft:cod_bucket" - }, - { - "id" : "minecraft:salmon_bucket" - }, - { - "id" : "minecraft:tropical_fish_bucket" - }, - { - "id" : "minecraft:pufferfish_bucket" - }, - { - "id" : "minecraft:powder_snow_bucket" - }, - { - "id" : "minecraft:axolotl_bucket" - }, - { - "id" : "minecraft:glow_frame" - }, - { - "id" : "minecraft:skull", - "damage" : 3 - }, - { - "id" : "minecraft:skull", - "damage" : 2 - }, - { - "id" : "minecraft:skull", - "damage" : 4 - }, - { - "id" : "minecraft:skull", - "damage" : 5 - }, - { - "id" : "minecraft:skull" - }, - { - "id" : "minecraft:skull", - "damage" : 1 - }, - { - "id" : "minecraft:beacon", - "blockRuntimeId" : 217 - }, - { - "id" : "minecraft:bell", - "blockRuntimeId" : 292 - }, - { - "id" : "minecraft:conduit", - "blockRuntimeId" : 3635 - }, - { - "id" : "minecraft:stonecutter_block", - "blockRuntimeId" : 7049 - }, - { - "id" : "minecraft:end_portal_frame", - "blockRuntimeId" : 4680 - }, - { - "id" : "minecraft:coal" - }, - { - "id" : "minecraft:charcoal" - }, - { - "id" : "minecraft:diamond" - }, - { - "id" : "minecraft:iron_nugget" - }, - { - "id" : "minecraft:raw_iron" - }, - { - "id" : "minecraft:raw_gold" - }, - { - "id" : "minecraft:raw_copper" - }, - { - "id" : "minecraft:copper_ingot" - }, - { - "id" : "minecraft:iron_ingot" - }, - { - "id" : "minecraft:netherite_scrap" - }, - { - "id" : "minecraft:netherite_ingot" - }, - { - "id" : "minecraft:gold_nugget" - }, - { - "id" : "minecraft:gold_ingot" - }, - { - "id" : "minecraft:emerald" - }, - { - "id" : "minecraft:quartz" - }, - { - "id" : "minecraft:clay_ball" - }, - { - "id" : "minecraft:brick" - }, - { - "id" : "minecraft:netherbrick" - }, - { - "id" : "minecraft:prismarine_shard" - }, - { - "id" : "minecraft:amethyst_shard" - }, - { - "id" : "minecraft:prismarine_crystals" - }, - { - "id" : "minecraft:nautilus_shell" - }, - { - "id" : "minecraft:heart_of_the_sea" - }, - { - "id" : "minecraft:scute" - }, - { - "id" : "minecraft:phantom_membrane" - }, - { - "id" : "minecraft:string" - }, - { - "id" : "minecraft:feather" - }, - { - "id" : "minecraft:flint" - }, - { - "id" : "minecraft:gunpowder" - }, - { - "id" : "minecraft:leather" - }, - { - "id" : "minecraft:rabbit_hide" - }, - { - "id" : "minecraft:rabbit_foot" - }, - { - "id" : "minecraft:fire_charge" - }, - { - "id" : "minecraft:blaze_rod" - }, - { - "id" : "minecraft:blaze_powder" - }, - { - "id" : "minecraft:magma_cream" - }, - { - "id" : "minecraft:fermented_spider_eye" - }, - { - "id" : "minecraft:dragon_breath" - }, - { - "id" : "minecraft:shulker_shell" - }, - { - "id" : "minecraft:ghast_tear" - }, - { - "id" : "minecraft:slime_ball" - }, - { - "id" : "minecraft:ender_pearl" - }, - { - "id" : "minecraft:ender_eye" - }, - { - "id" : "minecraft:nether_star" - }, - { - "id" : "minecraft:end_rod", - "blockRuntimeId" : 4688 - }, - { - "id" : "minecraft:lightning_rod", - "blockRuntimeId" : 5401 - }, - { - "id" : "minecraft:end_crystal" - }, - { - "id" : "minecraft:paper" - }, - { - "id" : "minecraft:book" - }, - { - "id" : "minecraft:writable_book" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQIAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAUAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAUAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAUAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQMAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQMAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQNAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQNAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAUAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQQAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAUAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQUAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQUAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQVAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQWAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQZAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQZAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQaAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQbAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQcAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAUAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQgAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQhAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAQAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAEAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAIAAAA=" - }, - { - "id" : "minecraft:enchanted_book", - "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAMAAAA=" - }, - { - "id" : "minecraft:oak_boat" - }, - { - "id" : "minecraft:spruce_boat" - }, - { - "id" : "minecraft:birch_boat" - }, - { - "id" : "minecraft:jungle_boat" - }, - { - "id" : "minecraft:acacia_boat" - }, - { - "id" : "minecraft:dark_oak_boat" - }, - { - "id" : "minecraft:rail", - "blockRuntimeId" : 6400 - }, - { - "id" : "minecraft:golden_rail", - "blockRuntimeId" : 4902 - }, - { - "id" : "minecraft:detector_rail", - "blockRuntimeId" : 4411 - }, - { - "id" : "minecraft:activator_rail", - "blockRuntimeId" : 122 - }, - { - "id" : "minecraft:minecart" - }, - { - "id" : "minecraft:chest_minecart" - }, - { - "id" : "minecraft:hopper_minecart" - }, - { - "id" : "minecraft:tnt_minecart" - }, - { - "id" : "minecraft:redstone" - }, - { - "id" : "minecraft:redstone_block", - "blockRuntimeId" : 6468 - }, - { - "id" : "minecraft:redstone_torch", - "blockRuntimeId" : 6471 - }, - { - "id" : "minecraft:lever", - "blockRuntimeId" : 5347 - }, - { - "id" : "minecraft:wooden_button", - "blockRuntimeId" : 7587 - }, - { - "id" : "minecraft:spruce_button", - "blockRuntimeId" : 6720 - }, - { - "id" : "minecraft:birch_button", - "blockRuntimeId" : 356 - }, - { - "id" : "minecraft:jungle_button", - "blockRuntimeId" : 5114 - }, - { - "id" : "minecraft:acacia_button" - }, - { - "id" : "minecraft:dark_oak_button", - "blockRuntimeId" : 3886 - }, - { - "id" : "minecraft:stone_button", - "blockRuntimeId" : 6949 - }, - { - "id" : "minecraft:crimson_button", - "blockRuntimeId" : 3731 - }, - { - "id" : "minecraft:warped_button", - "blockRuntimeId" : 7284 - }, - { - "id" : "minecraft:polished_blackstone_button", - "blockRuntimeId" : 5844 - }, - { - "id" : "minecraft:tripwire_hook", - "blockRuntimeId" : 7155 - }, - { - "id" : "minecraft:wooden_pressure_plate", - "blockRuntimeId" : 7631 - }, - { - "id" : "minecraft:spruce_pressure_plate", - "blockRuntimeId" : 6780 - }, - { - "id" : "minecraft:birch_pressure_plate", - "blockRuntimeId" : 416 - }, - { - "id" : "minecraft:jungle_pressure_plate", - "blockRuntimeId" : 5174 - }, - { - "id" : "minecraft:acacia_pressure_plate", - "blockRuntimeId" : 60 - }, - { - "id" : "minecraft:dark_oak_pressure_plate", - "blockRuntimeId" : 3946 - }, - { - "id" : "minecraft:crimson_pressure_plate", - "blockRuntimeId" : 3800 - }, - { - "id" : "minecraft:warped_pressure_plate", - "blockRuntimeId" : 7353 - }, - { - "id" : "minecraft:stone_pressure_plate", - "blockRuntimeId" : 6961 - }, - { - "id" : "minecraft:light_weighted_pressure_plate", - "blockRuntimeId" : 5385 - }, - { - "id" : "minecraft:heavy_weighted_pressure_plate", - "blockRuntimeId" : 5001 - }, - { - "id" : "minecraft:polished_blackstone_pressure_plate", - "blockRuntimeId" : 5858 - }, - { - "id" : "minecraft:observer", - "blockRuntimeId" : 5588 - }, - { - "id" : "minecraft:daylight_detector", - "blockRuntimeId" : 4016 - }, - { - "id" : "minecraft:repeater" - }, - { - "id" : "minecraft:comparator" - }, - { - "id" : "minecraft:hopper" - }, - { - "id" : "minecraft:dropper", - "blockRuntimeId" : 4538 - }, - { - "id" : "minecraft:dispenser", - "blockRuntimeId" : 4439 - }, - { - "id" : "minecraft:piston", - "blockRuntimeId" : 5629 - }, - { - "id" : "minecraft:sticky_piston", - "blockRuntimeId" : 6923 - }, - { - "id" : "minecraft:tnt", - "blockRuntimeId" : 7107 - }, - { - "id" : "minecraft:name_tag" - }, - { - "id" : "minecraft:loom", - "blockRuntimeId" : 5457 - }, - { - "id" : "minecraft:banner" - }, - { - "id" : "minecraft:banner", - "damage" : 8 - }, - { - "id" : "minecraft:banner", - "damage" : 7 - }, - { - "id" : "minecraft:banner", - "damage" : 15 - }, - { - "id" : "minecraft:banner", - "damage" : 12 - }, - { - "id" : "minecraft:banner", - "damage" : 14 - }, - { - "id" : "minecraft:banner", - "damage" : 1 - }, - { - "id" : "minecraft:banner", - "damage" : 4 - }, - { - "id" : "minecraft:banner", - "damage" : 5 - }, - { - "id" : "minecraft:banner", - "damage" : 13 - }, - { - "id" : "minecraft:banner", - "damage" : 9 - }, - { - "id" : "minecraft:banner", - "damage" : 3 - }, - { - "id" : "minecraft:banner", - "damage" : 11 - }, - { - "id" : "minecraft:banner", - "damage" : 10 - }, - { - "id" : "minecraft:banner", - "damage" : 2 - }, - { - "id" : "minecraft:banner", - "damage" : 6 - }, - { - "id" : "minecraft:banner", - "damage" : 15, - "nbt_b64" : "CgAAAwQAVHlwZQEAAAAA" - }, - { - "id" : "minecraft:creeper_banner_pattern" - }, - { - "id" : "minecraft:skull_banner_pattern" - }, - { - "id" : "minecraft:flower_banner_pattern" - }, - { - "id" : "minecraft:mojang_banner_pattern" - }, - { - "id" : "minecraft:field_masoned_banner_pattern" - }, - { - "id" : "minecraft:bordure_indented_banner_pattern" - }, - { - "id" : "minecraft:piglin_banner_pattern" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwAAAAAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAABwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAIBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAHBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAPBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAMBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAOBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAABBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAEBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAFBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAANBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAJBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAADBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAALBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAKBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAACBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_rocket", - "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAGBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" - }, - { - "id" : "minecraft:firework_star", - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yIR0d/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 8, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yUk9H/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 7, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yl52d/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 15, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9y8PDw/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 12, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9y2rM6/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 14, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yHYD5/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 1, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yJi6w/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 4, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yqkQ8/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 5, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yuDKJ/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 13, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yvU7H/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 9, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yqovz/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 3, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yMlSD/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 11, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yPdj+/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 10, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yH8eA/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 2, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yFnxe/wA=" - }, - { - "id" : "minecraft:firework_star", - "damage" : 6, - "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9ynJwW/wA=" - }, - { - "id" : "minecraft:chain" - }, - { - "id" : "minecraft:target", - "blockRuntimeId" : 7105 - }, - { - "id" : "minecraft:lodestone_compass" - } - ] -} \ No newline at end of file diff --git a/connector/src/main/resources/bedrock/runtime_item_states.1_17_0.json b/connector/src/main/resources/bedrock/runtime_item_states.1_17_0.json deleted file mode 100644 index d52495ed4..000000000 --- a/connector/src/main/resources/bedrock/runtime_item_states.1_17_0.json +++ /dev/null @@ -1,4154 +0,0 @@ -[ - { - "name" : "minecraft:acacia_boat", - "id" : 379 - }, - { - "name" : "minecraft:acacia_button", - "id" : -140 - }, - { - "name" : "minecraft:acacia_door", - "id" : 556 - }, - { - "name" : "minecraft:acacia_fence_gate", - "id" : 187 - }, - { - "name" : "minecraft:acacia_pressure_plate", - "id" : -150 - }, - { - "name" : "minecraft:acacia_sign", - "id" : 579 - }, - { - "name" : "minecraft:acacia_stairs", - "id" : 163 - }, - { - "name" : "minecraft:acacia_standing_sign", - "id" : -190 - }, - { - "name" : "minecraft:acacia_trapdoor", - "id" : -145 - }, - { - "name" : "minecraft:acacia_wall_sign", - "id" : -191 - }, - { - "name" : "minecraft:activator_rail", - "id" : 126 - }, - { - "name" : "minecraft:agent_spawn_egg", - "id" : 487 - }, - { - "name" : "minecraft:air", - "id" : -158 - }, - { - "name" : "minecraft:allow", - "id" : 210 - }, - { - "name" : "minecraft:amethyst_block", - "id" : -327 - }, - { - "name" : "minecraft:amethyst_cluster", - "id" : -329 - }, - { - "name" : "minecraft:amethyst_shard", - "id" : 623 - }, - { - "name" : "minecraft:ancient_debris", - "id" : -271 - }, - { - "name" : "minecraft:andesite_stairs", - "id" : -171 - }, - { - "name" : "minecraft:anvil", - "id" : 145 - }, - { - "name" : "minecraft:apple", - "id" : 257 - }, - { - "name" : "minecraft:armor_stand", - "id" : 552 - }, - { - "name" : "minecraft:arrow", - "id" : 301 - }, - { - "name" : "minecraft:axolotl_bucket", - "id" : 369 - }, - { - "name" : "minecraft:axolotl_spawn_egg", - "id" : 500 - }, - { - "name" : "minecraft:azalea", - "id" : -337 - }, - { - "name" : "minecraft:azalea_leaves", - "id" : -324 - }, - { - "name" : "minecraft:azalea_leaves_flowered", - "id" : -325 - }, - { - "name" : "minecraft:baked_potato", - "id" : 281 - }, - { - "name" : "minecraft:balloon", - "id" : 597 - }, - { - "name" : "minecraft:bamboo", - "id" : -163 - }, - { - "name" : "minecraft:bamboo_sapling", - "id" : -164 - }, - { - "name" : "minecraft:banner", - "id" : 567 - }, - { - "name" : "minecraft:banner_pattern", - "id" : 627 - }, - { - "name" : "minecraft:barrel", - "id" : -203 - }, - { - "name" : "minecraft:barrier", - "id" : -161 - }, - { - "name" : "minecraft:basalt", - "id" : -234 - }, - { - "name" : "minecraft:bat_spawn_egg", - "id" : 453 - }, - { - "name" : "minecraft:beacon", - "id" : 138 - }, - { - "name" : "minecraft:bed", - "id" : 418 - }, - { - "name" : "minecraft:bedrock", - "id" : 7 - }, - { - "name" : "minecraft:bee_nest", - "id" : -218 - }, - { - "name" : "minecraft:bee_spawn_egg", - "id" : 494 - }, - { - "name" : "minecraft:beef", - "id" : 273 - }, - { - "name" : "minecraft:beehive", - "id" : -219 - }, - { - "name" : "minecraft:beetroot", - "id" : 285 - }, - { - "name" : "minecraft:beetroot_seeds", - "id" : 295 - }, - { - "name" : "minecraft:beetroot_soup", - "id" : 286 - }, - { - "name" : "minecraft:bell", - "id" : -206 - }, - { - "name" : "minecraft:big_dripleaf", - "id" : -323 - }, - { - "name" : "minecraft:birch_boat", - "id" : 376 - }, - { - "name" : "minecraft:birch_button", - "id" : -141 - }, - { - "name" : "minecraft:birch_door", - "id" : 554 - }, - { - "name" : "minecraft:birch_fence_gate", - "id" : 184 - }, - { - "name" : "minecraft:birch_pressure_plate", - "id" : -151 - }, - { - "name" : "minecraft:birch_sign", - "id" : 577 - }, - { - "name" : "minecraft:birch_stairs", - "id" : 135 - }, - { - "name" : "minecraft:birch_standing_sign", - "id" : -186 - }, - { - "name" : "minecraft:birch_trapdoor", - "id" : -146 - }, - { - "name" : "minecraft:birch_wall_sign", - "id" : -187 - }, - { - "name" : "minecraft:black_dye", - "id" : 395 - }, - { - "name" : "minecraft:black_glazed_terracotta", - "id" : 235 - }, - { - "name" : "minecraft:blackstone", - "id" : -273 - }, - { - "name" : "minecraft:blackstone_double_slab", - "id" : -283 - }, - { - "name" : "minecraft:blackstone_slab", - "id" : -282 - }, - { - "name" : "minecraft:blackstone_stairs", - "id" : -276 - }, - { - "name" : "minecraft:blackstone_wall", - "id" : -277 - }, - { - "name" : "minecraft:blast_furnace", - "id" : -196 - }, - { - "name" : "minecraft:blaze_powder", - "id" : 429 - }, - { - "name" : "minecraft:blaze_rod", - "id" : 423 - }, - { - "name" : "minecraft:blaze_spawn_egg", - "id" : 456 - }, - { - "name" : "minecraft:bleach", - "id" : 595 - }, - { - "name" : "minecraft:blue_dye", - "id" : 399 - }, - { - "name" : "minecraft:blue_glazed_terracotta", - "id" : 231 - }, - { - "name" : "minecraft:blue_ice", - "id" : -11 - }, - { - "name" : "minecraft:boat", - "id" : 625 - }, - { - "name" : "minecraft:bone", - "id" : 415 - }, - { - "name" : "minecraft:bone_block", - "id" : 216 - }, - { - "name" : "minecraft:bone_meal", - "id" : 411 - }, - { - "name" : "minecraft:book", - "id" : 387 - }, - { - "name" : "minecraft:bookshelf", - "id" : 47 - }, - { - "name" : "minecraft:border_block", - "id" : 212 - }, - { - "name" : "minecraft:bordure_indented_banner_pattern", - "id" : 586 - }, - { - "name" : "minecraft:bow", - "id" : 300 - }, - { - "name" : "minecraft:bowl", - "id" : 321 - }, - { - "name" : "minecraft:bread", - "id" : 261 - }, - { - "name" : "minecraft:brewing_stand", - "id" : 431 - }, - { - "name" : "minecraft:brewingstandblock", - "id" : 117 - }, - { - "name" : "minecraft:brick", - "id" : 383 - }, - { - "name" : "minecraft:brick_block", - "id" : 45 - }, - { - "name" : "minecraft:brick_stairs", - "id" : 108 - }, - { - "name" : "minecraft:brown_dye", - "id" : 398 - }, - { - "name" : "minecraft:brown_glazed_terracotta", - "id" : 232 - }, - { - "name" : "minecraft:brown_mushroom", - "id" : 39 - }, - { - "name" : "minecraft:brown_mushroom_block", - "id" : 99 - }, - { - "name" : "minecraft:bubble_column", - "id" : -160 - }, - { - "name" : "minecraft:bucket", - "id" : 360 - }, - { - "name" : "minecraft:budding_amethyst", - "id" : -328 - }, - { - "name" : "minecraft:cactus", - "id" : 81 - }, - { - "name" : "minecraft:cake", - "id" : 417 - }, - { - "name" : "minecraft:calcite", - "id" : -326 - }, - { - "name" : "minecraft:camera", - "id" : 592 - }, - { - "name" : "minecraft:campfire", - "id" : 588 - }, - { - "name" : "minecraft:carpet", - "id" : 171 - }, - { - "name" : "minecraft:carrot", - "id" : 279 - }, - { - "name" : "minecraft:carrot_on_a_stick", - "id" : 517 - }, - { - "name" : "minecraft:carrots", - "id" : 141 - }, - { - "name" : "minecraft:cartography_table", - "id" : -200 - }, - { - "name" : "minecraft:carved_pumpkin", - "id" : -155 - }, - { - "name" : "minecraft:cat_spawn_egg", - "id" : 488 - }, - { - "name" : "minecraft:cauldron", - "id" : 432 - }, - { - "name" : "minecraft:cave_spider_spawn_egg", - "id" : 457 - }, - { - "name" : "minecraft:cave_vines", - "id" : -322 - }, - { - "name" : "minecraft:cave_vines_body_with_berries", - "id" : -375 - }, - { - "name" : "minecraft:cave_vines_head_with_berries", - "id" : -376 - }, - { - "name" : "minecraft:chain", - "id" : 617 - }, - { - "name" : "minecraft:chain_command_block", - "id" : 189 - }, - { - "name" : "minecraft:chainmail_boots", - "id" : 342 - }, - { - "name" : "minecraft:chainmail_chestplate", - "id" : 340 - }, - { - "name" : "minecraft:chainmail_helmet", - "id" : 339 - }, - { - "name" : "minecraft:chainmail_leggings", - "id" : 341 - }, - { - "name" : "minecraft:charcoal", - "id" : 303 - }, - { - "name" : "minecraft:chemical_heat", - "id" : 192 - }, - { - "name" : "minecraft:chemistry_table", - "id" : 238 - }, - { - "name" : "minecraft:chest", - "id" : 54 - }, - { - "name" : "minecraft:chest_minecart", - "id" : 389 - }, - { - "name" : "minecraft:chicken", - "id" : 275 - }, - { - "name" : "minecraft:chicken_spawn_egg", - "id" : 435 - }, - { - "name" : "minecraft:chiseled_deepslate", - "id" : -395 - }, - { - "name" : "minecraft:chiseled_nether_bricks", - "id" : -302 - }, - { - "name" : "minecraft:chiseled_polished_blackstone", - "id" : -279 - }, - { - "name" : "minecraft:chorus_flower", - "id" : 200 - }, - { - "name" : "minecraft:chorus_fruit", - "id" : 558 - }, - { - "name" : "minecraft:chorus_plant", - "id" : 240 - }, - { - "name" : "minecraft:clay", - "id" : 82 - }, - { - "name" : "minecraft:clay_ball", - "id" : 384 - }, - { - "name" : "minecraft:clock", - "id" : 393 - }, - { - "name" : "minecraft:coal", - "id" : 302 - }, - { - "name" : "minecraft:coal_block", - "id" : 173 - }, - { - "name" : "minecraft:coal_ore", - "id" : 16 - }, - { - "name" : "minecraft:cobbled_deepslate", - "id" : -379 - }, - { - "name" : "minecraft:cobbled_deepslate_double_slab", - "id" : -396 - }, - { - "name" : "minecraft:cobbled_deepslate_slab", - "id" : -380 - }, - { - "name" : "minecraft:cobbled_deepslate_stairs", - "id" : -381 - }, - { - "name" : "minecraft:cobbled_deepslate_wall", - "id" : -382 - }, - { - "name" : "minecraft:cobblestone", - "id" : 4 - }, - { - "name" : "minecraft:cobblestone_wall", - "id" : 139 - }, - { - "name" : "minecraft:cocoa", - "id" : 127 - }, - { - "name" : "minecraft:cocoa_beans", - "id" : 412 - }, - { - "name" : "minecraft:cod", - "id" : 264 - }, - { - "name" : "minecraft:cod_bucket", - "id" : 364 - }, - { - "name" : "minecraft:cod_spawn_egg", - "id" : 480 - }, - { - "name" : "minecraft:colored_torch_bp", - "id" : 204 - }, - { - "name" : "minecraft:colored_torch_rg", - "id" : 202 - }, - { - "name" : "minecraft:command_block", - "id" : 137 - }, - { - "name" : "minecraft:command_block_minecart", - "id" : 563 - }, - { - "name" : "minecraft:comparator", - "id" : 522 - }, - { - "name" : "minecraft:compass", - "id" : 391 - }, - { - "name" : "minecraft:composter", - "id" : -213 - }, - { - "name" : "minecraft:compound", - "id" : 593 - }, - { - "name" : "minecraft:concrete", - "id" : 236 - }, - { - "name" : "minecraft:concrete_powder", - "id" : 237 - }, - { - "name" : "minecraft:conduit", - "id" : -157 - }, - { - "name" : "minecraft:cooked_beef", - "id" : 274 - }, - { - "name" : "minecraft:cooked_chicken", - "id" : 276 - }, - { - "name" : "minecraft:cooked_cod", - "id" : 268 - }, - { - "name" : "minecraft:cooked_mutton", - "id" : 551 - }, - { - "name" : "minecraft:cooked_porkchop", - "id" : 263 - }, - { - "name" : "minecraft:cooked_rabbit", - "id" : 289 - }, - { - "name" : "minecraft:cooked_salmon", - "id" : 269 - }, - { - "name" : "minecraft:cookie", - "id" : 271 - }, - { - "name" : "minecraft:copper_block", - "id" : -340 - }, - { - "name" : "minecraft:copper_ingot", - "id" : 504 - }, - { - "name" : "minecraft:copper_ore", - "id" : -311 - }, - { - "name" : "minecraft:coral", - "id" : -131 - }, - { - "name" : "minecraft:coral_block", - "id" : -132 - }, - { - "name" : "minecraft:coral_fan", - "id" : -133 - }, - { - "name" : "minecraft:coral_fan_dead", - "id" : -134 - }, - { - "name" : "minecraft:coral_fan_hang", - "id" : -135 - }, - { - "name" : "minecraft:coral_fan_hang2", - "id" : -136 - }, - { - "name" : "minecraft:coral_fan_hang3", - "id" : -137 - }, - { - "name" : "minecraft:cow_spawn_egg", - "id" : 436 - }, - { - "name" : "minecraft:cracked_deepslate_bricks", - "id" : -410 - }, - { - "name" : "minecraft:cracked_deepslate_tiles", - "id" : -409 - }, - { - "name" : "minecraft:cracked_nether_bricks", - "id" : -303 - }, - { - "name" : "minecraft:cracked_polished_blackstone_bricks", - "id" : -280 - }, - { - "name" : "minecraft:crafting_table", - "id" : 58 - }, - { - "name" : "minecraft:creeper_banner_pattern", - "id" : 582 - }, - { - "name" : "minecraft:creeper_spawn_egg", - "id" : 441 - }, - { - "name" : "minecraft:crimson_button", - "id" : -260 - }, - { - "name" : "minecraft:crimson_door", - "id" : 614 - }, - { - "name" : "minecraft:crimson_double_slab", - "id" : -266 - }, - { - "name" : "minecraft:crimson_fence", - "id" : -256 - }, - { - "name" : "minecraft:crimson_fence_gate", - "id" : -258 - }, - { - "name" : "minecraft:crimson_fungus", - "id" : -228 - }, - { - "name" : "minecraft:crimson_hyphae", - "id" : -299 - }, - { - "name" : "minecraft:crimson_nylium", - "id" : -232 - }, - { - "name" : "minecraft:crimson_planks", - "id" : -242 - }, - { - "name" : "minecraft:crimson_pressure_plate", - "id" : -262 - }, - { - "name" : "minecraft:crimson_roots", - "id" : -223 - }, - { - "name" : "minecraft:crimson_sign", - "id" : 612 - }, - { - "name" : "minecraft:crimson_slab", - "id" : -264 - }, - { - "name" : "minecraft:crimson_stairs", - "id" : -254 - }, - { - "name" : "minecraft:crimson_standing_sign", - "id" : -250 - }, - { - "name" : "minecraft:crimson_stem", - "id" : -225 - }, - { - "name" : "minecraft:crimson_trapdoor", - "id" : -246 - }, - { - "name" : "minecraft:crimson_wall_sign", - "id" : -252 - }, - { - "name" : "minecraft:crossbow", - "id" : 575 - }, - { - "name" : "minecraft:crying_obsidian", - "id" : -289 - }, - { - "name" : "minecraft:cut_copper", - "id" : -347 - }, - { - "name" : "minecraft:cut_copper_slab", - "id" : -361 - }, - { - "name" : "minecraft:cut_copper_stairs", - "id" : -354 - }, - { - "name" : "minecraft:cyan_dye", - "id" : 401 - }, - { - "name" : "minecraft:cyan_glazed_terracotta", - "id" : 229 - }, - { - "name" : "minecraft:dark_oak_boat", - "id" : 380 - }, - { - "name" : "minecraft:dark_oak_button", - "id" : -142 - }, - { - "name" : "minecraft:dark_oak_door", - "id" : 557 - }, - { - "name" : "minecraft:dark_oak_fence_gate", - "id" : 186 - }, - { - "name" : "minecraft:dark_oak_pressure_plate", - "id" : -152 - }, - { - "name" : "minecraft:dark_oak_sign", - "id" : 580 - }, - { - "name" : "minecraft:dark_oak_stairs", - "id" : 164 - }, - { - "name" : "minecraft:dark_oak_trapdoor", - "id" : -147 - }, - { - "name" : "minecraft:dark_prismarine_stairs", - "id" : -3 - }, - { - "name" : "minecraft:darkoak_standing_sign", - "id" : -192 - }, - { - "name" : "minecraft:darkoak_wall_sign", - "id" : -193 - }, - { - "name" : "minecraft:daylight_detector", - "id" : 151 - }, - { - "name" : "minecraft:daylight_detector_inverted", - "id" : 178 - }, - { - "name" : "minecraft:deadbush", - "id" : 32 - }, - { - "name" : "minecraft:deepslate", - "id" : -378 - }, - { - "name" : "minecraft:deepslate_brick_double_slab", - "id" : -399 - }, - { - "name" : "minecraft:deepslate_brick_slab", - "id" : -392 - }, - { - "name" : "minecraft:deepslate_brick_stairs", - "id" : -393 - }, - { - "name" : "minecraft:deepslate_brick_wall", - "id" : -394 - }, - { - "name" : "minecraft:deepslate_bricks", - "id" : -391 - }, - { - "name" : "minecraft:deepslate_coal_ore", - "id" : -406 - }, - { - "name" : "minecraft:deepslate_copper_ore", - "id" : -408 - }, - { - "name" : "minecraft:deepslate_diamond_ore", - "id" : -405 - }, - { - "name" : "minecraft:deepslate_emerald_ore", - "id" : -407 - }, - { - "name" : "minecraft:deepslate_gold_ore", - "id" : -402 - }, - { - "name" : "minecraft:deepslate_iron_ore", - "id" : -401 - }, - { - "name" : "minecraft:deepslate_lapis_ore", - "id" : -400 - }, - { - "name" : "minecraft:deepslate_redstone_ore", - "id" : -403 - }, - { - "name" : "minecraft:deepslate_tile_double_slab", - "id" : -398 - }, - { - "name" : "minecraft:deepslate_tile_slab", - "id" : -388 - }, - { - "name" : "minecraft:deepslate_tile_stairs", - "id" : -389 - }, - { - "name" : "minecraft:deepslate_tile_wall", - "id" : -390 - }, - { - "name" : "minecraft:deepslate_tiles", - "id" : -387 - }, - { - "name" : "minecraft:deny", - "id" : 211 - }, - { - "name" : "minecraft:detector_rail", - "id" : 28 - }, - { - "name" : "minecraft:diamond", - "id" : 304 - }, - { - "name" : "minecraft:diamond_axe", - "id" : 319 - }, - { - "name" : "minecraft:diamond_block", - "id" : 57 - }, - { - "name" : "minecraft:diamond_boots", - "id" : 350 - }, - { - "name" : "minecraft:diamond_chestplate", - "id" : 348 - }, - { - "name" : "minecraft:diamond_helmet", - "id" : 347 - }, - { - "name" : "minecraft:diamond_hoe", - "id" : 332 - }, - { - "name" : "minecraft:diamond_horse_armor", - "id" : 533 - }, - { - "name" : "minecraft:diamond_leggings", - "id" : 349 - }, - { - "name" : "minecraft:diamond_ore", - "id" : 56 - }, - { - "name" : "minecraft:diamond_pickaxe", - "id" : 318 - }, - { - "name" : "minecraft:diamond_shovel", - "id" : 317 - }, - { - "name" : "minecraft:diamond_sword", - "id" : 316 - }, - { - "name" : "minecraft:diorite_stairs", - "id" : -170 - }, - { - "name" : "minecraft:dirt", - "id" : 3 - }, - { - "name" : "minecraft:dirt_with_roots", - "id" : -318 - }, - { - "name" : "minecraft:dispenser", - "id" : 23 - }, - { - "name" : "minecraft:dolphin_spawn_egg", - "id" : 484 - }, - { - "name" : "minecraft:donkey_spawn_egg", - "id" : 465 - }, - { - "name" : "minecraft:double_cut_copper_slab", - "id" : -368 - }, - { - "name" : "minecraft:double_plant", - "id" : 175 - }, - { - "name" : "minecraft:double_stone_slab", - "id" : 44 - }, - { - "name" : "minecraft:double_stone_slab2", - "id" : 182 - }, - { - "name" : "minecraft:double_stone_slab3", - "id" : -162 - }, - { - "name" : "minecraft:double_stone_slab4", - "id" : -166 - }, - { - "name" : "minecraft:double_wooden_slab", - "id" : 157 - }, - { - "name" : "minecraft:dragon_breath", - "id" : 560 - }, - { - "name" : "minecraft:dragon_egg", - "id" : 122 - }, - { - "name" : "minecraft:dried_kelp", - "id" : 270 - }, - { - "name" : "minecraft:dried_kelp_block", - "id" : -139 - }, - { - "name" : "minecraft:dripstone_block", - "id" : -317 - }, - { - "name" : "minecraft:dropper", - "id" : 125 - }, - { - "name" : "minecraft:drowned_spawn_egg", - "id" : 483 - }, - { - "name" : "minecraft:dye", - "id" : 626 - }, - { - "name" : "minecraft:egg", - "id" : 390 - }, - { - "name" : "minecraft:elder_guardian_spawn_egg", - "id" : 471 - }, - { - "name" : "minecraft:element_0", - "id" : 36 - }, - { - "name" : "minecraft:element_1", - "id" : -12 - }, - { - "name" : "minecraft:element_10", - "id" : -21 - }, - { - "name" : "minecraft:element_100", - "id" : -111 - }, - { - "name" : "minecraft:element_101", - "id" : -112 - }, - { - "name" : "minecraft:element_102", - "id" : -113 - }, - { - "name" : "minecraft:element_103", - "id" : -114 - }, - { - "name" : "minecraft:element_104", - "id" : -115 - }, - { - "name" : "minecraft:element_105", - "id" : -116 - }, - { - "name" : "minecraft:element_106", - "id" : -117 - }, - { - "name" : "minecraft:element_107", - "id" : -118 - }, - { - "name" : "minecraft:element_108", - "id" : -119 - }, - { - "name" : "minecraft:element_109", - "id" : -120 - }, - { - "name" : "minecraft:element_11", - "id" : -22 - }, - { - "name" : "minecraft:element_110", - "id" : -121 - }, - { - "name" : "minecraft:element_111", - "id" : -122 - }, - { - "name" : "minecraft:element_112", - "id" : -123 - }, - { - "name" : "minecraft:element_113", - "id" : -124 - }, - { - "name" : "minecraft:element_114", - "id" : -125 - }, - { - "name" : "minecraft:element_115", - "id" : -126 - }, - { - "name" : "minecraft:element_116", - "id" : -127 - }, - { - "name" : "minecraft:element_117", - "id" : -128 - }, - { - "name" : "minecraft:element_118", - "id" : -129 - }, - { - "name" : "minecraft:element_12", - "id" : -23 - }, - { - "name" : "minecraft:element_13", - "id" : -24 - }, - { - "name" : "minecraft:element_14", - "id" : -25 - }, - { - "name" : "minecraft:element_15", - "id" : -26 - }, - { - "name" : "minecraft:element_16", - "id" : -27 - }, - { - "name" : "minecraft:element_17", - "id" : -28 - }, - { - "name" : "minecraft:element_18", - "id" : -29 - }, - { - "name" : "minecraft:element_19", - "id" : -30 - }, - { - "name" : "minecraft:element_2", - "id" : -13 - }, - { - "name" : "minecraft:element_20", - "id" : -31 - }, - { - "name" : "minecraft:element_21", - "id" : -32 - }, - { - "name" : "minecraft:element_22", - "id" : -33 - }, - { - "name" : "minecraft:element_23", - "id" : -34 - }, - { - "name" : "minecraft:element_24", - "id" : -35 - }, - { - "name" : "minecraft:element_25", - "id" : -36 - }, - { - "name" : "minecraft:element_26", - "id" : -37 - }, - { - "name" : "minecraft:element_27", - "id" : -38 - }, - { - "name" : "minecraft:element_28", - "id" : -39 - }, - { - "name" : "minecraft:element_29", - "id" : -40 - }, - { - "name" : "minecraft:element_3", - "id" : -14 - }, - { - "name" : "minecraft:element_30", - "id" : -41 - }, - { - "name" : "minecraft:element_31", - "id" : -42 - }, - { - "name" : "minecraft:element_32", - "id" : -43 - }, - { - "name" : "minecraft:element_33", - "id" : -44 - }, - { - "name" : "minecraft:element_34", - "id" : -45 - }, - { - "name" : "minecraft:element_35", - "id" : -46 - }, - { - "name" : "minecraft:element_36", - "id" : -47 - }, - { - "name" : "minecraft:element_37", - "id" : -48 - }, - { - "name" : "minecraft:element_38", - "id" : -49 - }, - { - "name" : "minecraft:element_39", - "id" : -50 - }, - { - "name" : "minecraft:element_4", - "id" : -15 - }, - { - "name" : "minecraft:element_40", - "id" : -51 - }, - { - "name" : "minecraft:element_41", - "id" : -52 - }, - { - "name" : "minecraft:element_42", - "id" : -53 - }, - { - "name" : "minecraft:element_43", - "id" : -54 - }, - { - "name" : "minecraft:element_44", - "id" : -55 - }, - { - "name" : "minecraft:element_45", - "id" : -56 - }, - { - "name" : "minecraft:element_46", - "id" : -57 - }, - { - "name" : "minecraft:element_47", - "id" : -58 - }, - { - "name" : "minecraft:element_48", - "id" : -59 - }, - { - "name" : "minecraft:element_49", - "id" : -60 - }, - { - "name" : "minecraft:element_5", - "id" : -16 - }, - { - "name" : "minecraft:element_50", - "id" : -61 - }, - { - "name" : "minecraft:element_51", - "id" : -62 - }, - { - "name" : "minecraft:element_52", - "id" : -63 - }, - { - "name" : "minecraft:element_53", - "id" : -64 - }, - { - "name" : "minecraft:element_54", - "id" : -65 - }, - { - "name" : "minecraft:element_55", - "id" : -66 - }, - { - "name" : "minecraft:element_56", - "id" : -67 - }, - { - "name" : "minecraft:element_57", - "id" : -68 - }, - { - "name" : "minecraft:element_58", - "id" : -69 - }, - { - "name" : "minecraft:element_59", - "id" : -70 - }, - { - "name" : "minecraft:element_6", - "id" : -17 - }, - { - "name" : "minecraft:element_60", - "id" : -71 - }, - { - "name" : "minecraft:element_61", - "id" : -72 - }, - { - "name" : "minecraft:element_62", - "id" : -73 - }, - { - "name" : "minecraft:element_63", - "id" : -74 - }, - { - "name" : "minecraft:element_64", - "id" : -75 - }, - { - "name" : "minecraft:element_65", - "id" : -76 - }, - { - "name" : "minecraft:element_66", - "id" : -77 - }, - { - "name" : "minecraft:element_67", - "id" : -78 - }, - { - "name" : "minecraft:element_68", - "id" : -79 - }, - { - "name" : "minecraft:element_69", - "id" : -80 - }, - { - "name" : "minecraft:element_7", - "id" : -18 - }, - { - "name" : "minecraft:element_70", - "id" : -81 - }, - { - "name" : "minecraft:element_71", - "id" : -82 - }, - { - "name" : "minecraft:element_72", - "id" : -83 - }, - { - "name" : "minecraft:element_73", - "id" : -84 - }, - { - "name" : "minecraft:element_74", - "id" : -85 - }, - { - "name" : "minecraft:element_75", - "id" : -86 - }, - { - "name" : "minecraft:element_76", - "id" : -87 - }, - { - "name" : "minecraft:element_77", - "id" : -88 - }, - { - "name" : "minecraft:element_78", - "id" : -89 - }, - { - "name" : "minecraft:element_79", - "id" : -90 - }, - { - "name" : "minecraft:element_8", - "id" : -19 - }, - { - "name" : "minecraft:element_80", - "id" : -91 - }, - { - "name" : "minecraft:element_81", - "id" : -92 - }, - { - "name" : "minecraft:element_82", - "id" : -93 - }, - { - "name" : "minecraft:element_83", - "id" : -94 - }, - { - "name" : "minecraft:element_84", - "id" : -95 - }, - { - "name" : "minecraft:element_85", - "id" : -96 - }, - { - "name" : "minecraft:element_86", - "id" : -97 - }, - { - "name" : "minecraft:element_87", - "id" : -98 - }, - { - "name" : "minecraft:element_88", - "id" : -99 - }, - { - "name" : "minecraft:element_89", - "id" : -100 - }, - { - "name" : "minecraft:element_9", - "id" : -20 - }, - { - "name" : "minecraft:element_90", - "id" : -101 - }, - { - "name" : "minecraft:element_91", - "id" : -102 - }, - { - "name" : "minecraft:element_92", - "id" : -103 - }, - { - "name" : "minecraft:element_93", - "id" : -104 - }, - { - "name" : "minecraft:element_94", - "id" : -105 - }, - { - "name" : "minecraft:element_95", - "id" : -106 - }, - { - "name" : "minecraft:element_96", - "id" : -107 - }, - { - "name" : "minecraft:element_97", - "id" : -108 - }, - { - "name" : "minecraft:element_98", - "id" : -109 - }, - { - "name" : "minecraft:element_99", - "id" : -110 - }, - { - "name" : "minecraft:elytra", - "id" : 564 - }, - { - "name" : "minecraft:emerald", - "id" : 512 - }, - { - "name" : "minecraft:emerald_block", - "id" : 133 - }, - { - "name" : "minecraft:emerald_ore", - "id" : 129 - }, - { - "name" : "minecraft:empty_map", - "id" : 515 - }, - { - "name" : "minecraft:enchanted_book", - "id" : 521 - }, - { - "name" : "minecraft:enchanted_golden_apple", - "id" : 259 - }, - { - "name" : "minecraft:enchanting_table", - "id" : 116 - }, - { - "name" : "minecraft:end_brick_stairs", - "id" : -178 - }, - { - "name" : "minecraft:end_bricks", - "id" : 206 - }, - { - "name" : "minecraft:end_crystal", - "id" : 629 - }, - { - "name" : "minecraft:end_gateway", - "id" : 209 - }, - { - "name" : "minecraft:end_portal", - "id" : 119 - }, - { - "name" : "minecraft:end_portal_frame", - "id" : 120 - }, - { - "name" : "minecraft:end_rod", - "id" : 208 - }, - { - "name" : "minecraft:end_stone", - "id" : 121 - }, - { - "name" : "minecraft:ender_chest", - "id" : 130 - }, - { - "name" : "minecraft:ender_eye", - "id" : 433 - }, - { - "name" : "minecraft:ender_pearl", - "id" : 422 - }, - { - "name" : "minecraft:enderman_spawn_egg", - "id" : 442 - }, - { - "name" : "minecraft:endermite_spawn_egg", - "id" : 460 - }, - { - "name" : "minecraft:evoker_spawn_egg", - "id" : 475 - }, - { - "name" : "minecraft:experience_bottle", - "id" : 508 - }, - { - "name" : "minecraft:exposed_copper", - "id" : -341 - }, - { - "name" : "minecraft:exposed_cut_copper", - "id" : -348 - }, - { - "name" : "minecraft:exposed_cut_copper_slab", - "id" : -362 - }, - { - "name" : "minecraft:exposed_cut_copper_stairs", - "id" : -355 - }, - { - "name" : "minecraft:exposed_double_cut_copper_slab", - "id" : -369 - }, - { - "name" : "minecraft:farmland", - "id" : 60 - }, - { - "name" : "minecraft:feather", - "id" : 327 - }, - { - "name" : "minecraft:fence", - "id" : 85 - }, - { - "name" : "minecraft:fence_gate", - "id" : 107 - }, - { - "name" : "minecraft:fermented_spider_eye", - "id" : 428 - }, - { - "name" : "minecraft:field_masoned_banner_pattern", - "id" : 585 - }, - { - "name" : "minecraft:filled_map", - "id" : 420 - }, - { - "name" : "minecraft:fire", - "id" : 51 - }, - { - "name" : "minecraft:fire_charge", - "id" : 509 - }, - { - "name" : "minecraft:firework_rocket", - "id" : 519 - }, - { - "name" : "minecraft:firework_star", - "id" : 520 - }, - { - "name" : "minecraft:fishing_rod", - "id" : 392 - }, - { - "name" : "minecraft:fletching_table", - "id" : -201 - }, - { - "name" : "minecraft:flint", - "id" : 356 - }, - { - "name" : "minecraft:flint_and_steel", - "id" : 299 - }, - { - "name" : "minecraft:flower_banner_pattern", - "id" : 581 - }, - { - "name" : "minecraft:flower_pot", - "id" : 514 - }, - { - "name" : "minecraft:flowering_azalea", - "id" : -338 - }, - { - "name" : "minecraft:flowing_lava", - "id" : 10 - }, - { - "name" : "minecraft:flowing_water", - "id" : 8 - }, - { - "name" : "minecraft:fox_spawn_egg", - "id" : 490 - }, - { - "name" : "minecraft:frame", - "id" : 513 - }, - { - "name" : "minecraft:frosted_ice", - "id" : 207 - }, - { - "name" : "minecraft:furnace", - "id" : 61 - }, - { - "name" : "minecraft:ghast_spawn_egg", - "id" : 454 - }, - { - "name" : "minecraft:ghast_tear", - "id" : 424 - }, - { - "name" : "minecraft:gilded_blackstone", - "id" : -281 - }, - { - "name" : "minecraft:glass", - "id" : 20 - }, - { - "name" : "minecraft:glass_bottle", - "id" : 427 - }, - { - "name" : "minecraft:glass_pane", - "id" : 102 - }, - { - "name" : "minecraft:glistering_melon_slice", - "id" : 434 - }, - { - "name" : "minecraft:glow_berries", - "id" : 630 - }, - { - "name" : "minecraft:glow_frame", - "id" : 621 - }, - { - "name" : "minecraft:glow_ink_sac", - "id" : 503 - }, - { - "name" : "minecraft:glow_lichen", - "id" : -411 - }, - { - "name" : "minecraft:glow_squid_spawn_egg", - "id" : 502 - }, - { - "name" : "minecraft:glow_stick", - "id" : 166 - }, - { - "name" : "minecraft:glowingobsidian", - "id" : 246 - }, - { - "name" : "minecraft:glowstone", - "id" : 89 - }, - { - "name" : "minecraft:glowstone_dust", - "id" : 394 - }, - { - "name" : "minecraft:goat_horn", - "id" : 622 - }, - { - "name" : "minecraft:goat_spawn_egg", - "id" : 501 - }, - { - "name" : "minecraft:gold_block", - "id" : 41 - }, - { - "name" : "minecraft:gold_ingot", - "id" : 306 - }, - { - "name" : "minecraft:gold_nugget", - "id" : 425 - }, - { - "name" : "minecraft:gold_ore", - "id" : 14 - }, - { - "name" : "minecraft:golden_apple", - "id" : 258 - }, - { - "name" : "minecraft:golden_axe", - "id" : 325 - }, - { - "name" : "minecraft:golden_boots", - "id" : 354 - }, - { - "name" : "minecraft:golden_carrot", - "id" : 283 - }, - { - "name" : "minecraft:golden_chestplate", - "id" : 352 - }, - { - "name" : "minecraft:golden_helmet", - "id" : 351 - }, - { - "name" : "minecraft:golden_hoe", - "id" : 333 - }, - { - "name" : "minecraft:golden_horse_armor", - "id" : 532 - }, - { - "name" : "minecraft:golden_leggings", - "id" : 353 - }, - { - "name" : "minecraft:golden_pickaxe", - "id" : 324 - }, - { - "name" : "minecraft:golden_rail", - "id" : 27 - }, - { - "name" : "minecraft:golden_shovel", - "id" : 323 - }, - { - "name" : "minecraft:golden_sword", - "id" : 322 - }, - { - "name" : "minecraft:granite_stairs", - "id" : -169 - }, - { - "name" : "minecraft:grass", - "id" : 2 - }, - { - "name" : "minecraft:grass_path", - "id" : 198 - }, - { - "name" : "minecraft:gravel", - "id" : 13 - }, - { - "name" : "minecraft:gray_dye", - "id" : 403 - }, - { - "name" : "minecraft:gray_glazed_terracotta", - "id" : 227 - }, - { - "name" : "minecraft:green_dye", - "id" : 397 - }, - { - "name" : "minecraft:green_glazed_terracotta", - "id" : 233 - }, - { - "name" : "minecraft:grindstone", - "id" : -195 - }, - { - "name" : "minecraft:guardian_spawn_egg", - "id" : 461 - }, - { - "name" : "minecraft:gunpowder", - "id" : 328 - }, - { - "name" : "minecraft:hanging_roots", - "id" : -319 - }, - { - "name" : "minecraft:hard_glass", - "id" : 253 - }, - { - "name" : "minecraft:hard_glass_pane", - "id" : 190 - }, - { - "name" : "minecraft:hard_stained_glass", - "id" : 254 - }, - { - "name" : "minecraft:hard_stained_glass_pane", - "id" : 191 - }, - { - "name" : "minecraft:hardened_clay", - "id" : 172 - }, - { - "name" : "minecraft:hay_block", - "id" : 170 - }, - { - "name" : "minecraft:heart_of_the_sea", - "id" : 571 - }, - { - "name" : "minecraft:heavy_weighted_pressure_plate", - "id" : 148 - }, - { - "name" : "minecraft:hoglin_spawn_egg", - "id" : 496 - }, - { - "name" : "minecraft:honey_block", - "id" : -220 - }, - { - "name" : "minecraft:honey_bottle", - "id" : 591 - }, - { - "name" : "minecraft:honeycomb", - "id" : 590 - }, - { - "name" : "minecraft:honeycomb_block", - "id" : -221 - }, - { - "name" : "minecraft:hopper", - "id" : 527 - }, - { - "name" : "minecraft:hopper_minecart", - "id" : 526 - }, - { - "name" : "minecraft:horse_spawn_egg", - "id" : 458 - }, - { - "name" : "minecraft:husk_spawn_egg", - "id" : 463 - }, - { - "name" : "minecraft:ice", - "id" : 79 - }, - { - "name" : "minecraft:ice_bomb", - "id" : 594 - }, - { - "name" : "minecraft:infested_deepslate", - "id" : -454 - }, - { - "name" : "minecraft:info_update", - "id" : 248 - }, - { - "name" : "minecraft:info_update2", - "id" : 249 - }, - { - "name" : "minecraft:ink_sac", - "id" : 413 - }, - { - "name" : "minecraft:invisiblebedrock", - "id" : 95 - }, - { - "name" : "minecraft:iron_axe", - "id" : 298 - }, - { - "name" : "minecraft:iron_bars", - "id" : 101 - }, - { - "name" : "minecraft:iron_block", - "id" : 42 - }, - { - "name" : "minecraft:iron_boots", - "id" : 346 - }, - { - "name" : "minecraft:iron_chestplate", - "id" : 344 - }, - { - "name" : "minecraft:iron_door", - "id" : 372 - }, - { - "name" : "minecraft:iron_helmet", - "id" : 343 - }, - { - "name" : "minecraft:iron_hoe", - "id" : 331 - }, - { - "name" : "minecraft:iron_horse_armor", - "id" : 531 - }, - { - "name" : "minecraft:iron_ingot", - "id" : 305 - }, - { - "name" : "minecraft:iron_leggings", - "id" : 345 - }, - { - "name" : "minecraft:iron_nugget", - "id" : 569 - }, - { - "name" : "minecraft:iron_ore", - "id" : 15 - }, - { - "name" : "minecraft:iron_pickaxe", - "id" : 297 - }, - { - "name" : "minecraft:iron_shovel", - "id" : 296 - }, - { - "name" : "minecraft:iron_sword", - "id" : 307 - }, - { - "name" : "minecraft:iron_trapdoor", - "id" : 167 - }, - { - "name" : "minecraft:item.acacia_door", - "id" : 196 - }, - { - "name" : "minecraft:item.bed", - "id" : 26 - }, - { - "name" : "minecraft:item.beetroot", - "id" : 244 - }, - { - "name" : "minecraft:item.birch_door", - "id" : 194 - }, - { - "name" : "minecraft:item.cake", - "id" : 92 - }, - { - "name" : "minecraft:item.camera", - "id" : 242 - }, - { - "name" : "minecraft:item.campfire", - "id" : -209 - }, - { - "name" : "minecraft:item.cauldron", - "id" : 118 - }, - { - "name" : "minecraft:item.chain", - "id" : -286 - }, - { - "name" : "minecraft:item.crimson_door", - "id" : -244 - }, - { - "name" : "minecraft:item.dark_oak_door", - "id" : 197 - }, - { - "name" : "minecraft:item.flower_pot", - "id" : 140 - }, - { - "name" : "minecraft:item.frame", - "id" : 199 - }, - { - "name" : "minecraft:item.glow_frame", - "id" : -339 - }, - { - "name" : "minecraft:item.hopper", - "id" : 154 - }, - { - "name" : "minecraft:item.iron_door", - "id" : 71 - }, - { - "name" : "minecraft:item.jungle_door", - "id" : 195 - }, - { - "name" : "minecraft:item.kelp", - "id" : -138 - }, - { - "name" : "minecraft:item.nether_sprouts", - "id" : -238 - }, - { - "name" : "minecraft:item.nether_wart", - "id" : 115 - }, - { - "name" : "minecraft:item.reeds", - "id" : 83 - }, - { - "name" : "minecraft:item.skull", - "id" : 144 - }, - { - "name" : "minecraft:item.soul_campfire", - "id" : -290 - }, - { - "name" : "minecraft:item.spruce_door", - "id" : 193 - }, - { - "name" : "minecraft:item.warped_door", - "id" : -245 - }, - { - "name" : "minecraft:item.wheat", - "id" : 59 - }, - { - "name" : "minecraft:item.wooden_door", - "id" : 64 - }, - { - "name" : "minecraft:jigsaw", - "id" : -211 - }, - { - "name" : "minecraft:jukebox", - "id" : 84 - }, - { - "name" : "minecraft:jungle_boat", - "id" : 377 - }, - { - "name" : "minecraft:jungle_button", - "id" : -143 - }, - { - "name" : "minecraft:jungle_door", - "id" : 555 - }, - { - "name" : "minecraft:jungle_fence_gate", - "id" : 185 - }, - { - "name" : "minecraft:jungle_pressure_plate", - "id" : -153 - }, - { - "name" : "minecraft:jungle_sign", - "id" : 578 - }, - { - "name" : "minecraft:jungle_stairs", - "id" : 136 - }, - { - "name" : "minecraft:jungle_standing_sign", - "id" : -188 - }, - { - "name" : "minecraft:jungle_trapdoor", - "id" : -148 - }, - { - "name" : "minecraft:jungle_wall_sign", - "id" : -189 - }, - { - "name" : "minecraft:kelp", - "id" : 382 - }, - { - "name" : "minecraft:ladder", - "id" : 65 - }, - { - "name" : "minecraft:lantern", - "id" : -208 - }, - { - "name" : "minecraft:lapis_block", - "id" : 22 - }, - { - "name" : "minecraft:lapis_lazuli", - "id" : 414 - }, - { - "name" : "minecraft:lapis_ore", - "id" : 21 - }, - { - "name" : "minecraft:large_amethyst_bud", - "id" : -330 - }, - { - "name" : "minecraft:lava", - "id" : 11 - }, - { - "name" : "minecraft:lava_bucket", - "id" : 363 - }, - { - "name" : "minecraft:lava_cauldron", - "id" : -210 - }, - { - "name" : "minecraft:lead", - "id" : 547 - }, - { - "name" : "minecraft:leather", - "id" : 381 - }, - { - "name" : "minecraft:leather_boots", - "id" : 338 - }, - { - "name" : "minecraft:leather_chestplate", - "id" : 336 - }, - { - "name" : "minecraft:leather_helmet", - "id" : 335 - }, - { - "name" : "minecraft:leather_horse_armor", - "id" : 530 - }, - { - "name" : "minecraft:leather_leggings", - "id" : 337 - }, - { - "name" : "minecraft:leaves", - "id" : 18 - }, - { - "name" : "minecraft:leaves2", - "id" : 161 - }, - { - "name" : "minecraft:lectern", - "id" : -194 - }, - { - "name" : "minecraft:lever", - "id" : 69 - }, - { - "name" : "minecraft:light_block", - "id" : -215 - }, - { - "name" : "minecraft:light_blue_dye", - "id" : 407 - }, - { - "name" : "minecraft:light_blue_glazed_terracotta", - "id" : 223 - }, - { - "name" : "minecraft:light_gray_dye", - "id" : 402 - }, - { - "name" : "minecraft:light_weighted_pressure_plate", - "id" : 147 - }, - { - "name" : "minecraft:lightning_rod", - "id" : -312 - }, - { - "name" : "minecraft:lime_dye", - "id" : 405 - }, - { - "name" : "minecraft:lime_glazed_terracotta", - "id" : 225 - }, - { - "name" : "minecraft:lingering_potion", - "id" : 562 - }, - { - "name" : "minecraft:lit_blast_furnace", - "id" : -214 - }, - { - "name" : "minecraft:lit_deepslate_redstone_ore", - "id" : -404 - }, - { - "name" : "minecraft:lit_furnace", - "id" : 62 - }, - { - "name" : "minecraft:lit_pumpkin", - "id" : 91 - }, - { - "name" : "minecraft:lit_redstone_lamp", - "id" : 124 - }, - { - "name" : "minecraft:lit_redstone_ore", - "id" : 74 - }, - { - "name" : "minecraft:lit_smoker", - "id" : -199 - }, - { - "name" : "minecraft:llama_spawn_egg", - "id" : 473 - }, - { - "name" : "minecraft:lodestone", - "id" : -222 - }, - { - "name" : "minecraft:lodestone_compass", - "id" : 600 - }, - { - "name" : "minecraft:log", - "id" : 17 - }, - { - "name" : "minecraft:log2", - "id" : 162 - }, - { - "name" : "minecraft:loom", - "id" : -204 - }, - { - "name" : "minecraft:magenta_dye", - "id" : 408 - }, - { - "name" : "minecraft:magenta_glazed_terracotta", - "id" : 222 - }, - { - "name" : "minecraft:magma", - "id" : 213 - }, - { - "name" : "minecraft:magma_cream", - "id" : 430 - }, - { - "name" : "minecraft:magma_cube_spawn_egg", - "id" : 455 - }, - { - "name" : "minecraft:medicine", - "id" : 598 - }, - { - "name" : "minecraft:medium_amethyst_bud", - "id" : -331 - }, - { - "name" : "minecraft:melon_block", - "id" : 103 - }, - { - "name" : "minecraft:melon_seeds", - "id" : 293 - }, - { - "name" : "minecraft:melon_slice", - "id" : 272 - }, - { - "name" : "minecraft:melon_stem", - "id" : 105 - }, - { - "name" : "minecraft:milk_bucket", - "id" : 361 - }, - { - "name" : "minecraft:minecart", - "id" : 370 - }, - { - "name" : "minecraft:mob_spawner", - "id" : 52 - }, - { - "name" : "minecraft:mojang_banner_pattern", - "id" : 584 - }, - { - "name" : "minecraft:monster_egg", - "id" : 97 - }, - { - "name" : "minecraft:mooshroom_spawn_egg", - "id" : 440 - }, - { - "name" : "minecraft:moss_block", - "id" : -320 - }, - { - "name" : "minecraft:moss_carpet", - "id" : -335 - }, - { - "name" : "minecraft:mossy_cobblestone", - "id" : 48 - }, - { - "name" : "minecraft:mossy_cobblestone_stairs", - "id" : -179 - }, - { - "name" : "minecraft:mossy_stone_brick_stairs", - "id" : -175 - }, - { - "name" : "minecraft:movingblock", - "id" : 250 - }, - { - "name" : "minecraft:mule_spawn_egg", - "id" : 466 - }, - { - "name" : "minecraft:mushroom_stew", - "id" : 260 - }, - { - "name" : "minecraft:music_disc_11", - "id" : 544 - }, - { - "name" : "minecraft:music_disc_13", - "id" : 534 - }, - { - "name" : "minecraft:music_disc_blocks", - "id" : 536 - }, - { - "name" : "minecraft:music_disc_cat", - "id" : 535 - }, - { - "name" : "minecraft:music_disc_chirp", - "id" : 537 - }, - { - "name" : "minecraft:music_disc_far", - "id" : 538 - }, - { - "name" : "minecraft:music_disc_mall", - "id" : 539 - }, - { - "name" : "minecraft:music_disc_mellohi", - "id" : 540 - }, - { - "name" : "minecraft:music_disc_pigstep", - "id" : 618 - }, - { - "name" : "minecraft:music_disc_stal", - "id" : 541 - }, - { - "name" : "minecraft:music_disc_strad", - "id" : 542 - }, - { - "name" : "minecraft:music_disc_wait", - "id" : 545 - }, - { - "name" : "minecraft:music_disc_ward", - "id" : 543 - }, - { - "name" : "minecraft:mutton", - "id" : 550 - }, - { - "name" : "minecraft:mycelium", - "id" : 110 - }, - { - "name" : "minecraft:name_tag", - "id" : 548 - }, - { - "name" : "minecraft:nautilus_shell", - "id" : 570 - }, - { - "name" : "minecraft:nether_brick", - "id" : 112 - }, - { - "name" : "minecraft:nether_brick_fence", - "id" : 113 - }, - { - "name" : "minecraft:nether_brick_stairs", - "id" : 114 - }, - { - "name" : "minecraft:nether_gold_ore", - "id" : -288 - }, - { - "name" : "minecraft:nether_sprouts", - "id" : 619 - }, - { - "name" : "minecraft:nether_star", - "id" : 518 - }, - { - "name" : "minecraft:nether_wart", - "id" : 294 - }, - { - "name" : "minecraft:nether_wart_block", - "id" : 214 - }, - { - "name" : "minecraft:netherbrick", - "id" : 523 - }, - { - "name" : "minecraft:netherite_axe", - "id" : 605 - }, - { - "name" : "minecraft:netherite_block", - "id" : -270 - }, - { - "name" : "minecraft:netherite_boots", - "id" : 610 - }, - { - "name" : "minecraft:netherite_chestplate", - "id" : 608 - }, - { - "name" : "minecraft:netherite_helmet", - "id" : 607 - }, - { - "name" : "minecraft:netherite_hoe", - "id" : 606 - }, - { - "name" : "minecraft:netherite_ingot", - "id" : 601 - }, - { - "name" : "minecraft:netherite_leggings", - "id" : 609 - }, - { - "name" : "minecraft:netherite_pickaxe", - "id" : 604 - }, - { - "name" : "minecraft:netherite_scrap", - "id" : 611 - }, - { - "name" : "minecraft:netherite_shovel", - "id" : 603 - }, - { - "name" : "minecraft:netherite_sword", - "id" : 602 - }, - { - "name" : "minecraft:netherrack", - "id" : 87 - }, - { - "name" : "minecraft:netherreactor", - "id" : 247 - }, - { - "name" : "minecraft:normal_stone_stairs", - "id" : -180 - }, - { - "name" : "minecraft:noteblock", - "id" : 25 - }, - { - "name" : "minecraft:npc_spawn_egg", - "id" : 470 - }, - { - "name" : "minecraft:oak_boat", - "id" : 375 - }, - { - "name" : "minecraft:oak_sign", - "id" : 358 - }, - { - "name" : "minecraft:oak_stairs", - "id" : 53 - }, - { - "name" : "minecraft:observer", - "id" : 251 - }, - { - "name" : "minecraft:obsidian", - "id" : 49 - }, - { - "name" : "minecraft:ocelot_spawn_egg", - "id" : 451 - }, - { - "name" : "minecraft:orange_dye", - "id" : 409 - }, - { - "name" : "minecraft:orange_glazed_terracotta", - "id" : 221 - }, - { - "name" : "minecraft:oxidized_copper", - "id" : -343 - }, - { - "name" : "minecraft:oxidized_cut_copper", - "id" : -350 - }, - { - "name" : "minecraft:oxidized_cut_copper_slab", - "id" : -364 - }, - { - "name" : "minecraft:oxidized_cut_copper_stairs", - "id" : -357 - }, - { - "name" : "minecraft:oxidized_double_cut_copper_slab", - "id" : -371 - }, - { - "name" : "minecraft:packed_ice", - "id" : 174 - }, - { - "name" : "minecraft:painting", - "id" : 357 - }, - { - "name" : "minecraft:panda_spawn_egg", - "id" : 489 - }, - { - "name" : "minecraft:paper", - "id" : 386 - }, - { - "name" : "minecraft:parrot_spawn_egg", - "id" : 478 - }, - { - "name" : "minecraft:phantom_membrane", - "id" : 574 - }, - { - "name" : "minecraft:phantom_spawn_egg", - "id" : 486 - }, - { - "name" : "minecraft:pig_spawn_egg", - "id" : 437 - }, - { - "name" : "minecraft:piglin_banner_pattern", - "id" : 587 - }, - { - "name" : "minecraft:piglin_brute_spawn_egg", - "id" : 499 - }, - { - "name" : "minecraft:piglin_spawn_egg", - "id" : 497 - }, - { - "name" : "minecraft:pillager_spawn_egg", - "id" : 491 - }, - { - "name" : "minecraft:pink_dye", - "id" : 404 - }, - { - "name" : "minecraft:pink_glazed_terracotta", - "id" : 226 - }, - { - "name" : "minecraft:piston", - "id" : 33 - }, - { - "name" : "minecraft:pistonarmcollision", - "id" : 34 - }, - { - "name" : "minecraft:planks", - "id" : 5 - }, - { - "name" : "minecraft:podzol", - "id" : 243 - }, - { - "name" : "minecraft:pointed_dripstone", - "id" : -308 - }, - { - "name" : "minecraft:poisonous_potato", - "id" : 282 - }, - { - "name" : "minecraft:polar_bear_spawn_egg", - "id" : 472 - }, - { - "name" : "minecraft:polished_andesite_stairs", - "id" : -174 - }, - { - "name" : "minecraft:polished_basalt", - "id" : -235 - }, - { - "name" : "minecraft:polished_blackstone", - "id" : -291 - }, - { - "name" : "minecraft:polished_blackstone_brick_double_slab", - "id" : -285 - }, - { - "name" : "minecraft:polished_blackstone_brick_slab", - "id" : -284 - }, - { - "name" : "minecraft:polished_blackstone_brick_stairs", - "id" : -275 - }, - { - "name" : "minecraft:polished_blackstone_brick_wall", - "id" : -278 - }, - { - "name" : "minecraft:polished_blackstone_bricks", - "id" : -274 - }, - { - "name" : "minecraft:polished_blackstone_button", - "id" : -296 - }, - { - "name" : "minecraft:polished_blackstone_double_slab", - "id" : -294 - }, - { - "name" : "minecraft:polished_blackstone_pressure_plate", - "id" : -295 - }, - { - "name" : "minecraft:polished_blackstone_slab", - "id" : -293 - }, - { - "name" : "minecraft:polished_blackstone_stairs", - "id" : -292 - }, - { - "name" : "minecraft:polished_blackstone_wall", - "id" : -297 - }, - { - "name" : "minecraft:polished_deepslate", - "id" : -383 - }, - { - "name" : "minecraft:polished_deepslate_double_slab", - "id" : -397 - }, - { - "name" : "minecraft:polished_deepslate_slab", - "id" : -384 - }, - { - "name" : "minecraft:polished_deepslate_stairs", - "id" : -385 - }, - { - "name" : "minecraft:polished_deepslate_wall", - "id" : -386 - }, - { - "name" : "minecraft:polished_diorite_stairs", - "id" : -173 - }, - { - "name" : "minecraft:polished_granite_stairs", - "id" : -172 - }, - { - "name" : "minecraft:popped_chorus_fruit", - "id" : 559 - }, - { - "name" : "minecraft:porkchop", - "id" : 262 - }, - { - "name" : "minecraft:portal", - "id" : 90 - }, - { - "name" : "minecraft:potato", - "id" : 280 - }, - { - "name" : "minecraft:potatoes", - "id" : 142 - }, - { - "name" : "minecraft:potion", - "id" : 426 - }, - { - "name" : "minecraft:powder_snow", - "id" : -306 - }, - { - "name" : "minecraft:powder_snow_bucket", - "id" : 368 - }, - { - "name" : "minecraft:powered_comparator", - "id" : 150 - }, - { - "name" : "minecraft:powered_repeater", - "id" : 94 - }, - { - "name" : "minecraft:prismarine", - "id" : 168 - }, - { - "name" : "minecraft:prismarine_bricks_stairs", - "id" : -4 - }, - { - "name" : "minecraft:prismarine_crystals", - "id" : 549 - }, - { - "name" : "minecraft:prismarine_shard", - "id" : 565 - }, - { - "name" : "minecraft:prismarine_stairs", - "id" : -2 - }, - { - "name" : "minecraft:pufferfish", - "id" : 267 - }, - { - "name" : "minecraft:pufferfish_bucket", - "id" : 367 - }, - { - "name" : "minecraft:pufferfish_spawn_egg", - "id" : 481 - }, - { - "name" : "minecraft:pumpkin", - "id" : 86 - }, - { - "name" : "minecraft:pumpkin_pie", - "id" : 284 - }, - { - "name" : "minecraft:pumpkin_seeds", - "id" : 292 - }, - { - "name" : "minecraft:pumpkin_stem", - "id" : 104 - }, - { - "name" : "minecraft:purple_dye", - "id" : 400 - }, - { - "name" : "minecraft:purple_glazed_terracotta", - "id" : 219 - }, - { - "name" : "minecraft:purpur_block", - "id" : 201 - }, - { - "name" : "minecraft:purpur_stairs", - "id" : 203 - }, - { - "name" : "minecraft:quartz", - "id" : 524 - }, - { - "name" : "minecraft:quartz_block", - "id" : 155 - }, - { - "name" : "minecraft:quartz_bricks", - "id" : -304 - }, - { - "name" : "minecraft:quartz_ore", - "id" : 153 - }, - { - "name" : "minecraft:quartz_stairs", - "id" : 156 - }, - { - "name" : "minecraft:rabbit", - "id" : 288 - }, - { - "name" : "minecraft:rabbit_foot", - "id" : 528 - }, - { - "name" : "minecraft:rabbit_hide", - "id" : 529 - }, - { - "name" : "minecraft:rabbit_spawn_egg", - "id" : 459 - }, - { - "name" : "minecraft:rabbit_stew", - "id" : 290 - }, - { - "name" : "minecraft:rail", - "id" : 66 - }, - { - "name" : "minecraft:rapid_fertilizer", - "id" : 596 - }, - { - "name" : "minecraft:ravager_spawn_egg", - "id" : 493 - }, - { - "name" : "minecraft:raw_copper", - "id" : 507 - }, - { - "name" : "minecraft:raw_copper_block", - "id" : -452 - }, - { - "name" : "minecraft:raw_gold", - "id" : 506 - }, - { - "name" : "minecraft:raw_gold_block", - "id" : -453 - }, - { - "name" : "minecraft:raw_iron", - "id" : 505 - }, - { - "name" : "minecraft:raw_iron_block", - "id" : -451 - }, - { - "name" : "minecraft:real_double_stone_slab", - "id" : 43 - }, - { - "name" : "minecraft:real_double_stone_slab2", - "id" : 181 - }, - { - "name" : "minecraft:real_double_stone_slab3", - "id" : -167 - }, - { - "name" : "minecraft:real_double_stone_slab4", - "id" : -168 - }, - { - "name" : "minecraft:red_dye", - "id" : 396 - }, - { - "name" : "minecraft:red_flower", - "id" : 38 - }, - { - "name" : "minecraft:red_glazed_terracotta", - "id" : 234 - }, - { - "name" : "minecraft:red_mushroom", - "id" : 40 - }, - { - "name" : "minecraft:red_mushroom_block", - "id" : 100 - }, - { - "name" : "minecraft:red_nether_brick", - "id" : 215 - }, - { - "name" : "minecraft:red_nether_brick_stairs", - "id" : -184 - }, - { - "name" : "minecraft:red_sandstone", - "id" : 179 - }, - { - "name" : "minecraft:red_sandstone_stairs", - "id" : 180 - }, - { - "name" : "minecraft:redstone", - "id" : 373 - }, - { - "name" : "minecraft:redstone_block", - "id" : 152 - }, - { - "name" : "minecraft:redstone_lamp", - "id" : 123 - }, - { - "name" : "minecraft:redstone_ore", - "id" : 73 - }, - { - "name" : "minecraft:redstone_torch", - "id" : 76 - }, - { - "name" : "minecraft:redstone_wire", - "id" : 55 - }, - { - "name" : "minecraft:repeater", - "id" : 419 - }, - { - "name" : "minecraft:repeating_command_block", - "id" : 188 - }, - { - "name" : "minecraft:reserved6", - "id" : 255 - }, - { - "name" : "minecraft:respawn_anchor", - "id" : -272 - }, - { - "name" : "minecraft:rotten_flesh", - "id" : 277 - }, - { - "name" : "minecraft:saddle", - "id" : 371 - }, - { - "name" : "minecraft:salmon", - "id" : 265 - }, - { - "name" : "minecraft:salmon_bucket", - "id" : 365 - }, - { - "name" : "minecraft:salmon_spawn_egg", - "id" : 482 - }, - { - "name" : "minecraft:sand", - "id" : 12 - }, - { - "name" : "minecraft:sandstone", - "id" : 24 - }, - { - "name" : "minecraft:sandstone_stairs", - "id" : 128 - }, - { - "name" : "minecraft:sapling", - "id" : 6 - }, - { - "name" : "minecraft:scaffolding", - "id" : -165 - }, - { - "name" : "minecraft:sculk_sensor", - "id" : -307 - }, - { - "name" : "minecraft:scute", - "id" : 572 - }, - { - "name" : "minecraft:sea_pickle", - "id" : -156 - }, - { - "name" : "minecraft:seagrass", - "id" : -130 - }, - { - "name" : "minecraft:sealantern", - "id" : 169 - }, - { - "name" : "minecraft:shears", - "id" : 421 - }, - { - "name" : "minecraft:sheep_spawn_egg", - "id" : 438 - }, - { - "name" : "minecraft:shield", - "id" : 355 - }, - { - "name" : "minecraft:shroomlight", - "id" : -230 - }, - { - "name" : "minecraft:shulker_box", - "id" : 218 - }, - { - "name" : "minecraft:shulker_shell", - "id" : 566 - }, - { - "name" : "minecraft:shulker_spawn_egg", - "id" : 469 - }, - { - "name" : "minecraft:silver_glazed_terracotta", - "id" : 228 - }, - { - "name" : "minecraft:silverfish_spawn_egg", - "id" : 443 - }, - { - "name" : "minecraft:skeleton_horse_spawn_egg", - "id" : 467 - }, - { - "name" : "minecraft:skeleton_spawn_egg", - "id" : 444 - }, - { - "name" : "minecraft:skull", - "id" : 516 - }, - { - "name" : "minecraft:skull_banner_pattern", - "id" : 583 - }, - { - "name" : "minecraft:slime", - "id" : 165 - }, - { - "name" : "minecraft:slime_ball", - "id" : 388 - }, - { - "name" : "minecraft:slime_spawn_egg", - "id" : 445 - }, - { - "name" : "minecraft:small_amethyst_bud", - "id" : -332 - }, - { - "name" : "minecraft:small_dripleaf_block", - "id" : -336 - }, - { - "name" : "minecraft:smithing_table", - "id" : -202 - }, - { - "name" : "minecraft:smoker", - "id" : -198 - }, - { - "name" : "minecraft:smooth_basalt", - "id" : -377 - }, - { - "name" : "minecraft:smooth_quartz_stairs", - "id" : -185 - }, - { - "name" : "minecraft:smooth_red_sandstone_stairs", - "id" : -176 - }, - { - "name" : "minecraft:smooth_sandstone_stairs", - "id" : -177 - }, - { - "name" : "minecraft:smooth_stone", - "id" : -183 - }, - { - "name" : "minecraft:snow", - "id" : 80 - }, - { - "name" : "minecraft:snow_layer", - "id" : 78 - }, - { - "name" : "minecraft:snowball", - "id" : 374 - }, - { - "name" : "minecraft:soul_campfire", - "id" : 620 - }, - { - "name" : "minecraft:soul_fire", - "id" : -237 - }, - { - "name" : "minecraft:soul_lantern", - "id" : -269 - }, - { - "name" : "minecraft:soul_sand", - "id" : 88 - }, - { - "name" : "minecraft:soul_soil", - "id" : -236 - }, - { - "name" : "minecraft:soul_torch", - "id" : -268 - }, - { - "name" : "minecraft:sparkler", - "id" : 599 - }, - { - "name" : "minecraft:spawn_egg", - "id" : 628 - }, - { - "name" : "minecraft:spider_eye", - "id" : 278 - }, - { - "name" : "minecraft:spider_spawn_egg", - "id" : 446 - }, - { - "name" : "minecraft:splash_potion", - "id" : 561 - }, - { - "name" : "minecraft:sponge", - "id" : 19 - }, - { - "name" : "minecraft:spore_blossom", - "id" : -321 - }, - { - "name" : "minecraft:spruce_boat", - "id" : 378 - }, - { - "name" : "minecraft:spruce_button", - "id" : -144 - }, - { - "name" : "minecraft:spruce_door", - "id" : 553 - }, - { - "name" : "minecraft:spruce_fence_gate", - "id" : 183 - }, - { - "name" : "minecraft:spruce_pressure_plate", - "id" : -154 - }, - { - "name" : "minecraft:spruce_sign", - "id" : 576 - }, - { - "name" : "minecraft:spruce_stairs", - "id" : 134 - }, - { - "name" : "minecraft:spruce_standing_sign", - "id" : -181 - }, - { - "name" : "minecraft:spruce_trapdoor", - "id" : -149 - }, - { - "name" : "minecraft:spruce_wall_sign", - "id" : -182 - }, - { - "name" : "minecraft:spyglass", - "id" : 624 - }, - { - "name" : "minecraft:squid_spawn_egg", - "id" : 450 - }, - { - "name" : "minecraft:stained_glass", - "id" : 241 - }, - { - "name" : "minecraft:stained_glass_pane", - "id" : 160 - }, - { - "name" : "minecraft:stained_hardened_clay", - "id" : 159 - }, - { - "name" : "minecraft:standing_banner", - "id" : 176 - }, - { - "name" : "minecraft:standing_sign", - "id" : 63 - }, - { - "name" : "minecraft:stick", - "id" : 320 - }, - { - "name" : "minecraft:sticky_piston", - "id" : 29 - }, - { - "name" : "minecraft:stickypistonarmcollision", - "id" : -217 - }, - { - "name" : "minecraft:stone", - "id" : 1 - }, - { - "name" : "minecraft:stone_axe", - "id" : 315 - }, - { - "name" : "minecraft:stone_brick_stairs", - "id" : 109 - }, - { - "name" : "minecraft:stone_button", - "id" : 77 - }, - { - "name" : "minecraft:stone_hoe", - "id" : 330 - }, - { - "name" : "minecraft:stone_pickaxe", - "id" : 314 - }, - { - "name" : "minecraft:stone_pressure_plate", - "id" : 70 - }, - { - "name" : "minecraft:stone_shovel", - "id" : 313 - }, - { - "name" : "minecraft:stone_stairs", - "id" : 67 - }, - { - "name" : "minecraft:stone_sword", - "id" : 312 - }, - { - "name" : "minecraft:stonebrick", - "id" : 98 - }, - { - "name" : "minecraft:stonecutter", - "id" : 245 - }, - { - "name" : "minecraft:stonecutter_block", - "id" : -197 - }, - { - "name" : "minecraft:stray_spawn_egg", - "id" : 462 - }, - { - "name" : "minecraft:strider_spawn_egg", - "id" : 495 - }, - { - "name" : "minecraft:string", - "id" : 326 - }, - { - "name" : "minecraft:stripped_acacia_log", - "id" : -8 - }, - { - "name" : "minecraft:stripped_birch_log", - "id" : -6 - }, - { - "name" : "minecraft:stripped_crimson_hyphae", - "id" : -300 - }, - { - "name" : "minecraft:stripped_crimson_stem", - "id" : -240 - }, - { - "name" : "minecraft:stripped_dark_oak_log", - "id" : -9 - }, - { - "name" : "minecraft:stripped_jungle_log", - "id" : -7 - }, - { - "name" : "minecraft:stripped_oak_log", - "id" : -10 - }, - { - "name" : "minecraft:stripped_spruce_log", - "id" : -5 - }, - { - "name" : "minecraft:stripped_warped_hyphae", - "id" : -301 - }, - { - "name" : "minecraft:stripped_warped_stem", - "id" : -241 - }, - { - "name" : "minecraft:structure_block", - "id" : 252 - }, - { - "name" : "minecraft:structure_void", - "id" : 217 - }, - { - "name" : "minecraft:sugar", - "id" : 416 - }, - { - "name" : "minecraft:sugar_cane", - "id" : 385 - }, - { - "name" : "minecraft:suspicious_stew", - "id" : 589 - }, - { - "name" : "minecraft:sweet_berries", - "id" : 287 - }, - { - "name" : "minecraft:sweet_berry_bush", - "id" : -207 - }, - { - "name" : "minecraft:tallgrass", - "id" : 31 - }, - { - "name" : "minecraft:target", - "id" : -239 - }, - { - "name" : "minecraft:tinted_glass", - "id" : -334 - }, - { - "name" : "minecraft:tnt", - "id" : 46 - }, - { - "name" : "minecraft:tnt_minecart", - "id" : 525 - }, - { - "name" : "minecraft:torch", - "id" : 50 - }, - { - "name" : "minecraft:totem_of_undying", - "id" : 568 - }, - { - "name" : "minecraft:trapdoor", - "id" : 96 - }, - { - "name" : "minecraft:trapped_chest", - "id" : 146 - }, - { - "name" : "minecraft:trident", - "id" : 546 - }, - { - "name" : "minecraft:tripwire", - "id" : 132 - }, - { - "name" : "minecraft:tripwire_hook", - "id" : 131 - }, - { - "name" : "minecraft:tropical_fish", - "id" : 266 - }, - { - "name" : "minecraft:tropical_fish_bucket", - "id" : 366 - }, - { - "name" : "minecraft:tropical_fish_spawn_egg", - "id" : 479 - }, - { - "name" : "minecraft:tuff", - "id" : -333 - }, - { - "name" : "minecraft:turtle_egg", - "id" : -159 - }, - { - "name" : "minecraft:turtle_helmet", - "id" : 573 - }, - { - "name" : "minecraft:turtle_spawn_egg", - "id" : 485 - }, - { - "name" : "minecraft:twisting_vines", - "id" : -287 - }, - { - "name" : "minecraft:underwater_torch", - "id" : 239 - }, - { - "name" : "minecraft:undyed_shulker_box", - "id" : 205 - }, - { - "name" : "minecraft:unknown", - "id" : -305 - }, - { - "name" : "minecraft:unlit_redstone_torch", - "id" : 75 - }, - { - "name" : "minecraft:unpowered_comparator", - "id" : 149 - }, - { - "name" : "minecraft:unpowered_repeater", - "id" : 93 - }, - { - "name" : "minecraft:vex_spawn_egg", - "id" : 476 - }, - { - "name" : "minecraft:villager_spawn_egg", - "id" : 449 - }, - { - "name" : "minecraft:vindicator_spawn_egg", - "id" : 474 - }, - { - "name" : "minecraft:vine", - "id" : 106 - }, - { - "name" : "minecraft:wall_banner", - "id" : 177 - }, - { - "name" : "minecraft:wall_sign", - "id" : 68 - }, - { - "name" : "minecraft:wandering_trader_spawn_egg", - "id" : 492 - }, - { - "name" : "minecraft:warped_button", - "id" : -261 - }, - { - "name" : "minecraft:warped_door", - "id" : 615 - }, - { - "name" : "minecraft:warped_double_slab", - "id" : -267 - }, - { - "name" : "minecraft:warped_fence", - "id" : -257 - }, - { - "name" : "minecraft:warped_fence_gate", - "id" : -259 - }, - { - "name" : "minecraft:warped_fungus", - "id" : -229 - }, - { - "name" : "minecraft:warped_fungus_on_a_stick", - "id" : 616 - }, - { - "name" : "minecraft:warped_hyphae", - "id" : -298 - }, - { - "name" : "minecraft:warped_nylium", - "id" : -233 - }, - { - "name" : "minecraft:warped_planks", - "id" : -243 - }, - { - "name" : "minecraft:warped_pressure_plate", - "id" : -263 - }, - { - "name" : "minecraft:warped_roots", - "id" : -224 - }, - { - "name" : "minecraft:warped_sign", - "id" : 613 - }, - { - "name" : "minecraft:warped_slab", - "id" : -265 - }, - { - "name" : "minecraft:warped_stairs", - "id" : -255 - }, - { - "name" : "minecraft:warped_standing_sign", - "id" : -251 - }, - { - "name" : "minecraft:warped_stem", - "id" : -226 - }, - { - "name" : "minecraft:warped_trapdoor", - "id" : -247 - }, - { - "name" : "minecraft:warped_wall_sign", - "id" : -253 - }, - { - "name" : "minecraft:warped_wart_block", - "id" : -227 - }, - { - "name" : "minecraft:water", - "id" : 9 - }, - { - "name" : "minecraft:water_bucket", - "id" : 362 - }, - { - "name" : "minecraft:waterlily", - "id" : 111 - }, - { - "name" : "minecraft:waxed_copper", - "id" : -344 - }, - { - "name" : "minecraft:waxed_cut_copper", - "id" : -351 - }, - { - "name" : "minecraft:waxed_cut_copper_slab", - "id" : -365 - }, - { - "name" : "minecraft:waxed_cut_copper_stairs", - "id" : -358 - }, - { - "name" : "minecraft:waxed_double_cut_copper_slab", - "id" : -372 - }, - { - "name" : "minecraft:waxed_exposed_copper", - "id" : -345 - }, - { - "name" : "minecraft:waxed_exposed_cut_copper", - "id" : -352 - }, - { - "name" : "minecraft:waxed_exposed_cut_copper_slab", - "id" : -366 - }, - { - "name" : "minecraft:waxed_exposed_cut_copper_stairs", - "id" : -359 - }, - { - "name" : "minecraft:waxed_exposed_double_cut_copper_slab", - "id" : -373 - }, - { - "name" : "minecraft:waxed_oxidized_copper", - "id" : -446 - }, - { - "name" : "minecraft:waxed_oxidized_cut_copper", - "id" : -447 - }, - { - "name" : "minecraft:waxed_oxidized_cut_copper_slab", - "id" : -449 - }, - { - "name" : "minecraft:waxed_oxidized_cut_copper_stairs", - "id" : -448 - }, - { - "name" : "minecraft:waxed_oxidized_double_cut_copper_slab", - "id" : -450 - }, - { - "name" : "minecraft:waxed_weathered_copper", - "id" : -346 - }, - { - "name" : "minecraft:waxed_weathered_cut_copper", - "id" : -353 - }, - { - "name" : "minecraft:waxed_weathered_cut_copper_slab", - "id" : -367 - }, - { - "name" : "minecraft:waxed_weathered_cut_copper_stairs", - "id" : -360 - }, - { - "name" : "minecraft:waxed_weathered_double_cut_copper_slab", - "id" : -374 - }, - { - "name" : "minecraft:weathered_copper", - "id" : -342 - }, - { - "name" : "minecraft:weathered_cut_copper", - "id" : -349 - }, - { - "name" : "minecraft:weathered_cut_copper_slab", - "id" : -363 - }, - { - "name" : "minecraft:weathered_cut_copper_stairs", - "id" : -356 - }, - { - "name" : "minecraft:weathered_double_cut_copper_slab", - "id" : -370 - }, - { - "name" : "minecraft:web", - "id" : 30 - }, - { - "name" : "minecraft:weeping_vines", - "id" : -231 - }, - { - "name" : "minecraft:wheat", - "id" : 334 - }, - { - "name" : "minecraft:wheat_seeds", - "id" : 291 - }, - { - "name" : "minecraft:white_dye", - "id" : 410 - }, - { - "name" : "minecraft:white_glazed_terracotta", - "id" : 220 - }, - { - "name" : "minecraft:witch_spawn_egg", - "id" : 452 - }, - { - "name" : "minecraft:wither_rose", - "id" : -216 - }, - { - "name" : "minecraft:wither_skeleton_spawn_egg", - "id" : 464 - }, - { - "name" : "minecraft:wolf_spawn_egg", - "id" : 439 - }, - { - "name" : "minecraft:wood", - "id" : -212 - }, - { - "name" : "minecraft:wooden_axe", - "id" : 311 - }, - { - "name" : "minecraft:wooden_button", - "id" : 143 - }, - { - "name" : "minecraft:wooden_door", - "id" : 359 - }, - { - "name" : "minecraft:wooden_hoe", - "id" : 329 - }, - { - "name" : "minecraft:wooden_pickaxe", - "id" : 310 - }, - { - "name" : "minecraft:wooden_pressure_plate", - "id" : 72 - }, - { - "name" : "minecraft:wooden_shovel", - "id" : 309 - }, - { - "name" : "minecraft:wooden_slab", - "id" : 158 - }, - { - "name" : "minecraft:wooden_sword", - "id" : 308 - }, - { - "name" : "minecraft:wool", - "id" : 35 - }, - { - "name" : "minecraft:writable_book", - "id" : 510 - }, - { - "name" : "minecraft:written_book", - "id" : 511 - }, - { - "name" : "minecraft:yellow_dye", - "id" : 406 - }, - { - "name" : "minecraft:yellow_flower", - "id" : 37 - }, - { - "name" : "minecraft:yellow_glazed_terracotta", - "id" : 224 - }, - { - "name" : "minecraft:zoglin_spawn_egg", - "id" : 498 - }, - { - "name" : "minecraft:zombie_horse_spawn_egg", - "id" : 468 - }, - { - "name" : "minecraft:zombie_pigman_spawn_egg", - "id" : 448 - }, - { - "name" : "minecraft:zombie_spawn_egg", - "id" : 447 - }, - { - "name" : "minecraft:zombie_villager_spawn_egg", - "id" : 477 - } -] \ No newline at end of file diff --git a/pom.xml b/pom.xml index 43baad6ea..dd4a6b020 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.geysermc geyser-parent - 1.4.2-SNAPSHOT + 1.4.3-SNAPSHOT pom Geyser Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers. @@ -15,8 +15,8 @@ Geyser UTF-8 UTF-8 - 1.8 - 1.8 + 16 + 16 @@ -37,6 +37,14 @@ connector + + + + apache.snapshots + https://repository.apache.org/snapshots/ + + + jitpack.io From 02ac69591f242fcf556a2b004a0dd6df92d5083f Mon Sep 17 00:00:00 2001 From: Tim203 Date: Fri, 10 Sep 2021 20:46:58 +0200 Subject: [PATCH 589/766] Should fix deploying --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index dd4a6b020..ee2b90b56 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,11 @@ + + + apache.snapshots + https://repository.apache.org/snapshots/ + jitpack.io https://jitpack.io From 9136e4b5917cf5ffe081f4fac80ac5afc6d4060c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 14:53:02 -0400 Subject: [PATCH 590/766] Remove deploying for now; fix LecternHasBookMap offset issue --- Jenkinsfile | 4 ++-- .../connector/utils/collections/LecternHasBookMap.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b77fa9c4..325fb977b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - stage ('Deploy') { + /*stage ('Deploy') { when { branch "master" } @@ -48,7 +48,7 @@ pipeline { serverId: "opencollab-artifactory" ) } - } + }*/ } post { diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java b/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java index 3252963e4..f6371af8d 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java +++ b/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java @@ -45,7 +45,7 @@ public class LecternHasBookMap extends FixedInt2BooleanMap { WorldManager worldManager = session.getConnector().getWorldManager(); int offset = blockState - this.start; - if (offset < 0 || offset > this.value.length) { + if (offset < 0 || offset >= this.value.length) { // Block state is out of bounds of this map - lectern has been destroyed, if it existed if (!worldManager.shouldExpectLecternHandled()) { session.getLecternCache().remove(position); From f32e4725b83ef819231d4e92b44174158c591048 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 15:03:43 -0400 Subject: [PATCH 591/766] Update world border in constructor Prevents us from thinking the player is in the border before we get the packet. --- .../geysermc/connector/network/session/cache/WorldBorder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java index d3f8362d7..202be421c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java @@ -108,6 +108,8 @@ public class WorldBorder { public WorldBorder(GeyserSession session) { this.session = session; + // Initialize all min/max/warning variables + update(); } /** From b69cc8eba5ccfbcb42306afdec9efc80c15d47e6 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 16:31:36 -0400 Subject: [PATCH 592/766] Remove 1.17.10 from supported Bedrock versions in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce786545a..a07af9ef1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,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.17.0 - 1.17.11 and Minecraft Java 1.17.1. +### Currently supporting Minecraft Bedrock 1.17.10 - 1.17.11 and Minecraft Java 1.17.1. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. From 3632ebda8b61735f95f6b0b822411285260adbe7 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 16:32:09 -0400 Subject: [PATCH 593/766] Prevent concurrency issues with SkinProvider#requestedSkins There is a small potential here to return null if containsKey runs before remove and then get is called. --- .../main/java/org/geysermc/connector/skin/SkinProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java index 4b97ba5fb..ed18f2c22 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java @@ -163,7 +163,11 @@ public class SkinProvider { public static CompletableFuture requestSkin(UUID playerId, String textureUrl, boolean newThread) { if (textureUrl == null || textureUrl.isEmpty()) return CompletableFuture.completedFuture(EMPTY_SKIN); - if (requestedSkins.containsKey(textureUrl)) return requestedSkins.get(textureUrl); // already requested + CompletableFuture requestedSkin = requestedSkins.get(textureUrl); + if (requestedSkin != null) { + // already requested + return requestedSkin; + } Skin cachedSkin = getCachedSkin(textureUrl); if (cachedSkin != null) { From c763939452a6c9b27e37b6c20f61eb53b804ba0a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 16:36:56 -0400 Subject: [PATCH 594/766] Use set for sticky pistons --- .../network/translators/world/block/BlockStateValues.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java index bf62b83aa..78470e3e1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java @@ -49,7 +49,7 @@ public class BlockStateValues { private static final LecternHasBookMap LECTERN_BOOK_STATES = new LecternHasBookMap(); private static final Int2IntMap NOTEBLOCK_PITCHES = new FixedInt2IntMap(); private static final Int2BooleanMap PISTON_VALUES = new Int2BooleanOpenHashMap(); - private static final Int2BooleanMap IS_STICKY_PISTON = new Int2BooleanOpenHashMap(); + private static final IntSet STICKY_PISTONS = new IntOpenHashSet(); private static final Object2IntMap PISTON_HEADS = new Object2IntOpenHashMap<>(); private static final Int2ObjectMap PISTON_ORIENTATION = new Int2ObjectOpenHashMap<>(); private static final IntSet ALL_PISTON_HEADS = new IntOpenHashSet(); @@ -132,7 +132,9 @@ public class BlockStateValues { } else { PISTON_VALUES.put(javaBlockState, javaId.contains("extended=true")); } - IS_STICKY_PISTON.put(javaBlockState, javaId.contains("sticky")); + if (javaId.contains("sticky")) { + STICKY_PISTONS.add(javaBlockState); + } PISTON_ORIENTATION.put(javaBlockState, getBlockDirection(javaId)); return; } else if (javaId.startsWith("minecraft:piston_head")) { @@ -255,7 +257,7 @@ public class BlockStateValues { } public static boolean isStickyPiston(int blockState) { - return IS_STICKY_PISTON.get(blockState); + return STICKY_PISTONS.contains(blockState); } public static boolean isPistonHead(int state) { From 4196402105901f903a89edd8e99e55b9d2cde7d4 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 21:12:12 -0400 Subject: [PATCH 595/766] Indicate when the en_US jar has finished downloading --- .../src/main/java/org/geysermc/connector/utils/LocaleUtils.java | 2 ++ connector/src/main/resources/languages | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java index 533e95d4a..5423ada60 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java @@ -276,6 +276,8 @@ public class LocaleUtils { // Delete the nolonger needed client/server jar Files.delete(tmpFilePath); + + GeyserConnector.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us.done")); } catch (Exception e) { GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.en_us"), e); } diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index 3221de4b3..1138a6462 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit 3221de4b3a7f952638c6256d4e248b7f308d8c24 +Subproject commit 1138a64627dec66fdb7f33c922ff6cd5636ec30a From 4ecdcbb7c3fea0f0b1f3fd960bd69dd6aad9ffa0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Sep 2021 21:18:24 -0400 Subject: [PATCH 596/766] Preface Spigot injector messages with a warning --- .../java/org/geysermc/platform/spigot/GeyserSpigotInjector.java | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java index 5b6e259f5..fcf4b2eaf 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java @@ -147,6 +147,7 @@ public class GeyserSpigotInjector extends GeyserInjector { break; } catch (Exception e) { if (bootstrap.getGeyserConfig().isDebugMode()) { + bootstrap.getGeyserLogger().debug("The handler " + name + " isn't a ChannelInitializer. THIS ERROR IS SAFE TO IGNORE!"); e.printStackTrace(); } } From e13643d0404ba8bf11d2b699e5af1f81960890bd Mon Sep 17 00:00:00 2001 From: TheFloyds4240 <80289503+TheFloyds4240@users.noreply.github.com> Date: Sun, 12 Sep 2021 15:32:58 -0400 Subject: [PATCH 597/766] Update config.yml (#2522) --- connector/src/main/resources/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 7936425a3..04976adae 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -59,7 +59,6 @@ remote: forward-hostname: false # Allows the overworld world height to be extended from 0 - 255 to -64 - 319. This option cannot be changed during a reload. -# 1.17.0-1.17.2 Bedrock clients cannot connect with this option enabled. # Performance issues and/or additional bugs may occur for Bedrock clients as this is an experimental toggle on their end. extended-world-height: false From 0537c04ef6c5596fdfcee42944ca2c57cd122645 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 14 Sep 2021 11:18:26 -0400 Subject: [PATCH 598/766] Handle invalid enchantment NBT Fixes #2117 --- .../item/translators/nbt/EnchantmentTranslator.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java index 6d7ab4de6..b5807a7f4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java @@ -43,9 +43,9 @@ public class EnchantmentTranslator extends NbtItemStackTranslator { @Override public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { List newTags = new ArrayList<>(); - if (itemTag.contains("Enchantments")) { - ListTag enchantmentTag = itemTag.get("Enchantments"); - for (Tag tag : enchantmentTag.getValue()) { + Tag enchantmentTag = itemTag.get("Enchantments"); + if (enchantmentTag instanceof ListTag listTag) { + for (Tag tag : listTag.getValue()) { if (!(tag instanceof CompoundTag)) continue; CompoundTag bedrockTag = remapEnchantment((CompoundTag) tag); @@ -53,9 +53,9 @@ public class EnchantmentTranslator extends NbtItemStackTranslator { } itemTag.remove("Enchantments"); } - if (itemTag.contains("StoredEnchantments")) { - ListTag enchantmentTag = itemTag.get("StoredEnchantments"); - for (Tag tag : enchantmentTag.getValue()) { + enchantmentTag = itemTag.get("StoredEnchantments"); + if (enchantmentTag instanceof ListTag listTag) { + for (Tag tag : listTag.getValue()) { if (!(tag instanceof CompoundTag)) continue; CompoundTag bedrockTag = remapEnchantment((CompoundTag) tag); From 4b05b74a9aea01c4c2e6ca5c6364b344f935b205 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 17 Sep 2021 22:04:29 -0400 Subject: [PATCH 599/766] Velocity: only initialize injector on Minecraft listener bound --- .../velocity/GeyserVelocityPlugin.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java index 0802d07c2..f53eee8d1 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java @@ -31,6 +31,7 @@ import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.proxy.ListenerBoundEvent; import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; +import com.velocitypowered.api.network.ListenerType; import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; @@ -86,7 +87,8 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { if (!configFolder.toFile().exists()) //noinspection ResultOfMethodCallIgnored configFolder.toFile().mkdirs(); - File configFile = FileUtils.fileOrCopiedFromResource(configFolder.resolve("config.yml").toFile(), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); + File configFile = FileUtils.fileOrCopiedFromResource(configFolder.resolve("config.yml").toFile(), + "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserVelocityConfiguration.class); } catch (IOException ex) { logger.warn(LanguageUtils.getLocaleStringLog("geyser.config.failed"), ex); @@ -116,13 +118,15 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { try { // Should only exist on 1.0 Class.forName("org.geysermc.floodgate.FloodgateAPI"); - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); + geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", + "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); return; } catch (ClassNotFoundException ignored) { } - if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && !proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); + if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) { + geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; } else if (geyserConfig.isAutoconfiguredRemote() && proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) { // Floodgate installed means that the user wants Floodgate authentication @@ -188,8 +192,10 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { @Subscribe public void onProxyBound(ListenerBoundEvent event) { - // After this bound, we know that the channel initializer cannot change without it being ineffective for Velocity, too - geyserInjector.initializeLocalChannel(this); + if (event.getListenerType() == ListenerType.MINECRAFT && geyserInjector != null) { + // After this bound, we know that the channel initializer cannot change without it being ineffective for Velocity, too + geyserInjector.initializeLocalChannel(this); + } } @Override From 58e00b264597979b4ca9711fee1f30438811b965 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 18 Sep 2021 10:35:49 -0400 Subject: [PATCH 600/766] Add more sanity checks for shulker boxes Also properly implements reading byte tags from Java Edition. --- .../geysermc/connector/entity/FireworkEntity.java | 8 ++++---- .../item/translators/nbt/FireworkBaseTranslator.java | 12 ++++++------ .../translators/nbt/FireworkRocketTranslator.java | 4 ++-- .../translators/nbt/ShulkerBoxItemTranslator.java | 8 +++++--- .../java/org/geysermc/connector/utils/MathUtils.java | 12 ++++-------- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java index 42c98703b..9de2102d5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java @@ -81,7 +81,7 @@ public class FireworkEntity extends Entity { NbtMapBuilder fireworksBuilder = NbtMap.builder(); if (fireworks.get("Flight") != null) { - fireworksBuilder.putByte("Flight", MathUtils.convertByte(fireworks.get("Flight").getValue())); + fireworksBuilder.putByte("Flight", MathUtils.getNbtByte(fireworks.get("Flight").getValue())); } List explosions = new ArrayList<>(); @@ -91,7 +91,7 @@ public class FireworkEntity extends Entity { NbtMapBuilder effectBuilder = NbtMap.builder(); if (effectData.get("Type") != null) { - effectBuilder.putByte("FireworkType", MathUtils.convertByte(effectData.get("Type").getValue())); + effectBuilder.putByte("FireworkType", MathUtils.getNbtByte(effectData.get("Type").getValue())); } if (effectData.get("Colors") != null) { @@ -119,11 +119,11 @@ public class FireworkEntity extends Entity { } if (effectData.get("Trail") != null) { - effectBuilder.putByte("FireworkTrail", MathUtils.convertByte(effectData.get("Trail").getValue())); + effectBuilder.putByte("FireworkTrail", MathUtils.getNbtByte(effectData.get("Trail").getValue())); } if (effectData.get("Flicker") != null) { - effectBuilder.putByte("FireworkFlicker", MathUtils.convertByte(effectData.get("Flicker").getValue())); + effectBuilder.putByte("FireworkFlicker", MathUtils.getNbtByte(effectData.get("Flicker").getValue())); } explosions.add(effectBuilder.build()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java index 99fe7c813..b61448d81 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java @@ -42,7 +42,7 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { CompoundTag newExplosionData = new CompoundTag(newName); if (explosion.get("Type") != null) { - newExplosionData.put(new ByteTag("FireworkType", MathUtils.convertByte(explosion.get("Type").getValue()))); + newExplosionData.put(new ByteTag("FireworkType", MathUtils.getNbtByte(explosion.get("Type").getValue()))); } if (explosion.get("Colors") != null) { @@ -70,11 +70,11 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { } if (explosion.get("Trail") != null) { - newExplosionData.put(new ByteTag("FireworkTrail", MathUtils.convertByte(explosion.get("Trail").getValue()))); + newExplosionData.put(new ByteTag("FireworkTrail", MathUtils.getNbtByte(explosion.get("Trail").getValue()))); } if (explosion.get("Flicker") != null) { - newExplosionData.put(new ByteTag("FireworkFlicker", MathUtils.convertByte(explosion.get("Flicker").getValue()))); + newExplosionData.put(new ByteTag("FireworkFlicker", MathUtils.getNbtByte(explosion.get("Flicker").getValue()))); } return newExplosionData; @@ -84,7 +84,7 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { CompoundTag newExplosionData = new CompoundTag(newName); if (explosion.get("FireworkType") != null) { - newExplosionData.put(new ByteTag("Type", MathUtils.convertByte(explosion.get("FireworkType").getValue()))); + newExplosionData.put(new ByteTag("Type", MathUtils.getNbtByte(explosion.get("FireworkType").getValue()))); } if (explosion.get("FireworkColor") != null) { @@ -112,11 +112,11 @@ public abstract class FireworkBaseTranslator extends NbtItemStackTranslator { } if (explosion.get("FireworkTrail") != null) { - newExplosionData.put(new ByteTag("Trail", MathUtils.convertByte(explosion.get("FireworkTrail").getValue()))); + newExplosionData.put(new ByteTag("Trail", MathUtils.getNbtByte(explosion.get("FireworkTrail").getValue()))); } if (explosion.get("FireworkFlicker") != null) { - newExplosionData.put(new ByteTag("Flicker", MathUtils.convertByte(explosion.get("FireworkFlicker").getValue()))); + newExplosionData.put(new ByteTag("Flicker", MathUtils.getNbtByte(explosion.get("FireworkFlicker").getValue()))); } return newExplosionData; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java index 0d37f0477..1ce94c5b0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java @@ -45,7 +45,7 @@ public class FireworkRocketTranslator extends FireworkBaseTranslator { } if (fireworks.get("Flight") != null) { - fireworks.put(new ByteTag("Flight", MathUtils.convertByte(fireworks.get("Flight").getValue()))); + fireworks.put(new ByteTag("Flight", MathUtils.getNbtByte(fireworks.get("Flight").getValue()))); } ListTag explosions = fireworks.get("Explosions"); @@ -69,7 +69,7 @@ public class FireworkRocketTranslator extends FireworkBaseTranslator { } if (fireworks.contains("Flight")) { - fireworks.put(new ByteTag("Flight", MathUtils.convertByte(fireworks.get("Flight").getValue()))); + fireworks.put(new ByteTag("Flight", MathUtils.getNbtByte(fireworks.get("Flight").getValue()))); } ListTag explosions = fireworks.get("Explosions"); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java index 5f39d3a68..7c737ba13 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java @@ -25,11 +25,13 @@ package org.geysermc.connector.network.translators.item.translators.nbt; +import com.github.steveice10.mc.protocol.data.game.Identifier; import com.github.steveice10.opennbt.tag.builtin.*; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.network.translators.item.*; import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.connector.utils.MathUtils; @ItemRemapper public class ShulkerBoxItemTranslator extends NbtItemStackTranslator { @@ -44,14 +46,14 @@ public class ShulkerBoxItemTranslator extends NbtItemStackTranslator { for (Tag item : (ListTag) blockEntityTag.get("Items")) { CompoundTag itemData = (CompoundTag) item; // Information about the item CompoundTag boxItemTag = new CompoundTag(""); // Final item tag to add to the list - boxItemTag.put(new ByteTag("Slot", ((ByteTag) itemData.get("Slot")).getValue())); + boxItemTag.put(new ByteTag("Slot", (byte) (MathUtils.getNbtByte(itemData.get("Slot").getValue()) & 255))); boxItemTag.put(new ByteTag("WasPickedUp", (byte) 0)); // ??? - ItemMapping boxMapping = session.getItemMappings().getMapping(((StringTag) itemData.get("id")).getValue()); + ItemMapping boxMapping = session.getItemMappings().getMapping(Identifier.formalize(((StringTag) itemData.get("id")).getValue())); boxItemTag.put(new StringTag("Name", boxMapping.getBedrockIdentifier())); boxItemTag.put(new ShortTag("Damage", (short) boxMapping.getBedrockData())); - boxItemTag.put(new ByteTag("Count", ((ByteTag) itemData.get("Count")).getValue())); + boxItemTag.put(new ByteTag("Count", MathUtils.getNbtByte(itemData.get("Count").getValue()))); // Only the display name is what we have interest in, so just translate that if relevant CompoundTag displayTag = itemData.get("tag"); if (displayTag == null && boxMapping.hasTranslation()) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java b/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java index 4896e54ce..927f72202 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java @@ -85,18 +85,14 @@ public class MathUtils { } /** - * Converts the given object from an int or byte to byte. - * This is used for NBT data that might be either an int - * or byte and bedrock only takes it as an byte + * Ensures the resulting object is a byte. Java Edition does not care whether a byte is encoded as an integer or not; + * it converts it into a byte anyway. * * @param value The value to convert * @return The converted byte */ - public static Byte convertByte(Object value) { - if (value instanceof Integer) { - return ((Integer) value).byteValue(); - } - return (Byte) value; + public static byte getNbtByte(Object value) { + return ((Number) value).byteValue(); } /** From fdca9f9be675b73ea3da633f4cd188b4c88d8b8a Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sun, 19 Sep 2021 14:20:42 -0500 Subject: [PATCH 601/766] Add support for 1.17.30 (v465) --- connector/pom.xml | 4 +- .../connector/network/BedrockProtocol.java | 2 + .../populator/BlockRegistryPopulator.java | 24 +- .../populator/ItemRegistryPopulator.java | 5 +- .../bedrock/block_palette.1_17_30.nbt | Bin 0 -> 41709 bytes .../bedrock/creative_items.1_17_30.json | 5207 +++++++++++++++++ .../bedrock/runtime_item_states.1_17_30.json | 4306 ++++++++++++++ 7 files changed, 9533 insertions(+), 15 deletions(-) create mode 100644 connector/src/main/resources/bedrock/block_palette.1_17_30.nbt create mode 100644 connector/src/main/resources/bedrock/creative_items.1_17_30.json create mode 100644 connector/src/main/resources/bedrock/runtime_item_states.1_17_30.json diff --git a/connector/pom.xml b/connector/pom.xml index 0a15c759d..845cd334a 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -114,8 +114,8 @@ com.github.CloudburstMC.Protocol - bedrock-v448 - 6b48673 + bedrock-v465 + v1.17.30-d29a058370-1 compile diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java index 3efb7a849..b7694c672 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java @@ -27,6 +27,7 @@ package org.geysermc.connector.network; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; +import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; import java.util.ArrayList; import java.util.List; @@ -50,6 +51,7 @@ public class BedrockProtocol { SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder() .minecraftVersion("1.17.10/1.17.11") .build()); + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC); } /** diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index bdf4c3538..6d54375f1 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -29,11 +29,13 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; import com.nukkitx.nbt.*; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; +import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectIntPair; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.network.translators.world.chunk.BlockStorage; @@ -58,17 +60,15 @@ import java.util.zip.GZIPInputStream; * Populates the block registries. */ public class BlockRegistryPopulator { - private static final ImmutableMap> STATE_MAPPER; - - private static final Object2IntMap PALETTE_VERSIONS; + private static final ImmutableMap, BiFunction> BLOCK_MAPPERS; + private static final BiFunction EMPTY_MAPPER = (bedrockIdentifier, statesBuilder) -> null; static { - ImmutableMap.Builder> stateMapperBuilder = ImmutableMap.>builder() - .put("1_17_10", (bedrockIdentifier, statesBuilder) -> null); - STATE_MAPPER = stateMapperBuilder.build(); + ImmutableMap.Builder, BiFunction> stateMapperBuilder = ImmutableMap., BiFunction>builder() + .put(ObjectIntPair.of("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion()), EMPTY_MAPPER) + .put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER); - PALETTE_VERSIONS = new Object2IntOpenHashMap<>(); - PALETTE_VERSIONS.put("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion()); + BLOCK_MAPPERS = stateMapperBuilder.build(); } /** @@ -84,8 +84,8 @@ public class BlockRegistryPopulator { } private static void registerBedrockBlocks() { - for (Map.Entry> palette : STATE_MAPPER.entrySet()) { - InputStream stream = FileUtils.getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey())); + for (Map.Entry, BiFunction> palette : BLOCK_MAPPERS.entrySet()) { + InputStream stream = FileUtils.getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key())); NbtList blocksTag; try (NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { NbtMap blockPalette = (NbtMap) nbtInputStream.readTag(); @@ -116,7 +116,7 @@ public class BlockRegistryPopulator { int movingBlockRuntimeId = -1; Iterator> blocksIterator = BLOCKS_JSON.fields(); - BiFunction stateMapper = STATE_MAPPER.getOrDefault(palette.getKey(), (i, s) -> null); + BiFunction stateMapper = BLOCK_MAPPERS.getOrDefault(palette.getKey(), EMPTY_MAPPER); int[] javaToBedrockBlocks = new int[BLOCKS_JSON.size()]; @@ -199,7 +199,7 @@ public class BlockRegistryPopulator { } builder.bedrockBlockStates(blocksTag); - BlockRegistries.BLOCKS.register(PALETTE_VERSIONS.getInt(palette.getKey()), builder.blockStateVersion(stateVersion) + BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion) .emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) .javaToBedrockBlocks(javaToBedrockBlocks) .javaIdentifierToBedrockTag(javaIdentifierToBedrockTag) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 6657442e9..f03826458 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -36,6 +36,7 @@ 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.v448.Bedrock_v448; +import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -68,6 +69,8 @@ public class ItemRegistryPopulator { } else { PALETTE_VERSIONS.put("1_17_10", new PaletteVersion(Bedrock_v448.V448_CODEC.getProtocolVersion(), Collections.emptyMap())); } + + PALETTE_VERSIONS.put("1_17_30", new PaletteVersion(Bedrock_v465.V465_CODEC.getProtocolVersion(), Collections.emptyMap())); } @Getter @@ -84,7 +87,7 @@ public class ItemRegistryPopulator { // Load item mappings from Java Edition to Bedrock Edition InputStream stream = FileUtils.getResource("mappings/items.json"); - TypeReference> mappingItemsType = new TypeReference>() { }; + TypeReference> mappingItemsType = new TypeReference<>() { }; Map items; try { diff --git a/connector/src/main/resources/bedrock/block_palette.1_17_30.nbt b/connector/src/main/resources/bedrock/block_palette.1_17_30.nbt new file mode 100644 index 0000000000000000000000000000000000000000..fde145ca5239cc9a74e13b2a4a2ac77fca4971f0 GIT binary patch literal 41709 zcmeGES6oy<^EQgABt;O(QPe?DvO~_O1eGWtIp-ibXGD-R0|E*R89@-qIR{AtNX`sH zlALppynFQhe&>JoIs0PYyx+~o#hO~xwT9{Ls_v(r>Y4kno7evS;V;y~V$o_PS+AM6 zU5ZU)W7%hNf2n>y)$#Pqsay)? z#?+(EkF8^S!mK?TrmTN0;$^&Cm#^p?n;*!%NR?ApZO~iZU-c-amY3$78TRw?fF@I_ zilNCC9m~!dJ6CoUJ<1ENT+a8d65(&t;dr5rT(7=#K2TBsQcyS-y-B!W`ui~i1HSwJ z6a>b`*8`sHm*h>iA>b*~+LH4FFKe&F>hrJ`D&KjEcq$j{Elyqe7VGBkS$S$dwY$1W z>PE-B_4-@Y=T{Esec^~N`t?=@3#&=JA6LLf8rRc$hnryuIa1B_MIPP9BT_1>O%*E7eRIP2=Ll}e%GPA^Pi#Pavwo%xpZZm*to3N<3OAFrP?HKcAZ+(Wes zl_)x!q^@=NrZJq!y*#Rp*a#LXxxd=c5a~8z6_c*TUt?A7ra`%1$M=B$%xm4`V2_D2 z$Afy}4I$z00eQ?t26K72NdO(~`^bRJMHz9oLr36+fYa`o@x$1C-TNMHO1uRXW0b1Z zy1jN+8nM{#EA}_A%96j|OUw6YNG5u6&1P8z{~7uu`$oU3SmCv@WFmH;`g|Lx{$Nxs z7!?;#4G{pIO=icdgtRob-XCsMkXKonSC0a zJ8^ISd{H1J=2$(r^BaW3U5-^}e0?59{x(HaR$i8>8XHZ)Varsb;xdY<_Uv*tbf($MpRM{;b2KJcc};?eFU^Cw5h?_xMhK+wUlhpcB-#9!soyF?svqk<{@E@z(?O z{ff%YoClxDrZB2U4i0`;rONq_&A~0FpxUytq!o@$vE?%lpCn|p?a-!E3flQBX`XLNZ25S= zLsf54b~awLV0<}=UVX!f?-Q#~-+Wil9489WCzNU==I7p8c6lYf*hBmCW$u*2p@iCn zb=g(HQNU)7?_QsFL+!_ok3Fl26t0@HLxE` z%&!Ub74&tLeElO(>!rQZxw3dEzSZ0qUjWlzqdh38JA0}qojP?fcKWkz#Mw!+yCC+& zQ&cGbYMD!Bp%i^}i|E4Jr~WJ*dZ+Sf6~!qeckPPqmM%q|_^H5zGEqbxw&<|(HmS~S zpR~;B$L_+XltdYdV<;;nHqHor`@ZeVb?1H8m`_ZmxWx4DZr%5ud%3P!p1jC%pC;R9 zr@F5fX65>0uh?NQ*!*m!vJ3Wc5QVh7@4Mww_-5H@zKlrh__K$au6#MiFNH&|n7o|5 z5+YL3fxF2TAt_cNDX%5P8#uKV zrjk3oQjL?@`NHk&Q}V;4F5J0$d^tulcF~t4;>U4+q##k|rARf`5A<6eEeZEgF2A|@ zmWEWL`h2Itmpud%ZPvvRm3r`!YsQ<`9#33nnz&x$G+X!Rjo=D(nlPRymh*C&`TG_+ zczGd~J$QYOMYnW~4z%p7|L5fy-R!*A^_-<5d3G(f8M3Z9Z|!pN_a`9&;+?r!uf%kh z*2A4%%SrcfbeUed)^zy&($+^Gzqyy2osylc@b)cHA1g#Vc$xgGr@J0;PVlm-dA*Pq ztiG4^#od`ke6Z9=hLMaZ{Fc|d9s*&c`5dm+deLDdfzFnUHh7jnI) zeRWIpL5~UD?Q1=)#n<|IFhbMk^-Uv{Jc=9-dz_|G=9hP^lO3^}mL#3G?ZucLY~Pc4 zt`KyS>p3p*l(4hWGj2$Y+e+*ErHr%buXnE{gl>5Szqn>`$K?1<=7Vt|#u~RLIK)c} zrP7geMnZ+I%BV!?muK@!sfupl$EUMrepSpAhs_$J5$dON3>+JuH%r78&h4vLf_)o) z<;X{|+g{oH*-@OaraUcfcZl{8*?7m5g5RcX~}E zjJpaqt~cL_w!UHoik3&(zNW&B%Oi~?csHkFL5uKb!fcUM@r;zyu7=y2F9)6e+tWMrw4|28&iwK&adO6 z6f?X&ik{=FKX0bLe1G`BkjSsmGqPy2`tSthWneqfT(PXiZtVpGPyNbXk^-+OBaDP7 znjT|k$~$%umi*Twv7pAjVQ5R_7i1ZkAo6OwW%3Tm(bLL+K%2hJ_s8hx;C)A3>uR}7L?okUHTNKuSkrcRx7K~8WPE>^+&_|UNLn0%S|+GFLBle}KeS+5^LjSkzHYv*D0 zaXI_Khk7}^V|RgaMt&ocMU2rcXe7{b&vM=GACNU@>o6Qyr8}@XMu9_ zLN&S3)UTgRJHv114#o3nJi_n?b{~SIBi)_}GyJ*ixW{(mDN%#C9Ug49yJb5pEF;YPBCc9s_C%p--(Cn!ej1^STV{` z8nR;_YK1ehvc$O9$syQ~LO0jS_ZVTt_;+{$>h#;Q=w}X#x`mCKoh=5k&*DV;K*)-HC3tq}{hdrIc&fZ_+pa0;h5xEkT#}82V1_S_O_XJy9;Hz-XM}R= z2wXMF3k;BFMazQmp|e(8G2GUM{^<5HZZLt4HZ>guR>ZO)Sph$$7nP;WmlbqnH;4tBb_w~O0VYTyWejD zI*#aPPFQ{$sB|nvw`t%7)4bq|%e$$%v+woxP~W#SKNiL2*Um#-@BO(aY_ZK*@9mjE z#?+PJVSnm2b{_xr_2dtSy*i$SiJoY0p|03{DV0r3>}L2-P_V1N|1?UK?Q&x{;ad4t zZ=BO6ZW3q6=&d*J2EQJTDCM8tSKr1FR;bo#K4EU~dEijo;oG@9B(JB6%A2$<>31Ae z*VrT#zOAEgXr8&wy20k*^D()6dj#uux{|bRyZ3~EnVX-u{+H5RB;Fr`l)|i=&jJ`Ey>r%v*(w2&c4rU@RljRdD;IJjwv(uZx4zJ zG(MOL*k2#M`1V6vFQ0S2EwML!Pjf%bDn*@0EF!$}yw3MHn6lGDc2xQXp;MyFXNXFf zh~ZL|eCBJS*NIeCC66Uztx=3|VFaq-3FbJ!+L;RO5MTz<*{@Dv=Cgn1=ftdO# zx!nS$l5|RP=4oz0vj^x=iE8@KmY-zfp2$Dx;)vr=3X{w7Dae$ zJK-Qwu2xsYGOWu4y*|hoRj<5(Kj_{Yl%%ij)+G=9bP z#j978GA-G3Ly@$pp9RsJ^2R=C_{BdwTv-0nS?bA9K^&)Q&f8cYPW>F7uX4ir#y`U3 zP0?p0Ot2!{JN%dL*fqUX?Tc<1y!*87%xhmoY+(EYlJ`D9{yMEJx#0z^#oh6V`5G`l zL~?%z=nmrV09_RR8zA3*1C)5PB9^7*lz;e55%{ka;PbsLDwfy0tB^gk>!Z?tL9p3l@JxHjEUgWoz#P}?QI zi#p5DyfIl-auxL)y6G!x(*_w0NRl?Slc0nH-XqL(;nMDx$1v68@DG0}%;%BH_DJQA z%sJ1}(35)?yLf(Y$o-(L{_3eN=dT`~T2aOJE3`+KUt)R6jM#lM>(!RBWa@Uja3?d| ztEXSzNt<2|E{Ja`%&Ooa^fmh+*1f(I%xtDk#Pa>y+%&z~)gd4@?&?{quN$Q(E-&`% z9q}kgbK32tC&UeTC~fA>TO9jM5KHnm>k%sqGsxK!BiB6aC9f?t5no5(y~Ng}ccm#k zJ=I>=h71R9UYUqaq=tRmamZ4!hLZ_D50j5Ha$Ac~SUTS26c#zXJ|uT7$Zlxv#Tii_uTD9|7at_?&0{>5 zl>PG~b_Y+ZxvwlR_1!JMY{v7b*qz&`V;Pdt}=uHV5 z9cCSIhWDKwq%hq3l(H;tw?^Alp`pLzw5+_>PseJJ^29=cjORX>ZkLgHZwN*TTx!{8 z_Ih#i3i;;A(4p?vH(Bf2FTTo+9S8U>XKgcYohtNiPaedqp3?6eN>CTtU6Xp*bvH-# z^77=Yb0yEWj5But)nlsL=XFzrCD+rjjGbL$D~Wd^pYlTF<~R;{*ZDasmD+Kj>H9vm3%`rrabFIo1{W2~g#mNf zui9}(wN#zCf5*Byo!(6>DWJ;jsvMGcZCLTmyPBJB5?|b3weqU3VTldz+j%=IvZvVWJn z`V@(gUPj z6t;M7)tjOfnNZqA@oj0N76+&tfNEL?sI)18Y6j;=ePE6cfvOjd>KS&<5%b$k-nX0F z*%Qle$~n`l^lOGMPY@FabxDoM(`1QVs~&o)QlDzYU(K9|TpM%~dk6@>K7t26%PQDF zrE?vqEHNs2pc=XfRNgm$su-hsim@UDsw6C+I>D%3V62FNsty~dp8EsUTZ|P2P)*_h zRVYSfhOwe~HM4)R33!}@KD+7Dl>bea-sMV4!i%mv3%-3oJhee`vrv6)o;e}8g&_!dWYWprhQ#F`{brn0uNNyRT24B_b3xg)h)+%XUM@C2uF$T0-Ha?ZbE8zBYlOGrH(M9#z_ZyjUDTg!XVvI6R(=6EEPGx^SDCDrV$ z5HIw}abkw*V(+~WzEq#X+3b=vJ>wqA;a^isl45bc8q4TJlH<_2J^5FQb%vfPcE3iZ zrt8=_jgHA(IhO3ufdOJxMd|z8mp@dA>r;zl$_!CSE-x7qN+l0rOSM-;GCY}eCtI?4 zBt7w!qpa@7x!B<^WiDnC&{r`PGqU3sgu9B*zFnhK>-lP*e*e)|`D944|Kw}m%s@UD zPy2~@i3_>pp5eC4(n#UCXlm-d7f0?eGaaGBvwKVYTh>_|EJ^;|#BtqK&bW^4+D|i@ zHFxl)7#GJf-*LDotr9FKD652g{vK-n!0SWFizE>#A<{ekmDbY8(n!&zX6nSg7ndQj z<|ZPy_53THk(u0)!az&i_v|R73;dJYw$FD)W-hT2vbu5tSn;Gj`!5rPq=c}lKYJen zNmPK8-oL^C`G5axx9|8@SV({5juZr+IIj2Emiuk9w*t2>uR$YA^(QF^KhT378ZtR{ zGbxgSfAv5@(CqW~SLV$RcVc@w+$l=hbp(v}H9PJ*tis{uO{_byy?=YBBfv0E-9hhw zg3FpWu|Lal+?c?T62U@Yg)buHQ(02|&kdQJy0gH02I@cHNGU#HTliGtEsa+e`F!aH zO=8~%rw1HqQM&{tK#N@Bjuc;-16}>#_KaY2y!?(Q7{K883235-Jb2Flf-Qu63MBbf z`%i5?hI!2ndZ*v;9`lEOt(n|hDL9QkwT0#fsXOigEgXz(t0^}}GEU_+RDxr>-2hv5 z6LkljnRUC>8X1^^JEgpt1H-FL@jExmaDd&%Nibi3`>D+{Kd5PcvrLNn|IaKUrk>=} zV2gs$#_CzrkWXPs@!#-w&EQG+e?5uUOL#L?OVe=8A2=bR=yHFkd;{~`J^DpjyGul!WZ%-;tkm)ro|`h#C@=mQ+ZaKRq?0vOzw-dtYYQ3#0zr-=V;CaW1p_%vdFG|sFI`&5U5x3>#W~=%;2qJFx zSWh{8^$?_s8|+!*?^Kwpnr(ysbod(2Oh-wR(B|;9I+Tv`oC(+YUK;;b!9*R&ohN;5 zfdpK-k{wUSq*~#nx|01=Gg8=a9zDr%_hl(;qH;aSNr7!CY(gG=$zhFSDeOCy`jQ)u zF1viYU^i2K`f1vD5~frk-Aw%D7jNrB?4a_8v!#aT=F7Se|b0ZU)mG%Mb_BV4jYjp%OG^{jCoPIi2SsgR~66<({y^s{q0z zfp3P=3Uq_d0v_M7tl9;(D|8WEzAdoesfPKIiLJSZO!hjiiMk@)qxa$#)hLO0KhJYb zt;{u<+3N(Mbwv8vBD%ak!|-%Bs)Ej3%md^L%4VffSfM7Nt1`DWmud!$C?*QZ(r_AB z*$s+!Wp1N~JTh@OEA=cLZr7`8^(*hkP?QIs$=sgo^UZ8im}`Vo)(w7myrZv_pl1ns zUHHnTuq>_Ttk5F7u&n6Exq98Gy4EDwC9B##D?8{mdF4e6h48Q+@g{q^!OxHt!#nU$ zYSX3=gabYNCXGdNNcM9McnFnMOGp*DHx;qyXb7=CRx%Ya?_e0QVL&|h8d~l`{L42o^cv**_lO2(%3ElTOMb= zs302A#8+4aPZM9YfG*!mFcjIrzU;DQh2zCH`BB>j?mkOA*3Uv4h>X9z>~bZA2PZcB zY1;blz8U(%c}Dn@-u1-xz~+^;aP*%o=~R+hYyQ)3AyTyi-zC{5!^Id)R&5WMp|Y+S zilOQav_3M!4WOxYs~CvmgHtOiMikrNsj@y`<=};R1EJvgu!}Q&=3?ON4!&2cj7B%w z$=8n?m5nO4s^%^()n$g|B3S3P{W1f4W~qVH6<|*(vA2!LpUWd-?RsDlSDoxF@LWY@pG&mN@CtoA7cNOO-f?n(5sS} zJqTvX)e`k2I|wejY|*fr6LnW5lYb!1S$q0f+WL}U#=GqIVIc`fzj!-8;$jKltgaMF z2;jW`bw}T-n$XiGZA2ZtJLaqyI4IY7-P9$buGIk?4!8GI1tZI+&lAG>E8jmqnz zKk#ig&ha)xW4ceQt^XRtd7(v5;kRtdbM=KIb>)p$SBxIzJz?9ev`?8lzhGq;;c7l* zGDF}Qe?Z1RWwL_bHik$~JY}-2BQj18rhziqCy^Sb<7z>ftn(<1A;F1ICU**cv&MT! z$-Y@+9$za0!90nWilrhg_u)6IW=6L5EF$G9+YmnmClSAqRHS^LXt`%-j6VeTGPyPq zo3{nBbTjS!Y%wDZjZ`WP73ru#Nz$9mT0@9nnNO~&*P?~sff!wu1u>5r32*`8|C<$LaLb0 z<9<_sU=6?Gnz_bcM0r+tltn+4@+bwD4eA+%B^$13)I?$&>rvF2_K}GVYUO`h7Or94 zLNb4JU>G{k6|P}4`{HpdRrzojW6p2*Y}u4$ z!P959Y+5R8P+JauibD2SDuG~H*a(#@L1KG&n@u<)E|H6|oc5O|<4`7V#Qls9($ri` z7D)`4VdY}7j(lwVA}E22$sR`?8ThH(RBqv!J~A+z$4qY0z#JJEQE4W3z%va`Q$+?U z{_g4K>q4Xn*2VvJr6%R`=jWb!YJB7IzFCE~ncTvo>2Aj%cxYlrBFZiiI$->r%HxP@ z0AaN7wOt-c0&U5n@<8~jz(x8yn5F5hhRGO+psrz2!P>^)LNC(RffbPiY=ab_dj=Wc z*$#5>z^vvZ)$+9yv=7~s7e*IMV<=+dfe>{gNGz`g`;dEiT$0bpk13#h&4TM z4MAya&YA6o@K9T0(wU2`&mZD8-BKw^EE>gH z<@pmkTEHs5;E&tGw0BJcxOEY^8L7uCSn5S4e*#+zu*wthx&vD}abOD;_znJ+kl9=3 zaU*I}#9RSaCFq+Bmq#(=$Uv($2gLo$ve66Ncn*jOVjW_HL~%eY;M$-i&hhQyEh;7m_2hPRQRdUzGYA=6v=4!n}g=UzqPo{SEWVhJRtc z1oi|>m|sGSf)(go8z;;9Ct+gd=sHErB>?~)2|)b?=Do2^H5Ip)HG z6FME@ZJl=wxCJ;`Y&hsGDB4XMI@nIGAlbSSaiEEwHh(>aDY~+u~o5=bpq+fWC*JFJ)l&)*3^OD3qQWNFF@J zL$<<83?#b+h@=5HG?W~EKq)OrP;MwWi7y5Zp?}vJ^3z`d9ztW;7E;ut2M?jMLx%i~ zbm9L*ddR;>XNUfabd~=^I_zJhhyN$id8M(zGW`t|C~3?Wg-Z|oJAfcj{@Zh~Y=aRs zC$&riOFYldaR6Yf!@~lmi1#-I_25R#l=H5##HZ7a&?T zg$o24uVP5RY7lk^unkn(O=lN_ZLFBu$#(&^X$Amx0HXjCPksUvFJ209q=!rI#KLaU zFIFQWpJ%~tQZLm2C|Lo!Ni$y?@;(X)yGgrU7c%>G6c$3eTpyC=zXS`RS#JpW`TGbK zlHBTtvI9Ve^bcpQJSW5i_sX<#QwrN=8elhXVndY^&Y^q|CHPmSRVPxCU~TKJYz!Iy zN*ZisSAnwg+x_pmx|@zoVSeX~wRS~ob>{RjUOsPi^oKZ)g0e`dELLWduj?{lnpU;Z zA7cL$e0#r$WM#J2UydQG3qF(y(_RBGg(4AP5}!$R<=K=YR%Q_GxEHn4Zzl7(r_H4j2!(M4rd zK0X>+2lUcx?DjuMf!?}pu=!}$$TG?+p|}iea2gw~pq;>$O+kW<-3*_fB9}3i0wgXJ zh0L)OAX$fvQ^?*7l*l?^;)Vwz}IbT0Q$-y|8np|iyL1|#fo%<}Gi^Ut? z&a7Nh8mH%X&qhU8cG0c6_{AV6PcnMcjH?JG ziJJdT6$<)|xR9nM1sp}`1d}m_qi{_$k;8BlixkwPpxfM24~#J!MG)Fp4#QD+JHc=1 zZ6GIveZ934-6x8NccgsT1T8`z$`WcVbtq?0Xq5~X;iRzfniMn35>5`qWCn3on*NBo z?W1Wmu527jQyI)HOE}e+kSVP=-vg=qrQGs;$4n`~^v822_tICJ;OSd+nq@(nRm!0i!3CE|k=+CZt zekVMP+G-%XgIt7$TzvGK(pM~98gl-@EG7Q{9~yGu>1?In`vSZl_&{s03OD*yMmm#& zRgkvj+ere29%t_Gu%wPNy z`uANkY^AV!$IVh;wU7ctoW41v(N%-yUvKZ-PRwirnTyc{P=I;YsGH%Jg@L_I>fEQa3}osW zWk7Koq^nYwKrtI-n^$jV(H%6mNkuO9>yyLt00L@qp6)0mrFk~s+Q`pJ4;kcv-%iIU z{g$wyCKv3DQ!>N~rzYngjaT~Gl21)88qQxj!;;Yqrd=)3^ld-gbhm9S96#}AqNXiE z$^Wwl_YgZb3z&7YDog1$`GubD%AV|%ufVC#lAg#xNd`c&8jnx{_uW;%$t`AqfAd;| zMTJlawY_T1#{|TuWTQtn@D!k6YJig$H38d&Kfv}cJ)!iEo~Y>jM^7+O|Dz|Q{?QZs z9slTwqyNwobjBazYKto<7hAUnr;-y^n1;vTj5wV8MwSm@c^b+cfC(Tg9S&i{Vc#_b zIjfC^@^}LWNJoiCW63Iq1AxB5;I-13K+(6KqJ$vle00g`%Ka~0{Z1ZB1`@Zhk(;vk zfSC##!2gWvlXVc4nMq@I!C|ZNp#S9m53z-6}4WxEI5i3e};9=AzO$dY` zJ^U7pc{3s#$^j3hvTQ+A?TW!e>8)B3KOGd{p)?k4h@xUWcqpAM67e_GT|q933H7`G zLS5VFU#MqM{R?%9f1ytMpHP1XzeO*UIDVm!L{6H6Azp|Q0G8_)I zQA#&xN9-8-!trTLI}m9O5tw1^L=-(wf#0IG`i1yOu0u^KHW~|!!tw#M%OC>k5Rgnw zDm0w{#VqX~)IjS;er`0I@rR`yvmmso+&K1hw{r{pR#JB&$~GPv_1T@fOP-s_7Gh`C zXoJM~?gFYy@-Oki4;-2x(P+UC7Z5McfG>Mw1HTt(9S04U!B*KGf}tiZ zmZ*s9yc^H>m}LNy(Wux2xvLYLy|N+)|vN z`!8SB(q&fS7Ayz}FZfbKO{ZSQ_m6mY{LISe{B5439&OfQF~|O2r`~Z2D^T{y_<(2G zC<>LJHyQ?<4Agcm5|>&4&@luF0^fdr1a!ilM0MaAFK%gX&s7?9x%!>VAQap(y+5mWjj0r)O#CB~(~8yEqCcmaoS$ zx3#Pq2Gfu1^)3C+P=#e+jZR{=ABl-2Y^aDUKM*mb zx6?o&_GzRH>C#$&W+|d%fV3w{{~d;Ou)LYk8c71?x!YbA9x~AYz#AFE+>)bl z1=>gwtZv+c7ITpxrGa!HNz>6womi!+?%?3Knx* z?Z5nu2q-Fn75$rk5a4g#WPoRX0)EmGbeZxwHyjUC8scp}?mhqo#g_1=^q7L8Gc6ns z>}Dw254-lDpxDL!lpa%1Y`l(a;g|_;APlv6N%EI>iQAM;B`dZ7WJ}0LK*Y1#=S9a+N(v9G#-Uv0W0)@6%T75}Oq0M<676N9R+SZpCa1)&Sn}EPvY5h8pXmfsA^(a0-cpsl8jib;?^S3It`-*Uo$o+ zh<1wVd$Cji$H4~g%EIHD!=L!bot0k%2_}#&7$dNB|j@5u$cv4HB|(qlZKH@CoT{N{LN18? z9Z+Nxl@0{C`38S`$n4_TR3&u4#(J(6)QxsZF1ChVP=IO^S&2PBD2Pl9j$y~tkqk}% zcriS~K%BaEAUeom(2rIfcxqS-W3^QcL=1300@WiNP+Xil2h}4`Q)V5-C@@6i89+6d za|Epb=7fQ0m%=Fi)>SbI;O~ed)~5e{RdubN#JmwO@&9$)zSTG}?MB*2;^t;%RI8wW z7DH0o?ZYU=#--0p3{GgsbSSUKkd(H1WVW*M>oF^xofd!<-dbH|TzL%W$DK2=H|MLB z=Z?yBn7=v+6pR!8hkM^F_!4r9PCd`;Ka0ECze5B@8LW)fxb5WmJuxIau=%jb1({p- zR;wOuS5QL}+`FW(Kkezrbvzi73M6pS1*H$P6n6NouH?^G^HPD~ZeaO-vo6&dzON_Q z|7>4MGTcR9a@PJ#sufdYs|3V6rpT5BP9R{4Y)6p4MK=D1e?_)YaQXmKWIKoaEwZ7( z8JqslmMwKOyh`CCKqju^tq+NyR-m#(#Sad~5MU0*;L6ht?z{j1CYv0bq!}*;C}#Zc zNty+KVtCwvEv-1P1rTn7zs?=h95`|}Iq1RZ3DZhcTMIZSq-pE2`-WSPVn&81NW>xl^KM$e%5L^`6F`>P+QAzXwBXo_ zXfl8*j_WZLmHl3sIPARomP%e#g=If4Hq^B+-tO4N%8se3X0FCiVA9m#BbnQnGar z2!x4r=)XwEV0BO=wJK~SEt2{<=E$o;pT#0yTvz(FmlX%qu?@cNhr z?HMoysILI*46guNd$1kQfI5RzKf$~|I5J|UZ76~{GGfmF#{)g)n!=rL0%s;F5)DK! zM@AfP!-K(*5tQBg-J&kH3_A%UbX4nKkYZXp@K}m%0w5Ek-vGZnl*Ql|%@P1w>h=Iq zNk76s8`n=jY>vegqDtKXv`O>9oT))O0kL0@PJIIdSimW%uzgTpA|@3m(7+U&N?qE? zw?R4SZ&?)sb};U~2^1g99CV^E3IN?96BgKZ)giM=DX?4ACN&|Eh6S(?YV+EVG-w0t zCY5DfNYQRDs6$!Rhg3OCgYuI_Lr8Y<7VIXSEhrgbGW1x0`Y{>$0pxFnjs_8d$4uE?51(!`UHejTY&Bzc%h|oA7jU>2RZfR*a@zlw+A$^9YtdY3 zE9X~Mo>|<`{)q6%?#k+>U+u-|Lgz~9g}(dWZ;BoGd}&87j+E4C-nqMWP%%Mpce%oI ztz8g3HhcZXCTq2CT4$Ed*JgOIwiEl;w08yUcN}}lTbl~1E1vc9j*&dE=uxE%7!kaB zWB88afkJ=6{wLC^r5iUs<_lgu>)`#aw0th{e2lKH_oTh4K+rpRpJ=#ZNz5*&x}n!q zKVU=0m;ni!sOfD;VoN43Soy4{gY)F!)+v#XP)^`0Kdr(Z1EdIv-9-pRTP zUGk%{3jtCN4%I)_n=2moqrHot*m+teafGe=rp`I5vK5{(>%2vwea($@+13Kie8N!Z zZp*tSsYd1bYOoaZ(&HQf;XDRm=S7DZ~rUX0gYRm}# zy9b7=s-yhxN;tz^@$E`X-}N$OC{ABUp~k-HJ#;-8B6Nt8oqAAP$6~zUl$R7S3OA-u zeTRJbu!if-t-%Bb0_m5?ha;uX=RwpWq1&)akz-&OpRE5R2pcmwQEe@_k9uld`g$H3q6|k-q+v6D=e+Uq^8+-gC#t|2$HgeVzAn zQ;@#>SFzFT5gjY8ZC|mG!S?#N=45%H@mnBKk&mAVN#h(fL1 zw4cF(^iOsSBk=GiQ|6yr-(r@=H_e}daJyxujPyeLo*hNGx0zh9^ivQ(Khw0Ji24N(AtnU2=@>niFl z@2&n=w`M*Zb~%dlToX!^7IjJ1O;4%mCENzL{0-|r)+etOe&14IoFe+-oXWf^rapM_ z=JhcH;}j)*Ljg;dyxVWFxz7RKIo~7teCjElDkZTZ(63)taE2nE%7pA>JR8W+eaM3pNJ-S$kulVwxKfF&2QFxCo{+$OdQM zwX#3|ejy)pdnAf=pwH9D@go6{OtK?%9!lK1LrLhU%N#63%`t3J_2ypnAUN(N;j$pJ zUbA=W@X#w%WpskwgsPoeaLn>y7&8s} zQOzA2+tK$vmQsuNW6T$?Q5SE_|JN6ihIu{T?bPLd^^&t?kL-@B zZ%rm;ch<&Aji%^XxVA*y57#}?YD70KFt%>LM+(h5yLPrA>veqe6wC|tyG5@aaz+G8 z;d?mIr99pVyXoNuUhTg{R<=L%AgRY9?EGx>Et0b1p@%Y@Y!6>hM6qTJqp9q;a(_g! zP``*7opBUog>_@&)&aRI-}O^`;l{&l)(vmttiqywn|Sc`QhrmQoQYlqN(qc|6M<10 zW0YYSCBt7!gt3q4A8ZI$h`KqYm`@17+{n;JMS4hpfzzC@O9%lZ9?yqTa(yZ%QsXP9 z`o~s$pIVkjYAfri_$SeFW9fT1;pC@5F)td@ieJnWuO)JBYJ9cRJnV^c&FeqTBiqY# z^|5Tn_ZeA3;}xr^7B}?f7#&B3_)e;X@IHz&0cA*8uK106UB^mq9>&Tvc;6==H+t>L zhH9(v!fo3oA!Xx0F*0fBl*q~zfq0AC`2W_J#32kEIys6SdYn`2*08ok zKc6{gH8YxO9!Gy+oRU?Jb>e)j`K$gBIoDPlR9V2jLd-;sBhG7Nb!n3&bqVFE zB0It#@;IX~;xgP+(}n|m^{ZyG;fl3=esZA^N&QKz?t(Vg@t#iDtNs@`d}N!}KAKnD zJ!Q-#Qhn&vtV=t~|BJP^fU4?w_lHqXLq(NG`I}csbjdX+3A>AO- z-CZJa=&nP)bNv49{lDvX?|s+$-}SD=p83pYo{7EZnY}l2_B>Cn42BGc`Cfl`qj;BL zXa>g|3qC%B=f)>gL(O;V*BbNC4Ti7squIvcHPRqIonwj|ABVmLd6R*%l|fzKG_((w z*E&X0DCNCO-DVONHr8ARO$ENqgW~TjESfh1N4Whn4oCK48VnTeofnA3>nsc!r%izE zu^D9*)1Y0g=yXQ%Wjr~*>>9(xqIaG8u)H3f3oIhJE>Y@i0E98;#&-4(6!bte zAT)z>N(euJz6JFa{eRalfw1A-glb-_%x=)HL>PWf@VI|yI%m(5@X`PKjz!@U6vYd? zU~t_K5M~2=rX=xrofA0;atg-%S%0ILpc+{;T-H-CB#j>ZF^;S?>B#@bJsPp2&4Ll1?qgI|4tMuugB;o&X4%M9-AZ9ZjHD4 z+8lj*7`{ z7i*RrOFG<;MiBEeR_xeuV&L_ZozQCZAVnPOeD#Q6DCA0r$?NTq4oh@cT$j!*dy3O)v)vdceV zCt*;HkRzzK^B?Ppqxj0Iy5H|`$f(&UHreDE_a*&prUJ&jC7tmY_NbmQ8Y{LLv#F~= zAt&MfZFXBME*{YOPpAe4U=%6nqishW4$Os{)!A-5=&96pQ_FFC>P*TjMb$}iVnn>Q zyQMvo-FK&jL(|wNX7W0#Oe;Ev2u-%f_2#fg|L|YL;`a6cl@ZmT(ub>zc~;l}?&59&dMcU7w|BAp#t-W^+I6SPPRE&I|-iB#z>zn2y8i>^ThsH^1!83%EwYPYmeZ47e3_ ztG}VB6#1)>4B$Gz_0*#Lq)VN0HCyBYA!-q?*^>qgq|*>nB`Z~IZVB1=u79y#Dbm+5HhGsr;w}PKt0FE!MV6Dne-c2fZK>Z{a5(8AdCs&NqOmbsjHi4nyjGJ~kiF86N1kiDeh&+S$b z|LOj6-ibx*Vy-^RmB~G_NOd>S-kmJ?-#(k^n7ZK@OADr`1!GOT`Q*G#6xUsnnsZzi zXRkz3YZuYCsxl-G8SSHiPuh%h#=co)<8oIIm(ObJX@MT2JjKN!4T)38*pm%yCx7Rg zI~SvMyz}(0{*4%e+aa4)eIZ3YZuK%!mkbgO0HE(C{crd%E zw`kt2hv9P1{?m>zM#!nlZA~Folxa6-V}8Y%I(OezN|SmaazUSCX?lWkd_unvFQX+L zT4U}a9U5VG_1F)2B04mpwM$7vXlMOcs%;BjQ03Cs{u@spcNSM*Wa%O+y{v4BY3<%5NTjB~o_j3aGxT}63hBBOLhb(C z@@jFjJ#G20#r*WirAc+k_C1Hdw}ii2c+U_&@s;%Lb*>{Y>#*q!RZ41N2qtQ?*NF{8 zmi3=q?XmqnUqC*cp5y;*=273sBV=Wxp72c+?Y*aj*@x{0N_IUb&6v4FVVvV3DTPN> zt1(K!v$hhCJ8xR(H!gDUV0L_HE)EATj>j7nQCs<)J8oV6u1gSCqbHYz4n7ymc=mGV zNDFG_EyuW=*1w|12eu}!kGQmV?$%+lGkEsK<-e#sk(_w4-GIri$65LzTuw_h`{~kA zkq{on%ag#GME;wrpATB-oRDr0_tj6Y&5Fc+vd(zahFVNJ_$_TV9@nBi@oLy?G+|RQ z+sPh%;^HuxA5~3H5Et5FKI($B=mAY)%q!vDq0Y%`Y^}MsvQRKm4LOdSDl+4?A3}UU zo|=X?xvPM+^4IVw)vp}5DQIctU$JQt8QF@wQ(6-GXK`#(+J7Sz9SQx`xKmRK(KxNI z{idF_qnwKu$|w2RrC(HGdaqOQ?~a$siyE&pH%B5<0+-OCKSiH5e_u!ZvNU#VD`ag7 zW6G+na{oG_q0T2hNpkGxCdh@W2=zP{RZ09h?J!u5rtCHlJMrisZEOV!~;8 zj_M6tEb84YY;xez+4C zf~ecqpqK|J1_U0Z{UY_noxlKWAYg?7OSWr)M4$g}>{Bj$FEn+z|9Wr-f}&;r=b(ME zV+~UO?V)Q7TD+zI=Xm7tvlW>>|9?CJ*Xe*DFX-ZzD>2Zm|Ig!7ydOAaydeI^py%K$ zBS9Cs!TIQeg3O?rmsOdb&(!7qW;afY>T~B`CDLjjSsFXfQ7)2F4Tm*))#jSwQs*sQ={TLI zZq{1H_I{)oR}U6#?Xu`t3&oOr+mLpTN@j%tlQfT>f7{SR0^rNY%sZBQh;r!(Z1G$# zt!O2MLab#zwfJO{zlL~`FD5L(p|sG;Ea3zH(2hT0;t)iB%imtxk+&Vjcf8|2-j`N} zGJ*mfSZpN;K-|lp(U?t&Ry~MYHkdpEx9@|YveJIN=2?|a#>NEEvi?20@tS0zj?9dK zdQ72?R0#SD`=yt{9jOHH00Y_AXxq3i9p5w)jLGTB!<+mi3KvCvaawZWH4}Es9j{6k;sfzbFiaY%s3BwY^gq zN`?a93qau}0I>ixYyt2MfWB=2ssWhW0iX+j?Ogz-Ge{*DCoq-8+n$cZ+=yl>Ngexn zE713r-Ahzc@}E&p#@v)hf zvu=`CWg#-2%^7ov+QvnVjGy@|Z??887QU9qCZ)@F%V(#52<8gLJY$obsC*+IS+-*P zmA#nw?2=$A!qpwkT#UCRpgM;{r+rTTcKgQ(jeIqFPWIKLu98wKS6IllYM?yenP>}j zh^Msvk=X|&0q;2d!+BzQFn`@Ob~vwdx96fZ27gS&XDLH~g=UWSRTBDNGmFJ1k^wXl zx%q~YF*IgLnEO0`@z4P?K`W(`{M(I2;yc{gUCDPci*;)ZxU&t{h6%EyL`+(SzDySp zwAScL2y$%cWLbjytdwj$z5)J^VIxr^uUH8%3D(4I=@#b2f2&-+$`X8xQ~L`U1+Aj6 z4u?GVJ&tEV=QJXXKO9Z;6$mwRZ<~K$O zu!Qef?6+X{DX=Z4thj`w9@j7;>s6GvQx8I zz@WZGK#IBBmLF;(*t+v=XGVyHdcF&!R*!cmF z0~^O$k546 z-0Euc)gWbc`XaJ7VVst3$vTjW#G~%|VvA?qptd=!cN1<8KOpA$pKR*_;ZBid<-m~8 zmU46)JP&JPT8680b?{=UNe?#%whqjJRTBYoVDZ2l*rc73W<~RwNF05rOvEz#i4dBvo59zLp?R0* zJ{_Ip^OnErdW&dN;!r?#Hf zrplSCLUKWT9~`=W#dY*;YiN2oIey>-L!PQ9a}AmbGfl z)S*`zs+1y96eIeR$o1!Wg2la~vxsz2#e$1RuT7HjNx|;z1Y;!eYd49r6y(7D7Gt#y z3`BnXw81_RweTS;hR|?(VHeqQF+=4HqOWtSJGV;<;njRA+X)phv~*yhZSp0WfoCchBN`K#f>hQF&6> zB&eId$T#lWL8Z(WD7e3Lj>i*A8nVb3`s){NHh6~;qHL7Z49d+MdNf*#*Z915Dg=*m zM&;ZWY2Hj{M9qTHTQH-% zgxbb<={d%8xaYT$*t_WmX(=R)+VM&{uxO7RtyC`mWH8BgUH>VvYpAGQ%Bh&bEt`US zG@AE)E&oocM%Zp!eP<8JKj2mbx}ax(F+?wV{(FJT@cuhliZOq4+R|EMU`WHa3A>%M zn!dau5vK!WZS9H4{V6-y>CR3TjVg~`?`UVwL3l6<4<_M3Yd8pcLC}%}53=Av0X!&& z2leov4Icaz8HJUza(cB8Azx9nx; zddiJc`wS$#Z0h1^)=bftUd}y<#MG1En={^eyM}wt$|3vH+0piv9iIK74O@Pkoj>l; z_rvbm5|VE1vDlOQj+w>B+p&8Xn2RDL0m%u5_Vj!=T0@ae_a5L@-f&}OUVYJe3*q)| zy6!xl?VLUn+3Ja0ONe;^^Xc5`!Fc;o%=5D?dPdq=8R_7AYQ)Z@XV`fZ{It`NMyU}u`I`KE zwgftN_inc3Lskt}>}OfZYWH8VZwIk-{*Q@XC5a1ZiHkN@?~=;@G~4?hoK1w*nI;C) zBG&6gV9&Q8W#=Y$p(-Cew}2^vRdU3zV~p8%ShnA{I8Au;ofexJ3GTGPY10x>qM4;ha5bPi7^h~8K)Di=G6)J+O2b9UEL9o zR4w7d0GVsq?ziX)8G%jraM4|ml5{d{4!x$*89Lqq6KSwB@c%DAImi`h68vi4Wp{4o zS~7}H+^)b=nsEc}6ek!w!xz%OWfa?M!~k+n{Hm9$mTU`yP?Hq@~0ImzP0$a9hsc;GQH^t`22B>>fD;LCw^+{(XP;aGW1|31$)13Tdv3+){vi!=QYp0cvjg8Ozf%0i(!6+%_5gW9?pZXL!Ji|Us|G&;hu0dr69M* z-w0_=JDWTqW8v6Wb|gHqlGCwP-$qnVTeyN8uGzQzuG6P~+tq#hmFJKgWFwL1{3O9a zJpcg3%gyFB<(5zE2I;$Z9?4p3ma}oh`vc#0ZH%W30=Zc!xfhbqW>>c-Q1fY9^V6~=4gJKNTFoipy6SkFMO zxr4*$TlD+l<&}&J?we4+Y;iRmN&Y5J8E&jK6Gf5Geus-9v7~?lPzp8*=Ydp<&=B`T zw@lVLRavq%`|TBC*^p9jM7(q|eT8!Q`SP^0SE7ObH|u0%Wjt8bUHjnr{26#$r3IEw z@MRBGj)_gw`(6iesoImuL;LnAXd&nt2K?+^->(0@@t4ngxK-C<^F4AF7f<)+rlgc@ zC&rAS{)3Lvt7sdD^ok-TZxvuHyFmXnntEZO<8KROWDxcJs3;z0c#&jyks(kd4+_LA zetp#A>aPifOuDRI^lrj!t1gB{3|Vd8%gKn6Hqn^1w!l55K!4egQQjV=|0}3O;T0Cw zKHSF_s_+vSem>;-67!G41&8wV?&y<|*KTYN9Xd(E5ww1YQ3y=$0BYS8P}O`IaU9jt zNu>$v;oI4ks7P9kmOhzMb@b02Ue`YIW!MB?pgAt$_S83}Jmwwt>`UP{ztgQxoPIi+ z0{=yhRHkp&jOWUvT2amVczvT(_^R#h!bLsBibR*BM0L_B9^?7eZd1Ndg7B+7Zc4-t zm}}yv?AVlILE_m&f>9qhg+6d4=Nx^We!&+*A@)=}f@p;T#qJw~c!eSu9-&Zp+%Szf z56bo5*_(iib%r4LkYo6W604ublo3ehB(wfHA621t=5hDmYikhK|IaFK~E zZ53y{IoYMB>Z+9+20{pS${%v|Hy{leYUi*y3ZVa58HGy zdOJLovL(~9B(80A9?ic<(=Ni!w>8_aV8yUf*kAFh$g@gI#`;ShE$J16zO05^dx_zF zr|g0DXcX$kN=R3bnfsU@PPn{BT{g2}PklDoaVZYk3u}$hY*^r*KXxad?{rzNTw2YC z?)aTNNAanU?;M60>D$**bz}m1Ia|G-#m4Tg?~p-nSeT`UX3x-L?VWyt+{HsCPGe&p zK)uEQ)Bv110TeYapp@^gAu+a_Asljr&*2OhRn^@5f%`^yLQy}Pl_uIX;Wzus>vZ}R`GPntpur{ z*EOPfS}ZDg*VKen%d$*W^^2R+QwoYfy}&Rw4`P};EAx8(L7Z6FxIS{K+ATl1svLss(Yf6;o!|ZF z249@a>O;@)(oW`7&o3c+x4MxTs(HI&7X~S@o5R-Bqsv?S#!H>kK1vsh-rSnAN5N@y z#TV53CA*g$&Gyin4wm)fxocY)mnIXjTLNS~ue zER<&Y%rHGqbNT|J3mvM*{xw7_S-KP2{KFpl^*T*zXlI9)5eI4v%M-?#NpMH7930*& zrURcK41#Ca?PGy?Q-1A*@fOcA3bk}t(~P$8dDG5!+J;xn%4z-i35E6#&J-LO(zFX> z%D$AIh}2_Sm0xbPw@;_laV>`^k&k zT}_4NxHLZ|5U?_l_32li@u+AF|F;pf*$(W3C2vN42^6dP%ssm%U3OyXBzVr1PhMjf zFg*WLlm`kbfr5o4P(@I%5EPu8Iw=4Jl{JQqL8dgwEGU7pg3R2S^kGnI63E0Vfo@Eb zufrUg`>f)_+Ym-|`>)28#&5D`DQ=37y2o!*ds>ho*R3lR!$#{c7`ZCu^8LX{VWL)B zCw~jW^iHkf;PZ?LOKzeiUoCl1$7&h>l$FMw4p(2m2-dD-rt}g=U2%qS3F%8$r2WImFl?O9Yb! z-aBY7WYRf4fYfu4HFfPO{6Vo#;{Z;x^m=IBDe(*6$&Qv>DzE;it#p^SDC3TV?cOr? zyW6Yr3oWoXl3WZPt>%IUNAdOJJMQk$Lv>$t%B|NLuhN&-RI5&ap)eO=GLP3By`N!w|0G>&P$Yl!Xt1 z1hNUdpHLQ#Yx`VHn0|QW9`QFaj^HzWJh!$q?V3cxL+Eq*dfDb;G{Jp%QB3F9vQ~Wg z!u8=+`%o+J$1&!dejkuVGdvABQ@rR8{-t$u8~43c_jlRbTY5wb9Y+lE5SfX_M z*gH%pUb2Iek$JMAblsJ;apoHt8MNj$!Tn-phxhh74uADp(UO2^@5PbN*wBLz;Qt6E zq-z>yeb|w6v0$igQj#h9uu(tIies$(e!}(Ap}A*>u>S^@t2ybVVx^uz@lO?H22no@;0!c&vp@H6zvya2`8VC#Ktov+Yd?6I zE53TlS-A;_IS!03cL&>7_cVB+dKVnRtTSRtfBKq5(vtQlwg>D;<&C?pgF;GYMQWPN z?gB31KMA%jmlx%AEI!uaRX)GAJ-dB#y;plxxXaVrF*hWfWgs{QU-QdS|8E~oItl?ik4ip4VLpl<8JJ=e-+74(zM zhQwiKen=U?`YDfwdH4Iqp(511R~J}}v$6P5E^$oA!K%T>ua0P$NvO1sJ$4FV}L_`Pgh@PRO1=JTSYH_0twU!}K2#;mNSfz!=oEFe*B8Z6#2h z`<{*1?d#%at}kdEJ9k&XS4Gb;XS^(VZ>;{D?-w;>mfgucNJYKWdHukb&(+!xYJ4|L zZg`3&$ZkfYVw@!(zWw%nVtxz9v&sBE$XT;bzNq7dvJ#3_MQ65rYwN=8wFCU~t6L3H zPT;#K7q=wRmE~%CbNN&JFj zf3~j@qa5+41)z?vQoX7GP57~`OKhTAXi7@eOJ{b7c2#|qxg!UCjiJb5tdJ)|Gi33> z1W7pt7^;PmxRfUn^Gub_X*^mm$@eTxJ*t!eYDKJZxp!pkG8?f4;--DkhY7PiiSZRl zLRsO1rZgESU*|xw3B{`*T*~xK0u44u22>;oB!Oganm}&K?mU(V=qyq=N0MwFZC;kU z9#!f<9;oyyzeMKD-_xV)vviP?!k5YV4U%h0m~ZN$nb8bcgY5`Y#^v}F-_(F>3c=|( zjP)qW76XkWZc(4~PIRz+mFYqF3NxTpNVa=(WB86G_q#=|oQb}@dY|#b?;!cw>z9t% zsscfu;nOc5nPovGXSAxIZbuzOujUMGtKgLP16OR|GWJY~7D&A|l2TdyUtFJEZO&65@;{_41>>nm#}fR<238$~aK!%2B=MPbw{RZ(h1xaAJng<-#Tq){WTV!XglshuCrX+56@2 ztyKs^z60FoDbiWJh^J3~Qy?rd`ncT27!$Y*O>$C_ zY+Amp+)`X)jpiSq`(!kp7nqmPymF2n6x&kg{_a>zi;n_vuIH8ggYbTipSRZe;Sb0c z@Adv9^^iEi!upNLy#_j2Y17dTydlDUrI3+TP|t*vyb)GDiV3+Nuu(ohB^Ny$357`Jo35_RYCl4p6r zhXrdNxP19BlPWX#nNXMeGwT2QUJbxL)nJBrQ?WcDIAu;1QWnDE>=?Lu`7w(s^97@z zmbgCF9Qd@FCOpD~B6OjX?Ohg{s-TuM1!8i~E5OQ_kOwY&VPnZe)A4zUSYbhTdMUkz z!HR6~-X|GeC;lUrQ~?n_3M=1wf6>QP(SrNr1Sun;=mq^I1_FfIzV%^U>)_e~7JuZ! z;{quYO+Lbp4=c)Zfy3%tA7gU2M8Q{${~E`x-IeLk<|u%O@KwV8lM$)rEpiV&Q*d$g+i5yhrKjN_GnO zCrA(8)eUgp&6SM?B20wl$ub!v=`ZdDG4 z>b6YOmI8&DHRt;*`P4_;P1oe)o!Ggx}4mvH=h`P6Y(6LO0rh3ViE=W$sEbBWChGA46NG!-lA9nVo5UbJDH z`yipM$%8ek&yX4oSLHf~uFmn+1GKXUnbd1-X)e@ykYjuF)*!OZLi9W93N8~xxY3?3 zN&1)FtPT8%W3BI|8LH-O^&8NFNZ|H2zfJ#|`;w2uSa{+%ZWKfHng07t2%lWcW~Fe$odsG8yFQ zXsuwxC{Dnn0wab7W;GZwmJAdq7_rqqz{Lb$2Y`zSa35euM>#;iUuL!-!3JI|FxXmw z8WnouvIOC;l&1*D@Dc9&)cbeAXF5>hw2=>R<+c#O;seSpx=|SgS8l=)A-HlI@L_#? z$h@dOBfhx;nlNhWwz^`2*U7S?&*2f`^6m!F_6Rgf?lrN_`VP!#7Q7K~-4+mSAB2a3 z5dthr#+MsraI0{kYC<%CN|j}ZNcav3?K7S50=FH1M=_1@e{rdPS~!_bG5qb7iFdcf zKfS7&{XTh0^Jn%DwWAX>9DF06Fgychb&sY1xNtV;9YDvy-~hJA9rw5!On^U0hv-ph zjQ<+H_JO~CJK*Ez)KZnq!^=e&0sNhGb+Sgo{hcI%`2+l&05$Uj{!T>Uj!OWG2b`(^ ze7Huy}b@Q00i>DMJ+b zv8&$F6?oeh0B^`!2~XcE(&D_|qqCV({VlKK)6L*BE#s2{(UzG$`{R+f!nK>?7PzkL zu|C+hqpUJXnq}thn|C2O;c_Z}TUzF%-;K%4IA?I zw9mLwrrlrspX5iKfW8MTa9Kp6K_AwidEp3uccxq|6D~h&^1RO*KM~<1}*&G z_3OPnNjBr97Cr(r&n(^c_pD#gR;6G3_0)=o^*2huco)XXLCW#V0xVB;j={nvbbdiT z0{>|zuM=$2Lx<5Rw@=b^I2^QFdW|}d^{#%;%8x`Km~ao12+Tv&AIv2~=Vz}#x{(|# z*|Z~N?(Kf}H;u%ZzW8M8@!v)nZ%PlaI?p_^>sn;7r!Rv4T=B_kE>nl>Tz|0jfHVJ7 zltEj1pa=>Uf`Xv_0#Hy{b2$$bRI>HRpea3I1(~^ZEyJLWB#^17xoiwFrK^CCU^CSs z5xz9Tei*rR5dYGBuWOZ#b!fcp3;t?mr9Gs=cRq!SX&lf=0*565GiteNiNHAy^lG?M z&ez-@TOxz?=8sk34FXxlvPQ7Sl5LpXe$)4ZG3|Bu)rQdFCnNskoYGLRf{2t%5 zv&*gHB9P{x1T5Z>e&2t8{RT2U>)b-;%XOWP&^^p2xoCTycAP=l)86=}?)eyXAPHIO z#apm@yP58lzcn5a-oqr+<$VqY{|@52?srA+S~nM?Utcxv_rxHqI2#1JMsnL_R5I2> zPvP~gIIocylfGVtMl9^?<~;OYj&@7+=p}}!!sZL=oUcj|`FY>}C_Wy_L2ozZLpXg# zR=@Qh0R$l`VDkuJgcXSekCz0&HNa-$PtFBdVX@17#Ff=Z^PThT?D-4ZbXn3DQ2dh@ zKB-vH={J1j_g=Qp^Tl^D3%Y_|4Q4Comw8u@=Im!@%_|y{k}URndwb1Ej^o9Mg8aq9 z1iafiziyOa2q>_KXE*FTZQhMAy|@t0X+RZlcEqXsEac-|w21wru2{w=)l7gyD9Tx@ zhlL0lD$;aa{iOO0c z>(fW!W8cHUvd(?xFSlr_Ety1}fXTP${Oo>AkD*=NmZftw$x)~ckI3-c8?o%#@b~~g z#m#Fgq&w(B|7;D54t-uvVC%NX4@ zGRk&e3h{tP{Oksw4p)T%5CZ^FB*4SKkGHaoucnQ!yp6BAEnS~ana~24Bl1eGd1&iw za`~sFjAB4xu)P2W1vM^ew(mXWChv9#N@aoJXz5(<7>+^u`2NunoTYFARy0}|<{TBJ(mzBEK|Ln^Px7OrQ`*7f6m zM5=sw@%Cp?ANu3ptB!(CP>&lT{2xG+)=~T9G^s?KSFUgN8T$;9MQH5o6TI6k)-Y`n zWi%e5!#sUEeRfcIi0UGKw)^ZL^AK&kMSp-?ig#%9o9h7vaw!G?4F~`r!x;cP?@w%g zJKsa_rrCBri;l86!QOc(jzq#zeEIs9u}@|1ax)o^IUe0cw9;(q-^d7h{jq*}g$_hy zFM&wgGIlE1LhxJjg5wdix|QaA;H^v>tfBh%h|z_Gj%63jeaZ9Ms@0Oi`gD~ig>sKu z_Un=-ME>34+YXzZcanN_j)bq77t~W?UTzk=?GRX|!bA-q3inPNG(qaH5T$r!#7gjh zIc4-okWbE$p=xnhsO-^NS=D!MyBGA8OnqIIC2QAZwf9s+!`Z)Xtthj7{S-bt63Yk* z(Ll>qV9qMslT?A~->;aRIXCa8tamm+_TrdCBgAtP<`Iqvc;W)pyz*GI%ny{}jTdjV zFg|(>YAHWb9O=Gg7WHp~t3MFEM%)>T!#rFMT~2CK zP}0OcYm!I0C@_S$J`;U&oY{>h!Teb3(TR{(X{BkQdlvO*9R%lrpCM#qyk{ z)irN+z}`jX)0*X0xkvK{!Z;SK$Y*mcijw6-VhITluB~jb!5v8)ElN{`#bONn)aBcH zNNh;AY9>Z*G$QM97Cyv4l#hjiG$mSgpa)~1hj$g%Rh4Bdi>v zX_~FiOND~(BMRR%)6hw#wl^5!8yi9uxlH=m%65e6X}QLj5)FgUj8rI(louYcM-I@! zu=R1p-JcCam$I)aHYtnz>4%(*rd3_vA3-@R4_-WYF}b1MhVlFbj^eYhkB<_pJ}B7? z%6@pnu>^qZ#}AKccL1P?S{2oCY?_T{$%oXQsi2hvpj*skpGoA*7gO}#B!pX z7f1tHkl;_0yEhTKCB)iZPL{hj5W1~IIb)=nXl2d1`z&-j>VFlBa&{n-@5P>V=ZA6z zDul}zV{NyBa+Cg7)>IQ-99ehB0R&lzKF|ccld~rUL#pVYAf%?HkTuzt@CXU zU*vF;48tYbPqoei@1DCanfn|vrT=a~rCxZ7MoZm3D@>*Zk(XB)d^ZPZf zv-GLewr>`ASm8ADogei3oR~)wE3~B9a^V!Gg_`!H={6yHTbo*ZU@W=L`{kaXnV*l{ zO#FyvKSx^p=zceo7VZ7?Dk~C+em4uv3EX-s+DKS`>}f<_DA&a5m8FWA61?MAsZ6PW zv=vb=AcrA^^m0oE=v73-WF@BN7`&lceS`m$Pl#_aisI+&FGQ+&MXf`SIR0k=86N6NF>^A`*fwsNx^_k^0Vu4)G zsz&Ei_7vsk7<{G{)D|IrJ@Rq+fCfL0t{M}m#OU=Cf?>&#p@0b*rZK zXP*!Z38FGfR}ixQ6A-4LjHMO@&(26kZD`6oQ{059SkSFLnJ7(}e%+t2{8tHT8@@%48-ZIUBkU9F5 zkf!~}(MqyDCJR@x9|PJn(Wy?|#_xJFP5VOx_EJt41%hcJ9?Woa^mLCdc4Q3B)nvcC zB-_C@{eEkwRjCbXLTWgKxCRur^Eq#E4#LU~f0D(%xtyk;o_Qm{Y2p(3dWV>WC^rs^z2kW(Yy zZnk2#P#pY%=Ln3TIOi^eo-wXu2lXHCw}({uMw_U>XooWq zL8bjAIagCz1QI5X6v2-x#beuTp)W zBy@v+%(5h%Wj1rx@Ka9Fql7)fPc~`V0gv!D0C)|6pMt?BrcWXOd;*{j4zvMyDGGoA z04{J~2EdGwmukrb-_smw!5Nu#$>%i+^_c!1N@YlAL80mXx%BznYNwQPf#wI46*Z?5 zW(tl*^E;-|)0PhwH;k`r)u{*_z2kdDiIWT~=npt9eY1ax8WQSOw5j4edUx59{qwPo zI`+)(l+cHS?jG`={SKI(S{#aq`k=K8zWLFnN&tkkPu58qX|ul=m$({>xL@m*=2f+x zTYYzUpEzd1^g1%_Cv{Fk8g?9ylY-LmjD)-?|HIEgFoUB1%n#d$Es5#=D0&i{eQG6Z zS}omhvOw{O0em^8isJd=GlfhdnmQ#+(HS_Q9kyLO9XW<7s;Ab zWdt=DW(n36^ka1dGG}ZF7E`Ii4pJE13fIbhonk3gX?L7Mnho!M)sFwpC_eB0#12vf zD~v0BRkHQtRvg`fYd3E!hU|~NxZfzqfAK5@iJ#O{lB2IAexn-YD8+ z$tZ+mSQPmxl`t*n&^pYsQHzLp^VIHHYX2y+4TDa1otu?&cO73sx4ve^{1$Vmtn+ET z7O5Zf)YBoo|AC$B&asb<)zOsHCZ2q}rD0^QwNl@Yd}UlNTurqo-L}a`__&(704P7k z$6W~ds@tX|4uCfR&0+vJ0YD4~765pN0-*O*S6*JxOqUGv4K0Bf{qqkGMMU@uzIcjf z_QYv^|BQix9rsXyzDfAuBab4ar>-g}*r!F9Z#I=*%Z=noW@d`T3E1AT;p;5=hko1L zaC)(JNOowWjXm7XDaV5WB`*)|~16uC0Ekj3GveTci?lQ-YJuN+W`C?jTV1`L-z+N%LkW ze?HLlv!EKXva5cHew4qWB2raY?h_MSnP@?ahkQxwB0r7Ur2LaT6%{`?JIKdcn}uvf zFqm!2$h?@4NRA8YYqNfVEs|D7t|(7k)T1Km|*Fwb{Gj0|HlHK^T17>^tI99kp?K75>dmx$A$2wsfDCDcTmauoNJ9mL=(Lh+lBEk_NPQ0c^f!d z)>f4ieBz$t#2`8=_|6r4oflu|Z*5i(0?Cb6>mFz>aW>m>8f2|@=;Tohr8>`%+U@o` zsY6rBY`wLs(mtE4uf=w6=^0nH96WToA5_?LcoIEtsUQ_@>|AS!P(DAnsmsOYooFmt zFr+;Yrhs!g^hTN8M6@6TfmKquog>GAdxF0woa-Ced92iK-n?=1lwx1bxdCgQNfA5I zcYPS*$aI3O77eeN$2+sQQ*!$7AQE%sx)_YOBifrviv)Z5kQT|b$ZO3X{w{p|3 z4V}oc-&olWf3{rWzuFcC^Vo`+@4I$(tthAYDa%!sxu%qukK5$@d?c;Zi%5=@`t~8! zdtM}IrY7N^NPgU&lZLpxdZV5q;e-O%xv(nM=fk)X$)X}JwW!wx5k7KJ9jGT=pwe#I zw>OH<{W&b&KeqX74SD~ga{2Ukmk0~v$=lS$w?^{P2j$)S?oHc0aVVrD+aQvG6pa9Uav!-<0u%o+?M^v!guxU8Evy&#F|PS)X1#>y$zW8$ zocOOjj{0#wRc^29;1|gsY;b8&YQy+^jQc1T*dl)(kUqFDNX5fXEs_xMj55f`W@E13 zymXDm`^|BP=dmUWVcGK5vAQ4JpsKwu_(&{*;^Ng<>WSa2?D7JyQ^rL;p>n9Zr?;vn zVQ`w3MTF(Czhqe0gRC(!eF5+m`0_dJ8S`T#&jWeE&o_KHNCCU8H_r;Q+0t<5X_SWN zN!usO>I^Aq5AtsX(VXz{J~yzi6c7CV;5ppzLytgp>2>;0^5-~%N$m#p{KeRhjk}f7 zHixuktY`s_?}9@OtJFh2O)|bWch^jo)q|pk20d*+AYf;zpF)6?r0LHoFS)Ne2mDHz z#8_Dp8uH_6>?1-sf7z2`sOf7T+#X7yyktAY!@w-IG5V9GOxY)gR!5)?k2qDnfY2AI zwhK+rS7RaIRa=Q!jxnl@5X(P3Ny%!L?sX^oc>HlY(tmb#Q}^in`#4+2n$ zz=@NFUiB*;bCQt-`u9|_*H=uOwQs=pm-J7;_m`o+5cykc0^}+#mvd#Hj>oo2%A+nd z5=f&rkeILX%&pfav*bEmor|OyUma(|%6m7E-3EV?uw7gQr=&OBPK-R;Z%ZeU!E#f$ z=KR^rUJl)V`E*~`^YH}}zsD`n?0%22}`{GsEUr$pk{ zj6XEes>f!V3skrQ5rM~W2VbAv$|8Nk3@u{1>)q{7v)!y-0~=eVelJb#65;tg@K>Hb zzI2#=u3z==c*I8!$krk^Wb*bxB(6)BXHPVMXZ8b8U=b-gi4mmk>U;Rj?ZPV}sG|xo zj|qiO3O_o93jIl22Z>50IZ3H?UIIkxP2pl!IL2qTysxFbnhM*G?SoBIb}UG=0^5@Y z=<>|pWu!K2x%+CLIQ~*BG*nR8Gn>oX$Q#xe&+)^X_rek#pQ+yO74t34h(uE5hl$%f z_!@~cEdT&M0ITws;!G@GB9T}nj-x*lNbq3}kO5&7N|-p48zm`9Zp0czTT`?$R|1=$$jb$m5V#kYIh9vY>Z+bf`;Y?(Hip%k8fn-IpWkLR4v^>>S5oD84EXx zhSJ`Ap&?pGI9%~SiQJcZX{j%*`v{BB95u(Xm_Dqgyymba-0wQM8xiGT-sRPb2O$O} zU~hRy#DVBFL>k9)nOd_W^nIb;%Jg}&f+F|Ojs{Y470_hwx@EnuEEm&J)Gr4gZ zw*j-cW+ZO2x)b5#q2iRR391%6NAmRlsqDsBg|yUi?U?PavZ6#OhOGJ z%oxYWOvBj6J|x>2owB9Ku4LkH7)wT$ib!t^Z5rzsYeeEO3XO2|-qX3>tM}jcpXd7A zzu)h9{=J{i_j>N@;aFlzN8knhIhH?GG%Jld+J)zfNPKhR?hcG?PO;5zIg+iF-f}vMsa{kcFD|ffov`Tm&!-1Kgk08r=SX;YaHrvXCWRrPPF_If>d@S7y`ED-ce0r(kU_f!gd{kF+y%qbW{B z{aT%41&35%F#2J4!eOtfPCpW#*D3XYL|8i2m6~=}l0YkmDckh6k)HNhwk)s66|;v4 zzI222Ij#S>JeB;wMtQQPiTnPr+qe&tQpfC%yb{}Q)}}GRGW+;=Sz$aI_{jt?5z5$z zL%wNZ828)O8Wsg87s$qU5MkUe2L2&I#3O*3toRzqcLN0h%5pK1w~V-6H`adIJTaL? z8T+r01kRTvv()AhasY=&P!8b*Obx|3nS zJ&IgzUko|uaNFiaR&1X4yUSN&KTt3(8nS0Ugen)akS8U!2``NOe+Uek67`of)F|=Q z55buOJ`=`fhVRlMzhLY1mV(^3v+r_`zt1D6WIsKu>Mi9K?_H8J@dwJxcRbHpo`l`q z{u8!3EkK2&|6PX z&V}x?!2n1B(2WDI%C8UsxaEP0AAqOByCS%(54ls0+{B%Rc5{E(XS1z?b&qQ`43K)F zEMX5Z%StLX$vp<=XgL5M3i zL7M0O7REmSs?(YWROg*D;Y!E_pgKc#Ky?x|>pS!Hf$FGN03Tw4Aw(e zheLdD0MMoi;4ARA6544^wg z>1y;(bAGEUe;-I5j$$`A@CI?A0b?(cB5^K`X@*_XM0$bu^J^Pqers z)NWd^QxBdVR}pZz^(LYrT^QM)(2;EIxitWd5?9n+iwoy*c@oaXO4}riYC2~B6`wmL|1u3y z_N1fZd z#(+T$nv?c)yXrq@i(iw)QD3tk8}o3%kaETxoF#|5dt>3c?#+}p?C|u04BhySIahso z96aIWz=7Kg(oD8|As*m}tx4i6z^Z9ciJ+u=u`TTnbcGv;!%()QG_cJS z@RyJ#`({_Uc60@Pq~d=sgYDx|&d%GMkDQzrIsEtwbUSx2{Y{#={`z1$A={GVUwx0e z0$sGSz3>@QHx7ZM>-z%iC7^A)jCj8mEqmd%bD{7*K^JHa5OyVIN|NJtzmI}d>1W#- z%1||m#jwGq)77n+rF6iR0nU*+^dcF>|EIJFt6{vEjaeu*5gU2%P5o4B^n}&H<;g(l zdlQHtsm5r0hA@*mX#0>pd!<2J`?25aPp3H4Tv}@EmcMT-@1N+sE$xWUaf{yc%9wKR zmPGxV6=AL_Eq}%e+yq&D;6U0)lEe6O|02E7Wl(s7wQyIJn@Tt{a9FTCb!dyPo*f`@d*Jc4ai z_SM0d<=0+zu4en%XeV>(xLOf6QhKSK+Q<{gh-^<4R9RnY_^RY?ICJiFQ<+n^5&Oak ed5@XQvQCl&fW^!*ULHbXSE Date: Tue, 21 Sep 2021 11:25:41 -0500 Subject: [PATCH 602/766] 1.17.30 is now supported --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a07af9ef1..f8a649294 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,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.17.10 - 1.17.11 and Minecraft Java 1.17.1. +### Currently supporting Minecraft Bedrock 1.17.10 - 1.17.30 and Minecraft Java 1.17.1. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. From 22b962731c9814c6d2b777da5cc3d5f79e08e425 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 21 Sep 2021 14:04:11 -0400 Subject: [PATCH 603/766] Implement proper non-sound particle for turtle eggs --- .../java/world/JavaPlayEffectTranslator.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java index e29fd437f..73b9d5d8e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java @@ -33,6 +33,7 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; +import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -207,15 +208,11 @@ public class JavaPlayEffectTranslator extends PacketTranslator { - effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); - } - case MOB_SPAWN -> { - effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java - } - // Note that there is no particle without sound in Bedrock. If you wanted to implement the sound, send a PlaySoundPacket with "item.bone_meal.use" and volume and pitch at 1.0F + case BREAK_EYE_OF_ENDER -> effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); + case MOB_SPAWN -> effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java case BONEMEAL_GROW_WITH_SOUND, BONEMEAL_GROW -> { - effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH); + effectPacket.setType((particleEffect == ParticleEffect.BONEMEAL_GROW + && session.getUpstream().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion()) ? LevelEventType.PARTICLE_TURTLE_EGG : LevelEventType.PARTICLE_CROP_GROWTH); BonemealGrowEffectData growEffectData = (BonemealGrowEffectData) packet.getData(); effectPacket.setData(growEffectData.getParticleCount()); From e0ae4c1b85dbf46adff3161e933f927e8d0fa2c1 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 21 Sep 2021 14:34:17 -0400 Subject: [PATCH 604/766] Fix disconnect message formatting --- .../network/session/GeyserSession.java | 21 +++++++------------ .../network/translators/PacketTranslator.java | 7 +++++++ .../translators/PacketTranslatorRegistry.java | 2 +- .../java/JavaDisconnectPacket.java | 5 +++++ .../java/JavaLoginDisconnectTranslator.java | 5 +++++ 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index df152da6a..c9c42e756 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -140,17 +140,17 @@ public class GeyserSession implements CommandSender { private final SessionPlayerEntity playerEntity; - private AdvancementsCache advancementsCache; - private BookEditCache bookEditCache; - private ChunkCache chunkCache; - private EntityCache entityCache; - private EntityEffectCache effectCache; + private final AdvancementsCache advancementsCache; + private final BookEditCache bookEditCache; + private final ChunkCache chunkCache; + private final EntityCache entityCache; + private final EntityEffectCache effectCache; private final FormCache formCache; private final LodestoneCache lodestoneCache; private final PistonCache pistonCache; private final PreferencesCache preferencesCache; private final TagCache tagCache; - private WorldCache worldCache; + private final WorldCache worldCache; private final Int2ObjectMap teleportMap = new Int2ObjectOpenHashMap<>(); @@ -884,16 +884,9 @@ public class GeyserSession implements CommandSender { } if (tickThread != null) { - tickThread.cancel(true); + tickThread.cancel(false); } - this.advancementsCache = null; - this.bookEditCache = null; - this.chunkCache = null; - this.entityCache = null; - this.effectCache = null; - this.worldCache = null; - closed = true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java index f59f747d2..b0b1aab5e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java @@ -31,4 +31,11 @@ public abstract class PacketTranslator { public abstract void translate(GeyserSession session, T packet); + /** + * Determines if this packet should be handled in the session's event loop. This should generally be true - + * only when the packet has to be executed immediately should it be false. + */ + public boolean shouldExecuteInEventLoop() { + return true; + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 49f299d59..56735f98d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -90,7 +90,7 @@ public class PacketTranslatorRegistry { PacketTranslator

translator = (PacketTranslator

) translators.get(clazz); if (translator != null) { EventLoop eventLoop = session.getEventLoop(); - if (eventLoop.inEventLoop()) { + if (!translator.shouldExecuteInEventLoop() || eventLoop.inEventLoop()) { translate0(session, translator, packet); } else { eventLoop.execute(() -> translate0(session, translator, packet)); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java index 3a9ca3787..b5b2e83a3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java @@ -38,4 +38,9 @@ public class JavaDisconnectPacket extends PacketTranslator Date: Tue, 21 Sep 2021 16:50:06 -0400 Subject: [PATCH 605/766] Fix item frames on 1.17.30 --- .../geysermc/connector/entity/ItemFrameEntity.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java index dfa989c1d..42ead8dcf 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java @@ -35,6 +35,7 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; +import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; import lombok.Getter; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; @@ -85,10 +86,14 @@ public class ItemFrameEntity extends Entity { NbtMapBuilder blockBuilder = NbtMap.builder() .putString("name", this.entityType == EntityType.GLOW_ITEM_FRAME ? "minecraft:glow_frame" : "minecraft:frame") .putInt("version", session.getBlockMappings().getBlockStateVersion()); - blockBuilder.put("states", NbtMap.builder() + NbtMapBuilder statesBuilder = NbtMap.builder() .putInt("facing_direction", direction.ordinal()) - .putByte("item_frame_map_bit", (byte) 0) - .build()); + .putByte("item_frame_map_bit", (byte) 0); + if (session.getUpstream().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion()) { + statesBuilder.putByte("item_frame_photo_bit", (byte) 0); + } + blockBuilder.put("states", statesBuilder.build()); + bedrockRuntimeId = session.getBlockMappings().getItemFrame(blockBuilder.build()); bedrockPosition = Vector3i.from(position.getFloorX(), position.getFloorY(), position.getFloorZ()); From c28364c5dd4f2cff78fba1a294e0d384274be479 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 21 Sep 2021 21:06:07 -0400 Subject: [PATCH 606/766] Prevent large ArrayLists from growing on collision checks See #2540 - not confirmed to be resolved as we weren't able to replicate a cause for this issue but this solved the issue from artifically invoking it. --- .../network/session/GeyserSession.java | 2 +- .../network/session/cache/PistonCache.java | 2 +- .../player/BedrockMovePlayerTranslator.java | 2 +- .../collision/CollisionManager.java | 25 ++++++++++++------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index c9c42e756..97773458c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -929,7 +929,7 @@ public class GeyserSession implements CommandSender { // Check to see if the player's position needs updating - a position update should be sent once every 3 seconds if (spawned && (System.currentTimeMillis() - lastMovementTimestamp) > 3000) { // Recalculate in case something else changed position - Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround()); + Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround(), false); // A null return value cancels the packet if (position != null) { ClientPlayerPositionPacket packet = new ClientPlayerPositionPacket(playerEntity.isOnGround(), diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java index aa929759c..a0bed9ad4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java @@ -150,7 +150,7 @@ public class PistonCache { Vector3d delta = totalDisplacement.sub(playerDisplacement); // Check if the piston is pushing a player into collision - delta = session.getCollisionManager().correctPlayerMovement(delta, true); + delta = session.getCollisionManager().correctPlayerMovement(delta, true, false); session.getCollisionManager().getPlayerBoundingBox().translate(delta.getX(), delta.getY(), delta.getZ()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index b0ab3f1e4..869af9ae6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -97,7 +97,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator Date: Wed, 22 Sep 2021 08:56:47 -0400 Subject: [PATCH 607/766] Just deploy connector while something is borked for the other projects --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 325fb977b..4d6731831 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } - /*stage ('Deploy') { + stage ('Deploy') { when { branch "master" } @@ -40,7 +40,7 @@ pipeline { ) rtMavenRun( pom: 'pom.xml', - goals: 'javadoc:jar source:jar install -DskipTests', + goals: 'javadoc:jar source:jar install -pl connector -am -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) @@ -48,7 +48,7 @@ pipeline { serverId: "opencollab-artifactory" ) } - }*/ + } } post { From 3d473a4939f4cba3b6780c6176481772df95ad43 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 09:03:42 -0400 Subject: [PATCH 608/766] Temporarily remove Javadoc jar too I guess --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4d6731831..0c74cf736 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { ) rtMavenRun( pom: 'pom.xml', - goals: 'javadoc:jar source:jar install -pl connector -am -DskipTests', + goals: 'source:jar install -pl connector -am -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) From c9b6d945d2d37b9b88d24f55ce8e0c36eead56bf Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 10:17:11 -0400 Subject: [PATCH 609/766] Another attempt to get some deploying down --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0c74cf736..b88a78abb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { ) rtMavenRun( pom: 'pom.xml', - goals: 'source:jar install -pl connector -am -DskipTests', + goals: 'javadoc:jar source:jar install -pl :connector -am -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) From f1d702b78ab0e11caa4744776d3145905ce8690f Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:24:44 -0400 Subject: [PATCH 610/766] Fully re-enable deploying --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b88a78abb..0b77fa9c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { ) rtMavenRun( pom: 'pom.xml', - goals: 'javadoc:jar source:jar install -pl :connector -am -DskipTests', + goals: 'javadoc:jar source:jar install -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) From 9f95178b58b3d66e9e554268c3b619909639bd9c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:43:06 -0400 Subject: [PATCH 611/766] Return to main develop branch of Protocol --- connector/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/pom.xml b/connector/pom.xml index 845cd334a..63350173f 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -115,7 +115,7 @@ com.github.CloudburstMC.Protocol bedrock-v465 - v1.17.30-d29a058370-1 + fa9d104 compile From 94af039f715effc5fafebdd78f836a68a2ea3d69 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:54:17 -0400 Subject: [PATCH 612/766] Just deploy connector --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b77fa9c4..b88a78abb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { ) rtMavenRun( pom: 'pom.xml', - goals: 'javadoc:jar source:jar install -DskipTests', + goals: 'javadoc:jar source:jar install -pl :connector -am -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) From 82bb6ad61fb95a3c4ea10aba08e463d02e07449c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 15:11:14 -0400 Subject: [PATCH 613/766] Fix furnace minecart custom item for 1.17.30 --- .../registry/populator/ItemRegistryPopulator.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index f03826458..65fa1e5a0 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -100,7 +100,7 @@ public class ItemRegistryPopulator { for (Map.Entry palette : PALETTE_VERSIONS.entrySet()) { stream = FileUtils.getResource(String.format("bedrock/runtime_item_states.%s.json", palette.getKey())); - TypeReference> paletteEntriesType = new TypeReference>() { }; + TypeReference> paletteEntriesType = new TypeReference<>() {}; // Used to get the Bedrock namespaced ID (in instances where there are small differences) Object2IntMap bedrockIdentifierToId = new Object2IntOpenHashMap<>(); @@ -470,9 +470,17 @@ public class ItemRegistryPopulator { builder.putString("name", "geysermc:furnace_minecart") .putInt("id", furnaceMinecartId); + NbtMapBuilder itemProperties = NbtMap.builder(); + NbtMapBuilder componentBuilder = NbtMap.builder(); // Conveniently, as of 1.16.200, the furnace minecart has a texture AND translation string already. - componentBuilder.putCompound("minecraft:icon", NbtMap.builder().putString("texture", "minecart_furnace").build()); + // 1.17.30 moves the icon to the item properties section + (palette.getValue().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion() ? + itemProperties : componentBuilder).putCompound("minecraft:icon", NbtMap.builder() + .putString("texture", "minecart_furnace") + .putString("frame", "0.000000") + .putInt("frame_version", 1) + .putString("legacy_id", "").build()); componentBuilder.putCompound("minecraft:display_name", NbtMap.builder().putString("value", "item.minecartFurnace.name").build()); // Indicate that the arm animation should play on rails @@ -483,7 +491,6 @@ public class ItemRegistryPopulator { .putList("use_on", NbtType.COMPOUND, useOnTag) .build()); - NbtMapBuilder itemProperties = NbtMap.builder(); // We always want to allow offhand usage when we can - matches Java Edition itemProperties.putBoolean("allow_off_hand", true); itemProperties.putBoolean("hand_equipped", false); From 27a17ff18376257b5b5abd0ab0f553fe13b3bef5 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Sep 2021 19:27:49 -0400 Subject: [PATCH 614/766] Fix firework stars being unobtainable from the creative menu --- .../org/geysermc/connector/registry/type/ItemMappings.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java index 767b6b2e0..bffe415a1 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java @@ -121,8 +121,9 @@ public class ItemMappings { } } else { if (!(mapping.getBedrockData() == data.getDamage() || - // Make exceptions for potions and tipped arrows, whose damage values can vary - (mapping.getJavaIdentifier().endsWith("potion") || mapping.getJavaIdentifier().equals("minecraft:arrow")))) { + // Make exceptions for potions, tipped arrows, and firework stars, whose damage values can vary + (mapping.getJavaIdentifier().endsWith("potion") || mapping.getJavaIdentifier().equals("minecraft:arrow") + || mapping.getJavaIdentifier().equals("minecraft:firework_star")))) { continue; } } From 85a57623648647f0b8e12679ada55e0ee1f7fb8b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 23 Sep 2021 17:52:22 -0400 Subject: [PATCH 615/766] Don't allow blank messages to be sent Fixes #2546 --- .../network/translators/bedrock/BedrockTextTranslator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java index 775a40114..221fc39c1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java @@ -40,6 +40,11 @@ public class BedrockTextTranslator extends PacketTranslator { public void translate(GeyserSession session, TextPacket packet) { String message = packet.getMessage(); + if (message.isBlank()) { + // Java Edition (as of 1.17.1) just doesn't pass on these messages, so... we won't either! + return; + } + if (MessageTranslator.isTooLong(message, session)) { return; } From f6313dd0ac5a0e4861a65a62798c8eccb4fbda0a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 23 Sep 2021 17:53:57 -0400 Subject: [PATCH 616/766] Use old MCProtocolLib, etc. commits for now While we work out the kinks! --- connector/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 63350173f..b77a94a2e 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -141,13 +141,13 @@ - com.github.GeyserMC + com.github.RednedEpic MCAuthLib 6c99331 compile - com.github.GeyserMC + com.github.RednedEpic MCProtocolLib e17787a compile @@ -167,7 +167,7 @@ - com.github.GeyserMC + com.github.RednedEpic PacketLib 9d4b476 compile From 67c93dcc8c47826fae8a0613c7b531ec5c51717b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 25 Sep 2021 14:56:37 -0400 Subject: [PATCH 617/766] Add new map colors Also fix our map colors, which appear to in fact be RGB for both Java and Bedrock. Fixes #2468 --- .../java/world/JavaMapDataTranslator.java | 2 +- .../geysermc/connector/utils/MapColor.java | 438 +++++++++--------- 2 files changed, 226 insertions(+), 214 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java index 984d85d04..7dfa08266 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java @@ -67,7 +67,7 @@ public class JavaMapDataTranslator extends PacketTranslator int idx = 0; for (byte colorId : data.getData()) { - colors[idx++] = MapColor.fromId(colorId & 0xFF).toABGR(); + colors[idx++] = MapColor.fromId(colorId & 0xFF).toARGB(); } mapItemDataPacket.setColors(colors); diff --git a/connector/src/main/java/org/geysermc/connector/utils/MapColor.java b/connector/src/main/java/org/geysermc/connector/utils/MapColor.java index 893aa0b85..5e70b1436 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MapColor.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MapColor.java @@ -30,238 +30,250 @@ public enum MapColor { COLOR_1(-1, -1, -1), COLOR_2(-1, -1, -1), COLOR_3(-1, -1, -1), - COLOR_4(90, 126, 40), - COLOR_5(110, 154, 48), - COLOR_6(127, 178, 56), - COLOR_7(67, 94, 30), - COLOR_8(174, 164, 115), - COLOR_9(213, 201, 141), - COLOR_10(247, 233, 163), - COLOR_11(131, 123, 86), + COLOR_4(39, 125, 89), + COLOR_5(48, 153, 109), + COLOR_6(56, 178, 127), + COLOR_7(29, 94, 67), + COLOR_8(115, 164, 174), + COLOR_9(140, 201, 213), + COLOR_10(163, 233, 247), + COLOR_11(86, 123, 130), COLOR_12(140, 140, 140), - COLOR_13(172, 172, 172), + COLOR_13(171, 171, 171), COLOR_14(199, 199, 199), COLOR_15(105, 105, 105), - COLOR_16(180, 0, 0), - COLOR_17(220, 0, 0), - COLOR_18(255, 0, 0), - COLOR_19(135, 0, 0), - COLOR_20(113, 113, 180), - COLOR_21(138, 138, 220), - COLOR_22(160, 160, 255), - COLOR_23(85, 85, 135), - COLOR_24(118, 118, 118), + COLOR_16(0, 0, 180), + COLOR_17(0, 0, 220), + COLOR_18(0, 0, 255), + COLOR_19(0, 0, 135), + COLOR_20(180, 112, 112), + COLOR_21(220, 138, 138), + COLOR_22(255, 160, 160), + COLOR_23(135, 84, 84), + COLOR_24(117, 117, 117), COLOR_25(144, 144, 144), COLOR_26(167, 167, 167), COLOR_27(88, 88, 88), - COLOR_28(0, 88, 0), - COLOR_29(0, 107, 0), + COLOR_28(0, 87, 0), + COLOR_29(0, 106, 0), COLOR_30(0, 124, 0), - COLOR_31(0, 66, 0), + COLOR_31(0, 65, 0), COLOR_32(180, 180, 180), COLOR_33(220, 220, 220), COLOR_34(255, 255, 255), COLOR_35(135, 135, 135), - COLOR_36(116, 119, 130), - COLOR_37(141, 145, 159), - COLOR_38(164, 168, 184), - COLOR_39(87, 89, 97), - COLOR_40(107, 77, 54), - COLOR_41(130, 94, 66), - COLOR_42(151, 109, 77), - COLOR_43(80, 58, 41), + COLOR_36(129, 118, 115), + COLOR_37(158, 144, 141), + COLOR_38(184, 168, 164), + COLOR_39(97, 88, 86), + COLOR_40(54, 76, 106), + COLOR_41(66, 94, 130), + COLOR_42(77, 109, 151), + COLOR_43(40, 57, 79), COLOR_44(79, 79, 79), - COLOR_45(97, 97, 97), + COLOR_45(96, 96, 96), COLOR_46(112, 112, 112), COLOR_47(59, 59, 59), - COLOR_48(45, 45, 180), - COLOR_49(55, 55, 220), - COLOR_50(64, 64, 255), - COLOR_51(34, 34, 135), - COLOR_52(101, 84, 51), - COLOR_53(123, 103, 62), - COLOR_54(143, 119, 72), - COLOR_55(76, 63, 38), - COLOR_56(180, 178, 173), - COLOR_57(220, 217, 211), - COLOR_58(255, 252, 245), - COLOR_59(135, 133, 130), - COLOR_60(152, 90, 36), - COLOR_61(186, 110, 44), - COLOR_62(216, 127, 51), - COLOR_63(114, 67, 27), - COLOR_64(126, 54, 152), - COLOR_65(154, 66, 186), - COLOR_66(178, 76, 216), - COLOR_67(94, 40, 114), - COLOR_68(72, 108, 152), - COLOR_69(88, 132, 186), - COLOR_70(102, 153, 216), - COLOR_71(54, 81, 114), - COLOR_72(162, 162, 36), - COLOR_73(198, 198, 44), - COLOR_74(229, 229, 51), - COLOR_75(121, 121, 27), - COLOR_76(90, 144, 18), - COLOR_77(110, 176, 22), - COLOR_78(127, 204, 25), - COLOR_79(67, 108, 13), - COLOR_80(171, 90, 116), - COLOR_81(209, 110, 142), - COLOR_82(242, 127, 165), - COLOR_83(128, 67, 87), - COLOR_84(54, 54, 54), - COLOR_85(66, 66, 66), + COLOR_48(180, 45, 45), + COLOR_49(220, 55, 55), + COLOR_50(255, 64, 64), + COLOR_51(135, 33, 33), + COLOR_52(50, 84, 100), + COLOR_53(62, 102, 123), + COLOR_54(72, 119, 143), + COLOR_55(38, 63, 75), + COLOR_56(172, 177, 180), + COLOR_57(211, 217, 220), + COLOR_58(245, 252, 255), + COLOR_59(129, 133, 135), + COLOR_60(36, 89, 152), + COLOR_61(44, 109, 186), + COLOR_62(51, 127, 216), + COLOR_63(27, 67, 114), + COLOR_64(152, 53, 125), + COLOR_65(186, 65, 153), + COLOR_66(216, 76, 178), + COLOR_67(114, 40, 94), + COLOR_68(152, 108, 72), + COLOR_69(186, 132, 88), + COLOR_70(216, 153, 102), + COLOR_71(114, 81, 54), + COLOR_72(36, 161, 161), + COLOR_73(44, 197, 197), + COLOR_74(51, 229, 229), + COLOR_75(27, 121, 121), + COLOR_76(17, 144, 89), + COLOR_77(21, 176, 109), + COLOR_78(25, 204, 127), + COLOR_79(13, 108, 67), + COLOR_80(116, 89, 170), + COLOR_81(142, 109, 208), + COLOR_82(165, 127, 242), + COLOR_83(87, 67, 128), + COLOR_84(53, 53, 53), + COLOR_85(65, 65, 65), COLOR_86(76, 76, 76), COLOR_87(40, 40, 40), COLOR_88(108, 108, 108), COLOR_89(132, 132, 132), COLOR_90(153, 153, 153), COLOR_91(81, 81, 81), - COLOR_92(54, 90, 108), - COLOR_93(66, 110, 132), - COLOR_94(76, 127, 153), - COLOR_95(40, 67, 81), - COLOR_96(90, 44, 126), - COLOR_97(110, 54, 154), - COLOR_98(127, 63, 178), - COLOR_99(67, 33, 94), - COLOR_100(36, 54, 126), - COLOR_101(44, 66, 154), - COLOR_102(51, 76, 178), - COLOR_103(27, 40, 94), - COLOR_104(72, 54, 36), - COLOR_105(88, 66, 44), - COLOR_106(102, 76, 51), - COLOR_107(54, 40, 27), - COLOR_108(72, 90, 36), - COLOR_109(88, 110, 44), - COLOR_110(102, 127, 51), - COLOR_111(54, 67, 27), - COLOR_112(108, 36, 36), - COLOR_113(132, 44, 44), - COLOR_114(153, 51, 51), - COLOR_115(81, 27, 27), - COLOR_116(18, 18, 18), - COLOR_117(22, 22, 22), + COLOR_92(108, 89, 53), + COLOR_93(132, 109, 65), + COLOR_94(153, 127, 76), + COLOR_95(81, 67, 40), + COLOR_96(125, 44, 89), + COLOR_97(153, 54, 109), + COLOR_98(178, 63, 127), + COLOR_99(94, 33, 67), + COLOR_100(125, 53, 36), + COLOR_101(153, 65, 44), + COLOR_102(178, 76, 51), + COLOR_103(94, 40, 27), + COLOR_104(36, 53, 72), + COLOR_105(44, 65, 88), + COLOR_106(51, 76, 102), + COLOR_107(27, 40, 54), + COLOR_108(36, 89, 72), + COLOR_109(44, 109, 88), + COLOR_110(51, 127, 102), + COLOR_111(27, 67, 54), + COLOR_112(36, 36, 108), + COLOR_113(44, 44, 132), + COLOR_114(51, 51, 153), + COLOR_115(27, 27, 81), + COLOR_116(17, 17, 17), + COLOR_117(21, 21, 21), COLOR_118(25, 25, 25), COLOR_119(13, 13, 13), - COLOR_120(176, 168, 54), - COLOR_121(216, 205, 66), - COLOR_122(250, 238, 77), - COLOR_123(132, 126, 41), - COLOR_124(65, 155, 150), - COLOR_125(79, 189, 184), - COLOR_126(92, 219, 213), - COLOR_127(49, 116, 113), - COLOR_128(52, 90, 180), - COLOR_129(64, 110, 220), - COLOR_130(74, 128, 255), - COLOR_131(39, 68, 135), - COLOR_132(0, 153, 41), - COLOR_133(0, 187, 50), - COLOR_134(0, 217, 58), - COLOR_135(0, 115, 31), - COLOR_136(91, 61, 35), - COLOR_137(111, 74, 42), - COLOR_138(129, 86, 49), - COLOR_139(68, 46, 26), - COLOR_140(79, 1, 0), - COLOR_141(97, 2, 0), - COLOR_142(112, 2, 0), - COLOR_143(59, 1, 0), - COLOR_144(148, 125, 114), - COLOR_145(180, 153, 139), - COLOR_146(209, 177, 161), - COLOR_147(111, 94, 85), - COLOR_148(112, 58, 25), - COLOR_149(137, 71, 31), - COLOR_150(159, 82, 36), - COLOR_151(84, 43, 19), - COLOR_152(105, 61, 76), - COLOR_153(129, 75, 93), - COLOR_154(149, 87, 108), - COLOR_155(79, 46, 57), - COLOR_156(79, 76, 97), - COLOR_157(97, 93, 119), - COLOR_158(112, 108, 138), - COLOR_159(59, 57, 73), - COLOR_160(131, 94, 25), - COLOR_161(160, 115, 31), - COLOR_162(186, 133, 36), - COLOR_163(98, 70, 19), - COLOR_164(73, 83, 37), - COLOR_165(89, 101, 46), - COLOR_166(103, 117, 53), - COLOR_167(55, 62, 28), - COLOR_168(113, 54, 55), - COLOR_169(138, 66, 67), - COLOR_170(160, 77, 78), - COLOR_171(85, 41, 41), - COLOR_172(40, 29, 25), - COLOR_173(49, 35, 30), - COLOR_174(57, 41, 35), - COLOR_175(30, 22, 19), - COLOR_176(95, 76, 69), - COLOR_177(116, 92, 85), - COLOR_178(135, 107, 98), - COLOR_179(71, 57, 52), - COLOR_180(61, 65, 65), - COLOR_181(75, 79, 79), - COLOR_182(87, 92, 92), - COLOR_183(46, 49, 49), - COLOR_184(86, 52, 62), - COLOR_185(105, 63, 76), - COLOR_186(122, 73, 88), - COLOR_187(65, 39, 47), - COLOR_188(54, 44, 65), - COLOR_189(66, 53, 79), - COLOR_190(76, 62, 92), - COLOR_191(40, 33, 49), - COLOR_192(54, 35, 25), - COLOR_193(66, 43, 30), - COLOR_194(76, 50, 35), - COLOR_195(40, 26, 19), - COLOR_196(54, 58, 30), - COLOR_197(66, 71, 36), - COLOR_198(76, 82, 42), - COLOR_199(40, 43, 22), - COLOR_200(100, 42, 32), - COLOR_201(123, 52, 40), - COLOR_202(142, 60, 46), - COLOR_203(75, 32, 24), - COLOR_204(26, 16, 11), - COLOR_205(32, 19, 14), - COLOR_206(37, 22, 16), - COLOR_207(20, 12, 8), - COLOR_208(133, 34, 35), - COLOR_209(163, 41, 42), - COLOR_210(189, 48, 49), - COLOR_211(100, 25, 26), - COLOR_212(104, 44, 68), - COLOR_213(128, 54, 84), - COLOR_214(148, 63, 97), - COLOR_215(78, 33, 51), - COLOR_216(65, 18, 20), - COLOR_217(79, 22, 25), - COLOR_218(92, 25, 29), - COLOR_219(49, 13, 15), - COLOR_220(16, 89, 95), - COLOR_221(19, 109, 116), - COLOR_222(22, 126, 134), - COLOR_223(12, 67, 71), - COLOR_224(41, 100, 99), - COLOR_225(50, 123, 121), - COLOR_226(58, 142, 140), - COLOR_227(31, 75, 74), - COLOR_228(61, 31, 44), - COLOR_229(74, 38, 53), - COLOR_230(86, 44, 62), - COLOR_231(46, 23, 33), - COLOR_232(14, 127, 94), - COLOR_233(17, 155, 115), - COLOR_234(20, 180, 133), - COLOR_235(11, 95, 70); + COLOR_120(54, 168, 176), + COLOR_121(66, 205, 215), + COLOR_122(77, 238, 250), + COLOR_123(40, 126, 132), + COLOR_124(150, 154, 64), + COLOR_125(183, 188, 79), + COLOR_126(213, 219, 92), + COLOR_127(112, 115, 48), + COLOR_128(180, 90, 52), + COLOR_129(220, 110, 63), + COLOR_130(255, 128, 74), + COLOR_131(135, 67, 39), + COLOR_132(40, 153, 0), + COLOR_133(50, 187, 0), + COLOR_134(58, 217, 0), + COLOR_135(30, 114, 0), + COLOR_136(34, 60, 91), + COLOR_137(42, 74, 111), + COLOR_138(49, 86, 129), + COLOR_139(25, 45, 68), + COLOR_140(0, 1, 79), + COLOR_141(0, 1, 96), + COLOR_142(0, 2, 112), + COLOR_143(0, 1, 59), + COLOR_144(113, 124, 147), + COLOR_145(138, 152, 180), + COLOR_146(161, 177, 209), + COLOR_147(85, 93, 110), + COLOR_148(25, 57, 112), + COLOR_149(31, 70, 137), + COLOR_150(36, 82, 159), + COLOR_151(19, 43, 84), + COLOR_152(76, 61, 105), + COLOR_153(93, 75, 128), + COLOR_154(108, 87, 149), + COLOR_155(57, 46, 78), + COLOR_156(97, 76, 79), + COLOR_157(119, 93, 96), + COLOR_158(138, 108, 112), + COLOR_159(73, 57, 59), + COLOR_160(25, 93, 131), + COLOR_161(31, 114, 160), + COLOR_162(36, 133, 186), + COLOR_163(19, 70, 98), + COLOR_164(37, 82, 72), + COLOR_165(45, 100, 88), + COLOR_166(53, 117, 103), + COLOR_167(28, 61, 54), + COLOR_168(55, 54, 112), + COLOR_169(67, 66, 138), + COLOR_170(78, 77, 160), + COLOR_171(41, 40, 84), + COLOR_172(24, 28, 40), + COLOR_173(30, 35, 49), + COLOR_174(35, 41, 57), + COLOR_175(18, 21, 30), + COLOR_176(69, 75, 95), + COLOR_177(84, 92, 116), + COLOR_178(98, 107, 135), + COLOR_179(51, 56, 71), + COLOR_180(64, 64, 61), + COLOR_181(79, 79, 75), + COLOR_182(92, 92, 87), + COLOR_183(48, 48, 46), + COLOR_184(62, 51, 86), + COLOR_185(75, 62, 105), + COLOR_186(88, 73, 122), + COLOR_187(46, 38, 64), + COLOR_188(64, 43, 53), + COLOR_189(79, 53, 65), + COLOR_190(92, 62, 76), + COLOR_191(48, 32, 40), + COLOR_192(24, 35, 53), + COLOR_193(30, 43, 65), + COLOR_194(35, 50, 76), + COLOR_195(18, 26, 40), + COLOR_196(29, 57, 53), + COLOR_197(36, 70, 65), + COLOR_198(42, 82, 76), + COLOR_199(22, 43, 40), + COLOR_200(32, 42, 100), + COLOR_201(39, 51, 122), + COLOR_202(46, 60, 142), + COLOR_203(24, 31, 75), + COLOR_204(11, 15, 26), + COLOR_205(13, 18, 31), + COLOR_206(16, 22, 37), + COLOR_207(8, 11, 19), + COLOR_208(34, 33, 133), + COLOR_209(42, 41, 163), + COLOR_210(49, 48, 189), + COLOR_211(25, 25, 100), + COLOR_212(68, 44, 104), + COLOR_213(83, 54, 127), + COLOR_214(97, 63, 148), + COLOR_215(51, 33, 78), + COLOR_216(20, 17, 64), + COLOR_217(25, 21, 79), + COLOR_218(29, 25, 92), + COLOR_219(15, 13, 48), + COLOR_220(94, 88, 15), + COLOR_221(115, 108, 18), + COLOR_222(134, 126, 22), + COLOR_223(70, 66, 11), + COLOR_224(98, 100, 40), + COLOR_225(120, 122, 50), + COLOR_226(140, 142, 58), + COLOR_227(74, 75, 30), + COLOR_228(43, 31, 60), + COLOR_229(53, 37, 74), + COLOR_230(62, 44, 86), + COLOR_231(32, 23, 45), + COLOR_232(93, 127, 14), + COLOR_233(114, 155, 17), + COLOR_234(133, 180, 20), + COLOR_235(70, 95, 10), + COLOR_236(70, 70, 70), + COLOR_237(86, 86, 86), + COLOR_238(100, 100, 100), + COLOR_239(52, 52, 52), + COLOR_240(103, 123, 152), + COLOR_241(126, 150, 186), + COLOR_242(147, 175, 216), + COLOR_243(77, 92, 114), + COLOR_244(105, 117, 89), + COLOR_245(129, 144, 109), + COLOR_246(150, 167, 127), + COLOR_247(79, 88, 67); private static final MapColor[] VALUES = values(); @@ -279,14 +291,14 @@ public enum MapColor { return id >= 0 && id < VALUES.length ? VALUES[id] : COLOR_0; } - public int toABGR() { + public int toARGB() { int alpha = 255; if (red == -1 && green == -1 && blue == -1) alpha = 0; // transparent return ((alpha & 0xFF) << 24) | - ((blue & 0xFF) << 16) | + ((red & 0xFF) << 16) | ((green & 0xFF) << 8) | - (red & 0xFF); + (blue & 0xFF); } } \ No newline at end of file From 6f4d433561b21de8ad2a9bf48d972249c8e2d6d3 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 25 Sep 2021 15:02:08 -0400 Subject: [PATCH 618/766] We don't need to store each individual RGB color for maps --- .../java/world/JavaMapDataTranslator.java | 2 +- .../geysermc/connector/utils/MapColor.java | 26 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java index 7dfa08266..0bed6a28b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java @@ -67,7 +67,7 @@ public class JavaMapDataTranslator extends PacketTranslator int idx = 0; for (byte colorId : data.getData()) { - colors[idx++] = MapColor.fromId(colorId & 0xFF).toARGB(); + colors[idx++] = MapColor.fromId(colorId & 0xFF).getARGB(); } mapItemDataPacket.setColors(colors); diff --git a/connector/src/main/java/org/geysermc/connector/utils/MapColor.java b/connector/src/main/java/org/geysermc/connector/utils/MapColor.java index 5e70b1436..2a7c34888 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MapColor.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MapColor.java @@ -277,28 +277,24 @@ public enum MapColor { private static final MapColor[] VALUES = values(); - private final int red; - private final int green; - private final int blue; + private final int value; MapColor(int red, int green, int blue) { - this.red = red; - this.green = green; - this.blue = blue; + int alpha = 255; + if (red == -1 && green == -1 && blue == -1) + alpha = 0; // transparent + + this.value = ((alpha & 0xFF) << 24) | + ((red & 0xFF) << 16) | + ((green & 0xFF) << 8) | + (blue & 0xFF); } public static MapColor fromId(int id) { return id >= 0 && id < VALUES.length ? VALUES[id] : COLOR_0; } - public int toARGB() { - int alpha = 255; - if (red == -1 && green == -1 && blue == -1) - alpha = 0; // transparent - - return ((alpha & 0xFF) << 24) | - ((red & 0xFF) << 16) | - ((green & 0xFF) << 8) | - (blue & 0xFF); + public int getARGB() { + return value; } } \ No newline at end of file From 9a8795988fff4b05fa771121bafee00971f5ab5a Mon Sep 17 00:00:00 2001 From: David Choo Date: Sun, 26 Sep 2021 10:16:22 -0400 Subject: [PATCH 619/766] Movement checks (#2547) This avoids ArrayList allocations and https://github.com/GeyserMC/Geyser/issues/2540. --- .../connector/entity/FishingHookEntity.java | 19 ++-- .../player/BedrockMovePlayerTranslator.java | 30 +++---- .../translators/collision/BoundingBox.java | 20 +++-- .../collision/CollisionManager.java | 86 +++++++------------ .../collision/translators/BlockCollision.java | 57 +++--------- .../translators/DirtPathCollision.java | 4 +- .../collision/translators/DoorCollision.java | 10 +-- .../translators/ScaffoldingCollision.java | 6 +- .../collision/translators/SnowCollision.java | 12 +-- .../translators/TrapdoorCollision.java | 12 +-- .../world/block/entity/PistonBlockEntity.java | 34 ++++---- .../utils/BlockPositionIterator.java | 82 ++++++++++++++++++ .../geysermc/connector/utils/BlockUtils.java | 25 ++---- 13 files changed, 199 insertions(+), 198 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index 91c3d401a..565614143 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -27,7 +27,6 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; @@ -35,13 +34,12 @@ import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionManager; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.utils.BlockPositionIterator; import org.geysermc.connector.utils.BlockUtils; -import java.util.List; import java.util.concurrent.ThreadLocalRandom; public class FishingHookEntity extends ThrowableEntity { @@ -91,19 +89,16 @@ public class FishingHookEntity extends ThrowableEntity { boundingBox.setMiddleY(position.getY() + boundingBox.getSizeY() / 2); boundingBox.setMiddleZ(position.getZ()); - CollisionManager collisionManager = session.getCollisionManager(); - List collidableBlocks = collisionManager.getCollidableBlocks(boundingBox); boolean touchingWater = false; boolean collided = false; - for (Vector3i blockPos : collidableBlocks) { - int blockID = session.getConnector().getWorldManager().getBlockAt(session, blockPos); - BlockCollision blockCollision = BlockUtils.getCollision(blockID, blockPos); + for (BlockPositionIterator iter = session.getCollisionManager().collidableBlocksIterator(boundingBox); iter.hasNext(); iter.next()) { + int blockID = session.getConnector().getWorldManager().getBlockAt(session, iter.getX(), iter.getY(), iter.getZ()); + BlockCollision blockCollision = BlockUtils.getCollision(blockID); if (blockCollision != null) { - if (blockCollision.checkIntersection(boundingBox)) { + if (blockCollision.checkIntersection(iter.getX(), iter.getY(), iter.getZ(), boundingBox)) { // TODO Push bounding box out of collision to improve movement collided = true; } - blockCollision.reset(); } int waterLevel = BlockStateValues.getWaterLevel(blockID); @@ -111,10 +106,10 @@ public class FishingHookEntity extends ThrowableEntity { waterLevel = 0; } if (waterLevel >= 0) { - double waterMaxY = blockPos.getY() + 1 - (waterLevel + 1) / 9.0; + double waterMaxY = iter.getY() + 1 - (waterLevel + 1) / 9.0; // Falling water is a full block if (waterLevel >= 8) { - waterMaxY = blockPos.getY() + 1; + waterMaxY = iter.getY() + 1; } if (position.getY() <= waterMaxY) { touchingWater = true; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index 869af9ae6..f70233c04 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -73,7 +73,10 @@ public class BedrockMovePlayerTranslator extends PacketTranslator 100) { + private boolean isValidMove(GeyserSession session, Vector3f currentPosition, Vector3f newPosition) { + if (isInvalidNumber(newPosition.getX()) || isInvalidNumber(newPosition.getY()) || isInvalidNumber(newPosition.getZ())) { + return false; + } + if (currentPosition.distanceSquared(newPosition) > 300) { session.getConnector().getLogger().debug(ChatColor.RED + session.getName() + " moved too quickly." + " current position: " + currentPosition + ", new position: " + newPosition); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java index 27c200a99..e74953b7a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java @@ -89,39 +89,41 @@ public class BoundingBox implements Cloneable { return Vector3d.from(middleX, middleY - sizeY / 2, middleZ); } - private boolean checkOverlapInAxis(Vector3d offset, BoundingBox otherBox, Axis axis) { + private boolean checkOverlapInAxis(double xOffset, double yOffset, double zOffset, BoundingBox otherBox, Axis axis) { return switch (axis) { - case X -> Math.abs((middleX + offset.getX()) - otherBox.getMiddleX()) * 2 < (sizeX + otherBox.getSizeX()); - case Y -> Math.abs((middleY + offset.getY()) - otherBox.getMiddleY()) * 2 < (sizeY + otherBox.getSizeY()); - case Z -> Math.abs((middleZ + offset.getZ()) - otherBox.getMiddleZ()) * 2 < (sizeZ + otherBox.getSizeZ()); + case X -> Math.abs((middleX + xOffset) - otherBox.getMiddleX()) * 2 < (sizeX + otherBox.getSizeX()); + case Y -> Math.abs((middleY + yOffset) - otherBox.getMiddleY()) * 2 < (sizeY + otherBox.getSizeY()); + case Z -> Math.abs((middleZ + zOffset) - otherBox.getMiddleZ()) * 2 < (sizeZ + otherBox.getSizeZ()); }; } /** * Find the maximum offset of another bounding box in an axis that will not collide with this bounding box * - * @param boxOffset The offset of this bounding box + * @param xOffset The x offset of this bounding box + * @param yOffset The y offset of this bounding box + * @param zOffset The z offset of this bounding box * @param otherBoundingBox The bounding box that is moving * @param axis The axis of movement * @param offset The current max offset * @return The new max offset */ - public double getMaxOffset(Vector3d boxOffset, BoundingBox otherBoundingBox, Axis axis, double offset) { + public double getMaxOffset(double xOffset, double yOffset, double zOffset, BoundingBox otherBoundingBox, Axis axis, double offset) { // Make sure that the bounding box overlaps in the other axes for (Axis a : Axis.VALUES) { - if (a != axis && !checkOverlapInAxis(boxOffset, otherBoundingBox, a)) { + if (a != axis && !checkOverlapInAxis(xOffset, yOffset, zOffset, otherBoundingBox, a)) { return offset; } } if (offset > 0) { - double min = axis.choose(getMin().add(boxOffset)); + double min = axis.choose(getMin().add(xOffset, yOffset, zOffset)); double max = axis.choose(otherBoundingBox.getMax()); if ((min - max) >= -2.0 * CollisionManager.COLLISION_TOLERANCE) { offset = Math.min(min - max, offset); } } else if (offset < 0) { double min = axis.choose(otherBoundingBox.getMin()); - double max = axis.choose(getMax().add(boxOffset)); + double max = axis.choose(getMax().add(xOffset, yOffset, zOffset)); if ((min - max) >= -2.0 * CollisionManager.COLLISION_TOLERANCE) { offset = Math.max(max - min, offset); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index 9b3641566..bb9303447 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -42,13 +42,12 @@ import org.geysermc.connector.network.session.cache.PistonCache; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; import org.geysermc.connector.network.translators.collision.translators.ScaffoldingCollision; import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.connector.utils.BlockPositionIterator; import org.geysermc.connector.utils.BlockUtils; import org.geysermc.connector.utils.Axis; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; -import java.util.ArrayList; -import java.util.List; import java.util.Locale; public class CollisionManager { @@ -133,6 +132,7 @@ public class CollisionManager { * * @param bedrockPosition the current Bedrock position of the client * @param onGround whether the Bedrock player is on the ground + * @param teleported whether the Bedrock player has teleported to a new position. If true, movement correction is skipped. * @return the position to send to the Java server, or null to cancel sending the packet */ public Vector3d adjustBedrockPosition(Vector3f bedrockPosition, boolean onGround, boolean teleported) { @@ -201,9 +201,7 @@ public class CollisionManager { session.sendUpstreamPacket(movePlayerPacket); } - public List getCollidableBlocks(BoundingBox box) { - List blocks = new ArrayList<>(); - + public BlockPositionIterator collidableBlocksIterator(BoundingBox box) { Vector3d position = Vector3d.from(box.getMiddleX(), box.getMiddleY() - (box.getSizeY() / 2), box.getMiddleZ()); @@ -211,42 +209,28 @@ public class CollisionManager { // Expand volume by 1 in each direction to include moving blocks double pistonExpand = session.getPistonCache().getPistons().isEmpty() ? 0 : 1; - // Ensure sizes cannot be too large - https://github.com/GeyserMC/Geyser/issues/2540 - double sizeX = Math.min(box.getSizeX(), 256); - double sizeY = Math.min(box.getSizeY(), 256); - double sizeZ = Math.min(box.getSizeZ(), 256); - // Loop through all blocks that could collide - int minCollisionX = (int) Math.floor(position.getX() - ((sizeX / 2) + COLLISION_TOLERANCE + pistonExpand)); - int maxCollisionX = (int) Math.floor(position.getX() + (sizeX / 2) + COLLISION_TOLERANCE + pistonExpand); + int minCollisionX = (int) Math.floor(position.getX() - ((box.getSizeX() / 2) + COLLISION_TOLERANCE + pistonExpand)); + int maxCollisionX = (int) Math.floor(position.getX() + (box.getSizeX() / 2) + COLLISION_TOLERANCE + pistonExpand); // Y extends 0.5 blocks down because of fence hitboxes int minCollisionY = (int) Math.floor(position.getY() - 0.5 - COLLISION_TOLERANCE - pistonExpand / 2.0); + int maxCollisionY = (int) Math.floor(position.getY() + box.getSizeY() + pistonExpand); - int maxCollisionY = (int) Math.floor(position.getY() + sizeY + pistonExpand); + int minCollisionZ = (int) Math.floor(position.getZ() - ((box.getSizeZ() / 2) + COLLISION_TOLERANCE + pistonExpand)); + int maxCollisionZ = (int) Math.floor(position.getZ() + (box.getSizeZ() / 2) + COLLISION_TOLERANCE + pistonExpand); - int minCollisionZ = (int) Math.floor(position.getZ() - ((sizeZ / 2) + COLLISION_TOLERANCE + pistonExpand)); - int maxCollisionZ = (int) Math.floor(position.getZ() + (sizeZ / 2) + COLLISION_TOLERANCE + pistonExpand); - - for (int y = minCollisionY; y < maxCollisionY + 1; y++) { - for (int x = minCollisionX; x < maxCollisionX + 1; x++) { - for (int z = minCollisionZ; z < maxCollisionZ + 1; z++) { - blocks.add(Vector3i.from(x, y, z)); - } - } - } - - return blocks; + return new BlockPositionIterator(minCollisionX, minCollisionY, minCollisionZ, maxCollisionX, maxCollisionY, maxCollisionZ); } - public List getPlayerCollidableBlocks() { - return getCollidableBlocks(playerBoundingBox); + public BlockPositionIterator playerCollidableBlocksIterator() { + return collidableBlocksIterator(playerBoundingBox); } /** * Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be * cancelled - * See {@link BlockCollision#correctPosition(GeyserSession, BoundingBox)} for more info + * See {@link BlockCollision#correctPosition(GeyserSession, int, int, int, BoundingBox)} for more info */ public boolean correctPlayerPosition() { @@ -254,25 +238,22 @@ public class CollisionManager { touchingScaffolding = false; onScaffolding = false; - List collidableBlocks = getPlayerCollidableBlocks(); - // Used when correction code needs to be run before the main correction - for (Vector3i blockPos : collidableBlocks) { - BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); + BlockPositionIterator iter = session.getCollisionManager().playerCollidableBlocksIterator(); + for (; iter.hasNext(); iter.next()) { + BlockCollision blockCollision = BlockUtils.getCollisionAt(session, iter.getX(), iter.getY(), iter.getZ()); if (blockCollision != null) { - blockCollision.beforeCorrectPosition(playerBoundingBox); - blockCollision.reset(); + blockCollision.beforeCorrectPosition(iter.getX(), iter.getY(), iter.getZ(), playerBoundingBox); } } // Main correction code - for (Vector3i blockPos : collidableBlocks) { - BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); + for (iter.reset(); iter.hasNext(); iter.next()) { + BlockCollision blockCollision = BlockUtils.getCollisionAt(session, iter.getX(), iter.getY(), iter.getZ()); if (blockCollision != null) { - if (!blockCollision.correctPosition(session, playerBoundingBox)) { + if (!blockCollision.correctPosition(session, iter.getX(), iter.getY(), iter.getZ(), playerBoundingBox)) { return false; } - blockCollision.reset(); } } @@ -341,24 +322,22 @@ public class CollisionManager { BoundingBox movementBoundingBox = boundingBox.clone(); movementBoundingBox.extend(movement); - - List collidableBlocks = getCollidableBlocks(movementBoundingBox); - + BlockPositionIterator iter = collidableBlocksIterator(movementBoundingBox); if (Math.abs(movementY) > CollisionManager.COLLISION_TOLERANCE) { - movementY = computeCollisionOffset(boundingBox, Axis.Y, movementY, collidableBlocks, checkWorld); + movementY = computeCollisionOffset(boundingBox, Axis.Y, movementY, iter, checkWorld); boundingBox.translate(0, movementY, 0); } boolean checkZFirst = Math.abs(movementZ) > Math.abs(movementX); if (checkZFirst && Math.abs(movementZ) > CollisionManager.COLLISION_TOLERANCE) { - movementZ = computeCollisionOffset(boundingBox, Axis.Z, movementZ, collidableBlocks, checkWorld); + movementZ = computeCollisionOffset(boundingBox, Axis.Z, movementZ, iter, checkWorld); boundingBox.translate(0, 0, movementZ); } if (Math.abs(movementX) > CollisionManager.COLLISION_TOLERANCE) { - movementX = computeCollisionOffset(boundingBox, Axis.X, movementX, collidableBlocks, checkWorld); + movementX = computeCollisionOffset(boundingBox, Axis.X, movementX, iter, checkWorld); boundingBox.translate(movementX, 0, 0); } if (!checkZFirst && Math.abs(movementZ) > CollisionManager.COLLISION_TOLERANCE) { - movementZ = computeCollisionOffset(boundingBox, Axis.Z, movementZ, collidableBlocks, checkWorld); + movementZ = computeCollisionOffset(boundingBox, Axis.Z, movementZ, iter, checkWorld); boundingBox.translate(0, 0, movementZ); } @@ -366,16 +345,18 @@ public class CollisionManager { return Vector3d.from(movementX, movementY, movementZ); } - private double computeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset, List collidableBlocks, boolean checkWorld) { - for (Vector3i blockPos : collidableBlocks) { + private double computeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset, BlockPositionIterator iter, boolean checkWorld) { + for (iter.reset(); iter.hasNext(); iter.next()) { + int x = iter.getX(); + int y = iter.getY(); + int z = iter.getZ(); if (checkWorld) { - BlockCollision blockCollision = BlockUtils.getCollisionAt(session, blockPos); + BlockCollision blockCollision = BlockUtils.getCollisionAt(session, x, y, z); if (blockCollision != null && !(blockCollision instanceof ScaffoldingCollision)) { - offset = blockCollision.computeCollisionOffset(boundingBox, axis, offset); - blockCollision.reset(); + offset = blockCollision.computeCollisionOffset(x, y, z, boundingBox, axis, offset); } } - offset = session.getPistonCache().computeCollisionOffset(blockPos, boundingBox, axis, offset); + offset = session.getPistonCache().computeCollisionOffset(Vector3i.from(x, y, z), boundingBox, axis, offset); if (Math.abs(offset) < COLLISION_TOLERANCE) { return 0; } @@ -399,9 +380,8 @@ public class CollisionManager { playerBoundingBox.setSizeY(EntityType.PLAYER.getHeight()); playerBoundingBox.setMiddleY(standingY); - boolean result = collision.checkIntersection(playerBoundingBox); + boolean result = collision.checkIntersection(position, playerBoundingBox); result |= session.getPistonCache().checkCollision(position, playerBoundingBox); - collision.reset(); playerBoundingBox.setSizeY(originalHeight); playerBoundingBox.setMiddleY(originalY); return result; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java index 0b23973e8..869ff97d3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java @@ -40,16 +40,6 @@ public class BlockCollision { @Getter protected final BoundingBox[] boundingBoxes; - @EqualsAndHashCode.Exclude - protected final ThreadLocal position; - - /** - * Store a Vector3d to allow the collision to be offset by a fractional amount - * This is used only in {@link #checkIntersection(BoundingBox)} and {@link #computeCollisionOffset(BoundingBox, Axis, double)} - */ - @EqualsAndHashCode.Exclude - protected final ThreadLocal positionOffset; - /** * This is used for the step up logic. * Usually, the player can only step up a block if they are on the same Y level as its bottom face or higher @@ -68,28 +58,13 @@ public class BlockCollision { protected BlockCollision(BoundingBox[] boxes) { this.boundingBoxes = boxes; - this.position = new ThreadLocal<>(); - this.positionOffset = new ThreadLocal<>(); - } - - public void setPosition(Vector3i newPosition) { - this.position.set(newPosition); - } - - public void setPositionOffset(Vector3d newOffset) { - this.positionOffset.set(newOffset); - } - - public void reset() { - this.position.set(null); - this.positionOffset.set(null); } /** * Overridden in classes like SnowCollision and GrassPathCollision when correction code needs to be run before the * main correction */ - public void beforeCorrectPosition(BoundingBox playerCollision) {} + public void beforeCorrectPosition(int x, int y, int z, BoundingBox playerCollision) {} /** * Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be @@ -97,12 +72,7 @@ public class BlockCollision { * While the Java server should do this, it could result in false flags by anticheat * This functionality is currently only used in 6 or 7 layer snow */ - public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { - Vector3i blockPos = this.position.get(); - int x = blockPos.getX(); - int y = blockPos.getY(); - int z = blockPos.getZ(); - + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); for (BoundingBox b : this.boundingBoxes) { double boxMinY = (b.getMiddleY() + y) - (b.getSizeY() / 2); @@ -174,29 +144,22 @@ public class BlockCollision { return true; } - private Vector3d getFullPos() { - Vector3i blockPos = this.position.get(); - Vector3d blockOffset = this.positionOffset.get(); - if (blockOffset != null && blockOffset != Vector3d.ZERO) { - return blockOffset.add(blockPos.getX(), blockPos.getY(), blockPos.getZ()); - } - return blockPos.toDouble(); - } - - public boolean checkIntersection(BoundingBox playerCollision) { - Vector3d blockPos = getFullPos(); + public boolean checkIntersection(double x, double y, double z, BoundingBox playerCollision) { for (BoundingBox b : boundingBoxes) { - if (b.checkIntersection(blockPos, playerCollision)) { + if (b.checkIntersection(x, y, z, playerCollision)) { return true; } } return false; } - public double computeCollisionOffset(BoundingBox boundingBox, Axis axis, double offset) { - Vector3d blockPos = getFullPos(); + public boolean checkIntersection(Vector3i position, BoundingBox playerCollision) { + return checkIntersection(position.getX(), position.getY(), position.getZ(), playerCollision); + } + + public double computeCollisionOffset(double x, double y, double z, BoundingBox boundingBox, Axis axis, double offset) { for (BoundingBox b : boundingBoxes) { - offset = b.getMaxOffset(blockPos, boundingBox, axis, offset); + offset = b.getMaxOffset(x, y, z, boundingBox, axis, offset); if (Math.abs(offset) < CollisionManager.COLLISION_TOLERANCE) { return 0; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java index aa9a082fa..e4d1b8f5a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java @@ -40,10 +40,10 @@ public class DirtPathCollision extends BlockCollision { // Needs to run before the main correction code or it can move the player into blocks // This is counteracted by the main collision code pushing them out @Override - public void beforeCorrectPosition(BoundingBox playerCollision) { + public void beforeCorrectPosition(int x, int y, int z, BoundingBox playerCollision) { // In Bedrock, dirt paths are solid blocks, so the player must be pushed down. double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); - double blockMaxY = position.get().getY() + 1; + double blockMaxY = y + 1; if (Math.abs(blockMaxY - playerMinY) <= CollisionManager.COLLISION_TOLERANCE) { playerCollision.translate(0, -0.0625, 0); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java index 8fb3e6981..d1b8e45aa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java @@ -61,19 +61,15 @@ public class DoorCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { - boolean result = super.correctPosition(session, playerCollision); + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + boolean result = super.correctPosition(session, x, y, z, playerCollision); // Hack to prevent false positives playerCollision.setSizeX(playerCollision.getSizeX() - 0.0001); playerCollision.setSizeY(playerCollision.getSizeY() - 0.0001); playerCollision.setSizeZ(playerCollision.getSizeZ() - 0.0001); // Check for door bug (doors are 0.1875 blocks thick on Java but 0.1825 blocks thick on Bedrock) - if (this.checkIntersection(playerCollision)) { - Vector3i blockPos = this.position.get(); - int x = blockPos.getX(); - int z = blockPos.getZ(); - + if (this.checkIntersection(x, y, z, playerCollision)) { switch (facing) { case 1 -> playerCollision.setMiddleZ(z + 0.5125); // North case 2 -> playerCollision.setMiddleX(x + 0.5125); // East diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java index 06cb0265e..9aed59636 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java @@ -41,12 +41,12 @@ public class ScaffoldingCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { // Hack to not check below the player playerCollision.setSizeY(playerCollision.getSizeY() - 0.001); playerCollision.setMiddleY(playerCollision.getMiddleY() + 0.002); - boolean intersected = this.checkIntersection(playerCollision); + boolean intersected = this.checkIntersection(x, y, z, playerCollision); playerCollision.setSizeY(playerCollision.getSizeY() + 0.001); playerCollision.setMiddleY(playerCollision.getMiddleY() - 0.002); @@ -59,7 +59,7 @@ public class ScaffoldingCollision extends BlockCollision { playerCollision.setSizeY(playerCollision.getSizeY() + 0.001); playerCollision.setMiddleY(playerCollision.getMiddleY() - 0.002); - if (this.checkIntersection(playerCollision)) { + if (this.checkIntersection(x, y, z, playerCollision)) { session.getCollisionManager().setOnScaffolding(true); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java index 471969d89..35ac13056 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java @@ -46,13 +46,13 @@ public class SnowCollision extends BlockCollision { // Needs to run before the main correction code or it can move the player into blocks // This is counteracted by the main collision code pushing them out @Override - public void beforeCorrectPosition(BoundingBox playerCollision) { + public void beforeCorrectPosition(int x, int y, int z, BoundingBox playerCollision) { // In Bedrock, snow layers round down to half blocks but you can't sink into them at all // This means the collision each half block reaches above where it should be on Java so the player has to be // pushed down if (layers == 4 || layers == 8) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); - double boxMaxY = (boundingBoxes[0].getMiddleY() + position.get().getY()) + (boundingBoxes[0].getSizeY() / 2); + double boxMaxY = (boundingBoxes[0].getMiddleY() + y) + (boundingBoxes[0].getSizeY() / 2); // If the player is in the buggy area, push them down if (playerMinY > boxMaxY && playerMinY <= (boxMaxY + 0.125)) { @@ -62,7 +62,7 @@ public class SnowCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { if (layers == 1) { // 1 layer of snow does not have collision return true; @@ -72,9 +72,9 @@ public class SnowCollision extends BlockCollision { playerCollision.setSizeY(playerCollision.getSizeY() - 0.0001); playerCollision.setSizeZ(playerCollision.getSizeZ() - 0.0001); - if (this.checkIntersection(playerCollision)) { + if (this.checkIntersection(x, y, z, playerCollision)) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); - double boxMaxY = (boundingBoxes[0].getMiddleY() + position.get().getY()) + (boundingBoxes[0].getSizeY() / 2); + double boxMaxY = (boundingBoxes[0].getMiddleY() + y) + (boundingBoxes[0].getSizeY() / 2); // If the player actually can't step onto it (they can step onto it from other snow layers) if ((boxMaxY - playerMinY) > 0.5) { // Cancel the movement @@ -85,6 +85,6 @@ public class SnowCollision extends BlockCollision { playerCollision.setSizeX(playerCollision.getSizeX() + 0.0001); playerCollision.setSizeY(playerCollision.getSizeY() + 0.0001); playerCollision.setSizeZ(playerCollision.getSizeZ() + 0.0001); - return super.correctPosition(session, playerCollision); + return super.correctPosition(session, x, y, z, playerCollision); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java index a8a35256f..aef966edf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java @@ -25,7 +25,6 @@ package org.geysermc.connector.network.translators.collision.translators; -import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; @@ -69,15 +68,10 @@ public class TrapdoorCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, BoundingBox playerCollision) { - boolean result = super.correctPosition(session, playerCollision); + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + boolean result = super.correctPosition(session, x, y, z, playerCollision); // Check for door bug (doors are 0.1875 blocks thick on Java but 0.1825 blocks thick on Bedrock) - if (this.checkIntersection(playerCollision)) { - Vector3i blockPos = this.position.get(); - int x = blockPos.getX(); - int y = blockPos.getY(); - int z = blockPos.getZ(); - + if (this.checkIntersection(x, y, z, playerCollision)) { switch (facing) { case 1: // North playerCollision.setMiddleZ(z + 0.5125); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java index c22287a4b..b255fa5d7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java @@ -526,16 +526,7 @@ public class PistonBlockEntity { } private BlockCollision getCollision(Vector3i blockPos) { - int blockId = getAttachedBlockId(blockPos); - if (blockId != BlockStateValues.JAVA_AIR_ID) { - double movementProgress = progress; - if (action == PistonValueType.PULLING || action == PistonValueType.CANCELLED_MID_PUSH) { - movementProgress = 1f - progress; - } - Vector3d offset = getMovement().toDouble().mul(movementProgress); - return BlockUtils.getCollision(blockId, blockPos, offset); - } - return null; + return BlockUtils.getCollision(getAttachedBlockId(blockPos)); } /** @@ -550,8 +541,15 @@ public class PistonBlockEntity { public double computeCollisionOffset(Vector3i blockPos, BoundingBox boundingBox, Axis axis, double movement) { BlockCollision blockCollision = getCollision(blockPos); if (blockCollision != null) { - double adjustedMovement = blockCollision.computeCollisionOffset(boundingBox, axis, movement); - blockCollision.reset(); + double movementProgress = progress; + if (action == PistonValueType.PULLING || action == PistonValueType.CANCELLED_MID_PUSH) { + movementProgress = 1f - progress; + } + Vector3i movementVec = getMovement(); + double x = blockPos.getX() + movementVec.getX() * movementProgress; + double y = blockPos.getY() + movementVec.getY() * movementProgress; + double z = blockPos.getZ() + movementVec.getZ() * movementProgress; + double adjustedMovement = blockCollision.computeCollisionOffset(x, y, z, boundingBox, axis, movement); if (getAttachedBlockId(blockPos) == BlockStateValues.JAVA_SLIME_BLOCK_ID && adjustedMovement != movement) { session.getPistonCache().setPlayerSlimeCollision(true); } @@ -563,9 +561,15 @@ public class PistonBlockEntity { public boolean checkCollision(Vector3i blockPos, BoundingBox boundingBox) { BlockCollision blockCollision = getCollision(blockPos); if (blockCollision != null) { - boolean result = blockCollision.checkIntersection(boundingBox); - blockCollision.reset(); - return result; + double movementProgress = progress; + if (action == PistonValueType.PULLING || action == PistonValueType.CANCELLED_MID_PUSH) { + movementProgress = 1f - progress; + } + Vector3i movementVec = getMovement(); + double x = blockPos.getX() + movementVec.getX() * movementProgress; + double y = blockPos.getY() + movementVec.getY() * movementProgress; + double z = blockPos.getZ() + movementVec.getZ() * movementProgress; + return blockCollision.checkIntersection(x, y, z, boundingBox); } return false; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java b/connector/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java new file mode 100644 index 000000000..c7ef28c82 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2019-2021 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.connector.utils; + +import com.nukkitx.network.util.Preconditions; +import lombok.Getter; + + +public class BlockPositionIterator { + private final int minX; + private final int minY; + private final int minZ; + + private final int sizeX; + private final int sizeZ; + + private int i = 0; + private final int maxI; + + public BlockPositionIterator(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { + Preconditions.checkArgument(maxX >= minX, "maxX is not greater than or equal to minX"); + Preconditions.checkArgument(maxY >= minY, "maxY is not greater than or equal to minY"); + Preconditions.checkArgument(maxZ >= minZ, "maxZ is not greater than or equal to minZ"); + + this.minX = minX; + this.minY = minY; + this.minZ = minZ; + + this.sizeX = maxX - minX + 1; + int sizeY = maxY - minY + 1; + this.sizeZ = maxZ - minZ + 1; + this.maxI = sizeX * sizeY * sizeZ; + } + + public boolean hasNext() { + return i < maxI; + } + + public void next() { + // Iterate in zxy order + i++; + } + + public void reset() { + i = 0; + } + + public int getX() { + return ((i / sizeZ) % sizeX) + minX; + } + + public int getY() { + return (i / sizeZ / sizeX) + minY; + } + + public int getZ() { + return (i % sizeZ) + minZ; + } +} \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index fd877a522..723d0bd99 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -27,7 +27,6 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3i; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.PlayerInventory; @@ -231,25 +230,15 @@ public class BlockUtils { return fullJavaIdentifier.substring(0, stateIndex); } - public static BlockCollision getCollision(int blockId, Vector3i blockPos) { - BlockCollision collision = Registries.COLLISIONS.get(blockId); - if (collision != null) { - collision.setPosition(blockPos); - collision.setPositionOffset(null); - } - return collision; - } - - public static BlockCollision getCollision(int blockId, Vector3i blockPos, Vector3d blockOffset) { - BlockCollision collision = Registries.COLLISIONS.get(blockId); - if (collision != null) { - collision.setPosition(blockPos); - collision.setPositionOffset(blockOffset); - } - return collision; + public static BlockCollision getCollision(int blockId) { + return Registries.COLLISIONS.get(blockId); } public static BlockCollision getCollisionAt(GeyserSession session, Vector3i blockPos) { - return getCollision(session.getConnector().getWorldManager().getBlockAt(session, blockPos), blockPos); + return getCollision(session.getConnector().getWorldManager().getBlockAt(session, blockPos)); + } + + public static BlockCollision getCollisionAt(GeyserSession session, int x, int y, int z) { + return getCollision(session.getConnector().getWorldManager().getBlockAt(session, x, y, z)); } } From 0438aa470900e6eab922bbd19f6f0aa46eff7229 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 26 Sep 2021 20:54:03 -0400 Subject: [PATCH 620/766] Comment change in map data translator --- .../network/translators/java/world/JavaMapDataTranslator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java index 0bed6a28b..7fee63437 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java @@ -62,7 +62,7 @@ public class JavaMapDataTranslator extends PacketTranslator shouldStore = true; } - // Every int entry is an ABGR color + // Every int entry is an ARGB color int[] colors = new int[data.getData().length]; int idx = 0; From 43bef851c7b18e6905aa43f5f85478c45ceb13f0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 26 Sep 2021 20:54:44 -0400 Subject: [PATCH 621/766] Don't shade any Google dependency All server platforms have modern enough Google dependencies that nothing should break. Tested with Velocity, BungeeCord, Spigot 1.12.2/1.16.5/1.17.1. --- bootstrap/bungeecord/pom.xml | 10 +--------- bootstrap/spigot/pom.xml | 10 +--------- bootstrap/velocity/pom.xml | 10 +--------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index bef37d453..089fd5b04 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -72,14 +72,6 @@ io.netty.channel.kqueue org.geysermc.platform.bungeecord.shaded.io.netty.channel.kqueue - - com.google.common - org.geysermc.platform.bungeecord.shaded.google.common - - - com.google.guava - org.geysermc.platform.bungeecord.shaded.google.guava - net.kyori org.geysermc.platform.bungeecord.shaded.kyori @@ -91,7 +83,7 @@ - com.google.code.gson:* + com.google.*:* org.yaml:* io.netty:netty-transport-native-epoll:* io.netty:netty-transport-native-unix-common:* diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index dd6b28473..4b5b50de9 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -83,14 +83,6 @@ com.fasterxml.jackson org.geysermc.platform.spigot.shaded.jackson - - com.google.common - org.geysermc.platform.spigot.shaded.google.common - - - com.google.guava - org.geysermc.platform.spigot.shaded.google.guava - net.kyori org.geysermc.platform.spigot.shaded.kyori @@ -106,7 +98,7 @@ - com.google.code.gson:* + com.google.*:* org.yaml:* diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml index 33df2be80..fe984e974 100644 --- a/bootstrap/velocity/pom.xml +++ b/bootstrap/velocity/pom.xml @@ -65,14 +65,6 @@ it.unimi.dsi.fastutil org.geysermc.platform.velocity.shaded.fastutil - - com.google.common - org.geysermc.platform.velocity.shaded.google.common - - - com.google.guava - org.geysermc.platform.velocity.shaded.google.guava - net.kyori.adventure.text.serializer.gson.legacyimpl org.geysermc.platform.velocity.shaded.kyori.legacyimpl @@ -84,7 +76,7 @@ - com.google.code.gson:* + com.google.*:* io.netty:netty-transport-native-epoll:* io.netty:netty-transport-native-unix-common:* From 4503991d371d7d40dc7f3e3a47f7730e0dd060d9 Mon Sep 17 00:00:00 2001 From: Cybornut <51033431+Cybornut@users.noreply.github.com> Date: Mon, 27 Sep 2021 19:51:50 -0700 Subject: [PATCH 622/766] Added a couple of comments in config.yml for clarification (#2544) * Update config.yml Added commented clarifications on: 1. "remote: address: auto" 2. "remote: auth-type: online" May need formatting checks to conform with correct annotation * Update config.yml --- connector/src/main/resources/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 04976adae..cc22dc4aa 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -38,12 +38,14 @@ remote: # The IP address of the remote (Java Edition) server # If it is "auto", for standalone version the remote address will be set to 127.0.0.1, # for plugin versions, it is recommended to keep this as "auto" so Geyser will automatically configure address, port, and auth-type. + # Leave as "auto" if floodgate is installed. address: auto # The port of the remote (Java Edition) server # For plugin versions, if address has been set to "auto", the port will also follow the server's listening port. port: 25565 # Authentication type. Can be offline, online, or floodgate (see https://github.com/GeyserMC/Geyser/wiki/Floodgate). # For plugin versions, it's recommended to keep the `address` field to "auto" so Floodgate support is automatically configured. + # If Floodgate is installed and `address:` is set to "auto", then "auth-type: floodgate" will automatically be used. auth-type: online # Allow for password-based authentication methods through Geyser. Only useful in online mode. # If this is false, users must authenticate to Microsoft using a code provided by Geyser on their desktop. From 7d176cd6698c94f049f2e171d6f7f00ee538bd04 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 28 Sep 2021 09:46:12 -0400 Subject: [PATCH 623/766] Fix regressions in handling invalid account cases --- .../network/session/GeyserSession.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 97773458c..21730b230 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -25,6 +25,7 @@ package org.geysermc.connector.network.session; +import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.exception.request.AuthPendingException; import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException; import com.github.steveice10.mc.auth.exception.request.RequestException; @@ -593,7 +594,14 @@ public class GeyserSession implements CommandSender { authenticationService.setPassword(password); authenticationService.login(); - protocol = new MinecraftProtocol(authenticationService.getSelectedProfile(), authenticationService.getAccessToken()); + GameProfile profile = authenticationService.getSelectedProfile(); + if (profile == null) { + // Java account is offline + disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + return null; + } + + protocol = new MinecraftProtocol(profile, authenticationService.getAccessToken()); } else { // always replace spaces when using Floodgate, // as usernames with spaces cause issues with Bungeecord's login cycle. @@ -618,7 +626,9 @@ public class GeyserSession implements CommandSender { disconnect(ex.toString()); } if (this.closed) { - connector.getLogger().error("", ex); + if (ex != null) { + connector.getLogger().error("", ex); + } // Client disconnected during the authentication attempt return; } @@ -657,6 +667,7 @@ public class GeyserSession implements CommandSender { }).whenComplete((response, ex) -> { if (ex != null) { ex.printStackTrace(); + disconnect(ex.toString()); return; } LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response); @@ -673,7 +684,14 @@ public class GeyserSession implements CommandSender { } try { msaAuthenticationService.login(); - protocol = new MinecraftProtocol(msaAuthenticationService.getSelectedProfile(), msaAuthenticationService.getAccessToken()); + GameProfile profile = msaAuthenticationService.getSelectedProfile(); + if (profile == null) { + // Java account is offline + disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + return; + } + + protocol = new MinecraftProtocol(profile, msaAuthenticationService.getAccessToken()); connectDownstream(); } catch (RequestException e) { @@ -773,11 +791,6 @@ public class GeyserSession implements CommandSender { public void connected(ConnectedEvent event) { loggingIn = false; loggedIn = true; - if (protocol.getProfile() == null) { - // Java account is offline - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); - return; - } if (downstream.isInternallyConnecting()) { // Connected directly to the server From 7f4d3def58281fcf09ecb53cbce1a183d7f951ca Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 28 Sep 2021 19:25:34 -0400 Subject: [PATCH 624/766] Convert GameProfileData to record; remove confusing skin log `Registering bedrock skin for PLAYERNAME` is now just confusing as it implies something to do with Floodgate's skin system when it's just for Bedrock <-> Bedrock players. --- .../geysermc/connector/skin/SkinManager.java | 27 ++++++++----------- .../geysermc/connector/skin/SkinProvider.java | 2 +- .../connector/skin/SkullSkinManager.java | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java b/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java index 04c3778b6..70f9f8ff5 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java @@ -30,8 +30,6 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.nukkitx.protocol.bedrock.data.skin.ImageData; import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; -import lombok.AllArgsConstructor; -import lombok.Getter; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.entity.player.PlayerEntity; @@ -52,10 +50,10 @@ public class SkinManager { */ public static PlayerListPacket.Entry buildCachedEntry(GeyserSession session, PlayerEntity playerEntity) { GameProfileData data = GameProfileData.from(playerEntity.getProfile()); - SkinProvider.Cape cape = SkinProvider.getCachedCape(data.getCapeUrl()); + SkinProvider.Cape cape = SkinProvider.getCachedCape(data.capeUrl()); SkinProvider.SkinGeometry geometry = SkinProvider.SkinGeometry.getLegacy(data.isAlex()); - SkinProvider.Skin skin = SkinProvider.getCachedSkin(data.getSkinUrl()); + SkinProvider.Skin skin = SkinProvider.getCachedSkin(data.skinUrl()); if (skin == null) { skin = SkinProvider.EMPTY_SKIN; } @@ -118,7 +116,7 @@ public class SkinManager { Consumer skinAndCapeConsumer) { GameProfileData data = GameProfileData.from(entity.getProfile()); - SkinProvider.requestSkinAndCape(entity.getUuid(), data.getSkinUrl(), data.getCapeUrl()) + SkinProvider.requestSkinAndCape(entity.getUuid(), data.skinUrl(), data.capeUrl()) .whenCompleteAsync((skinAndCape, throwable) -> { try { SkinProvider.Skin skin = skinAndCape.getSkin(); @@ -206,7 +204,10 @@ public class SkinManager { } public static void handleBedrockSkin(PlayerEntity playerEntity, BedrockClientData clientData) { - GeyserConnector.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); + GeyserConnector connector = GeyserConnector.getInstance(); + if (connector.getConfig().isDebugMode()) { + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); + } try { byte[] skinBytes = Base64.getDecoder().decode(clientData.getSkinData().getBytes(StandardCharsets.UTF_8)); @@ -218,9 +219,9 @@ public class SkinManager { if (skinBytes.length <= (128 * 128 * 4) && !clientData.isPersonaSkin()) { SkinProvider.storeBedrockSkin(playerEntity.getUuid(), clientData.getSkinId(), skinBytes); SkinProvider.storeBedrockGeometry(playerEntity.getUuid(), geometryNameBytes, geometryBytes); - } else { - GeyserConnector.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.fail", playerEntity.getUsername())); - GeyserConnector.getInstance().getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight()); + } else if (connector.getConfig().isDebugMode()) { + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.fail", playerEntity.getUsername())); + connector.getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight()); } if (!clientData.getCapeId().equals("")) { @@ -231,13 +232,7 @@ public class SkinManager { } } - @AllArgsConstructor - @Getter - public static class GameProfileData { - private final String skinUrl; - private final String capeUrl; - private final boolean alex; - + public record GameProfileData(String skinUrl, String capeUrl, boolean isAlex) { /** * Generate the GameProfileData from the given GameProfile * diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java index ed18f2c22..567e52ace 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java @@ -63,7 +63,7 @@ public class SkinProvider { public static final Skin EMPTY_SKIN = new Skin(-1, "steve", STEVE_SKIN); public static final byte[] ALEX_SKIN = new ProvidedSkin("bedrock/skin/skin_alex.png").getSkin(); public static final Skin EMPTY_SKIN_ALEX = new Skin(-1, "alex", ALEX_SKIN); - private static final Map permanentSkins = new HashMap() {{ + private static final Map permanentSkins = new HashMap<>() {{ put("steve", EMPTY_SKIN); put("alex", EMPTY_SKIN_ALEX); }}; diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java b/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java index 7481b70bc..40ef47f99 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java @@ -52,7 +52,7 @@ public class SkullSkinManager extends SkinManager { Consumer skinConsumer) { GameProfileData data = GameProfileData.from(entity.getProfile()); - SkinProvider.requestSkin(entity.getUuid(), data.getSkinUrl(), true) + SkinProvider.requestSkin(entity.getUuid(), data.skinUrl(), true) .whenCompleteAsync((skin, throwable) -> { try { if (session.getUpstream().isInitialized()) { From 3323e5732cb06f26e567ea8e5ffd3b1307c30196 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Wed, 29 Sep 2021 20:36:27 +0200 Subject: [PATCH 625/766] Scoreboard improvements (#2078) * Fixed some Scoreboard bugs and ScoreboardUpdater is now global * Begin implementing below name support and better name display * Use final for classes * Revert "Begin implementing below name support and better name display" This reverts commit 01babd636ab317aa3e36cc6fdfa97cc8d9b4a532. * Don't remove objective if we're showing it * Prevent concurrency exceptions when switching servers * Properly fix the concurrency issue * Fix inconsistencies in update cycle * Few minor changes * Port over this fix * Fixed a problem that was introduced yesterday * Cleanup * Scores don't have to be removed before removing the objective itself * Moved away from the general thread pool and some more changes * Small changes * Converted switch statements Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com> --- .../geysermc/connector/GeyserConnector.java | 2 + .../network/session/cache/WorldCache.java | 19 +- .../JavaDisplayScoreboardTranslator.java | 3 +- .../JavaScoreboardObjectiveTranslator.java | 23 +- .../java/scoreboard/JavaTeamTranslator.java | 17 +- .../scoreboard/JavaUpdateScoreTranslator.java | 2 +- .../connector/scoreboard/Objective.java | 58 +++- .../geysermc/connector/scoreboard/Score.java | 12 +- .../connector/scoreboard/Scoreboard.java | 277 ++++++++++-------- .../scoreboard/ScoreboardUpdater.java | 201 ++++++++----- .../geysermc/connector/scoreboard/Team.java | 54 ++-- 11 files changed, 384 insertions(+), 284 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 7e22792fa..37bfd2413 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -53,6 +53,7 @@ import org.geysermc.connector.network.translators.PacketTranslatorRegistry; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; +import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.skin.FloodgateSkinUploader; import org.geysermc.connector.utils.*; import org.geysermc.floodgate.crypto.AesCipher; @@ -155,6 +156,7 @@ public class GeyserConnector { ItemTranslator.init(); MessageTranslator.init(); LocaleUtils.init(); + ScoreboardUpdater.init(); ResourcePack.loadPacks(); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java index 4a2939621..bec206ba1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java @@ -29,38 +29,33 @@ import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.scoreboard.Objective; import org.geysermc.connector.scoreboard.Scoreboard; -import org.geysermc.connector.scoreboard.ScoreboardUpdater; +import org.geysermc.connector.scoreboard.ScoreboardUpdater.ScoreboardSession; @Getter public class WorldCache { private final GeyserSession session; + private final ScoreboardSession scoreboardSession; + private Scoreboard scoreboard; @Setter private Difficulty difficulty = Difficulty.EASY; - private Scoreboard scoreboard; - private final ScoreboardUpdater scoreboardUpdater; - public WorldCache(GeyserSession session) { this.session = session; this.scoreboard = new Scoreboard(session); - scoreboardUpdater = new ScoreboardUpdater(this); - scoreboardUpdater.start(); + scoreboardSession = new ScoreboardSession(session); } public void removeScoreboard() { if (scoreboard != null) { - for (Objective objective : scoreboard.getObjectives().values()) { - scoreboard.despawnObjective(objective); - } + scoreboard.removeScoreboard(); scoreboard = new Scoreboard(session); } } public int increaseAndGetScoreboardPacketsPerSecond() { - int pendingPps = scoreboardUpdater.incrementAndGetPacketsPerSecond(); - int pps = scoreboardUpdater.getPacketsPerSecond(); + int pendingPps = scoreboardSession.getPendingPacketsPerSecond().incrementAndGet(); + int pps = scoreboardSession.getPacketsPerSecond(); return Math.max(pps, pendingPps); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java index a92cc628e..577e206b9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java @@ -25,12 +25,11 @@ package org.geysermc.connector.network.translators.java.scoreboard; +import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; - @Translator(packet = ServerDisplayScoreboardPacket.class) public class JavaDisplayScoreboardTranslator extends PacketTranslator { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index dcdc9ac9b..ab5f7b350 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -25,30 +25,39 @@ package org.geysermc.connector.network.translators.java.scoreboard; +import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; +import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.scoreboard.Objective; import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; -import org.geysermc.connector.network.translators.chat.MessageTranslator; - -import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; +import org.geysermc.connector.scoreboard.UpdateType; @Translator(packet = ServerScoreboardObjectivePacket.class) public class JavaScoreboardObjectiveTranslator extends PacketTranslator { + private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override public void translate(GeyserSession session, ServerScoreboardObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); - Objective objective = scoreboard.getObjective(packet.getName()); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); - if (objective == null && packet.getAction() != ObjectiveAction.REMOVE) { - objective = scoreboard.registerNewObjective(packet.getName(), false); + Objective objective = scoreboard.getObjective(packet.getName()); + if (objective != null && objective.getUpdateType() != UpdateType.REMOVE && packet.getAction() == ObjectiveAction.ADD) { + // matches vanilla behaviour + logger.warning("An objective with the same name '" + packet.getName() + "' already exists! Ignoring packet"); + return; + } + + if ((objective == null || objective.getUpdateType() == UpdateType.REMOVE) && packet.getAction() != ObjectiveAction.REMOVE) { + objective = scoreboard.registerNewObjective(packet.getName()); } switch (packet.getAction()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index d8d2273b9..9e9d2813c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -25,26 +25,25 @@ package org.geysermc.connector.network.translators.java.scoreboard; +import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamAction; import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.scoreboard.Team; import org.geysermc.connector.scoreboard.UpdateType; import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.connector.network.translators.chat.MessageTranslator; import java.util.Arrays; -import java.util.Set; @Translator(packet = ServerTeamPacket.class) public class JavaTeamTranslator extends PacketTranslator { - private static final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger(); + private final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger(); @Override public void translate(GeyserSession session, ServerTeamPacket packet) { @@ -52,12 +51,16 @@ public class JavaTeamTranslator extends PacketTranslator { LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); } + if ((packet.getAction() == TeamAction.ADD_PLAYER || packet.getAction() == TeamAction.REMOVE_PLAYER) && packet.getPlayers().length == 0) { + return; + } + int pps = session.getWorldCache().increaseAndGetScoreboardPacketsPerSecond(); Scoreboard scoreboard = session.getWorldCache().getScoreboard(); Team team = scoreboard.getTeam(packet.getTeamName()); switch (packet.getAction()) { - case CREATE -> scoreboard.registerNewTeam(packet.getTeamName(), toPlayerSet(packet.getPlayers())) + case CREATE -> scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers()) .setName(MessageTranslator.convertMessage(packet.getDisplayName())) .setColor(packet.getColor()) .setNameTagVisibility(packet.getNameTagVisibility()) @@ -108,8 +111,4 @@ public class JavaTeamTranslator extends PacketTranslator { scoreboard.onUpdate(); } } - - private Set toPlayerSet(String[] players) { - return new ObjectOpenHashSet<>(players); - } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java index daf4d3832..6a210ce51 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java @@ -66,7 +66,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator ScoreboardPosition.BELOW_NAME; - case PLAYER_LIST -> ScoreboardPosition.PLAYER_LIST; - default -> ScoreboardPosition.SIDEBAR; - }; - } - public void registerScore(String id, int score) { if (!scores.containsKey(id)) { long scoreId = scoreboard.getNextId().getAndIncrement(); @@ -145,12 +138,57 @@ public final class Objective { public void setActive(ScoreboardPosition displaySlot) { if (!active) { active = true; - this.displaySlot = correctDisplaySlot(displaySlot); + this.displaySlot = displaySlot; displaySlotName = translateDisplaySlot(displaySlot); } } + /** + * The objective will be removed on the next update + */ + public void pendingRemove() { + updateType = UpdateType.REMOVE; + } + + public ScoreboardPosition getPositionCategory() { + return switch (displaySlot) { + case PLAYER_LIST -> ScoreboardPosition.PLAYER_LIST; + case BELOW_NAME -> ScoreboardPosition.BELOW_NAME; + default -> ScoreboardPosition.SIDEBAR; + }; + } + + public boolean hasTeamColor() { + return displaySlot != ScoreboardPosition.PLAYER_LIST && + displaySlot != ScoreboardPosition.BELOW_NAME && + displaySlot != ScoreboardPosition.SIDEBAR; + } + + public TeamColor getTeamColor() { + return switch (displaySlot) { + case SIDEBAR_TEAM_RED -> TeamColor.RED; + case SIDEBAR_TEAM_AQUA -> TeamColor.AQUA; + case SIDEBAR_TEAM_BLUE -> TeamColor.BLUE; + case SIDEBAR_TEAM_GOLD -> TeamColor.GOLD; + case SIDEBAR_TEAM_GRAY -> TeamColor.GRAY; + case SIDEBAR_TEAM_BLACK -> TeamColor.BLACK; + case SIDEBAR_TEAM_GREEN -> TeamColor.GREEN; + case SIDEBAR_TEAM_WHITE -> TeamColor.WHITE; + case SIDEBAR_TEAM_YELLOW -> TeamColor.YELLOW; + case SIDEBAR_TEAM_DARK_RED -> TeamColor.DARK_RED; + case SIDEBAR_TEAM_DARK_AQUA -> TeamColor.DARK_AQUA; + case SIDEBAR_TEAM_DARK_BLUE -> TeamColor.DARK_BLUE; + case SIDEBAR_TEAM_DARK_GRAY -> TeamColor.DARK_GRAY; + case SIDEBAR_TEAM_DARK_GREEN -> TeamColor.DARK_GREEN; + case SIDEBAR_TEAM_DARK_PURPLE -> TeamColor.DARK_PURPLE; + case SIDEBAR_TEAM_LIGHT_PURPLE -> TeamColor.LIGHT_PURPLE; + default -> null; + }; + } + public void removed() { + active = false; + updateType = UpdateType.REMOVE; scores = null; } } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java index 79c90b096..7f3ac6e60 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java @@ -39,7 +39,7 @@ public final class Score { /** * Changes that have been made since the last cached data. */ - private Score.ScoreData currentData; + private final Score.ScoreData currentData; /** * The data that is currently displayed to the Bedrock client. */ @@ -72,14 +72,14 @@ public final class Score { if (currentData.team != null && team != null) { if (!currentData.team.equals(team)) { currentData.team = team; - currentData.updateType = UpdateType.UPDATE; + setUpdateType(UpdateType.UPDATE); } return this; } // simplified from (this.team != null && team == null) || (this.team == null && team != null) if (currentData.team != null || team != null) { currentData.team = team; - currentData.updateType = UpdateType.UPDATE; + setUpdateType(UpdateType.UPDATE); } return this; } @@ -126,13 +126,13 @@ public final class Score { @Getter public static final class ScoreData { - protected UpdateType updateType; - protected long updateTime; + private UpdateType updateType; + private long updateTime; private Team team; private int score; - protected ScoreData() { + private ScoreData() { updateType = UpdateType.ADD; } } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index de27db0bf..3795db83f 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -42,14 +42,15 @@ import java.util.concurrent.atomic.AtomicLong; import static org.geysermc.connector.scoreboard.UpdateType.*; -@Getter public final class Scoreboard { private final GeyserSession session; private final GeyserLogger logger; + @Getter private final AtomicLong nextId = new AtomicLong(0); private final Map objectives = new ConcurrentHashMap<>(); - private final Map teams = new HashMap<>(); + private final Map objectiveSlots = new HashMap<>(); + private final Map teams = new ConcurrentHashMap<>(); // updated on multiple threads private int lastAddScoreCount = 0; private int lastRemoveScoreCount = 0; @@ -59,45 +60,52 @@ public final class Scoreboard { this.logger = GeyserConnector.getInstance().getLogger(); } - public Objective registerNewObjective(String objectiveId, boolean active) { - Objective objective = objectives.get(objectiveId); - if (active || objective != null) { - return objective; + public void removeScoreboard() { + Iterator iterator = objectives.values().iterator(); + while (iterator.hasNext()) { + Objective objective = iterator.next(); + iterator.remove(); + + deleteObjective(objective, false); } + } + + public Objective registerNewObjective(String objectiveId) { + Objective objective = objectives.get(objectiveId); + if (objective != null) { + // we have no other choice, or we have to make a new map? + // if the objective hasn't been deleted, we have to force it + if (objective.getUpdateType() != REMOVE) { + return null; + } + deleteObjective(objective, true); + } + objective = new Objective(this, objectiveId); objectives.put(objectiveId, objective); return objective; } - public Objective displayObjective(String objectiveId, ScoreboardPosition displaySlot) { + public void displayObjective(String objectiveId, ScoreboardPosition displaySlot) { Objective objective = objectives.get(objectiveId); - if (objective != null) { - if (!objective.isActive()) { - objective.setActive(displaySlot); - removeOldObjectives(objective); - return objective; - } - despawnObjective(objective); + if (objective == null) { + return; } - objective = new Objective(this, objectiveId, displaySlot, "unknown", 0); - objectives.put(objectiveId, objective); - removeOldObjectives(objective); - return objective; - } - - private void removeOldObjectives(Objective newObjective) { - for (Objective next : objectives.values()) { - if (next.getId() == newObjective.getId()) { - continue; - } - if (next.getDisplaySlot() == newObjective.getDisplaySlot()) { - next.setUpdateType(REMOVE); - } + if (!objective.isActive()) { + objective.setActive(displaySlot); + // for reactivated objectives + objective.setUpdateType(ADD); } + + Objective storedObjective = objectiveSlots.get(displaySlot); + if (storedObjective != null && storedObjective != objective) { + objective.pendingRemove(); + } + objectiveSlots.put(displaySlot, objective); } - public Team registerNewTeam(String teamName, Set players) { + public Team registerNewTeam(String teamName, String[] players) { Team team = teams.get(teamName); if (team != null) { logger.info(LanguageUtils.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName)); @@ -113,6 +121,10 @@ public final class Scoreboard { return objectives.get(objectiveName); } + public Collection getObjectives() { + return objectives.values(); + } + public Team getTeam(String teamName) { return teams.get(teamName); } @@ -120,7 +132,7 @@ public final class Scoreboard { public void unregisterObjective(String objectiveName) { Objective objective = getObjective(objectiveName); if (objective != null) { - objective.setUpdateType(REMOVE); + objective.pendingRemove(); } } @@ -132,114 +144,38 @@ public final class Scoreboard { } public void onUpdate() { - List addScores = new ArrayList<>(getLastAddScoreCount()); - List removeScores = new ArrayList<>(getLastRemoveScoreCount()); + List addScores = new ArrayList<>(lastAddScoreCount); + List removeScores = new ArrayList<>(lastRemoveScoreCount); List removedObjectives = new ArrayList<>(); + Team playerTeam = getTeamFor(session.getPlayerEntity().getUsername()); + Objective correctSidebar = null; + for (Objective objective : objectives.values()) { - if (!objective.isActive()) { - logger.debug("Ignoring non-active Scoreboard Objective '" + objective.getObjectiveName() + '\''); - continue; - } - - // hearts can't hold teams, so we treat them differently - if (objective.getType() == 1) { - for (Score score : objective.getScores().values()) { - boolean update = score.shouldUpdate(); - - if (update) { - score.update(objective.getObjectiveName()); - } - - if (score.getUpdateType() != REMOVE && update) { - addScores.add(score.getCachedInfo()); - } - if (score.getUpdateType() != ADD && update) { - removeScores.add(score.getCachedInfo()); - } - } - continue; - } - - boolean objectiveUpdate = objective.getUpdateType() == UPDATE; - boolean objectiveAdd = objective.getUpdateType() == ADD; - boolean objectiveRemove = objective.getUpdateType() == REMOVE; - - for (Score score : objective.getScores().values()) { - Team team = score.getTeam(); - - boolean add = objectiveAdd || objectiveUpdate; - boolean remove = false; - if (team != null) { - if (team.getUpdateType() == REMOVE || !team.hasEntity(score.getName())) { - score.setTeam(null); - add = true; - remove = true; - } - } - - add |= score.shouldUpdate(); - remove |= score.shouldUpdate(); - - if (score.getUpdateType() == REMOVE || objectiveRemove) { - add = false; - } - - if (score.getUpdateType() == ADD || objectiveRemove) { - remove = false; - } - - if (objectiveRemove && score.getCachedData() != null) { - // This score has been sent to the client and needs to be removed since the objective is being removed - remove = true; - } else if (score.shouldUpdate()) { - score.update(objective.getObjectiveName()); - } - - if (add) { - addScores.add(score.getCachedInfo()); - } - - if (remove) { - removeScores.add(score.getCachedInfo()); - } - - // score is pending to be removed, so we can remove it from the objective - if (score.getUpdateType() == REMOVE) { - objective.removeScore0(score.getName()); - } - - score.setUpdateType(NOTHING); - } - - if (objectiveRemove) { + // objective has been deleted + if (objective.getUpdateType() == REMOVE) { removedObjectives.add(objective); + continue; } - if (objectiveUpdate) { - RemoveObjectivePacket removeObjectivePacket = new RemoveObjectivePacket(); - removeObjectivePacket.setObjectiveId(objective.getObjectiveName()); - session.sendUpstreamPacket(removeObjectivePacket); + if (playerTeam != null && playerTeam.getColor() == objective.getTeamColor()) { + correctSidebar = objective; } - - if ((objectiveAdd || objectiveUpdate) && !objectiveRemove) { - SetDisplayObjectivePacket displayObjectivePacket = new SetDisplayObjectivePacket(); - displayObjectivePacket.setObjectiveId(objective.getObjectiveName()); - displayObjectivePacket.setDisplayName(objective.getDisplayName()); - displayObjectivePacket.setCriteria("dummy"); - displayObjectivePacket.setDisplaySlot(objective.getDisplaySlotName()); - displayObjectivePacket.setSortOrder(1); // ?? - session.sendUpstreamPacket(displayObjectivePacket); - } - - objective.setUpdateType(NOTHING); } + if (correctSidebar == null) { + correctSidebar = objectiveSlots.get(ScoreboardPosition.SIDEBAR); + } + + handleObjective(objectiveSlots.get(ScoreboardPosition.PLAYER_LIST), addScores, removeScores); + handleObjective(correctSidebar, addScores, removeScores); + handleObjective(objectiveSlots.get(ScoreboardPosition.BELOW_NAME), addScores, removeScores); + Iterator teamIterator = teams.values().iterator(); while (teamIterator.hasNext()) { Team current = teamIterator.next(); - switch (current.getUpdateType()) { + switch (current.getCachedUpdateType()) { case ADD, UPDATE -> current.markUpdated(); case REMOVE -> teamIterator.remove(); } @@ -259,17 +195,100 @@ public final class Scoreboard { session.sendUpstreamPacket(setScorePacket); } - // prevents crashes in some cases for (Objective objective : removedObjectives) { - despawnObjective(objective); + deleteObjective(objective, true); } lastAddScoreCount = addScores.size(); lastRemoveScoreCount = removeScores.size(); } - public void despawnObjective(Objective objective) { - objectives.remove(objective.getObjectiveName()); + private void handleObjective(Objective objective, List addScores, List removeScores) { + if (objective == null || objective.getUpdateType() == REMOVE) { + return; + } + + // hearts can't hold teams, so we treat them differently + if (objective.getType() == 1) { + for (Score score : objective.getScores().values()) { + boolean update = score.shouldUpdate(); + + if (update) { + score.update(objective.getObjectiveName()); + } + + if (score.getUpdateType() != REMOVE && update) { + addScores.add(score.getCachedInfo()); + } + if (score.getUpdateType() != ADD && update) { + removeScores.add(score.getCachedInfo()); + } + } + return; + } + + boolean objectiveAdd = objective.getUpdateType() == ADD; + boolean objectiveUpdate = objective.getUpdateType() == UPDATE; + + for (Score score : objective.getScores().values()) { + if (score.getUpdateType() == REMOVE) { + removeScores.add(score.getCachedInfo()); + // score is pending to be removed, so we can remove it from the objective + objective.removeScore0(score.getName()); + break; + } + + Team team = score.getTeam(); + + boolean add = objectiveAdd || objectiveUpdate; + + if (team != null) { + if (team.getUpdateType() == REMOVE || !team.hasEntity(score.getName())) { + score.setTeam(null); + add = true; + } + } + + if (score.shouldUpdate()) { + score.update(objective.getObjectiveName()); + add = true; + } + + if (add) { + addScores.add(score.getCachedInfo()); + } + + score.setUpdateType(NOTHING); + } + + if (objectiveUpdate) { + RemoveObjectivePacket removeObjectivePacket = new RemoveObjectivePacket(); + removeObjectivePacket.setObjectiveId(objective.getObjectiveName()); + session.sendUpstreamPacket(removeObjectivePacket); + } + + if (objectiveAdd || objectiveUpdate) { + SetDisplayObjectivePacket displayObjectivePacket = new SetDisplayObjectivePacket(); + displayObjectivePacket.setObjectiveId(objective.getObjectiveName()); + displayObjectivePacket.setDisplayName(objective.getDisplayName()); + displayObjectivePacket.setCriteria("dummy"); + displayObjectivePacket.setDisplaySlot(objective.getDisplaySlotName()); + displayObjectivePacket.setSortOrder(1); // 0 = ascending, 1 = descending + session.sendUpstreamPacket(displayObjectivePacket); + } + + objective.setUpdateType(NOTHING); + } + + /** + * @param remove if we should remove the objective from the objectives map. + */ + public void deleteObjective(Objective objective, boolean remove) { + if (remove) { + objectives.remove(objective.getObjectiveName()); + } + objectiveSlots.remove(objective.getDisplaySlot(), objective); + objective.removed(); RemoveObjectivePacket removeObjectivePacket = new RemoveObjectivePacket(); diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java b/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java index e5a802507..2fb21337e 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java @@ -25,100 +25,149 @@ package org.geysermc.connector.scoreboard; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.utils.LanguageUtils; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -public class ScoreboardUpdater extends Thread { +public final class ScoreboardUpdater extends Thread { public static final int FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; public static final int SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD = 250; private static final int FIRST_MILLIS_BETWEEN_UPDATES = 250; // 4 updates per second - private static final int SECOND_MILLIS_BETWEEN_UPDATES = 1000 * 3; // 1 update per 3 seconds + private static final int SECOND_MILLIS_BETWEEN_UPDATES = 1000; // 1 update per second private static final boolean DEBUG_ENABLED; - private final WorldCache worldCache; - private final GeyserSession session; - - private int millisBetweenUpdates = FIRST_MILLIS_BETWEEN_UPDATES; - private long lastUpdate = System.currentTimeMillis(); - private long lastLog = -1; - - private long lastPacketsPerSecondUpdate = System.currentTimeMillis(); - private final AtomicInteger packetsPerSecond = new AtomicInteger(0); - private final AtomicInteger pendingPacketsPerSecond = new AtomicInteger(0); - - public ScoreboardUpdater(WorldCache worldCache) { - super("Scoreboard Updater"); - this.worldCache = worldCache; - session = worldCache.getSession(); - } - - @Override - public void run() { - if (!session.isClosed()) { - long currentTime = System.currentTimeMillis(); - - // reset score-packets per second every second - if (currentTime - lastPacketsPerSecondUpdate > 1000) { - lastPacketsPerSecondUpdate = currentTime; - packetsPerSecond.set(pendingPacketsPerSecond.get()); - pendingPacketsPerSecond.set(0); - } - - if (currentTime - lastUpdate > millisBetweenUpdates) { - lastUpdate = currentTime; - - int pps = packetsPerSecond.get(); - if (pps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { - boolean reachedSecondThreshold = pps >= SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD; - if (reachedSecondThreshold) { - millisBetweenUpdates = SECOND_MILLIS_BETWEEN_UPDATES; - } else { - millisBetweenUpdates = FIRST_MILLIS_BETWEEN_UPDATES; - } - - worldCache.getScoreboard().onUpdate(); - - if (DEBUG_ENABLED && (currentTime - lastLog > 60000)) { // one minute - int threshold = reachedSecondThreshold ? - SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD : - FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; - - GeyserConnector.getInstance().getLogger().info( - LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + - LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) - ); - - lastLog = currentTime; - } - } - } - - session.getConnector().getGeneralThreadPool().schedule(this, 50, TimeUnit.MILLISECONDS); - } - } - - public int getPacketsPerSecond() { - return packetsPerSecond.get(); - } - - /** - * Increase the Scoreboard Packets Per Second and return the updated value - */ - public int incrementAndGetPacketsPerSecond() { - return pendingPacketsPerSecond.incrementAndGet(); - } - static { GeyserConfiguration config = GeyserConnector.getInstance().getConfig(); FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD = Math.min(config.getScoreboardPacketThreshold(), SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD); DEBUG_ENABLED = config.isDebugMode(); } + + private final GeyserConnector connector = GeyserConnector.getInstance(); + + private long lastUpdate = System.currentTimeMillis(); + private long lastPacketsPerSecondUpdate = System.currentTimeMillis(); + + public static void init() { + new ScoreboardUpdater().start(); + } + + @Override + public void run() { + while (!connector.isShuttingDown()) { + long timeTillAction = getTimeTillNextAction(); + if (timeTillAction > 0) { + sleepFor(timeTillAction); + continue; + } + + long currentTime = System.currentTimeMillis(); + + // reset score-packets per second every second + if (currentTime - lastPacketsPerSecondUpdate >= 1000) { + lastPacketsPerSecondUpdate = currentTime; + for (GeyserSession session : connector.getPlayers()) { + ScoreboardSession scoreboardSession = session.getWorldCache().getScoreboardSession(); + + int oldPps = scoreboardSession.getPacketsPerSecond(); + int newPps = scoreboardSession.getPendingPacketsPerSecond().get(); + + scoreboardSession.packetsPerSecond = newPps; + scoreboardSession.pendingPacketsPerSecond.set(0); + + // just making sure that all updates are pushed before giving up control + if (oldPps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD && + newPps < FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { + session.getWorldCache().getScoreboard().onUpdate(); + } + } + } + + if (currentTime - lastUpdate >= FIRST_MILLIS_BETWEEN_UPDATES) { + lastUpdate = currentTime; + + for (GeyserSession session : connector.getPlayers()) { + WorldCache worldCache = session.getWorldCache(); + ScoreboardSession scoreboardSession = worldCache.getScoreboardSession(); + + int pps = scoreboardSession.getPacketsPerSecond(); + if (pps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { + boolean reachedSecondThreshold = pps >= SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD; + + int millisBetweenUpdates = reachedSecondThreshold ? + SECOND_MILLIS_BETWEEN_UPDATES : + FIRST_MILLIS_BETWEEN_UPDATES; + + if (currentTime - scoreboardSession.lastUpdate >= millisBetweenUpdates) { + worldCache.getScoreboard().onUpdate(); + scoreboardSession.lastUpdate = currentTime; + + if (DEBUG_ENABLED && (currentTime - scoreboardSession.lastLog >= 60000)) { // one minute + int threshold = reachedSecondThreshold ? + SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD : + FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; + + connector.getLogger().info( + LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + + LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) + ); + + scoreboardSession.lastLog = currentTime; + } + } + } + } + } + + if (DEBUG_ENABLED) { + long timeSpent = System.currentTimeMillis() - currentTime; + if (timeSpent > 0) { + connector.getLogger().info(String.format( + "Scoreboard updater: took %s ms. Updated %s players", + timeSpent, connector.getPlayers().size() + )); + } + } + + long timeTillNextAction = getTimeTillNextAction(); + sleepFor(timeTillNextAction); + } + } + + private long getTimeTillNextAction() { + long currentTime = System.currentTimeMillis(); + + long timeUntilNextUpdate = FIRST_MILLIS_BETWEEN_UPDATES - (currentTime - lastUpdate); + long timeUntilPacketReset = 1000 - (currentTime - lastPacketsPerSecondUpdate); + + return Math.min(timeUntilNextUpdate, timeUntilPacketReset); + } + + private void sleepFor(long millis) { + if (millis <= 0) { + return; + } + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @RequiredArgsConstructor + @Getter + public static final class ScoreboardSession { + private final GeyserSession session; + private final AtomicInteger pendingPacketsPerSecond = new AtomicInteger(0); + private int packetsPerSecond; + private long lastUpdate; + private long lastLog; + } } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java index efefb339a..41891ee5b 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java @@ -48,7 +48,7 @@ public final class Team { @Setter private NameTagVisibility nameTagVisibility; @Setter private TeamColor color; - private TeamData currentData; + private final TeamData currentData; private TeamData cachedData; private boolean updating; @@ -60,22 +60,6 @@ public final class Team { entities = new ObjectOpenHashSet<>(); } - private void checkAddedEntities(List added) { - if (added.size() == 0) { - return; - } - // we don't have to change the updateType, - // because the scores itself need updating, not the team - for (Objective objective : scoreboard.getObjectives().values()) { - for (String addedEntity : added) { - Score score = objective.getScores().get(addedEntity); - if (score != null) { - score.setTeam(this); - } - } - } - } - public Team addEntities(String... names) { List added = new ArrayList<>(); for (String name : names) { @@ -83,18 +67,20 @@ public final class Team { added.add(name); } } - checkAddedEntities(added); - return this; - } - public Team addEntities(Set names) { - List added = new ArrayList<>(); - for (String name : names) { - if (entities.add(name)) { - added.add(name); + if (added.size() == 0) { + return this; + } + // we don't have to change the updateType, + // because the scores itself need updating, not the team + for (Objective objective : scoreboard.getObjectives()) { + for (String addedEntity : added) { + Score score = objective.getScores().get(addedEntity); + if (score != null) { + score.setTeam(this); + } } } - checkAddedEntities(added); return this; } @@ -169,6 +155,10 @@ public final class Team { } public UpdateType getUpdateType() { + return currentData.updateType; + } + + public UpdateType getCachedUpdateType() { return cachedData != null ? cachedData.updateType : currentData.updateType; } @@ -196,14 +186,14 @@ public final class Team { @Getter public static final class TeamData { - protected UpdateType updateType; - protected long updateTime; + private UpdateType updateType; + private long updateTime; - protected String name; - protected String prefix; - protected String suffix; + private String name; + private String prefix; + private String suffix; - protected TeamData() { + private TeamData() { updateType = UpdateType.ADD; } From 59c34fbcae936d6b6e03956d4212d73ef89ba60e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 29 Sep 2021 14:49:20 -0400 Subject: [PATCH 626/766] Properly handle Norwegian locale code differences Bedrock's code is not the same as Java's code. --- .../geysermc/connector/utils/LocaleUtils.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java index 5423ada60..10fb4ba85 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java @@ -35,10 +35,7 @@ import org.geysermc.connector.GeyserConnector; import java.io.*; import java.nio.file.Files; import java.nio.file.Path; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.zip.ZipFile; @@ -119,7 +116,11 @@ public class LocaleUtils { * @param locale Locale to download and load */ public static void downloadAndLoadLocale(String locale) { - locale = locale.toLowerCase(); + locale = locale.toLowerCase(Locale.ROOT); + if (locale.equals("nb_no")) { + // Different locale code - https://minecraft.fandom.com/wiki/Language + locale = "no_no"; + } // Check the locale isn't already loaded if (!ASSET_MAP.containsKey("minecraft/lang/" + locale + ".json") && !locale.equals("en_us")) { @@ -225,8 +226,14 @@ public class LocaleUtils { langMap.put(entry.getKey(), entry.getValue().asText()); } + String bedrockLocale = locale.toLowerCase(Locale.ROOT); + if (bedrockLocale.equals("no_no")) { + // Store this locale under the Bedrock locale so we don't need to do this check over and over + bedrockLocale = "nb_no"; + } + // Insert the locale into the mappings - LOCALE_MAPPINGS.put(locale.toLowerCase(), langMap); + LOCALE_MAPPINGS.put(bedrockLocale, langMap); try { localeStream.close(); From 0f81b2863011f57286b1dd6bb13f5259b68aa149 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Thu, 30 Sep 2021 22:16:15 +0200 Subject: [PATCH 627/766] Fixed GeyserMC/Geyser#2556 --- .../java/scoreboard/JavaTeamTranslator.java | 25 ++++++++++--------- .../connector/scoreboard/Scoreboard.java | 5 ++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index 9e9d2813c..c4b2eacd5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -43,12 +43,12 @@ import java.util.Arrays; @Translator(packet = ServerTeamPacket.class) public class JavaTeamTranslator extends PacketTranslator { - private final GeyserLogger LOGGER = GeyserConnector.getInstance().getLogger(); + private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override public void translate(GeyserSession session, ServerTeamPacket packet) { - if (LOGGER.isDebug()) { - LOGGER.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); + if (logger.isDebug()) { + logger.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); } if ((packet.getAction() == TeamAction.ADD_PLAYER || packet.getAction() == TeamAction.REMOVE_PLAYER) && packet.getPlayers().length == 0) { @@ -60,15 +60,16 @@ public class JavaTeamTranslator extends PacketTranslator { Scoreboard scoreboard = session.getWorldCache().getScoreboard(); Team team = scoreboard.getTeam(packet.getTeamName()); switch (packet.getAction()) { - case CREATE -> scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers()) - .setName(MessageTranslator.convertMessage(packet.getDisplayName())) - .setColor(packet.getColor()) - .setNameTagVisibility(packet.getNameTagVisibility()) - .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) - .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); + case CREATE -> + scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers()) + .setName(MessageTranslator.convertMessage(packet.getDisplayName())) + .setColor(packet.getColor()) + .setNameTagVisibility(packet.getNameTagVisibility()) + .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) + .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); case UPDATE -> { if (team == null) { - LOGGER.debug(LanguageUtils.getLocaleStringLog( + logger.debug(LanguageUtils.getLocaleStringLog( "geyser.network.translator.team.failed_not_registered", packet.getAction(), packet.getTeamName() )); @@ -84,7 +85,7 @@ public class JavaTeamTranslator extends PacketTranslator { } case ADD_PLAYER -> { if (team == null) { - LOGGER.debug(LanguageUtils.getLocaleStringLog( + logger.debug(LanguageUtils.getLocaleStringLog( "geyser.network.translator.team.failed_not_registered", packet.getAction(), packet.getTeamName() )); @@ -94,7 +95,7 @@ public class JavaTeamTranslator extends PacketTranslator { } case REMOVE_PLAYER -> { if (team == null) { - LOGGER.debug(LanguageUtils.getLocaleStringLog( + logger.debug(LanguageUtils.getLocaleStringLog( "geyser.network.translator.team.failed_not_registered", packet.getAction(), packet.getTeamName() )); diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index 3795db83f..9b2417c16 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -258,6 +258,11 @@ public final class Scoreboard { addScores.add(score.getCachedInfo()); } + // we need this as long as MCPE-143063 hasn't been fixed + if (add && score.getUpdateType() != ADD && !objectiveUpdate) { + removeScores.add(score.getCachedInfo()); + } + score.setUpdateType(NOTHING); } From 50896a24e77844e94b386b912e6c27444bc4777f Mon Sep 17 00:00:00 2001 From: Tim203 Date: Thu, 30 Sep 2021 23:04:32 +0200 Subject: [PATCH 628/766] Documented the if statement introduced in the previous commit --- .../java/org/geysermc/connector/scoreboard/Scoreboard.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index 9b2417c16..199cf7ed2 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -258,8 +258,10 @@ public final class Scoreboard { addScores.add(score.getCachedInfo()); } - // we need this as long as MCPE-143063 hasn't been fixed - if (add && score.getUpdateType() != ADD && !objectiveUpdate) { + // we need this as long as MCPE-143063 hasn't been fixed. + // the checks after 'add' are there to prevent removing scores that + // are going to be removed anyway / don't need to be removed + if (add && score.getUpdateType() != ADD && !(objectiveUpdate || objectiveAdd)) { removeScores.add(score.getCachedInfo()); } From 86c0c009e7a07b610f0bf4ede0e2df2a89082794 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:24:25 -0400 Subject: [PATCH 629/766] Add below name scoreboard support Fixes #1927 --- .../connector/entity/player/PlayerEntity.java | 45 ++++++++++-- .../network/session/cache/EntityCache.java | 4 ++ .../JavaScoreboardObjectiveTranslator.java | 17 ++++- .../scoreboard/JavaUpdateScoreTranslator.java | 72 +++++++++++++++++-- .../connector/scoreboard/Scoreboard.java | 17 ++++- 5 files changed, 145 insertions(+), 10 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index d5170d2fc..b43e020bc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -28,6 +28,7 @@ package org.geysermc.connector.entity.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; @@ -37,10 +38,7 @@ import com.nukkitx.protocol.bedrock.data.command.CommandPermission; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; -import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; -import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; -import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import com.nukkitx.protocol.bedrock.packet.*; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; @@ -50,7 +48,10 @@ import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.connector.scoreboard.Objective; +import org.geysermc.connector.scoreboard.Score; import org.geysermc.connector.scoreboard.Team; +import org.geysermc.connector.scoreboard.UpdateType; import java.util.Collections; import java.util.UUID; @@ -85,6 +86,12 @@ public class PlayerEntity extends LivingEntity { @Override public void spawnEntity(GeyserSession session) { + // Check to see if the player should have a belowname counterpart added + Objective objective = session.getWorldCache().getScoreboard().getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME); + if (objective != null) { + setBelowNameText(session, objective); + } + AddPlayerPacket addPlayerPacket = new AddPlayerPacket(); addPlayerPacket.setUuid(uuid); addPlayerPacket.setUsername(username); @@ -326,4 +333,34 @@ public class PlayerEntity extends LivingEntity { metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); } + + public void setBelowNameText(GeyserSession session, Objective objective) { + if (objective != null && objective.getUpdateType() != UpdateType.REMOVE) { + int amount; + Score score = objective.getScores().get(username); + if (score != null) { + amount = score.getCurrentData().getScore(); + } else { + amount = 0; + } + String displayString = amount + " " + objective.getDisplayName(); + + metadata.put(EntityData.SCORE_TAG, displayString); + if (valid) { + // Already spawned - we still need to run the rest of this code because the spawn packet will be + // providing the information + SetEntityDataPacket packet = new SetEntityDataPacket(); + packet.setRuntimeEntityId(geyserId); + packet.getMetadata().put(EntityData.SCORE_TAG, displayString); + session.sendUpstreamPacket(packet); + } + } else { + if (valid && metadata.remove(EntityData.SCORE_TAG) != null) { + SetEntityDataPacket packet = new SetEntityDataPacket(); + packet.setRuntimeEntityId(geyserId); + packet.getMetadata().put(EntityData.SCORE_TAG, ""); + session.sendUpstreamPacket(packet); + } + } + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java index a9d856b9e..afc90fbe0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java @@ -138,6 +138,10 @@ public class EntityCache { return playerEntities.remove(uuid); } + public Collection getAllPlayerEntities() { + return playerEntities.values(); + } + public void addBossBar(UUID uuid, BossBar bossBar) { bossBars.put(uuid, bossBar); bossBar.addBossBar(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index ab5f7b350..fec000420 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -26,9 +26,11 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; +import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; +import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.network.translators.PacketTranslator; @@ -63,7 +65,20 @@ public class JavaScoreboardObjectiveTranslator extends PacketTranslator objective.setDisplayName(MessageTranslator.convertMessage(packet.getDisplayName())) .setType(packet.getType().ordinal()); - case REMOVE -> scoreboard.unregisterObjective(packet.getName()); + case REMOVE -> { + scoreboard.unregisterObjective(packet.getName()); + if (objective != null && objective == scoreboard.getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME)) { + // Clear the score tag from all players + for (PlayerEntity entity : session.getEntityCache().getAllPlayerEntities()) { + if (!entity.isValid()) { + // Player hasn't spawned yet - don't bother + continue; + } + + entity.setBelowNameText(session, null); + } + } + } } if (objective == null || !objective.isActive()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java index 6a210ce51..870f89a43 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java @@ -26,9 +26,13 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardAction; +import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; +import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.network.translators.PacketTranslator; @@ -58,19 +62,40 @@ public class JavaUpdateScoreTranslator extends PacketTranslator { objective.setScore(packet.getEntry(), packet.getValue()); - break; - case REMOVE: + if (isBelowName) { + // Update the below name score on this player + setBelowName(session, objective, packet.getEntry(), packet.getValue()); + } + } + case REMOVE -> { + if (packet.getObjective().isEmpty()) { + // An empty objective name means all scores are reset for that player (/scoreboard players reset PLAYERNAME) + Objective belowName = scoreboard.getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME); + if (belowName != null) { + setBelowName(session, belowName, packet.getEntry(), 0); + } + } + if (objective != null) { objective.removeScore(packet.getEntry()); + + if (isBelowName) { + // Update the score on this player to now reflect 0 + setBelowName(session, objective, packet.getEntry(), 0); + } } else { for (Objective objective1 : scoreboard.getObjectives()) { objective1.removeScore(packet.getEntry()); } } - break; + } } // ScoreboardUpdater will handle it for us if the packets per second @@ -79,4 +104,43 @@ public class JavaUpdateScoreTranslator extends PacketTranslator objectives = new ConcurrentHashMap<>(); - private final Map objectiveSlots = new HashMap<>(); + @Getter + private final Map objectiveSlots = new EnumMap<>(ScoreboardPosition.class); private final Map teams = new ConcurrentHashMap<>(); // updated on multiple threads private int lastAddScoreCount = 0; @@ -103,6 +105,19 @@ public final class Scoreboard { objective.pendingRemove(); } objectiveSlots.put(displaySlot, objective); + + if (displaySlot == ScoreboardPosition.BELOW_NAME) { + // Display the below name score option to all players + // Of note: unlike Bedrock, if there is an objective in the below name slot, everyone has a display + for (PlayerEntity entity : session.getEntityCache().getAllPlayerEntities()) { + if (!entity.isValid()) { + // Player hasn't spawned yet - don't bother, it'll be done then + continue; + } + + entity.setBelowNameText(session, objective); + } + } } public Team registerNewTeam(String teamName, String[] players) { From b58cbd00bc5c0de388291726e8f90e022c14fc58 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:38:04 -0400 Subject: [PATCH 630/766] Fix edge case in removing below name objectives --- .../geysermc/connector/entity/player/PlayerEntity.java | 4 +++- .../scoreboard/JavaScoreboardObjectiveTranslator.java | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index b43e020bc..85493660b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -355,7 +355,9 @@ public class PlayerEntity extends LivingEntity { session.sendUpstreamPacket(packet); } } else { - if (valid && metadata.remove(EntityData.SCORE_TAG) != null) { + // Always remove the score tag first, then check for valid. + // That way the score tag is removed if the player was spawned, then despawned, and is being respawned + if (metadata.remove(EntityData.SCORE_TAG) != null && valid) { SetEntityDataPacket packet = new SetEntityDataPacket(); packet.setRuntimeEntityId(geyserId); packet.getMetadata().put(EntityData.SCORE_TAG, ""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index fec000420..30ef6568d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -70,11 +70,9 @@ public class JavaScoreboardObjectiveTranslator extends PacketTranslator Date: Sat, 2 Oct 2021 08:53:36 -0400 Subject: [PATCH 631/766] Add Geyser listener into listeners set in BungeeCord Will fix ViaVersion compatibility when https://github.com/ViaVersion/ViaVersion/pull/2698 gets merged. --- .../bungeecord/GeyserBungeeInjector.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java index 88fbe105a..d5dccd1da 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java @@ -39,7 +39,9 @@ import net.md_5.bungee.netty.PipelineUtils; import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.common.GeyserInjector; +import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.util.Set; public class GeyserBungeeInjector extends GeyserInjector { private final ProxyServer proxy; @@ -47,12 +49,14 @@ public class GeyserBungeeInjector extends GeyserInjector { * Set as a variable so it is only set after the proxy has finished initializing */ private ChannelInitializer channelInitializer = null; + private Set bungeeChannels = null; public GeyserBungeeInjector(ProxyServer proxy) { this.proxy = proxy; } @Override + @SuppressWarnings("unchecked") protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Exception { // TODO - allow Geyser to specify its own listener info properties if (proxy.getConfig().getListeners().size() != 1) { @@ -97,6 +101,13 @@ public class GeyserBungeeInjector extends GeyserInjector { bootstrap.getGeyserConfig().getRemote().isUseProxyProtocol() // If Geyser is expecting HAProxy, so should the Bungee end ); + // The field that stores all listeners in BungeeCord + // As of https://github.com/ViaVersion/ViaVersion/pull/2698 ViaVersion adds a wrapper to this field to + // add its connections + Field listenerField = proxyClass.getDeclaredField("listeners"); + listenerField.setAccessible(true); + bungeeChannels = (Set) listenerField.get(proxy); + // This method is what initializes the connection in Java Edition, after Netty is all set. Method initChannel = ChannelInitializer.class.getDeclaredMethod("initChannel", Channel.class); initChannel.setAccessible(true); @@ -116,7 +127,7 @@ public class GeyserBungeeInjector extends GeyserInjector { if (channelInitializer == null) { // Proxy has finished initializing; we can safely grab this variable without fear of plugins modifying it - // (ViaVersion replaces this to inject) + // (Older versions of ViaVersion replace this to inject) channelInitializer = PipelineUtils.SERVER_CHILD; } initChannel.invoke(channelInitializer, ch); @@ -129,6 +140,16 @@ public class GeyserBungeeInjector extends GeyserInjector { .syncUninterruptibly(); this.localChannel = channelFuture; + this.bungeeChannels.add(this.localChannel.channel()); this.serverSocketAddress = channelFuture.channel().localAddress(); } + + @Override + public void shutdown() { + if (this.localChannel != null && this.bungeeChannels != null) { + this.bungeeChannels.remove(this.localChannel.channel()); + this.bungeeChannels = null; + } + super.shutdown(); + } } From 7cd3eb99ef2e44e8ac2cc4741df2d3ca9ced5946 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 2 Oct 2021 14:00:10 -0400 Subject: [PATCH 632/766] Always check for a key in Floodgate's folder first on plugin versions This should avoid people trying to incorrectly copy the key. --- .../bungeecord/GeyserBungeeConfiguration.java | 2 +- .../spigot/GeyserSpigotConfiguration.java | 2 +- .../velocity/GeyserVelocityConfiguration.java | 6 ++-- .../connector/FloodgateKeyLoader.java | 29 ++++++++++--------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java index dc29b4bde..9ad3f13da 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java @@ -45,6 +45,6 @@ public final class GeyserBungeeConfiguration extends GeyserJacksonConfiguration Path geyserDataFolder = plugin.getDataFolder().toPath(); Path floodgateDataFolder = floodgate != null ? floodgate.getDataFolder().toPath() : null; - floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgate, floodgateDataFolder, geyserDataFolder, plugin.getGeyserLogger()); + floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgateDataFolder, geyserDataFolder, plugin.getGeyserLogger()); } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java index e39c50bca..91cba5c15 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java @@ -46,6 +46,6 @@ public final class GeyserSpigotConfiguration extends GeyserJacksonConfiguration Path geyserDataFolder = plugin.getDataFolder().toPath(); Path floodgateDataFolder = floodgate != null ? floodgate.getDataFolder().toPath() : null; - floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgate, floodgateDataFolder, geyserDataFolder, plugin.getGeyserLogger()); + floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgateDataFolder, geyserDataFolder, plugin.getGeyserLogger()); } } diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java index 53b873701..a1b1c861e 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java @@ -36,6 +36,7 @@ import org.geysermc.connector.configuration.GeyserJacksonConfiguration; import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Optional; @Getter @JsonIgnoreProperties(ignoreUnknown = true) @@ -44,7 +45,8 @@ public final class GeyserVelocityConfiguration extends GeyserJacksonConfiguratio private Path floodgateKeyPath; public void loadFloodgate(GeyserVelocityPlugin plugin, ProxyServer proxyServer, File dataFolder) { - PluginContainer floodgate = proxyServer.getPluginManager().getPlugin("floodgate").orElse(null); - floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgate, Paths.get("plugins/floodgate/"), dataFolder.toPath(), plugin.getGeyserLogger()); + Optional floodgate = proxyServer.getPluginManager().getPlugin("floodgate"); + Path floodgateDataPath = floodgate.isPresent() ? Paths.get("plugins/floodgate/") : null; + floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgateDataPath, dataFolder.toPath(), plugin.getGeyserLogger()); } } diff --git a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java b/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java index 0d257cb7d..74335dc7d 100644 --- a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java +++ b/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java @@ -33,30 +33,33 @@ import java.nio.file.Files; import java.nio.file.Path; public class FloodgateKeyLoader { - public static Path getKeyPath(GeyserJacksonConfiguration config, Object floodgate, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) { + public static Path getKeyPath(GeyserJacksonConfiguration config, Path floodgateDataFolder, Path geyserDataFolder, GeyserLogger logger) { if (config.getRemote().getAuthType() != AuthType.FLOODGATE) { return geyserDataFolder.resolve(config.getFloodgateKeyFile()); } - Path floodgateKey = geyserDataFolder.resolve(config.getFloodgateKeyFile()); + // Always prioritize Floodgate's key, if it is installed. + // This mostly prevents people from trying to copy the key and corrupting it in the process + if (floodgateDataFolder != null) { + Path autoKey = floodgateDataFolder.resolve("key.pem"); + if (Files.exists(autoKey)) { + logger.info(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded")); + return autoKey; + } else { + logger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.missing_key")); + } + } + Path floodgateKey; if (config.getFloodgateKeyFile().equals("public-key.pem")) { logger.info("Floodgate 2.0 doesn't use a public/private key system anymore. We'll search for key.pem instead"); floodgateKey = geyserDataFolder.resolve("key.pem"); + } else { + floodgateKey = geyserDataFolder.resolve(config.getFloodgateKeyFile()); } if (!Files.exists(floodgateKey)) { - if (floodgate != null) { - Path autoKey = floodgateDataFolder.resolve("key.pem"); - if (Files.exists(autoKey)) { - logger.info(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded")); - floodgateKey = autoKey; - } else { - logger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.missing_key")); - } - } else { - logger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed")); - } + logger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed")); } return floodgateKey; From a5779a716bfb0d5cfd84eebaf41cd999bd56c021 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 3 Oct 2021 10:54:00 -0400 Subject: [PATCH 633/766] Better handling of invalid items in recipe translator Stonecutter recipes will now be processed correctly, even if an item is modded. Co-authored-by: Setadokalo --- .../java/JavaDeclareRecipesTranslator.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java index 8d01470e0..4b456c0c4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java @@ -85,6 +85,10 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator { ShapelessRecipeData shapelessRecipeData = (ShapelessRecipeData) recipe.getData(); ItemData output = ItemTranslator.translateToBedrock(session, shapelessRecipeData.getResult()); + if (output.equals(ItemData.AIR)) { + // Likely modded item that Bedrock will complain about if it persists + continue; + } // Strip NBT - tools won't appear in the recipe book otherwise output = output.toBuilder().tag(null).build(); ItemData[][] inputCombinations = combinations(session, shapelessRecipeData.getIngredients()); @@ -98,6 +102,10 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator { ShapedRecipeData shapedRecipeData = (ShapedRecipeData) recipe.getData(); ItemData output = ItemTranslator.translateToBedrock(session, shapedRecipeData.getResult()); + if (output.equals(ItemData.AIR)) { + // Likely modded item that Bedrock will complain about if it persists + continue; + } // See above output = output.toBuilder().tag(null).build(); ItemData[][] inputCombinations = combinations(session, shapedRecipeData.getIngredients()); @@ -136,7 +144,9 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator - session.getItemMappings().getItems().get(stoneCuttingRecipeData.getResult().getId()).getJavaIdentifier()))); + session.getItemMappings().getItems() + .getOrDefault(stoneCuttingRecipeData.getResult().getId(), ItemMapping.AIR) + .getJavaIdentifier()))); // Now that it's sorted, let's translate these recipes for (StoneCuttingRecipeData stoneCuttingData : data.getValue()) { @@ -144,6 +154,10 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator new IntArrayList()); outputs.add(stoneCuttingData.getResult().getId()); } } From 175d9aff487c30eebb414fdd5354be327456e65e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 4 Oct 2021 08:58:33 -0400 Subject: [PATCH 634/766] Don't add sculk sensor to creative items without extended height enabled Fixes #2564 --- .../populator/ItemRegistryPopulator.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 65fa1e5a0..175bf13d7 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -42,8 +42,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.objects.*; -import lombok.AllArgsConstructor; -import lombok.Getter; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.item.StoredItemMappings; import org.geysermc.connector.registry.BlockRegistries; @@ -73,14 +71,7 @@ public class ItemRegistryPopulator { PALETTE_VERSIONS.put("1_17_30", new PaletteVersion(Bedrock_v465.V465_CODEC.getProtocolVersion(), Collections.emptyMap())); } - @Getter - @AllArgsConstructor - private static class PaletteVersion { - private final int protocolVersion; - /** - * Key - item not available in this version. Value - Java replacement item - */ - private final Map additionalTranslatedItems; + private record PaletteVersion(int protocolVersion, Map additionalTranslatedItems) { } public static void populate() { @@ -176,6 +167,10 @@ public class ItemRegistryPopulator { } String identifier = itemNode.get("id").textValue(); + if (identifier.equals("minecraft:sculk_sensor") && !GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { + // https://github.com/GeyserMC/Geyser/issues/2564 + continue; + } StartGamePacket.ItemEntry entry = entries.get(identifier); int id = -1; if (entry != null) { @@ -210,7 +205,7 @@ public class ItemRegistryPopulator { } } - BlockMappings blockMappings = BlockRegistries.BLOCKS.forVersion(palette.getValue().getProtocolVersion()); + BlockMappings blockMappings = BlockRegistries.BLOCKS.forVersion(palette.getValue().protocolVersion()); int itemIndex = 0; int javaFurnaceMinecartId = 0; @@ -227,12 +222,12 @@ public class ItemRegistryPopulator { javaOnlyItems.add("minecraft:sculk_sensor"); } // Java-only items for this version - javaOnlyItems.addAll(palette.getValue().getAdditionalTranslatedItems().keySet()); + javaOnlyItems.addAll(palette.getValue().additionalTranslatedItems().keySet()); for (Map.Entry entry : items.entrySet()) { String javaIdentifier = entry.getKey().intern(); GeyserMappingItem mappingItem; - String replacementItem = palette.getValue().getAdditionalTranslatedItems().get(javaIdentifier); + String replacementItem = palette.getValue().additionalTranslatedItems().get(javaIdentifier); if (replacementItem != null) { mappingItem = items.get(replacementItem); } else { @@ -475,7 +470,7 @@ public class ItemRegistryPopulator { NbtMapBuilder componentBuilder = NbtMap.builder(); // Conveniently, as of 1.16.200, the furnace minecart has a texture AND translation string already. // 1.17.30 moves the icon to the item properties section - (palette.getValue().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion() ? + (palette.getValue().protocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion() ? itemProperties : componentBuilder).putCompound("minecraft:icon", NbtMap.builder() .putString("texture", "minecart_furnace") .putString("frame", "0.000000") @@ -517,7 +512,7 @@ public class ItemRegistryPopulator { .furnaceMinecartData(furnaceMinecartData) .build(); - Registries.ITEMS.register(palette.getValue().getProtocolVersion(), itemMappings); + Registries.ITEMS.register(palette.getValue().protocolVersion(), itemMappings); } } } From b65ba2cb5235f75b4b3a0dd711c83df565db6dbb Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 5 Oct 2021 17:06:15 -0400 Subject: [PATCH 635/766] Update display names for team players after team updates Resolves #1912 --- .../org/geysermc/connector/entity/Entity.java | 21 ++- .../connector/entity/player/PlayerEntity.java | 84 ++++++++--- .../network/session/cache/EntityCache.java | 7 +- .../translators/chat/MessageTranslator.java | 135 +++++------------- .../java/scoreboard/JavaTeamTranslator.java | 75 +++++++--- .../connector/scoreboard/Scoreboard.java | 51 ++++++- .../geysermc/connector/scoreboard/Team.java | 33 +++-- 7 files changed, 249 insertions(+), 157 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index f8bf9693d..6dfaad337 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -41,7 +41,6 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.connector.entity.living.ArmorStandEntity; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; @@ -256,10 +255,7 @@ public class Entity { setAir((int) entityMetadata.getValue()); break; case 2: // custom name - if (entityMetadata.getValue() instanceof Component message) { - // Always translate even if it's a TextMessage since there could be translatable parameters - metadata.put(EntityData.NAMETAG, MessageTranslator.convertMessage(message, session.getLocale())); - } + setDisplayName(session, (Component) entityMetadata.getValue()); break; case 3: // is custom name visible if (!this.is(PlayerEntity.class)) @@ -310,6 +306,21 @@ public class Entity { return false; } + /** + * @return the translated string display + */ + protected String setDisplayName(GeyserSession session, Component name) { + if (name != null) { + String displayName = MessageTranslator.convertMessage(name, session.getLocale()); + metadata.put(EntityData.NAMETAG, displayName); + return displayName; + } else if (!metadata.getString(EntityData.NAMETAG).isEmpty()) { + // Clear nametag + metadata.put(EntityData.NAMETAG, ""); + } + return null; + } + /** * Set the height and width of the entity's bounding box */ diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 85493660b..e248d5c63 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -29,6 +29,7 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; +import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; @@ -39,9 +40,11 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.*; +import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; +import org.geysermc.connector.common.ChatColor; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; @@ -53,6 +56,7 @@ import org.geysermc.connector.scoreboard.Score; import org.geysermc.connector.scoreboard.Team; import org.geysermc.connector.scoreboard.UpdateType; +import javax.annotation.Nullable; import java.util.Collections; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -64,6 +68,9 @@ public class PlayerEntity extends LivingEntity { private String username; private boolean playerList = true; // Player is in the player list + @Getter(AccessLevel.NONE) + private String displayName; + /** * Saves the parrot currently on the player's left shoulder; otherwise null */ @@ -79,6 +86,7 @@ public class PlayerEntity extends LivingEntity { profile = gameProfile; uuid = gameProfile.getId(); username = gameProfile.getName(); + displayName = username; // For the OptionalPack, set all bits as invisible by default as this matches Java Edition behavior metadata.put(EntityData.MARK_VARIANT, 0xff); @@ -240,23 +248,6 @@ public class PlayerEntity extends LivingEntity { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 2) { - String username = this.username; - Component name = (Component) entityMetadata.getValue(); - if (name != null) { - username = MessageTranslator.convertMessage(name); - } - Team team = session.getWorldCache().getScoreboard().getTeamFor(username); - if (team != null) { - String displayName = ""; - if (team.isVisibleFor(session.getPlayerEntity().getUsername())) { - displayName = MessageTranslator.toChatColor(team.getColor()) + username; - displayName = team.getCurrentData().getDisplayName(displayName); - } - metadata.put(EntityData.NAMETAG, displayName); - } - } - // Extra hearts - is not metadata but an attribute on Bedrock if (entityMetadata.getId() == 15) { UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); @@ -319,6 +310,65 @@ public class PlayerEntity extends LivingEntity { } } + @Override + protected String setDisplayName(GeyserSession session, Component name) { + String displayName = super.setDisplayName(session, name); + this.displayName = displayName != null ? displayName : username; + // Update if we know this player has a team + updateDisplayName(session, null, false); + + return this.displayName; + } + + //todo this will become common entity logic once UUID support is implemented for them + /** + * @param useGivenTeam even if there is no team, update the username in the entity metadata anyway, and don't look for a team + */ + public void updateDisplayName(GeyserSession session, @Nullable Team team, boolean useGivenTeam) { + if (team == null && !useGivenTeam) { + // Only search for the team if we are not supposed to use the given team + // If the given team is null, this is intentional that we are being removed from the team + team = session.getWorldCache().getScoreboard().getTeamFor(username); + } + + boolean needsUpdate; + String newDisplayName = this.displayName; + if (team != null) { + if (team.isVisibleFor(session.getPlayerEntity().getUsername())) { + TeamColor color = team.getColor(); + String chatColor; + if (color == TeamColor.NONE) { + chatColor = ChatColor.RESET; + } else { + chatColor = MessageTranslator.toChatColor(color); + } + // We have to emulate what modern Java text already does for us and add the color to each section + String prefix = team.getCurrentData().getPrefix(); + String suffix = team.getCurrentData().getSuffix(); + newDisplayName = chatColor + prefix + chatColor + this.displayName + chatColor + suffix; + } else { + // The name is not visible to the session player; clear name + newDisplayName = ""; + } + needsUpdate = useGivenTeam && !newDisplayName.equals(metadata.getString(EntityData.NAMETAG, null)); + metadata.put(EntityData.NAMETAG, newDisplayName); + } else if (useGivenTeam) { + // The name has reset, if it was previously something else + needsUpdate = !newDisplayName.equals(metadata.getString(EntityData.NAMETAG)); + metadata.put(EntityData.NAMETAG, this.displayName); + } else { + needsUpdate = false; + } + + if (needsUpdate) { + // Update the metadata as it won't be updated later + SetEntityDataPacket packet = new SetEntityDataPacket(); + packet.getMetadata().put(EntityData.NAMETAG, newDisplayName); + packet.setRuntimeEntityId(geyserId); + session.sendUpstreamPacket(packet); + } + } + @Override protected void setDimensions(Pose pose) { float height; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java index afc90fbe0..3ff547c95 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java @@ -25,13 +25,16 @@ package org.geysermc.connector.network.session.cache; -import it.unimi.dsi.fastutil.longs.*; +import it.unimi.dsi.fastutil.longs.Long2LongMap; +import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Getter; -import org.geysermc.connector.entity.Tickable; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.Tickable; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index e7aea8909..73d4d7dfc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -28,8 +28,6 @@ package org.geysermc.connector.network.translators.chat; import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.legacyimpl.NBTLegacyHoverEventSerializer; @@ -38,9 +36,10 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; -import java.util.HashMap; +import java.util.EnumMap; import java.util.Locale; import java.util.Map; +import java.util.regex.Pattern; public class MessageTranslator { @@ -54,7 +53,7 @@ public class MessageTranslator { .build(); // Store team colors for player names - private static final Map TEAM_FORMATS = new HashMap<>(); + private static final Map TEAM_COLORS = new EnumMap<>(TeamColor.class); // Legacy formatting character private static final String BASE = "\u00a7"; @@ -62,11 +61,36 @@ public class MessageTranslator { // Reset character private static final String RESET = BASE + "r"; + /* Various regexes to fix formatting for Bedrock's specifications */ + private static final Pattern STRIKETHROUGH_UNDERLINE = Pattern.compile("\u00a7[mn]"); + private static final Pattern COLOR_CHARACTERS = Pattern.compile("\u00a7([0-9a-f])"); + private static final Pattern DOUBLE_RESET = Pattern.compile("\u00a7r\u00a7r"); + static { - TEAM_FORMATS.put(TeamColor.OBFUSCATED, TextDecoration.OBFUSCATED); - TEAM_FORMATS.put(TeamColor.BOLD, TextDecoration.BOLD); - TEAM_FORMATS.put(TeamColor.STRIKETHROUGH, TextDecoration.STRIKETHROUGH); - TEAM_FORMATS.put(TeamColor.ITALIC, TextDecoration.ITALIC); + TEAM_COLORS.put(TeamColor.NONE, ""); + + TEAM_COLORS.put(TeamColor.BLACK, BASE + "0"); + TEAM_COLORS.put(TeamColor.DARK_BLUE, BASE + "1"); + TEAM_COLORS.put(TeamColor.DARK_GREEN, BASE + "2"); + TEAM_COLORS.put(TeamColor.DARK_AQUA, BASE + "3"); + TEAM_COLORS.put(TeamColor.DARK_RED, BASE + "4"); + TEAM_COLORS.put(TeamColor.DARK_PURPLE, BASE + "5"); + TEAM_COLORS.put(TeamColor.GOLD, BASE + "6"); + TEAM_COLORS.put(TeamColor.GRAY, BASE + "7"); + TEAM_COLORS.put(TeamColor.DARK_GRAY, BASE + "8"); + TEAM_COLORS.put(TeamColor.BLUE, BASE + "9"); + TEAM_COLORS.put(TeamColor.GREEN, BASE + "a"); + TEAM_COLORS.put(TeamColor.AQUA, BASE + "b"); + TEAM_COLORS.put(TeamColor.RED, BASE + "c"); + TEAM_COLORS.put(TeamColor.LIGHT_PURPLE, BASE + "d"); + TEAM_COLORS.put(TeamColor.YELLOW, BASE + "e"); + TEAM_COLORS.put(TeamColor.WHITE, BASE + "f"); + + // Formats, not colors + TEAM_COLORS.put(TeamColor.OBFUSCATED, BASE + "k"); + TEAM_COLORS.put(TeamColor.BOLD, BASE + "l"); + TEAM_COLORS.put(TeamColor.STRIKETHROUGH, BASE + "m"); + TEAM_COLORS.put(TeamColor.ITALIC, BASE + "o"); // Tell MCProtocolLib to use our serializer DefaultComponentSerializer.set(GSON_SERIALIZER); @@ -88,12 +112,12 @@ public class MessageTranslator { String legacy = LegacyComponentSerializer.legacySection().serialize(message); // Strip strikethrough and underline as they are not supported on bedrock - legacy = legacy.replaceAll("\u00a7[mn]", ""); + legacy = STRIKETHROUGH_UNDERLINE.matcher(legacy).replaceAll(""); // Make color codes reset formatting like Java // See https://minecraft.gamepedia.com/Formatting_codes#Usage - legacy = legacy.replaceAll("\u00a7([0-9a-f])", "\u00a7r\u00a7$1"); - legacy = legacy.replaceAll("\u00a7r\u00a7r", "\u00a7r"); + legacy = COLOR_CHARACTERS.matcher(legacy).replaceAll("\u00a7r\u00a7$1"); + legacy = DOUBLE_RESET.matcher(legacy).replaceAll("\u00a7r"); return legacy; } catch (Exception e) { @@ -158,84 +182,6 @@ public class MessageTranslator { return GSON_SERIALIZER.serialize(component); } - /** - * Convert a {@link NamedTextColor} into a string for inserting into messages - * - * @param color {@link NamedTextColor} to convert - * @return The converted color string - */ - private static String getColor(NamedTextColor color) { - StringBuilder str = new StringBuilder(BASE); - if (color.equals(NamedTextColor.BLACK)) { - str.append("0"); - } else if (color.equals(NamedTextColor.DARK_BLUE)) { - str.append("1"); - } else if (color.equals(NamedTextColor.DARK_GREEN)) { - str.append("2"); - } else if (color.equals(NamedTextColor.DARK_AQUA)) { - str.append("3"); - } else if (color.equals(NamedTextColor.DARK_RED)) { - str.append("4"); - } else if (color.equals(NamedTextColor.DARK_PURPLE)) { - str.append("5"); - } else if (color.equals(NamedTextColor.GOLD)) { - str.append("6"); - } else if (color.equals(NamedTextColor.GRAY)) { - str.append("7"); - } else if (color.equals(NamedTextColor.DARK_GRAY)) { - str.append("8"); - } else if (color.equals(NamedTextColor.BLUE)) { - str.append("9"); - } else if (color.equals(NamedTextColor.GREEN)) { - str.append("a"); - } else if (color.equals(NamedTextColor.AQUA)) { - str.append("b"); - } else if (color.equals(NamedTextColor.RED)) { - str.append("c"); - } else if (color.equals(NamedTextColor.LIGHT_PURPLE)) { - str.append("d"); - } else if (color.equals(NamedTextColor.YELLOW)) { - str.append("e"); - } else if (color.equals(NamedTextColor.WHITE)) { - str.append("f"); - } else { - return ""; - } - - return str.toString(); - } - - /** - * Convert a {@link TextDecoration} into a string for inserting into messages - * - * @param format {@link TextDecoration} to convert - * @return The converted chat formatting string - */ - private static String getFormat(TextDecoration format) { - StringBuilder str = new StringBuilder(BASE); - switch (format) { - case OBFUSCATED: - str.append("k"); - break; - case BOLD: - str.append("l"); - break; - case STRIKETHROUGH: - str.append("m"); - break; - case UNDERLINED: - str.append("n"); - break; - case ITALIC: - str.append("o"); - break; - default: - return ""; - } - - return str.toString(); - } - /** * Convert a team color to a chat color * @@ -243,16 +189,7 @@ public class MessageTranslator { * @return The chat color character */ public static String toChatColor(TeamColor teamColor) { - if (teamColor.equals(TeamColor.NONE)) { - return ""; - } - - NamedTextColor textColor = NamedTextColor.NAMES.value(teamColor.name().toLowerCase()); - if (textColor != null) { - return getColor(textColor); - } - - return getFormat(TEAM_FORMATS.get(teamColor)); + return TEAM_COLORS.getOrDefault(teamColor, ""); } /** diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index c4b2eacd5..e309209aa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -25,7 +25,9 @@ package org.geysermc.connector.network.translators.java.scoreboard; +import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamAction; +import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; @@ -37,9 +39,9 @@ import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.scoreboard.Team; import org.geysermc.connector.scoreboard.UpdateType; -import org.geysermc.connector.utils.LanguageUtils; import java.util.Arrays; +import java.util.Set; @Translator(packet = ServerTeamPacket.class) public class JavaTeamTranslator extends PacketTranslator { @@ -60,48 +62,77 @@ public class JavaTeamTranslator extends PacketTranslator { Scoreboard scoreboard = session.getWorldCache().getScoreboard(); Team team = scoreboard.getTeam(packet.getTeamName()); switch (packet.getAction()) { - case CREATE -> - scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers()) - .setName(MessageTranslator.convertMessage(packet.getDisplayName())) - .setColor(packet.getColor()) - .setNameTagVisibility(packet.getNameTagVisibility()) - .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) - .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); + case CREATE -> { + team = scoreboard.registerNewTeam(packet.getTeamName(), packet.getPlayers()) + .setName(MessageTranslator.convertMessage(packet.getDisplayName())) + .setColor(packet.getColor()) + .setNameTagVisibility(packet.getNameTagVisibility()) + .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) + .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())); + + if (packet.getPlayers().length != 0) { + if ((team.getNameTagVisibility() != NameTagVisibility.ALWAYS && !team.isVisibleFor(session.getPlayerEntity().getUsername())) + || team.getColor() != TeamColor.NONE + || !team.getCurrentData().getPrefix().isEmpty() + || !team.getCurrentData().getSuffix().isEmpty()) { + // Something is here that would modify entity names + scoreboard.updateEntityNames(team, true); + } + } + } case UPDATE -> { if (team == null) { - logger.debug(LanguageUtils.getLocaleStringLog( - "geyser.network.translator.team.failed_not_registered", - packet.getAction(), packet.getTeamName() - )); + if (logger.isDebug()) { + logger.debug("Error while translating Team Packet " + packet.getAction() + + "! Scoreboard Team " + packet.getTeamName() + " is not registered." + ); + } return; } + TeamColor oldColor = team.getColor(); + NameTagVisibility oldVisibility = team.getNameTagVisibility(); + String oldPrefix = team.getCurrentData().getPrefix(); + String oldSuffix = team.getCurrentData().getSuffix(); + team.setName(MessageTranslator.convertMessage(packet.getDisplayName())) .setColor(packet.getColor()) .setNameTagVisibility(packet.getNameTagVisibility()) .setPrefix(MessageTranslator.convertMessage(packet.getPrefix(), session.getLocale())) .setSuffix(MessageTranslator.convertMessage(packet.getSuffix(), session.getLocale())) .setUpdateType(UpdateType.UPDATE); + + if (oldVisibility != team.getNameTagVisibility() + || oldColor != team.getColor() + || !oldPrefix.equals(team.getCurrentData().getPrefix()) + || !oldSuffix.equals(team.getCurrentData().getSuffix())) { + // Update entities attached to this team as something about their nameplates have changed + scoreboard.updateEntityNames(team, false); + } } case ADD_PLAYER -> { if (team == null) { - logger.debug(LanguageUtils.getLocaleStringLog( - "geyser.network.translator.team.failed_not_registered", - packet.getAction(), packet.getTeamName() - )); + if (logger.isDebug()) { + logger.debug("Error while translating Team Packet " + packet.getAction() + + "! Scoreboard Team " + packet.getTeamName() + " is not registered." + ); + } return; } - team.addEntities(packet.getPlayers()); + Set added = team.addEntities(packet.getPlayers()); + scoreboard.updateEntityNames(team, added, true); } case REMOVE_PLAYER -> { if (team == null) { - logger.debug(LanguageUtils.getLocaleStringLog( - "geyser.network.translator.team.failed_not_registered", - packet.getAction(), packet.getTeamName() - )); + if (logger.isDebug()) { + logger.debug("Error while translating Team Packet " + packet.getAction() + + "! Scoreboard Team " + packet.getTeamName() + " is not registered." + ); + } return; } - team.removeEntities(packet.getPlayers()); + Set removed = team.removeEntities(packet.getPlayers()); + scoreboard.updateEntityNames(null, removed, true); } case REMOVE -> scoreboard.removeTeam(packet.getTeamName()); } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index f194b97f4..3596907e7 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -33,10 +33,12 @@ import com.nukkitx.protocol.bedrock.packet.SetScorePacket; import lombok.Getter; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; +import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; +import javax.annotation.Nullable; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; @@ -127,7 +129,8 @@ public final class Scoreboard { return team; } - team = new Team(this, teamName).addEntities(players); + team = new Team(this, teamName); + team.addEntities(players); teams.put(teamName, team); return team; } @@ -155,6 +158,9 @@ public final class Scoreboard { Team remove = teams.remove(teamName); if (remove != null) { remove.setUpdateType(REMOVE); + // We need to use the direct entities list here, so #refreshSessionPlayerDisplays also updates accordingly + // With the player's lack of a team in visibility checks + updateEntityNames(remove, remove.getEntities(), true); } } @@ -326,4 +332,47 @@ public final class Scoreboard { } return null; } + + /** + * Updates the display names of all entities in a given team. + * @param teamChange the players have either joined or left the team. Used for optimizations when just the display name updated. + */ + public void updateEntityNames(Team team, boolean teamChange) { + Set names = new HashSet<>(team.getEntities()); + updateEntityNames(team, names, teamChange); + } + + /** + * Updates the display name of a set of entities within a given team. The team may also be null if the set is being removed + * from a team. + */ + public void updateEntityNames(@Nullable Team team, Set names, boolean teamChange) { + if (names.remove(session.getPlayerEntity().getUsername()) && teamChange) { + // If the player's team changed, then other entities' teams may modify their visibility based on team status + refreshSessionPlayerDisplays(); + } + if (!names.isEmpty()) { + for (Entity entity : session.getEntityCache().getEntities().values()) { + // This more complex logic is for the future to iterate over all entities, not just players + if (entity instanceof PlayerEntity player && names.remove(player.getUsername())) { + player.updateDisplayName(session, team, true); + if (names.isEmpty()) { + break; + } + } + } + } + } + + /** + * If the team's player was refreshed, then we need to go through every entity and check... + */ + private void refreshSessionPlayerDisplays() { + for (Entity entity : session.getEntityCache().getEntities().values()) { + if (entity instanceof PlayerEntity player) { + Team playerTeam = session.getWorldCache().getScoreboard().getTeamFor(player.getUsername()); + player.updateDisplayName(session, playerTeam, true); + } + } + } } diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java index 41891ee5b..b5aef31d0 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java @@ -33,8 +33,7 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; import java.util.Set; @Getter @@ -43,7 +42,7 @@ public final class Team { private final Scoreboard scoreboard; private final String id; - @Getter(AccessLevel.NONE) + @Getter(AccessLevel.PACKAGE) private final Set entities; @Setter private NameTagVisibility nameTagVisibility; @Setter private TeamColor color; @@ -60,16 +59,16 @@ public final class Team { entities = new ObjectOpenHashSet<>(); } - public Team addEntities(String... names) { - List added = new ArrayList<>(); + public Set addEntities(String... names) { + Set added = new HashSet<>(); for (String name : names) { if (entities.add(name)) { added.add(name); } } - if (added.size() == 0) { - return this; + if (added.isEmpty()) { + return added; } // we don't have to change the updateType, // because the scores itself need updating, not the team @@ -81,13 +80,21 @@ public final class Team { } } } - return this; + + return added; } - public void removeEntities(String... names) { + /** + * @return all removed entities from this team + */ + public Set removeEntities(String... names) { + Set removed = new HashSet<>(); for (String name : names) { - entities.remove(name); + if (entities.remove(name)) { + removed.add(name); + } } + return removed; } public boolean hasEntity(String name) { @@ -172,7 +179,11 @@ public final class Team { public boolean isVisibleFor(String entity) { return switch (nameTagVisibility) { - case HIDE_FOR_OTHER_TEAMS -> hasEntity(entity); + case HIDE_FOR_OTHER_TEAMS -> { + // Player must be in a team in order for HIDE_FOR_OTHER_TEAMS to be triggered + Team team = scoreboard.getTeamFor(entity); + yield team == null || team == this; + } case HIDE_FOR_OWN_TEAM -> !hasEntity(entity); case ALWAYS -> true; case NEVER -> false; From e1085270b842b0a482c36f65356bd8c0e95af741 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 5 Oct 2021 18:55:32 -0400 Subject: [PATCH 636/766] Don't use Locale class in MessageTranslator The Minecraft Java client doesn't appear to use any specific locale function in its translating. Just passing a string saves computational time in parsing a locale that will be the same result every time. Should this be invalid behavior, we should instead cache the Locale class for a player so it doesn't have to be repeatedly calculated. --- .../translators/chat/MessageTranslator.java | 10 ++++------ .../chat/MinecraftTranslationRegistry.java | 17 ++++++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index 73d4d7dfc..7fa74d4cd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -37,14 +37,13 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; import java.util.EnumMap; -import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; public class MessageTranslator { - // These are used for handling the translations of the messages - private static final TranslatableComponentRenderer RENDERER = TranslatableComponentRenderer.usingTranslationSource(new MinecraftTranslationRegistry()); + // Custom instead of TranslatableComponentRenderer#usingTranslationSource so we don't need to worry about finding a Locale class + private static final TranslatableComponentRenderer RENDERER = new MinecraftTranslationRegistry(); // Construct our own {@link GsonComponentSerializer} since we need to change a setting private static final GsonComponentSerializer GSON_SERIALIZER = GsonComponentSerializer.builder() @@ -105,9 +104,8 @@ public class MessageTranslator { */ public static String convertMessage(Component message, String locale) { try { - // Get a Locale from the given locale string - Locale localeCode = Locale.forLanguageTag(locale.replace('_', '-')); - message = RENDERER.render(message, localeCode); + // Translate any components that require it + message = RENDERER.render(message, locale); String legacy = LegacyComponentSerializer.legacySection().serialize(message); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java index 3f8edc657..3bae14abf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java @@ -25,8 +25,7 @@ package org.geysermc.connector.network.translators.chat; -import net.kyori.adventure.key.Key; -import net.kyori.adventure.translation.Translator; +import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import org.geysermc.connector.utils.LocaleUtils; import javax.annotation.Nonnull; @@ -40,19 +39,14 @@ import java.util.regex.Pattern; * This class is used for mapping a translation key with the already loaded Java locale data * Used in MessageTranslator.java as part of the KyoriPowered/Adventure library */ -public class MinecraftTranslationRegistry implements Translator { +public class MinecraftTranslationRegistry extends TranslatableComponentRenderer { private final Pattern stringReplacement = Pattern.compile("%s"); private final Pattern positionalStringReplacement = Pattern.compile("%([0-9]+)\\$s"); @Override - public @Nonnull Key name() { - return Key.key("geyser", "minecraft_translations"); - } - - @Override - public @Nullable MessageFormat translate(@Nonnull String key, @Nonnull Locale locale) { + public @Nullable MessageFormat translate(@Nonnull String key, @Nonnull String locale) { // Get the locale string - String localeString = LocaleUtils.getLocaleString(key, locale.toString()); + String localeString = LocaleUtils.getLocaleString(key, locale); // Replace the `%s` with numbered inserts `{0}` Pattern p = stringReplacement; @@ -75,6 +69,7 @@ public class MinecraftTranslationRegistry implements Translator { m.appendTail(sb); // replace single quote instances which get lost in MessageFormat otherwise - return new MessageFormat(sb.toString().replace("'", "''"), locale); + // Locale shouldn't need to be specific - dates for example will not be handled + return new MessageFormat(sb.toString().replace("'", "''"), Locale.ROOT); } } From 11bc083885488411904ffe7aebca65c33d6338eb Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 7 Oct 2021 11:00:43 -0400 Subject: [PATCH 637/766] Update MCProtocolLib; add clearer errors for various connection issues Errors that are a result of online mode and offline mode clashes are now clarified. Users will now get a clearer message stating that the server is offline. Resolves #2501 --- .../platform/spigot/GeyserSpigotPlugin.java | 3 +- connector/pom.xml | 28 ++---------- .../network/session/GeyserSession.java | 44 ++++++++++++++++--- .../translators/chat/MessageTranslator.java | 11 +---- .../geysermc/connector/utils/Constants.java | 2 + connector/src/main/resources/languages | 2 +- 6 files changed, 47 insertions(+), 43 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index 4d19de0b3..38d3fb6c6 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -42,6 +42,7 @@ import org.geysermc.connector.dump.BootstrapDumpInfo; import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough; +import org.geysermc.connector.utils.Constants; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; @@ -126,7 +127,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // Remove this in like a year if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); + geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION)); this.getPluginLoader().disablePlugin(this); return; } diff --git a/connector/pom.xml b/connector/pom.xml index b77a94a2e..8964f18c8 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -11,7 +11,7 @@ connector - 4.8.0 + 4.9.2 8.5.2 2.12.4 4.1.66.Final @@ -147,15 +147,11 @@ compile - com.github.RednedEpic + com.github.GeyserMC MCProtocolLib - e17787a + e7979c4 compile - - net.kyori - adventure-text-serializer-gson - com.github.steveice10 packetlib @@ -226,30 +222,12 @@ osx-x86_64 - - net.kyori - adventure-api - ${adventure.version} - compile - - - net.kyori - adventure-text-serializer-gson - ${adventure.version} - compile - net.kyori adventure-text-serializer-legacy ${adventure.version} compile - - net.kyori - adventure-text-serializer-gson-legacy-impl - ${adventure.version} - compile - junit diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 21730b230..e5009938d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -35,6 +35,7 @@ import com.github.steveice10.mc.auth.service.MsaAuthenticationService; import com.github.steveice10.mc.protocol.MinecraftConstants; import com.github.steveice10.mc.protocol.MinecraftProtocol; import com.github.steveice10.mc.protocol.data.SubProtocol; +import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; @@ -100,6 +101,7 @@ import org.geysermc.cumulus.util.FormBuilder; import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.util.BedrockData; +import java.net.ConnectException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; @@ -831,16 +833,44 @@ public class GeyserSession implements CommandSender { public void disconnected(DisconnectedEvent event) { loggingIn = false; loggedIn = false; - if (downstream != null && downstream.isInternallyConnecting()) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), event.getReason())); + + String disconnectMessage; + Throwable cause = event.getCause(); + if (cause instanceof UnexpectedEncryptionException) { + if (remoteAuthType != AuthType.FLOODGATE) { + // Server expects online mode + disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", getLocale()); + // Explain that they may be looking for Floodgate. + connector.getLogger().warning(LanguageUtils.getLocaleStringLog( + connector.getPlatformType() == PlatformType.STANDALONE ? + "geyser.network.remote.floodgate_explanation_standalone" + : "geyser.network.remote.floodgate_explanation_plugin", + Constants.FLOODGATE_DOWNLOAD_LOCATION + )); + } else { + // Likely that Floodgate is not configured correctly. + disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", getLocale()); + if (connector.getPlatformType() == PlatformType.STANDALONE) { + connector.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone")); + } + } + } else if (cause instanceof ConnectException) { + // Server is offline, probably + disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale()); } else { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, event.getReason())); - } - if (event.getCause() != null) { - event.getCause().printStackTrace(); + disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason()); } - upstream.disconnect(MessageTranslator.convertMessageLenient(event.getReason())); + if (downstream != null && downstream.isInternallyConnecting()) { + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); + } else { + connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); + } + if (cause != null) { + cause.printStackTrace(); + } + + upstream.disconnect(disconnectMessage); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index 7fa74d4cd..1f0380f2f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -30,7 +30,6 @@ import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import net.kyori.adventure.text.serializer.gson.legacyimpl.NBTLegacyHoverEventSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; @@ -45,11 +44,8 @@ public class MessageTranslator { // Custom instead of TranslatableComponentRenderer#usingTranslationSource so we don't need to worry about finding a Locale class private static final TranslatableComponentRenderer RENDERER = new MinecraftTranslationRegistry(); - // Construct our own {@link GsonComponentSerializer} since we need to change a setting - private static final GsonComponentSerializer GSON_SERIALIZER = GsonComponentSerializer.builder() - // Specify that we may be expecting legacy hover events - .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.get()) - .build(); + // Possible TODO: replace the legacy hover event serializer with an empty one since we have no use for hover events + private static final GsonComponentSerializer GSON_SERIALIZER = DefaultComponentSerializer.get(); // Store team colors for player names private static final Map TEAM_COLORS = new EnumMap<>(TeamColor.class); @@ -90,9 +86,6 @@ public class MessageTranslator { TEAM_COLORS.put(TeamColor.BOLD, BASE + "l"); TEAM_COLORS.put(TeamColor.STRIKETHROUGH, BASE + "m"); TEAM_COLORS.put(TeamColor.ITALIC, BASE + "o"); - - // Tell MCProtocolLib to use our serializer - DefaultComponentSerializer.set(GSON_SERIALIZER); } /** diff --git a/connector/src/main/java/org/geysermc/connector/utils/Constants.java b/connector/src/main/java/org/geysermc/connector/utils/Constants.java index 02f5c1ae4..0a6062a3b 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Constants.java +++ b/connector/src/main/java/org/geysermc/connector/utils/Constants.java @@ -35,6 +35,8 @@ public final class Constants { public static final String NEWS_OVERVIEW_URL = "https://api.geysermc.org/v1/news"; public static final String NEWS_PROJECT_NAME = "geyser"; + public static final String FLOODGATE_DOWNLOAD_LOCATION = "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/"; + static { URI wsUri = null; try { diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index 1138a6462..b3ef0d567 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit 1138a64627dec66fdb7f33c922ff6cd5636ec30a +Subproject commit b3ef0d567d2e088a3b900741a464ad00524e9beb From 60115200439362bb9f470e522c126bc4acee9f21 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Mon, 4 Oct 2021 20:46:38 +0200 Subject: [PATCH 638/766] Allow scores and teams to update more than once every millisecond --- .../geysermc/connector/scoreboard/Score.java | 12 ++-- .../connector/scoreboard/Scoreboard.java | 62 ++++++++++--------- .../geysermc/connector/scoreboard/Team.java | 8 +-- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java index 7f3ac6e60..10abfa29a 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java @@ -59,6 +59,10 @@ public final class Score { return name; } + public int getScore() { + return currentData.getScore(); + } + public Score setScore(int score) { currentData.score = score; return this; @@ -90,14 +94,14 @@ public final class Score { public Score setUpdateType(UpdateType updateType) { if (updateType != UpdateType.NOTHING) { - currentData.updateTime = System.currentTimeMillis(); + currentData.changed = true; } currentData.updateType = updateType; return this; } public boolean shouldUpdate() { - return cachedData == null || currentData.updateTime > cachedData.updateTime || + return cachedData == null || currentData.changed || (currentData.team != null && currentData.team.shouldUpdate()); } @@ -112,7 +116,7 @@ public final class Score { cachedData.updateType = currentData.updateType; } - cachedData.updateTime = currentData.updateTime; + currentData.changed = false; cachedData.team = currentData.team; cachedData.score = currentData.score; @@ -127,7 +131,7 @@ public final class Score { @Getter public static final class ScoreData { private UpdateType updateType; - private long updateTime; + private boolean changed; private Team team; private int score; diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index 3596907e7..6f4b540ac 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -135,35 +135,6 @@ public final class Scoreboard { return team; } - public Objective getObjective(String objectiveName) { - return objectives.get(objectiveName); - } - - public Collection getObjectives() { - return objectives.values(); - } - - public Team getTeam(String teamName) { - return teams.get(teamName); - } - - public void unregisterObjective(String objectiveName) { - Objective objective = getObjective(objectiveName); - if (objective != null) { - objective.pendingRemove(); - } - } - - public void removeTeam(String teamName) { - Team remove = teams.remove(teamName); - if (remove != null) { - remove.setUpdateType(REMOVE); - // We need to use the direct entities list here, so #refreshSessionPlayerDisplays also updates accordingly - // With the player's lack of a team in visibility checks - updateEntityNames(remove, remove.getEntities(), true); - } - } - public void onUpdate() { List addScores = new ArrayList<>(lastAddScoreCount); List removeScores = new ArrayList<>(lastRemoveScoreCount); @@ -324,6 +295,29 @@ public final class Scoreboard { session.sendUpstreamPacket(removeObjectivePacket); } + public Objective getObjective(String objectiveName) { + return objectives.get(objectiveName); + } + + public Collection getObjectives() { + return objectives.values(); + } + + public void unregisterObjective(String objectiveName) { + Objective objective = getObjective(objectiveName); + if (objective != null) { + objective.pendingRemove(); + } + } + + public Objective getSlot(ScoreboardPosition slot) { + return objectiveSlots.get(slot); + } + + public Team getTeam(String teamName) { + return teams.get(teamName); + } + public Team getTeamFor(String entity) { for (Team team : teams.values()) { if (team.hasEntity(entity)) { @@ -333,6 +327,16 @@ public final class Scoreboard { return null; } + public void removeTeam(String teamName) { + Team remove = teams.remove(teamName); + if (remove != null) { + remove.setUpdateType(REMOVE); + // We need to use the direct entities list here, so #refreshSessionPlayerDisplays also updates accordingly + // With the player's lack of a team in visibility checks + updateEntityNames(remove, remove.getEntities(), true); + } + } + /** * Updates the display names of all entities in a given team. * @param teamChange the players have either joined or left the team. Used for optimizations when just the display name updated. diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java index b5aef31d0..fe986b7aa 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java @@ -139,7 +139,7 @@ public final class Team { } public boolean shouldUpdate() { - return updating || cachedData == null || currentData.updateTime > cachedData.updateTime; + return updating || cachedData == null || currentData.changed; } public void prepareUpdate() { @@ -155,7 +155,7 @@ public final class Team { cachedData.updateType = currentData.updateType; } - cachedData.updateTime = currentData.updateTime; + cachedData.changed = currentData.changed; cachedData.name = currentData.name; cachedData.prefix = currentData.prefix; cachedData.suffix = currentData.suffix; @@ -171,7 +171,7 @@ public final class Team { public Team setUpdateType(UpdateType updateType) { if (updateType != UpdateType.NOTHING) { - currentData.updateTime = System.currentTimeMillis(); + currentData.changed = true; } currentData.updateType = updateType; return this; @@ -198,7 +198,7 @@ public final class Team { @Getter public static final class TeamData { private UpdateType updateType; - private long updateTime; + private boolean changed; private String name; private String prefix; From 81566d0577ade5d9e9d7ce2fcdd5e3856e40a391 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Thu, 7 Oct 2021 20:47:29 +0200 Subject: [PATCH 639/766] Reset the 'changed' boolean after updating --- .../src/main/java/org/geysermc/connector/scoreboard/Team.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java index fe986b7aa..78457fba1 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java @@ -155,7 +155,7 @@ public final class Team { cachedData.updateType = currentData.updateType; } - cachedData.changed = currentData.changed; + currentData.changed = false; cachedData.name = currentData.name; cachedData.prefix = currentData.prefix; cachedData.suffix = currentData.suffix; From bf1359cf0cba13e28ca415f8a9cc3a69b7ded646 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 10 Oct 2021 11:21:48 -0400 Subject: [PATCH 640/766] Various border fixes; adhere to world coordinate scale Fixes #2552 --- .../network/session/cache/ChunkCache.java | 5 +- .../network/session/cache/WorldBorder.java | 48 ++++++++++++++----- .../java/JavaJoinGameTranslator.java | 2 +- .../java/JavaRespawnTranslator.java | 2 +- .../JavaInitializeBorderTranslator.java | 5 +- ...ava => JavaSetBorderCenterTranslator.java} | 6 +-- .../geysermc/connector/utils/ChunkUtils.java | 13 ++--- 7 files changed, 55 insertions(+), 26 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/{JavaSetBorderCenterPacket.java => JavaSetBorderCenterTranslator.java} (90%) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java index 4c2d8c36f..6154ff65f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java @@ -67,7 +67,10 @@ public class ChunkCache { chunks.put(chunkPosition, geyserColumn); } - public GeyserColumn getChunk(int chunkX, int chunkZ) { + /** + * Doesn't check for cache enabled, so don't use this without checking that first! + */ + private GeyserColumn getChunk(int chunkX, int chunkZ) { long chunkPosition = MathUtils.chunkPositionToLong(chunkX, chunkZ); return chunks.getOrDefault(chunkPosition, null); } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java index 202be421c..f312bb8b4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.session.cache; import com.nukkitx.math.GenericMath; -import com.nukkitx.math.vector.Vector2f; +import com.nukkitx.math.vector.Vector2d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; @@ -43,35 +43,45 @@ import java.util.Collections; public class WorldBorder { private static final double DEFAULT_WORLD_BORDER_SIZE = 5.9999968E7D; - @Getter @Setter - private @Nonnull Vector2f center = Vector2f.ZERO; + @Setter + private @Nonnull Vector2d center = Vector2d.ZERO; /** * The diameter in blocks of the world border before it got changed or similar to newDiameter if not changed. */ - @Getter @Setter + @Setter private double oldDiameter = DEFAULT_WORLD_BORDER_SIZE; /** * The diameter in blocks of the new world border. */ - @Getter @Setter + @Setter private double newDiameter = DEFAULT_WORLD_BORDER_SIZE; /** * The speed to apply an expansion/shrinking of the world border. * When a client joins they get the actual border oldDiameter and the time left to reach the newDiameter. */ - @Getter @Setter + @Setter private long speed = 0; /** * The time in seconds before a shrinking world border would hit a not moving player. * Creates the same visual warning effect as warningBlocks. */ - @Getter @Setter + @Setter private int warningDelay = 15; /** * Block length before you reach the border to show warning particles. */ - @Getter @Setter + @Setter private int warningBlocks = 5; + /** + * The world border cannot go beyond this number, positive or negative, in world coordinates + */ + @Setter + private int absoluteMaxSize = 29999984; + + /** + * The world coordinate scale as sent in the dimension registry. Used to scale the center X and Z. + */ + private double worldCoordinateScale = 1.0D; @Getter private boolean resizing; @@ -112,6 +122,14 @@ public class WorldBorder { update(); } + public void setWorldCoordinateScale(double worldCoordinateScale) { + boolean needsUpdate = worldCoordinateScale != this.worldCoordinateScale; + this.worldCoordinateScale = worldCoordinateScale; + if (needsUpdate) { + this.update(); + } + } + /** * @return true as long the entity is within the world limits. */ @@ -173,10 +191,16 @@ public class WorldBorder { } else { radius = this.newDiameter / 2.0D; } - this.minX = center.getX() - radius; - this.minZ = center.getY() - radius; // Mapping 2D vector to 3D coordinates >> Y becomes Z - this.maxX = center.getX() + radius; - this.maxZ = center.getY() + radius; // Mapping 2D vector to 3D coordinates >> Y becomes Z + + double absoluteMinSize = -this.absoluteMaxSize; + // Used in the Nether by default + double centerX = this.center.getX() / this.worldCoordinateScale; + double centerZ = this.center.getY() / this.worldCoordinateScale; // Mapping 2D vector to 3D coordinates >> Y becomes Z + + this.minX = GenericMath.clamp(centerX - radius, absoluteMinSize, this.absoluteMaxSize); + this.minZ = GenericMath.clamp(centerZ - radius, absoluteMinSize, this.absoluteMaxSize); + this.maxX = GenericMath.clamp(centerX + radius, absoluteMinSize, this.absoluteMaxSize); + this.maxZ = GenericMath.clamp(centerZ + radius, absoluteMinSize, this.absoluteMaxSize); /* * Caching the warning boundaries. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index da21b7c22..b0332e23e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -114,6 +114,6 @@ public class JavaJoinGameTranslator extends PacketTranslator DimensionUtils.switchDimension(session, newDimension); } - ChunkUtils.applyDimensionHeight(session, packet.getDimension()); + ChunkUtils.loadDimensionTag(session, packet.getDimension()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java index 45c33fcf8..05632cefa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.world.border; import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerInitializeBorderPacket; -import com.nukkitx.math.vector.Vector2f; +import com.nukkitx.math.vector.Vector2d; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; @@ -38,13 +38,14 @@ public class JavaInitializeBorderTranslator extends PacketTranslator 0); + worldBorder.setAbsoluteMaxSize(packet.getNewAbsoluteMaxSize()); worldBorder.update(); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java index 034c7cf6d..3d755fce1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java @@ -26,19 +26,19 @@ package org.geysermc.connector.network.translators.java.world.border; import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderCenterPacket; -import com.nukkitx.math.vector.Vector2f; +import com.nukkitx.math.vector.Vector2d; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ServerSetBorderCenterPacket.class) -public class JavaSetBorderCenterPacket extends PacketTranslator { +public class JavaSetBorderCenterTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ServerSetBorderCenterPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); - worldBorder.setCenter(Vector2f.from(packet.getNewCenterX(), packet.getNewCenterZ())); + worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); worldBorder.update(); } diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 3b2614d77..fbe30f6e5 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -31,10 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.chunk.Column; import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.IntTag; -import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.github.steveice10.opennbt.tag.builtin.Tag; +import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.math.vector.Vector2i; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; @@ -429,10 +426,10 @@ public class ChunkUtils { } /** - * Process the minimum and maximum heights for this dimension. + * Process the minimum and maximum heights for this dimension, and processes the world coordinate scale. * This must be done after the player has switched dimensions so we know what their dimension is */ - public static void applyDimensionHeight(GeyserSession session, CompoundTag dimensionTag) { + public static void loadDimensionTag(GeyserSession session, CompoundTag dimensionTag) { int minY = ((IntTag) dimensionTag.get("min_y")).getValue(); int maxY = ((IntTag) dimensionTag.get("height")).getValue(); // Logical height can be ignored probably - seems to be for artificial limits like the Nether. @@ -467,6 +464,10 @@ public class ChunkUtils { session.getChunkCache().setMinY(minY); session.getChunkCache().setHeightY(maxY); + + // Load world coordinate scale for the world border + double coordinateScale = ((DoubleTag) dimensionTag.get("coordinate_scale")).getValue(); + session.getWorldBorder().setWorldCoordinateScale(coordinateScale); } @Data From 265c42fe09093e83828096efc2c3a2c4e798af5b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 10 Oct 2021 14:54:06 -0400 Subject: [PATCH 641/766] Ignore all entity metadata for player names The Java client ignores this; only the GameProfile of the player can set this. Fixes #2563 --- .../org/geysermc/connector/entity/Entity.java | 18 ++++++------ .../connector/entity/player/PlayerEntity.java | 28 +++++++++---------- .../entity/JavaEntityMetadataTranslator.java | 5 ++-- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index 6dfaad337..fe0077d5d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -41,7 +41,6 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.chat.MessageTranslator; @@ -51,7 +50,7 @@ import org.geysermc.connector.utils.MathUtils; @Setter public class Entity { protected long entityId; - protected long geyserId; + protected final long geyserId; protected Vector3f position; protected Vector3f motion; @@ -258,8 +257,7 @@ public class Entity { setDisplayName(session, (Component) entityMetadata.getValue()); break; case 3: // is custom name visible - if (!this.is(PlayerEntity.class)) - metadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); + setDisplayNameVisible(entityMetadata); break; case 4: // silent metadata.getFlags().setFlag(EntityFlag.SILENT, (boolean) entityMetadata.getValue()); @@ -306,19 +304,18 @@ public class Entity { return false; } - /** - * @return the translated string display - */ - protected String setDisplayName(GeyserSession session, Component name) { + protected void setDisplayName(GeyserSession session, Component name) { if (name != null) { String displayName = MessageTranslator.convertMessage(name, session.getLocale()); metadata.put(EntityData.NAMETAG, displayName); - return displayName; } else if (!metadata.getString(EntityData.NAMETAG).isEmpty()) { // Clear nametag metadata.put(EntityData.NAMETAG, ""); } - return null; + } + + protected void setDisplayNameVisible(EntityMetadata entityMetadata) { + metadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); } /** @@ -326,6 +323,7 @@ public class Entity { */ protected void setDimensions(Pose pose) { // No flexibility options for basic entities + //TODO don't even set this for basic entities since we already set it on entity initialization metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index e248d5c63..08f9f1bb4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -40,7 +40,6 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.*; -import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; @@ -68,9 +67,6 @@ public class PlayerEntity extends LivingEntity { private String username; private boolean playerList = true; // Player is in the player list - @Getter(AccessLevel.NONE) - private String displayName; - /** * Saves the parrot currently on the player's left shoulder; otherwise null */ @@ -86,7 +82,6 @@ public class PlayerEntity extends LivingEntity { profile = gameProfile; uuid = gameProfile.getId(); username = gameProfile.getName(); - displayName = username; // For the OptionalPack, set all bits as invisible by default as this matches Java Edition behavior metadata.put(EntityData.MARK_VARIANT, 0xff); @@ -100,6 +95,9 @@ public class PlayerEntity extends LivingEntity { setBelowNameText(session, objective); } + // The name can't be updated later (the entity metadata for it is ignored), so we need to check for this now + updateDisplayName(session, null, false); + AddPlayerPacket addPlayerPacket = new AddPlayerPacket(); addPlayerPacket.setUuid(uuid); addPlayerPacket.setUsername(username); @@ -311,13 +309,8 @@ public class PlayerEntity extends LivingEntity { } @Override - protected String setDisplayName(GeyserSession session, Component name) { - String displayName = super.setDisplayName(session, name); - this.displayName = displayName != null ? displayName : username; - // Update if we know this player has a team - updateDisplayName(session, null, false); - - return this.displayName; + protected void setDisplayName(GeyserSession session, Component name) { + // Doesn't do anything for players } //todo this will become common entity logic once UUID support is implemented for them @@ -332,7 +325,7 @@ public class PlayerEntity extends LivingEntity { } boolean needsUpdate; - String newDisplayName = this.displayName; + String newDisplayName = this.username; if (team != null) { if (team.isVisibleFor(session.getPlayerEntity().getUsername())) { TeamColor color = team.getColor(); @@ -345,7 +338,7 @@ public class PlayerEntity extends LivingEntity { // We have to emulate what modern Java text already does for us and add the color to each section String prefix = team.getCurrentData().getPrefix(); String suffix = team.getCurrentData().getSuffix(); - newDisplayName = chatColor + prefix + chatColor + this.displayName + chatColor + suffix; + newDisplayName = chatColor + prefix + chatColor + this.username + chatColor + suffix; } else { // The name is not visible to the session player; clear name newDisplayName = ""; @@ -355,7 +348,7 @@ public class PlayerEntity extends LivingEntity { } else if (useGivenTeam) { // The name has reset, if it was previously something else needsUpdate = !newDisplayName.equals(metadata.getString(EntityData.NAMETAG)); - metadata.put(EntityData.NAMETAG, this.displayName); + metadata.put(EntityData.NAMETAG, this.username); } else { needsUpdate = false; } @@ -369,6 +362,11 @@ public class PlayerEntity extends LivingEntity { } } + @Override + protected void setDisplayNameVisible(EntityMetadata entityMetadata) { + // Doesn't do anything for players + } + @Override protected void setDimensions(Pose pose) { float height; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java index c67becaef..02ec44ad1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java @@ -25,13 +25,12 @@ package org.geysermc.connector.network.translators.java.entity; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; - -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket; import org.geysermc.connector.utils.InteractiveTagManager; import org.geysermc.connector.utils.LanguageUtils; From 02387dc6e265eed5744a3521c605a043dd48f329 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 11 Oct 2021 21:14:06 -0400 Subject: [PATCH 642/766] Fix all blocks not appearing in /setblock; show effect suggestions in commands --- connector/pom.xml | 2 +- .../connector/entity/type/EntityType.java | 3 ++- .../session/cache/EntityEffectCache.java | 8 ++++---- .../java/JavaDeclareCommandsTranslator.java | 5 ++++- .../populator/BlockRegistryPopulator.java | 5 ++--- .../populator/ItemRegistryPopulator.java | 2 +- .../geysermc/connector/utils/EntityUtils.java | 17 +++++++++++++++++ 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 8964f18c8..0f13d134a 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -149,7 +149,7 @@ com.github.GeyserMC MCProtocolLib - e7979c4 + f1ac2de compile diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index 094cb4d61..57ce2de3c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -41,6 +41,7 @@ import org.geysermc.connector.entity.player.PlayerEntity; import java.util.ArrayList; import java.util.List; +import java.util.Locale; @Getter public enum EntityType { @@ -194,7 +195,7 @@ public enum EntityType { if (type == AGENT || type == BALLOON || type == CHALKBOARD || type == NPC || type == TRIPOD_CAMERA || type == ENDER_DRAGON_PART) { continue; } - allJavaIdentifiers.add("minecraft:" + type.name().toLowerCase()); + allJavaIdentifiers.add("minecraft:" + type.name().toLowerCase(Locale.ROOT)); } ALL_JAVA_IDENTIFIERS = allJavaIdentifiers.toArray(new String[0]); } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java index e165ea545..910367889 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java @@ -49,8 +49,8 @@ public class EntityEffectCache { public void setEffect(Effect effect, int effectAmplifier) { switch (effect) { case CONDUIT_POWER -> conduitPower = effectAmplifier + 1; - case FASTER_DIG -> haste = effectAmplifier + 1; - case SLOWER_DIG -> miningFatigue = effectAmplifier + 1; + case HASTE -> haste = effectAmplifier + 1; + case MINING_FATIGUE -> miningFatigue = effectAmplifier + 1; } entityEffects.add(effect); } @@ -58,8 +58,8 @@ public class EntityEffectCache { public void removeEffect(Effect effect) { switch (effect) { case CONDUIT_POWER -> conduitPower = 0; - case FASTER_DIG -> haste = 0; - case SLOWER_DIG -> miningFatigue = 0; + case HASTE -> haste = 0; + case MINING_FATIGUE -> miningFatigue = 0; } entityEffects.remove(effect); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 996619eac..37760996c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -49,17 +49,19 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.item.Enchantment; import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.utils.EntityUtils; import java.util.*; @Translator(packet = ServerDeclareCommandsPacket.class) public class JavaDeclareCommandsTranslator extends PacketTranslator { + private static final String[] ALL_POTION_IDENTIFIERS = EntityUtils.getAllPotionIdentifiers(); private static final String[] ENUM_BOOLEAN = {"true", "false"}; private static final String[] VALID_COLORS; private static final String[] VALID_SCOREBOARD_SLOTS; - private static final Hash.Strategy PARAM_STRATEGY = new Hash.Strategy() { + private static final Hash.Strategy PARAM_STRATEGY = new Hash.Strategy<>() { @Override public int hashCode(CommandParamData[][] o) { return Arrays.deepHashCode(o); @@ -221,6 +223,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator EntityType.ALL_JAVA_IDENTIFIERS; case COLOR -> VALID_COLORS; case SCOREBOARD_SLOT -> VALID_SCOREBOARD_SLOTS; + case MOB_EFFECT -> ALL_POTION_IDENTIFIERS; default -> CommandParam.STRING; }; } diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 6d54375f1..a46ca77af 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -299,9 +299,8 @@ public class BlockRegistryPopulator { BlockRegistries.JAVA_BLOCKS.register(javaRuntimeId, builder.build()); // Keeping this here since this is currently unchanged between versions - if (!cleanJavaIdentifier.equals(bedrockIdentifier)) { - BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier.intern(), bedrockIdentifier.intern()); - } + // It's possible to only have this store differences in names, but the key set of all Java names is used in sending command suggestions + BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.register(cleanJavaIdentifier.intern(), bedrockIdentifier.intern()); if (javaId.startsWith("minecraft:bell[")) { bellBlockId = uniqueJavaId; diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 175bf13d7..ae69904df 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -406,7 +406,7 @@ public class ItemRegistryPopulator { } else if (javaIdentifier.startsWith("minecraft:music_disc_")) { // The Java record level event uses the item ID as the "key" to play the record Registries.RECORDS.register(itemIndex, SoundEvent.valueOf("RECORD_" + - javaIdentifier.replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH).intern())); + javaIdentifier.replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH))); } else if (javaIdentifier.endsWith("_spawn_egg")) { spawnEggs.add(mapping.getBedrockId()); } diff --git a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java index 5c4929a91..594fc0601 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java @@ -35,8 +35,22 @@ import org.geysermc.connector.entity.living.animal.AnimalEntity; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.Locale; + public final class EntityUtils { + /** + * @return a new String array of all known potion identifiers + */ + public static String[] getAllPotionIdentifiers() { + String[] identifiers = new String[Effect.VALUES.length]; + for (int i = 0; i < Effect.VALUES.length; i++) { + identifiers[i] = "minecraft:" + Effect.VALUES[i].name().toLowerCase(Locale.ROOT); + } + + return identifiers; + } + /** * Convert Java edition effect IDs to Bedrock edition * @@ -178,4 +192,7 @@ public final class EntityUtils { } passenger.updateBedrockMetadata(session); } + + private EntityUtils() { + } } From 682e4b3eddef5bc2885cd74c06531a7dcbf714ac Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 11 Oct 2021 21:16:17 -0400 Subject: [PATCH 643/766] Potion -> Effect from the last commit --- .../translators/java/JavaDeclareCommandsTranslator.java | 4 ++-- .../main/java/org/geysermc/connector/utils/EntityUtils.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 37760996c..92dc83c37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -56,7 +56,7 @@ import java.util.*; @Translator(packet = ServerDeclareCommandsPacket.class) public class JavaDeclareCommandsTranslator extends PacketTranslator { - private static final String[] ALL_POTION_IDENTIFIERS = EntityUtils.getAllPotionIdentifiers(); + private static final String[] ALL_EFFECT_IDENTIFIERS = EntityUtils.getAllEffectIdentifiers(); private static final String[] ENUM_BOOLEAN = {"true", "false"}; private static final String[] VALID_COLORS; private static final String[] VALID_SCOREBOARD_SLOTS; @@ -223,7 +223,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator EntityType.ALL_JAVA_IDENTIFIERS; case COLOR -> VALID_COLORS; case SCOREBOARD_SLOT -> VALID_SCOREBOARD_SLOTS; - case MOB_EFFECT -> ALL_POTION_IDENTIFIERS; + case MOB_EFFECT -> ALL_EFFECT_IDENTIFIERS; default -> CommandParam.STRING; }; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java index 594fc0601..fdfb40971 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java @@ -40,9 +40,9 @@ import java.util.Locale; public final class EntityUtils { /** - * @return a new String array of all known potion identifiers + * @return a new String array of all known effect identifiers */ - public static String[] getAllPotionIdentifiers() { + public static String[] getAllEffectIdentifiers() { String[] identifiers = new String[Effect.VALUES.length]; for (int i = 0; i < Effect.VALUES.length; i++) { identifiers[i] = "minecraft:" + Effect.VALUES[i].name().toLowerCase(Locale.ROOT); From 52ef3d392adc72f92f9e86e1edc9e162ad1c1538 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 11 Oct 2021 21:21:21 -0400 Subject: [PATCH 644/766] Convert ChunkUtils.ChunkData into a record --- .../translators/java/world/JavaChunkDataTranslator.java | 6 +++--- .../main/java/org/geysermc/connector/utils/ChunkUtils.java | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java index 2cadf157f..6e579b5f4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java @@ -69,7 +69,7 @@ public class JavaChunkDataTranslator extends PacketTranslator Date: Wed, 13 Oct 2021 19:09:19 +0200 Subject: [PATCH 645/766] Register `/geyser stop` only on standalone (#2569) We don't want to condone stopping Geyser in the middle of a plugin session, especially when there's no way to start it back up again. --- bootstrap/spigot/src/main/resources/plugin.yml | 2 -- .../java/org/geysermc/connector/command/CommandManager.java | 5 ++++- .../org/geysermc/connector/command/defaults/StopCommand.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index 0cd78ebe3..0171abd70 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -22,8 +22,6 @@ permissions: description: Puts an items in your offhand. geyser.command.reload: description: Reloads the Geyser configurations. Kicks all players when used! - geyser.command.shutdown: - description: Shuts down Geyser. geyser.command.statistics: description: Shows the statistics of the player on the server. geyser.command.version: diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java index f62fd8539..53cdfb269 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java @@ -27,6 +27,7 @@ package org.geysermc.connector.command; import lombok.Getter; +import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.defaults.*; import org.geysermc.connector.network.session.GeyserSession; @@ -47,13 +48,15 @@ public abstract class CommandManager { registerCommand(new HelpCommand(connector, "help", "geyser.commands.help.desc", "geyser.command.help")); registerCommand(new ListCommand(connector, "list", "geyser.commands.list.desc", "geyser.command.list")); registerCommand(new ReloadCommand(connector, "reload", "geyser.commands.reload.desc", "geyser.command.reload")); - registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); registerCommand(new OffhandCommand(connector, "offhand", "geyser.commands.offhand.desc", "geyser.command.offhand")); registerCommand(new DumpCommand(connector, "dump", "geyser.commands.dump.desc", "geyser.command.dump")); registerCommand(new VersionCommand(connector, "version", "geyser.commands.version.desc", "geyser.command.version")); registerCommand(new SettingsCommand(connector, "settings", "geyser.commands.settings.desc", "geyser.command.settings")); registerCommand(new StatisticsCommand(connector, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics")); registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements")); + if (GeyserConnector.getInstance().getPlatformType() == PlatformType.STANDALONE) { + registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); + } } public void registerCommand(GeyserCommand command) { diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java index 8ceeb9990..ad5049432 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java @@ -54,4 +54,4 @@ public class StopCommand extends GeyserCommand { connector.getBootstrap().onDisable(); } -} +} \ No newline at end of file From 501183b91899b2a23525794a3703e1368ba57baa Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sun, 17 Oct 2021 19:24:27 -0500 Subject: [PATCH 646/766] Add support for 1.17.40 (v471) --- README.md | 2 +- connector/pom.xml | 4 +- .../connector/entity/ItemFrameEntity.java | 2 +- .../connector/network/BedrockProtocol.java | 4 +- .../java/world/JavaPlayEffectTranslator.java | 2 +- .../populator/BlockRegistryPopulator.java | 6 +- .../populator/ItemRegistryPopulator.java | 4 +- .../bedrock/block_palette.1_17_40.nbt | Bin 0 -> 41760 bytes .../bedrock/creative_items.1_17_40.json | 5206 +++++++++++++++++ .../bedrock/runtime_item_states.1_17_40.json | 4322 ++++++++++++++ 10 files changed, 9543 insertions(+), 9 deletions(-) create mode 100644 connector/src/main/resources/bedrock/block_palette.1_17_40.nbt create mode 100644 connector/src/main/resources/bedrock/creative_items.1_17_40.json create mode 100644 connector/src/main/resources/bedrock/runtime_item_states.1_17_40.json diff --git a/README.md b/README.md index f8a649294..062da91eb 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,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.17.10 - 1.17.30 and Minecraft Java 1.17.1. +### Currently supporting Minecraft Bedrock 1.17.10 - 1.17.40 and Minecraft Java 1.17.1. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. diff --git a/connector/pom.xml b/connector/pom.xml index 0f13d134a..810e99bef 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -114,8 +114,8 @@ com.github.CloudburstMC.Protocol - bedrock-v465 - fa9d104 + bedrock-v471 + b71f1c9 compile diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java index 42ead8dcf..cf40a3df1 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java @@ -35,7 +35,7 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import lombok.Getter; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java index b7694c672..d19fe18ca 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java @@ -27,7 +27,8 @@ package org.geysermc.connector.network; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import java.util.ArrayList; import java.util.List; @@ -52,6 +53,7 @@ public class BedrockProtocol { .minecraftVersion("1.17.10/1.17.11") .build()); SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC); + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v471.V471_CODEC); } /** diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java index 73b9d5d8e..2018fe211 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index a46ca77af..253b30ba9 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -29,7 +29,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; import com.nukkitx.nbt.*; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; @@ -66,7 +67,8 @@ public class BlockRegistryPopulator { static { ImmutableMap.Builder, BiFunction> stateMapperBuilder = ImmutableMap., BiFunction>builder() .put(ObjectIntPair.of("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion()), EMPTY_MAPPER) - .put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER); + .put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER) + .put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER); BLOCK_MAPPERS = stateMapperBuilder.build(); } diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index ae69904df..dbf634989 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -36,7 +36,8 @@ 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.v448.Bedrock_v448; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; +import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -69,6 +70,7 @@ public class ItemRegistryPopulator { } PALETTE_VERSIONS.put("1_17_30", new PaletteVersion(Bedrock_v465.V465_CODEC.getProtocolVersion(), Collections.emptyMap())); + PALETTE_VERSIONS.put("1_17_40", new PaletteVersion(Bedrock_v471.V471_CODEC.getProtocolVersion(), Collections.emptyMap())); } private record PaletteVersion(int protocolVersion, Map additionalTranslatedItems) { diff --git a/connector/src/main/resources/bedrock/block_palette.1_17_40.nbt b/connector/src/main/resources/bedrock/block_palette.1_17_40.nbt new file mode 100644 index 0000000000000000000000000000000000000000..0415c135a3e1221c962da5a1ea3b831b4cab3d76 GIT binary patch literal 41760 zcmeFZWn5Lk_b;r1fP_dlDhMil=q@OwR zzn}ZR_j&Pro;Sby=K5loy=Lw0nVGd_zU#YY@5eBVJOBP+uG9xdFH4tXzDA?9SIqpD zLszaIm1})GyVmCz6P>HnKV<5z_kQjpx)=?ut-n~2s8Z^PVIKhwDYh|0NSue#&?NxNKH{8uH>Rp@Jk^X#@L4WRQk7Rn3p)j-Z{?SP|n_Wlb zQj%ndKrmsYP~-Bevr*V|l74;FE~spKUGZ;MA0A_cfSTWuyMALz)!g{rliQ|;Uw~TR z8I?@U%|n7yw#JrLp`JZ9yXhl=l`9tncmUPmwSc_N-nRM=VO)aoi*wby{+8C`25@=co6wZ~T|)Gw=(w1i zcZ!|XAxh}*m&d)^rh)^<>BQ?sDZF2Om&#UTj?NWf{~BZn*KyJ9tQ&h~)y^Ets~&Gl zMfH!z+sD2gZ);=MF7wKnf2+1R%->kC_k8;@sUbQ42zKUO(r2@D@k@9p(kq|#LQ>`= zCv3-qzog&MD0#cHp^)~%H*5#XP5p=3%Uq}QJT;F%CrJMX6#LS~$~V%iHiv0(F{wDC z1COX@M?modS$K`~JugWBSox0#DNV&Pf&oU z7b)TdB8OfQ^r?6TZ6{Cls|AXK3mylZ?=5?CDl&fA*EH)t?UGA1RNq;Cb!XJ1jdDb*x-(s;Q&+C2F%gnlYi*tBZ<`t#dO zPQ1l0Z}uLsY?fhzO4h!cvc2-)lSE#tPdMXmYys|&{@tCHG1T;Yiu-)C1(ywQr3h z^&nED(j8q&qi>ygbXmtRmiQs#>{CU;`Zo0IvH)@ClQh%b2C)Q2Y_itsH9x<<&MXmP zMSKUldQbd$9fp|ZyOYUzBA=(r9PRMecFMf1?7q5*6LI`Rp4R6uCo|#}b`f;Km&G~` zTUxR&b>(PFo?_V*Hm#DY?GOGv^xL5!dA!3sVViqac)ePovY*d-c-O)EaiaRFY6EK0 z{-lD z7i>MhsXN|oY-mm^Xpnc!KMw9Fd3zZu;d)-<%;6T*?~!b&fr^8+xEUyA%g$L4cC>R| z$3zhlURqmuKN+s~`(~Nta(lDpZ$^U{Yj-W~kN~*v4!L5!{5{^=SIPSW{o~`ctmMnKSpFYUSxa)S`y&U8n=aDB)0vMKI%NkWn2&{<$_LQ3w!Hi* z(|xYl&K(nf5VsvJ{k?yB`MdEAkB!=ynUcw)#p3Awrsv*edaBc!1&67=Q|QSTJ9XJ6 zF$|9>o_o1g+&I+MX}n0ZN;p|upF72L66SexvEU#QYdSirvYoc0(y0C`m%+#M7v=o9 zoZg>9BBFYsHAeTer~HGDghn3;4L>5P514#@!8S;MGZ-AOkrS{HEBUA8B28*;Hn#4R zZ)_4e{14Bw6WgQfBFjm0FM{If`15|$%NVO^rL zo$*=Mq?pplifezj?Y0+KY-0~?)2QC3QKbl=_sQLh@=v;3<1oM>>hjPXjkl*ss{eGk`#-F(<5nZhfc*zeU+*gD2VW&qpzMLguk-7J?rgQ zf`4sH8dvws%afeFb=&@ML7i(zG)h1;8XU5<=q6>fyx8GyTG&kat3Yg&3nPx0SxLcD;3?RCiZByxhR`(H!@^RGLO6 zZ~MK1XN_cCQbI{+D{0iYDE5lsroO`KDkm75Zg1`a$vv;Wm!c!fkd%JD`$6u4sDJpf z?kI-Kd=y?Me6n?LXJ9?yo}`fV&8^nj{O#q{?PWW-#7w5=R@LNArl;0bS?yg@vUZ)l zCvLh<{78$m^5eedEb|l37fx7z`urTW$#OnA_{8GI-Gi+~?0QU^eC=f^JX$sRW8_u2 z*s)j{uxHf;gGpWNLmQtgKlMw%#xwH6KK#qBt@k3U6%Qp2PX^meoD!09#yeY&{yi3M zcsC`Mm-tRx0I2Y}+Slt^hK!1H;TAlZ;9te?`=K26WFjHxH&tH;>Po%D%g$eq#OT3- z;1T!++e}*W^kE|DfT!cU0O37RjzO=zcNlkieRt+k2~oAPKx4*}<^<0v3?&`;_0cyB z9W+Ay6=vUV)e_7JD+lce{ zdUJbMT;zoJO-Xnl)w9VC3Eb$N<;B3)6_;JqDJfN7ghV$gjBp>##afzKo<#|XPKbTk z^)beMz$eiW{K%*We3tV@VL;H4M(U;An`h3Y=50QLZqr7fB)Y=+Kv7-N8X|1jib|Y=wd!CQ$^HKa{ctg(s z*Qd!nq9{=0z0j+Pmia>JXO z2isn=4gnD+L7)(0|EL=H9fag%{dkehM*xOdi z0}5joHKVz|{68HxSO<3QemtEPYj)SK{G!h=8F-5#Xr`<5ZOOuuh`O)Bb%Z=aPy)zs z3D%4dY+ntU%T~~;QMK&-v4_7<7$Kr(Ug+_pDWG1gOEdQTVl$v``DFepbjc~5D3gvS zWIXgm&)(yJ>MLt!?bYGYCGTt!RbhRbE@STtxe(3m>EHD#PQrOdSbz0$`)p=Ba`+pe zdl_4oZ|Y-mkGNWa(1pMwN7nmzPG9xV-?o6PQ@f>JL6MQ@m8n?`Y;+q?9pL&di?kLr<-VakM?V6@vQZ& zJpNwv6td*n*Cxzg7cMWb{eB5INpaIc|FvZg)C&gfMOk41bzj@^KYQ& zKo+J^pg@lXMHaGRRMj~l-Qd$D8?u3=`%fo~ zzpyK!x#p1dcAj~wcv!pV9r8x*QT~g#XZl8^d7Js(xtg4f!ESXoUyrY~5}34DtXYd8 zN;{}8xy3?e6FCM+9u7GK;0cI@DDby7@Uy7hEN>-3JKRnOY`w!ogh#40j2c&tHt7p< zE!C{KHO)e|f8?LWCUO;4mXw|xt2vMToa;(ErFQPBoEK>%a-cfyEl%Hx-#Mw%i`$lR zp3{iy=UL6YF0~&%hZE+%sL^gv#y+>bR$7X)eg66Skeb5e3Hdr53}?B{8>Qv1cWO9} ze_!aH`o#oW+Ip9ZfpfT@jlUq7m)(UKFJnx1{lczI=$j);uhaAWuY)l%H|-_)+%dqT zb*<;GqL%Hf5A~PfGJEsap{msnUot&YNs1zob*gB{zlqf;AuNWPY&$C7RIYrwk!VgTifb!Yz3ioMo27UyErKc<5pCgI$FAtl$ZNn z0ZC(llEAN!5aU@gj!e0)-Bmm$@-Z~gPA--#x{=jA7lvJ*6vreYqQ1+M8cMZRy>{3P zff>)zab&_u$f1;UhBYrfJk1=hd0zQ7AE7el#clw86};A{*=SQy^R#p93lT|oorH-z zi6Nb2xz>YWDGe;KdNspeA+pA^6a@6J;)j0jKRkay^ZihIpX`kn=XAITF&*_G*mUD` z#_AykHH5`IwT2%yLwbzoA9K*dOQ;`m!!6ki;6!%WZY!yK`ih|4sM%3bttHju%Wej& zg!m!XH_Lqky~yqw^-OsL1H!ISK9)^^W!rmFuNmqe>(Z0(aydVwMd3MxJejdBrKRZP zg1?ZVDy6kJP~iQr^j@Ot1ixJq4?Rwq`|tb0K;v1y+mW%k9hvdlk?}A=j!a7vS~Lzl zyqM-8S1I^klZwFaE3;(P{WfZwU2W{KnU?<<1&3wcFW&u|dOG{w*RwAfL16ff=;Xq? z>SVa1^Q$yYsMrl^NEsL34|kmmf$>3~CUBp)P?KjknnSQ^!kui3gi?Rd!HO{-a%EWV z9q8hA*KmMeLLXyi(}Q4cc#N=x?1xpYATAxdke zNu8P(d5iCrf2|EkX<`LV5lqdb*O5m#CCek2q?ndjV%ap^RmOx$%8fwGvll@&+@|pW zJzlaRhNW4HcjQS)eTPefEbjziNwpDVtSL1hqL+?Qoal0gTJyA-@rZ8oe7+dcU8|qg&OeOkFFDo?p|#8+77-*FEA7~r!1{)OlIwxR9!}? z4&;Sd**Qn`JEhfCBzo14X96KD>?LJ0R_DLEpnwo`S&f0cD)$bF;#W*j3I^FoS#Sa@75jYeY9 zxyCbRDbE|FA>5Qv)$!P-O8vl6D5X@j@$P&RN7RdkDV~{amrVRN^|Ju?qrNee8uBmZ z9o^CNQuN*4G0Y0?uQF!~ayZ+JOLm<$@uk#H13b$6)Y2vx=HJ_lPP)H%p6Ah0|HhO- z!BN$wh-XtiBe-A3{zE-C~@+JG^Np&VZ5m{H&aE2U_{xOB+ z)VNme#@75hlt%x#tTfPGYZ<(h=Oux2MJ`9Eze-`TH9kdKL-WmiygP4E`5&-^z)=<@#t==#3~sPW$b`75Am%Ms~bQCPf~n4;y^2EUJCLL=?3#r!+} zrgr4`pv7UIT=bIbJ(~`TVNwW@&%9#MjQbN|S*t5&9@1?zvt2?LQt%sx`=KS1qGgm# z5pyVdok*Kx$*%pcAxZUPwCSMmvOs4Wws>ZCKsN_R8=ItkLjTRz;+nS=T}a^x4)@6iMn%skn{4J#E1{IUr?Jj; zmgY)EB|9#Yz>18fcH?A~b?B${VptR%ootE}^$mled7csq=j0y9>GBUfo028a9i_17 z8dr;>8L8_hf2HcJ%*2|>)op(rZ7z6zIp>2YAXznun@!4EzS*r?ZS2+Rw@Jq3sQ6w}#0Rr-XXu*E-N^OE&*++c<*_)B4!a z@6^RhN*~W`yW&poU+cpPda9H8GnOT2^WEcCd;Et@%D;^M46dHg*j%ndORcq4ygny>$So{#czsOdT#((+ z+;@LeeWE()98+Wn-#ee~Qc~`3PV~NqR&#&Zr{oV08Vl(zeWUlWf|X~JlJ}DEy4p_M zCtYP-`3p;6(;X&*FMIq96M615759;|@{Vb?-|ygOEML$tg%DG2=U0L@I#t{JQVYy5Ct_)!H1!-P z&7lG%1W<~^2TBr;Im7EMw6fNn9!!sZ-7WF9wyK4%;`ilgvMknRgUSbOP-z7fMqN-@ z5V4eHGC5ZCcDe+=w~to1#-(-3X;+^-`FK-EhM!uf-)C-wC)%pGp=Z4>VFi7E5d zn~cN9LJN6;?0WNeLc*e-s^neH9-V$2)Vwm&S4%IA@2*KYedMa5HhGv9-n_hho(ir0 z<^HO!@&yYEPkHdviMZQWR^n9!+|R>OcC+gQ2?Zgms>#c&xjPEU97Qa|$EjYzO*;w| zJ4X-HrY*`hoE~}<_?2p#&dDsKbsY)c`q69GY%=3_JO{5dZqDlc zeY)0%M^D_HRGBD}7jpm*`LUw&Zcer@V--}4PN_vJVQ#7{6yuvP{Ts`g7uUtiYsU&z z*SMobf9AHK#R!(eLiKL#C6iN0*|@G7-7j-P0}Y@eI<)I-Zh=xU1h{8 zigqLJf(&6=VKQxsc?a3N77%J8nICQGOW7HJEmh}s&_0iMA4-3as%R5s?x`TnKAt2- zDVLvyrl@_;#vVztf-UOQCUY8IetYYadsBXP=VbBsUCZ$UE#{I{lc~XCOeKecjwf8} zU09$}3@R2#N&FM89ZWmnALu!J0%l?seMwpoai!hF-`93(?*ow?5Y6cTkv0hs&EL_kd^!DH1}8@POzH6^NjBfye+UA_pQqbRarJiasMn zw8&>Y03yG8K$L?NF(IFY1w{BLK-7yAaYZz&A59x4^>QW8*BuM}A1V_2ZCJ_AV>AaX z*Mzi*U{Y!drOB{kvz-K2LdMG(?M0H9<~`~c@}{fD$JX637dDrnGOQ-6_If+?u#&by z3i#i;u<(Z~o-9)6_QEM?D16B(gT4vj`5U5rrsE5u%c*LKw2!<;`R*;M|F=qn!>HF7 z_BVZ!QmxE}$BvCB7j6D1Qk1*_u+isob?h z$f-P1qs{XxA`d3|G}^g4EalvAb9$G33p+DX#*{5|htHqS!MQ(rCDe;cFnLbUDZz9~ zxx)=#$m!jB$JxqC&ax-lc}|aN_!zMSUkK>#&c*%7$@6^~`Qk-SjiN*_{1; z8A7$yrIXP0&E0M2wnFvJ^|Mpz{Vt2zqz1ijJZ_`Bth%*jopjHpOPpWvlEmpWSGTX= z_pQ>!*cRl!#eHVosJ+=^eRWh@9%jp zrX0BD-qbo>G!C6iW7Rf3z2*xhTxibaBYg8`nZ7JX`8!91z%SOMfy_6!Zv-5&lj}-j zYpNWH?PYY>X_qxSsci<~a#`MuEth&py(3beIU@L$zL3TAiT-xQGEw2hx=yM6ep%z# zo58}6=sWY;0@Lo0^8nlE?K`!guUW55o1gAS_jbAxmvrdx8XjqOKDOJ0!%dqQ_oMr& z9MSB7ly;e{liF?)E@#@rjL~pDoqWe32ll}9i9?#rwV5(_#1oebZb+B zOrLn96jPRNDz9=xi1ZkRP5v=oirvR*ZR6lh{(Pwz)4%bNn7va+6m-@0Ve5TP_9WjO zAf50;JM7RA1mn5?FesI(c1$cB3?Q4bfXUaaVDQX{CaTh3U?vtxUAs+;1hFO!SrUrR zm{!889HrY!7f4*?Om+BCs(~~TjBR+8WqU^H0`U`V<==mq!{}dT8+9}nPdB28R zIU_z&r;|#toTm{aKKAMV;~k<17990A5fBz$2Qre#{Ljs;baY5R;tmw zqMv+CNm7Tv<7MIG_`EDGQ3@(Nk;{Jbtse_e{?K!peuZIBuT~=>#4=$RWNS4+2)hax z2KjPr(8tJj7zV{&UC=`67%Yfly*?<#cMTRqzTFV?bMXWgl-TMsY2$|1MDUk2Pl1)j z2<^tWa#sq~YR*T~+7r(}`HXe=2P=&==8bXHnUti$a$`?rW6(q@L14tL5#O}F;7(Dn z1T}P|^(hX-dMN^pjMwf}3w9ju_r=d|D2LuL%2N&%89sk#UgS#<$l22wEJ1Fz4|I9F zfo@`p-K34{LD95}j@q=YU@K}^w{5B9vcrtbpw~n>yWnoO8=@ZvQN-L) zHzDKavatAOpEe8c3@Om4=BWxDxY74?LtzGqp7|p@2&E5L)-x z%E5!C8Ynns32B$s>CRZD0B&<*ILA9|M#?)^ywZU9{-5#xZP zC;jw^wfcPUgyS!3ODG$)+0k{kBLy5izRPFQ+V8+t`7diXGaI!9`HgYo-S!ri`OpTO zU@IB?`PmI+Xw0s3GGVb9&-u5Y&$WYDpO|Jth3QOwS^s%?(B+c;Hh9VfG))LOr@wum zT|?m|+p`4j@;jLXTGsubD!y*3Q|xoYNC%9av2V{OLsEXB3VL;|F55FkrCv9GBO4s| z%TDU@s_8=6%!{%`ZfFUZ~(YlC)zzlFRCh2JB{F4glZ)RhL-uGH(=)s;Z^8KK*Z zFM*#E{Wyyv5Vkm!oiE*WnBUZv*=R(mV<(R=v;UV?VXP&)(p z)>jnmt)Zs|@_*jZwxfnQK;=h78QVXF9z*3u&lIK8 z_=af}d+kg-ZHTJs8N_Au;W=e8juYlakb~6P7f1 z>=xXS=wv+coh{f23M;;7z!UCBm=d@Z0qb^KC@u{aocRfK%~mXFaJgK8E~N<2eY4cK z!_yM9@Zd6LRE-pm-T$U!8iUr4d#{nHvMH!2=Q3uKo)nMg^9}pVJ=(O)1N}9M_mVr% zo6)(E^y#my!yoCSS?%BFK;)P-pgruk(WGSqpXj8SZ4H9)U{)H?nIvH*h^hgdK+Z-xo5lkm-H6JSVA%w2IceQ<~ zybT{^-PW*}+%VYSsH(W?M{(;ysx{mkhJRn6{S)qyp~}DuiFVXb2O}`7a_ygR4vpkH z-zm4F7A$lj_KPdv!IT@_h@!}Lcre9I4`Se83?7`+9*l%&-_X z)9;&PQkcju7|r!Kcf*4dTH`gX;~;hfZX6d@9Q5uxgtYy7^yJEL!9P_mrD;qi2x)OS zY(pZ^$@$tkB|_t%D^J_sKn`s`$U_bX{If{ientY_k%5=e)RupMZgn##1Ys1kX5a7z zIjSI~R_rt;m^>y`ucakHk7KPP@$4L`A=5bQG`0_UOsa*XKlLuR@9=a4Ev#P5Rze1? zESGBMy_EJ#u6_@T6Ysht6PDOEUH~hc1eSK#N14-cF zF{|99cwkFopGBoz%G}ov(0(sD!g<~8i2@JO{oOb<=R(kk@8V(tt$m|^5rtpd<3%UM z#IFAm5362Xwo_?43cs|~Eu)o@NAIQL#d!f(;Vso=CzQs4e8MpUb$7X1Y3Za)=Vht` zZ@~mk;kSuhfdby$f^R_&DAn^#{%dhpQ*gmk|J;&HL251VDL;KPe1 z$k<<5EU>Y+eelX?Q&?<-ay1Si`))U_Z(b~MMKU-?gNX(YqF(!nKqwN!gUHsK063(F z2a&Hd2L+{a!-KS&0`Ue7LrL*?2ZHewX@3ASnt#%t zZav)!Kp>>2LvB62vONg7OmoIZnDx*P{Y2V#gaNqj1j{xUQGjAN!4i)~DiHt5{|6-g z6$);W!uLgKfMP_!I&Ypm2y_=PK>@l9OCf7V0sh@n(d-KLvY16_Qd|JujB9Y({S{Ul zEqR(;t6pBltP+#rf~~A%{?4*N%%1doKx+kU@E*V`#oYj;glLojkkZ*V?NB384)Z^ha{%rVyVwC*mFuAT&(<4nfVX&c5Urm!D$&pbY~u~E zjmdTx;~Wy(^sZFVTmx(a04(Da5TJsIr?~-wjaMB~WrG-V_IOR{f+Pg&osM`878-Xd0Iu)7VC@cNrLklH<8Un13T7Oer!feuZ82vjBzOXjOYe4jxi5BEssH1q zz8aRdTh4VBZ`B>mTRC!Zol;J(uC&kIA4Oc!=}7mP$x-(;M9vDp5&Zcm!lD^hy3f1Y zbzl5Wi}b)6Uk~KaqbS1i@C#YYnPG3bHsI~hO3?m%U*9fH@AXrTzl9oBh2Oyd6uO2M z-Y)NB>Pj<&*Nj?6j4uJ0C91xPA`}?%3D&dXSQ0oug9lTu{>(;*5yOMY)|wD0cJ%OI z^5tekP$W0lNcR9-NtK2_pj>Z7Wc#YYA5d(!AvzaL;181803;8DAgw+R2SShB-zw?a zk^7sbbqEBxzYSY~eF0c~6{H=xzx7nMBNkFigZ+4x;QtrQ{9iEhf5FUu0?eF#_`p`P z_lN7f`CvCC0PZwc(Zr<#{>Z)4z+6#IM?n(Pdg@aO5`(sAqzwsnl@ z&4E+w4E71E>CI^591Pa^9O>eL+8hk-`yn*2RqGXWzb$>NPLsA#1WkJ!C{8J&AUT={saZTz$!k1}He>L_D3TiVz8Aa-wQKne?TOI8Fw~ z6uI;z=_yVI+oHGW&<+YN22biN=>h5VrFB~i6AE*ck!NpuZ5cyD;+t|}tuqxPOZm8_ zcfozcStiw~()asTMs_MkviFOR!X&lR%z6ay7nj$lVp9yj^}tUz85)a~I$At#i@8V) zGJ(BUs0EO{SD$c`T%OU$^aJ!z8w8SHi$vGHG;e%$6Fb5*usEU@*wooPx@gxO>< z?A%;T&Sm5+Osgc_TdVbu>UenRWEM2JhlA?9nBUpS#O1Ewt|BjIpf%$FstcMk8awkm zx7L2}|zCjW*H5AX0~&00A;w?L-O$heFFwaY85G)lsE4 z%bY=2%p#tq`vvf^Ggu_hr8l>`vNITcf0=%-qn4e)Gn+Y`rsE9wK?)>­vL!Lf=f zJuU0N{$gF zk&t6Zq**e-XJEMQAXp{fumDC*#?$r+6(<4MH<|(j9}hT1aMeGDC*|L8pOij+L?;q2Sd6AHJ}6H1kt4BKR?q+GgTM_+j*Q9wQj6R zGeK-q3FP2f7H#+~C;QOg$ctFOu>gBtan^wT!M0|Sm0*GZAV-`-2k!RbA^!0)nv^Go z0ya)8hn>(8+GYW#3jj!NsiGa(i1>FrZk4V$IOIq0p6I1I%*v;oUPZX-RwVA!0sZ(;| zv_Ioxtq~C4uWlUE%pCOg_%@!)zQxv6<)I?9kuOK8f zu}DvbhomNIq@KoeNy`tOS24+ zES=3)zrRAGkyK2X5nyRP0uJZ-=iPq<4mGH@G0y_R#_RyxrFgLew5rxY6+|wD6OBC4 zgn*<7Ir1>Ph3-fJl6l`dZU2Itc03;&rhiQ2E)XCC)<~oP*gJHp5Y^@n4jYYg^^Jwcyu!8YObJ~d^T}>-@z}L& zu8LcK1%hS0MLFyrJmrdE(_8vjB2H~@v2@PBb^0(2T}206h62Aa>&@)E%9z`pYbWo zQ76r1+LBb^KTo}i@`G8H^MJHNYR}hd= z-Hz!n^!O$_GHZteQIJ_XQedHWEMB(Qn=ZDZUox*A@*{C8XpNxD1c{>9ZCRM6S?!P? z@!x{7k8SOY%$9H0K_+U(J)@2Jj~>{0d)2i@sDCpu+lpL75rZ`@Wady73uIlS%-u6S zgHWBOynYBtOr>!(3?Z%kKuh1;P8me7y@h2+9&+XckUH;fq{=FT{O;1G1@Zw3^4on{ zXuBI5$Y?yEO+%|@qk(4Q&@QR%8%X}qpp`~_=m?b@dBrIG3FibVx#G$pjoj5Rra&vU zb&sV4JP0t)WY&PenRYSEjE73j=venSYr`?X>ZWN8#{)Y#>!fv^x$vSkb|V0y-u%PT~9Ac0k9x|A6Fg`~fFZ1y*#wH=A2VX%DlD|Qk`w0+;mGTyJ zA_e?Ic6e5tew8|s`!D+2K4G)#N_Mi1OSQsFbtMN#=cQ2LoO+TIuIo~$xaE41GrW6J zs5qSZk|P?YQm79r0jv1zy4$-Oh5@Er)5;wWkQ1!6Rv;M#5^eU&Fbu%Q#aeseff;9Q z>1CxsCfXXVq*@;)@~U{0_Ih8y0{`QtUJYK_v{JYi@`h=Wfsr z=*XVr_I(y62(%bS4n92` z2r^MT&|qJzL=EVO5@R%JMIebBe5M~xhX%Zzrm_V;9fWL(=t{i@9p!G8k$260n-`c)O zz_hXa1nOLmV+;HN2-YU8VEW$wN@aDm+}x=*ygD^0=nXBYG;TV%1+~s#$!^U zAl(Xrb8MbpL7>NwVP9*JolfEUYo(ByYI0jk!U0KAC7z+E9zra{wKMKjVlKI|Z>UA*Pqvu304A->BYqdT{Y z`}o%FAp%Rsj8DA_RcYnbN`5AGI+5`pKSfIwvogy~D@|Zi9kigB1baYcR1*|oPyh=e zGp!9ufi%D{NX_eliVpg~X&Q_ApenmLaEQjNAt<}}Hw=T)8XSBX!v;>rJdEdEc`6N1%%f$H zREqd_FeU|{7(H;-0H?ee6avoRbPNUZBn=#7p?uK*im_b=hzCHpn5zI1T#$1xE}w0a z0H-H*xNBVz;Gj_V4;E^G;EZbq+x$Vdu`8=xQ#2`K≥SYbNZ z>d;R7VZgliIAydkmFb#`VR@=+{e&(@5m#g#flQQj{m>Gzdtq5h#u_8D1@37SaaHn_ zEDTt?l(kz1GOL=#SwDpAdgK%UJRnRRB-b}bhN-SU3d@jTYW^C)Kp;%DzF=f_&c30U z(w1!ch&R|m3F6Z(KRn2?ASuXbe8N-o*CEA&j0E7>G5%$vanHx2y@$>Zp|SW*MB9w! z0im(4Bct_0dipMCMSA+vTTicSz4dej$gQU{-+DSv`>m%VvAQ$2;%*eL-xw*bpf&Q` z05?b~fpY`j4gTem(!qh4kH}oq#6PeDLQ-<;e+ei@0CvcQ0N5#D1IK7Uo&h7yKoEIk z#F7z?4&0l}`qP0Z=yB%sdqL!p5oZE;AV?x>TKgWn8wOb!95!lafKaSnSqgml`wyg8 z@|*)BN2ZjRW&nOM+615lA_uZh!RieFsf;urLCf!AP@Nb8i6|)X9)LDw{Xomk1Ni{{ zz~zuDfKQ6SDJeT-ehFk3iMBz)30m>HY6*FE2ANh}0$}H#xg!MwOks?NNCANEk`$o} z%)nl|93W5qZwuI^^a531e4B{X?Sg zM>Dp5H4zTpSr8`Qt(yX$9@$-npZMJQa?d-LAYtU0js;vm9XG>0Aumu#sBcsvhkAVr z)un)1_L%p7i2EFz3NM+ubX6z6jqcdHH@N44Hx25qY%2AW!5fh^H&}(Gn#Fa92H2r% zZJky$PxoE%#5uM2yGt`_Z?AYwFUSQ&Q@rTLaXBZyF{&UAY(Esx5jyskw}};0NApf_ zjT2+ktZCi5|D$>fTExHpn8C95e(M7*hikig<2s@#MO^ETF{;-%w-S6_Y{dDG^WA`Z z0t+3keW%7|OnceJ$0vV(h)Dck+3KpOUFlY=+(lfO=fUpo_9%TdmXxIVEFX@w=o!%d z*;ZJ4Sv+AYkQXI@bi43{48}@`{U_0a|6W-SIsdB{G&?ToHd<7aTzA#7`9F{SA3hjy zD2NgjT5rYx6+clS(=L?bfio}EF%Rr9kENlD?3~I3)iZhylf)dyDS{7k8TUIUS#+ zw%%yZ^-z3%rNJloiGM3FP)VKWAOe2`|8eU{$WrQvmb$0oR4y$1jdth(pTurd`#M4S zC`Izy5j`hQVLUUUa`h*VQ^)vMo{p%6*8QBa7z#Z7v^EVrQfqSR%<7d;%hTmJPtvrd zI{npTXB_21?Nqp@YTS!}MjCVOhuilR>tIolrG{_f zZ3FuK2?^{^TBfi_#PDE}>SBNG|%re|TAS zn3tnJ_6{cIZhYKJ{z}6=>bN&s~8Wt50@Xl&(6={D(+EZ z(S-+1L@X~#ggpyaasRdfst%hNIk9qgS4E$zal|}tSs%hv;)uD|<@+Yzgyny^d=aBx zCGMT)(t_GSXsjIRknNBc*DuVYU@JfBc~Wh~VBc(bQf=pFn7dZm|3f*FfV#B5mw-~4 zE7{9BIV9m4(g?G?!G=w;CSUOd@>k}bsZ{#}w5jxFbzPN;JQvLDy5eBUv=CPP4cZqW z;Ew@B^(e>wW~YA>ewHQO!w|2#dbBCnuf8osWz`tdUgLnj8E!=$4~=w@yIg#iR-G(U z`O}9IGrvm;yg}qrXgT6DFtMMly?f+gQOHwU$;Ul;mgd2*Jr~(_T%+@*zcQZxWSX`k zJ^aLnU03zYJ+WUxPoO0L&+F-s2>dAVktOMR9?b+>AJ3~Ig9O%S)PMsoDjW*5`XNt! zxt0L2LeBZ|VbH?3JKVx{RASjc_vcU3@(p_Jjc|QFZC(9ERGz2XX`{a7JWfZ&+$SNF zaKrn;!9=e3jJ6(O9mV$fq*X#4A->ZN`J@vU{LaKKyW6BhpeB9)q#;bvx4v-M0O$Y# zH9b(nbr1}55}|&vZxDu#>4{kOy;r&JI&g6y3LYT1apjuwb8fs??+5jZqEn}Q^*nUU z9WN@}ughY49Vp1>CHnffFzugsM!p?~?bI!{CEIkVUYQzS*c5*H70i86{nZ0}+-O$c z*n5}P);*F-??6Q7XMf15W23~8e}{%y%E3F|HvyQOWDM`*!V>Z@5@{_{qA3kf%2zNb zHpIf(C3I!n|EGdVA#J@VGoMm@n51u*=k%3(ZQX=>#nFk3UW2BtNpGk{(vOffn!L=( z{x)|`Vk;J!ujgdXk70o$hrMYNdVvXXqcqx>?%(Gr`RvCHC)Cc~Eb0B$S2?@pd6~Jr z1dT1Xem|}}UhV0=#jh)=`4_%4AKK&e6nAc@LtXmcScjZa)R?f16e&PKPi`jR%^?z#+>*aV2lOmnq z&EkLGOlnfbPK5+4?8oY3gf4Q_4UicMiV7pY>tWmaajgZfB{p1yGPF2hZ;i*hPiErOy*sU9qiqD)e1w3*Qj(FOd_|_PR(#e3x z6Dj(R6j=b#GC2_SAVpPF9@bMUd-*kgYccenuJhnEi1+P1Z4e}!Qkl$6Up`JLcD`A> zPr6kUm_@v0RQ2xbqPWwF?4Qykgw9h5rxi@HTw3+ccY!TZ{yOSisc!RS(q^c#3;Dk#1Gc9V}4q9XCtjDuniL{&_3JnOKn%m^sXRJm47jeJ$R3G=A1# z)vX>H(#{=RAQ2z$WWzIj6)>A9<7Ky#T~s)GnIYMo`xJbL00;RYfcX4MH^W$mIr2vWvSvz=TT zBt6uy`bi|WQM0)=2hI<()vm(x>WV|O-&X60kFd?ZM!t{jEHV=NU+-i8d5}|BH1(YL z_^-q#DTV7t28uBvk{X8_oc+0Z=CQgtb&C(fXeS--;&oJi`e~QIh)LN|{qv{Y!glYe zkc%zlU-u)gVJb@WhB?o9C-jcU%jUgl-j=%E-xOr0HMKTIGZ()bBJEh~43Bn>rbxK^ z<09?$z(qb8+38sA`7t&O?y;wPTGLV4bi zfX;jbQYe5F_9Bo%C{h@N6jH2d=;I3e24OFaPJVv-n8x4r*m3b|U?=!;&EGdvH2$yF z#OBck-76WMscm$tJ}nlXFTe~YI(Lr}Z+JFbp6w}S__@I#BZAc|f50XGd`(V3Z9`kl z>nMYY@sAMWXU`m6{i$Mc{qplQv3yn4{KC@Q3880ck537qIKSw~B&6HE$kTgt9C{I| z1Z8|-oky4Wtnr0P&bjz^lGs6QD=JLRIrsr_%nm*Q6Yw{>|5d^=Nk^}tQz9o{RAm%{ zcyITM1=6(iMHlMV_P;6qzSP^vldxOK+iZv%GJW+};n#-*P}_U!$w^n3d11lNcqG)z zgZ#u6N8)UlxOp%Xy6N&6bEg=6Lt^ z57nN8P_G`!i?Iluw7mkcV##{6c?~ajoD>a)v#sF|ciQaN@>bnvy>13y_~_4gKW0aM zRAkHX$Rz6Rk!5{O#ui2E|L1o_SfrkrJyoR$asKyR5tAvx$+Y!d8_h zdkd&Io^M?gNC<%h2?PivSa1mL4#9&53r=u%cM0wg+}(mpZ~_GP;2zv{a2R+szyJT- zd(V02zO~+2i{ACsSG%gKt9H%w6y1Br>fn}D)ruO1WpGH6XUn8fXr2!thay|9y`Fp7 z05|;^50Bn!%O%XvqUpLZmo718b?pv*+72&~&TSd61`RvOxpeWib89>Z9f_{)9{Q$X zAvk>IImc%b69s)ZeAclH5P*V=ej!EU^fy?XLO>5lyShi;nP-O&;;bM>LJEHMw)9dk z3S2uQ3%eLrAu?z)n(1wBh@t_@Uz9IWU_7pq*Xa_fcGtEe>ovs!!;X=^3>s?I@3;as zW;Mq+vRD2cc=Ph5^omrFF`BK&kec5UwUOR|YGq7mRimHGXQy#J8{vt}(Aj z3ar9DqhE-X2?KpLr!2i1AHbE35?D3@%UD6LOc-pi7>D#|d?4)tBWqaAxIgc~dA*iR1`S{rs!#VFOnfukpO1LhbZ*mt zg{ChnYLV_MLQ zjTzT?Is*jp8-@XXaa`qess8bH9;fs78rbIJt1It#S_ZcFWwee(QM~yJDyeZC(FP7( zp;5PTBP%80;{S5-Qw{yJpTDQMAucyvW;Pb|GS1$sDR(kctPIWk!M zU@fo)JaSSnl(?!@+?(m3h&4aH{V?gHMA;RPLiG(FJ&{(NDngU%qv^)LtAS+ND?{#U z-14PdGwt?)k8(Kj#X*nt@hqmHCRH_ocqnyAtbEK%OB?h$;mg9*KP);Yax zRMrbqCd*Kh)66@`FarZHlDTwoRWOsOlNU1zJA#t{HUQcHYz$D3sFUas4LgD-7S5!g z^TAg;Nb{xOr=yU0Mdvil_#_i2u0R~;u|Knh7ieX$O(WnX1A~!}0^Qgdg{F}+(|{UP zIH03dHDc<7xv`?&d*agFE)Oaw0_q1pzV_%@6v)KUIV}^%F|kh+1miq5X4Xo8eq_K* z@-4mF7BETBNi<-R;0)<7lS~Hcz$C#L2;rFV^(UWFRd4MZh9s=5qeANL(-uFgvZEg;}KSc#b<< z-%*%$JNRvi!(*H@hZiTQC<1HrDC~bSR=pMtCTCST=-@1ZT}%`c1^uAsS*W;l1z-jq z>;+6?z_svM*BXLrIUlOR`R7{TOtZtoaCpoC%dBzGQUyK`O~(1)46a1ua0DZOnK0Tj zQN)44<}puN!UdBV_2D5-z}OX3`p?ESo_WV5WuR0&%cV~jZ9A@K98t?FMsB}#@B(-4 zmM(sO3_T@?e#PMdI-26`t>}GJouZ<4dUQTTqoO)r| z^UzF_P&w9aIkxUm)^2o_uo@a-l^37yb?b;h?tg(W#rxDimqxw{=%z(;vE{N^yz0b! zYC6ZKQ;1As$>R?T=kkuwkUpKuC2`D!PAKgryDng<&CLBJ_FqQORgUm zHAtdvEnbRK$bGfzX*}Vn zRFUz|(Cj?&eIaX_rX!rdWv&{`6J5I?KVGZLRpFgHaN&8uvcCCXEhS}VQdzif!9_&& zXIDmTq|To=HGcbIh4AUlK?{wM>Ym7*z#FpZTyKjSGf0?I66_t^#^!Hv~pm)yVIZyZf_9*+{(3TVcM>3OP&m-%n)>#>N8Q9kK$^O$MGC!QSq zxoy{w6va?t!Nt04!^BfA5)r0jM{f4}umzLNuL)$oMA9mdD$T?f`8nU0jCDWhxo@M} zx@zaQ@i`795L#((#(}oY@4Y&C>9lhAet~T%i{rNZ{t%%vlm3<-KO%m<$%GYwP>Yqu zz%op1Gv`>Hl~Ble#dT}Y)O_?7_+LJ%IBb8L`h6}w=RWtMWPT(KBIxtncw3aMc~azh z^zckCJLH5a)v)HhV)%)H@t?vSr6@<$KVLk_BkKN@OsW2vwI=uc6Rco}yJ?rAqv;@f zM{Cm?!R(*49%*A5>ip6>baX`I z=LreGxuOoqNVD@JwqIOA6b8s}n%-RNK4QO5mL9^racomU6Hjv&g4&_7kdj?h!>V)ekk0hD~NPO$9_1I&VX%ZEC;;SnBOhEiI68Q zsP+O>0}5G+*Pejo2P_d_(E%Hj9szX!3oAsq9t2onpi5#R1jVS$@_Mc=FYqnB>p!!8 zl@Iu}S^xdvv<3R8^RGi`4C!72H1>ZzzO;d^ulV68$rrUF(fxlPL55r=LWrKe*ZQDE zCeS@FE?zG|_rSOif%8Ry5$FZ|gcVo0Te8;smqZm;i~e$wZzrUhLn|4V8A+@ev}l~G za|T;=osiiZuMCv-G{F}W>GWD>m*-k@ME>u><>^nzze^JeuEXTt)&w57GWTVS<|kt*)ED2h@1d0-Ad z@vm(^e*fCkJ71Jy4Kh7YHgw2=NmpI{R#yE~P z7W>4QOLP+sD~lW{3675I*Hf2h|EfzzAM}6wCMHLsnStjQltNP~f1=>i6GhNMUs7;R z*4(#12*(rkGHTbOcAxk2Sr*EH=NV1d62nMNFQZ~I6o@?S?gcY zOhlp^-s`?A|EPQ7>pt9a(znO=ZQ2{DbNMYD3qJ^czD^&UlP8VDFhU|oAC-0N#h5_0KS(l6}Aw|_TSu*v>jlXD}* zC6(6xy=Du5uq*&*Zl$;e^8l~{;6*V2)c{D90dNUGSQP-=cR=UDIOsD+oe1{lN`zXn z_E%I>vG>GTN>XS0-k<6E<)D&vWbONuQ+5euaCF8?C}Vaw#xY^ZP`OK9F<7Ea`;1y-7NxM3Dc(CR@- zbhM;$W}zf^@puj-Yd9+W(daSaD?Chm10ms${vIY0Cee7P$f$OC4cJGPWHz)Opx8fD zW7YrLGd1N!6e2R#zS_MR8xxag*lu`y!OQk|~sY@q~|_CWN?P9#vZ;g-$A2Yb19 ze>qV5b#)` z?m2L_e-LsN=UCr+*U!zf2{lNUfq;#X2Uh_#W7^itA2p@RKus5>R(BQWSxkDD9eE(m zT}`y#=aoZx_euOxkzfw^;}@8TfqoRflp>g`a4=|}j)A5}9vnLwJZ6#JMMNGD0hC92 zC&yjw4T>1Js~>?oe^^pNdS?xia?-o@oxX>l$O9PDzT5YpN-+0WKzfHuFlX&(&^{3Z z)fT@*BA9F6>wAz9zdYuy768Z@C~1jbK90pe1;7~?Kz212y4Ge<)j~Bo)7{dyEZK|( zy?)59K8@Z|oyvD9T#q7rM?SZ8Jq6W2+pHZ3bzaDh6hA(G@Z=t4pR=?!X1>*ZM2gKO z`_{0du_tdk?mU&fmSg=xxLb5ZBPcYitraIYicNJ8cndS*0^Y*tVBW$ufw!=_ci4#* z46X`>gTSx7v&_>Tn{oo(m)n>K0OUo#Y2zV5&<8im&D$i5;9i;GsQcs{LfNHoR_fqL zuJ$s|USW%S4Mg=S(uF16aPTH)j>a42xzh_nzuE*(=WHDRNu8{ZI@m2xbVFB`$zRl zb@6~`{0zE?XJ}^P7u5?0=01(Lww~4n!$z8<6C7qHOZXR6Kd#zo zO9?D$epb|E-N&Oj(jh5#i+IQZX7A*yAkKnF&fnw<-b-4qCQ3eVXzMU*8cli7xC>l_ z>5KPke}>+6WH%qHCERrVk`ptou~YcR^PS%MBF3`ffr8o;B~t$7HFtAS+~%Umvf@#z zsI6^dat1>^BiN_cQ&{$yl*R34+lxyt56!nX_S7j$ClyJra;z#cl+U!dq|nIWpEJ`a zTWk;id)Mz%dH`u%9e~#7?S4qZ?evNMa2}K;;2-3S6%&DvlpmI|BiP2wwvTHLU+vAqSQ|)v#Ry=Gf%N|GYf`Lq0q8;CXuQ# z-aw|GQ+=aHv|BuNb01G$v=MQjdq8wKjhNl6Gb;9wHh_;+o`sYDTYAjRE_j6;62Xu^Ua*UeOL@1=TF%=Z_~c5IXUYBj+>+G9D3@y zMYqbLhHol{FRs7sQMSJEwDd1+ zkKPS;`x2v5#x~gZ{YZ6b_SH_-9g||)(J5RUsN^72|yK2`(x$Y)T zosCD9Ox4&w%O_-_b?yXIr7gDxcm5*IF+tf|hI5)>=-!DC|0VCtBd=uo_67CBC2Q|x zG~#2gs(W@j^X{_{?nulFvQLwe--`}i3B>zLRVFW6%tS3mOI4JP_orNS6k4@O6k01( zB|sJ%bL!5GfVe^(5Hs*+CD<2?73)-2GbA~LTaLj+L9PVv&D^zvn%mJ{)$vtyE$IXW z?|HV;Os$gSxam}Ua&!qUTAta5b0s)>;1+>3k9U!aq(JU2?Q!`xNhZFGd%DY?&H1s; zSShWmt_Icy+-=MV%cIfF(=ZfBy5(m;F`>1Ux6F+}nE;w-Y_ zUP|RenVb;}kB>DCUyM1lpeeUwB|jcNjz4ULRQzwpy(M|>1$lS6e7~mW{+Bb~|KK=# z%iYS6l8!=Rk3=M|z`r4-C9gW%Y)1MoG|?HCu*jD{L2>L+vi#4})a=K`)`8K%OwSL; z-d2e}^`9;b7kK>C+Hg4^e~`Oemv7cVU$WlWtm#5v4c%ZW^M1W8iWKqQm9`$B-!!bD z_BL!EK>O3kbG@%W(j5pPWov!|u3sM$UFcosNgQgVelKJ`{4y z>Diu`1ckE@QjPQr+EP5}Htk1uAgJ9y!Y?Ej7~`b78E^6Gd7>p?W-I$Flm(AUR?3UD zf~f9a1tPW&HW*0N>5>9!`EvXB^RNIp?ziBpnqdokbGL_pZ|KF0yv!f=8nJ*pl(_BZ z{zbVUz((3lC5+&j3|^vnHsqPtN-&kzKKRBaY(vYE?G-reHm`X}P`tsNn++^3m1tGqGQ^ETdKhdZ`i|GSKtzjh6IorMl5!8VeG z&d(Da)B^!fy#AZM0e+UV8Dtzhc&2D=SkA>091Z0i*ceY61o5zt@hm2z&aLu|woC-} zqd9Za&8^C^kn=3=CW2DBm;;-_{TPBHR`%+y^kq?}hKYU@U^{5V9)uw z7mD_nx3XGsOYmR{n0@E#ZNPLox~#|l5@pYHww?;djBT;_07O0w5bV^LcFTz#0cp-f z=&2tEWwhB=%x*7`w9|_*3FwkpH4IAi4%;h^9~k?4By>2?OX$x`p+TvG9Q(uP9z5t; z#hxPR#`#f2_J~)n9Lu-(b4KEq#Fft8)%SUsJxE+ZL{FnEs}?-n>l$D4BRWe+WPIZx zBa`bQz>K9_LqqOYv<-SnOd4Cb4ltHo(6=aK)iKb1?pVjNF|S!J(Tl0#2(^oK$dTA5fcafU4uy zi07!ANiI*^jM&SueDPGP+0r*ls(}u}f&3?;AN@|f;F#kQPG4h7>NCDkuYptn^9QfS zq#2aC{oSo$8X}p212f)R-8w}z>$ADJ)#$MrTp0$Lp6J5^Xt!oxBb#SQYV_VeM@8rlp;wAm*UbP=`gzD zCJ|rW{gFup*|VbUd%x}%8;X^^7FMt(7xAELX=C-6HO_hS z*U9L^=yd9?Oxv=Aw$Wvbz!G(rC>#IoT+^Zz{c6czb!VwprIw6!Kp_p$tt(wc{d?_Y zdd_aSW9{+i7h9{LJ;7!kfBdl{6g(Spm<;cJJ{SO*}i9Hk{+46K#Q|?`UOgtP8hk2 zjd=k@jt;0H7zF_oB_E)aANS;~Qss>2?AlDM-k<#Q%md4V0m*`*coAnHZN@KbN}KLx z2-Tc^?=dd|?84*Fx~V~?C)eLR_rjAtX1k^ZIYIRneO=H`Vt&X$Kt=jCPTq04p3ZiJhTQf`F4 z|HgH7*|Qb(PS3dn#@l&cH}yL|7FF=~@ms%f-IP22QTE2w*s{Bi$DCGdSxtlKOx8Il z#<__vyk!FVbtByhgY?)T=#6Wk#_v9!B~r2FT?&{=NDS_<&9OsbvvG0BORqUfc{x`4 zoovb!l=Cqx)JNBy5TkqEbAy#Ct*bl24)M}`>KPzzrh({Z|Lf7;_BJ7%Ay{R`-s0Cy z?1A9;*qNJCyi{LCZiVj(;`#sE<9_nOif4S~zIiL`$7n(jeK27Pv(9eeuI4lF^a^cO zPyx#g0IrV^&tcb$is@$YyxoQE_x;Ud6-TA#njAuA)hNsEWlxLy-6C6O#G_LVOifs{ zEGtx11KgcZNJ)qFg2Gun37G$s-W}Fe_m!)r;|?Z9`jg|%Q(i@B=_IPIF6ey==E8dY zeoI<0IEh6K?6a7E5E*g}VY^DF+P*nt-qA!j=0I;U36JJ&Cpe~OSRU>cz~lQr-0$8O z6mBhH@TxlroT5Ee-kmzt9#lbYYerlTY2EKzE*~m;N6mHS^tUf?(;@S!m)EX`(63RM zs)YwgR|ctZJEPW=<12ed#>?F^zDiezK0KOpry=RIKdvZ`$_}o7x7u&t|7PAio4>P_ zacMCTPf1u8T^O%@cib}P{cv=>e*mJ8Rcq_4yAC*d#%)v2To`5)YR+7_e%&5veBC)h z@Tq)1thLg9`}&9^*3s%wu9%22_BGF1qYg+TjSIH8G&G7BpJ}JyWmyP z82xV(O0)eN5lgoJw>N7?`tI41ct89B~=Kbc4L+gN5LPQ7L_}9VP38jhq zoH^3_+SA?%Xj)$zlIvajYW1km=FQD}Rm_#gW7q>19o+&g^fUV$io+O0Gf2bbXN_jj zaz=^W+&X*K%}7NRPKI5W+0XVOJgb zkgXQgA`$y#fm>1g`_HYPm*0(lKidihK7PenU6=8v41D%cU&&-}h=3dhD4M==6Bbb% z&^U(C%>ABP4@v^U4|3yW*SS4kt&MKL(|68<5JO1P5~+xS)y%|kzNx z1fYEzjj=BNh-A056Xq|7+l;5wpNf=8^sY%;dDE%pi1%!&BZfomqWsS!QT_UMPCi0x zqPRLDSw%!GiiGwX)925j^Fq_1OVi_R`nY$(&S>?JqEWQSfttC3g9q;1#^^!t5TJDY zOG57GqG!YiA!cyzql;wS5%&}eU-_PJ{gb3|-8SHv#JTJ28y1{cJpGgC(Yh?Ib4Kn? z*5ziucD~I%>C1P#y;U5Pd#TO?b%i zYdWrGS#c`_btAYP0I`@+}5&n6$ED5*0?vp5^cX*v3y%KCUw+L6{XsY(Y`0JK0(M& zpLh$RCau4XsGuFl+_!5|Oph;(*L}C<+>5qkl^66_d~vet7L(4Aa0C9k*9863e9@mB zRAA5c&?t;`xcGeyb$GkwY5W>j#bDd1M|$RG-n#o6ZsB~Fk$dPuj0?ohy{#Gh@&hh3 zpZvk2E>oE1X<1E=>P)GgYrySe>Ox;Gomk9AFhMG;$)<80MRQDj4`=ZHT`cl8LFVj&nLcIX?Y55zU(cv5Z0YIWzr&Sbp1omL*FvxE zF0hq+@pJd(n4MJ?Ue@N~{F!raEzaD*r^{#a-j;m#R%@3>rA=8C5AyJ7FRpdS;r;mC ztPQt~ADm;DZv(UN+0aUB#)`xoao$NQt-K91Q`&5~T^3Zz<%ZCdJOw|k#*0>Tz`Z>; z?6ItevZ%DJIXA_yX>mS0PuFwn4})g*a}TQ1o0m&ET!h;ck8C3@=MRS~U*gRL8%cc+ zoPYX!%qU~n_b$lzB>G9Xk#}kGk?uliPY5l(|FS#jlW&BSDRm<9_u0OrgzA1BgZ0m7 zPVE+?68U{%0j%HqpMJ8?1hqC8DiuiRZeou9K=xzVQwNH^2ij2=^C6QdVok`iBW_aq z8qj=Bu_L=TWM?kOwLp0*ZSXs&ieJF z4izfKPssB#VaaYyfJO&0$>c5mxjf8GcJ8A5@B(=okhP;he!bY26j+@s(ikypN|j0d zdI5}S3yR)#f1C1nF6(!xq4T&K12aAR0SW`S0S{(uY8kHA56o}zCO)$(Qq@**(QUH$ zeg@fCfmMb&TWZuz=75hNE6krgAKGWYsgDa z{|6&B7ckXC@=wRcJmN0?)iD!XmG%G0cxhCtb5NRrX$irztp1m!{kG^g z{C``Sx*gfMD44lyX)wJo>mc{`jX>EQ+Q>wV-v8;7O|u{a9sNnOJ}!PIkX&8@KINfH z+^BKmAVSNJFWS=EqIHG%hY!{#(H+|~yc_)|B$Qo2yafCk$$EXKC$!VAKHGP5e>5xq zA}%qEz5l$pQICKmo%V8NUU+2i@Fu5C>O(a|Y;il)PWe%7&Z}^r;ZW1}ah%@Moxffg zDu7eBr*YB01H$-TfiP;CA8JGw0uaNQo(4hw!1vf_)Bbuh687Xxmn$2bJ}*9T&pNyw zFCKBv1iW4ghhVtzlix1Z_(2P#KA{A*IM!B=&RA>_DFNLlUF`R ziGnR&{Vb@w+k5XY(a+fv=FX|llKY6Zus_u7PIOI-F59>x{g%|xyBKlbKeI$-}5id=;#2FLE8$2k^dbLDIpQQ8=J0eF6 z8h1$wYJaUZC!0KxHb6h0j{T3$DU-uG$FfEg9A^Aqdseeb82rLSi5F`Q^w;)AdLydQ zMXbAKl>md3Kck&0`FUo@{Z}K8mz45YVtfG zSRoh=uU3!k1};1(`3ZBHpbTj9TQ~xqY}WhCR~#LhA4#9g_Yph4ijXlO4VpA$WzIrn z=+G2fhs_aSUz)u4pCo6c&qSq!pZhYgkNbM!7fTG^5OMU->RE+MX^K9s_ zULmENSEc^btEY$grtH3<9%746?2*BVN&Oc^S=qBA-hECS2h-{C)E*Da*n4llGG~Rn z{G2$};K82u)IeXRS?nX~sK_OwFu&78VINRQieMWqkV790_9mv!u)VR^0QMvHtTsky z3jsfIG|-)xK1<=hT2*puMbzJ6h)13Fq@Z<&rud`z!Z-+a!KX7x242aJ*$MDM2_Gkx;Wgamb8&Dvvx7q z(~+!;zZ@vL0#m61-lC`Sh;x=La&?++j=UO4ZoZUqJ+Z!RGA?iN@*_uX`Zd6RKjYET zulTzrns2B!cWPsIym;HH0oO8zjDbEQ)meqH_xHUnP2iRhSMR{m+>FH)!B_N&%H!AbT2dD5A!z-hZdj;BLj0;zZD-<{G zVghkA8eAw~aWqIFz;HkujWFX*1`tQ12n6c@?D`rA)&b&Zd@}B&Bc^cX^?pN+3eM3L zel#nSNdcl$2o*RV6o5tpb-;|pz!nu)@z21j1~ZmC`pq89nCq^XlwyiwE=w=7&uO(H3WQI zFgbuV0FguV!2&pyc0uYJN&NTxeKm3(`uF_t=%~wN5T>K{{?cGyUrX*Iv|kM$0_*2@ zJ_~&Ya{Dh0?%Y3WeFT6FGbVBWZOB5Cu5%PxO=DJ%Us5z}z1x$EyD$abS(~p3-%XWVuU^sBbLftK&%gWt99Pf`*bwlVnHUbvW2QD238T?Kb4tHJ z1+cB7#crAd6k^P%t>|)d32PdAf@nFH)p$QjtOFuaAvMrUX;{dhol_^*x*z`MIQWl? zI%~Lzzr|%jZpWCtovSHw!Q;-ZiUO}|KhT1}$;A?gX}gIioQgEqoQJeF)2e?JbbNd1 zeN|IgHf~AtCVazu+OvnC%^XF{k+M-?;;g-|8?Ir@U zgRfRd$nHrX>TalgDTv~W2~-dFr#TK1gT9t}#LrYMCZ~tnC_Ez!@exPC?nvM ztJ+3NZdcx}Ahft$6;41zxtg1xgx=>a8SNwWVW?j&9WseWrK& zcTQm}63&EYlu&TNRULjlWqV=n7UY}XgT0)tr&)&w`QJ>VuxGBm*n0lANhVeKF;@45 zXHG+#-0PXEkhNQW1G3f{IGEo|)9; z$1I?*prLIPw2=%76*X6kL7{YQn}E5QYN;qc>`8$4*1-bHkNs}7I@Vzcwyy;0K;W;Z zCG5T>OX(cjQ}_;(bo3b9|fuxj|*3^Z#}n+YX5pU|>@z@y_LnC__rT(=YDA93DMxz5Zvx6%4>-xb02j`Dw6vb{_{ z%OvRQYF=x=_(K^)NRoE-LG$@`D=qOiYutCZ2+1#2jyUMQ{U&(OPgPFUIX~*dglan* zNcx=cRExCs5;Ts^B`(^#!A^0)V;5Bu6?<$ie&l$m0N;7s$2Zcp5qV#Ff2g#m;W^`* z`R?5pm77PM#boHu2r}n149B@@x`i`7ZTHA@zPP1f5Pga=)8i~9sAcmNQS>*7a6!0^ zub&_@NW|30Wb#YOTFPUC;fTfU0<0y?V>`J6>Ls*=TyVOdbhWvqk%y#$sD1I^bjja5 zfh+iyM+ZxunuHl&VY*^0Whz*+H_ZsFXRsq8@XMh*_0W4A+{Xf6s6d5b)A z!$v(7fh*pJ*N>QJK001Nrsl)qqx!djwgoyKx%Fg?ekwUEgZ}9|Gf#||Dttk~xdepg zR14g2@P-;svjk|z(#JC6pAN8J$$6^~?|Bl1vhGJw=$6{!acmdOll~r#KfGosZKk=V z6ZuF`=*oAQ)?ewz8CjD5e1H6XStzqij^Hy@72EGO7et|dGc0UO3CSSx-(2cR%5fB^ zpLn#u8!7m4l?0mD?>f4WI+#ze%CX~$xG=0!wVh5#wQGKRNNjo)sJn9AGKj6AqHibk z^Vf!7E)NCnyA!6yzi*=ZyMN@eEgC9+IAhgP4|-2@H+YC@(36`OW=2@=MGzlQjCWd@ z6mN<2VK&(1OC{=Qr7qUm*AATDU4EJPydSPlI{+XBz_+uDf4U=MS2uGWYaQAP#-(F&4bxDhH=!rsK zEqZj+`Rk-{;6g8yHNTaSwuCsh@J_pR6CgmqCz?b z3@En*?h0eQvtfP@zqMbV69ARWN}%G`N;UgN`USUj_M))Mjnm_&RpiW9$Fo6%xRLQ1Y+a1dIh&l4`DHVmPS~vb$h*|64>56yj z-COUb=XQ|UU{S=kPy&J)XJiu;`?(e!!6daTZ3-1gI~i@d6Ma! z;19T5XwX?6WerodmWw|Ow%i2~rroDC7okvi`>big(!Q3pcg;nim0Csi`#Cg8(e0wq z-52|nhyum!xYIrS1blN3P7B!+aEpmMV!ZU#Eh&CHua~mKZ3H<$hdsjb~tya z7Q8r-5zxo?-vGRtU?7a%5 zqD=6oT%=Pf->#7DRr(Ps8*pomy>~@3xl$zW4f3D{$Osh4KNfw2zQx{KDUpB7`v|Q; zxnQ7~Y*);F$odFX2)Kb4%0F4tV7r}IlvG>|RJ>`H~Ynn-K)$9kPK>TN3 zI5HJZIT3v6J<1A!jRG>Id5b^L(?>dg@k+`RxY0~L!QT54Fz;1fglBSQAD>HDB;WgH zZ;)V*7d`ZjPM|Q?IO5Okdn+X3h)b6QmAD434o_r1pP)Hsu6ZL#LVq8*^BJ95 z5(JS&ZiU6F{BUBDkq9_%QufU?#V@?s>3cJbD#gVvp4_D;o6x~4{mCZrc>=@*8h$US zd1~&2)nnVVriZp}(%+USteC~inrBt3yTf&^NS$;2;vF8kC&NT49PiV}wnUlb_m`~_ zwF$YBR-Dt31w#-<14ZeDiqne_f9lx{^~PNGLm_g+BvSl1grQdvlJHx>J$Z2UBKn_w zxN?|~IKoP4A}xnI-lmfm3k*&SalR+j<0ClmMRWS$&o|jYxT|}mj$roWRV%r~S9FI; zeS(8*w97vDh49cH!gDGOZF+dWt8{ce;Btua{VFvoXLy758msI3%We@ya$%-ZseXCs z^Uut$Jpw%DgGSDZ2#*jG(`_Q6F5mUJI%d-T+DY9YW9%rQ!p!iZb0f<$x6RTCBShX+ z55F)UC-t4bXbd0dzLghY3^{x_cWpM9UtX6y&sM_tf=l!KJYET7hp3o%jPkQk(yUZ! zP4)vBmESBs)_Jj_JS}-b17`UPDXOn}kNrTfV#dE=!Z-Z>`rvmkh(`W&e)ldi)^10U zPH4DJM~IbDl{r*1-^Zr`qg&+}klca#~Ykdb@cfvE<^=@;p_PU-5|zMGj7< zq{w6p@Yd|887?A1fKB>Jq4&3h$mA;+#XBT+{(B*pa+#3t^l~TUr?^}TpWE8uIF@x3 zVF_P7CEOpH%fb%k=5VK+=_5Hge&mW&6I*4a51n`vzt~X@OnuR7f9cbmJh1eL5IDQ_ z=>3Hne|Wa+-9vn>hu(rz7a-k(ZCv7i^h)*Jc|gNj)_NCq?^9>i*GO9U<(xb1Hr*Ze zQw?i>;mtH{Px4sHIbF!`Rp0U6h0~%D+Vx-~$+4`5`u8TR9AHOXvGcp-#)(D`nfLml zeE%wzbqAH5{p65c8{hK|vSp1TNiJ%;iI0`TDJ;`3ubI6iLN%hKkNH})gc|;n`!Ju`5#Ku>$aYXzqze=e+}5;DZE9PUU#k(~ zbT0*Ao5Cw7A+p7OE!D;BI8kQ2`Fc&0RLkUnJsC=&9e{tPsU+GEq2QkuR`UEOli3%0 z1?p_hh|` z;*ft-nBaONVayvH*}#{ZWhPYwEgV9e#q-WCztpcTUu@!DqQ9`pSOrRKKxwX^ zxkN>RC?F<|_(wt0Cya#8TIA37i&T*JUg2^fOKQkR)$~bbq0KBylF8tgIu@E;)XzY8 z%Tf$lE(~vN)y3KO;L1qfIvPyJl-;y+z=y)U#kTw%gNmm7boQ@{s1GWdIsknzpaZ}g zF#rqzFo6M602;PDgS57UjFL;2Q(vukCJ$0OZZFq;M|-A-k6vI`N8`e$5LY`3i6 zCmbGR8b@cim*bfZ@&8dC_u2c8a`miav4FyNeuwYV6M62(e1Ccjo%1@i{D@v1Nt`Tn z5FmRoH;^hc&+J!Bk)^SHwRhJ0o%`{}I#&YmzDqRS5O>D6=e4p$nOu|Hga$9`Wq&1g zmSHg#`0Rfx)JJQSZ6Hz{bL@mBb(Lcsi5FZX30Gio_Wa#g&Q~dbJ0OCO%tQq5 zHb{tzd{b+A6=P&CDe|t9L7~*#Nme9fTv$Pkfwg3HrgwP5jB}q@jzq|cTyq4urE0w+ zFgdqFrsI4`0w-oTaDH%=Rx9Hv#U^4LB_`^E2OLXO~p! zbIE8jp7Gq>7xBCw%n|}35sh(xB{=y8AsW8{AOV2H_pV=Tuw#P|aftyqi~$S*0NnuK zz6Bs1#=LR;GFeVtWl8dm%8Vm&Rty8}b={q$#Xb^JXj(t^{6U9r&PTye%j3U-LMsEl zei`vk5TP_kC~nGVug{C$QSB&j$)^cK6sU4|;b0%m(ucp{e@ZwKw&u!-6uQ0YL75R` zpXx%m!_>aC4IRb5%Dg#i|HB!X((cU0MilYsem78z9Jq_h#q@5Rbs@p%` z4O)6GcHP9aSQ(v(V}5g#zac<$kf$aBLXDW3dr}{zlY8wloA3+9v{3%?><-n_)$gz2 z=}4&&Qba!+V5It38%e%8Avh%ah}up~{eGdTsDp!C)IbB5?YtoG`5xJ@y2!>~j<8T} zL(zhq5!IODqBvy(nmuXkw^6y_uUWgANIC#4<&irQ#sr|7pOrOYFRS`h)a2!21N=fY#TmJB;!LZ zQe-J?i!=gqFOdAT3DkAS%|N8ir_E;fl#*ZQQ;3aA>KHFjl;+vAE286e_Ob08ge#)4 zb`P=r9DUpa(j>eqqSsU15NU4z5*!C542ALGJqC?Wq@TCWK5XaIE+?yOreKcN@X{m* zX(ygTYEu|kyGJziYKX<}=&iaXBL9dUbTiY1zFk>G+*PWBPS%&`$(TF4t_C~Pjms{s z)QON=Xh|sz{i&OzDLAq$(~_z;ODHF&HQH5Yts;`q6Nnt?GRj5pJm1f`C}9|FE%+Pu zA!4SH4Z3i_AyYR&B4U*&$;Otk!dDOf+X^=~sCW!cFM*JJ-kpi>lhW9HuEyf>+8N%Xf_If|-GtCfq-*3@D16PB4d!_y5^1gAPa^-a>HpLdkaYZP+H zuJpF+pO0S}TfEBo)JpfUp1uHwWWn5$4xyc!uI*7$TBsfEdeiZAN!9^zkDrnWQHV$W ziamtd$7wbbqRG>uvhBWn=KnL5x@#~iQ~|lr_IGYwFLq1UZAGE#39488~!3+mBYu z{90}@OMg0v`_+L1`|&C1l4cz(#*bQXoXNiY*3|!fShjO1W^s3CYPq7`{hJZ|yMWLx zIzNWL$;@aRvQJL#f;#vz3S1F-&Ge$>ayFze#A!GPw2e*Cyq>i0lX^?$s=e^2x=TG2 zwtAqJB|v(0?Xghqg&mkLfDF0s$yDmjxnQ#69i32y)`h-|35U-{Ak`Nvvgvz+LGzsX z**6r=aCqMpcO{Gl?@Sbgp9eaN{sY93+c#FvryyH7?QNl{VmW7MsW0>@2N{vN;$yyw zA|Rc)F9&WyDr;p=Yqy>bQc?4)nq}L`X>7*2<5{26n7l{5Rc3wxQLfAg{j$x#S?Z~o zHu7;DIGsuON{+za@7!$Ul~u%Y_M^3b?jCH ze5sD9iggl`NFgS=F)BH~z}^7Hk>QKN?|Xs7t10U+u?Q1WVk0=Zi3v3U-@ch6yyeo6 zkZ36QVOtvz`^`KSUtEJqvY{Y9rY69lT|U-kSPestQlv9hE@czRyL;F5dokyP zk?AKDuk;Wd3i|#1yy-`U%XY`)X`3@i`GgLKD%7V6kGx@_#5&7RkA(bE#`e2YQw40t zx2cv4JLYcaS#!mdg1a{d2`5`kDTFO8b2Xnxhv71*)%kzYZoZf z7dbUsd%)%5pFBVj0!mmMPz^DFGRfmPYver(;62OdJ^M&_^NH|Ao$yAC@J5C3Mwak~ zu*$Zo&RWV02`9>GF}zzO_0sTkY>Q4^y59CDPL$<*!-Z{-$HYq~TxE}`gA=KWvP>w$ zeE!T~xB7-+v&6fy+}9Rhi-k?5&9BN8<*$s)_b3hyMfkR=;s3R|K2Pg7ZV6IHb}kDe6Y+jOxz7GJ&fY_&B41Ti%Q)Zj zr_DBz?1U0;EcKyYywO167MetJUnR$hUc*QwJp2Dta;D)> zw|g9yHHwg-WRFQS=RsrNJ(g^PGRBaQC7Bsd3kumr%2FYXEQydO+hE36#+I!JA^VK& zAw!mAX)2RC_jJy=&N*++b)6T#`}*A9|L?wE{IBc2?*I4u;@`e7M5ecHUhMQDB$@PG{7Or9aQ8%{C%~!NO(*hccaRm?zK-C3+ zBY@R&08RlYa{{oR-Qxh@{Ya8ZeITO50k1f@8Ci7B8UeSHay1a#K_cLTp1MOOd5h*; zdt+TP6+JFXflhql0S=(-LD_<`2KBlQH>RhUW{C$Urq2k`BET4t_vE=Qo>qz1eb$W< z3Gx|%4;QGkEn``S0mh_}DQ!89ot2+$?O4uU*MAR83~(pN z?SYQvhpftM(DryLny>m_E=Gc^74@gP{d_ZaYvN!icp0xsVe1-p#a~nf92+Wkd%tZ{ zQ=ct91s*2rubE>+o0XefAEXWzot8NR+=(3x%FjwzIkI-V6d0NpZ=Xgs#qOqLvrqd% zZ16$m&>A?`ysQAG>?6bt#xBW*K`>kntINj-h->iMnVCUjC#|SO@1Y>8?(pfEmunyy z4-8D>`)y3qg9@N)NA|vd^tB_aNOl%Oj?0K+wSaShg4{US1i(s12fo(;z>Oqec+PHC z%@I|A;knq=foD~KuiI_Np#vW~LDGyvgC?tF(1Z;!p4fuJ)}yGb&DEXH)*ZqZX5)j$ zaJq^60!=4yb1J42fnJ1s|Cx;R)EXYmFSSoV$nOv-+EYFmSY4OC_SwLp%(u4X-f29? zvFkFu1VN+FeYK2j-n(c{?3Hq*m%M!E0gM2+djY_Aw&D#y5egI^0CoWQ{5i2xq2ZQK z&nfUdLCalJL)+I$Rg|NGmB!z*2Ps!DIJ?e=a?XC84;6L3)}Nvjbi!0=9E|De*q zcsoC7jq1@%FRw3|+RhzYMaB(22kIl*>67d0dgr)5sPGFOE5s*CVP?F*5}UinFg z=%GGqUs`W(ywsf6IrI}b)Rz~ZrQ4_(8`~p>@ri-OyyUP)c*STz)l3RSkIXHp#_o$M zW`i<-P&Oz5uw;V*0C6_R0$_Nosn097RO{vDX0cYQ5>X>qIdTST@Fa>bLCX7!6tw-5 zXfntX<-=)H$sdp)=yv)OEMK0t$V@6; z+6@U=8`3Cs)~+Zm#iB|JU64HMyO$i1-AG&hn6ce(PcI1X;>Ba?M;9+eI(Efe43Vb7~og+s*foaWNE@;RKW5XvUba<&4(5D5Y& zcb!r_XPcn_(d0@8UR8Lic}{@4P6J4hfk}Wy2B{3i=vLy?)4@wQru;wvpaX2${*F1y_4>+u_3=R&iNRxQf;3sB@nd4f62dEA%c0`vwobs9`Wv-@xXW%Cre#q@&0n#k z8Nw^{;;6ZK z4`eiXzHdPfSS`To-ywC_;r|_~!msE*tUF!>WWaqsi%C*^!_*JlRE0mua;;mCQyV39 zus;%N7X=4vo8)O3+UE4FVA>dkI;)|&p8_K%*wIPO=EXR)xi2jPZC-)vVZq4wv-EeL z+%uAvYhaL8KXDO^d+Q6f>`2#0?yiB^T7X^)uqex7gqG0+c2cIm1Y7+|5)kyWo9_N1 z7M*ykBZAQ5VhWojAssPPEM&y&H+LS&ZZDAd7mzw78k6iRCS4`HLSgFFujz}+ zr2B6^m1wL}_5O2cV20SscTp;z5)q|#L~x^oob^-L@s#(-bqBp_S8)|H^fhoPUr+<&VLHv(0M&8|_QENiUU^L(6z^}~fA2X+` zN?O$U$)aV~=ZzMA=>3*A1i$GTUzS|O%WH$3ntSz>rU?*j;&q!CdHmvV6?!Q< z08Vd%O7@465-rKnxNG4-nUGuGuOBX$L}=?8YNs+q^3&dGJIUP+_Za*6jOX}_xR}0V mmsQ;8Vqx1!AtT8rjJd+L5+Nh%>1p-d=>980na6kzbNn5zQoU9H literal 0 HcmV?d00001 diff --git a/connector/src/main/resources/bedrock/creative_items.1_17_40.json b/connector/src/main/resources/bedrock/creative_items.1_17_40.json new file mode 100644 index 000000000..0bc7f91ea --- /dev/null +++ b/connector/src/main/resources/bedrock/creative_items.1_17_40.json @@ -0,0 +1,5206 @@ +{ + "items" : [ + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5797 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5798 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5799 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5800 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5801 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5802 + }, + { + "id" : "minecraft:crimson_planks", + "blockRuntimeId" : 3840 + }, + { + "id" : "minecraft:warped_planks", + "blockRuntimeId" : 7598 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1319 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1320 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1321 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1322 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1323 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1324 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1331 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1326 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1327 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1325 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1328 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1332 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1329 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1330 + }, + { + "id" : "minecraft:blackstone_wall", + "blockRuntimeId" : 507 + }, + { + "id" : "minecraft:polished_blackstone_wall", + "blockRuntimeId" : 6041 + }, + { + "id" : "minecraft:polished_blackstone_brick_wall", + "blockRuntimeId" : 5838 + }, + { + "id" : "minecraft:cobbled_deepslate_wall", + "blockRuntimeId" : 1156 + }, + { + "id" : "minecraft:deepslate_tile_wall", + "blockRuntimeId" : 4298 + }, + { + "id" : "minecraft:polished_deepslate_wall", + "blockRuntimeId" : 6216 + }, + { + "id" : "minecraft:deepslate_brick_wall", + "blockRuntimeId" : 4115 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4774 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4775 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4776 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4777 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4778 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4779 + }, + { + "id" : "minecraft:nether_brick_fence", + "blockRuntimeId" : 5689 + }, + { + "id" : "minecraft:crimson_fence", + "blockRuntimeId" : 3818 + }, + { + "id" : "minecraft:warped_fence", + "blockRuntimeId" : 7576 + }, + { + "id" : "minecraft:fence_gate", + "blockRuntimeId" : 4780 + }, + { + "id" : "minecraft:spruce_fence_gate", + "blockRuntimeId" : 7010 + }, + { + "id" : "minecraft:birch_fence_gate", + "blockRuntimeId" : 400 + }, + { + "id" : "minecraft:jungle_fence_gate", + "blockRuntimeId" : 5253 + }, + { + "id" : "minecraft:acacia_fence_gate", + "blockRuntimeId" : 44 + }, + { + "id" : "minecraft:dark_oak_fence_gate", + "blockRuntimeId" : 3981 + }, + { + "id" : "minecraft:crimson_fence_gate", + "blockRuntimeId" : 3819 + }, + { + "id" : "minecraft:warped_fence_gate", + "blockRuntimeId" : 7577 + }, + { + "id" : "minecraft:normal_stone_stairs", + "blockRuntimeId" : 5708 + }, + { + "id" : "minecraft:stone_stairs", + "blockRuntimeId" : 7281 + }, + { + "id" : "minecraft:mossy_cobblestone_stairs", + "blockRuntimeId" : 5668 + }, + { + "id" : "minecraft:oak_stairs", + "blockRuntimeId" : 5717 + }, + { + "id" : "minecraft:spruce_stairs", + "blockRuntimeId" : 7042 + }, + { + "id" : "minecraft:birch_stairs", + "blockRuntimeId" : 432 + }, + { + "id" : "minecraft:jungle_stairs", + "blockRuntimeId" : 5285 + }, + { + "id" : "minecraft:acacia_stairs", + "blockRuntimeId" : 76 + }, + { + "id" : "minecraft:dark_oak_stairs", + "blockRuntimeId" : 4013 + }, + { + "id" : "minecraft:stone_brick_stairs", + "blockRuntimeId" : 7187 + }, + { + "id" : "minecraft:mossy_stone_brick_stairs", + "blockRuntimeId" : 5676 + }, + { + "id" : "minecraft:sandstone_stairs", + "blockRuntimeId" : 6710 + }, + { + "id" : "minecraft:smooth_sandstone_stairs", + "blockRuntimeId" : 6903 + }, + { + "id" : "minecraft:red_sandstone_stairs", + "blockRuntimeId" : 6637 + }, + { + "id" : "minecraft:smooth_red_sandstone_stairs", + "blockRuntimeId" : 6895 + }, + { + "id" : "minecraft:granite_stairs", + "blockRuntimeId" : 4989 + }, + { + "id" : "minecraft:polished_granite_stairs", + "blockRuntimeId" : 6386 + }, + { + "id" : "minecraft:diorite_stairs", + "blockRuntimeId" : 4476 + }, + { + "id" : "minecraft:polished_diorite_stairs", + "blockRuntimeId" : 6378 + }, + { + "id" : "minecraft:andesite_stairs", + "blockRuntimeId" : 144 + }, + { + "id" : "minecraft:polished_andesite_stairs", + "blockRuntimeId" : 5814 + }, + { + "id" : "minecraft:brick_stairs", + "blockRuntimeId" : 876 + }, + { + "id" : "minecraft:nether_brick_stairs", + "blockRuntimeId" : 5690 + }, + { + "id" : "minecraft:red_nether_brick_stairs", + "blockRuntimeId" : 6625 + }, + { + "id" : "minecraft:end_brick_stairs", + "blockRuntimeId" : 4720 + }, + { + "id" : "minecraft:quartz_stairs", + "blockRuntimeId" : 6559 + }, + { + "id" : "minecraft:smooth_quartz_stairs", + "blockRuntimeId" : 6887 + }, + { + "id" : "minecraft:purpur_stairs", + "blockRuntimeId" : 6537 + }, + { + "id" : "minecraft:prismarine_stairs", + "blockRuntimeId" : 6449 + }, + { + "id" : "minecraft:dark_prismarine_stairs", + "blockRuntimeId" : 4037 + }, + { + "id" : "minecraft:prismarine_bricks_stairs", + "blockRuntimeId" : 6441 + }, + { + "id" : "minecraft:crimson_stairs", + "blockRuntimeId" : 3860 + }, + { + "id" : "minecraft:warped_stairs", + "blockRuntimeId" : 7618 + }, + { + "id" : "minecraft:blackstone_stairs", + "blockRuntimeId" : 499 + }, + { + "id" : "minecraft:polished_blackstone_stairs", + "blockRuntimeId" : 6033 + }, + { + "id" : "minecraft:polished_blackstone_brick_stairs", + "blockRuntimeId" : 5830 + }, + { + "id" : "minecraft:cut_copper_stairs", + "blockRuntimeId" : 3913 + }, + { + "id" : "minecraft:exposed_cut_copper_stairs", + "blockRuntimeId" : 4756 + }, + { + "id" : "minecraft:weathered_cut_copper_stairs", + "blockRuntimeId" : 7745 + }, + { + "id" : "minecraft:oxidized_cut_copper_stairs", + "blockRuntimeId" : 5758 + }, + { + "id" : "minecraft:waxed_cut_copper_stairs", + "blockRuntimeId" : 7689 + }, + { + "id" : "minecraft:waxed_exposed_cut_copper_stairs", + "blockRuntimeId" : 7703 + }, + { + "id" : "minecraft:waxed_weathered_cut_copper_stairs", + "blockRuntimeId" : 7731 + }, + { + "id" : "minecraft:waxed_oxidized_cut_copper_stairs", + "blockRuntimeId" : 7717 + }, + { + "id" : "minecraft:cobbled_deepslate_stairs", + "blockRuntimeId" : 1148 + }, + { + "id" : "minecraft:deepslate_tile_stairs", + "blockRuntimeId" : 4290 + }, + { + "id" : "minecraft:polished_deepslate_stairs", + "blockRuntimeId" : 6208 + }, + { + "id" : "minecraft:deepslate_brick_stairs", + "blockRuntimeId" : 4107 + }, + { + "id" : "minecraft:wooden_door" + }, + { + "id" : "minecraft:spruce_door" + }, + { + "id" : "minecraft:birch_door" + }, + { + "id" : "minecraft:jungle_door" + }, + { + "id" : "minecraft:acacia_door" + }, + { + "id" : "minecraft:dark_oak_door" + }, + { + "id" : "minecraft:iron_door" + }, + { + "id" : "minecraft:crimson_door" + }, + { + "id" : "minecraft:warped_door" + }, + { + "id" : "minecraft:trapdoor", + "blockRuntimeId" : 7363 + }, + { + "id" : "minecraft:spruce_trapdoor", + "blockRuntimeId" : 7066 + }, + { + "id" : "minecraft:birch_trapdoor", + "blockRuntimeId" : 456 + }, + { + "id" : "minecraft:jungle_trapdoor", + "blockRuntimeId" : 5309 + }, + { + "id" : "minecraft:acacia_trapdoor", + "blockRuntimeId" : 100 + }, + { + "id" : "minecraft:dark_oak_trapdoor", + "blockRuntimeId" : 4021 + }, + { + "id" : "minecraft:iron_trapdoor", + "blockRuntimeId" : 5168 + }, + { + "id" : "minecraft:crimson_trapdoor", + "blockRuntimeId" : 3887 + }, + { + "id" : "minecraft:warped_trapdoor", + "blockRuntimeId" : 7645 + }, + { + "id" : "minecraft:iron_bars", + "blockRuntimeId" : 5133 + }, + { + "id" : "minecraft:glass", + "blockRuntimeId" : 4883 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7088 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7096 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7095 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7103 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7100 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7102 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7089 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7092 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7093 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7101 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7097 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7091 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7099 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7098 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7090 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7094 + }, + { + "id" : "minecraft:tinted_glass", + "blockRuntimeId" : 7352 + }, + { + "id" : "minecraft:glass_pane", + "blockRuntimeId" : 4884 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7104 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7112 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7111 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7119 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7116 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7118 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7105 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7108 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7109 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7117 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7113 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7107 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7115 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7114 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7106 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7110 + }, + { + "id" : "minecraft:ladder", + "blockRuntimeId" : 5357 + }, + { + "id" : "minecraft:scaffolding", + "blockRuntimeId" : 6730 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7223 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7273 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7226 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7244 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7903 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7904 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7905 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7906 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7907 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7908 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7228 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7271 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7224 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7274 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7245 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7239 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7275 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7256 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7261 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7262 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7259 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7260 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7258 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7257 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7227 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7230 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7246 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7255 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7229 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7272 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7240 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7241 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7242 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7243 + }, + { + "id" : "minecraft:crimson_slab", + "blockRuntimeId" : 3858 + }, + { + "id" : "minecraft:warped_slab", + "blockRuntimeId" : 7616 + }, + { + "id" : "minecraft:blackstone_slab", + "blockRuntimeId" : 497 + }, + { + "id" : "minecraft:polished_blackstone_slab", + "blockRuntimeId" : 6031 + }, + { + "id" : "minecraft:polished_blackstone_brick_slab", + "blockRuntimeId" : 5828 + }, + { + "id" : "minecraft:cut_copper_slab", + "blockRuntimeId" : 3911 + }, + { + "id" : "minecraft:exposed_cut_copper_slab", + "blockRuntimeId" : 4754 + }, + { + "id" : "minecraft:weathered_cut_copper_slab", + "blockRuntimeId" : 7743 + }, + { + "id" : "minecraft:oxidized_cut_copper_slab", + "blockRuntimeId" : 5756 + }, + { + "id" : "minecraft:waxed_cut_copper_slab", + "blockRuntimeId" : 7687 + }, + { + "id" : "minecraft:waxed_exposed_cut_copper_slab", + "blockRuntimeId" : 7701 + }, + { + "id" : "minecraft:waxed_weathered_cut_copper_slab", + "blockRuntimeId" : 7729 + }, + { + "id" : "minecraft:waxed_oxidized_cut_copper_slab", + "blockRuntimeId" : 7715 + }, + { + "id" : "minecraft:cobbled_deepslate_slab", + "blockRuntimeId" : 1146 + }, + { + "id" : "minecraft:polished_deepslate_slab", + "blockRuntimeId" : 6206 + }, + { + "id" : "minecraft:deepslate_tile_slab", + "blockRuntimeId" : 4288 + }, + { + "id" : "minecraft:deepslate_brick_slab", + "blockRuntimeId" : 4105 + }, + { + "id" : "minecraft:brick_block", + "blockRuntimeId" : 875 + }, + { + "id" : "minecraft:chiseled_nether_bricks", + "blockRuntimeId" : 1130 + }, + { + "id" : "minecraft:cracked_nether_bricks", + "blockRuntimeId" : 3769 + }, + { + "id" : "minecraft:quartz_bricks", + "blockRuntimeId" : 6557 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7289 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7290 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7291 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7292 + }, + { + "id" : "minecraft:end_bricks", + "blockRuntimeId" : 4728 + }, + { + "id" : "minecraft:prismarine", + "blockRuntimeId" : 6440 + }, + { + "id" : "minecraft:polished_blackstone_bricks", + "blockRuntimeId" : 6000 + }, + { + "id" : "minecraft:cracked_polished_blackstone_bricks", + "blockRuntimeId" : 3770 + }, + { + "id" : "minecraft:gilded_blackstone", + "blockRuntimeId" : 4882 + }, + { + "id" : "minecraft:chiseled_polished_blackstone", + "blockRuntimeId" : 1131 + }, + { + "id" : "minecraft:deepslate_tiles", + "blockRuntimeId" : 4460 + }, + { + "id" : "minecraft:cracked_deepslate_tiles", + "blockRuntimeId" : 3768 + }, + { + "id" : "minecraft:deepslate_bricks", + "blockRuntimeId" : 4277 + }, + { + "id" : "minecraft:cracked_deepslate_bricks", + "blockRuntimeId" : 3767 + }, + { + "id" : "minecraft:chiseled_deepslate", + "blockRuntimeId" : 1129 + }, + { + "id" : "minecraft:cobblestone", + "blockRuntimeId" : 1318 + }, + { + "id" : "minecraft:mossy_cobblestone", + "blockRuntimeId" : 5667 + }, + { + "id" : "minecraft:cobbled_deepslate", + "blockRuntimeId" : 1143 + }, + { + "id" : "minecraft:smooth_stone", + "blockRuntimeId" : 6911 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6706 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6707 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6708 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6709 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6633 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6634 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6635 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6636 + }, + { + "id" : "minecraft:coal_block", + "blockRuntimeId" : 1141 + }, + { + "id" : "minecraft:dried_kelp_block", + "blockRuntimeId" : 4584 + }, + { + "id" : "minecraft:gold_block", + "blockRuntimeId" : 4975 + }, + { + "id" : "minecraft:iron_block", + "blockRuntimeId" : 5134 + }, + { + "id" : "minecraft:copper_block", + "blockRuntimeId" : 3677 + }, + { + "id" : "minecraft:exposed_copper", + "blockRuntimeId" : 4752 + }, + { + "id" : "minecraft:weathered_copper", + "blockRuntimeId" : 7741 + }, + { + "id" : "minecraft:oxidized_copper", + "blockRuntimeId" : 5754 + }, + { + "id" : "minecraft:waxed_copper", + "blockRuntimeId" : 7685 + }, + { + "id" : "minecraft:waxed_exposed_copper", + "blockRuntimeId" : 7699 + }, + { + "id" : "minecraft:waxed_weathered_copper", + "blockRuntimeId" : 7727 + }, + { + "id" : "minecraft:waxed_oxidized_copper", + "blockRuntimeId" : 7713 + }, + { + "id" : "minecraft:cut_copper", + "blockRuntimeId" : 3910 + }, + { + "id" : "minecraft:exposed_cut_copper", + "blockRuntimeId" : 4753 + }, + { + "id" : "minecraft:weathered_cut_copper", + "blockRuntimeId" : 7742 + }, + { + "id" : "minecraft:oxidized_cut_copper", + "blockRuntimeId" : 5755 + }, + { + "id" : "minecraft:waxed_cut_copper", + "blockRuntimeId" : 7686 + }, + { + "id" : "minecraft:waxed_exposed_cut_copper", + "blockRuntimeId" : 7700 + }, + { + "id" : "minecraft:waxed_weathered_cut_copper", + "blockRuntimeId" : 7728 + }, + { + "id" : "minecraft:waxed_oxidized_cut_copper", + "blockRuntimeId" : 7714 + }, + { + "id" : "minecraft:emerald_block", + "blockRuntimeId" : 4717 + }, + { + "id" : "minecraft:diamond_block", + "blockRuntimeId" : 4474 + }, + { + "id" : "minecraft:lapis_block", + "blockRuntimeId" : 5365 + }, + { + "id" : "minecraft:raw_iron_block", + "blockRuntimeId" : 6579 + }, + { + "id" : "minecraft:raw_copper_block", + "blockRuntimeId" : 6577 + }, + { + "id" : "minecraft:raw_gold_block", + "blockRuntimeId" : 6578 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6545 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6547 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6546 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6548 + }, + { + "id" : "minecraft:prismarine", + "blockRuntimeId" : 6438 + }, + { + "id" : "minecraft:prismarine", + "blockRuntimeId" : 6439 + }, + { + "id" : "minecraft:slime", + "blockRuntimeId" : 6864 + }, + { + "id" : "minecraft:honey_block", + "blockRuntimeId" : 5112 + }, + { + "id" : "minecraft:honeycomb_block", + "blockRuntimeId" : 5113 + }, + { + "id" : "minecraft:hay_block", + "blockRuntimeId" : 5084 + }, + { + "id" : "minecraft:bone_block", + "blockRuntimeId" : 692 + }, + { + "id" : "minecraft:nether_brick", + "blockRuntimeId" : 5688 + }, + { + "id" : "minecraft:red_nether_brick", + "blockRuntimeId" : 6624 + }, + { + "id" : "minecraft:netherite_block", + "blockRuntimeId" : 5705 + }, + { + "id" : "minecraft:lodestone", + "blockRuntimeId" : 5563 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7915 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7923 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7922 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7930 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7927 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7929 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7916 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7919 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7920 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7928 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7924 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7918 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7926 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7925 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7917 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7921 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 963 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 971 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 970 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 978 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 975 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 977 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 964 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 967 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 968 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 976 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 972 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 966 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 974 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 973 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 965 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 969 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3660 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3668 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3667 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3675 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3672 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3674 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3661 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3664 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3665 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3673 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3669 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3663 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3671 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3670 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3662 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3666 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3644 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3652 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3651 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3659 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3656 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3658 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3645 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3648 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3649 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3657 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3653 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3647 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3655 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3654 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3646 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3650 + }, + { + "id" : "minecraft:clay", + "blockRuntimeId" : 1139 + }, + { + "id" : "minecraft:hardened_clay", + "blockRuntimeId" : 5083 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7120 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7128 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7127 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7135 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7132 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7134 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7121 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7124 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7125 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7133 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7129 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7123 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7131 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7130 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7122 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7126 + }, + { + "id" : "minecraft:white_glazed_terracotta", + "blockRuntimeId" : 7800 + }, + { + "id" : "minecraft:silver_glazed_terracotta", + "blockRuntimeId" : 6846 + }, + { + "id" : "minecraft:gray_glazed_terracotta", + "blockRuntimeId" : 5010 + }, + { + "id" : "minecraft:black_glazed_terracotta", + "blockRuntimeId" : 488 + }, + { + "id" : "minecraft:brown_glazed_terracotta", + "blockRuntimeId" : 894 + }, + { + "id" : "minecraft:red_glazed_terracotta", + "blockRuntimeId" : 6601 + }, + { + "id" : "minecraft:orange_glazed_terracotta", + "blockRuntimeId" : 5748 + }, + { + "id" : "minecraft:yellow_glazed_terracotta", + "blockRuntimeId" : 7942 + }, + { + "id" : "minecraft:lime_glazed_terracotta", + "blockRuntimeId" : 5532 + }, + { + "id" : "minecraft:green_glazed_terracotta", + "blockRuntimeId" : 5026 + }, + { + "id" : "minecraft:cyan_glazed_terracotta", + "blockRuntimeId" : 3931 + }, + { + "id" : "minecraft:light_blue_glazed_terracotta", + "blockRuntimeId" : 5484 + }, + { + "id" : "minecraft:blue_glazed_terracotta", + "blockRuntimeId" : 685 + }, + { + "id" : "minecraft:purple_glazed_terracotta", + "blockRuntimeId" : 6519 + }, + { + "id" : "minecraft:magenta_glazed_terracotta", + "blockRuntimeId" : 5596 + }, + { + "id" : "minecraft:pink_glazed_terracotta", + "blockRuntimeId" : 5779 + }, + { + "id" : "minecraft:purpur_block", + "blockRuntimeId" : 6525 + }, + { + "id" : "minecraft:purpur_block", + "blockRuntimeId" : 6527 + }, + { + "id" : "minecraft:nether_wart_block", + "blockRuntimeId" : 5704 + }, + { + "id" : "minecraft:warped_wart_block", + "blockRuntimeId" : 7667 + }, + { + "id" : "minecraft:shroomlight", + "blockRuntimeId" : 6829 + }, + { + "id" : "minecraft:crimson_nylium", + "blockRuntimeId" : 3839 + }, + { + "id" : "minecraft:warped_nylium", + "blockRuntimeId" : 7597 + }, + { + "id" : "minecraft:basalt", + "blockRuntimeId" : 214 + }, + { + "id" : "minecraft:polished_basalt", + "blockRuntimeId" : 5822 + }, + { + "id" : "minecraft:smooth_basalt", + "blockRuntimeId" : 6886 + }, + { + "id" : "minecraft:soul_soil", + "blockRuntimeId" : 6956 + }, + { + "id" : "minecraft:dirt", + "blockRuntimeId" : 4484 + }, + { + "id" : "minecraft:dirt", + "blockRuntimeId" : 4485 + }, + { + "id" : "minecraft:farmland", + "blockRuntimeId" : 4766 + }, + { + "id" : "minecraft:grass", + "blockRuntimeId" : 4997 + }, + { + "id" : "minecraft:grass_path", + "blockRuntimeId" : 4998 + }, + { + "id" : "minecraft:podzol", + "blockRuntimeId" : 5803 + }, + { + "id" : "minecraft:mycelium", + "blockRuntimeId" : 5685 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7180 + }, + { + "id" : "minecraft:iron_ore", + "blockRuntimeId" : 5167 + }, + { + "id" : "minecraft:gold_ore", + "blockRuntimeId" : 4976 + }, + { + "id" : "minecraft:diamond_ore", + "blockRuntimeId" : 4475 + }, + { + "id" : "minecraft:lapis_ore", + "blockRuntimeId" : 5366 + }, + { + "id" : "minecraft:redstone_ore", + "blockRuntimeId" : 6647 + }, + { + "id" : "minecraft:coal_ore", + "blockRuntimeId" : 1142 + }, + { + "id" : "minecraft:copper_ore", + "blockRuntimeId" : 3678 + }, + { + "id" : "minecraft:emerald_ore", + "blockRuntimeId" : 4718 + }, + { + "id" : "minecraft:quartz_ore", + "blockRuntimeId" : 6558 + }, + { + "id" : "minecraft:nether_gold_ore", + "blockRuntimeId" : 5698 + }, + { + "id" : "minecraft:ancient_debris", + "blockRuntimeId" : 143 + }, + { + "id" : "minecraft:deepslate_iron_ore", + "blockRuntimeId" : 4283 + }, + { + "id" : "minecraft:deepslate_gold_ore", + "blockRuntimeId" : 4282 + }, + { + "id" : "minecraft:deepslate_diamond_ore", + "blockRuntimeId" : 4280 + }, + { + "id" : "minecraft:deepslate_lapis_ore", + "blockRuntimeId" : 4284 + }, + { + "id" : "minecraft:deepslate_redstone_ore", + "blockRuntimeId" : 4285 + }, + { + "id" : "minecraft:deepslate_emerald_ore", + "blockRuntimeId" : 4281 + }, + { + "id" : "minecraft:deepslate_coal_ore", + "blockRuntimeId" : 4278 + }, + { + "id" : "minecraft:deepslate_copper_ore", + "blockRuntimeId" : 4279 + }, + { + "id" : "minecraft:gravel", + "blockRuntimeId" : 4999 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7181 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7183 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7185 + }, + { + "id" : "minecraft:blackstone", + "blockRuntimeId" : 494 + }, + { + "id" : "minecraft:deepslate", + "blockRuntimeId" : 4100 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7182 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7184 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7186 + }, + { + "id" : "minecraft:polished_blackstone", + "blockRuntimeId" : 5825 + }, + { + "id" : "minecraft:polished_deepslate", + "blockRuntimeId" : 6203 + }, + { + "id" : "minecraft:sand", + "blockRuntimeId" : 6704 + }, + { + "id" : "minecraft:sand", + "blockRuntimeId" : 6705 + }, + { + "id" : "minecraft:cactus", + "blockRuntimeId" : 920 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5564 + }, + { + "id" : "minecraft:stripped_oak_log", + "blockRuntimeId" : 7319 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5565 + }, + { + "id" : "minecraft:stripped_spruce_log", + "blockRuntimeId" : 7322 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5566 + }, + { + "id" : "minecraft:stripped_birch_log", + "blockRuntimeId" : 7304 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5567 + }, + { + "id" : "minecraft:stripped_jungle_log", + "blockRuntimeId" : 7316 + }, + { + "id" : "minecraft:log2", + "blockRuntimeId" : 5576 + }, + { + "id" : "minecraft:stripped_acacia_log", + "blockRuntimeId" : 7301 + }, + { + "id" : "minecraft:log2", + "blockRuntimeId" : 5577 + }, + { + "id" : "minecraft:stripped_dark_oak_log", + "blockRuntimeId" : 7313 + }, + { + "id" : "minecraft:crimson_stem", + "blockRuntimeId" : 3884 + }, + { + "id" : "minecraft:stripped_crimson_stem", + "blockRuntimeId" : 7310 + }, + { + "id" : "minecraft:warped_stem", + "blockRuntimeId" : 7642 + }, + { + "id" : "minecraft:stripped_warped_stem", + "blockRuntimeId" : 7328 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7807 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7813 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7808 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7814 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7809 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7815 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7810 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7816 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7811 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7817 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7812 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7818 + }, + { + "id" : "minecraft:crimson_hyphae", + "blockRuntimeId" : 3836 + }, + { + "id" : "minecraft:stripped_crimson_hyphae", + "blockRuntimeId" : 7307 + }, + { + "id" : "minecraft:warped_hyphae", + "blockRuntimeId" : 7594 + }, + { + "id" : "minecraft:stripped_warped_hyphae", + "blockRuntimeId" : 7325 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5410 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5411 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5412 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5413 + }, + { + "id" : "minecraft:leaves2", + "blockRuntimeId" : 5426 + }, + { + "id" : "minecraft:leaves2", + "blockRuntimeId" : 5427 + }, + { + "id" : "minecraft:azalea_leaves", + "blockRuntimeId" : 169 + }, + { + "id" : "minecraft:azalea_leaves_flowered", + "blockRuntimeId" : 173 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6718 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6719 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6720 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6721 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6722 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6723 + }, + { + "id" : "minecraft:bee_nest", + "blockRuntimeId" : 236 + }, + { + "id" : "minecraft:wheat_seeds" + }, + { + "id" : "minecraft:pumpkin_seeds" + }, + { + "id" : "minecraft:melon_seeds" + }, + { + "id" : "minecraft:beetroot_seeds" + }, + { + "id" : "minecraft:wheat" + }, + { + "id" : "minecraft:beetroot" + }, + { + "id" : "minecraft:potato" + }, + { + "id" : "minecraft:poisonous_potato" + }, + { + "id" : "minecraft:carrot" + }, + { + "id" : "minecraft:golden_carrot" + }, + { + "id" : "minecraft:apple" + }, + { + "id" : "minecraft:golden_apple" + }, + { + "id" : "minecraft:enchanted_golden_apple" + }, + { + "id" : "minecraft:melon_block", + "blockRuntimeId" : 5609 + }, + { + "id" : "minecraft:melon_slice" + }, + { + "id" : "minecraft:glistering_melon_slice" + }, + { + "id" : "minecraft:sweet_berries" + }, + { + "id" : "minecraft:glow_berries" + }, + { + "id" : "minecraft:pumpkin", + "blockRuntimeId" : 6457 + }, + { + "id" : "minecraft:carved_pumpkin", + "blockRuntimeId" : 988 + }, + { + "id" : "minecraft:lit_pumpkin", + "blockRuntimeId" : 5551 + }, + { + "id" : "minecraft:honeycomb" + }, + { + "id" : "minecraft:tallgrass", + "blockRuntimeId" : 7349 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4504 + }, + { + "id" : "minecraft:tallgrass", + "blockRuntimeId" : 7348 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4503 + }, + { + "id" : "minecraft:nether_sprouts" + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3682 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3680 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3681 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3679 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3683 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3687 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3685 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3686 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3684 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3688 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3702 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3700 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3701 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3699 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3703 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3712 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3710 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3711 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3709 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3713 + }, + { + "id" : "minecraft:kelp" + }, + { + "id" : "minecraft:seagrass", + "blockRuntimeId" : 6825 + }, + { + "id" : "minecraft:crimson_roots", + "blockRuntimeId" : 3857 + }, + { + "id" : "minecraft:warped_roots", + "blockRuntimeId" : 7615 + }, + { + "id" : "minecraft:yellow_flower", + "blockRuntimeId" : 7941 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6590 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6591 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6592 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6593 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6594 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6595 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6596 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6597 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6598 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6599 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6600 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4501 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4502 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4505 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4506 + }, + { + "id" : "minecraft:wither_rose", + "blockRuntimeId" : 7806 + }, + { + "id" : "minecraft:white_dye" + }, + { + "id" : "minecraft:light_gray_dye" + }, + { + "id" : "minecraft:gray_dye" + }, + { + "id" : "minecraft:black_dye" + }, + { + "id" : "minecraft:brown_dye" + }, + { + "id" : "minecraft:red_dye" + }, + { + "id" : "minecraft:orange_dye" + }, + { + "id" : "minecraft:yellow_dye" + }, + { + "id" : "minecraft:lime_dye" + }, + { + "id" : "minecraft:green_dye" + }, + { + "id" : "minecraft:cyan_dye" + }, + { + "id" : "minecraft:light_blue_dye" + }, + { + "id" : "minecraft:blue_dye" + }, + { + "id" : "minecraft:purple_dye" + }, + { + "id" : "minecraft:magenta_dye" + }, + { + "id" : "minecraft:pink_dye" + }, + { + "id" : "minecraft:ink_sac" + }, + { + "id" : "minecraft:glow_ink_sac" + }, + { + "id" : "minecraft:cocoa_beans" + }, + { + "id" : "minecraft:lapis_lazuli" + }, + { + "id" : "minecraft:bone_meal" + }, + { + "id" : "minecraft:vine", + "blockRuntimeId" : 7502 + }, + { + "id" : "minecraft:weeping_vines", + "blockRuntimeId" : 7756 + }, + { + "id" : "minecraft:twisting_vines", + "blockRuntimeId" : 7430 + }, + { + "id" : "minecraft:waterlily", + "blockRuntimeId" : 7684 + }, + { + "id" : "minecraft:deadbush", + "blockRuntimeId" : 4099 + }, + { + "id" : "minecraft:bamboo", + "blockRuntimeId" : 177 + }, + { + "id" : "minecraft:snow", + "blockRuntimeId" : 6912 + }, + { + "id" : "minecraft:ice", + "blockRuntimeId" : 5126 + }, + { + "id" : "minecraft:packed_ice", + "blockRuntimeId" : 5768 + }, + { + "id" : "minecraft:blue_ice", + "blockRuntimeId" : 691 + }, + { + "id" : "minecraft:snow_layer", + "blockRuntimeId" : 6913 + }, + { + "id" : "minecraft:pointed_dripstone", + "blockRuntimeId" : 5809 + }, + { + "id" : "minecraft:dripstone_block", + "blockRuntimeId" : 4585 + }, + { + "id" : "minecraft:moss_carpet", + "blockRuntimeId" : 5666 + }, + { + "id" : "minecraft:moss_block", + "blockRuntimeId" : 5665 + }, + { + "id" : "minecraft:dirt_with_roots", + "blockRuntimeId" : 4486 + }, + { + "id" : "minecraft:hanging_roots", + "blockRuntimeId" : 5048 + }, + { + "id" : "minecraft:big_dripleaf", + "blockRuntimeId" : 328 + }, + { + "id" : "minecraft:small_dripleaf_block", + "blockRuntimeId" : 6878 + }, + { + "id" : "minecraft:spore_blossom", + "blockRuntimeId" : 6965 + }, + { + "id" : "minecraft:azalea", + "blockRuntimeId" : 168 + }, + { + "id" : "minecraft:flowering_azalea", + "blockRuntimeId" : 4815 + }, + { + "id" : "minecraft:glow_lichen", + "blockRuntimeId" : 4972 + }, + { + "id" : "minecraft:amethyst_block", + "blockRuntimeId" : 136 + }, + { + "id" : "minecraft:budding_amethyst", + "blockRuntimeId" : 919 + }, + { + "id" : "minecraft:amethyst_cluster", + "blockRuntimeId" : 137 + }, + { + "id" : "minecraft:large_amethyst_bud", + "blockRuntimeId" : 5367 + }, + { + "id" : "minecraft:medium_amethyst_bud", + "blockRuntimeId" : 5603 + }, + { + "id" : "minecraft:small_amethyst_bud", + "blockRuntimeId" : 6865 + }, + { + "id" : "minecraft:tuff", + "blockRuntimeId" : 7417 + }, + { + "id" : "minecraft:calcite", + "blockRuntimeId" : 943 + }, + { + "id" : "minecraft:chicken" + }, + { + "id" : "minecraft:porkchop" + }, + { + "id" : "minecraft:beef" + }, + { + "id" : "minecraft:mutton" + }, + { + "id" : "minecraft:rabbit" + }, + { + "id" : "minecraft:cod" + }, + { + "id" : "minecraft:salmon" + }, + { + "id" : "minecraft:tropical_fish" + }, + { + "id" : "minecraft:pufferfish" + }, + { + "id" : "minecraft:brown_mushroom", + "blockRuntimeId" : 900 + }, + { + "id" : "minecraft:red_mushroom", + "blockRuntimeId" : 6607 + }, + { + "id" : "minecraft:crimson_fungus", + "blockRuntimeId" : 3835 + }, + { + "id" : "minecraft:warped_fungus", + "blockRuntimeId" : 7593 + }, + { + "id" : "minecraft:brown_mushroom_block", + "blockRuntimeId" : 915 + }, + { + "id" : "minecraft:red_mushroom_block", + "blockRuntimeId" : 6622 + }, + { + "id" : "minecraft:brown_mushroom_block", + "blockRuntimeId" : 916 + }, + { + "id" : "minecraft:brown_mushroom_block", + "blockRuntimeId" : 901 + }, + { + "id" : "minecraft:egg" + }, + { + "id" : "minecraft:sugar_cane" + }, + { + "id" : "minecraft:sugar" + }, + { + "id" : "minecraft:rotten_flesh" + }, + { + "id" : "minecraft:bone" + }, + { + "id" : "minecraft:web", + "blockRuntimeId" : 7755 + }, + { + "id" : "minecraft:spider_eye" + }, + { + "id" : "minecraft:mob_spawner", + "blockRuntimeId" : 5658 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5659 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5660 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5661 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5662 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5663 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5664 + }, + { + "id" : "minecraft:infested_deepslate", + "blockRuntimeId" : 5127 + }, + { + "id" : "minecraft:dragon_egg", + "blockRuntimeId" : 4583 + }, + { + "id" : "minecraft:turtle_egg", + "blockRuntimeId" : 7418 + }, + { + "id" : "minecraft:chicken_spawn_egg" + }, + { + "id" : "minecraft:bee_spawn_egg" + }, + { + "id" : "minecraft:cow_spawn_egg" + }, + { + "id" : "minecraft:pig_spawn_egg" + }, + { + "id" : "minecraft:sheep_spawn_egg" + }, + { + "id" : "minecraft:wolf_spawn_egg" + }, + { + "id" : "minecraft:polar_bear_spawn_egg" + }, + { + "id" : "minecraft:ocelot_spawn_egg" + }, + { + "id" : "minecraft:cat_spawn_egg" + }, + { + "id" : "minecraft:mooshroom_spawn_egg" + }, + { + "id" : "minecraft:bat_spawn_egg" + }, + { + "id" : "minecraft:parrot_spawn_egg" + }, + { + "id" : "minecraft:rabbit_spawn_egg" + }, + { + "id" : "minecraft:llama_spawn_egg" + }, + { + "id" : "minecraft:horse_spawn_egg" + }, + { + "id" : "minecraft:donkey_spawn_egg" + }, + { + "id" : "minecraft:mule_spawn_egg" + }, + { + "id" : "minecraft:skeleton_horse_spawn_egg" + }, + { + "id" : "minecraft:zombie_horse_spawn_egg" + }, + { + "id" : "minecraft:tropical_fish_spawn_egg" + }, + { + "id" : "minecraft:cod_spawn_egg" + }, + { + "id" : "minecraft:pufferfish_spawn_egg" + }, + { + "id" : "minecraft:salmon_spawn_egg" + }, + { + "id" : "minecraft:dolphin_spawn_egg" + }, + { + "id" : "minecraft:turtle_spawn_egg" + }, + { + "id" : "minecraft:panda_spawn_egg" + }, + { + "id" : "minecraft:fox_spawn_egg" + }, + { + "id" : "minecraft:creeper_spawn_egg" + }, + { + "id" : "minecraft:enderman_spawn_egg" + }, + { + "id" : "minecraft:silverfish_spawn_egg" + }, + { + "id" : "minecraft:skeleton_spawn_egg" + }, + { + "id" : "minecraft:wither_skeleton_spawn_egg" + }, + { + "id" : "minecraft:stray_spawn_egg" + }, + { + "id" : "minecraft:slime_spawn_egg" + }, + { + "id" : "minecraft:spider_spawn_egg" + }, + { + "id" : "minecraft:zombie_spawn_egg" + }, + { + "id" : "minecraft:zombie_pigman_spawn_egg" + }, + { + "id" : "minecraft:husk_spawn_egg" + }, + { + "id" : "minecraft:drowned_spawn_egg" + }, + { + "id" : "minecraft:squid_spawn_egg" + }, + { + "id" : "minecraft:glow_squid_spawn_egg" + }, + { + "id" : "minecraft:cave_spider_spawn_egg" + }, + { + "id" : "minecraft:witch_spawn_egg" + }, + { + "id" : "minecraft:guardian_spawn_egg" + }, + { + "id" : "minecraft:elder_guardian_spawn_egg" + }, + { + "id" : "minecraft:endermite_spawn_egg" + }, + { + "id" : "minecraft:magma_cube_spawn_egg" + }, + { + "id" : "minecraft:strider_spawn_egg" + }, + { + "id" : "minecraft:hoglin_spawn_egg" + }, + { + "id" : "minecraft:piglin_spawn_egg" + }, + { + "id" : "minecraft:zoglin_spawn_egg" + }, + { + "id" : "minecraft:piglin_brute_spawn_egg" + }, + { + "id" : "minecraft:goat_spawn_egg" + }, + { + "id" : "minecraft:axolotl_spawn_egg" + }, + { + "id" : "minecraft:ghast_spawn_egg" + }, + { + "id" : "minecraft:blaze_spawn_egg" + }, + { + "id" : "minecraft:shulker_spawn_egg" + }, + { + "id" : "minecraft:vindicator_spawn_egg" + }, + { + "id" : "minecraft:evoker_spawn_egg" + }, + { + "id" : "minecraft:vex_spawn_egg" + }, + { + "id" : "minecraft:villager_spawn_egg" + }, + { + "id" : "minecraft:wandering_trader_spawn_egg" + }, + { + "id" : "minecraft:zombie_villager_spawn_egg" + }, + { + "id" : "minecraft:phantom_spawn_egg" + }, + { + "id" : "minecraft:pillager_spawn_egg" + }, + { + "id" : "minecraft:ravager_spawn_egg" + }, + { + "id" : "minecraft:obsidian", + "blockRuntimeId" : 5737 + }, + { + "id" : "minecraft:crying_obsidian", + "blockRuntimeId" : 3909 + }, + { + "id" : "minecraft:bedrock", + "blockRuntimeId" : 234 + }, + { + "id" : "minecraft:soul_sand", + "blockRuntimeId" : 6955 + }, + { + "id" : "minecraft:netherrack", + "blockRuntimeId" : 5706 + }, + { + "id" : "minecraft:magma", + "blockRuntimeId" : 5602 + }, + { + "id" : "minecraft:nether_wart" + }, + { + "id" : "minecraft:end_stone", + "blockRuntimeId" : 4745 + }, + { + "id" : "minecraft:chorus_flower", + "blockRuntimeId" : 1132 + }, + { + "id" : "minecraft:chorus_plant", + "blockRuntimeId" : 1138 + }, + { + "id" : "minecraft:chorus_fruit" + }, + { + "id" : "minecraft:popped_chorus_fruit" + }, + { + "id" : "minecraft:sponge", + "blockRuntimeId" : 6963 + }, + { + "id" : "minecraft:sponge", + "blockRuntimeId" : 6964 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3689 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3690 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3691 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3692 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3693 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3694 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3695 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3696 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3697 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3698 + }, + { + "id" : "minecraft:leather_helmet" + }, + { + "id" : "minecraft:chainmail_helmet" + }, + { + "id" : "minecraft:iron_helmet" + }, + { + "id" : "minecraft:golden_helmet" + }, + { + "id" : "minecraft:diamond_helmet" + }, + { + "id" : "minecraft:netherite_helmet" + }, + { + "id" : "minecraft:leather_chestplate" + }, + { + "id" : "minecraft:chainmail_chestplate" + }, + { + "id" : "minecraft:iron_chestplate" + }, + { + "id" : "minecraft:golden_chestplate" + }, + { + "id" : "minecraft:diamond_chestplate" + }, + { + "id" : "minecraft:netherite_chestplate" + }, + { + "id" : "minecraft:leather_leggings" + }, + { + "id" : "minecraft:chainmail_leggings" + }, + { + "id" : "minecraft:iron_leggings" + }, + { + "id" : "minecraft:golden_leggings" + }, + { + "id" : "minecraft:diamond_leggings" + }, + { + "id" : "minecraft:netherite_leggings" + }, + { + "id" : "minecraft:leather_boots" + }, + { + "id" : "minecraft:chainmail_boots" + }, + { + "id" : "minecraft:iron_boots" + }, + { + "id" : "minecraft:golden_boots" + }, + { + "id" : "minecraft:diamond_boots" + }, + { + "id" : "minecraft:netherite_boots" + }, + { + "id" : "minecraft:wooden_sword" + }, + { + "id" : "minecraft:stone_sword" + }, + { + "id" : "minecraft:iron_sword" + }, + { + "id" : "minecraft:golden_sword" + }, + { + "id" : "minecraft:diamond_sword" + }, + { + "id" : "minecraft:netherite_sword" + }, + { + "id" : "minecraft:wooden_axe" + }, + { + "id" : "minecraft:stone_axe" + }, + { + "id" : "minecraft:iron_axe" + }, + { + "id" : "minecraft:golden_axe" + }, + { + "id" : "minecraft:diamond_axe" + }, + { + "id" : "minecraft:netherite_axe" + }, + { + "id" : "minecraft:wooden_pickaxe" + }, + { + "id" : "minecraft:stone_pickaxe" + }, + { + "id" : "minecraft:iron_pickaxe" + }, + { + "id" : "minecraft:golden_pickaxe" + }, + { + "id" : "minecraft:diamond_pickaxe" + }, + { + "id" : "minecraft:netherite_pickaxe" + }, + { + "id" : "minecraft:wooden_shovel" + }, + { + "id" : "minecraft:stone_shovel" + }, + { + "id" : "minecraft:iron_shovel" + }, + { + "id" : "minecraft:golden_shovel" + }, + { + "id" : "minecraft:diamond_shovel" + }, + { + "id" : "minecraft:netherite_shovel" + }, + { + "id" : "minecraft:wooden_hoe" + }, + { + "id" : "minecraft:stone_hoe" + }, + { + "id" : "minecraft:iron_hoe" + }, + { + "id" : "minecraft:golden_hoe" + }, + { + "id" : "minecraft:diamond_hoe" + }, + { + "id" : "minecraft:netherite_hoe" + }, + { + "id" : "minecraft:bow" + }, + { + "id" : "minecraft:crossbow" + }, + { + "id" : "minecraft:arrow" + }, + { + "id" : "minecraft:arrow", + "damage" : 6 + }, + { + "id" : "minecraft:arrow", + "damage" : 7 + }, + { + "id" : "minecraft:arrow", + "damage" : 8 + }, + { + "id" : "minecraft:arrow", + "damage" : 9 + }, + { + "id" : "minecraft:arrow", + "damage" : 10 + }, + { + "id" : "minecraft:arrow", + "damage" : 11 + }, + { + "id" : "minecraft:arrow", + "damage" : 12 + }, + { + "id" : "minecraft:arrow", + "damage" : 13 + }, + { + "id" : "minecraft:arrow", + "damage" : 14 + }, + { + "id" : "minecraft:arrow", + "damage" : 15 + }, + { + "id" : "minecraft:arrow", + "damage" : 16 + }, + { + "id" : "minecraft:arrow", + "damage" : 17 + }, + { + "id" : "minecraft:arrow", + "damage" : 18 + }, + { + "id" : "minecraft:arrow", + "damage" : 19 + }, + { + "id" : "minecraft:arrow", + "damage" : 20 + }, + { + "id" : "minecraft:arrow", + "damage" : 21 + }, + { + "id" : "minecraft:arrow", + "damage" : 22 + }, + { + "id" : "minecraft:arrow", + "damage" : 23 + }, + { + "id" : "minecraft:arrow", + "damage" : 24 + }, + { + "id" : "minecraft:arrow", + "damage" : 25 + }, + { + "id" : "minecraft:arrow", + "damage" : 26 + }, + { + "id" : "minecraft:arrow", + "damage" : 27 + }, + { + "id" : "minecraft:arrow", + "damage" : 28 + }, + { + "id" : "minecraft:arrow", + "damage" : 29 + }, + { + "id" : "minecraft:arrow", + "damage" : 30 + }, + { + "id" : "minecraft:arrow", + "damage" : 31 + }, + { + "id" : "minecraft:arrow", + "damage" : 32 + }, + { + "id" : "minecraft:arrow", + "damage" : 33 + }, + { + "id" : "minecraft:arrow", + "damage" : 34 + }, + { + "id" : "minecraft:arrow", + "damage" : 35 + }, + { + "id" : "minecraft:arrow", + "damage" : 36 + }, + { + "id" : "minecraft:arrow", + "damage" : 37 + }, + { + "id" : "minecraft:arrow", + "damage" : 38 + }, + { + "id" : "minecraft:arrow", + "damage" : 39 + }, + { + "id" : "minecraft:arrow", + "damage" : 40 + }, + { + "id" : "minecraft:arrow", + "damage" : 41 + }, + { + "id" : "minecraft:arrow", + "damage" : 42 + }, + { + "id" : "minecraft:arrow", + "damage" : 43 + }, + { + "id" : "minecraft:shield" + }, + { + "id" : "minecraft:cooked_chicken" + }, + { + "id" : "minecraft:cooked_porkchop" + }, + { + "id" : "minecraft:cooked_beef" + }, + { + "id" : "minecraft:cooked_mutton" + }, + { + "id" : "minecraft:cooked_rabbit" + }, + { + "id" : "minecraft:cooked_cod" + }, + { + "id" : "minecraft:cooked_salmon" + }, + { + "id" : "minecraft:bread" + }, + { + "id" : "minecraft:mushroom_stew" + }, + { + "id" : "minecraft:beetroot_soup" + }, + { + "id" : "minecraft:rabbit_stew" + }, + { + "id" : "minecraft:baked_potato" + }, + { + "id" : "minecraft:cookie" + }, + { + "id" : "minecraft:pumpkin_pie" + }, + { + "id" : "minecraft:cake" + }, + { + "id" : "minecraft:dried_kelp" + }, + { + "id" : "minecraft:fishing_rod" + }, + { + "id" : "minecraft:carrot_on_a_stick" + }, + { + "id" : "minecraft:warped_fungus_on_a_stick" + }, + { + "id" : "minecraft:snowball" + }, + { + "id" : "minecraft:shears" + }, + { + "id" : "minecraft:flint_and_steel" + }, + { + "id" : "minecraft:lead" + }, + { + "id" : "minecraft:clock" + }, + { + "id" : "minecraft:compass" + }, + { + "id" : "minecraft:empty_map" + }, + { + "id" : "minecraft:empty_map", + "damage" : 2 + }, + { + "id" : "minecraft:saddle" + }, + { + "id" : "minecraft:leather_horse_armor" + }, + { + "id" : "minecraft:iron_horse_armor" + }, + { + "id" : "minecraft:golden_horse_armor" + }, + { + "id" : "minecraft:diamond_horse_armor" + }, + { + "id" : "minecraft:trident" + }, + { + "id" : "minecraft:turtle_helmet" + }, + { + "id" : "minecraft:elytra" + }, + { + "id" : "minecraft:totem_of_undying" + }, + { + "id" : "minecraft:glass_bottle" + }, + { + "id" : "minecraft:experience_bottle" + }, + { + "id" : "minecraft:potion" + }, + { + "id" : "minecraft:potion", + "damage" : 1 + }, + { + "id" : "minecraft:potion", + "damage" : 2 + }, + { + "id" : "minecraft:potion", + "damage" : 3 + }, + { + "id" : "minecraft:potion", + "damage" : 4 + }, + { + "id" : "minecraft:potion", + "damage" : 5 + }, + { + "id" : "minecraft:potion", + "damage" : 6 + }, + { + "id" : "minecraft:potion", + "damage" : 7 + }, + { + "id" : "minecraft:potion", + "damage" : 8 + }, + { + "id" : "minecraft:potion", + "damage" : 9 + }, + { + "id" : "minecraft:potion", + "damage" : 10 + }, + { + "id" : "minecraft:potion", + "damage" : 11 + }, + { + "id" : "minecraft:potion", + "damage" : 12 + }, + { + "id" : "minecraft:potion", + "damage" : 13 + }, + { + "id" : "minecraft:potion", + "damage" : 14 + }, + { + "id" : "minecraft:potion", + "damage" : 15 + }, + { + "id" : "minecraft:potion", + "damage" : 16 + }, + { + "id" : "minecraft:potion", + "damage" : 17 + }, + { + "id" : "minecraft:potion", + "damage" : 18 + }, + { + "id" : "minecraft:potion", + "damage" : 19 + }, + { + "id" : "minecraft:potion", + "damage" : 20 + }, + { + "id" : "minecraft:potion", + "damage" : 21 + }, + { + "id" : "minecraft:potion", + "damage" : 22 + }, + { + "id" : "minecraft:potion", + "damage" : 23 + }, + { + "id" : "minecraft:potion", + "damage" : 24 + }, + { + "id" : "minecraft:potion", + "damage" : 25 + }, + { + "id" : "minecraft:potion", + "damage" : 26 + }, + { + "id" : "minecraft:potion", + "damage" : 27 + }, + { + "id" : "minecraft:potion", + "damage" : 28 + }, + { + "id" : "minecraft:potion", + "damage" : 29 + }, + { + "id" : "minecraft:potion", + "damage" : 30 + }, + { + "id" : "minecraft:potion", + "damage" : 31 + }, + { + "id" : "minecraft:potion", + "damage" : 32 + }, + { + "id" : "minecraft:potion", + "damage" : 33 + }, + { + "id" : "minecraft:potion", + "damage" : 34 + }, + { + "id" : "minecraft:potion", + "damage" : 35 + }, + { + "id" : "minecraft:potion", + "damage" : 36 + }, + { + "id" : "minecraft:potion", + "damage" : 37 + }, + { + "id" : "minecraft:potion", + "damage" : 38 + }, + { + "id" : "minecraft:potion", + "damage" : 39 + }, + { + "id" : "minecraft:potion", + "damage" : 40 + }, + { + "id" : "minecraft:potion", + "damage" : 41 + }, + { + "id" : "minecraft:potion", + "damage" : 42 + }, + { + "id" : "minecraft:splash_potion" + }, + { + "id" : "minecraft:splash_potion", + "damage" : 1 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 2 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 3 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 4 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 5 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 6 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 7 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 8 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 9 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 10 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 11 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 12 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 13 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 14 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 15 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 16 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 17 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 18 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 19 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 20 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 21 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 22 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 23 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 24 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 25 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 26 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 27 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 28 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 29 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 30 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 31 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 32 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 33 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 34 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 35 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 36 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 37 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 38 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 39 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 40 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 41 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 42 + }, + { + "id" : "minecraft:lingering_potion" + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 1 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 2 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 3 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 4 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 5 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 6 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 7 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 8 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 9 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 10 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 11 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 12 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 13 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 14 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 15 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 16 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 17 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 18 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 19 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 20 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 21 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 22 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 23 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 24 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 25 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 26 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 27 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 28 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 29 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 30 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 31 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 32 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 33 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 34 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 35 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 36 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 37 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 38 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 39 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 40 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 41 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 42 + }, + { + "id" : "minecraft:spyglass" + }, + { + "id" : "minecraft:stick" + }, + { + "id" : "minecraft:bed" + }, + { + "id" : "minecraft:bed", + "damage" : 8 + }, + { + "id" : "minecraft:bed", + "damage" : 7 + }, + { + "id" : "minecraft:bed", + "damage" : 15 + }, + { + "id" : "minecraft:bed", + "damage" : 12 + }, + { + "id" : "minecraft:bed", + "damage" : 14 + }, + { + "id" : "minecraft:bed", + "damage" : 1 + }, + { + "id" : "minecraft:bed", + "damage" : 4 + }, + { + "id" : "minecraft:bed", + "damage" : 5 + }, + { + "id" : "minecraft:bed", + "damage" : 13 + }, + { + "id" : "minecraft:bed", + "damage" : 9 + }, + { + "id" : "minecraft:bed", + "damage" : 3 + }, + { + "id" : "minecraft:bed", + "damage" : 11 + }, + { + "id" : "minecraft:bed", + "damage" : 10 + }, + { + "id" : "minecraft:bed", + "damage" : 2 + }, + { + "id" : "minecraft:bed", + "damage" : 6 + }, + { + "id" : "minecraft:torch", + "blockRuntimeId" : 7357 + }, + { + "id" : "minecraft:soul_torch", + "blockRuntimeId" : 6957 + }, + { + "id" : "minecraft:sea_pickle", + "blockRuntimeId" : 6817 + }, + { + "id" : "minecraft:lantern", + "blockRuntimeId" : 5363 + }, + { + "id" : "minecraft:soul_lantern", + "blockRuntimeId" : 6953 + }, + { + "id" : "minecraft:candle", + "blockRuntimeId" : 953 + }, + { + "id" : "minecraft:white_candle", + "blockRuntimeId" : 7790 + }, + { + "id" : "minecraft:orange_candle", + "blockRuntimeId" : 5738 + }, + { + "id" : "minecraft:magenta_candle", + "blockRuntimeId" : 5586 + }, + { + "id" : "minecraft:light_blue_candle", + "blockRuntimeId" : 5474 + }, + { + "id" : "minecraft:yellow_candle", + "blockRuntimeId" : 7931 + }, + { + "id" : "minecraft:lime_candle", + "blockRuntimeId" : 5522 + }, + { + "id" : "minecraft:pink_candle", + "blockRuntimeId" : 5769 + }, + { + "id" : "minecraft:gray_candle", + "blockRuntimeId" : 5000 + }, + { + "id" : "minecraft:light_gray_candle", + "blockRuntimeId" : 5490 + }, + { + "id" : "minecraft:cyan_candle", + "blockRuntimeId" : 3921 + }, + { + "id" : "minecraft:purple_candle", + "blockRuntimeId" : 6509 + }, + { + "id" : "minecraft:blue_candle", + "blockRuntimeId" : 675 + }, + { + "id" : "minecraft:brown_candle", + "blockRuntimeId" : 884 + }, + { + "id" : "minecraft:green_candle", + "blockRuntimeId" : 5016 + }, + { + "id" : "minecraft:red_candle", + "blockRuntimeId" : 6580 + }, + { + "id" : "minecraft:black_candle", + "blockRuntimeId" : 478 + }, + { + "id" : "minecraft:crafting_table", + "blockRuntimeId" : 3771 + }, + { + "id" : "minecraft:cartography_table", + "blockRuntimeId" : 987 + }, + { + "id" : "minecraft:fletching_table", + "blockRuntimeId" : 4812 + }, + { + "id" : "minecraft:smithing_table", + "blockRuntimeId" : 6879 + }, + { + "id" : "minecraft:beehive", + "blockRuntimeId" : 260 + }, + { + "id" : "minecraft:campfire" + }, + { + "id" : "minecraft:soul_campfire" + }, + { + "id" : "minecraft:furnace", + "blockRuntimeId" : 4876 + }, + { + "id" : "minecraft:blast_furnace", + "blockRuntimeId" : 669 + }, + { + "id" : "minecraft:smoker", + "blockRuntimeId" : 6880 + }, + { + "id" : "minecraft:respawn_anchor", + "blockRuntimeId" : 6699 + }, + { + "id" : "minecraft:brewing_stand" + }, + { + "id" : "minecraft:anvil", + "blockRuntimeId" : 152 + }, + { + "id" : "minecraft:anvil", + "blockRuntimeId" : 156 + }, + { + "id" : "minecraft:anvil", + "blockRuntimeId" : 160 + }, + { + "id" : "minecraft:grindstone", + "blockRuntimeId" : 5032 + }, + { + "id" : "minecraft:enchanting_table", + "blockRuntimeId" : 4719 + }, + { + "id" : "minecraft:bookshelf", + "blockRuntimeId" : 704 + }, + { + "id" : "minecraft:lectern", + "blockRuntimeId" : 5434 + }, + { + "id" : "minecraft:cauldron" + }, + { + "id" : "minecraft:composter", + "blockRuntimeId" : 3635 + }, + { + "id" : "minecraft:chest", + "blockRuntimeId" : 1123 + }, + { + "id" : "minecraft:trapped_chest", + "blockRuntimeId" : 7379 + }, + { + "id" : "minecraft:ender_chest", + "blockRuntimeId" : 4746 + }, + { + "id" : "minecraft:barrel", + "blockRuntimeId" : 201 + }, + { + "id" : "minecraft:undyed_shulker_box", + "blockRuntimeId" : 7462 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6830 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6838 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6837 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6845 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6842 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6844 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6831 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6834 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6835 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6843 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6839 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6833 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6841 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6840 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6832 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6836 + }, + { + "id" : "minecraft:armor_stand" + }, + { + "id" : "minecraft:noteblock", + "blockRuntimeId" : 5716 + }, + { + "id" : "minecraft:jukebox", + "blockRuntimeId" : 5208 + }, + { + "id" : "minecraft:music_disc_13" + }, + { + "id" : "minecraft:music_disc_cat" + }, + { + "id" : "minecraft:music_disc_blocks" + }, + { + "id" : "minecraft:music_disc_chirp" + }, + { + "id" : "minecraft:music_disc_far" + }, + { + "id" : "minecraft:music_disc_mall" + }, + { + "id" : "minecraft:music_disc_mellohi" + }, + { + "id" : "minecraft:music_disc_stal" + }, + { + "id" : "minecraft:music_disc_strad" + }, + { + "id" : "minecraft:music_disc_ward" + }, + { + "id" : "minecraft:music_disc_11" + }, + { + "id" : "minecraft:music_disc_wait" + }, + { + "id" : "minecraft:music_disc_pigstep" + }, + { + "id" : "minecraft:glowstone_dust" + }, + { + "id" : "minecraft:glowstone", + "blockRuntimeId" : 4974 + }, + { + "id" : "minecraft:redstone_lamp", + "blockRuntimeId" : 6646 + }, + { + "id" : "minecraft:sealantern", + "blockRuntimeId" : 6828 + }, + { + "id" : "minecraft:oak_sign" + }, + { + "id" : "minecraft:spruce_sign" + }, + { + "id" : "minecraft:birch_sign" + }, + { + "id" : "minecraft:jungle_sign" + }, + { + "id" : "minecraft:acacia_sign" + }, + { + "id" : "minecraft:dark_oak_sign" + }, + { + "id" : "minecraft:crimson_sign" + }, + { + "id" : "minecraft:warped_sign" + }, + { + "id" : "minecraft:painting" + }, + { + "id" : "minecraft:frame" + }, + { + "id" : "minecraft:glow_frame" + }, + { + "id" : "minecraft:honey_bottle" + }, + { + "id" : "minecraft:flower_pot" + }, + { + "id" : "minecraft:bowl" + }, + { + "id" : "minecraft:bucket" + }, + { + "id" : "minecraft:milk_bucket" + }, + { + "id" : "minecraft:water_bucket" + }, + { + "id" : "minecraft:lava_bucket" + }, + { + "id" : "minecraft:cod_bucket" + }, + { + "id" : "minecraft:salmon_bucket" + }, + { + "id" : "minecraft:tropical_fish_bucket" + }, + { + "id" : "minecraft:pufferfish_bucket" + }, + { + "id" : "minecraft:powder_snow_bucket" + }, + { + "id" : "minecraft:axolotl_bucket" + }, + { + "id" : "minecraft:skull", + "damage" : 3 + }, + { + "id" : "minecraft:skull", + "damage" : 2 + }, + { + "id" : "minecraft:skull", + "damage" : 4 + }, + { + "id" : "minecraft:skull", + "damage" : 5 + }, + { + "id" : "minecraft:skull" + }, + { + "id" : "minecraft:skull", + "damage" : 1 + }, + { + "id" : "minecraft:beacon", + "blockRuntimeId" : 217 + }, + { + "id" : "minecraft:bell", + "blockRuntimeId" : 292 + }, + { + "id" : "minecraft:conduit", + "blockRuntimeId" : 3676 + }, + { + "id" : "minecraft:stonecutter_block", + "blockRuntimeId" : 7295 + }, + { + "id" : "minecraft:end_portal_frame", + "blockRuntimeId" : 4731 + }, + { + "id" : "minecraft:coal" + }, + { + "id" : "minecraft:charcoal" + }, + { + "id" : "minecraft:diamond" + }, + { + "id" : "minecraft:iron_nugget" + }, + { + "id" : "minecraft:raw_iron" + }, + { + "id" : "minecraft:raw_gold" + }, + { + "id" : "minecraft:raw_copper" + }, + { + "id" : "minecraft:copper_ingot" + }, + { + "id" : "minecraft:iron_ingot" + }, + { + "id" : "minecraft:netherite_scrap" + }, + { + "id" : "minecraft:netherite_ingot" + }, + { + "id" : "minecraft:gold_nugget" + }, + { + "id" : "minecraft:gold_ingot" + }, + { + "id" : "minecraft:emerald" + }, + { + "id" : "minecraft:quartz" + }, + { + "id" : "minecraft:clay_ball" + }, + { + "id" : "minecraft:brick" + }, + { + "id" : "minecraft:netherbrick" + }, + { + "id" : "minecraft:prismarine_shard" + }, + { + "id" : "minecraft:amethyst_shard" + }, + { + "id" : "minecraft:prismarine_crystals" + }, + { + "id" : "minecraft:nautilus_shell" + }, + { + "id" : "minecraft:heart_of_the_sea" + }, + { + "id" : "minecraft:scute" + }, + { + "id" : "minecraft:phantom_membrane" + }, + { + "id" : "minecraft:string" + }, + { + "id" : "minecraft:feather" + }, + { + "id" : "minecraft:flint" + }, + { + "id" : "minecraft:gunpowder" + }, + { + "id" : "minecraft:leather" + }, + { + "id" : "minecraft:rabbit_hide" + }, + { + "id" : "minecraft:rabbit_foot" + }, + { + "id" : "minecraft:fire_charge" + }, + { + "id" : "minecraft:blaze_rod" + }, + { + "id" : "minecraft:blaze_powder" + }, + { + "id" : "minecraft:magma_cream" + }, + { + "id" : "minecraft:fermented_spider_eye" + }, + { + "id" : "minecraft:dragon_breath" + }, + { + "id" : "minecraft:shulker_shell" + }, + { + "id" : "minecraft:ghast_tear" + }, + { + "id" : "minecraft:slime_ball" + }, + { + "id" : "minecraft:ender_pearl" + }, + { + "id" : "minecraft:ender_eye" + }, + { + "id" : "minecraft:nether_star" + }, + { + "id" : "minecraft:end_rod", + "blockRuntimeId" : 4739 + }, + { + "id" : "minecraft:lightning_rod", + "blockRuntimeId" : 5516 + }, + { + "id" : "minecraft:end_crystal" + }, + { + "id" : "minecraft:paper" + }, + { + "id" : "minecraft:book" + }, + { + "id" : "minecraft:writable_book" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQIAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQMAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQMAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQNAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQNAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQQAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQUAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQUAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQVAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQWAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQZAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQZAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQaAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQbAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQcAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQgAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQhAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:oak_boat" + }, + { + "id" : "minecraft:spruce_boat" + }, + { + "id" : "minecraft:birch_boat" + }, + { + "id" : "minecraft:jungle_boat" + }, + { + "id" : "minecraft:acacia_boat" + }, + { + "id" : "minecraft:dark_oak_boat" + }, + { + "id" : "minecraft:rail", + "blockRuntimeId" : 6567 + }, + { + "id" : "minecraft:golden_rail", + "blockRuntimeId" : 4977 + }, + { + "id" : "minecraft:detector_rail", + "blockRuntimeId" : 4462 + }, + { + "id" : "minecraft:activator_rail", + "blockRuntimeId" : 122 + }, + { + "id" : "minecraft:minecart" + }, + { + "id" : "minecraft:chest_minecart" + }, + { + "id" : "minecraft:hopper_minecart" + }, + { + "id" : "minecraft:tnt_minecart" + }, + { + "id" : "minecraft:redstone" + }, + { + "id" : "minecraft:redstone_block", + "blockRuntimeId" : 6645 + }, + { + "id" : "minecraft:redstone_torch", + "blockRuntimeId" : 6648 + }, + { + "id" : "minecraft:lever", + "blockRuntimeId" : 5442 + }, + { + "id" : "minecraft:wooden_button", + "blockRuntimeId" : 7843 + }, + { + "id" : "minecraft:spruce_button", + "blockRuntimeId" : 6966 + }, + { + "id" : "minecraft:birch_button", + "blockRuntimeId" : 356 + }, + { + "id" : "minecraft:jungle_button", + "blockRuntimeId" : 5209 + }, + { + "id" : "minecraft:acacia_button" + }, + { + "id" : "minecraft:dark_oak_button", + "blockRuntimeId" : 3937 + }, + { + "id" : "minecraft:stone_button", + "blockRuntimeId" : 7195 + }, + { + "id" : "minecraft:crimson_button", + "blockRuntimeId" : 3772 + }, + { + "id" : "minecraft:warped_button", + "blockRuntimeId" : 7530 + }, + { + "id" : "minecraft:polished_blackstone_button", + "blockRuntimeId" : 6001 + }, + { + "id" : "minecraft:tripwire_hook", + "blockRuntimeId" : 7401 + }, + { + "id" : "minecraft:wooden_pressure_plate", + "blockRuntimeId" : 7887 + }, + { + "id" : "minecraft:spruce_pressure_plate", + "blockRuntimeId" : 7026 + }, + { + "id" : "minecraft:birch_pressure_plate", + "blockRuntimeId" : 416 + }, + { + "id" : "minecraft:jungle_pressure_plate", + "blockRuntimeId" : 5269 + }, + { + "id" : "minecraft:acacia_pressure_plate", + "blockRuntimeId" : 60 + }, + { + "id" : "minecraft:dark_oak_pressure_plate", + "blockRuntimeId" : 3997 + }, + { + "id" : "minecraft:crimson_pressure_plate", + "blockRuntimeId" : 3841 + }, + { + "id" : "minecraft:warped_pressure_plate", + "blockRuntimeId" : 7599 + }, + { + "id" : "minecraft:stone_pressure_plate", + "blockRuntimeId" : 7207 + }, + { + "id" : "minecraft:light_weighted_pressure_plate", + "blockRuntimeId" : 5500 + }, + { + "id" : "minecraft:heavy_weighted_pressure_plate", + "blockRuntimeId" : 5096 + }, + { + "id" : "minecraft:polished_blackstone_pressure_plate", + "blockRuntimeId" : 6015 + }, + { + "id" : "minecraft:observer", + "blockRuntimeId" : 5725 + }, + { + "id" : "minecraft:daylight_detector", + "blockRuntimeId" : 4067 + }, + { + "id" : "minecraft:repeater" + }, + { + "id" : "minecraft:comparator" + }, + { + "id" : "minecraft:hopper" + }, + { + "id" : "minecraft:dropper", + "blockRuntimeId" : 4589 + }, + { + "id" : "minecraft:dispenser", + "blockRuntimeId" : 4490 + }, + { + "id" : "minecraft:piston", + "blockRuntimeId" : 5786 + }, + { + "id" : "minecraft:sticky_piston", + "blockRuntimeId" : 7169 + }, + { + "id" : "minecraft:tnt", + "blockRuntimeId" : 7353 + }, + { + "id" : "minecraft:name_tag" + }, + { + "id" : "minecraft:loom", + "blockRuntimeId" : 5582 + }, + { + "id" : "minecraft:banner" + }, + { + "id" : "minecraft:banner", + "damage" : 8 + }, + { + "id" : "minecraft:banner", + "damage" : 7 + }, + { + "id" : "minecraft:banner", + "damage" : 15 + }, + { + "id" : "minecraft:banner", + "damage" : 12 + }, + { + "id" : "minecraft:banner", + "damage" : 14 + }, + { + "id" : "minecraft:banner", + "damage" : 1 + }, + { + "id" : "minecraft:banner", + "damage" : 4 + }, + { + "id" : "minecraft:banner", + "damage" : 5 + }, + { + "id" : "minecraft:banner", + "damage" : 13 + }, + { + "id" : "minecraft:banner", + "damage" : 9 + }, + { + "id" : "minecraft:banner", + "damage" : 3 + }, + { + "id" : "minecraft:banner", + "damage" : 11 + }, + { + "id" : "minecraft:banner", + "damage" : 10 + }, + { + "id" : "minecraft:banner", + "damage" : 2 + }, + { + "id" : "minecraft:banner", + "damage" : 6 + }, + { + "id" : "minecraft:banner", + "damage" : 15, + "nbt_b64" : "CgAAAwQAVHlwZQEAAAAA" + }, + { + "id" : "minecraft:creeper_banner_pattern" + }, + { + "id" : "minecraft:skull_banner_pattern" + }, + { + "id" : "minecraft:flower_banner_pattern" + }, + { + "id" : "minecraft:mojang_banner_pattern" + }, + { + "id" : "minecraft:field_masoned_banner_pattern" + }, + { + "id" : "minecraft:bordure_indented_banner_pattern" + }, + { + "id" : "minecraft:piglin_banner_pattern" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwAAAAAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAABwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAIBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAHBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAPBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAMBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAOBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAABBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAEBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAFBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAANBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAJBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAADBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAALBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAKBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAACBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAGBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_star", + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yIR0d/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 8, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yUk9H/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 7, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yl52d/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 15, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9y8PDw/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 12, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9y2rM6/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 14, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yHYD5/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 1, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yJi6w/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 4, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yqkQ8/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 5, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yuDKJ/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 13, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yvU7H/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 9, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yqovz/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 3, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yMlSD/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 11, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yPdj+/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 10, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yH8eA/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 2, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yFnxe/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 6, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9ynJwW/wA=" + }, + { + "id" : "minecraft:chain" + }, + { + "id" : "minecraft:target", + "blockRuntimeId" : 7351 + }, + { + "id" : "minecraft:lodestone_compass" + }, + { + "id" : "minecraft:debug_stick" + } + ] +} \ No newline at end of file diff --git a/connector/src/main/resources/bedrock/runtime_item_states.1_17_40.json b/connector/src/main/resources/bedrock/runtime_item_states.1_17_40.json new file mode 100644 index 000000000..342a45afb --- /dev/null +++ b/connector/src/main/resources/bedrock/runtime_item_states.1_17_40.json @@ -0,0 +1,4322 @@ +[ + { + "name" : "minecraft:acacia_boat", + "id" : 379 + }, + { + "name" : "minecraft:acacia_button", + "id" : -140 + }, + { + "name" : "minecraft:acacia_door", + "id" : 556 + }, + { + "name" : "minecraft:acacia_fence_gate", + "id" : 187 + }, + { + "name" : "minecraft:acacia_pressure_plate", + "id" : -150 + }, + { + "name" : "minecraft:acacia_sign", + "id" : 579 + }, + { + "name" : "minecraft:acacia_stairs", + "id" : 163 + }, + { + "name" : "minecraft:acacia_standing_sign", + "id" : -190 + }, + { + "name" : "minecraft:acacia_trapdoor", + "id" : -145 + }, + { + "name" : "minecraft:acacia_wall_sign", + "id" : -191 + }, + { + "name" : "minecraft:activator_rail", + "id" : 126 + }, + { + "name" : "minecraft:agent_spawn_egg", + "id" : 487 + }, + { + "name" : "minecraft:air", + "id" : -158 + }, + { + "name" : "minecraft:allow", + "id" : 210 + }, + { + "name" : "minecraft:amethyst_block", + "id" : -327 + }, + { + "name" : "minecraft:amethyst_cluster", + "id" : -329 + }, + { + "name" : "minecraft:amethyst_shard", + "id" : 624 + }, + { + "name" : "minecraft:ancient_debris", + "id" : -271 + }, + { + "name" : "minecraft:andesite_stairs", + "id" : -171 + }, + { + "name" : "minecraft:anvil", + "id" : 145 + }, + { + "name" : "minecraft:apple", + "id" : 257 + }, + { + "name" : "minecraft:armor_stand", + "id" : 552 + }, + { + "name" : "minecraft:arrow", + "id" : 301 + }, + { + "name" : "minecraft:axolotl_bucket", + "id" : 369 + }, + { + "name" : "minecraft:axolotl_spawn_egg", + "id" : 500 + }, + { + "name" : "minecraft:azalea", + "id" : -337 + }, + { + "name" : "minecraft:azalea_leaves", + "id" : -324 + }, + { + "name" : "minecraft:azalea_leaves_flowered", + "id" : -325 + }, + { + "name" : "minecraft:baked_potato", + "id" : 281 + }, + { + "name" : "minecraft:balloon", + "id" : 598 + }, + { + "name" : "minecraft:bamboo", + "id" : -163 + }, + { + "name" : "minecraft:bamboo_sapling", + "id" : -164 + }, + { + "name" : "minecraft:banner", + "id" : 567 + }, + { + "name" : "minecraft:banner_pattern", + "id" : 628 + }, + { + "name" : "minecraft:barrel", + "id" : -203 + }, + { + "name" : "minecraft:barrier", + "id" : -161 + }, + { + "name" : "minecraft:basalt", + "id" : -234 + }, + { + "name" : "minecraft:bat_spawn_egg", + "id" : 453 + }, + { + "name" : "minecraft:beacon", + "id" : 138 + }, + { + "name" : "minecraft:bed", + "id" : 418 + }, + { + "name" : "minecraft:bedrock", + "id" : 7 + }, + { + "name" : "minecraft:bee_nest", + "id" : -218 + }, + { + "name" : "minecraft:bee_spawn_egg", + "id" : 494 + }, + { + "name" : "minecraft:beef", + "id" : 273 + }, + { + "name" : "minecraft:beehive", + "id" : -219 + }, + { + "name" : "minecraft:beetroot", + "id" : 285 + }, + { + "name" : "minecraft:beetroot_seeds", + "id" : 295 + }, + { + "name" : "minecraft:beetroot_soup", + "id" : 286 + }, + { + "name" : "minecraft:bell", + "id" : -206 + }, + { + "name" : "minecraft:big_dripleaf", + "id" : -323 + }, + { + "name" : "minecraft:birch_boat", + "id" : 376 + }, + { + "name" : "minecraft:birch_button", + "id" : -141 + }, + { + "name" : "minecraft:birch_door", + "id" : 554 + }, + { + "name" : "minecraft:birch_fence_gate", + "id" : 184 + }, + { + "name" : "minecraft:birch_pressure_plate", + "id" : -151 + }, + { + "name" : "minecraft:birch_sign", + "id" : 577 + }, + { + "name" : "minecraft:birch_stairs", + "id" : 135 + }, + { + "name" : "minecraft:birch_standing_sign", + "id" : -186 + }, + { + "name" : "minecraft:birch_trapdoor", + "id" : -146 + }, + { + "name" : "minecraft:birch_wall_sign", + "id" : -187 + }, + { + "name" : "minecraft:black_candle", + "id" : -428 + }, + { + "name" : "minecraft:black_candle_cake", + "id" : -445 + }, + { + "name" : "minecraft:black_dye", + "id" : 395 + }, + { + "name" : "minecraft:black_glazed_terracotta", + "id" : 235 + }, + { + "name" : "minecraft:blackstone", + "id" : -273 + }, + { + "name" : "minecraft:blackstone_double_slab", + "id" : -283 + }, + { + "name" : "minecraft:blackstone_slab", + "id" : -282 + }, + { + "name" : "minecraft:blackstone_stairs", + "id" : -276 + }, + { + "name" : "minecraft:blackstone_wall", + "id" : -277 + }, + { + "name" : "minecraft:blast_furnace", + "id" : -196 + }, + { + "name" : "minecraft:blaze_powder", + "id" : 429 + }, + { + "name" : "minecraft:blaze_rod", + "id" : 423 + }, + { + "name" : "minecraft:blaze_spawn_egg", + "id" : 456 + }, + { + "name" : "minecraft:bleach", + "id" : 596 + }, + { + "name" : "minecraft:blue_candle", + "id" : -424 + }, + { + "name" : "minecraft:blue_candle_cake", + "id" : -441 + }, + { + "name" : "minecraft:blue_dye", + "id" : 399 + }, + { + "name" : "minecraft:blue_glazed_terracotta", + "id" : 231 + }, + { + "name" : "minecraft:blue_ice", + "id" : -11 + }, + { + "name" : "minecraft:boat", + "id" : 626 + }, + { + "name" : "minecraft:bone", + "id" : 415 + }, + { + "name" : "minecraft:bone_block", + "id" : 216 + }, + { + "name" : "minecraft:bone_meal", + "id" : 411 + }, + { + "name" : "minecraft:book", + "id" : 387 + }, + { + "name" : "minecraft:bookshelf", + "id" : 47 + }, + { + "name" : "minecraft:border_block", + "id" : 212 + }, + { + "name" : "minecraft:bordure_indented_banner_pattern", + "id" : 586 + }, + { + "name" : "minecraft:bow", + "id" : 300 + }, + { + "name" : "minecraft:bowl", + "id" : 321 + }, + { + "name" : "minecraft:bread", + "id" : 261 + }, + { + "name" : "minecraft:brewing_stand", + "id" : 431 + }, + { + "name" : "minecraft:brewingstandblock", + "id" : 117 + }, + { + "name" : "minecraft:brick", + "id" : 383 + }, + { + "name" : "minecraft:brick_block", + "id" : 45 + }, + { + "name" : "minecraft:brick_stairs", + "id" : 108 + }, + { + "name" : "minecraft:brown_candle", + "id" : -425 + }, + { + "name" : "minecraft:brown_candle_cake", + "id" : -442 + }, + { + "name" : "minecraft:brown_dye", + "id" : 398 + }, + { + "name" : "minecraft:brown_glazed_terracotta", + "id" : 232 + }, + { + "name" : "minecraft:brown_mushroom", + "id" : 39 + }, + { + "name" : "minecraft:brown_mushroom_block", + "id" : 99 + }, + { + "name" : "minecraft:bubble_column", + "id" : -160 + }, + { + "name" : "minecraft:bucket", + "id" : 360 + }, + { + "name" : "minecraft:budding_amethyst", + "id" : -328 + }, + { + "name" : "minecraft:cactus", + "id" : 81 + }, + { + "name" : "minecraft:cake", + "id" : 417 + }, + { + "name" : "minecraft:calcite", + "id" : -326 + }, + { + "name" : "minecraft:camera", + "id" : 593 + }, + { + "name" : "minecraft:campfire", + "id" : 588 + }, + { + "name" : "minecraft:candle", + "id" : -412 + }, + { + "name" : "minecraft:candle_cake", + "id" : -429 + }, + { + "name" : "minecraft:carpet", + "id" : 171 + }, + { + "name" : "minecraft:carrot", + "id" : 279 + }, + { + "name" : "minecraft:carrot_on_a_stick", + "id" : 517 + }, + { + "name" : "minecraft:carrots", + "id" : 141 + }, + { + "name" : "minecraft:cartography_table", + "id" : -200 + }, + { + "name" : "minecraft:carved_pumpkin", + "id" : -155 + }, + { + "name" : "minecraft:cat_spawn_egg", + "id" : 488 + }, + { + "name" : "minecraft:cauldron", + "id" : 432 + }, + { + "name" : "minecraft:cave_spider_spawn_egg", + "id" : 457 + }, + { + "name" : "minecraft:cave_vines", + "id" : -322 + }, + { + "name" : "minecraft:cave_vines_body_with_berries", + "id" : -375 + }, + { + "name" : "minecraft:cave_vines_head_with_berries", + "id" : -376 + }, + { + "name" : "minecraft:chain", + "id" : 618 + }, + { + "name" : "minecraft:chain_command_block", + "id" : 189 + }, + { + "name" : "minecraft:chainmail_boots", + "id" : 342 + }, + { + "name" : "minecraft:chainmail_chestplate", + "id" : 340 + }, + { + "name" : "minecraft:chainmail_helmet", + "id" : 339 + }, + { + "name" : "minecraft:chainmail_leggings", + "id" : 341 + }, + { + "name" : "minecraft:charcoal", + "id" : 303 + }, + { + "name" : "minecraft:chemical_heat", + "id" : 192 + }, + { + "name" : "minecraft:chemistry_table", + "id" : 238 + }, + { + "name" : "minecraft:chest", + "id" : 54 + }, + { + "name" : "minecraft:chest_minecart", + "id" : 389 + }, + { + "name" : "minecraft:chicken", + "id" : 275 + }, + { + "name" : "minecraft:chicken_spawn_egg", + "id" : 435 + }, + { + "name" : "minecraft:chiseled_deepslate", + "id" : -395 + }, + { + "name" : "minecraft:chiseled_nether_bricks", + "id" : -302 + }, + { + "name" : "minecraft:chiseled_polished_blackstone", + "id" : -279 + }, + { + "name" : "minecraft:chorus_flower", + "id" : 200 + }, + { + "name" : "minecraft:chorus_fruit", + "id" : 558 + }, + { + "name" : "minecraft:chorus_plant", + "id" : 240 + }, + { + "name" : "minecraft:clay", + "id" : 82 + }, + { + "name" : "minecraft:clay_ball", + "id" : 384 + }, + { + "name" : "minecraft:client_request_placeholder_block", + "id" : -465 + }, + { + "name" : "minecraft:clock", + "id" : 393 + }, + { + "name" : "minecraft:coal", + "id" : 302 + }, + { + "name" : "minecraft:coal_block", + "id" : 173 + }, + { + "name" : "minecraft:coal_ore", + "id" : 16 + }, + { + "name" : "minecraft:cobbled_deepslate", + "id" : -379 + }, + { + "name" : "minecraft:cobbled_deepslate_double_slab", + "id" : -396 + }, + { + "name" : "minecraft:cobbled_deepslate_slab", + "id" : -380 + }, + { + "name" : "minecraft:cobbled_deepslate_stairs", + "id" : -381 + }, + { + "name" : "minecraft:cobbled_deepslate_wall", + "id" : -382 + }, + { + "name" : "minecraft:cobblestone", + "id" : 4 + }, + { + "name" : "minecraft:cobblestone_wall", + "id" : 139 + }, + { + "name" : "minecraft:cocoa", + "id" : 127 + }, + { + "name" : "minecraft:cocoa_beans", + "id" : 412 + }, + { + "name" : "minecraft:cod", + "id" : 264 + }, + { + "name" : "minecraft:cod_bucket", + "id" : 364 + }, + { + "name" : "minecraft:cod_spawn_egg", + "id" : 480 + }, + { + "name" : "minecraft:colored_torch_bp", + "id" : 204 + }, + { + "name" : "minecraft:colored_torch_rg", + "id" : 202 + }, + { + "name" : "minecraft:command_block", + "id" : 137 + }, + { + "name" : "minecraft:command_block_minecart", + "id" : 563 + }, + { + "name" : "minecraft:comparator", + "id" : 522 + }, + { + "name" : "minecraft:compass", + "id" : 391 + }, + { + "name" : "minecraft:composter", + "id" : -213 + }, + { + "name" : "minecraft:compound", + "id" : 594 + }, + { + "name" : "minecraft:concrete", + "id" : 236 + }, + { + "name" : "minecraft:concrete_powder", + "id" : 237 + }, + { + "name" : "minecraft:conduit", + "id" : -157 + }, + { + "name" : "minecraft:cooked_beef", + "id" : 274 + }, + { + "name" : "minecraft:cooked_chicken", + "id" : 276 + }, + { + "name" : "minecraft:cooked_cod", + "id" : 268 + }, + { + "name" : "minecraft:cooked_mutton", + "id" : 551 + }, + { + "name" : "minecraft:cooked_porkchop", + "id" : 263 + }, + { + "name" : "minecraft:cooked_rabbit", + "id" : 289 + }, + { + "name" : "minecraft:cooked_salmon", + "id" : 269 + }, + { + "name" : "minecraft:cookie", + "id" : 271 + }, + { + "name" : "minecraft:copper_block", + "id" : -340 + }, + { + "name" : "minecraft:copper_ingot", + "id" : 504 + }, + { + "name" : "minecraft:copper_ore", + "id" : -311 + }, + { + "name" : "minecraft:coral", + "id" : -131 + }, + { + "name" : "minecraft:coral_block", + "id" : -132 + }, + { + "name" : "minecraft:coral_fan", + "id" : -133 + }, + { + "name" : "minecraft:coral_fan_dead", + "id" : -134 + }, + { + "name" : "minecraft:coral_fan_hang", + "id" : -135 + }, + { + "name" : "minecraft:coral_fan_hang2", + "id" : -136 + }, + { + "name" : "minecraft:coral_fan_hang3", + "id" : -137 + }, + { + "name" : "minecraft:cow_spawn_egg", + "id" : 436 + }, + { + "name" : "minecraft:cracked_deepslate_bricks", + "id" : -410 + }, + { + "name" : "minecraft:cracked_deepslate_tiles", + "id" : -409 + }, + { + "name" : "minecraft:cracked_nether_bricks", + "id" : -303 + }, + { + "name" : "minecraft:cracked_polished_blackstone_bricks", + "id" : -280 + }, + { + "name" : "minecraft:crafting_table", + "id" : 58 + }, + { + "name" : "minecraft:creeper_banner_pattern", + "id" : 582 + }, + { + "name" : "minecraft:creeper_spawn_egg", + "id" : 441 + }, + { + "name" : "minecraft:crimson_button", + "id" : -260 + }, + { + "name" : "minecraft:crimson_door", + "id" : 615 + }, + { + "name" : "minecraft:crimson_double_slab", + "id" : -266 + }, + { + "name" : "minecraft:crimson_fence", + "id" : -256 + }, + { + "name" : "minecraft:crimson_fence_gate", + "id" : -258 + }, + { + "name" : "minecraft:crimson_fungus", + "id" : -228 + }, + { + "name" : "minecraft:crimson_hyphae", + "id" : -299 + }, + { + "name" : "minecraft:crimson_nylium", + "id" : -232 + }, + { + "name" : "minecraft:crimson_planks", + "id" : -242 + }, + { + "name" : "minecraft:crimson_pressure_plate", + "id" : -262 + }, + { + "name" : "minecraft:crimson_roots", + "id" : -223 + }, + { + "name" : "minecraft:crimson_sign", + "id" : 613 + }, + { + "name" : "minecraft:crimson_slab", + "id" : -264 + }, + { + "name" : "minecraft:crimson_stairs", + "id" : -254 + }, + { + "name" : "minecraft:crimson_standing_sign", + "id" : -250 + }, + { + "name" : "minecraft:crimson_stem", + "id" : -225 + }, + { + "name" : "minecraft:crimson_trapdoor", + "id" : -246 + }, + { + "name" : "minecraft:crimson_wall_sign", + "id" : -252 + }, + { + "name" : "minecraft:crossbow", + "id" : 575 + }, + { + "name" : "minecraft:crying_obsidian", + "id" : -289 + }, + { + "name" : "minecraft:cut_copper", + "id" : -347 + }, + { + "name" : "minecraft:cut_copper_slab", + "id" : -361 + }, + { + "name" : "minecraft:cut_copper_stairs", + "id" : -354 + }, + { + "name" : "minecraft:cyan_candle", + "id" : -422 + }, + { + "name" : "minecraft:cyan_candle_cake", + "id" : -439 + }, + { + "name" : "minecraft:cyan_dye", + "id" : 401 + }, + { + "name" : "minecraft:cyan_glazed_terracotta", + "id" : 229 + }, + { + "name" : "minecraft:dark_oak_boat", + "id" : 380 + }, + { + "name" : "minecraft:dark_oak_button", + "id" : -142 + }, + { + "name" : "minecraft:dark_oak_door", + "id" : 557 + }, + { + "name" : "minecraft:dark_oak_fence_gate", + "id" : 186 + }, + { + "name" : "minecraft:dark_oak_pressure_plate", + "id" : -152 + }, + { + "name" : "minecraft:dark_oak_sign", + "id" : 580 + }, + { + "name" : "minecraft:dark_oak_stairs", + "id" : 164 + }, + { + "name" : "minecraft:dark_oak_trapdoor", + "id" : -147 + }, + { + "name" : "minecraft:dark_prismarine_stairs", + "id" : -3 + }, + { + "name" : "minecraft:darkoak_standing_sign", + "id" : -192 + }, + { + "name" : "minecraft:darkoak_wall_sign", + "id" : -193 + }, + { + "name" : "minecraft:daylight_detector", + "id" : 151 + }, + { + "name" : "minecraft:daylight_detector_inverted", + "id" : 178 + }, + { + "name" : "minecraft:deadbush", + "id" : 32 + }, + { + "name" : "minecraft:debug_stick", + "id" : 590 + }, + { + "name" : "minecraft:deepslate", + "id" : -378 + }, + { + "name" : "minecraft:deepslate_brick_double_slab", + "id" : -399 + }, + { + "name" : "minecraft:deepslate_brick_slab", + "id" : -392 + }, + { + "name" : "minecraft:deepslate_brick_stairs", + "id" : -393 + }, + { + "name" : "minecraft:deepslate_brick_wall", + "id" : -394 + }, + { + "name" : "minecraft:deepslate_bricks", + "id" : -391 + }, + { + "name" : "minecraft:deepslate_coal_ore", + "id" : -406 + }, + { + "name" : "minecraft:deepslate_copper_ore", + "id" : -408 + }, + { + "name" : "minecraft:deepslate_diamond_ore", + "id" : -405 + }, + { + "name" : "minecraft:deepslate_emerald_ore", + "id" : -407 + }, + { + "name" : "minecraft:deepslate_gold_ore", + "id" : -402 + }, + { + "name" : "minecraft:deepslate_iron_ore", + "id" : -401 + }, + { + "name" : "minecraft:deepslate_lapis_ore", + "id" : -400 + }, + { + "name" : "minecraft:deepslate_redstone_ore", + "id" : -403 + }, + { + "name" : "minecraft:deepslate_tile_double_slab", + "id" : -398 + }, + { + "name" : "minecraft:deepslate_tile_slab", + "id" : -388 + }, + { + "name" : "minecraft:deepslate_tile_stairs", + "id" : -389 + }, + { + "name" : "minecraft:deepslate_tile_wall", + "id" : -390 + }, + { + "name" : "minecraft:deepslate_tiles", + "id" : -387 + }, + { + "name" : "minecraft:deny", + "id" : 211 + }, + { + "name" : "minecraft:detector_rail", + "id" : 28 + }, + { + "name" : "minecraft:diamond", + "id" : 304 + }, + { + "name" : "minecraft:diamond_axe", + "id" : 319 + }, + { + "name" : "minecraft:diamond_block", + "id" : 57 + }, + { + "name" : "minecraft:diamond_boots", + "id" : 350 + }, + { + "name" : "minecraft:diamond_chestplate", + "id" : 348 + }, + { + "name" : "minecraft:diamond_helmet", + "id" : 347 + }, + { + "name" : "minecraft:diamond_hoe", + "id" : 332 + }, + { + "name" : "minecraft:diamond_horse_armor", + "id" : 533 + }, + { + "name" : "minecraft:diamond_leggings", + "id" : 349 + }, + { + "name" : "minecraft:diamond_ore", + "id" : 56 + }, + { + "name" : "minecraft:diamond_pickaxe", + "id" : 318 + }, + { + "name" : "minecraft:diamond_shovel", + "id" : 317 + }, + { + "name" : "minecraft:diamond_sword", + "id" : 316 + }, + { + "name" : "minecraft:diorite_stairs", + "id" : -170 + }, + { + "name" : "minecraft:dirt", + "id" : 3 + }, + { + "name" : "minecraft:dirt_with_roots", + "id" : -318 + }, + { + "name" : "minecraft:dispenser", + "id" : 23 + }, + { + "name" : "minecraft:dolphin_spawn_egg", + "id" : 484 + }, + { + "name" : "minecraft:donkey_spawn_egg", + "id" : 465 + }, + { + "name" : "minecraft:double_cut_copper_slab", + "id" : -368 + }, + { + "name" : "minecraft:double_plant", + "id" : 175 + }, + { + "name" : "minecraft:double_stone_slab", + "id" : 44 + }, + { + "name" : "minecraft:double_stone_slab2", + "id" : 182 + }, + { + "name" : "minecraft:double_stone_slab3", + "id" : -162 + }, + { + "name" : "minecraft:double_stone_slab4", + "id" : -166 + }, + { + "name" : "minecraft:double_wooden_slab", + "id" : 157 + }, + { + "name" : "minecraft:dragon_breath", + "id" : 560 + }, + { + "name" : "minecraft:dragon_egg", + "id" : 122 + }, + { + "name" : "minecraft:dried_kelp", + "id" : 270 + }, + { + "name" : "minecraft:dried_kelp_block", + "id" : -139 + }, + { + "name" : "minecraft:dripstone_block", + "id" : -317 + }, + { + "name" : "minecraft:dropper", + "id" : 125 + }, + { + "name" : "minecraft:drowned_spawn_egg", + "id" : 483 + }, + { + "name" : "minecraft:dye", + "id" : 627 + }, + { + "name" : "minecraft:egg", + "id" : 390 + }, + { + "name" : "minecraft:elder_guardian_spawn_egg", + "id" : 471 + }, + { + "name" : "minecraft:element_0", + "id" : 36 + }, + { + "name" : "minecraft:element_1", + "id" : -12 + }, + { + "name" : "minecraft:element_10", + "id" : -21 + }, + { + "name" : "minecraft:element_100", + "id" : -111 + }, + { + "name" : "minecraft:element_101", + "id" : -112 + }, + { + "name" : "minecraft:element_102", + "id" : -113 + }, + { + "name" : "minecraft:element_103", + "id" : -114 + }, + { + "name" : "minecraft:element_104", + "id" : -115 + }, + { + "name" : "minecraft:element_105", + "id" : -116 + }, + { + "name" : "minecraft:element_106", + "id" : -117 + }, + { + "name" : "minecraft:element_107", + "id" : -118 + }, + { + "name" : "minecraft:element_108", + "id" : -119 + }, + { + "name" : "minecraft:element_109", + "id" : -120 + }, + { + "name" : "minecraft:element_11", + "id" : -22 + }, + { + "name" : "minecraft:element_110", + "id" : -121 + }, + { + "name" : "minecraft:element_111", + "id" : -122 + }, + { + "name" : "minecraft:element_112", + "id" : -123 + }, + { + "name" : "minecraft:element_113", + "id" : -124 + }, + { + "name" : "minecraft:element_114", + "id" : -125 + }, + { + "name" : "minecraft:element_115", + "id" : -126 + }, + { + "name" : "minecraft:element_116", + "id" : -127 + }, + { + "name" : "minecraft:element_117", + "id" : -128 + }, + { + "name" : "minecraft:element_118", + "id" : -129 + }, + { + "name" : "minecraft:element_12", + "id" : -23 + }, + { + "name" : "minecraft:element_13", + "id" : -24 + }, + { + "name" : "minecraft:element_14", + "id" : -25 + }, + { + "name" : "minecraft:element_15", + "id" : -26 + }, + { + "name" : "minecraft:element_16", + "id" : -27 + }, + { + "name" : "minecraft:element_17", + "id" : -28 + }, + { + "name" : "minecraft:element_18", + "id" : -29 + }, + { + "name" : "minecraft:element_19", + "id" : -30 + }, + { + "name" : "minecraft:element_2", + "id" : -13 + }, + { + "name" : "minecraft:element_20", + "id" : -31 + }, + { + "name" : "minecraft:element_21", + "id" : -32 + }, + { + "name" : "minecraft:element_22", + "id" : -33 + }, + { + "name" : "minecraft:element_23", + "id" : -34 + }, + { + "name" : "minecraft:element_24", + "id" : -35 + }, + { + "name" : "minecraft:element_25", + "id" : -36 + }, + { + "name" : "minecraft:element_26", + "id" : -37 + }, + { + "name" : "minecraft:element_27", + "id" : -38 + }, + { + "name" : "minecraft:element_28", + "id" : -39 + }, + { + "name" : "minecraft:element_29", + "id" : -40 + }, + { + "name" : "minecraft:element_3", + "id" : -14 + }, + { + "name" : "minecraft:element_30", + "id" : -41 + }, + { + "name" : "minecraft:element_31", + "id" : -42 + }, + { + "name" : "minecraft:element_32", + "id" : -43 + }, + { + "name" : "minecraft:element_33", + "id" : -44 + }, + { + "name" : "minecraft:element_34", + "id" : -45 + }, + { + "name" : "minecraft:element_35", + "id" : -46 + }, + { + "name" : "minecraft:element_36", + "id" : -47 + }, + { + "name" : "minecraft:element_37", + "id" : -48 + }, + { + "name" : "minecraft:element_38", + "id" : -49 + }, + { + "name" : "minecraft:element_39", + "id" : -50 + }, + { + "name" : "minecraft:element_4", + "id" : -15 + }, + { + "name" : "minecraft:element_40", + "id" : -51 + }, + { + "name" : "minecraft:element_41", + "id" : -52 + }, + { + "name" : "minecraft:element_42", + "id" : -53 + }, + { + "name" : "minecraft:element_43", + "id" : -54 + }, + { + "name" : "minecraft:element_44", + "id" : -55 + }, + { + "name" : "minecraft:element_45", + "id" : -56 + }, + { + "name" : "minecraft:element_46", + "id" : -57 + }, + { + "name" : "minecraft:element_47", + "id" : -58 + }, + { + "name" : "minecraft:element_48", + "id" : -59 + }, + { + "name" : "minecraft:element_49", + "id" : -60 + }, + { + "name" : "minecraft:element_5", + "id" : -16 + }, + { + "name" : "minecraft:element_50", + "id" : -61 + }, + { + "name" : "minecraft:element_51", + "id" : -62 + }, + { + "name" : "minecraft:element_52", + "id" : -63 + }, + { + "name" : "minecraft:element_53", + "id" : -64 + }, + { + "name" : "minecraft:element_54", + "id" : -65 + }, + { + "name" : "minecraft:element_55", + "id" : -66 + }, + { + "name" : "minecraft:element_56", + "id" : -67 + }, + { + "name" : "minecraft:element_57", + "id" : -68 + }, + { + "name" : "minecraft:element_58", + "id" : -69 + }, + { + "name" : "minecraft:element_59", + "id" : -70 + }, + { + "name" : "minecraft:element_6", + "id" : -17 + }, + { + "name" : "minecraft:element_60", + "id" : -71 + }, + { + "name" : "minecraft:element_61", + "id" : -72 + }, + { + "name" : "minecraft:element_62", + "id" : -73 + }, + { + "name" : "minecraft:element_63", + "id" : -74 + }, + { + "name" : "minecraft:element_64", + "id" : -75 + }, + { + "name" : "minecraft:element_65", + "id" : -76 + }, + { + "name" : "minecraft:element_66", + "id" : -77 + }, + { + "name" : "minecraft:element_67", + "id" : -78 + }, + { + "name" : "minecraft:element_68", + "id" : -79 + }, + { + "name" : "minecraft:element_69", + "id" : -80 + }, + { + "name" : "minecraft:element_7", + "id" : -18 + }, + { + "name" : "minecraft:element_70", + "id" : -81 + }, + { + "name" : "minecraft:element_71", + "id" : -82 + }, + { + "name" : "minecraft:element_72", + "id" : -83 + }, + { + "name" : "minecraft:element_73", + "id" : -84 + }, + { + "name" : "minecraft:element_74", + "id" : -85 + }, + { + "name" : "minecraft:element_75", + "id" : -86 + }, + { + "name" : "minecraft:element_76", + "id" : -87 + }, + { + "name" : "minecraft:element_77", + "id" : -88 + }, + { + "name" : "minecraft:element_78", + "id" : -89 + }, + { + "name" : "minecraft:element_79", + "id" : -90 + }, + { + "name" : "minecraft:element_8", + "id" : -19 + }, + { + "name" : "minecraft:element_80", + "id" : -91 + }, + { + "name" : "minecraft:element_81", + "id" : -92 + }, + { + "name" : "minecraft:element_82", + "id" : -93 + }, + { + "name" : "minecraft:element_83", + "id" : -94 + }, + { + "name" : "minecraft:element_84", + "id" : -95 + }, + { + "name" : "minecraft:element_85", + "id" : -96 + }, + { + "name" : "minecraft:element_86", + "id" : -97 + }, + { + "name" : "minecraft:element_87", + "id" : -98 + }, + { + "name" : "minecraft:element_88", + "id" : -99 + }, + { + "name" : "minecraft:element_89", + "id" : -100 + }, + { + "name" : "minecraft:element_9", + "id" : -20 + }, + { + "name" : "minecraft:element_90", + "id" : -101 + }, + { + "name" : "minecraft:element_91", + "id" : -102 + }, + { + "name" : "minecraft:element_92", + "id" : -103 + }, + { + "name" : "minecraft:element_93", + "id" : -104 + }, + { + "name" : "minecraft:element_94", + "id" : -105 + }, + { + "name" : "minecraft:element_95", + "id" : -106 + }, + { + "name" : "minecraft:element_96", + "id" : -107 + }, + { + "name" : "minecraft:element_97", + "id" : -108 + }, + { + "name" : "minecraft:element_98", + "id" : -109 + }, + { + "name" : "minecraft:element_99", + "id" : -110 + }, + { + "name" : "minecraft:elytra", + "id" : 564 + }, + { + "name" : "minecraft:emerald", + "id" : 512 + }, + { + "name" : "minecraft:emerald_block", + "id" : 133 + }, + { + "name" : "minecraft:emerald_ore", + "id" : 129 + }, + { + "name" : "minecraft:empty_map", + "id" : 515 + }, + { + "name" : "minecraft:enchanted_book", + "id" : 521 + }, + { + "name" : "minecraft:enchanted_golden_apple", + "id" : 259 + }, + { + "name" : "minecraft:enchanting_table", + "id" : 116 + }, + { + "name" : "minecraft:end_brick_stairs", + "id" : -178 + }, + { + "name" : "minecraft:end_bricks", + "id" : 206 + }, + { + "name" : "minecraft:end_crystal", + "id" : 630 + }, + { + "name" : "minecraft:end_gateway", + "id" : 209 + }, + { + "name" : "minecraft:end_portal", + "id" : 119 + }, + { + "name" : "minecraft:end_portal_frame", + "id" : 120 + }, + { + "name" : "minecraft:end_rod", + "id" : 208 + }, + { + "name" : "minecraft:end_stone", + "id" : 121 + }, + { + "name" : "minecraft:ender_chest", + "id" : 130 + }, + { + "name" : "minecraft:ender_eye", + "id" : 433 + }, + { + "name" : "minecraft:ender_pearl", + "id" : 422 + }, + { + "name" : "minecraft:enderman_spawn_egg", + "id" : 442 + }, + { + "name" : "minecraft:endermite_spawn_egg", + "id" : 460 + }, + { + "name" : "minecraft:evoker_spawn_egg", + "id" : 475 + }, + { + "name" : "minecraft:experience_bottle", + "id" : 508 + }, + { + "name" : "minecraft:exposed_copper", + "id" : -341 + }, + { + "name" : "minecraft:exposed_cut_copper", + "id" : -348 + }, + { + "name" : "minecraft:exposed_cut_copper_slab", + "id" : -362 + }, + { + "name" : "minecraft:exposed_cut_copper_stairs", + "id" : -355 + }, + { + "name" : "minecraft:exposed_double_cut_copper_slab", + "id" : -369 + }, + { + "name" : "minecraft:farmland", + "id" : 60 + }, + { + "name" : "minecraft:feather", + "id" : 327 + }, + { + "name" : "minecraft:fence", + "id" : 85 + }, + { + "name" : "minecraft:fence_gate", + "id" : 107 + }, + { + "name" : "minecraft:fermented_spider_eye", + "id" : 428 + }, + { + "name" : "minecraft:field_masoned_banner_pattern", + "id" : 585 + }, + { + "name" : "minecraft:filled_map", + "id" : 420 + }, + { + "name" : "minecraft:fire", + "id" : 51 + }, + { + "name" : "minecraft:fire_charge", + "id" : 509 + }, + { + "name" : "minecraft:firework_rocket", + "id" : 519 + }, + { + "name" : "minecraft:firework_star", + "id" : 520 + }, + { + "name" : "minecraft:fishing_rod", + "id" : 392 + }, + { + "name" : "minecraft:fletching_table", + "id" : -201 + }, + { + "name" : "minecraft:flint", + "id" : 356 + }, + { + "name" : "minecraft:flint_and_steel", + "id" : 299 + }, + { + "name" : "minecraft:flower_banner_pattern", + "id" : 581 + }, + { + "name" : "minecraft:flower_pot", + "id" : 514 + }, + { + "name" : "minecraft:flowering_azalea", + "id" : -338 + }, + { + "name" : "minecraft:flowing_lava", + "id" : 10 + }, + { + "name" : "minecraft:flowing_water", + "id" : 8 + }, + { + "name" : "minecraft:fox_spawn_egg", + "id" : 490 + }, + { + "name" : "minecraft:frame", + "id" : 513 + }, + { + "name" : "minecraft:frosted_ice", + "id" : 207 + }, + { + "name" : "minecraft:furnace", + "id" : 61 + }, + { + "name" : "minecraft:ghast_spawn_egg", + "id" : 454 + }, + { + "name" : "minecraft:ghast_tear", + "id" : 424 + }, + { + "name" : "minecraft:gilded_blackstone", + "id" : -281 + }, + { + "name" : "minecraft:glass", + "id" : 20 + }, + { + "name" : "minecraft:glass_bottle", + "id" : 427 + }, + { + "name" : "minecraft:glass_pane", + "id" : 102 + }, + { + "name" : "minecraft:glistering_melon_slice", + "id" : 434 + }, + { + "name" : "minecraft:glow_berries", + "id" : 631 + }, + { + "name" : "minecraft:glow_frame", + "id" : 622 + }, + { + "name" : "minecraft:glow_ink_sac", + "id" : 503 + }, + { + "name" : "minecraft:glow_lichen", + "id" : -411 + }, + { + "name" : "minecraft:glow_squid_spawn_egg", + "id" : 502 + }, + { + "name" : "minecraft:glow_stick", + "id" : 166 + }, + { + "name" : "minecraft:glowingobsidian", + "id" : 246 + }, + { + "name" : "minecraft:glowstone", + "id" : 89 + }, + { + "name" : "minecraft:glowstone_dust", + "id" : 394 + }, + { + "name" : "minecraft:goat_horn", + "id" : 623 + }, + { + "name" : "minecraft:goat_spawn_egg", + "id" : 501 + }, + { + "name" : "minecraft:gold_block", + "id" : 41 + }, + { + "name" : "minecraft:gold_ingot", + "id" : 306 + }, + { + "name" : "minecraft:gold_nugget", + "id" : 425 + }, + { + "name" : "minecraft:gold_ore", + "id" : 14 + }, + { + "name" : "minecraft:golden_apple", + "id" : 258 + }, + { + "name" : "minecraft:golden_axe", + "id" : 325 + }, + { + "name" : "minecraft:golden_boots", + "id" : 354 + }, + { + "name" : "minecraft:golden_carrot", + "id" : 283 + }, + { + "name" : "minecraft:golden_chestplate", + "id" : 352 + }, + { + "name" : "minecraft:golden_helmet", + "id" : 351 + }, + { + "name" : "minecraft:golden_hoe", + "id" : 333 + }, + { + "name" : "minecraft:golden_horse_armor", + "id" : 532 + }, + { + "name" : "minecraft:golden_leggings", + "id" : 353 + }, + { + "name" : "minecraft:golden_pickaxe", + "id" : 324 + }, + { + "name" : "minecraft:golden_rail", + "id" : 27 + }, + { + "name" : "minecraft:golden_shovel", + "id" : 323 + }, + { + "name" : "minecraft:golden_sword", + "id" : 322 + }, + { + "name" : "minecraft:granite_stairs", + "id" : -169 + }, + { + "name" : "minecraft:grass", + "id" : 2 + }, + { + "name" : "minecraft:grass_path", + "id" : 198 + }, + { + "name" : "minecraft:gravel", + "id" : 13 + }, + { + "name" : "minecraft:gray_candle", + "id" : -420 + }, + { + "name" : "minecraft:gray_candle_cake", + "id" : -437 + }, + { + "name" : "minecraft:gray_dye", + "id" : 403 + }, + { + "name" : "minecraft:gray_glazed_terracotta", + "id" : 227 + }, + { + "name" : "minecraft:green_candle", + "id" : -426 + }, + { + "name" : "minecraft:green_candle_cake", + "id" : -443 + }, + { + "name" : "minecraft:green_dye", + "id" : 397 + }, + { + "name" : "minecraft:green_glazed_terracotta", + "id" : 233 + }, + { + "name" : "minecraft:grindstone", + "id" : -195 + }, + { + "name" : "minecraft:guardian_spawn_egg", + "id" : 461 + }, + { + "name" : "minecraft:gunpowder", + "id" : 328 + }, + { + "name" : "minecraft:hanging_roots", + "id" : -319 + }, + { + "name" : "minecraft:hard_glass", + "id" : 253 + }, + { + "name" : "minecraft:hard_glass_pane", + "id" : 190 + }, + { + "name" : "minecraft:hard_stained_glass", + "id" : 254 + }, + { + "name" : "minecraft:hard_stained_glass_pane", + "id" : 191 + }, + { + "name" : "minecraft:hardened_clay", + "id" : 172 + }, + { + "name" : "minecraft:hay_block", + "id" : 170 + }, + { + "name" : "minecraft:heart_of_the_sea", + "id" : 571 + }, + { + "name" : "minecraft:heavy_weighted_pressure_plate", + "id" : 148 + }, + { + "name" : "minecraft:hoglin_spawn_egg", + "id" : 496 + }, + { + "name" : "minecraft:honey_block", + "id" : -220 + }, + { + "name" : "minecraft:honey_bottle", + "id" : 592 + }, + { + "name" : "minecraft:honeycomb", + "id" : 591 + }, + { + "name" : "minecraft:honeycomb_block", + "id" : -221 + }, + { + "name" : "minecraft:hopper", + "id" : 527 + }, + { + "name" : "minecraft:hopper_minecart", + "id" : 526 + }, + { + "name" : "minecraft:horse_spawn_egg", + "id" : 458 + }, + { + "name" : "minecraft:husk_spawn_egg", + "id" : 463 + }, + { + "name" : "minecraft:ice", + "id" : 79 + }, + { + "name" : "minecraft:ice_bomb", + "id" : 595 + }, + { + "name" : "minecraft:infested_deepslate", + "id" : -454 + }, + { + "name" : "minecraft:info_update", + "id" : 248 + }, + { + "name" : "minecraft:info_update2", + "id" : 249 + }, + { + "name" : "minecraft:ink_sac", + "id" : 413 + }, + { + "name" : "minecraft:invisiblebedrock", + "id" : 95 + }, + { + "name" : "minecraft:iron_axe", + "id" : 298 + }, + { + "name" : "minecraft:iron_bars", + "id" : 101 + }, + { + "name" : "minecraft:iron_block", + "id" : 42 + }, + { + "name" : "minecraft:iron_boots", + "id" : 346 + }, + { + "name" : "minecraft:iron_chestplate", + "id" : 344 + }, + { + "name" : "minecraft:iron_door", + "id" : 372 + }, + { + "name" : "minecraft:iron_helmet", + "id" : 343 + }, + { + "name" : "minecraft:iron_hoe", + "id" : 331 + }, + { + "name" : "minecraft:iron_horse_armor", + "id" : 531 + }, + { + "name" : "minecraft:iron_ingot", + "id" : 305 + }, + { + "name" : "minecraft:iron_leggings", + "id" : 345 + }, + { + "name" : "minecraft:iron_nugget", + "id" : 569 + }, + { + "name" : "minecraft:iron_ore", + "id" : 15 + }, + { + "name" : "minecraft:iron_pickaxe", + "id" : 297 + }, + { + "name" : "minecraft:iron_shovel", + "id" : 296 + }, + { + "name" : "minecraft:iron_sword", + "id" : 307 + }, + { + "name" : "minecraft:iron_trapdoor", + "id" : 167 + }, + { + "name" : "minecraft:item.acacia_door", + "id" : 196 + }, + { + "name" : "minecraft:item.bed", + "id" : 26 + }, + { + "name" : "minecraft:item.beetroot", + "id" : 244 + }, + { + "name" : "minecraft:item.birch_door", + "id" : 194 + }, + { + "name" : "minecraft:item.cake", + "id" : 92 + }, + { + "name" : "minecraft:item.camera", + "id" : 242 + }, + { + "name" : "minecraft:item.campfire", + "id" : -209 + }, + { + "name" : "minecraft:item.cauldron", + "id" : 118 + }, + { + "name" : "minecraft:item.chain", + "id" : -286 + }, + { + "name" : "minecraft:item.crimson_door", + "id" : -244 + }, + { + "name" : "minecraft:item.dark_oak_door", + "id" : 197 + }, + { + "name" : "minecraft:item.flower_pot", + "id" : 140 + }, + { + "name" : "minecraft:item.frame", + "id" : 199 + }, + { + "name" : "minecraft:item.glow_frame", + "id" : -339 + }, + { + "name" : "minecraft:item.hopper", + "id" : 154 + }, + { + "name" : "minecraft:item.iron_door", + "id" : 71 + }, + { + "name" : "minecraft:item.jungle_door", + "id" : 195 + }, + { + "name" : "minecraft:item.kelp", + "id" : -138 + }, + { + "name" : "minecraft:item.nether_sprouts", + "id" : -238 + }, + { + "name" : "minecraft:item.nether_wart", + "id" : 115 + }, + { + "name" : "minecraft:item.reeds", + "id" : 83 + }, + { + "name" : "minecraft:item.skull", + "id" : 144 + }, + { + "name" : "minecraft:item.soul_campfire", + "id" : -290 + }, + { + "name" : "minecraft:item.spruce_door", + "id" : 193 + }, + { + "name" : "minecraft:item.warped_door", + "id" : -245 + }, + { + "name" : "minecraft:item.wheat", + "id" : 59 + }, + { + "name" : "minecraft:item.wooden_door", + "id" : 64 + }, + { + "name" : "minecraft:jigsaw", + "id" : -211 + }, + { + "name" : "minecraft:jukebox", + "id" : 84 + }, + { + "name" : "minecraft:jungle_boat", + "id" : 377 + }, + { + "name" : "minecraft:jungle_button", + "id" : -143 + }, + { + "name" : "minecraft:jungle_door", + "id" : 555 + }, + { + "name" : "minecraft:jungle_fence_gate", + "id" : 185 + }, + { + "name" : "minecraft:jungle_pressure_plate", + "id" : -153 + }, + { + "name" : "minecraft:jungle_sign", + "id" : 578 + }, + { + "name" : "minecraft:jungle_stairs", + "id" : 136 + }, + { + "name" : "minecraft:jungle_standing_sign", + "id" : -188 + }, + { + "name" : "minecraft:jungle_trapdoor", + "id" : -148 + }, + { + "name" : "minecraft:jungle_wall_sign", + "id" : -189 + }, + { + "name" : "minecraft:kelp", + "id" : 382 + }, + { + "name" : "minecraft:ladder", + "id" : 65 + }, + { + "name" : "minecraft:lantern", + "id" : -208 + }, + { + "name" : "minecraft:lapis_block", + "id" : 22 + }, + { + "name" : "minecraft:lapis_lazuli", + "id" : 414 + }, + { + "name" : "minecraft:lapis_ore", + "id" : 21 + }, + { + "name" : "minecraft:large_amethyst_bud", + "id" : -330 + }, + { + "name" : "minecraft:lava", + "id" : 11 + }, + { + "name" : "minecraft:lava_bucket", + "id" : 363 + }, + { + "name" : "minecraft:lava_cauldron", + "id" : -210 + }, + { + "name" : "minecraft:lead", + "id" : 547 + }, + { + "name" : "minecraft:leather", + "id" : 381 + }, + { + "name" : "minecraft:leather_boots", + "id" : 338 + }, + { + "name" : "minecraft:leather_chestplate", + "id" : 336 + }, + { + "name" : "minecraft:leather_helmet", + "id" : 335 + }, + { + "name" : "minecraft:leather_horse_armor", + "id" : 530 + }, + { + "name" : "minecraft:leather_leggings", + "id" : 337 + }, + { + "name" : "minecraft:leaves", + "id" : 18 + }, + { + "name" : "minecraft:leaves2", + "id" : 161 + }, + { + "name" : "minecraft:lectern", + "id" : -194 + }, + { + "name" : "minecraft:lever", + "id" : 69 + }, + { + "name" : "minecraft:light_block", + "id" : -215 + }, + { + "name" : "minecraft:light_blue_candle", + "id" : -416 + }, + { + "name" : "minecraft:light_blue_candle_cake", + "id" : -433 + }, + { + "name" : "minecraft:light_blue_dye", + "id" : 407 + }, + { + "name" : "minecraft:light_blue_glazed_terracotta", + "id" : 223 + }, + { + "name" : "minecraft:light_gray_candle", + "id" : -421 + }, + { + "name" : "minecraft:light_gray_candle_cake", + "id" : -438 + }, + { + "name" : "minecraft:light_gray_dye", + "id" : 402 + }, + { + "name" : "minecraft:light_weighted_pressure_plate", + "id" : 147 + }, + { + "name" : "minecraft:lightning_rod", + "id" : -312 + }, + { + "name" : "minecraft:lime_candle", + "id" : -418 + }, + { + "name" : "minecraft:lime_candle_cake", + "id" : -435 + }, + { + "name" : "minecraft:lime_dye", + "id" : 405 + }, + { + "name" : "minecraft:lime_glazed_terracotta", + "id" : 225 + }, + { + "name" : "minecraft:lingering_potion", + "id" : 562 + }, + { + "name" : "minecraft:lit_blast_furnace", + "id" : -214 + }, + { + "name" : "minecraft:lit_deepslate_redstone_ore", + "id" : -404 + }, + { + "name" : "minecraft:lit_furnace", + "id" : 62 + }, + { + "name" : "minecraft:lit_pumpkin", + "id" : 91 + }, + { + "name" : "minecraft:lit_redstone_lamp", + "id" : 124 + }, + { + "name" : "minecraft:lit_redstone_ore", + "id" : 74 + }, + { + "name" : "minecraft:lit_smoker", + "id" : -199 + }, + { + "name" : "minecraft:llama_spawn_egg", + "id" : 473 + }, + { + "name" : "minecraft:lodestone", + "id" : -222 + }, + { + "name" : "minecraft:lodestone_compass", + "id" : 601 + }, + { + "name" : "minecraft:log", + "id" : 17 + }, + { + "name" : "minecraft:log2", + "id" : 162 + }, + { + "name" : "minecraft:loom", + "id" : -204 + }, + { + "name" : "minecraft:magenta_candle", + "id" : -415 + }, + { + "name" : "minecraft:magenta_candle_cake", + "id" : -432 + }, + { + "name" : "minecraft:magenta_dye", + "id" : 408 + }, + { + "name" : "minecraft:magenta_glazed_terracotta", + "id" : 222 + }, + { + "name" : "minecraft:magma", + "id" : 213 + }, + { + "name" : "minecraft:magma_cream", + "id" : 430 + }, + { + "name" : "minecraft:magma_cube_spawn_egg", + "id" : 455 + }, + { + "name" : "minecraft:medicine", + "id" : 599 + }, + { + "name" : "minecraft:medium_amethyst_bud", + "id" : -331 + }, + { + "name" : "minecraft:melon_block", + "id" : 103 + }, + { + "name" : "minecraft:melon_seeds", + "id" : 293 + }, + { + "name" : "minecraft:melon_slice", + "id" : 272 + }, + { + "name" : "minecraft:melon_stem", + "id" : 105 + }, + { + "name" : "minecraft:milk_bucket", + "id" : 361 + }, + { + "name" : "minecraft:minecart", + "id" : 370 + }, + { + "name" : "minecraft:mob_spawner", + "id" : 52 + }, + { + "name" : "minecraft:mojang_banner_pattern", + "id" : 584 + }, + { + "name" : "minecraft:monster_egg", + "id" : 97 + }, + { + "name" : "minecraft:mooshroom_spawn_egg", + "id" : 440 + }, + { + "name" : "minecraft:moss_block", + "id" : -320 + }, + { + "name" : "minecraft:moss_carpet", + "id" : -335 + }, + { + "name" : "minecraft:mossy_cobblestone", + "id" : 48 + }, + { + "name" : "minecraft:mossy_cobblestone_stairs", + "id" : -179 + }, + { + "name" : "minecraft:mossy_stone_brick_stairs", + "id" : -175 + }, + { + "name" : "minecraft:movingblock", + "id" : 250 + }, + { + "name" : "minecraft:mule_spawn_egg", + "id" : 466 + }, + { + "name" : "minecraft:mushroom_stew", + "id" : 260 + }, + { + "name" : "minecraft:music_disc_11", + "id" : 544 + }, + { + "name" : "minecraft:music_disc_13", + "id" : 534 + }, + { + "name" : "minecraft:music_disc_blocks", + "id" : 536 + }, + { + "name" : "minecraft:music_disc_cat", + "id" : 535 + }, + { + "name" : "minecraft:music_disc_chirp", + "id" : 537 + }, + { + "name" : "minecraft:music_disc_far", + "id" : 538 + }, + { + "name" : "minecraft:music_disc_mall", + "id" : 539 + }, + { + "name" : "minecraft:music_disc_mellohi", + "id" : 540 + }, + { + "name" : "minecraft:music_disc_pigstep", + "id" : 619 + }, + { + "name" : "minecraft:music_disc_stal", + "id" : 541 + }, + { + "name" : "minecraft:music_disc_strad", + "id" : 542 + }, + { + "name" : "minecraft:music_disc_wait", + "id" : 545 + }, + { + "name" : "minecraft:music_disc_ward", + "id" : 543 + }, + { + "name" : "minecraft:mutton", + "id" : 550 + }, + { + "name" : "minecraft:mycelium", + "id" : 110 + }, + { + "name" : "minecraft:mysterious_frame", + "id" : -466 + }, + { + "name" : "minecraft:mysterious_frame_slot", + "id" : -467 + }, + { + "name" : "minecraft:name_tag", + "id" : 548 + }, + { + "name" : "minecraft:nautilus_shell", + "id" : 570 + }, + { + "name" : "minecraft:nether_brick", + "id" : 112 + }, + { + "name" : "minecraft:nether_brick_fence", + "id" : 113 + }, + { + "name" : "minecraft:nether_brick_stairs", + "id" : 114 + }, + { + "name" : "minecraft:nether_gold_ore", + "id" : -288 + }, + { + "name" : "minecraft:nether_sprouts", + "id" : 620 + }, + { + "name" : "minecraft:nether_star", + "id" : 518 + }, + { + "name" : "minecraft:nether_wart", + "id" : 294 + }, + { + "name" : "minecraft:nether_wart_block", + "id" : 214 + }, + { + "name" : "minecraft:netherbrick", + "id" : 523 + }, + { + "name" : "minecraft:netherite_axe", + "id" : 606 + }, + { + "name" : "minecraft:netherite_block", + "id" : -270 + }, + { + "name" : "minecraft:netherite_boots", + "id" : 611 + }, + { + "name" : "minecraft:netherite_chestplate", + "id" : 609 + }, + { + "name" : "minecraft:netherite_helmet", + "id" : 608 + }, + { + "name" : "minecraft:netherite_hoe", + "id" : 607 + }, + { + "name" : "minecraft:netherite_ingot", + "id" : 602 + }, + { + "name" : "minecraft:netherite_leggings", + "id" : 610 + }, + { + "name" : "minecraft:netherite_pickaxe", + "id" : 605 + }, + { + "name" : "minecraft:netherite_scrap", + "id" : 612 + }, + { + "name" : "minecraft:netherite_shovel", + "id" : 604 + }, + { + "name" : "minecraft:netherite_sword", + "id" : 603 + }, + { + "name" : "minecraft:netherrack", + "id" : 87 + }, + { + "name" : "minecraft:netherreactor", + "id" : 247 + }, + { + "name" : "minecraft:normal_stone_stairs", + "id" : -180 + }, + { + "name" : "minecraft:noteblock", + "id" : 25 + }, + { + "name" : "minecraft:npc_spawn_egg", + "id" : 470 + }, + { + "name" : "minecraft:oak_boat", + "id" : 375 + }, + { + "name" : "minecraft:oak_sign", + "id" : 358 + }, + { + "name" : "minecraft:oak_stairs", + "id" : 53 + }, + { + "name" : "minecraft:observer", + "id" : 251 + }, + { + "name" : "minecraft:obsidian", + "id" : 49 + }, + { + "name" : "minecraft:ocelot_spawn_egg", + "id" : 451 + }, + { + "name" : "minecraft:orange_candle", + "id" : -414 + }, + { + "name" : "minecraft:orange_candle_cake", + "id" : -431 + }, + { + "name" : "minecraft:orange_dye", + "id" : 409 + }, + { + "name" : "minecraft:orange_glazed_terracotta", + "id" : 221 + }, + { + "name" : "minecraft:oxidized_copper", + "id" : -343 + }, + { + "name" : "minecraft:oxidized_cut_copper", + "id" : -350 + }, + { + "name" : "minecraft:oxidized_cut_copper_slab", + "id" : -364 + }, + { + "name" : "minecraft:oxidized_cut_copper_stairs", + "id" : -357 + }, + { + "name" : "minecraft:oxidized_double_cut_copper_slab", + "id" : -371 + }, + { + "name" : "minecraft:packed_ice", + "id" : 174 + }, + { + "name" : "minecraft:painting", + "id" : 357 + }, + { + "name" : "minecraft:panda_spawn_egg", + "id" : 489 + }, + { + "name" : "minecraft:paper", + "id" : 386 + }, + { + "name" : "minecraft:parrot_spawn_egg", + "id" : 478 + }, + { + "name" : "minecraft:phantom_membrane", + "id" : 574 + }, + { + "name" : "minecraft:phantom_spawn_egg", + "id" : 486 + }, + { + "name" : "minecraft:pig_spawn_egg", + "id" : 437 + }, + { + "name" : "minecraft:piglin_banner_pattern", + "id" : 587 + }, + { + "name" : "minecraft:piglin_brute_spawn_egg", + "id" : 499 + }, + { + "name" : "minecraft:piglin_spawn_egg", + "id" : 497 + }, + { + "name" : "minecraft:pillager_spawn_egg", + "id" : 491 + }, + { + "name" : "minecraft:pink_candle", + "id" : -419 + }, + { + "name" : "minecraft:pink_candle_cake", + "id" : -436 + }, + { + "name" : "minecraft:pink_dye", + "id" : 404 + }, + { + "name" : "minecraft:pink_glazed_terracotta", + "id" : 226 + }, + { + "name" : "minecraft:piston", + "id" : 33 + }, + { + "name" : "minecraft:pistonarmcollision", + "id" : 34 + }, + { + "name" : "minecraft:planks", + "id" : 5 + }, + { + "name" : "minecraft:podzol", + "id" : 243 + }, + { + "name" : "minecraft:pointed_dripstone", + "id" : -308 + }, + { + "name" : "minecraft:poisonous_potato", + "id" : 282 + }, + { + "name" : "minecraft:polar_bear_spawn_egg", + "id" : 472 + }, + { + "name" : "minecraft:polished_andesite_stairs", + "id" : -174 + }, + { + "name" : "minecraft:polished_basalt", + "id" : -235 + }, + { + "name" : "minecraft:polished_blackstone", + "id" : -291 + }, + { + "name" : "minecraft:polished_blackstone_brick_double_slab", + "id" : -285 + }, + { + "name" : "minecraft:polished_blackstone_brick_slab", + "id" : -284 + }, + { + "name" : "minecraft:polished_blackstone_brick_stairs", + "id" : -275 + }, + { + "name" : "minecraft:polished_blackstone_brick_wall", + "id" : -278 + }, + { + "name" : "minecraft:polished_blackstone_bricks", + "id" : -274 + }, + { + "name" : "minecraft:polished_blackstone_button", + "id" : -296 + }, + { + "name" : "minecraft:polished_blackstone_double_slab", + "id" : -294 + }, + { + "name" : "minecraft:polished_blackstone_pressure_plate", + "id" : -295 + }, + { + "name" : "minecraft:polished_blackstone_slab", + "id" : -293 + }, + { + "name" : "minecraft:polished_blackstone_stairs", + "id" : -292 + }, + { + "name" : "minecraft:polished_blackstone_wall", + "id" : -297 + }, + { + "name" : "minecraft:polished_deepslate", + "id" : -383 + }, + { + "name" : "minecraft:polished_deepslate_double_slab", + "id" : -397 + }, + { + "name" : "minecraft:polished_deepslate_slab", + "id" : -384 + }, + { + "name" : "minecraft:polished_deepslate_stairs", + "id" : -385 + }, + { + "name" : "minecraft:polished_deepslate_wall", + "id" : -386 + }, + { + "name" : "minecraft:polished_diorite_stairs", + "id" : -173 + }, + { + "name" : "minecraft:polished_granite_stairs", + "id" : -172 + }, + { + "name" : "minecraft:popped_chorus_fruit", + "id" : 559 + }, + { + "name" : "minecraft:porkchop", + "id" : 262 + }, + { + "name" : "minecraft:portal", + "id" : 90 + }, + { + "name" : "minecraft:potato", + "id" : 280 + }, + { + "name" : "minecraft:potatoes", + "id" : 142 + }, + { + "name" : "minecraft:potion", + "id" : 426 + }, + { + "name" : "minecraft:powder_snow", + "id" : -306 + }, + { + "name" : "minecraft:powder_snow_bucket", + "id" : 368 + }, + { + "name" : "minecraft:powered_comparator", + "id" : 150 + }, + { + "name" : "minecraft:powered_repeater", + "id" : 94 + }, + { + "name" : "minecraft:prismarine", + "id" : 168 + }, + { + "name" : "minecraft:prismarine_bricks_stairs", + "id" : -4 + }, + { + "name" : "minecraft:prismarine_crystals", + "id" : 549 + }, + { + "name" : "minecraft:prismarine_shard", + "id" : 565 + }, + { + "name" : "minecraft:prismarine_stairs", + "id" : -2 + }, + { + "name" : "minecraft:pufferfish", + "id" : 267 + }, + { + "name" : "minecraft:pufferfish_bucket", + "id" : 367 + }, + { + "name" : "minecraft:pufferfish_spawn_egg", + "id" : 481 + }, + { + "name" : "minecraft:pumpkin", + "id" : 86 + }, + { + "name" : "minecraft:pumpkin_pie", + "id" : 284 + }, + { + "name" : "minecraft:pumpkin_seeds", + "id" : 292 + }, + { + "name" : "minecraft:pumpkin_stem", + "id" : 104 + }, + { + "name" : "minecraft:purple_candle", + "id" : -423 + }, + { + "name" : "minecraft:purple_candle_cake", + "id" : -440 + }, + { + "name" : "minecraft:purple_dye", + "id" : 400 + }, + { + "name" : "minecraft:purple_glazed_terracotta", + "id" : 219 + }, + { + "name" : "minecraft:purpur_block", + "id" : 201 + }, + { + "name" : "minecraft:purpur_stairs", + "id" : 203 + }, + { + "name" : "minecraft:quartz", + "id" : 524 + }, + { + "name" : "minecraft:quartz_block", + "id" : 155 + }, + { + "name" : "minecraft:quartz_bricks", + "id" : -304 + }, + { + "name" : "minecraft:quartz_ore", + "id" : 153 + }, + { + "name" : "minecraft:quartz_stairs", + "id" : 156 + }, + { + "name" : "minecraft:rabbit", + "id" : 288 + }, + { + "name" : "minecraft:rabbit_foot", + "id" : 528 + }, + { + "name" : "minecraft:rabbit_hide", + "id" : 529 + }, + { + "name" : "minecraft:rabbit_spawn_egg", + "id" : 459 + }, + { + "name" : "minecraft:rabbit_stew", + "id" : 290 + }, + { + "name" : "minecraft:rail", + "id" : 66 + }, + { + "name" : "minecraft:rapid_fertilizer", + "id" : 597 + }, + { + "name" : "minecraft:ravager_spawn_egg", + "id" : 493 + }, + { + "name" : "minecraft:raw_copper", + "id" : 507 + }, + { + "name" : "minecraft:raw_copper_block", + "id" : -452 + }, + { + "name" : "minecraft:raw_gold", + "id" : 506 + }, + { + "name" : "minecraft:raw_gold_block", + "id" : -453 + }, + { + "name" : "minecraft:raw_iron", + "id" : 505 + }, + { + "name" : "minecraft:raw_iron_block", + "id" : -451 + }, + { + "name" : "minecraft:real_double_stone_slab", + "id" : 43 + }, + { + "name" : "minecraft:real_double_stone_slab2", + "id" : 181 + }, + { + "name" : "minecraft:real_double_stone_slab3", + "id" : -167 + }, + { + "name" : "minecraft:real_double_stone_slab4", + "id" : -168 + }, + { + "name" : "minecraft:red_candle", + "id" : -427 + }, + { + "name" : "minecraft:red_candle_cake", + "id" : -444 + }, + { + "name" : "minecraft:red_dye", + "id" : 396 + }, + { + "name" : "minecraft:red_flower", + "id" : 38 + }, + { + "name" : "minecraft:red_glazed_terracotta", + "id" : 234 + }, + { + "name" : "minecraft:red_mushroom", + "id" : 40 + }, + { + "name" : "minecraft:red_mushroom_block", + "id" : 100 + }, + { + "name" : "minecraft:red_nether_brick", + "id" : 215 + }, + { + "name" : "minecraft:red_nether_brick_stairs", + "id" : -184 + }, + { + "name" : "minecraft:red_sandstone", + "id" : 179 + }, + { + "name" : "minecraft:red_sandstone_stairs", + "id" : 180 + }, + { + "name" : "minecraft:redstone", + "id" : 373 + }, + { + "name" : "minecraft:redstone_block", + "id" : 152 + }, + { + "name" : "minecraft:redstone_lamp", + "id" : 123 + }, + { + "name" : "minecraft:redstone_ore", + "id" : 73 + }, + { + "name" : "minecraft:redstone_torch", + "id" : 76 + }, + { + "name" : "minecraft:redstone_wire", + "id" : 55 + }, + { + "name" : "minecraft:repeater", + "id" : 419 + }, + { + "name" : "minecraft:repeating_command_block", + "id" : 188 + }, + { + "name" : "minecraft:reserved6", + "id" : 255 + }, + { + "name" : "minecraft:respawn_anchor", + "id" : -272 + }, + { + "name" : "minecraft:rotten_flesh", + "id" : 277 + }, + { + "name" : "minecraft:saddle", + "id" : 371 + }, + { + "name" : "minecraft:salmon", + "id" : 265 + }, + { + "name" : "minecraft:salmon_bucket", + "id" : 365 + }, + { + "name" : "minecraft:salmon_spawn_egg", + "id" : 482 + }, + { + "name" : "minecraft:sand", + "id" : 12 + }, + { + "name" : "minecraft:sandstone", + "id" : 24 + }, + { + "name" : "minecraft:sandstone_stairs", + "id" : 128 + }, + { + "name" : "minecraft:sapling", + "id" : 6 + }, + { + "name" : "minecraft:scaffolding", + "id" : -165 + }, + { + "name" : "minecraft:sculk", + "id" : -458 + }, + { + "name" : "minecraft:sculk_catalyst", + "id" : -460 + }, + { + "name" : "minecraft:sculk_sensor", + "id" : -307 + }, + { + "name" : "minecraft:sculk_shrieker", + "id" : -461 + }, + { + "name" : "minecraft:sculk_vein", + "id" : -459 + }, + { + "name" : "minecraft:scute", + "id" : 572 + }, + { + "name" : "minecraft:sea_pickle", + "id" : -156 + }, + { + "name" : "minecraft:seagrass", + "id" : -130 + }, + { + "name" : "minecraft:sealantern", + "id" : 169 + }, + { + "name" : "minecraft:shears", + "id" : 421 + }, + { + "name" : "minecraft:sheep_spawn_egg", + "id" : 438 + }, + { + "name" : "minecraft:shield", + "id" : 355 + }, + { + "name" : "minecraft:shroomlight", + "id" : -230 + }, + { + "name" : "minecraft:shulker_box", + "id" : 218 + }, + { + "name" : "minecraft:shulker_shell", + "id" : 566 + }, + { + "name" : "minecraft:shulker_spawn_egg", + "id" : 469 + }, + { + "name" : "minecraft:silver_glazed_terracotta", + "id" : 228 + }, + { + "name" : "minecraft:silverfish_spawn_egg", + "id" : 443 + }, + { + "name" : "minecraft:skeleton_horse_spawn_egg", + "id" : 467 + }, + { + "name" : "minecraft:skeleton_spawn_egg", + "id" : 444 + }, + { + "name" : "minecraft:skull", + "id" : 516 + }, + { + "name" : "minecraft:skull_banner_pattern", + "id" : 583 + }, + { + "name" : "minecraft:slime", + "id" : 165 + }, + { + "name" : "minecraft:slime_ball", + "id" : 388 + }, + { + "name" : "minecraft:slime_spawn_egg", + "id" : 445 + }, + { + "name" : "minecraft:small_amethyst_bud", + "id" : -332 + }, + { + "name" : "minecraft:small_dripleaf_block", + "id" : -336 + }, + { + "name" : "minecraft:smithing_table", + "id" : -202 + }, + { + "name" : "minecraft:smoker", + "id" : -198 + }, + { + "name" : "minecraft:smooth_basalt", + "id" : -377 + }, + { + "name" : "minecraft:smooth_quartz_stairs", + "id" : -185 + }, + { + "name" : "minecraft:smooth_red_sandstone_stairs", + "id" : -176 + }, + { + "name" : "minecraft:smooth_sandstone_stairs", + "id" : -177 + }, + { + "name" : "minecraft:smooth_stone", + "id" : -183 + }, + { + "name" : "minecraft:snow", + "id" : 80 + }, + { + "name" : "minecraft:snow_layer", + "id" : 78 + }, + { + "name" : "minecraft:snowball", + "id" : 374 + }, + { + "name" : "minecraft:soul_campfire", + "id" : 621 + }, + { + "name" : "minecraft:soul_fire", + "id" : -237 + }, + { + "name" : "minecraft:soul_lantern", + "id" : -269 + }, + { + "name" : "minecraft:soul_sand", + "id" : 88 + }, + { + "name" : "minecraft:soul_soil", + "id" : -236 + }, + { + "name" : "minecraft:soul_torch", + "id" : -268 + }, + { + "name" : "minecraft:sparkler", + "id" : 600 + }, + { + "name" : "minecraft:spawn_egg", + "id" : 629 + }, + { + "name" : "minecraft:spider_eye", + "id" : 278 + }, + { + "name" : "minecraft:spider_spawn_egg", + "id" : 446 + }, + { + "name" : "minecraft:splash_potion", + "id" : 561 + }, + { + "name" : "minecraft:sponge", + "id" : 19 + }, + { + "name" : "minecraft:spore_blossom", + "id" : -321 + }, + { + "name" : "minecraft:spruce_boat", + "id" : 378 + }, + { + "name" : "minecraft:spruce_button", + "id" : -144 + }, + { + "name" : "minecraft:spruce_door", + "id" : 553 + }, + { + "name" : "minecraft:spruce_fence_gate", + "id" : 183 + }, + { + "name" : "minecraft:spruce_pressure_plate", + "id" : -154 + }, + { + "name" : "minecraft:spruce_sign", + "id" : 576 + }, + { + "name" : "minecraft:spruce_stairs", + "id" : 134 + }, + { + "name" : "minecraft:spruce_standing_sign", + "id" : -181 + }, + { + "name" : "minecraft:spruce_trapdoor", + "id" : -149 + }, + { + "name" : "minecraft:spruce_wall_sign", + "id" : -182 + }, + { + "name" : "minecraft:spyglass", + "id" : 625 + }, + { + "name" : "minecraft:squid_spawn_egg", + "id" : 450 + }, + { + "name" : "minecraft:stained_glass", + "id" : 241 + }, + { + "name" : "minecraft:stained_glass_pane", + "id" : 160 + }, + { + "name" : "minecraft:stained_hardened_clay", + "id" : 159 + }, + { + "name" : "minecraft:standing_banner", + "id" : 176 + }, + { + "name" : "minecraft:standing_sign", + "id" : 63 + }, + { + "name" : "minecraft:stick", + "id" : 320 + }, + { + "name" : "minecraft:sticky_piston", + "id" : 29 + }, + { + "name" : "minecraft:stickypistonarmcollision", + "id" : -217 + }, + { + "name" : "minecraft:stone", + "id" : 1 + }, + { + "name" : "minecraft:stone_axe", + "id" : 315 + }, + { + "name" : "minecraft:stone_brick_stairs", + "id" : 109 + }, + { + "name" : "minecraft:stone_button", + "id" : 77 + }, + { + "name" : "minecraft:stone_hoe", + "id" : 330 + }, + { + "name" : "minecraft:stone_pickaxe", + "id" : 314 + }, + { + "name" : "minecraft:stone_pressure_plate", + "id" : 70 + }, + { + "name" : "minecraft:stone_shovel", + "id" : 313 + }, + { + "name" : "minecraft:stone_stairs", + "id" : 67 + }, + { + "name" : "minecraft:stone_sword", + "id" : 312 + }, + { + "name" : "minecraft:stonebrick", + "id" : 98 + }, + { + "name" : "minecraft:stonecutter", + "id" : 245 + }, + { + "name" : "minecraft:stonecutter_block", + "id" : -197 + }, + { + "name" : "minecraft:stray_spawn_egg", + "id" : 462 + }, + { + "name" : "minecraft:strider_spawn_egg", + "id" : 495 + }, + { + "name" : "minecraft:string", + "id" : 326 + }, + { + "name" : "minecraft:stripped_acacia_log", + "id" : -8 + }, + { + "name" : "minecraft:stripped_birch_log", + "id" : -6 + }, + { + "name" : "minecraft:stripped_crimson_hyphae", + "id" : -300 + }, + { + "name" : "minecraft:stripped_crimson_stem", + "id" : -240 + }, + { + "name" : "minecraft:stripped_dark_oak_log", + "id" : -9 + }, + { + "name" : "minecraft:stripped_jungle_log", + "id" : -7 + }, + { + "name" : "minecraft:stripped_oak_log", + "id" : -10 + }, + { + "name" : "minecraft:stripped_spruce_log", + "id" : -5 + }, + { + "name" : "minecraft:stripped_warped_hyphae", + "id" : -301 + }, + { + "name" : "minecraft:stripped_warped_stem", + "id" : -241 + }, + { + "name" : "minecraft:structure_block", + "id" : 252 + }, + { + "name" : "minecraft:structure_void", + "id" : 217 + }, + { + "name" : "minecraft:sugar", + "id" : 416 + }, + { + "name" : "minecraft:sugar_cane", + "id" : 385 + }, + { + "name" : "minecraft:suspicious_stew", + "id" : 589 + }, + { + "name" : "minecraft:sweet_berries", + "id" : 287 + }, + { + "name" : "minecraft:sweet_berry_bush", + "id" : -207 + }, + { + "name" : "minecraft:tallgrass", + "id" : 31 + }, + { + "name" : "minecraft:target", + "id" : -239 + }, + { + "name" : "minecraft:tinted_glass", + "id" : -334 + }, + { + "name" : "minecraft:tnt", + "id" : 46 + }, + { + "name" : "minecraft:tnt_minecart", + "id" : 525 + }, + { + "name" : "minecraft:torch", + "id" : 50 + }, + { + "name" : "minecraft:totem_of_undying", + "id" : 568 + }, + { + "name" : "minecraft:trapdoor", + "id" : 96 + }, + { + "name" : "minecraft:trapped_chest", + "id" : 146 + }, + { + "name" : "minecraft:trident", + "id" : 546 + }, + { + "name" : "minecraft:tripwire", + "id" : 132 + }, + { + "name" : "minecraft:tripwire_hook", + "id" : 131 + }, + { + "name" : "minecraft:tropical_fish", + "id" : 266 + }, + { + "name" : "minecraft:tropical_fish_bucket", + "id" : 366 + }, + { + "name" : "minecraft:tropical_fish_spawn_egg", + "id" : 479 + }, + { + "name" : "minecraft:tuff", + "id" : -333 + }, + { + "name" : "minecraft:turtle_egg", + "id" : -159 + }, + { + "name" : "minecraft:turtle_helmet", + "id" : 573 + }, + { + "name" : "minecraft:turtle_spawn_egg", + "id" : 485 + }, + { + "name" : "minecraft:twisting_vines", + "id" : -287 + }, + { + "name" : "minecraft:underwater_torch", + "id" : 239 + }, + { + "name" : "minecraft:undyed_shulker_box", + "id" : 205 + }, + { + "name" : "minecraft:unknown", + "id" : -305 + }, + { + "name" : "minecraft:unlit_redstone_torch", + "id" : 75 + }, + { + "name" : "minecraft:unpowered_comparator", + "id" : 149 + }, + { + "name" : "minecraft:unpowered_repeater", + "id" : 93 + }, + { + "name" : "minecraft:vex_spawn_egg", + "id" : 476 + }, + { + "name" : "minecraft:villager_spawn_egg", + "id" : 449 + }, + { + "name" : "minecraft:vindicator_spawn_egg", + "id" : 474 + }, + { + "name" : "minecraft:vine", + "id" : 106 + }, + { + "name" : "minecraft:wall_banner", + "id" : 177 + }, + { + "name" : "minecraft:wall_sign", + "id" : 68 + }, + { + "name" : "minecraft:wandering_trader_spawn_egg", + "id" : 492 + }, + { + "name" : "minecraft:warped_button", + "id" : -261 + }, + { + "name" : "minecraft:warped_door", + "id" : 616 + }, + { + "name" : "minecraft:warped_double_slab", + "id" : -267 + }, + { + "name" : "minecraft:warped_fence", + "id" : -257 + }, + { + "name" : "minecraft:warped_fence_gate", + "id" : -259 + }, + { + "name" : "minecraft:warped_fungus", + "id" : -229 + }, + { + "name" : "minecraft:warped_fungus_on_a_stick", + "id" : 617 + }, + { + "name" : "minecraft:warped_hyphae", + "id" : -298 + }, + { + "name" : "minecraft:warped_nylium", + "id" : -233 + }, + { + "name" : "minecraft:warped_planks", + "id" : -243 + }, + { + "name" : "minecraft:warped_pressure_plate", + "id" : -263 + }, + { + "name" : "minecraft:warped_roots", + "id" : -224 + }, + { + "name" : "minecraft:warped_sign", + "id" : 614 + }, + { + "name" : "minecraft:warped_slab", + "id" : -265 + }, + { + "name" : "minecraft:warped_stairs", + "id" : -255 + }, + { + "name" : "minecraft:warped_standing_sign", + "id" : -251 + }, + { + "name" : "minecraft:warped_stem", + "id" : -226 + }, + { + "name" : "minecraft:warped_trapdoor", + "id" : -247 + }, + { + "name" : "minecraft:warped_wall_sign", + "id" : -253 + }, + { + "name" : "minecraft:warped_wart_block", + "id" : -227 + }, + { + "name" : "minecraft:water", + "id" : 9 + }, + { + "name" : "minecraft:water_bucket", + "id" : 362 + }, + { + "name" : "minecraft:waterlily", + "id" : 111 + }, + { + "name" : "minecraft:waxed_copper", + "id" : -344 + }, + { + "name" : "minecraft:waxed_cut_copper", + "id" : -351 + }, + { + "name" : "minecraft:waxed_cut_copper_slab", + "id" : -365 + }, + { + "name" : "minecraft:waxed_cut_copper_stairs", + "id" : -358 + }, + { + "name" : "minecraft:waxed_double_cut_copper_slab", + "id" : -372 + }, + { + "name" : "minecraft:waxed_exposed_copper", + "id" : -345 + }, + { + "name" : "minecraft:waxed_exposed_cut_copper", + "id" : -352 + }, + { + "name" : "minecraft:waxed_exposed_cut_copper_slab", + "id" : -366 + }, + { + "name" : "minecraft:waxed_exposed_cut_copper_stairs", + "id" : -359 + }, + { + "name" : "minecraft:waxed_exposed_double_cut_copper_slab", + "id" : -373 + }, + { + "name" : "minecraft:waxed_oxidized_copper", + "id" : -446 + }, + { + "name" : "minecraft:waxed_oxidized_cut_copper", + "id" : -447 + }, + { + "name" : "minecraft:waxed_oxidized_cut_copper_slab", + "id" : -449 + }, + { + "name" : "minecraft:waxed_oxidized_cut_copper_stairs", + "id" : -448 + }, + { + "name" : "minecraft:waxed_oxidized_double_cut_copper_slab", + "id" : -450 + }, + { + "name" : "minecraft:waxed_weathered_copper", + "id" : -346 + }, + { + "name" : "minecraft:waxed_weathered_cut_copper", + "id" : -353 + }, + { + "name" : "minecraft:waxed_weathered_cut_copper_slab", + "id" : -367 + }, + { + "name" : "minecraft:waxed_weathered_cut_copper_stairs", + "id" : -360 + }, + { + "name" : "minecraft:waxed_weathered_double_cut_copper_slab", + "id" : -374 + }, + { + "name" : "minecraft:weathered_copper", + "id" : -342 + }, + { + "name" : "minecraft:weathered_cut_copper", + "id" : -349 + }, + { + "name" : "minecraft:weathered_cut_copper_slab", + "id" : -363 + }, + { + "name" : "minecraft:weathered_cut_copper_stairs", + "id" : -356 + }, + { + "name" : "minecraft:weathered_double_cut_copper_slab", + "id" : -370 + }, + { + "name" : "minecraft:web", + "id" : 30 + }, + { + "name" : "minecraft:weeping_vines", + "id" : -231 + }, + { + "name" : "minecraft:wheat", + "id" : 334 + }, + { + "name" : "minecraft:wheat_seeds", + "id" : 291 + }, + { + "name" : "minecraft:white_candle", + "id" : -413 + }, + { + "name" : "minecraft:white_candle_cake", + "id" : -430 + }, + { + "name" : "minecraft:white_dye", + "id" : 410 + }, + { + "name" : "minecraft:white_glazed_terracotta", + "id" : 220 + }, + { + "name" : "minecraft:witch_spawn_egg", + "id" : 452 + }, + { + "name" : "minecraft:wither_rose", + "id" : -216 + }, + { + "name" : "minecraft:wither_skeleton_spawn_egg", + "id" : 464 + }, + { + "name" : "minecraft:wolf_spawn_egg", + "id" : 439 + }, + { + "name" : "minecraft:wood", + "id" : -212 + }, + { + "name" : "minecraft:wooden_axe", + "id" : 311 + }, + { + "name" : "minecraft:wooden_button", + "id" : 143 + }, + { + "name" : "minecraft:wooden_door", + "id" : 359 + }, + { + "name" : "minecraft:wooden_hoe", + "id" : 329 + }, + { + "name" : "minecraft:wooden_pickaxe", + "id" : 310 + }, + { + "name" : "minecraft:wooden_pressure_plate", + "id" : 72 + }, + { + "name" : "minecraft:wooden_shovel", + "id" : 309 + }, + { + "name" : "minecraft:wooden_slab", + "id" : 158 + }, + { + "name" : "minecraft:wooden_sword", + "id" : 308 + }, + { + "name" : "minecraft:wool", + "id" : 35 + }, + { + "name" : "minecraft:writable_book", + "id" : 510 + }, + { + "name" : "minecraft:written_book", + "id" : 511 + }, + { + "name" : "minecraft:yellow_candle", + "id" : -417 + }, + { + "name" : "minecraft:yellow_candle_cake", + "id" : -434 + }, + { + "name" : "minecraft:yellow_dye", + "id" : 406 + }, + { + "name" : "minecraft:yellow_flower", + "id" : 37 + }, + { + "name" : "minecraft:yellow_glazed_terracotta", + "id" : 224 + }, + { + "name" : "minecraft:zoglin_spawn_egg", + "id" : 498 + }, + { + "name" : "minecraft:zombie_horse_spawn_egg", + "id" : 468 + }, + { + "name" : "minecraft:zombie_pigman_spawn_egg", + "id" : 448 + }, + { + "name" : "minecraft:zombie_spawn_egg", + "id" : 447 + }, + { + "name" : "minecraft:zombie_villager_spawn_egg", + "id" : 477 + } +] \ No newline at end of file From 9de26f2ba1a00743faaff2ef2ba98831af82e572 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 18 Oct 2021 12:58:43 -0400 Subject: [PATCH 647/766] Play thunder sounds when a lightning entity is spawned Fixes #2580 --- .../connector/entity/LightningEntity.java | 62 +++++++++++++++++++ .../connector/entity/type/EntityType.java | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java new file mode 100644 index 000000000..2255519e5 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity; + +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.concurrent.ThreadLocalRandom; + +public class LightningEntity extends Entity { + + public LightningEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { + super(entityId, geyserId, entityType, position, motion, rotation); + } + + @Override + public void spawnEntity(GeyserSession session) { + super.spawnEntity(session); + + // Add these two sound effects - they're done completely clientside on Java Edition as of 1.17.1 + ThreadLocalRandom random = ThreadLocalRandom.current(); + + PlaySoundPacket thunderPacket = new PlaySoundPacket(); + thunderPacket.setPosition(this.position); + thunderPacket.setSound("ambient.weather.thunder"); + thunderPacket.setPitch(0.8f + random.nextFloat() * 0.2f); + thunderPacket.setVolume(10000f); // Really. + session.sendUpstreamPacket(thunderPacket); + + PlaySoundPacket impactPacket = new PlaySoundPacket(); + impactPacket.setPosition(this.position); + impactPacket.setSound("ambient.weather.lightning.impact"); + impactPacket.setPitch(0.5f + random.nextFloat() * 0.2f); + impactPacket.setVolume(2.0f); + session.sendUpstreamPacket(impactPacket); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index 57ce2de3c..85f6fde5b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -133,7 +133,7 @@ public enum EntityType { WITHER_SKULL(WitherSkullEntity.class, 89, 0.3125f), BOAT(BoatEntity.class, 90, 0.6f, 1.6f, 1.6f, 0.35f), WITHER_SKULL_DANGEROUS(WitherSkullEntity.class, 91, 0f), - LIGHTNING_BOLT(Entity.class, 93, 0f), + LIGHTNING_BOLT(LightningEntity.class, 93, 0f), SMALL_FIREBALL(ItemedFireballEntity.class, 94, 0.3125f), AREA_EFFECT_CLOUD(AreaEffectCloudEntity.class, 95, 0.5f, 1.0f), MINECART_HOPPER(MinecartEntity.class, 96, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:hopper_minecart"), From 483a336b8aa544028d463414204d7d1be9d86192 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 19 Oct 2021 13:16:46 -0400 Subject: [PATCH 648/766] Fix grindstones and looms on 1.17.40 --- connector/pom.xml | 2 +- .../inventory/InventoryTranslator.java | 6 ++++-- .../translators/LoomInventoryTranslator.java | 19 ++++++++++++++++--- .../item/translators/BannerTranslator.java | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 810e99bef..c65e73b51 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -115,7 +115,7 @@ com.github.CloudburstMC.Protocol bedrock-v471 - b71f1c9 + 0bc10c8e compile diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java index b6a00982a..00d2804d3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java @@ -64,7 +64,7 @@ import java.util.*; public abstract class InventoryTranslator { public static final InventoryTranslator PLAYER_INVENTORY_TRANSLATOR = new PlayerInventoryTranslator(); - public static final Map INVENTORY_TRANSLATORS = new HashMap() { + public static final Map INVENTORY_TRANSLATORS = new HashMap<>() { { /* Player Inventory */ put(null, PLAYER_INVENTORY_TRANSLATOR); @@ -395,7 +395,9 @@ public abstract class InventoryTranslator { case CRAFT_RECIPE_AUTO: // Called by villagers case CRAFT_NON_IMPLEMENTED_DEPRECATED: // Tends to be called for UI inventories case CRAFT_RESULTS_DEPRECATED: // Tends to be called for UI inventories - case CRAFT_RECIPE_OPTIONAL: { // Anvils and cartography tables will handle this + case CRAFT_RECIPE_OPTIONAL: // Anvils and cartography tables will handle this + case CRAFT_LOOM: // Looms 1.17.40+ + case CRAFT_REPAIR_AND_DISENCHANT: { // Grindstones 1.17.40+ break; } default: diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java index c6909ec9f..2d67f8de0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java @@ -34,6 +34,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; +import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftLoomStackRequestActionData; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; @@ -118,12 +119,14 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { @Override public boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { // If the LOOM_MATERIAL slot is not empty, we are crafting a pattern that does not come from an item - return action.getType() == StackRequestActionType.CRAFT_NON_IMPLEMENTED_DEPRECATED && inventory.getItem(2).isEmpty(); + // Remove the CRAFT_NON_IMPLEMENTED_DEPRECATED when 1.17.30 is dropped + return (action.getType() == StackRequestActionType.CRAFT_NON_IMPLEMENTED_DEPRECATED || action.getType() == StackRequestActionType.CRAFT_LOOM) + && inventory.getItem(2).isEmpty(); } @Override public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { - // TODO: I anticipate this will be changed in the future to use something non-deprecated. Keep an eye out. + StackRequestActionData headerData = request.getActions()[0]; StackRequestActionData data = request.getActions()[1]; if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { return rejectRequest(request); @@ -133,8 +136,18 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { List newBlockEntityTag = craftData.getResultItems()[0].getTag().getList("Patterns", NbtType.COMPOUND); // Get the pattern that the Bedrock client requests - the last pattern in the Patterns list NbtMap pattern = newBlockEntityTag.get(newBlockEntityTag.size() - 1); + String bedrockPattern; + + if (headerData instanceof CraftLoomStackRequestActionData loomData) { + // Prioritize this if on 1.17.40 + // Remove the below if statement when 1.17.30 is dropped + bedrockPattern = loomData.getPatternId(); + } else { + bedrockPattern = pattern.getString("Pattern"); + } + // Get the Java index of this pattern - int index = PATTERN_TO_INDEX.getOrDefault(pattern.getString("Pattern"), -1); + int index = PATTERN_TO_INDEX.getOrDefault(bedrockPattern, -1); if (index == -1) { return rejectRequest(request); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java index 116e703bc..e85426647 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java @@ -145,7 +145,7 @@ public class BannerTranslator extends ItemTranslator { /** * Convert the Bedrock edition banner pattern nbt to Java edition * - * @param pattern Bedorck edition pattern nbt + * @param pattern Bedrock edition pattern nbt * @return The Java edition format pattern nbt */ public static CompoundTag getJavaBannerPattern(NbtMap pattern) { From 582da8b88a3fa67aaff454ac86e7a8e9d4d49113 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Wed, 20 Oct 2021 12:53:09 +0200 Subject: [PATCH 649/766] Only check the TeamColor of active objectives --- .../java/org/geysermc/connector/scoreboard/Scoreboard.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index 6f4b540ac..c32353b78 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -150,6 +150,13 @@ public final class Scoreboard { continue; } + // there's nothing we can do with inactive objectives + // after checking if the objective has been deleted, + // except waiting for the objective to become activated (: + if (!objective.isActive()) { + continue; + } + if (playerTeam != null && playerTeam.getColor() == objective.getTeamColor()) { correctSidebar = objective; } From 6cbbf8a8dd1c6c300884ff6a16170d9755a0917e Mon Sep 17 00:00:00 2001 From: Tim203 Date: Wed, 20 Oct 2021 21:08:25 +0200 Subject: [PATCH 650/766] A DisplayScoreboard packet should also cause the scoreboard to update --- .../JavaDisplayScoreboardTranslator.java | 16 ++++++++++++++-- .../JavaScoreboardObjectiveTranslator.java | 2 +- .../java/scoreboard/JavaTeamTranslator.java | 2 +- .../scoreboard/JavaUpdateScoreTranslator.java | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java index 577e206b9..a56e59fe7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java @@ -27,15 +27,27 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.scoreboard.Scoreboard; +import org.geysermc.connector.scoreboard.ScoreboardUpdater; @Translator(packet = ServerDisplayScoreboardPacket.class) public class JavaDisplayScoreboardTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ServerDisplayScoreboardPacket packet) { - session.getWorldCache().getScoreboard() - .displayObjective(packet.getName(), packet.getPosition()); + WorldCache worldCache = session.getWorldCache(); + Scoreboard scoreboard = worldCache.getScoreboard(); + int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); + + scoreboard.displayObjective(packet.getName(), packet.getPosition()); + + // ScoreboardUpdater will handle it for us if the packets per second + // (for score and team packets) is higher than the first threshold + if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { + scoreboard.onUpdate(); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index 30ef6568d..09e5df391 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -84,7 +84,7 @@ public class JavaScoreboardObjectiveTranslator extends PacketTranslator { } // ScoreboardUpdater will handle it for us if the packets per second - // (for score and team packets) is higher then the first threshold + // (for score and team packets) is higher than the first threshold if (pps < ScoreboardUpdater.FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { scoreboard.onUpdate(); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java index 870f89a43..79d625fc7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java @@ -99,7 +99,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator Date: Wed, 20 Oct 2021 18:42:02 -0400 Subject: [PATCH 651/766] Temporary workaround to fix null issue with components --- .../chat/GsonComponentSerializerWrapper.java | 84 +++++++++++++++++++ .../translators/chat/MessageTranslator.java | 8 +- .../title/JavaSetTitleTextTranslator.java | 2 +- .../chat/MessageTranslatorTest.java | 8 ++ 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java new file mode 100644 index 000000000..c5888c06a --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.chat; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.UnaryOperator; + +/** + * A wrapper around a normal GsonComponentSerializer to accept null components. + */ +public final class GsonComponentSerializerWrapper implements GsonComponentSerializer { + private final GsonComponentSerializer source; + + public GsonComponentSerializerWrapper(GsonComponentSerializer source) { + this.source = source; + } + + @Override + public @NotNull Gson serializer() { + return this.source.serializer(); + } + + @Override + public @NotNull UnaryOperator populator() { + return this.source.populator(); + } + + @Override + public @NotNull Component deserializeFromTree(@NotNull JsonElement input) { + // This has yet to be an issue, so it won't be overridden unless we have to + return this.source.deserializeFromTree(input); + } + + @Override + public @NotNull JsonElement serializeToTree(@NotNull Component component) { + return this.source.serializeToTree(component); + } + + @Override + public @Nullable Component deserialize(@NotNull String input) { + // See https://github.com/KyoriPowered/adventure/issues/447 + return this.serializer().fromJson(input, Component.class); + } + + @Override + public @NotNull String serialize(@NotNull Component component) { + return this.source.serialize(component); + } + + @Override + public @NotNull Builder toBuilder() { + return this.source.toBuilder(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index 1f0380f2f..520e27455 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -45,7 +45,7 @@ public class MessageTranslator { private static final TranslatableComponentRenderer RENDERER = new MinecraftTranslationRegistry(); // Possible TODO: replace the legacy hover event serializer with an empty one since we have no use for hover events - private static final GsonComponentSerializer GSON_SERIALIZER = DefaultComponentSerializer.get(); + private static final GsonComponentSerializer GSON_SERIALIZER; // Store team colors for player names private static final Map TEAM_COLORS = new EnumMap<>(TeamColor.class); @@ -86,6 +86,12 @@ public class MessageTranslator { TEAM_COLORS.put(TeamColor.BOLD, BASE + "l"); TEAM_COLORS.put(TeamColor.STRIKETHROUGH, BASE + "m"); TEAM_COLORS.put(TeamColor.ITALIC, BASE + "o"); + + // Temporary fix for https://github.com/KyoriPowered/adventure/issues/447 + GsonComponentSerializer source = DefaultComponentSerializer.get(); + GSON_SERIALIZER = new GsonComponentSerializerWrapper(source); + // Tell MCProtocolLib to use this serializer, too. + DefaultComponentSerializer.set(GSON_SERIALIZER); } /** diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java index 199d05e3b..ddaa5b677 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java @@ -38,7 +38,7 @@ public class JavaSetTitleTextTranslator extends PacketTranslator Date: Wed, 20 Oct 2021 21:38:08 -0400 Subject: [PATCH 652/766] Include more vendor information and flags in Geyser dump --- .../command/defaults/DumpCommand.java | 9 ++++- .../org/geysermc/connector/dump/DumpInfo.java | 39 ++++++++++++++++--- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java index 0a1c81114..075bfbbcd 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java @@ -25,6 +25,8 @@ package org.geysermc.connector.command.defaults; +import com.fasterxml.jackson.core.util.DefaultIndenter; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.geysermc.common.PlatformType; @@ -79,10 +81,13 @@ public class DumpCommand extends GeyserCommand { AsteriskSerializer.showSensitive = showSensitive; sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collecting", sender.getLocale())); - String dumpData = ""; + String dumpData; try { if (offlineDump) { - dumpData = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new DumpInfo(addLog)); + DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter(); + // Make arrays easier to read + prettyPrinter.indentArraysWith(new DefaultIndenter(" ", "\n")); + dumpData = MAPPER.writer(prettyPrinter).writeValueAsString(new DumpInfo(addLog)); } else { dumpData = MAPPER.writeValueAsString(new DumpInfo(addLog)); } diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index d6a5f0725..3f566ee26 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -31,6 +31,7 @@ import com.github.steveice10.mc.protocol.MinecraftConstants; import com.google.common.hash.Hashing; import com.google.common.io.ByteSource; import com.google.common.io.Files; +import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import lombok.AllArgsConstructor; @@ -48,8 +49,13 @@ import org.geysermc.floodgate.util.FloodgateInfoHolder; import java.io.File; import java.io.IOException; -import java.net.*; +import java.lang.management.ManagementFactory; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.UnknownHostException; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.stream.Collectors; @@ -68,6 +74,7 @@ public class DumpInfo { private final RamInfo ramInfo; private LogsInfo logsInfo; private final BootstrapDumpInfo bootstrapInfo; + private final FlagsInfo flagsInfo; public DumpInfo(boolean addLog) { this.versionInfo = new VersionInfo(); @@ -113,12 +120,16 @@ public class DumpInfo { } this.bootstrapInfo = GeyserConnector.getInstance().getBootstrap().getDumpInfo(); + + this.flagsInfo = new FlagsInfo(); } @Getter public static class VersionInfo { private final String name; private final String version; + private final String javaName; + private final String javaVendor; private final String javaVersion; private final String architecture; private final String operatingSystem; @@ -130,7 +141,9 @@ public class DumpInfo { VersionInfo() { this.name = GeyserConnector.NAME; this.version = GeyserConnector.VERSION; - this.javaVersion = System.getProperty("java.version"); + this.javaName = System.getProperty("java.vm.name"); + this.javaVendor = System.getProperty("java.vendor"); + this.javaVersion = ManagementFactory.getRuntimeMXBean().getVmVersion(); // Gives a little more to the version we can use over the system property // Usually gives Java architecture but still may be helpful. this.architecture = System.getProperty("os.arch"); this.operatingSystem = System.getProperty("os.name"); @@ -171,14 +184,16 @@ public class DumpInfo { @Getter public static class MCInfo { - private final String bedrockVersion; - private final int bedrockProtocol; + private final List bedrockVersions; + private final List bedrockProtocols; + private final int defaultBedrockProtocol; private final String javaVersion; private final int javaProtocol; MCInfo() { - this.bedrockVersion = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion(); - this.bedrockProtocol = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion(); + this.bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList(); + this.bedrockProtocols = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList(); + this.defaultBedrockProtocol = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion(); this.javaVersion = MinecraftConstants.GAME_VERSION; this.javaProtocol = MinecraftConstants.PROTOCOL_VERSION; } @@ -230,4 +245,16 @@ public class DumpInfo { this.max = Runtime.getRuntime().maxMemory() / MEGABYTE; } } + + /** + * E.G. `-Xmx1024M` - all runtime JVM flags on this machine + */ + @Getter + public static class FlagsInfo { + private final List flags; + + FlagsInfo() { + this.flags = ManagementFactory.getRuntimeMXBean().getInputArguments(); + } + } } From 9a159bf8be2111d30b95b73331369f04c7ed006b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Fri, 22 Oct 2021 23:31:40 -0400 Subject: [PATCH 653/766] Fix instances of invisible/flickering scoreboards --- .../geysermc/connector/scoreboard/Objective.java | 14 -------------- .../geysermc/connector/scoreboard/Scoreboard.java | 12 +++++++----- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java index 41d35d42f..5a7748f79 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java @@ -150,20 +150,6 @@ public final class Objective { updateType = UpdateType.REMOVE; } - public ScoreboardPosition getPositionCategory() { - return switch (displaySlot) { - case PLAYER_LIST -> ScoreboardPosition.PLAYER_LIST; - case BELOW_NAME -> ScoreboardPosition.BELOW_NAME; - default -> ScoreboardPosition.SIDEBAR; - }; - } - - public boolean hasTeamColor() { - return displaySlot != ScoreboardPosition.PLAYER_LIST && - displaySlot != ScoreboardPosition.BELOW_NAME && - displaySlot != ScoreboardPosition.SIDEBAR; - } - public TeamColor getTeamColor() { return switch (displaySlot) { case SIDEBAR_TEAM_RED -> TeamColor.RED; diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index c32353b78..682ff8331 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -104,7 +104,7 @@ public final class Scoreboard { Objective storedObjective = objectiveSlots.get(displaySlot); if (storedObjective != null && storedObjective != objective) { - objective.pendingRemove(); + storedObjective.pendingRemove(); } objectiveSlots.put(displaySlot, objective); @@ -166,6 +166,12 @@ public final class Scoreboard { correctSidebar = objectiveSlots.get(ScoreboardPosition.SIDEBAR); } + for (Objective objective : removedObjectives) { + // Deletion must be handled before the active objectives are handled - otherwise if a scoreboard display is changed before the current + // scoreboard is removed, the client can crash + deleteObjective(objective, true); + } + handleObjective(objectiveSlots.get(ScoreboardPosition.PLAYER_LIST), addScores, removeScores); handleObjective(correctSidebar, addScores, removeScores); handleObjective(objectiveSlots.get(ScoreboardPosition.BELOW_NAME), addScores, removeScores); @@ -194,10 +200,6 @@ public final class Scoreboard { session.sendUpstreamPacket(setScorePacket); } - for (Objective objective : removedObjectives) { - deleteObjective(objective, true); - } - lastAddScoreCount = addScores.size(); lastRemoveScoreCount = removeScores.size(); } From a257211b01485da02b0af8eb1243b229269912b0 Mon Sep 17 00:00:00 2001 From: Redned Date: Thu, 28 Oct 2021 18:49:58 -0500 Subject: [PATCH 654/766] Update README to reflect we support 1.17.41 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 062da91eb..f1c20441b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,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.17.10 - 1.17.40 and Minecraft Java 1.17.1. +### Currently supporting Minecraft Bedrock 1.17.10 - 1.17.41 and Minecraft Java 1.17.1. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. From 362a21a4b1a9130e28aee71ba402cd433a255f39 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 29 Oct 2021 10:59:59 -0400 Subject: [PATCH 655/766] Use Jitpack for Adventure to fix boolean string serialization Fixes #2596 --- connector/pom.xml | 21 +++++++++++++++++-- .../translators/nbt/BasicItemTranslator.java | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index c65e73b51..c12c0d24f 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -11,7 +11,7 @@ connector - 4.9.2 + 3d6eaaf63f 8.5.2 2.12.4 4.1.66.Final @@ -160,6 +160,10 @@ com.github.steveice10 mcauthlib + + net.kyori + * + @@ -223,7 +227,20 @@ - net.kyori + com.github.KyoriPowered.adventure + adventure-text-serializer-gson + ${adventure.version} + compile + + + com.github.KyoriPowered.adventure + adventure-text-serializer-gson-legacy-impl + ${adventure.version} + compile + + + + com.github.KyoriPowered.adventure adventure-text-serializer-legacy ${adventure.version} compile diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java index 58d72de0e..b6b1dfac6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java @@ -56,10 +56,10 @@ public class BasicItemTranslator extends NbtItemStackTranslator { return; } - ListTag loreTag = displayTag.get("Lore"); - if (loreTag != null) { + Tag loreTag = displayTag.get("Lore"); + if (loreTag instanceof ListTag listTag) { List lore = new ArrayList<>(); - for (Tag tag : loreTag.getValue()) { + for (Tag tag : listTag.getValue()) { if (!(tag instanceof StringTag)) continue; lore.add(new StringTag("", MessageTranslator.convertMessageLenient(((StringTag) tag).getValue(), session.getLocale()))); } From 1316f6e1da26789976586c1ac71a725653914221 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 29 Oct 2021 11:18:32 -0400 Subject: [PATCH 656/766] Don't use Jitpack but instead a static snapshot --- connector/pom.xml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index c12c0d24f..c056eb771 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -11,7 +11,7 @@ connector - 3d6eaaf63f + 4.10.0-20211011.045617-12 8.5.2 2.12.4 4.1.66.Final @@ -227,20 +227,19 @@ - com.github.KyoriPowered.adventure + net.kyori adventure-text-serializer-gson ${adventure.version} compile - com.github.KyoriPowered.adventure + net.kyori adventure-text-serializer-gson-legacy-impl ${adventure.version} compile - - com.github.KyoriPowered.adventure + net.kyori adventure-text-serializer-legacy ${adventure.version} compile From c115afba85ed4c816c3cc8c3c16baf33e7d991fe Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 30 Oct 2021 20:47:49 -0400 Subject: [PATCH 657/766] Add exception handling to the scoreboard updater --- .../scoreboard/ScoreboardUpdater.java | 114 +++++++++--------- 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java b/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java index 2fb21337e..a7d936513 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java @@ -62,82 +62,88 @@ public final class ScoreboardUpdater extends Thread { @Override public void run() { while (!connector.isShuttingDown()) { - long timeTillAction = getTimeTillNextAction(); - if (timeTillAction > 0) { - sleepFor(timeTillAction); - continue; - } + try { + long timeTillAction = getTimeTillNextAction(); + if (timeTillAction > 0) { + sleepFor(timeTillAction); + continue; + } - long currentTime = System.currentTimeMillis(); + long currentTime = System.currentTimeMillis(); - // reset score-packets per second every second - if (currentTime - lastPacketsPerSecondUpdate >= 1000) { - lastPacketsPerSecondUpdate = currentTime; - for (GeyserSession session : connector.getPlayers()) { - ScoreboardSession scoreboardSession = session.getWorldCache().getScoreboardSession(); + // reset score-packets per second every second + if (currentTime - lastPacketsPerSecondUpdate >= 1000) { + lastPacketsPerSecondUpdate = currentTime; + for (GeyserSession session : connector.getPlayers()) { + ScoreboardSession scoreboardSession = session.getWorldCache().getScoreboardSession(); - int oldPps = scoreboardSession.getPacketsPerSecond(); - int newPps = scoreboardSession.getPendingPacketsPerSecond().get(); + int oldPps = scoreboardSession.getPacketsPerSecond(); + int newPps = scoreboardSession.getPendingPacketsPerSecond().get(); - scoreboardSession.packetsPerSecond = newPps; - scoreboardSession.pendingPacketsPerSecond.set(0); + scoreboardSession.packetsPerSecond = newPps; + scoreboardSession.pendingPacketsPerSecond.set(0); - // just making sure that all updates are pushed before giving up control - if (oldPps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD && - newPps < FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { - session.getWorldCache().getScoreboard().onUpdate(); + // just making sure that all updates are pushed before giving up control + if (oldPps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD && + newPps < FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { + session.getWorldCache().getScoreboard().onUpdate(); + } } } - } - if (currentTime - lastUpdate >= FIRST_MILLIS_BETWEEN_UPDATES) { - lastUpdate = currentTime; + if (currentTime - lastUpdate >= FIRST_MILLIS_BETWEEN_UPDATES) { + lastUpdate = currentTime; - for (GeyserSession session : connector.getPlayers()) { - WorldCache worldCache = session.getWorldCache(); - ScoreboardSession scoreboardSession = worldCache.getScoreboardSession(); + for (GeyserSession session : connector.getPlayers()) { + WorldCache worldCache = session.getWorldCache(); + ScoreboardSession scoreboardSession = worldCache.getScoreboardSession(); - int pps = scoreboardSession.getPacketsPerSecond(); - if (pps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { - boolean reachedSecondThreshold = pps >= SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD; + int pps = scoreboardSession.getPacketsPerSecond(); + if (pps >= FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD) { + boolean reachedSecondThreshold = pps >= SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD; - int millisBetweenUpdates = reachedSecondThreshold ? - SECOND_MILLIS_BETWEEN_UPDATES : - FIRST_MILLIS_BETWEEN_UPDATES; + int millisBetweenUpdates = reachedSecondThreshold ? + SECOND_MILLIS_BETWEEN_UPDATES : + FIRST_MILLIS_BETWEEN_UPDATES; - if (currentTime - scoreboardSession.lastUpdate >= millisBetweenUpdates) { - worldCache.getScoreboard().onUpdate(); - scoreboardSession.lastUpdate = currentTime; + if (currentTime - scoreboardSession.lastUpdate >= millisBetweenUpdates) { + worldCache.getScoreboard().onUpdate(); + scoreboardSession.lastUpdate = currentTime; - if (DEBUG_ENABLED && (currentTime - scoreboardSession.lastLog >= 60000)) { // one minute - int threshold = reachedSecondThreshold ? - SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD : - FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; + if (DEBUG_ENABLED && (currentTime - scoreboardSession.lastLog >= 60000)) { // one minute + int threshold = reachedSecondThreshold ? + SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD : + FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; - connector.getLogger().info( - LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + - LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) - ); + connector.getLogger().info( + LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + + LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) + ); - scoreboardSession.lastLog = currentTime; + scoreboardSession.lastLog = currentTime; + } } } } } - } - if (DEBUG_ENABLED) { - long timeSpent = System.currentTimeMillis() - currentTime; - if (timeSpent > 0) { - connector.getLogger().info(String.format( - "Scoreboard updater: took %s ms. Updated %s players", - timeSpent, connector.getPlayers().size() - )); + if (DEBUG_ENABLED) { + long timeSpent = System.currentTimeMillis() - currentTime; + if (timeSpent > 0) { + connector.getLogger().info(String.format( + "Scoreboard updater: took %s ms. Updated %s players", + timeSpent, connector.getPlayers().size() + )); + } } - } - long timeTillNextAction = getTimeTillNextAction(); - sleepFor(timeTillNextAction); + long timeTillNextAction = getTimeTillNextAction(); + sleepFor(timeTillNextAction); + } catch (Throwable e) { + connector.getLogger().error("Error while translating scoreboard information!", e); + // Wait so we don't try to run the scoreboard immediately after this + sleepFor(FIRST_MILLIS_BETWEEN_UPDATES); + } } } From f883dfdf2cc7511a3177f3ce89ee244d79d7c935 Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Sat, 30 Oct 2021 21:57:54 -0400 Subject: [PATCH 658/766] Remove commands from autocomplete/help list that cannot be run (#2602) * only tabcomplete for commands the sender has permission for * set permission defaults for spigot * Make velocity autocomplete on arg length 0 and 1 * fix advancements perm in spigot plugin.yml and add settings perm (whoops) * don't show bedrock commands to java players * modify spigot perm defaults * censor help menu, abstract tab complete code * Bedrock players don't get cmd argument suggestions * update spigot plugin.yml --- .../command/BungeeCommandSender.java | 5 +++ .../command/GeyserBungeeCommandExecutor.java | 7 ++-- .../command/GeyserSpigotCommandExecutor.java | 6 +-- .../spigot/command/SpigotCommandSender.java | 5 +++ .../spigot/src/main/resources/plugin.yml | 31 +++++++++----- .../command/GeyserSpongeCommandExecutor.java | 6 +-- .../sponge/command/SpongeCommandSender.java | 5 +++ .../standalone/GeyserStandaloneLogger.java | 5 +++ .../GeyserVelocityCommandExecutor.java | 9 +++-- .../command/VelocityCommandSender.java | 5 +++ .../connector/command/CommandExecutor.java | 40 +++++++++++++++++++ .../connector/command/CommandSender.java | 8 ++++ .../command/defaults/HelpCommand.java | 27 ++++++++++--- .../network/session/GeyserSession.java | 3 +- 14 files changed, 132 insertions(+), 30 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java index 1f3a875b2..4cda47af7 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java @@ -63,4 +63,9 @@ public class BungeeCommandSender implements CommandSender { } return LanguageUtils.getDefaultLocale(); } + + @Override + public boolean hasPermission(String permission) { + return handle.hasPermission(permission); + } } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index b391d7b1c..07a1fd897 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -35,8 +35,8 @@ import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; public class GeyserBungeeCommandExecutor extends Command implements TabExecutor { @@ -82,8 +82,9 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor @Override public Iterable onTabComplete(CommandSender sender, String[] args) { if (args.length == 1) { - return connector.getCommandManager().getCommandNames(); + return commandExecutor.tabComplete(new BungeeCommandSender(sender)); + } else { + return Collections.emptyList(); } - return new ArrayList<>(); } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java index 6cdcdae67..384fcf13a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java @@ -35,8 +35,8 @@ import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabExecutor { @@ -78,8 +78,8 @@ public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabE @Override public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { if (args.length == 1) { - return connector.getCommandManager().getCommandNames(); + return tabComplete(new SpigotCommandSender(sender)); } - return new ArrayList<>(); + return Collections.emptyList(); } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java index 16533623a..9cd6d672f 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java @@ -73,6 +73,11 @@ public class SpigotCommandSender implements CommandSender { return locale; } + @Override + public boolean hasPermission(String permission) { + return handle.hasPermission(permission); + } + /** * Set if we are on pre-1.12, and therefore {@code player.getLocale()} doesn't exist and we have to get * {@code player.spigot().getLocale()}. diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index 0171abd70..7edd14520 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -8,21 +8,32 @@ api-version: 1.13 commands: geyser: description: The main command for Geyser. - usage: /geyser help + usage: /geyser permissions: geyser.command.help: description: Shows help for all registered commands. - geyser.command.advancement: - description: Shows the advancements of the player on the server. - geyser.command.dump: - description: Dumps Geyser debug information for bug reports. - geyser.command.list: - description: List all players connected through Geyser. + default: true geyser.command.offhand: description: Puts an items in your offhand. - geyser.command.reload: - description: Reloads the Geyser configurations. Kicks all players when used! + default: true + geyser.command.advancements: + description: Shows the advancements of the player on the server. + default: true geyser.command.statistics: description: Shows the statistics of the player on the server. + default: true + geyser.command.settings: + description: Modify user settings + default: true + geyser.command.list: + description: List all players connected through Geyser. + default: op + geyser.command.dump: + description: Dumps Geyser debug information for bug reports. + default: op + geyser.command.reload: + description: Reloads the Geyser configurations. Kicks all players when used! + default: false geyser.command.version: - description: Shows the current Geyser version and checks for updates. \ No newline at end of file + description: Shows the current Geyser version and checks for updates. + default: op \ No newline at end of file diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java index 0e46413cc..cff6d24d7 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java @@ -40,8 +40,8 @@ import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Optional; @@ -82,9 +82,9 @@ public class GeyserSpongeCommandExecutor extends CommandExecutor implements Comm @Override public List getSuggestions(CommandSource source, String arguments, @Nullable Location targetPosition) { if (arguments.split(" ").length == 1) { - return connector.getCommandManager().getCommandNames(); + return tabComplete(new SpongeCommandSender(source)); } - return new ArrayList<>(); + return Collections.emptyList(); } @Override diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java index 4616e400b..d2167d80b 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java @@ -51,4 +51,9 @@ public class SpongeCommandSender implements CommandSender { public boolean isConsole() { return handle instanceof ConsoleSource; } + + @Override + public boolean hasPermission(String permission) { + return handle.hasPermission(permission); + } } diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java index 5255dc16f..94d5857db 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java @@ -110,4 +110,9 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey public boolean isConsole() { return true; } + + @Override + public boolean hasPermission(String permission) { + return true; + } } diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java index c8998d8fe..6f47b8791 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java @@ -34,8 +34,8 @@ import org.geysermc.connector.common.ChatColor; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; public class GeyserVelocityCommandExecutor extends CommandExecutor implements SimpleCommand { @@ -71,9 +71,10 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si @Override public List suggest(Invocation invocation) { - if (invocation.arguments().length == 0) { - return connector.getCommandManager().getCommandNames(); + // Velocity seems to do the splitting a bit differently. This results in the same behaviour in bungeecord/spigot. + if (invocation.arguments().length == 0 || invocation.arguments().length == 1) { + return tabComplete(new VelocityCommandSender(invocation.source())); } - return new ArrayList<>(); + return Collections.emptyList(); } } diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java index 21069acbb..140711a7c 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java @@ -72,4 +72,9 @@ public class VelocityCommandSender implements CommandSender { } return LanguageUtils.getDefaultLocale(); } + + @Override + public boolean hasPermission(String permission) { + return handle.hasPermission(permission); + } } diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java b/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java index 751f51260..913c39c5e 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java @@ -29,6 +29,11 @@ import lombok.AllArgsConstructor; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + /** * Represents helper functions for listening to {@code /geyser} commands. */ @@ -53,4 +58,39 @@ public class CommandExecutor { } return null; } + + /** + * Determine which subcommands to suggest in the tab complete for the main /geyser command by a given command sender. + * + * @param sender The command sender to receive the tab complete suggestions. + * If the command sender is a bedrock player, an empty list will be returned as bedrock players do not get command argument suggestions. + * If the command sender is not a bedrock player, bedrock commands will not be shown. + * If the command sender does not have the permission for a given command, the command will not be shown. + * @return A list of command names to include in the tab complete + */ + public List tabComplete(CommandSender sender) { + if (getGeyserSession(sender) != null) { + // Bedrock doesn't get tab completions or argument suggestions + return Collections.emptyList(); + } + + List availableCommands = new ArrayList<>(); + Map commands = connector.getCommandManager().getCommands(); + + // Only show commands they have permission to use + for (String name : commands.keySet()) { + GeyserCommand geyserCommand = commands.get(name); + if (sender.hasPermission(geyserCommand.getPermission())) { + + if (geyserCommand.isBedrockOnly()) { + // Don't show commands the JE player can't run + continue; + } + + availableCommands.add(name); + } + } + + return availableCommands; + } } diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandSender.java b/connector/src/main/java/org/geysermc/connector/command/CommandSender.java index 78d12aadb..9fa8673f4 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandSender.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandSender.java @@ -56,4 +56,12 @@ public interface CommandSender { default String getLocale() { return LanguageUtils.getDefaultLocale(); } + + /** + * Checks if the CommandSender has a permission + * + * @param permission The permission node to check + * @return true if the CommandSender has the requested permission, false if not + */ + boolean hasPermission(String permission); } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java index 53968e40b..c180a473d 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java @@ -33,9 +33,7 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; import java.util.Collections; -import java.util.List; import java.util.Map; -import java.util.stream.Collectors; public class HelpCommand extends GeyserCommand { private final GeyserConnector connector; @@ -47,16 +45,33 @@ public class HelpCommand extends GeyserCommand { this.setAliases(Collections.singletonList("?")); } + /** + * Sends the help menu to a command sender. Will not show certain commands depending on the command sender and session. + * + * @param session The Geyser session of the command sender, if it is a bedrock player. If null, bedrock-only commands will be hidden. + * @param sender The CommandSender to send the help message to. + * @param args Not used. + */ @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { int page = 1; int maxPage = 1; String header = LanguageUtils.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); - sender.sendMessage(header); + Map cmds = connector.getCommandManager().getCommands(); - List commands = connector.getCommandManager().getCommands().keySet().stream().sorted().collect(Collectors.toList()); - commands.forEach(cmd -> sender.sendMessage(ChatColor.YELLOW + "/geyser " + cmd + ChatColor.WHITE + ": " + - LanguageUtils.getPlayerLocaleString(cmds.get(cmd).getDescription(), sender.getLocale()))); + for (String cmdName : cmds.keySet()) { + GeyserCommand cmd = cmds.get(cmdName); + + if (sender.hasPermission(cmd.getPermission())) { + // Only list commands the player can actually run + if (cmd.isBedrockOnly() && session == null) { + continue; + } + + sender.sendMessage(ChatColor.YELLOW + "/geyser " + cmdName + ChatColor.WHITE + ": " + + LanguageUtils.getPlayerLocaleString(cmd.getDescription(), sender.getLocale())); + } + } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index e5009938d..db4d1fd8f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -1381,7 +1381,8 @@ public class GeyserSession implements CommandSender { * @param permission The permission node to check * @return true if the player has the requested permission, false if not */ - public Boolean hasPermission(String permission) { + @Override + public boolean hasPermission(String permission) { return connector.getWorldManager().hasPermission(this, permission); } From eb211884de765de89291b52a5414517ed61f9e0c Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Sat, 30 Oct 2021 23:22:04 -0400 Subject: [PATCH 659/766] Add client option to hide custom skulls (#2603) --- .../org/geysermc/connector/GeyserConnector.java | 1 - .../network/session/cache/PreferencesCache.java | 16 ++++++++++++++++ .../world/JavaUpdateTileEntityTranslator.java | 2 +- .../org/geysermc/connector/utils/ChunkUtils.java | 2 +- .../geysermc/connector/utils/SettingsUtils.java | 13 ++++++++++++- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 37bfd2413..17deca915 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -231,7 +231,6 @@ public class GeyserConnector { CooldownUtils.setDefaultShowCooldown(config.getShowCooldown()); DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether - SkullBlockEntityTranslator.ALLOW_CUSTOM_SKULLS = config.isAllowCustomSkulls(); // https://github.com/GeyserMC/Geyser/issues/957 RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu(); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java index d477066c2..310ef7911 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java @@ -41,11 +41,18 @@ public class PreferencesCache { */ @Setter private boolean prefersShowCoordinates = true; + /** * If the client's preference will be ignored, this will return false. */ private boolean allowShowCoordinates; + /** + * If the session wants custom skulls to be shown. + */ + @Setter + private boolean prefersCustomSkulls; + /** * Which CooldownType the client prefers. Initially set to {@link CooldownUtils#getDefaultShowCooldown()}. */ @@ -54,6 +61,8 @@ public class PreferencesCache { public PreferencesCache(GeyserSession session) { this.session = session; + + prefersCustomSkulls = session.getConnector().getConfig().isAllowCustomSkulls(); } /** @@ -68,4 +77,11 @@ public class PreferencesCache { allowShowCoordinates = !session.isReducedDebugInfo() && session.getConnector().getConfig().isShowCoordinates(); session.sendGameRule("showcoordinates", allowShowCoordinates && prefersShowCoordinates); } + + /** + * @return true if the session prefers custom skulls, and the config allows them. + */ + public boolean showCustomSkulls() { + return prefersCustomSkulls && session.getConnector().getConfig().isAllowCustomSkulls(); + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java index 25c4684b1..9acceb0a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java @@ -63,7 +63,7 @@ public class JavaUpdateTileEntityTranslator extends PacketTranslator= 2 || session.hasPermission("geyser.settings.server"); @@ -122,6 +129,10 @@ public class SettingsUtils { CooldownUtils.CooldownType cooldownType = CooldownUtils.CooldownType.VALUES[(int) response.next()]; session.getPreferencesCache().setCooldownPreference(cooldownType); } + + if (session.getConnector().getConfig().isAllowCustomSkulls()) { + session.getPreferencesCache().setPrefersCustomSkulls(response.next()); + } } if (canModifyServer) { From 1929a5be83c6d98767aa497ebec743d1a85bfece Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Sun, 31 Oct 2021 01:22:41 -0400 Subject: [PATCH 660/766] Fix help command (#2604) * Always pass session to execute() if the sender is a geyser player * cleanup --- .../command/GeyserBungeeCommandExecutor.java | 19 +++++++++---------- .../command/GeyserSpigotCommandExecutor.java | 16 +++++++--------- .../command/GeyserSpongeCommandExecutor.java | 16 +++++++--------- .../GeyserVelocityCommandExecutor.java | 16 +++++++--------- .../connector/command/CommandExecutor.java | 2 ++ 5 files changed, 32 insertions(+), 37 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index 07a1fd897..44edeb336 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -35,6 +35,7 @@ import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; +import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collections; @@ -52,30 +53,28 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor @Override public void execute(CommandSender sender, String[] args) { + BungeeCommandSender commandSender = new BungeeCommandSender(sender); + GeyserSession session = this.commandExecutor.getGeyserSession(commandSender); + if (args.length > 0) { GeyserCommand command = this.commandExecutor.getCommand(args[0]); if (command != null) { - BungeeCommandSender commandSender = new BungeeCommandSender(sender); if (!sender.hasPermission(command.getPermission())) { String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", commandSender.getLocale()); commandSender.sendMessage(ChatColor.RED + message); return; } - GeyserSession session = null; - if (command.isBedrockOnly()) { - session = this.commandExecutor.getGeyserSession(commandSender); - if (session == null) { - String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale()); + if (command.isBedrockOnly() && session == null) { + String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale()); - commandSender.sendMessage(ChatColor.RED + message); - return; - } + commandSender.sendMessage(ChatColor.RED + message); + return; } command.execute(session, commandSender, args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]); } } else { - this.commandExecutor.getCommand("help").execute(null, new BungeeCommandSender(sender), new String[0]); + this.commandExecutor.getCommand("help").execute(session, commandSender, new String[0]); } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java index 384fcf13a..14459a35a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java @@ -47,29 +47,27 @@ public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabE @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + SpigotCommandSender commandSender = new SpigotCommandSender(sender); + GeyserSession session = getGeyserSession(commandSender); + if (args.length > 0) { GeyserCommand geyserCommand = getCommand(args[0]); if (geyserCommand != null) { - SpigotCommandSender commandSender = new SpigotCommandSender(sender); if (!sender.hasPermission(geyserCommand.getPermission())) { String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", commandSender.getLocale()); commandSender.sendMessage(ChatColor.RED + message); return true; } - GeyserSession session = null; - if (geyserCommand.isBedrockOnly()) { - session = getGeyserSession(commandSender); - if (session == null) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale())); - return true; - } + if (geyserCommand.isBedrockOnly() && session == null) { + sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale())); + return true; } geyserCommand.execute(session, commandSender, args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]); return true; } } else { - getCommand("help").execute(null, new SpigotCommandSender(sender), new String[0]); + getCommand("help").execute(session, commandSender, new String[0]); return true; } return true; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java index cff6d24d7..10c361335 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java @@ -53,28 +53,26 @@ public class GeyserSpongeCommandExecutor extends CommandExecutor implements Comm @Override public CommandResult process(CommandSource source, String arguments) { + CommandSender commandSender = new SpongeCommandSender(source); + GeyserSession session = getGeyserSession(commandSender); + String[] args = arguments.split(" "); if (args.length > 0) { GeyserCommand command = getCommand(args[0]); if (command != null) { - CommandSender commandSender = new SpongeCommandSender(source); if (!source.hasPermission(command.getPermission())) { // Not ideal to use log here but we dont get a session source.sendMessage(Text.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.permission_fail"))); return CommandResult.success(); } - GeyserSession session = null; - if (command.isBedrockOnly()) { - session = getGeyserSession(commandSender); - if (session == null) { - source.sendMessage(Text.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only"))); - return CommandResult.success(); - } + if (command.isBedrockOnly() && session == null) { + source.sendMessage(Text.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only"))); + return CommandResult.success(); } getCommand(args[0]).execute(session, commandSender, args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]); } } else { - getCommand("help").execute(null, new SpongeCommandSender(source), new String[0]); + getCommand("help").execute(session, commandSender, new String[0]); } return CommandResult.success(); } diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java index 6f47b8791..ab9edd1e0 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java @@ -46,26 +46,24 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si @Override public void execute(Invocation invocation) { + CommandSender sender = new VelocityCommandSender(invocation.source()); + GeyserSession session = getGeyserSession(sender); + if (invocation.arguments().length > 0) { GeyserCommand command = getCommand(invocation.arguments()[0]); if (command != null) { - CommandSender sender = new VelocityCommandSender(invocation.source()); if (!invocation.source().hasPermission(getCommand(invocation.arguments()[0]).getPermission())) { sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; } - GeyserSession session = null; - if (command.isBedrockOnly()) { - session = getGeyserSession(sender); - if (session == null) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale())); - return; - } + if (command.isBedrockOnly() && session == null) { + sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale())); + return; } command.execute(session, sender, invocation.arguments().length > 1 ? Arrays.copyOfRange(invocation.arguments(), 1, invocation.arguments().length) : new String[0]); } } else { - getCommand("help").execute(null, new VelocityCommandSender(invocation.source()), new String[0]); + getCommand("help").execute(session, sender, new String[0]); } } diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java b/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java index 913c39c5e..26dd8125a 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java @@ -29,6 +29,7 @@ import lombok.AllArgsConstructor; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -46,6 +47,7 @@ public class CommandExecutor { return connector.getCommandManager().getCommands().get(label); } + @Nullable public GeyserSession getGeyserSession(CommandSender sender) { if (sender.isConsole()) { return null; From 96cbc54334b0474f36701fa2ace2404b49a33c68 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 31 Oct 2021 15:04:04 -0400 Subject: [PATCH 661/766] Update to Adventure 4.9.3 --- connector/pom.xml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index c056eb771..755828467 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -11,7 +11,7 @@ connector - 4.10.0-20211011.045617-12 + 4.9.3 8.5.2 2.12.4 4.1.66.Final @@ -149,7 +149,7 @@ com.github.GeyserMC MCProtocolLib - f1ac2de + c2985e8 compile @@ -160,10 +160,6 @@ com.github.steveice10 mcauthlib - - net.kyori - * - @@ -226,18 +222,6 @@ osx-x86_64 - - net.kyori - adventure-text-serializer-gson - ${adventure.version} - compile - - - net.kyori - adventure-text-serializer-gson-legacy-impl - ${adventure.version} - compile - net.kyori adventure-text-serializer-legacy From 6da6636a98b6d31e73ab0c0b7d05a62ebb0076ae Mon Sep 17 00:00:00 2001 From: HeroCC Date: Mon, 1 Nov 2021 12:26:08 -0400 Subject: [PATCH 662/766] Remove broken HitCounter from README.md (#2583) --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f1c20441b..94c42035c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Build Status](https://ci.opencollab.dev/job/Geyser/job/master/badge/icon)](https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/master/) [![Discord](https://img.shields.io/discord/613163671870242838.svg?color=%237289da&label=discord)](https://discord.gg/geysermc) -[![HitCount](http://hits.dwyl.com/Geyser/GeyserMC.svg)](http://hits.dwyl.com/Geyser/GeyserMC) [![Crowdin](https://badges.crowdin.net/geyser/localized.svg)](https://translate.geysermc.org/) Geyser is a bridge between Minecraft: Bedrock Edition and Minecraft: Java Edition, closing the gap from those wanting to play true cross-platform. From 6cda15cb8d8ae48cecdf5ac6c92849940f57a3e8 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 1 Nov 2021 21:49:20 -0400 Subject: [PATCH 663/766] Check if bucket sounds should be played in adventure mode Fixes #2608 --- .../sound/BlockSoundInteractionHandler.java | 40 +++++++++++++++++++ .../block/BucketSoundInteractionHandler.java | 7 +++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java b/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java index 04a879dc9..22ccd158c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java @@ -25,10 +25,16 @@ package org.geysermc.connector.network.translators.sound; +import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.ListTag; +import com.github.steveice10.opennbt.tag.builtin.StringTag; +import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.Registries; +import org.geysermc.connector.utils.BlockUtils; import java.util.Map; @@ -88,4 +94,38 @@ public interface BlockSoundInteractionHandler extends SoundInteractionHandler Date: Thu, 4 Nov 2021 13:54:50 -0400 Subject: [PATCH 664/766] update submodules (#2615) --- connector/src/main/resources/languages | 2 +- connector/src/main/resources/mappings | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index b3ef0d567..d12420771 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit b3ef0d567d2e088a3b900741a464ad00524e9beb +Subproject commit d12420771ea5e13083b3556552298d164767aae9 diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 3a2f75a27..7ff1b6567 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 3a2f75a2760923ec1aa7aaf70a2f00d566ef069e +Subproject commit 7ff1b6567b56c7b0b8e28786b9bbc30abfaededf From c18404cb52b3c4ab9abf14d0303aba2539a4c936 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sun, 7 Nov 2021 15:41:08 +0100 Subject: [PATCH 665/766] Updated to global api v2 --- common/pom.xml | 6 +++++ .../org/geysermc/floodgate/news/NewsItem.java | 24 ++++--------------- .../geysermc/connector/utils/Constants.java | 2 +- .../geysermc/connector/utils/NewsHandler.java | 6 +---- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index a3e86ff9b..a76ded3cf 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -10,6 +10,12 @@ common + + + 8 + 8 + + org.geysermc.cumulus diff --git a/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java b/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java index be0634a6d..5d9cd9d27 100644 --- a/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java +++ b/common/src/main/java/org/geysermc/floodgate/news/NewsItem.java @@ -35,23 +35,21 @@ import java.util.Set; public final class NewsItem { private final int id; - private final String project; private final boolean active; private final NewsType type; private final ItemData data; - private final boolean priority; private final String message; private final Set actions; private final String url; - private NewsItem(int id, String project, boolean active, NewsType type, ItemData data, - boolean priority, String message, Set actions, String url) { + private NewsItem( + int id, boolean active, NewsType type, ItemData data, + String message, Set actions, String url) { + this.id = id; - this.project = project; this.active = active; this.type = type; this.data = data; - this.priority = priority; this.message = message; this.actions = Collections.unmodifiableSet(actions); this.url = url; @@ -81,11 +79,9 @@ public final class NewsItem { return new NewsItem( newsItem.get("id").getAsInt(), - newsItem.get("project").getAsString(), newsItem.get("active").getAsBoolean(), newsType, newsType.read(newsItem.getAsJsonObject("data")), - newsItem.get("priority").getAsBoolean(), message, actions, newsItem.get("url").getAsString() @@ -96,14 +92,6 @@ public final class NewsItem { return id; } - public String getProject() { - return project; - } - - public boolean isGlobal() { - return "all".equals(getProject()); - } - public boolean isActive() { return active; } @@ -121,10 +109,6 @@ public final class NewsItem { return (T) data; } - public boolean isPriority() { - return priority; - } - public String getRawMessage() { return message; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/Constants.java b/connector/src/main/java/org/geysermc/connector/utils/Constants.java index 0a6062a3b..58125d909 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Constants.java +++ b/connector/src/main/java/org/geysermc/connector/utils/Constants.java @@ -32,7 +32,7 @@ public final class Constants { public static final URI GLOBAL_API_WS_URI; public static final String NTP_SERVER = "time.cloudflare.com"; - public static final String NEWS_OVERVIEW_URL = "https://api.geysermc.org/v1/news"; + public static final String NEWS_OVERVIEW_URL = "https://api.geysermc.org/v2/news/"; public static final String NEWS_PROJECT_NAME = "geyser"; public static final String FLOODGATE_DOWNLOAD_LOCATION = "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/"; diff --git a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java b/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java index 6c5168dd2..8272fb0b2 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java +++ b/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java @@ -68,7 +68,7 @@ public class NewsHandler { private void checkNews() { try { - String body = WebUtils.getBody(Constants.NEWS_OVERVIEW_URL); + String body = WebUtils.getBody(Constants.NEWS_OVERVIEW_URL + Constants.NEWS_PROJECT_NAME); JsonArray array = gson.fromJson(body, JsonArray.class); try { @@ -144,10 +144,6 @@ public class NewsHandler { return; } - if (!item.isGlobal() && !Constants.NEWS_PROJECT_NAME.equals(item.getProject())) { - return; - } - switch (item.getType()) { case ANNOUNCEMENT: if (!item.getDataAs(AnnouncementData.class).isAffected(Constants.NEWS_PROJECT_NAME)) { From 0274296366f03e6e83095bfc23ae9256d5463200 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 8 Nov 2021 08:33:16 -0500 Subject: [PATCH 666/766] Don't show the debug stick in the creative menu It currently doesn't have a texture, and Java Edition doesn't have the debug stick in its menu. --- .../connector/registry/populator/ItemRegistryPopulator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index dbf634989..0251103d0 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -172,6 +172,9 @@ public class ItemRegistryPopulator { if (identifier.equals("minecraft:sculk_sensor") && !GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { // https://github.com/GeyserMC/Geyser/issues/2564 continue; + } else if (identifier.equals("minecraft:debug_stick")) { + // Just shows an empty texture; either way it doesn't exist in the creative menu on Java + continue; } StartGamePacket.ItemEntry entry = entries.get(identifier); int id = -1; From 62cded2dafa96e4f70a3e8d25c223d78fe2d4e19 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 9 Nov 2021 11:44:28 -0500 Subject: [PATCH 667/766] Allow Geyser-BungeeCord to continue working after `/greload` We won't support reloading (neither does BungeeCord nor Waterfall), but at least Geyser will continue working after such a command is performed. --- .../bungeecord/GeyserBungeeInjector.java | 33 +++++++++++++++++-- .../bungeecord/GeyserBungeePlugin.java | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java index d5dccd1da..25b36a14e 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java @@ -35,7 +35,12 @@ import io.netty.channel.local.LocalAddress; import io.netty.util.AttributeKey; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ListenerInfo; +import net.md_5.bungee.api.event.ProxyReloadEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.api.plugin.Plugin; +import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.netty.PipelineUtils; +import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.common.GeyserInjector; @@ -43,16 +48,19 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Set; -public class GeyserBungeeInjector extends GeyserInjector { +public class GeyserBungeeInjector extends GeyserInjector implements Listener { + private final Plugin plugin; private final ProxyServer proxy; /** * Set as a variable so it is only set after the proxy has finished initializing */ private ChannelInitializer channelInitializer = null; private Set bungeeChannels = null; + private boolean eventRegistered = false; - public GeyserBungeeInjector(ProxyServer proxy) { - this.proxy = proxy; + public GeyserBungeeInjector(Plugin plugin) { + this.plugin = plugin; + this.proxy = plugin.getProxy(); } @Override @@ -142,6 +150,12 @@ public class GeyserBungeeInjector extends GeyserInjector { this.localChannel = channelFuture; this.bungeeChannels.add(this.localChannel.channel()); this.serverSocketAddress = channelFuture.channel().localAddress(); + + if (!this.eventRegistered) { + // Register reload listener + this.proxy.getPluginManager().registerListener(this.plugin, this); + this.eventRegistered = true; + } } @Override @@ -152,4 +166,17 @@ public class GeyserBungeeInjector extends GeyserInjector { } super.shutdown(); } + + /** + * The reload process clears the listeners field. Since we need to add to the listeners for maximum compatibility, + * we also need to re-add and re-enable our listener if a reload is initiated. + */ + @EventHandler + public void onProxyReload(ProxyReloadEvent event) { + this.bungeeChannels = null; + if (this.localChannel != null) { + shutdown(); + initializeLocalChannel(GeyserConnector.getInstance().getBootstrap()); + } + } } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index 548ec7210..64b10c650 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -118,7 +118,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this); - this.geyserInjector = new GeyserBungeeInjector(getProxy()); + this.geyserInjector = new GeyserBungeeInjector(this); this.geyserInjector.initializeLocalChannel(this); this.geyserCommandManager = new GeyserBungeeCommandManager(connector); From 09e3793fb27f3cdae86b91eecc704ff1911a3c3d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:02:14 -0500 Subject: [PATCH 668/766] Refactor GeyserSession tracking for better concurrency --- .../spigot/world/GeyserPistonListener.java | 7 +- .../GeyserSpigot1_11CraftingListener.java | 2 +- .../world/GeyserSpigotBlockPlaceListener.java | 41 ++++---- .../standalone/gui/GeyserStandaloneGUI.java | 2 +- .../geysermc/connector/GeyserConnector.java | 84 +++++------------ .../geysermc/connector/SessionManager.java | 94 +++++++++++++++++++ .../connector/command/CommandExecutor.java | 2 +- .../command/defaults/ListCommand.java | 4 +- .../command/defaults/ReloadCommand.java | 6 +- .../org/geysermc/connector/dump/DumpInfo.java | 2 +- .../network/ConnectorServerEventHandler.java | 2 +- .../connector/network/QueryPacketHandler.java | 2 +- .../network/UpstreamPacketHandler.java | 8 ++ .../network/session/GeyserSession.java | 11 +-- .../entity/player/BedrockEmoteTranslator.java | 2 +- .../java/JavaLoginSuccessTranslator.java | 2 + .../scoreboard/ScoreboardUpdater.java | 8 +- .../geysermc/connector/utils/NewsHandler.java | 2 +- 18 files changed, 169 insertions(+), 112 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/SessionManager.java diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java index 73d0300ff..39fefb2de 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java @@ -49,6 +49,8 @@ import org.geysermc.connector.utils.Direction; import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; import java.util.List; +import java.util.Map; +import java.util.UUID; public class GeyserPistonListener implements Listener { private final GeyserConnector connector; @@ -86,11 +88,12 @@ public class GeyserPistonListener implements Listener { Object2IntMap attachedBlocks = new Object2IntOpenHashMap<>(); boolean blocksFilled = false; - for (GeyserSession session : connector.getPlayers()) { - Player player = Bukkit.getPlayer(session.getPlayerEntity().getUuid()); + for (Map.Entry entry : connector.getSessionManager().getSessions().entrySet()) { + Player player = Bukkit.getPlayer(entry.getKey()); if (player == null || !player.getWorld().equals(world)) { continue; } + GeyserSession session = entry.getValue(); int dX = Math.abs(location.getBlockX() - player.getLocation().getBlockX()) >> 4; int dZ = Math.abs(location.getBlockZ() - player.getLocation().getBlockZ()) >> 4; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index f7a9d6df7..1fa5ef87b 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -80,7 +80,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { GeyserSession session = null; - for (GeyserSession otherSession : connector.getPlayers()) { + for (GeyserSession otherSession : connector.getSessionManager().getSessions().values()) { if (otherSession.getName().equals(event.getPlayer().getName())) { session = otherSession; break; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index 8111c7e56..8e3dfe075 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -29,7 +29,6 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import lombok.AllArgsConstructor; -import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; @@ -41,32 +40,30 @@ import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; @AllArgsConstructor public class GeyserSpigotBlockPlaceListener implements Listener { - private final GeyserConnector connector; private final GeyserSpigotWorldManager worldManager; @EventHandler public void place(final BlockPlaceEvent event) { - for (GeyserSession session : connector.getPlayers()) { - if (event.getPlayer() == Bukkit.getPlayer(session.getPlayerEntity().getUsername())) { - LevelSoundEventPacket placeBlockSoundPacket = new LevelSoundEventPacket(); - placeBlockSoundPacket.setSound(SoundEvent.PLACE); - placeBlockSoundPacket.setPosition(Vector3f.from(event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ())); - placeBlockSoundPacket.setBabySound(false); - if (worldManager.isLegacy()) { - placeBlockSoundPacket.setExtraData(session.getBlockMappings().getBedrockBlockId(worldManager.getBlockAt(session, - event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ()))); - } else { - String javaBlockId = event.getBlockPlaced().getBlockData().getAsString(); - placeBlockSoundPacket.setExtraData(session.getBlockMappings().getBedrockBlockId(BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(javaBlockId, BlockStateValues.JAVA_AIR_ID))); - } - placeBlockSoundPacket.setIdentifier(":"); - session.sendUpstreamPacket(placeBlockSoundPacket); - session.setLastBlockPlacePosition(null); - session.setLastBlockPlacedId(null); - break; - } + GeyserSession session = connector.getPlayerByUuid(event.getPlayer().getUniqueId()); + if (session == null) { + return; } - } + LevelSoundEventPacket placeBlockSoundPacket = new LevelSoundEventPacket(); + placeBlockSoundPacket.setSound(SoundEvent.PLACE); + placeBlockSoundPacket.setPosition(Vector3f.from(event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ())); + placeBlockSoundPacket.setBabySound(false); + if (worldManager.isLegacy()) { + placeBlockSoundPacket.setExtraData(session.getBlockMappings().getBedrockBlockId(worldManager.getBlockAt(session, + event.getBlockPlaced().getX(), event.getBlockPlaced().getY(), event.getBlockPlaced().getZ()))); + } else { + String javaBlockId = event.getBlockPlaced().getBlockData().getAsString(); + placeBlockSoundPacket.setExtraData(session.getBlockMappings().getBedrockBlockId(BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(javaBlockId, BlockStateValues.JAVA_AIR_ID))); + } + placeBlockSoundPacket.setIdentifier(":"); + session.sendUpstreamPacket(placeBlockSoundPacket); + session.setLastBlockPlacePosition(null); + session.setLastBlockPlacedId(null); + } } diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java index 3636dded8..e44d08b9e 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java @@ -306,7 +306,7 @@ public class GeyserStandaloneGUI { // Update player table playerTableModel.getDataVector().removeAllElements(); - for (GeyserSession player : GeyserConnector.getInstance().getPlayers()) { + for (GeyserSession player : GeyserConnector.getInstance().getSessionManager().getSessions().values()) { Vector row = new Vector<>(); row.add(player.getSocketAddress().getHostName()); row.add(player.getPlayerEntity().getUsername()); diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 17deca915..70550eedd 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -52,7 +52,6 @@ import org.geysermc.connector.registry.Registries; import org.geysermc.connector.network.translators.PacketTranslatorRegistry; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.world.WorldManager; -import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.skin.FloodgateSkinUploader; import org.geysermc.connector.utils.*; @@ -72,10 +71,7 @@ import java.net.UnknownHostException; import java.security.Key; import java.text.DecimalFormat; import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -100,7 +96,7 @@ public class GeyserConnector { private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"; - private final List players = new ArrayList<>(); + private final SessionManager sessionManager = new SessionManager(); private static GeyserConnector instance; @@ -115,7 +111,7 @@ public class GeyserConnector { private FloodgateSkinUploader skinUploader; private final NewsHandler newsHandler; - private boolean shuttingDown = false; + private volatile boolean shuttingDown = false; private final ScheduledExecutorService generalThreadPool; @@ -123,7 +119,7 @@ public class GeyserConnector { private final PlatformType platformType; private final GeyserBootstrap bootstrap; - private Metrics metrics; + private final Metrics metrics; private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) { long startupTime = System.currentTimeMillis(); @@ -277,7 +273,7 @@ public class GeyserConnector { if (config.getMetrics().isEnabled()) { metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger("")); - metrics.addCustomChart(new Metrics.SingleLineChart("players", players::size)); + metrics.addCustomChart(new Metrics.SingleLineChart("players", sessionManager::size)); // Prevent unwanted words best we can metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase())); metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName)); @@ -285,7 +281,7 @@ public class GeyserConnector { metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserConnector.VERSION)); metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> { Map valueMap = new HashMap<>(); - for (GeyserSession session : players) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session == null) continue; if (session.getClientData() == null) continue; String os = session.getClientData().getDeviceOs().toString(); @@ -299,7 +295,7 @@ public class GeyserConnector { })); metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> { Map valueMap = new HashMap<>(); - for (GeyserSession session : players) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session == null) continue; if (session.getClientData() == null) continue; String version = session.getClientData().getGameVersion(); @@ -359,6 +355,8 @@ public class GeyserConnector { map.put(release, entry); return map; })); + } else { + metrics = null; } boolean isGui = false; @@ -392,40 +390,10 @@ public class GeyserConnector { bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); shuttingDown = true; - if (players.size() >= 1) { - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", players.size())); - - // Make a copy to prevent ConcurrentModificationException - final List tmpPlayers = new ArrayList<>(players); - for (GeyserSession playerSession : tmpPlayers) { - playerSession.disconnect(LanguageUtils.getPlayerLocaleString("geyser.core.shutdown.kick.message", playerSession.getLocale())); - } - - CompletableFuture future = CompletableFuture.runAsync(new Runnable() { - @Override - public void run() { - // Simulate a long-running Job - try { - while (true) { - if (players.size() == 0) { - return; - } - - TimeUnit.MILLISECONDS.sleep(100); - } - } catch (InterruptedException e) { - throw new IllegalStateException(e); - } - } - }); - - // Block and wait for the future to complete - try { - future.get(); - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done")); - } catch (Exception e) { - // Quietly fail - } + if (sessionManager.size() >= 1) { + bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size())); + sessionManager.disconnectAll("geyser.core.shutdown.kick.message"); + bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done")); } generalThreadPool.shutdown(); @@ -437,20 +405,11 @@ public class GeyserConnector { skinUploader.close(); } newsHandler.shutdown(); - players.clear(); this.getCommandManager().getCommands().clear(); bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done")); } - public void addPlayer(GeyserSession player) { - players.add(player); - } - - public void removePlayer(GeyserSession player) { - players.remove(player); - } - /** * Gets a player by their current UUID * @@ -463,13 +422,7 @@ public class GeyserConnector { return null; } - for (GeyserSession session : players) { - if (uuid.equals(session.getPlayerEntity().getUuid())) { - return session; - } - } - - return null; + return sessionManager.getSessions().get(uuid); } /** @@ -480,8 +433,13 @@ public class GeyserConnector { */ @SuppressWarnings("unused") // API usage public GeyserSession getPlayerByXuid(String xuid) { - for (GeyserSession session : players) { - if (session.getAuthData() != null && session.getAuthData().getXboxUUID().equals(xuid)) { + for (GeyserSession session : sessionManager.getPendingSessions()) { + if (session.getAuthData().getXboxUUID().equals(xuid)) { + return session; + } + } + for (GeyserSession session : sessionManager.getSessions().values()) { + if (session.getAuthData().getXboxUUID().equals(xuid)) { return session; } } diff --git a/connector/src/main/java/org/geysermc/connector/SessionManager.java b/connector/src/main/java/org/geysermc/connector/SessionManager.java new file mode 100644 index 000000000..a2eb6d873 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/SessionManager.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2019-2021 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.connector; + +import com.google.common.collect.ImmutableList; +import lombok.AccessLevel; +import lombok.Getter; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.utils.LanguageUtils; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +public final class SessionManager { + /** + * A list of all players who don't currently have a permanent UUID attached yet. + */ + @Getter(AccessLevel.PACKAGE) + private final Set pendingSessions = ConcurrentHashMap.newKeySet(); + /** + * A list of all players who are currently in-game. + */ + @Getter + private final Map sessions = new ConcurrentHashMap<>(); + + /** + * Called once the player has successfully authenticated to the Geyser server. + */ + public void addPendingSession(GeyserSession session) { + pendingSessions.add(session); + } + + /** + * Called once a player has successfully logged into their Java server. + */ + public void addSession(UUID uuid, GeyserSession session) { + pendingSessions.remove(session); + sessions.put(uuid, session); + } + + public void removeSession(GeyserSession session) { + if (sessions.remove(session.getPlayerEntity().getUuid()) == null) { + // Session was likely pending + pendingSessions.remove(session); + } + } + + /** + * Creates a new, immutable list containing all pending and active sessions. + */ + public Collection getAllSessions() { + return ImmutableList.builder() // builderWithExpectedSize is probably not a good idea yet as older Spigot builds probably won't have it. + .addAll(pendingSessions) + .addAll(sessions.values()) + .build(); + } + + public void disconnectAll(String message) { + Collection sessions = getAllSessions(); + for (GeyserSession session : sessions) { + session.disconnect(LanguageUtils.getPlayerLocaleString(message, session.getLocale())); + } + } + + /** + * @return the total amount of sessions, including those pending. + */ + public int size() { + return pendingSessions.size() + sessions.size(); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java b/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java index 26dd8125a..d8b023529 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java @@ -53,7 +53,7 @@ public class CommandExecutor { return null; } - for (GeyserSession session : connector.getPlayers()) { + for (GeyserSession session : connector.getSessionManager().getSessions().values()) { if (sender.getName().equals(session.getPlayerEntity().getUsername())) { return session; } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java index 915a062a7..3058f2982 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java @@ -46,8 +46,8 @@ public class ListCommand extends GeyserCommand { @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { String message = LanguageUtils.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), - connector.getPlayers().size(), - connector.getPlayers().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); + connector.getSessionManager().size(), + connector.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); sender.sendMessage(message); } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java index d3f3d2f3f..3fa5adc31 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java @@ -32,8 +32,6 @@ import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; -import java.util.ArrayList; - public class ReloadCommand extends GeyserCommand { private final GeyserConnector connector; @@ -53,9 +51,7 @@ public class ReloadCommand extends GeyserCommand { sender.sendMessage(message); - for (GeyserSession otherSession : new ArrayList<>(connector.getPlayers())) { - otherSession.disconnect(LanguageUtils.getPlayerLocaleString("geyser.commands.reload.kick", otherSession.getLocale())); - } + connector.getSessionManager().disconnectAll("geyser.commands.reload.kick"); connector.reload(); } } diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index 3f566ee26..4d8eeefaf 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -114,7 +114,7 @@ public class DumpInfo { } this.userPlatforms = new Object2IntOpenHashMap<>(); - for (GeyserSession session : GeyserConnector.getInstance().getPlayers()) { + for (GeyserSession session : GeyserConnector.getInstance().getSessionManager().getAllSessions()) { DeviceOs device = session.getClientData().getDeviceOs(); userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1); } diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index dcc3cb50b..65f1d8d7d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -124,7 +124,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { pong.setPlayerCount(pingInfo.getPlayers().getOnline()); pong.setMaximumPlayerCount(pingInfo.getPlayers().getMax()); } else { - pong.setPlayerCount(connector.getPlayers().size()); + pong.setPlayerCount(connector.getSessionManager().getSessions().size()); pong.setMaximumPlayerCount(config.getMaxPlayers()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java index 8d3aeb435..89e2669bb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java @@ -159,7 +159,7 @@ public class QueryPacketHandler { currentPlayerCount = String.valueOf(pingInfo.getPlayers().getOnline()); maxPlayerCount = String.valueOf(pingInfo.getPlayers().getMax()); } else { - currentPlayerCount = String.valueOf(connector.getPlayers().size()); + currentPlayerCount = String.valueOf(connector.getSessionManager().getSessions().size()); maxPlayerCount = String.valueOf(connector.getConfig().getMaxPlayers()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 6915e4575..d8c2adef9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -59,6 +59,12 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(LoginPacket loginPacket) { + if (connector.isShuttingDown()) { + // Don't allow new players in if we're no longer operating + session.disconnect(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.message")); + return true; + } + BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(loginPacket.getProtocolVersion()); if (packetCodec == null) { String supportedVersions = BedrockProtocol.getAllSupportedVersions(); @@ -86,6 +92,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS); session.sendUpstreamPacket(playStatus); + connector.getSessionManager().addPendingSession(session); + ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket(); for(ResourcePack resourcePack : ResourcePack.PACKS.values()) { ResourcePackManifest.Header header = resourcePack.getManifest().getHeader(); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index db4d1fd8f..d9e95e9a9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -486,9 +486,7 @@ public class GeyserSession implements CommandSender { if (connector.getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.NO_EMOTES) { this.emotes = new HashSet<>(); - // Make a copy to prevent ConcurrentModificationException - final List tmpPlayers = new ArrayList<>(connector.getPlayers()); - tmpPlayers.forEach(player -> this.emotes.addAll(player.getEmotes())); + connector.getSessionManager().getSessions().values().forEach(player -> this.emotes.addAll(player.getEmotes())); } else { this.emotes = null; } @@ -498,7 +496,7 @@ public class GeyserSession implements CommandSender { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.disconnect", address, disconnectReason)); disconnect(disconnectReason.name()); - connector.removePlayer(this); + connector.getSessionManager().removeSession(this); }); } @@ -911,7 +909,6 @@ public class GeyserSession implements CommandSender { if (!internalConnect) { downstream.connect(); } - connector.addPlayer(this); } public void disconnect(String reason) { @@ -921,7 +918,7 @@ public class GeyserSession implements CommandSender { downstream.disconnect(reason); } if (upstream != null && !upstream.isClosed()) { - connector.getPlayers().remove(this); + connector.getSessionManager().removeSession(this); upstream.disconnect(reason); } } @@ -1442,7 +1439,7 @@ public class GeyserSession implements CommandSender { public void refreshEmotes(List emotes) { this.emotes.addAll(emotes); - for (GeyserSession player : connector.getPlayers()) { + for (GeyserSession player : connector.getSessionManager().getSessions().values()) { List pieces = new ArrayList<>(); for (UUID piece : emotes) { if (!player.getEmotes().contains(piece)) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java index a20c3872c..e53167301 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java @@ -53,7 +53,7 @@ public class BedrockEmoteTranslator extends PacketTranslator { } long javaId = session.getPlayerEntity().getEntityId(); - for (GeyserSession otherSession : session.getConnector().getPlayers()) { + for (GeyserSession otherSession : session.getConnector().getSessionManager().getSessions().values()) { if (otherSession != session) { if (otherSession.isClosed()) continue; if (otherSession.getEventLoop().inEventLoop()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java index d7675bd07..e3350c5eb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java @@ -47,6 +47,8 @@ public class JavaLoginSuccessTranslator extends PacketTranslator sessions = connector.getSessionManager().getSessions().values(); if (currentTime - lastPacketsPerSecondUpdate >= 1000) { lastPacketsPerSecondUpdate = currentTime; - for (GeyserSession session : connector.getPlayers()) { + for (GeyserSession session : sessions) { ScoreboardSession scoreboardSession = session.getWorldCache().getScoreboardSession(); int oldPps = scoreboardSession.getPacketsPerSecond(); @@ -94,7 +96,7 @@ public final class ScoreboardUpdater extends Thread { if (currentTime - lastUpdate >= FIRST_MILLIS_BETWEEN_UPDATES) { lastUpdate = currentTime; - for (GeyserSession session : connector.getPlayers()) { + for (GeyserSession session : sessions) { WorldCache worldCache = session.getWorldCache(); ScoreboardSession scoreboardSession = worldCache.getScoreboardSession(); @@ -132,7 +134,7 @@ public final class ScoreboardUpdater extends Thread { if (timeSpent > 0) { connector.getLogger().info(String.format( "Scoreboard updater: took %s ms. Updated %s players", - timeSpent, connector.getPlayers().size() + timeSpent, sessions.size() )); } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java b/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java index 8272fb0b2..24df69817 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java +++ b/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java @@ -109,7 +109,7 @@ public class NewsHandler { // } break; case BROADCAST_TO_OPERATORS: - for (GeyserSession player : GeyserConnector.getInstance().getPlayers()) { + for (GeyserSession player : GeyserConnector.getInstance().getSessionManager().getSessions().values()) { if (player.getOpPermissionLevel() >= 2) { session.sendMessage(ChatColor.GREEN + news.getMessage()); } From dc5edc0a2c9e33868aedd4fbf387c167fb22ac76 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:42:35 -0500 Subject: [PATCH 669/766] Remove 1.17.10 support; extended world height is always enabled --- .../configuration/GeyserConfiguration.java | 2 - .../GeyserJacksonConfiguration.java | 3 - .../connector/network/BedrockProtocol.java | 8 +- .../network/UpstreamPacketHandler.java | 5 +- .../network/session/GeyserSession.java | 3 +- .../player/BedrockMovePlayerTranslator.java | 12 +- .../java/world/JavaChunkDataTranslator.java | 45 +- .../populator/BlockRegistryPopulator.java | 2 - .../populator/ItemRegistryPopulator.java | 18 +- .../geysermc/connector/utils/ChunkUtils.java | 68 +- .../bedrock/block_palette.1_17_10.nbt | Bin 41318 -> 0 bytes ...eative_items.1_17_10.caves_and_cliffs.json | 5207 ----------------- .../bedrock/creative_items.1_17_10.json | 5203 ---------------- ..._item_states.1_17_10.caves_and_cliffs.json | 4290 -------------- .../bedrock/runtime_item_states.1_17_10.json | 4290 -------------- connector/src/main/resources/config.yml | 4 - 16 files changed, 57 insertions(+), 19103 deletions(-) delete mode 100644 connector/src/main/resources/bedrock/block_palette.1_17_10.nbt delete mode 100644 connector/src/main/resources/bedrock/creative_items.1_17_10.caves_and_cliffs.json delete mode 100644 connector/src/main/resources/bedrock/creative_items.1_17_10.json delete mode 100644 connector/src/main/resources/bedrock/runtime_item_states.1_17_10.caves_and_cliffs.json delete mode 100644 connector/src/main/resources/bedrock/runtime_item_states.1_17_10.json diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java index bf5b137b3..a3fe89c1b 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java @@ -46,8 +46,6 @@ public interface GeyserConfiguration { Map getUserAuths(); - boolean isExtendedWorldHeight(); - boolean isCommandSuggestions(); @JsonIgnore diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java index 759652293..da2840f76 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java @@ -62,9 +62,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration private BedrockConfiguration bedrock = new BedrockConfiguration(); private RemoteConfiguration remote = new RemoteConfiguration(); - @JsonProperty("extended-world-height") - private boolean extendedWorldHeight = false; - @JsonProperty("floodgate-key-file") private String floodgateKeyFile = "key.pem"; diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java index d19fe18ca..fa95c8f37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java @@ -26,7 +26,6 @@ package org.geysermc.connector.network; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; @@ -42,18 +41,15 @@ public class BedrockProtocol { * Default Bedrock codec that should act as a fallback. Should represent the latest available * release of the game that Geyser supports. */ - public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v448.V448_CODEC; + public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v471.V471_CODEC; /** * A list of all supported Bedrock versions that can join Geyser */ public static final List SUPPORTED_BEDROCK_CODECS = new ArrayList<>(); static { - SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder() - .minecraftVersion("1.17.10/1.17.11") - .build()); SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC); - SUPPORTED_BEDROCK_CODECS.add(Bedrock_v471.V471_CODEC); + SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC); } /** diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index d8c2adef9..42e24458f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -30,6 +30,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.data.ExperimentData; import com.nukkitx.protocol.bedrock.data.ResourcePackType; import com.nukkitx.protocol.bedrock.packet.*; +import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; @@ -151,8 +152,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { stackPacket.getExperiments().add(new ExperimentData("data_driven_items", true)); } - if (session.getConnector().getConfig().isExtendedWorldHeight()) { - // Allow extended world height in the overworld to work + if (session.getUpstream().getProtocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { + // Allow extended world height in the overworld to work for pre-1.18 clients stackPacket.getExperiments().add(new ExperimentData("caves_and_cliffs", true)); } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index d9e95e9a9..2efb74a32 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -59,6 +59,7 @@ import com.nukkitx.protocol.bedrock.data.command.CommandPermission; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; +import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import io.netty.channel.Channel; import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.ints.*; @@ -1200,7 +1201,7 @@ public class GeyserSession implements CommandSender { settings.setServerAuthoritativeBlockBreaking(false); startGamePacket.setPlayerMovementSettings(settings); - if (connector.getConfig().isExtendedWorldHeight()) { + if (upstream.getProtocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { startGamePacket.getExperiments().add(new ExperimentData("caves_and_cliffs", true)); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index f70233c04..fb7979afd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -33,7 +33,6 @@ import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.ChatColor; import org.geysermc.connector.entity.player.SessionPlayerEntity; import org.geysermc.connector.entity.type.EntityType; @@ -43,14 +42,9 @@ import org.geysermc.connector.network.translators.Translator; @Translator(packet = MovePlayerPacket.class) public class BedrockMovePlayerTranslator extends PacketTranslator { - /* The upper and lower bounds to check for the void floor that only exists in Bedrock */ - private static final int BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y; - private static final int BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y; - - static { - BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? -104 : -40; - BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y = BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y + 2; - } + /* The upper and lower bounds to check for the void floor that only exists in Bedrock. These are the constants for the overworld. */ + private static final int BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y = -104; + private static final int BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y = BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y + 2; @Override public void translate(GeyserSession session, MovePlayerPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java index 6e579b5f4..baa2d6781 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java @@ -39,8 +39,8 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.chunk.ChunkSection; import org.geysermc.connector.network.translators.world.BiomeTranslator; +import org.geysermc.connector.network.translators.world.chunk.ChunkSection; import org.geysermc.connector.utils.ChunkUtils; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT; @@ -48,8 +48,6 @@ import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OV @Translator(packet = ServerChunkDataPacket.class) public class JavaChunkDataTranslator extends PacketTranslator { - // Caves and cliffs supports 3D biomes by implementing a very similar palette system to blocks - private static final boolean NEW_BIOME_WRITE = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight(); @Override public void translate(GeyserSession session, ServerChunkDataPacket packet) { @@ -84,11 +82,7 @@ public class JavaChunkDataTranslator extends PacketTranslator> 4; - for (int i = 0; i < sectionCount; i++) { - int biomeYOffset = dimensionOffset + i; - if (biomeYOffset < yOffset) { - // Ignore this biome section since it goes below the height of the Java world - byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); - continue; - } - BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf); - } - - // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections - int remainingEmptyBiomes = 32 - sectionCount; - for (int i = 0; i < remainingEmptyBiomes; i++) { + // At this point we're dealing with Bedrock chunk sections + boolean overworld = session.getChunkCache().isExtendedHeight(); + int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4; + for (int i = 0; i < sectionCount; i++) { + int biomeYOffset = dimensionOffset + i; + if (biomeYOffset < yOffset) { + // Ignore this biome section since it goes below the height of the Java world byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + continue; } - } else { - byteBuf.writeBytes(BiomeTranslator.toBedrockBiome(session, column.getBiomeData())); // Biomes - 256 bytes + BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf); } + + // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections + int remainingEmptyBiomes = 32 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + } + byteBuf.writeByte(0); // Border blocks - Edu edition only VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 253b30ba9..30cd7c1cc 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -28,7 +28,6 @@ package org.geysermc.connector.registry.populator; import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; import com.nukkitx.nbt.*; -import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; @@ -66,7 +65,6 @@ public class BlockRegistryPopulator { static { ImmutableMap.Builder, BiFunction> stateMapperBuilder = ImmutableMap., BiFunction>builder() - .put(ObjectIntPair.of("1_17_10", Bedrock_v448.V448_CODEC.getProtocolVersion()), EMPTY_MAPPER) .put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER) .put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER); diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 0251103d0..b413b3a80 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -35,7 +35,6 @@ 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.v448.Bedrock_v448; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -63,12 +62,6 @@ public class ItemRegistryPopulator { static { PALETTE_VERSIONS = new Object2ObjectOpenHashMap<>(); - if (GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - PALETTE_VERSIONS.put("1_17_10.caves_and_cliffs", new PaletteVersion(Bedrock_v448.V448_CODEC.getProtocolVersion(), Collections.emptyMap())); - } else { - PALETTE_VERSIONS.put("1_17_10", new PaletteVersion(Bedrock_v448.V448_CODEC.getProtocolVersion(), Collections.emptyMap())); - } - PALETTE_VERSIONS.put("1_17_30", new PaletteVersion(Bedrock_v465.V465_CODEC.getProtocolVersion(), Collections.emptyMap())); PALETTE_VERSIONS.put("1_17_40", new PaletteVersion(Bedrock_v471.V471_CODEC.getProtocolVersion(), Collections.emptyMap())); } @@ -169,10 +162,7 @@ public class ItemRegistryPopulator { } String identifier = itemNode.get("id").textValue(); - if (identifier.equals("minecraft:sculk_sensor") && !GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - // https://github.com/GeyserMC/Geyser/issues/2564 - continue; - } else if (identifier.equals("minecraft:debug_stick")) { + if (identifier.equals("minecraft:debug_stick")) { // Just shows an empty texture; either way it doesn't exist in the creative menu on Java continue; } @@ -223,9 +213,6 @@ public class ItemRegistryPopulator { if (!usingFurnaceMinecart) { javaOnlyItems.add("minecraft:furnace_minecart"); } - if (!GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - javaOnlyItems.add("minecraft:sculk_sensor"); - } // Java-only items for this version javaOnlyItems.addAll(palette.getValue().additionalTranslatedItems().keySet()); @@ -239,7 +226,8 @@ public class ItemRegistryPopulator { // This items has a mapping specifically for this version of the game mappingItem = entry.getValue(); } - if (javaIdentifier.equals("minecraft:sculk_sensor") && GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { + if (javaIdentifier.equals("minecraft:sculk_sensor")) { + // TODO fix in mappings mappingItem.setBedrockIdentifier("minecraft:sculk_sensor"); } diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index bed0e9c80..a8fc5f7f8 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -69,49 +69,40 @@ public class ChunkUtils { * The minimum height Bedrock Edition will accept. */ public static final int MINIMUM_ACCEPTED_HEIGHT = 0; - private static final int CAVES_AND_CLIFFS_MINIMUM_HEIGHT = -64; - public static final int MINIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? - CAVES_AND_CLIFFS_MINIMUM_HEIGHT : MINIMUM_ACCEPTED_HEIGHT; + public static final int MINIMUM_ACCEPTED_HEIGHT_OVERWORLD = -64; /** * The maximum chunk height Bedrock Edition will accept, from the lowest point to the highest. */ private static final int MAXIMUM_ACCEPTED_HEIGHT = 256; - private static final int CAVES_AND_CLIFFS_MAXIMUM_HEIGHT = 384; - private static final int MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? - CAVES_AND_CLIFFS_MAXIMUM_HEIGHT : MAXIMUM_ACCEPTED_HEIGHT; + private static final int MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD = 384; public static final byte[] EMPTY_CHUNK_DATA; public static final byte[] EMPTY_BIOME_DATA; static { - if (GeyserConnector.getInstance().getConfig().isExtendedWorldHeight()) { - ByteBuf byteBuf = Unpooled.buffer(); - try { - BlockStorage blockStorage = new BlockStorage(0); - blockStorage.writeToNetwork(byteBuf); + ByteBuf byteBuf = Unpooled.buffer(); + try { + BlockStorage blockStorage = new BlockStorage(0); + blockStorage.writeToNetwork(byteBuf); - EMPTY_BIOME_DATA = new byte[byteBuf.readableBytes()]; - byteBuf.readBytes(EMPTY_BIOME_DATA); - } finally { - byteBuf.release(); + EMPTY_BIOME_DATA = new byte[byteBuf.readableBytes()]; + byteBuf.readBytes(EMPTY_BIOME_DATA); + } finally { + byteBuf.release(); + } + + byteBuf = Unpooled.buffer(); + try { + for (int i = 0; i < 32; i++) { + byteBuf.writeBytes(EMPTY_BIOME_DATA); } - byteBuf = Unpooled.buffer(); - try { - for (int i = 0; i < 32; i++) { - byteBuf.writeBytes(EMPTY_BIOME_DATA); - } + byteBuf.writeByte(0); // Border - byteBuf.writeByte(0); // Border - - EMPTY_CHUNK_DATA = new byte[byteBuf.readableBytes()]; - byteBuf.readBytes(EMPTY_CHUNK_DATA); - } finally { - byteBuf.release(); - } - } else { - EMPTY_BIOME_DATA = null; // Unused - EMPTY_CHUNK_DATA = new byte[257]; // 256 bytes for biomes, one for borders + EMPTY_CHUNK_DATA = new byte[byteBuf.readableBytes()]; + byteBuf.readBytes(EMPTY_CHUNK_DATA); + } finally { + byteBuf.release(); } } @@ -441,24 +432,17 @@ public class ChunkUtils { } int dimension = DimensionUtils.javaToBedrock(session.getDimension()); - boolean extendedHeight = dimension == 0 && session.getConnector().getConfig().isExtendedWorldHeight(); + boolean extendedHeight = dimension == 0; session.getChunkCache().setExtendedHeight(extendedHeight); // Yell in the console if the world height is too height in the current scenario // The constraints change depending on if the player is in the overworld or not, and if experimental height is enabled if (minY < (extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) || maxY > (extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT)) { - if (minY >= CAVES_AND_CLIFFS_MINIMUM_HEIGHT && maxY <= CAVES_AND_CLIFFS_MAXIMUM_HEIGHT && dimension == 0 && !session.getConnector().getConfig().isExtendedWorldHeight()) { - // This dimension uses heights that would be fixed by enabling the experimental toggle - session.getConnector().getLogger().warning( - LanguageUtils.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds.caves_and_cliffs", - "extended-world-height")); - } else { - session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds", - extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT, - extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT, - session.getDimension())); - } + session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds", + extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT, + extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT, + session.getDimension())); } session.getChunkCache().setMinY(minY); diff --git a/connector/src/main/resources/bedrock/block_palette.1_17_10.nbt b/connector/src/main/resources/bedrock/block_palette.1_17_10.nbt deleted file mode 100644 index a32c0736ea54406f5d8eb9a12729aa58feb5d9ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41318 zcmeFZXH-;8urB}Z#r^psxLM{_pxsCCXv? zX~ef@LCPaMuuYGj>6w2&SGBgU${QJL+w3|x?Beg)y9~Dv6;6g* zP>U65n}gr(V^T)Xm{S@b&Gwd^F75A}2~hu#q$VYsH4MA|Q9L=0glv|W)=0F8%2x7H zC_?7e`hVQJE-scggJs~3XJVC^S7wTlE}|~VS(~$?p4CHHublZR zIiian)z;sZ334T4UA?C~vU?oDII9MK=jyRDRWz>#&)VBr%AEh*55Et3L_tgLC*D&o zy45~2=ch!T0yX+MN4mvR5&4n2V-oT`uIjq_w;gL?d*k}x3mlt{*0`)Ivvms(Mdh{D zmehWVk&^cx9p1iI{bbD3KM;JM@U(~f%{_&xxY<7_VRN~tL}<&RLXkS1{7RTL_DX{g z_5F6kFM=EgULihF$B(BAX0FnFXL|Ixzr*Rvk_<sPal;~Cn`)+~6~v&NFKZ5AK8a?~uG_-F5_m9xt3S#XSH*QSkex{+RMY8hoerOanHwnn~;H0}7R%-R(@mwvWHU>4$K$IJ| z))(#wRh>3J+D?8@+;XrIYV_zlwLg6?i9-#Dz04VjlIe)4Ak*C_2|M#k5{n~h|bvQ|4 z~gX8Mpe^5K&fb#j0rVxO8VG%@Ay*M_YM zgP=#q-z$wBNrP;m#?w&LS&XqP@FsF|yG+__9$AM?@pKaHt^8n!vX9lHtp;gAA`M4?_co3?kZEEF~r+In7QQRcwiWp0oTzSWVhZ4hg z>#SkBqquqgQL*_Fh2o9_cRQU(wF5FI<50F;q3?|pM{#Y_LG4@nWl8&TMNRqb8m;rB zq0xP3XD`PpE>&o)gk-R2?2MS6W$q3-sCFE0^)-6B`$}aTa!=;=vCy}OZ4{GCF2)YE z&8Uj4x##Iac&R>oXP~TU?ko{*&tKZgv$!wTzB)$f#_dvh)~LNN@W*~b&fP~R%8_BN zc_F{t^Czj6mVyALVc9$;yFca6;UkO^EOGRdMRXgrv$HCWqCmw&Q0Jli0#Xfa(t`e@JN=Zkq;&=cGH z==@4sp^)?U^Bvd7%=FE@sMd`h-OXf7cG|)ULbr?jMpvNU!VkZN7{9ayzE-h8|G)&( zfakoDihPnC_mUaLpd6d4k3m+wT9$`G5P#N)Q;(KQFVRC36n?o)0x4{ z+{k#n8+#S{ZK2C$Rxu`9i|I`!)vMU8LR}a9o~cgt8{{JLKPAh zf`xYRj(RSIY?uTP{bU#Ow*Bl?AmIviK&j~+)Ui;>)(B-()b{q1d-bpMM^JX>aEJDbGLdId~{wBx)Zta;=Te}2jT zbFKZZz^-uiHQaZ;cqp3vyw~+(&~e^=b7gtNvGINAPV|i?sfWy0Y?MMvA1B&Ah?Q_j zc=fJ*|3aeH4Rvv4PDgU5Y3xBMI zgL6DwAcbYA{Kg}aL>jT-Pf#docdo%h9Qy=Mh#J;}M?JG)R8;Zec_1SJFJlN*=LbQ9 z$6MBAuB1m>@HMB`63?;!4Z+j=PA8rt1Q`{H`-3-A z`GmEp`KCB?)172j|L4S}(vo{5@l>5|cH<(qz_)a{uf4eTPn*~BSkf(UAvl?Or#8;5 z@0zlf{Cw~82d;nAyH0Zswie$_R*LPPk_t2=(^It!ZOH1n)%&{VY4`cZF_1t{I^nN0 z3R&|SR>u8E&$infk{Dd+SOy#GNFtV}ldj6`Zmiec)ATSReepu8nf{KQX5Q6nYx4ZO zMaRGC?=0VG-mM0LNAh{IYDHT@*{6{YA1@RclHMGPu`snb07nDj5i6cXq&GdH4O_A; z<}aiF|5d6?@-hZzx82GIdB^lqND9QVd${IfGRK4?WIzQzQ z0Ms6~u1xlG-BA8`mC!YMSiF{g&LJ#krS$f?hsaa#JtR)mx9?@{*=MK%g(de<^WGWp zS{L2oCo>Mej#lpIS7vKA3q&s0RW)Ps-CV-oj=)RMG99SdQ@Jeq_Nn*!*t!ow)Xc4h z(Oev*;v`;CBX{ZwW(cUiF$o0q2b+@DoR)T7x8;_PZsyW|ZIj|OYU*p&96V*uczx^0 zU;kZV+q(?6vezS|JL$jYmlR4{Evug)-nb7}V$$19?8V-%rT%rB8k6fi2mq3;7#Fze z{F{JEmH0L0UFAr(rON8`nWNPcRi<&fwd@B6A+DaP&Ben<8M0OVW4fxF!MmsF?Q40D z)Ng5~RIigzidT`)(1=%E!!?(OsB8A*R`nq7o!3uXMAY$2=sg_o)vjc`C9O_8_=8Fx z;hZmi6vgzVx?rny595%qdDJ*3)dB zH?_LJHmh5ANJt;2R)|y6#;L(|ML&(H45m*zZ~6ES?X3;xJoZ=Yh`bz6Okv8c@+E}s zSrq|&1fv${O{oH7tS!@L(P4RZahlN-0Pn*?6R?T z4Ga!9V0oHLsJy%y7f3Jow1ZlD8IP5J@#fKCiTX)nuWLid)@st^F`cJdnssiINAvt2 z1s&DF%n^&cPMUsAjWr&TH#(L^CM!!nmovR8Bc;|JE`PF2d{j+tdwXXkH|1~a@@@tF z=OrnJF{;mS{@L_XjZ(9CMtruQ)u=TJAF;UVPbJJF&ypC%kafh8(-nrf`f>f1dQ{_A z4+ppwM)t*q8vP(`Y~%ie3i#vr&fJHa4(5Vvn3l?k702M`TNdtnhwC4^)MPx78n0qo zc6Bu{!+X^>qU{Q&Z{juBbUNzB_w7woRd^cmRb%wW+GApD0no##~zMH$VJgd zzRntIgubOlqbT?^(Y{>VY9kq_>|5A|?sCgQcf%oNs>lb%SyV*&TA68Tl)BVtSql5z zF>ScV?No;d3W}C89%Fe7GsfDoHJVe3eQ9+-s|;ovv)A~EFeTIf4%@RBE^JVM^~bqx z3TR82oUuIAh_7By7Hg-}C(-(PDPiP!o`JH)Uh{`$<$CVb2*Qu4GDf3}nsTqS*tbYx z5ZdU-n}t2H(VVrfuf2Z57nPZ&(pQPl&!bwpWBM}^u7Osy`a(Z*BFN9@-e1SPh9>-z z+H5pROa4s`(o!K(6qVJawR?g<*4|&5)N5-ZAjhgh{Qt_(AD)6cuaINL-3?tj%b-r# z{Wp^@6q*TGwt}?!D!GknRcg@XM!!Fp*=X#w?2=K^wpJkL9Rxy^?u)9n$o-R zn}B5(t!iCDV&qCVof+uE$2u%WWg-i2!^ci5 zPlc4COE(#uFigmyC+RD&fNOv1wMwfpa$QW$^u5BzIqn_%`FDm=%wDq_n4Y}Vh=T|) zJ!6ctxam0}iQxj%W0ms`=)*F7eO3q`F1xcaM><=!V%V|5f&&SieGv`n`2K&Div+;* zDx+GsD5XqA1UsuQ!D~Fq(Og3=m zxcPCFh>Zoe^M8C=RyofN&u`}mA8a_bYD=}YrYx+D36)Di()+=JQv;GdF~67gSJxx| zXVf6OXCp6lrN_s%pxFjH9hD!>gCGD zDa%rq7!fLp?U&3O;vV5k<_hm$JI=QVIb3OnN-p80@hx^9{!M#@TemeKFF7$*9zm82 zPqo>>wZcWQp}7l zzq~pTUDI%}BA1Zan-(RGU8&8aEhdy>=9oeXP;{fMN=d#mt!CtBWBt4z{NLc^idE>PK!d&TxG z(*y2LZ@;%-9#s7mm^gAOQkGIX^K+%>=);Tud3a-=B;kkTMsL-mPBl;D{i@#rJ+Y2O z%nRmEzukswe!dmMexzLl?kdKi{9E@eOmk6xs@yH@QQFmBVa-5;3^$)jRg*W$&tL8N zxyHAvd|pT&)3fZ3ktNq|qfKk>-=eh%h_P_hDgt*D<4|e=?kI1?RsnZM*5BpM??}Bk zyHKU8w>pW&<7%a%lu_P_;~-gs+L536Azu{kepLFi3t7uxpUnEf5L6$uRAJz%pI>~7 z&(2k8_?EZgPWVwu{fhsav%)C$st1DVS91y%g|%ZQHL@d-iSzj2EJgNN$w+k#M|OGtP0jKXjknb$*$hY znjx=Xrl6mjH;Pg>-tT>nep;l>sc}9#nl!QJvy*;fVBo7(Xmdehs@x~$PevFy%zY{5 zKVto_l3`B<9m?E(Ol5e~?VQrcQD~pgX72P4oIkGqy*F%1ZiSXPMY@`SQyFeg-kMpw z@y_xy9NNgk-A>-P5$<-(ir+i{w`1X|U3PvuuiYHRO(?X43G%yzA5#1owep8ejQsBbkL@}2$%1qb>;gS|e#S$~ui`}bDss4NlGW~`WN zw{9&~RA`JPV4D|q6m(R!Y=q(I?)G#mr{8aj+c7RvOiDhi#e?c+CR~-l)1#*Yn8Zpl zY*zm}A|tz6>XcK$eE{bOPF2`H{E2y5l~irjuo)VeLlB=mJHgDGKk519v(b^7qu)+k+) zmPIxuSflojbENjj^H`}+CSldM$lZ)@zul_JX?q`yX;o=k3a_zck28q07{{)ZS<5mH zN{u-z-K1MOZuLgS3;a`)+fD-)?9;&FHwv>APNL|D=1nx;-OvDPtNNAVvinU;eM^`7ahyR*Vu=%Ws_fZ^be>8^mPc`3_PJ@KD_exdmib1B ziaA5CGNiI?2W)S}jS6pxU52VA>_MVccHApTf5BpfWV$MwwNxWx=eAF~q}r-VEn*Xh zLLK|=O>VRYmaaR^XKFcB*vfK>jtMb9>EW^H@=!|YPi%Vt%bQG>2JF&u~PrTwRSm%ne}54Idf3 zzOtDnXf8@mA#xUkHpfiF@`f zP+m0O-XdP46mk%lcNR5Rg^VhGMtJ=G{;1dU?ekw^BMQG9*mN?aibmu`US)ds#7!ff zwh3*54w4;oKI0_JPj84w#O3eY;hVqyI_$Hp0>{&~(%+O{=d>J&lx?%>@qY;Q&jG~@ zdvWvjo$@<{{Vxhhlgt^!d&T_H-7l*i-Ado3R#~x48-l(lgln6hxyiqE(PRf@O3SY6mWYyc!1<<|EJrr9rpOJ-5LMsxX_<}7DeXi@3_xf0NyVy5vN26 zlt``sC3Bn-2~gU)1e7Fz((*N+1or|;_kq%Le4vzvQ-T5|@+&~e823##zOD&*mbd1Y z&Kv1U@2d%Uy7qQfw+77_ zjBTmrsvGw59+j$xV%tMxa%(#(DLkxMk5|2F?Oy5Vt`)hJo?*wGw#{F0&NpP`-`6}Y zs|n~>+Fy9w?#wD2X6qe9G86YB`HIl@Odu+KWA$a@MM^v5+M~a8UhDs{(Sy~&2P z3o&VkZciFzncK$Rgfqh}?_2qQE&xhqNJ_ zUyqOzl<70MN><$QN|F3*?bYNqlSeLADjN2oxpPG3v+u}ZiE^{L zuSpWxTUN5>`aFd!qd|$q#=cmtpV0;z-#aXWF($x@JdJA4V+$sxQOvOLELf ze97JK62AR=Yms>7`6dTb!H+*af7p^^vqYSzg6Ne&@=p{~GpyY) zR@W+wc(@aMml4qR0XND`87*PPX^r*k6{$R&@m?c9+T=u#C!@tb-K}9oy_l|;)@yG8^O=|D1N41>~ zP)iWGrP0J-y@*De)Ud5bwU>b3Y}68DoThG~w;n{xnbdGRF0)x4!j}RAyHYqCt&sR2 z(d$@W*tYc>_|6ZycQ_Mr57=iy%iN@|7KDk>=BB_s zdpkbnT^T4OaREQ!zc_@5J)bNe-qmP@1Xw&_<1bBqFg;E5wv*^Kle?bvsbKE#tAA+< zPj^!{-3C&$$sN~vBQSUP#s3U`wrRBNVo$4~Zle44w$c3jS(4=QrFQi!*2Jt|E5HYO z|M@{`SY0cS;&~9~)e0W(`8YMXQff8UuSSpF|4D=QQ20vem7Q62g#_jVuVpWX6yDFG zQo`gUUd0yD*!-}EbG6j59TKMjawdkNL^@u@cISowq|{($16puTxXmOtp)UpdVzjr$++tREExPkP1pq4f0 z>+`K6-$^I?Vh?|N%FGBaXQcQ)6s666_o(h5IZk`j<5$-f7CvmsxHmNaDD1Fq$)?gn zb$qU{ZL%b8cUxeh zq;q-qHZ*RaVp@WnT#%EO+hJoKs|yOI?NXdDr%&?+5(F`vFvI92m;rW>6K0BDgI$)Ufx|2+wqV}=ui>zF zaeFXtg3oZ6dFB!9vi~p~=0J94x^!#X0V z^6KqUec5fb%@9Oy)n0dA9*?BV8E{JVU0JN?_Qq&t7nJypv2mFGIFLmR)w!qQubNbM z8?bEXhGW2amUUev%F1rsxWl6=yS@3>s*^d~QhgO>tEV{JQyUZ}s|`3jQl-Gar#L-R z8%TC^C0$YXskmS+(N~ZL(i&VadT?pU5CNp*I{Q1co)9`9p(Z#+`zE8oH!GwcramBTr5y1GWgt1C^{#a{j|w8_ zPn%!CCH)iLT(o3RT;?J+B7CfW2#~ayTMf? z5Kf?(0vh^}*r#>D%Rtv}m$~~z3b^(c1-M|~*)g=nfQnSq>x{en7S^YAqM8`~VdHV^ zp6)kHjZ@B#W6X*a7yY~IXGYG1X#dYx&q3XPru8vv(&K*hMT~)K@3vWUTO3jpgVYOX z-DT@*M;Bg7M6F6ElI0r;9DZ_|E${j+xl#^JEz^VU2aeHTF(%^;aFzJcGSDiX2i+uF z!K{Jtvq-XX_eKg3R+VAQR$94LXKYNyOCfAyd!DJ1Z8Ie>k25vd0pbw0At1nOn<{~M z0>Q%5MyZ0XYhyN$niNqeId_vC*vg zcDg~7kfTtD;D`q#_v1eNNKQv`9q+W|Z!#3Z?Q@n_zAT0JcFa>lXCGGkZ4*pHRX_>r zF=ny>EE1YCBaZ`Az-?g3`S}47z_LX$r^EcIdVyu5mju6xpBuH0Fo~H{5-{qX>!4X4 z0G4fWz6$cD!w6_bzyb(f1G@88TD#B+r-2m_&Wsjq(R#d)mQ@2NX}*1sy6m>RDB`9OEzJ~c` zv9TKeSdqQ{da69)aujX$*BtkFHRW~sJ~q~OKlXs!qADVJ*IM_Pm+MgWS6~2Y%S_o{ zCkT(#;-s>_hEX4@Wg2CF1*<*ViAeXE{>y{x06E=f)-U(7O;Nhfl>Y2zH?`KI;@kmz`mOU8Tg9ud@6lT2qcbLiUrnrzhhgnw!injh5lcYC&VF@GU zDi8?2s+j~D`r+87x*N+tS9+Iu^M#Kqx%00Lpu2qUwB^)*3Ia?&uk4oe2VnZkoF5?K z!1SXqH32x&Uz7q17nr^iAvyq|LpcWe=Z;-cUE#hFy)K$*=cj!m@Aa z1&R|Xs2lWLhDK544)`%)R~GBYQZTf+^}l?dvm?xZP{ta6y^BT*K=$T+Y zgcKXgZ}X0!^?slU6Ki8*wAqo~bL+-_n3m`q!itzhd>&>iZcAg=W^`a&eXNEKFLH`` z(|8xt7QK+GjTUu{F||W%c21X31xD+Go-OsLurYEGU z1~Zpr91xo?o|IEL=X3$xnd_iAcXUbrIy&YHM+a@baCCBp7mn^S^@XDo{nycjKx$g{ z$}N$}!vpn>)kj|^jE+XX`?3$MiLn|^dh9(z$nBLYUVoi8?ymf6^JMj7?d~WzwCDkG^~l6%;FpF3^`BabmzqlJWt= z6=cCm-Y77TA5e#5B}oL3@?Zj5Pi?5kANtVdm)*hE%THpLIRg<&!;Z)(XhU>K=}7dV z5rWx@M8McdA59qB7#yQZgY@xihxu3h9!GGM8JuCWJOpWKD_BBRabYqA6 zK)^bO|3T?Vj@&wJStp}{@CBc7SN|hj&$*}jcC9>6H?UlUCs+G>_K9qu_FPp2j4~$s zQve8}Ool&pWCJy(DwL-pX|q42xx1?YS6{@&WbtDO$Sum0y>~aXSgl=OXMO4vqElPO z&;A7bU6x>rHYo48(^AnXsNP0Oh4lZxffkY_!I`_#_H^Ahr-6SD^8&8D^$T$AI;J2D6rRU|BH-U? z2Y@bmS@5eDfg@eF)ieM&VC0w+d^o+sQAo>Q8z?ElYdWudprOuU)LKL5?^F^P_%~>o zQw}v9X3~h0-juS@$RiweReQN)sDEXEpM0Z0%d7?^s%Fqc_9v1uuhl-afxST6Oq|F~ z?e#B%=}5|=?_07&I`1mGrzl;r3%;bzv2mD_?nP3TB%a8k;_E%7bT(y)fW=E`Y|9dX zM=$kySC$B8@I~v9l>CurLB-pVlsJ1Y+>fLL&pxR9IFeGN#}l%`k*xPCU_qY*9Y}3d z6A*1pkG@7@S{sli&WR47GOr6Lp>U&uJnRdAcwLDHX44%6(f6sOf(VVFAvO6W2=7?{ zi-3c75Jv|92T!d-#)xz9^6(%C&cP4207L{F{AMi`1UUHoYF=r)&=rNRgC8W%VM~8( zlMnHd0tl-Bws0{5*z!dQK%8F#0OD8#gT~1U;2eQG0C8xBVxK+Bg=!JYQW5(6Ac0Z?8oZtYAq5QM>o!_(|f(LY79oN$nb@8fjP{)sNDK969QDNewP znhrV!f+WV<&@O34rxq!^&`mA*raOP6J`me#OSTFQOW_4?XiNTjIxY1f*bzXN7fVw0 z!CN|#osYMqB!lgBB`2(or0SnfRWHMxAvNUt@C=lWWE1ge%W57JQs4}r+$8E+>~Am; zhp?${>$-l>>VPz}W6Z%U0RN_qNkg%3cQMsY1Nyi9MeEamfg5N61Lw{G2%fqJ*ftRW z?@6x~1i$Jx0tByj1sHgAI9Lpw6F~Q!8_*T@pU$hEXsCNPZmprcI&~M|IR|LD6BspT zi=4J-k9m$*@gzt0@DY$2K&jrrg7O%C@pu`yiC=4c`$OnQim`CSDmGTEO7IP5rb zTm(iiTVz6!F#lKtvlFF&v8NC^5MX)@?VCs(rgy;9N8>Pk3(7zqhv~QTsK^1P=c(Yr z;xK(HJQz{)#FZT1vYr}|bR9VM^_($Dm?6ONq}*A+r&Hs6`i;K|GnW8_-_&Em2?I&Npln$1nRpw<<>Wyw5l6`D965O1I`n_WB=`~ZqRz`9eZ~K zKt{Wx>IG7{^&rftR~P|UBs8L)>6=@h<2<51lA2pTk@OC2h9bik!G0j!LaKD$e*z+_ zt)YC+V>#@H8=HpmO)p+z@v(P^Lq*KRO(^zp3k*ez+({MADwtwPyiB1juR)8W1q2 z1CPD8@^-Yb`#7jlVNrbqEd6Md#g}~qpcvyt0C2?RaL`4)3ILpeDsT#aEf;i0x&grP zrd$J86?OnEFIU_bhy+C8)^YN=E(urou&uaJn@RcOwB7C z*lz@eZ*>LO{FiXBK6)mAu9X|m1>?@Erjo`}oT$#^^o88z*@u@C=}UIbonU5-xL{z= zMlKNW5NbWCbuKd|f7{TVgZ>H_m_5x{aTnNNv##d6A-xx0MZnJC5_3fktzlTxZ9wUg z1L7z%JBN87ksM0>U0wIo?vB1$mn&6n!LQWkK%Pq>M>O1sN|jnQ!*+WEK%a}L>&A`W znzFtdx8if7>br5lZi*u)wE+Nn7$+(fA51_p2RhXkEO{6_I2AwC4jJJ%)jIH^;&w`{ z%mISaH0*AQx1SLA1M@hhlv=D4_XESPtSOfp%ef!8rE#Rd8V|T1SbRaGOkst29@v%e zr6hmf03iK$+B$1ROm74C15*-9W5-hT_1Iqk!*iuvX4x|ShG|V}dR7rL323=@FiT^P zL39xPP{Y8RO#na zZ3Y~lQ?Uv&ZBv}FsnVo7#w*px*2o9ZJP$mgMW&Ob2YJAZKT4@3py7S+F6>E)f!}N1 z2R8Vj(hZ?}W-1GhG13je1!gJ}dWq5vAp+(q`=ZZ-^{9h`66=1%Xg^I!X0|r>!*r*W zP{(~Zj&3ceoS@IyoAMapFp8}nUEPuhC!Nrf=a1e56W_`2@PE|I7u9uu+k0R=I1-NQJ45zhP3c5Hyzq=QkD%CN8 zopP(zc#U)PeK^6}@!*CdkNg6hr>|cVkRyt#3zotOaISs^C!k-%4)xy%9{lgH`lkgQ zf#(Jd9DN{lZ^P4i^pe3nZvqDdnUW7M{(vN4{39S?mE0ZxE5J$*7(ZVgFn-z*VEiF# zKo>0bUFh%V1?rLLUL$U1)t;bVT z{a?<${J9y_oP<&3;AT*vedJT?8(~TSwJK;MmGs%GwBAJ~zeT!-Qii zVVvGfIJPpG!;1;WR>I)#nHoa2bt5oSnfuQxE+La;gt#6Uhv6d){G7P}k3fh_#+Gm~ z8+^TioWdRf?2`sTUIvvbX7eu;$Xcumg4w2o8hJi?3d7M*r;J(ck}f^r(x` z6a72-ZYpxo0)gD4ctJL1m2+06FZSsNG(a=rSdh(fojY}L;M9MCfIx5I3mPX2;MoPv zqrhNn(~}#k0Qoe6Y&HkS*rD_<7&~RE3&!rI^aW!_zLKXP!tT8dUcJCB6rH+xD;ZG~Req}v69EUWexMSOmbyW`0c{jj@pn>ye%{rSU4aVc z)~BVuVnVy?^JGPx9gV14!LN;&vmiXI-JN_=5^z5 z(AMZ*%@r{#OgzjsWR}LxUFg8rrr1GUeq?eZU}2Vxl5wm|C@^vZKY(Vqt^hRiB^&^m zo-_bt3@iYUDV7G!!x8{w=mvrAjTM8L8fizwW*8fwe17GFJkFQ~lHL+2K9YR(4v z4bu<}0B!W7FUSJu1&lq+(1i3uv1xmmNDiFAag=^OXQyx^bX;p2zuJ*0Txd zuqquLW_=oXXaPue<$fR^uuH{TnJ!hH+AYw!py-KoSaXLRwXCDcFBp2ta%F>})siU= z`wN1e(=PQx+eAq+hwTMF54TDE5Mrm5>^N*erBE>o^OkYuWHt<2gh}|7a)KJk3d|e3 z&k57}x&f=jiojt`X*;kftTP;D`sDzYj4gx1tV&K`xCg(BsR#fJHKtbz4g*=7k>eoh z8elK-D%Pbw07oYecZUFi8eWIel>|v#%kd@@B2qB@V%@>b4>6O-@CQbmOKUXIQ)Yq?4w zH`t22RTz3Cdwt}O2U7!Zc?NK2CVY_3O|iQ$`GV4n0f#FSJ|OQJH1}n%1MW&n>rgfb zBy>`m$Ff17HY25TDjRfrvHD(ik;X>6(-o{_sEwXV>m4F&J@J;Fe5W8eRx;RHU%vh+ zEw(;*5BTyIj99!7TLVBZuz?!Mj)DA)6%Q7#V+vGP{Sml4K7+_W9+$_jMo^LC@_1(@ z5La7*V{|ByxIEquijBtQ@dv4Z?lHAA*rT<6C7*Uq!Dk8p5Z?=^OZ1Y$j6R?)Hy`@| z7ymv9xcGr{Y6tL_^zZb5pXUYCr9aIGNOMEhfG*D0LF+DjT`Jdwue*!B@O8w}7rxH> z!q>^^UHH1oRFLuk&qDa$u9as~X1~Z%ph7u4(M*)=2;-Qma>TDqYspe5OLFQ18u-}} z?-UuLs47PSm`{dr?$i z@RVrcJ&aHs=gwSQv@PB%yt!gNL&JoCubzTe`~CD*?^jy z*I$6ALJRu=yYsF+e3ylM93kUV2fl5pkV0x0g5MH zG60he0MBDa0C3Wj0KlmS0G|HcIkjU20FEF)@%}VJ4NX45phR_7ZNXs13qW~1A|pv$ zXkX^0hJZ2iR6Lc&h4vU77$YvU7eSi>aG`y676HSBc28^cH66gm(2|d0na?R1`0$z- zhhZ1MGIxmpmI=~02QU!;wOo$EQ8Yzs;8cz4GUyiD0R;4=0U#i$m3#nmCK7O92xss( zpaR%xwsstp!CAaJ5C958tpZn^!kPRrs8#{OTCD&G&Tak_2nNDWQD)U-{|#tfX)RLl zNDk~@_%G)vZO(dkt77*fOUil3hwTrCKuO7Hm5tRP{6IEPeW6lWBI-4u*qPedm~=`v zWCMr#9aHO9^~;rOqsp=XN&k(F$&{fZlC1dqtSn)CoppoGx@;iWaT1h25=jQ&Ur^xy zz(4kl6qY~On9P|QDXfz~J&T}`;%yALlCqJ)Ih>8j?(1|!#jtU`=@bXpTkzW!ao0y4 zY#(T~hajdcz$OE%BjgfeFciW+1~~X9Kf!*Pc2|h_l{P4Zug@LgRks2l3XZm#k-DI* zTrOy<7C__UXe(c^MF&S)Eut=Ht7F(XZH1{07y$bUMzf2kt>e%47UYCHp*K(goI4^5 z)SjquwI|}gf?p?n0X6@E&5o`+2MPH3obzH;6X54ft$?mT70?AEAJko+(l1^s$>en0 zxCwR{m7}ypTl;QfW>Y!o!N84Nl2BJ;Ypkht=BB(rF>Vf8>eSf~lHooY@|Fjp*b+%u z(PYcy$Bxi8yW66r_PSMKIFhp9mt!hEJHL*ZzN>I{!NhDI8^^n(Jz1jH=2hLvyH>hp zUPpu31-LTo3==pH_8okZ$}Yg|JNRk@N>^atfhm!$8E)T!lbo&@Zr_1AO4kfmgDq*% zHOqZ+0__@uT_->X(9ivfj#i>X2T;$~1bp#gMhDQ$)CL43@uLGYYy2Ty$Y8K(rZW(t z#P|~=B?Bl(_;ed6_oHYT)kzp}Je@JLJ^;s4PBI~2IG%DlnF<2(xBNoj2vym%9^d9bkw)Sh_GYfrtgPp_as-KwS!w;$)~9&@)9Bd%Bl zJU(yF0?@SrDJ=~sNJ!;SVXuI=*2?L-aR=~}bwv82xCg#y#6^#L;I0s~KL~3YI+v%D z08hCK{pBWl%qPua9S&+pu0d9!nO;x(A0zCOv3@FMFkMjsb%7dQ-fvGL3^O| zq{JhX6@aTnf%;6)E)a<43uZOp1j60ckhi?v#afc<_d6Os5OZrwHgWY!)uZ#ZB|E9c zrSQ0oDs{&&7h&#hweWEO2`+ zpj8)pE>gjsG~Awx4b;V+i&L0^zXM&-Nf7IQ3zTQOe3-#}nAtkE@m%`jGK?YEK?m$2 zOWU=UK4N(P^?l-BJQhAe49#?V?~@<&^M8|6LTz_mq&Jod*TiS|D?j|-;!j&zqil~* zHsHlBBfj#ugzT{&Au@`VXDhoK%^$l=j&z;QUoG2q|I|1<+nZORL2~o&cF_>=&G{mi zzl}n}{S%iiudtPRd};osl~jxNr?urs`hv{jAhBsJtgi_vEqdIE=qI~x+Nuim=@mMA zp^xOe^Sm>9E0kPt?(${dV4<_eO^EMG^T$ub8|f_y+trlH*Z==dnEij@+z2s>ldEx3{R_~E=dVUH~d8g%Yo z>#_YN`hqlmTt=_5QLmDPvoiFvON&ON|IDc64aAA2aZ(yeK9(|;0QN_adjeX(r zCQNK5rs?7hily2jmd=YeD9mtgP|tV{&HmTt$USIqxYg{YVWL6d z&sV4fll;9jL6Pj&aUt?k$-lQe$UeIGjgce6+v2AGqMihveXocSxE`Kk<8;lwhm%r7rrZgt8fE9{{CqD|a_7@6Np$zdwG}E?zLu|nvEan*kVu@*$fA`&Bo%hYNAB#!+ zv~PNn_LIihtFZSg=^9~Mal>4^_flBLXaCGs{3@(!_9G)Mguibacg?4j}+zv|p|IQVnJ8Y4G)r@Z0;a@jUBE~F2QBv5^Wy?eKe zn}o3Yvo*1_3^rc8N|4O3EQ5H0X!OzZf!@{IEc+3AA-5bxkFNOY98V@ot@ZD)lr!azR*%rWp4Met@o*fMtc<0U{T46~Ha+JvzPI^8o)OdXang42+K(8yOS6wzUh!c5)8VHUxc1%ZKjr$~$e_F*O+r1T zs%<8TvCM+s%*BpI_$h=Y5l16}H3-$M!TG))O@yI?^K*nDKR$Pe6)Q?TKZ_ohDe?4c zSjKdm#yyGG>~%{Yc~obRKKF9=bTE;e9(+(!zT``Mum{esM}v=?==1}XQqSFaJM8gG zM&rn~EbxA2!hFU~a!Ap*9CCCpaJ!K|SRuEmoaxl+e%DAxisnQ$-Sy1hQn^*Fj@cGH zk4!C`dVcOUJS-H59UZ2NU3TjljkI5DnsU+R{60UdaQkR9e7Z~KC{bQbwMu7xE3Cgg zM_-au^3dP9iro9gw3{j(E%tzbkRQF(5b=wvDmz8L?u*RlwKrzqt?Tf)BNrNewCz`S z2P$KosJ7w{31ZQw)gvcI+j$}DtE+1N{yC#6%aFH~gsueijo01C*w*j8n%JcaMb4@t ztXxAVt`yI!BXaiam)Tc``VkL64}E>v{dUS_SKY?Cne$Vk@<5GY&WUcxL-fT&9UbYd zeXhnU`0qM4zU)nVT`rz?>O9(b>{XeKtbG0Oh2GkddiE>QTLVYJ^vsPuW1&}Z-zReA zY*l??YBrRQl2NBiv*(l)KuRPO!3xCVQWOWMaO- zrffXvpoW){##B`0%g3b43VzpnA{giIOUz%RO=FT7c+4SGOW+cgvhkunT<8B)=v{gW ze<2s5lFg{}g;BA5+yVpD?3k@M3CCEfVKi)0KF?Rx%?Hz zd;(2>7-*oupiv71jX=fHkEN0QtnXR2S1J<96eH~tSr^6By4{n$9(hHq$}x?q(N|?X zXi;#S6r1|!0>hBQky@c9}k14APrJze8+P6w`7Wkn~PH9@a*w!W1i%l`grQc z0V0YICA4uj$3@QVBm{3r?DuGG!8bZmqOtt0ZBYRC{e!|G!OZZNyDrbcnP^_!VBM}0u!#0DmF!nI<4TrmW<;;~2wG6ty>nw|)UOk? z{WBtP@U|$f-TY07saT_D#aXk9r)47hYfck}pNJQ@x3VvpkH*8h5_)U5@Vjs?Z3`Dv z38$-`Sw{*;TQ9L<DfRN@E@`p{_CCG8Uz zKPhbGUY5thI@t7>n_6|k)!+HXh9fO&CtGxfvJPjWq!iS9r>+;D1fu*Mbz_PCL12g*a?yx&kpK2S%_hai|z7+!Wl&mui8#zz!T87kZ z;n73xuHimIZf))g-cw9={BqY>8GUQ>vd}%npl}JDyZ-af_FQlh$^(W_N$-l{5jFJ{ zauLim@aAbh9%!JKK$Cd5N8wO~_@g#(P$UmtM~&qM?;cq;Zv)|7oY3K1h`QMpgWW+F`lp7gc;gNz0J0* znqkRM|5~--P&gxK^d98l=*s}Udzh~`s43*SW0r5XI6g?bDaWK+MgGKBJ>s^UL+sg$@00!{{Sb&$tm#1x#|aLg#gQ*M$C20 zC!5lOU8kz?>V4ZdeCuHnTQOzIxT$5%$zu9l|8F8ED%( zhR7_lLi_SPeJl}kbDuexwT??i;z2t2L`aJ+C%fbH*8Jy{DKX2Z*2>WAb%i%FW_Sg6 z356U!zJHm*E5VJ%=3A>O84!}exA2}gh0S}e?I6Ik6BG(wD2YtATcjR;p$PQvAVDYTE94K7SW85Hrro~T&4B=HKmO}=AP z#P@dF9zO5Verh<@F+^_N5c+^{5vL-)@6W+$Kc#J#7$UPS3hg6U#1(ZnE7d}ksNYCJ zdoexYVq2 za_V?0eb-`Ju96rc1?U6Nv^9C0Y}%eux1e)&QZ_>m3$rAKNb-9+O=j>x4`5X{l~^&7iyf9H$o3a#e>5O76ey#KbEy>*QNPbsKJIP9xLusSG;D{eExj}1)f9P4O`!(cz&uH$c zjmQ%4%gMlA?4}uUX`z2lvgrnkz(TY*=J!hl{Fh;YeQ~t0l4WFBT=uJXR{P@+oaC2& zmM$g9Q{SqFV=z>=erMF#GbrG)I!``R$Rdczm&#AB{=L9XB4}<027OqqsH6#KuhB=u zgbJq+?(q_d_Qk39(H(=tmVTij1Ok@1s~pUl$C@Jfu(6dIeH>8EYwHYxvHTta0h`P+ zr4Vx!@eq-HM%L&kFc`w>9Hyc^MN~Pyy z*4#<0BmmLMYDq1MoM?%R6WYf2f~_o{DUnBK&B6V*R*{25U=;kvwW{ePdVvybRSCPj z6;_$Vt5!dq)Lzqt9Gcpmgy1|eM4q1Dj8G&LLY^nwI*uaXJfW@b7(|{YScC$|^Mq5| zQOb8CmBZrB@$h?7tTBGW=hn%{GB?vJlei^n&X7~epB4v`2Pv2yz?5QCw}G5eIweBV zkW)$$t21&+(W%*>xK)M7p5n7s~VBrk-Hhyk#X)2-vt_{x>Jja zwi=wS=3hX|c`XcS(&YS`4m4?(h#B)10*#IKqAO88g+Y6#*^gVNCJ|XJnD;0R*t7eB zS)Y*=m>~>VV?lok+!}oey3BbJphk7mZicMUV9fQ@sVD%*d{b6wNUjCoa)x`cE z_aL7GJTJuRD!kWeqi-#%?^{~yjT`Kg=VYC<ftzLNe`mWxluV6}pCN_fx4>NTcB zZ5Prf2=l(6GSNAn?)jIp%c8PNVtMaU0sHXYWywKhx4CXU<_JpO5#2YQVNmX-!LCQf4FPc*i{ESj_kVV?Z#Ht{Y~Kekhv3)k|j z>QN1OyPiG^aQFojDI4j~!&~RJKYiEQanX`-q#l?GCp!dW&v2P2D!KTyrger=OjKuW zTa73gzBQTPPmuR;?wZ3-=`&Z0PuVjc>Kb@8RpQw&SmJ^?QLwDQ%@R*|8mOrIlUvQs zE=v8p*(sZtN_Y}qWCTCMEI7j=IKw=cGL*nnO*E7s_pHrK3>o`xrQqxv)}g(J9-K5)3cP~^NLZIJE2l*7@UAr^&Z)47Ov-6gZ1Y% z9=Qg~^^zpq!G^hh{$!NqznXcalAjMwVcJasueOWqkxG)~3pb9GTOAjT>Cg4{e6+Qq zU-=8^n)aPjMJd|!+Lw{9oRK5Vc`aF{^mAa`MC>~&+G0+1a?yl}V zBKcUfYw=OPaj@hr#pd(`I?ky5i#9{@mgEERJpgT=O?+zAtgR{M49hLmb_TTQLByxJW#Ua7?1!;Vk1Up*`lR{Ch_)x&&stUX-V z-*1eu>V-~Gu4>^pyjuGEY!Q*9sgv|Y%4p&G(IiogY%*bqJW&(q+xCyHc6PT z6lT~x&Dl)lhK;7%VN%2M&xbtutaYosIo%r(wO7@ZGD*5mdPTI#i+B5>IOsvP&U&iV zatfb(7TMSdlJ7)RX>zl0cHB{NX7CDDJkfBW3!9J{)$sTmc+rJjNscmx5ve&VvlX0o zNSL}Tst@D@HxlTrhQw8vp7nWjmF?~MXTK7$qHv#0MYDWz93Rhv?=IIjd$%QTb>P#& z=+WDkHs)@$1~<4%%^s(e)V$_y_d(=iO#C+-I3;!T;7`ve{q??q=Qr-d`usQ- zE8SxAS;9ijs=o~8GY&Tl7C)22y`~LBK9R$xD%!6JoTnGtu@O=LxgGYk!U_|+XV}cZ zaGU+#ZS#iP(^Q+nH(lXd!dFOvK#FsuI7NyR@E2DAHcxmG)g=GA5wZ=*jUa#QD1~6# z!MlxBxc~9?xQiItR#PU*iSDrP1)G_u7a>>XN5#uifFc0u1yJEo7JyT7WkPUBUN2&T zZ2q^$fdTUd{`EtyOz%4+uSL+Y3MoNhI0mM)W};XBZ&Y=-=gbn6^Do;p-vg4@K3M;H56QAGw0nS$z?2pkKj zkO*iPN^pb`polKe1cspM9AIb2XX3 zc%~d-D~L0CpG6R-`%V|kHx$I8O@ii?)%a}gQ0|)hJ^3vhQ@!KH!Y7yVE!v?;0XX3q zOr~5^Z?txXmDahvNYh>0Rxlg&A5Z;)^TvTe1o*kR1>D#8Qvu~6$*km>NO`Z5aOm`rbU(~Usss@o z$M8wL3`%@HME!n{)G#O!1|gz>-+2O`riT|($FrO67g#S%nHk+9x9RN`pV1G%^^Sy} z>VBfxEwAYo_gv6wh->ho8F?=Y{G8A3Q#G(^E|0|6$FXboC8+yWI{V`7-U2^XKHGQ| zRqSUdTK2wohojNteKGlnEcG$ZZZXcFFw6ir)1LenTFr{+D*r@>d-W?x#pVl5~3sT~lh8o!gH#i#>1fKM1P?D|@VXg1@9C>ep|gt=m7p84O-yUwvwK{bn$E9Vj1x zQoI3_7@#z60wotHy<0%31mY5$#!?q1vZehgy^B#3I_KSr3#rq|ykKTBOnplnJB)0m@0qdF-JWZGa(8 zWJIuncgy}vqMm8VBs90+LPPCJT+J)H*t@vcJHOc5v!8cgCz8Yejfk+x>#eS?2eMaZ ziDE^Rl+UA05_!}b7FJ;995A;Fy2l$=cj?G^zoJH$mGI13Bn|MFlO;yy3Mk~$Z7Rk* z`8^ne)K^j|xglAr*&6*W0*tIx(6~~$uXg6TPph0<@D3SquoKHT#S%TF;&?FA;(STn zrSA+iA%(UF5D275@dQFZ=!3WnfuMUhli8giQjrhhVy|2kQEX{t?Fk`Rl}siH=T*4N zecQY5Rphs&&k?)=J+-#Z52=8^d-~^JZfVM>*!Y&_Ht~o~x=HN8ok%HeRhq5~vwSp8aDL5%PbaAu$T2Bg&!(X+y)qSlj1y|y)y2+(Qn36-0 z!4QaL(;~`2kWY)qa5B1K1PK5U+3vn(2dJ79ycHB70lp0&hweKW`3y&0m4xpsIvU-S z(IRljp_Cv`Q~1tJF)adVxDWCKg6L-S)e*$1vY82Ze{b$ykZZ!eI=jxQ%Bx9&PpYWb?}KXtky{_*DBKREl!vS~$%#Wyg8Ih||5{#?PpYfSS!+mYkW*{Vh_w zM~V+f;m-Py(lR_A>Cnp_IP}sA56+S70}j2+_?X$CqbqwXE{6h6x4`WyHn@Ggg92_} z-$*}Loagc7$UHxoH$@|APl`}KeecTMt%|svG+?~041AQGs4TR!Efk!Fy9%Tk_nl`q z&|SOU#GF754XVt{^AAQy&}tQZweT`0=g%L_7k*m5pY4P?p6qDm<)m72z07Q*qxZEy zhwb+z{-SVXy@pX!m%`e+5JE`@@kK>!WU6fZ(J{2k* z!X9lGd+WW|T^*7uExG=j`n*TGV96l>cbnOddcFS%aNNgHPP6fk(_Iu6|CYED;p*y# z@VCxye}EbD&9pXD^Zxz-Psr-!b$bb8j;SWAaMPSMsfhcV8(Y5eJjxGd*-zNEHXl58 z!G83q-somm@vtiadh~KLR-lI3bS?{v?>Dw}_qp&qR46RQOPa@HQx}Mojkc+kl|L)E1jd>^ZCadUwiGBPa=PFmaM5jn*{VJ1Z3f;Lp(Ux^FpSY zYdB~k#AyS)5}ILyAJ{^|9PnN$RZ1DFWst?rEN|~*E5Ue=ekNWl(Pe z>&R|KDN17twj5^^(0weo{vjNqB_I{VZ@B$lxi3=~x?^1@?o~BWr`6!He0*i}UD?@L zFOG+)zj~IBRod#!ssqu=o`Q5+>gDSlZ%urHx`!R%TLd&vwWXI_7*1?Kke2Ds(sgf} zsoLtQ2D+qATPF-*ZgcKxw_;fht|%E)2XI>lJ>3Ifmiwe>5QzTUCz0b)+3u%U?fV2_nXLe zs&?p3TSG@T#b4!0Vtwwt5zZj1B>dMLzwu2Tb&9D-OWMLplZ=G!8;gb$ckR`&37V#F zMF%B~GxJ(|n~n7vCLwi!4~X2>4R41wgIgQPh4Vrb+I>$*Sd@$KN@usgVn0$0BgHsU zOe4h{Qv5=SKPDSUZKtzaZs7n@8sX|n8zq=ON6yVsKJ+;d@`1vAzhoj+;D_K}=kH$& zyo|f}s{jiJm|s-Lq0h;o2--HjyBj=@-u(|WX$N!PI3;E2E(Hg0yMMlG;tmtk|GNM9 zWu^N47>AjdXMF3Smt!9GtB$Roz1R6JcEAm+6UC_-tUe>y$qv$eBPCo;m)G)JCfMSX z|Mgq9uQ9tgkLD#P0+JJq9i9qbvLz-o`DE-tunhF0lNWg$W__Cx@y)Z{Umy1|Zt=>F z$1o`~DreWNJCV_sYbnpdiXYbs0i~r}ecemq#Qn4Q2}F+?8I@Mu-*)nCwvYe-W_QWk z@%HBMoH_l#Aos*6>THTNC*U5!jePH#UwjPE&k(Qmh&n7_{Zp!aVVtI@?{p z9Bsv^9trR)l#f!UUug>WB#2k>K3iwA5>u^5|~A zILT7eym>itz4oPiPebNZT*f6k*P}SsBR?1MPVjpt^j|RE*)sQV%*4Gf(R<=Dr>Zii z@-nAwuD0-=6Ed7<^LX_0AfYIFFX{ESLobUPNK5ZfUxwGy{Z^ZVZ`SCu1NokFbrq< z^*yRbv_XiVrjaWvN-G<0y!sVU@I%iv+)l65@Km3w)U6H#%`CjcdA^=ivlF} zNSt4g=L+Mv-5^b&AQrbX>Q49%na$2ZN(fH%WwVB&O;yLzJBz^3=M+r;%~yltNcInv z%`hOh8EN+JMAH?quv5Gp{G6CcQO=vIoU-Cd;m=c8qC6M4_J{>jSb-wZe z;Sa+XNVb|c7G`%MoW=(qLKfc!-1qDMyzdhC`z5c#A;OUQL+jKpc(#R(b%vhmsxx2f zRpryWfOiIpX(pf~AgT@X6kucm@ux_#nqoj!1A7d}YDNKB&7ck-tJ%B{$Z7%sSq&p6 zFtS3D)r=yIlG$-;YW04=BJeLr(tUD=2@fx6KSP2shhkuZcZL8<&BlGV13?sk#ZIvU zYMPh&{o4tQ^U_)D>uoT=QnM*}&r4#z#9#Vbgbd}}X){SeJN;wfyfN`la{Mi?>T}09 zfs*#4?=)Kd{QX3vTNMJq)zm#(#Ue15Bm@0DSlWZ_Vj}Ha|D3d{-6P$t04s)k&rz$Y zJZpWJ&xIDX=d#jARh81xNAbl#%;ZXUyXhZ2wqM8+ zwz|j4<2K=0vN^@>>Xa|*Sd%+u74m|J5%t# zK>$)3SwKp2XODJ^Y`{xAjkYPG(1@b0+uOoh<}^g&kaG6@Hw4_m;Ylini?p=K5AsLR zP}{&yMv`;X)JczBq;GN3B#|RixoEQ8dhZUxv7AQJX9{J#*OeF1y zA(M3Y!zgjSk5pgmKLt5*NiDaP(R$KJh2uw(@%@l`v?2}T2f-=`9!Xvt8079JXT_f@ zJXhuJGm#+Bdh7L4C<*xnybJ5$5C-4pH*6E0ciHtHB)oh^oL~=m`Eg+H>nAd|g6eeT zwTbz+pROKv*>>R7FQJ#6{Srjwd>+7({{1oI%MNvgjtr7*|Jt^OD>1|0E34K+8tGqo z#!@_6qMG}6Xnh)00zxc2N2{G0=5>CkB^ZBJ_iE5pu=!lTOnD)}TFy-pJ=cUbG{oSEIHCKV<2XJ(2vbhY!=mG!>muHzQ|qid4}Us+fN zA`9<(m6hUoD&=(|26t=kX7O=1weIK^uw;>3(A4HQ8k`A^a%mI@Z64b-SV`N%q1|`% zCvqzg_}MKmPb0aoNx^ZX$nyo5$b~i+26_}U%?;!gbDkN4^?u4tnStqrEW@vq#xK{i z7`F~#!!bgJO?#(gZBiwc@!L5QFIrDVwvwT@Q`w=_2GH}5W=;c!XoCqxn85+@Q*&x; z)G1Q>Xc-vC|LO@pX?9UacKWMj3-oQDReT_J5JfVl{${}@*=-@NG}_F-{O9LDal3(e z4Y;M3Pc}UnJ)UotK4LpAI8}2GPoa9DiLo#A_T#vbWq3=MRAjOhcTG}R-Bd}*k9mR5 zQBfw9uOyQp*uyZCMyg#Y* zA;q!P>O%8t60a8!Y)Dv-F8_#E}P-k61cdGO=lDb_1B5# z2zRB&?3>L5lH-@tco6Ihls;*?D}4%++Z^cyI#V%%N)2U!Zt3>AL$Du%X%0-E(gb34 zruxm6^-u;?{y0g<

wTGVB-01*u`#%Lr6P>UkkWr0vr~qVC1sRLO)>S~pV(#=I zP-+rLR3RNQ1&Q(?u_$c)IY?w685-!KSv_}b>HQEN)_H5hpzmT#b?h>`LGnyg+ma>ZOYZ9TB|98?GT91^sKpIsUyW@LA<|ztJi`X&g(C0&FqEZ4ht-**?jwy zSJ`}!BE2Uz;byXK4&o}kDYVIgHenW=-%kR97=}n`Kr9F(ZF{v)XFpl}dWwWMS0HRY z#p{tbuN+yf3+<+7H6dW_TUwVV{5lc1B`z&^_)R{o%gf=ielx|BZyVxwGib-v9G{6M z^EQauk1nJ$QZyPo)DVR@p^@Lopk1`^!(QnhNx<}DbGFWmUb|t(#?~z_wr|oz^q=jA zH}@2uKEJ+bclI=_Ruw(EmMrmI83=oe(j!2Mg_32=->p?S+XDRtGw|6M6nCaLId4;T zFh@HQ3dm#rH0OkpPy+&dXL$e=qZCnCj9^8OPdQG#5Z{t&Cp=dajGtlUOy zS}8cUv_IvwSV?uefDJoTYtJOYFy(O&fapXd>?x9`d!5$8d1eV)%Q5nHdM z{K_MrZ$n-VK1JN)tKMQ+>CXm$<)R?|MQic)O_R>k;CY(>lZuGKpK%@`{Lg2l#*K`_eQCmKbT8gHUEV?{!)I+y)Sx!#6Dq6obxM!Y z?62h-Hd6h)=LNGh_TWD=)H}AkVepudu6=Lbc^!i45@SdiJx_;)pu1-hEBh7)9dvI> z;O8>WgmVj2k0sE}QMZ4+sk~V|%-%iyYpr3b?)t=M=Saktgq@xT(#^7o{y$5^-6CD% zh;Z=O-4+^|w@H5(ljo&RtZ(aXKe{}Rm#r~?(nTcLjnFBjqGg|K-0G50>D7+Fw$_!oqO_Jw67u1*f-w6rDu_ROv|X61uFOMruO8ZDSWm`%1JEZ`ZY=_ z+L=B*%12>$8{>7;>meHBV=S>37G!Ttvy{WOp7JIZLU8q+RsyG_b$D^+q@R%y?o?xv; zw|RD^~6r6;w2uQjCjx z7qi9qRkjq^QQ{y2tY`cuSFD1xL(I7m^P6OQx=Ukj&ip*9{MTlN4qCmYsCghtZ}UUn zVi_EZ@x9L=nq|fC+GP2SmOW$S9s>d{jyv|6TWnWhZLFx*oGBv_n-R7N3SCut#8g+w z$GZCbi#;j%_!~(Trg{+Ni$lNn!3ea5eD+-D8dvNPez3KXyqq4!$feO@@rE)zaG3(;bYLEGr6O;4p%M;|ns=G<@0iC4D?2aVFB?t{i?r;}02Ce^`1Q&N! z7}=YIk#1k^W^@PQus+bX0Oid5^59LvaJ?sYD!P%OLb=Urd9)#M__Huk=YRS!?8U%; z-c;Xr^310M|J15*tn0(yTGb@vL(!R!i0yFt>A{Y}9@rC(On>6Gm)4a8-Fbl9Zwz|u z%cUJ5s3ZfYwC>C0BdG18$gmf?BzIp3;z8TF&ZiYJXn=_U_as+}u#h0_wO_q!=W2D7 z2pB)a!;-g??wjcdlkWM|`$~5FZ==c-4&nRAGX$G(S4L|=b0EJex0X^`Uxj-r`y5C( zUn`mmx>r6?KN;$Uk1c3JWiGqku4dwpvTa_*-i)&~{8@nL^>+c{Pvio`t$!9E@}&_@ zc!!2M-;i?6eRpJR4@hD9Op22tAjSK2j_-&0>LBi5QWIRx?SRp1UPxU}zbzVF_nk52 zH3y~55&q#*Bb>2avlnjej#~|+dlD&3Js}~cG#>q*pL2r4#7!8icfB}m$y%uV;;T66B2EG) zRbij06&R^TfUecom4py*O90eJ`2M*eH~|jjT`{G3ax}LyCBZH--%6JBsQd(F z$}{FntZa@zZ65%R3%2wxNREqcF!}+<#qv_p!F|AS!3_8p09p@-Gyum%4&cMMA2dil z#4ag=2KMpns{j~AJ%H#Ta*w=e6BPQJFen7<7w~oCQGBAm^t}F#mzE z4H|9`jP1@2&^chlCjqJoFk|Wn;w_+5!Sep;zr+Rd>c9QhKbY_~ra;QHodZyT)VnfN zAxS@AV5R_6AR(qd*Z~ztA)u-N=<*WakBUjvwnPXrndHzu5G+1Ab- z^%kDm3_<^E%`K(Mu1JsBX)B69maH?UQN9 z=ewRW`1MKa6OOt#3oayO?T`i+4ZR8Vh0(eyyh1SR){Po2qT4VfUfZ0LMWf++iO3 z5&YRV|4)D)m&%}{VFL026KM)}+9rjUv{$G>dbc(9`V}SFeXi0r1@(<=X7e3TP&#K& z6l>7rYtYCBP&j*}9DEP^JJ>{IC?Z#GZo&DkHx31TVyp>CD|R*oOUk|{M+}y{cV6Yn^x@CvpQrTq z*(-W9pt%D6q_dmGnGO2QvM29XE5(8T;xMlZkd*YTJVMf6-)#EXpgj0QN#zrk|6tgD z$KPPpA8WaPATaFNA4V?6!Ke#4-k~C$A8wG9M}rQBP(N`m2y8oGaGM8O3TW^s`^ho- zaFMSc(7@{lmOrl_5`@8f1~pvp)}akOb5}?1?idA2_YjZ1;T1%iv=K~D#*wjzOMo@7K4nByH1Oi&V*IS7EM8- zJV<;JzW*E~=JP^^K&eS)o<0lXWp6|N@@6hP{PRs#4W&&;yfdyyEr;qZdNH?O@q8N3 z`UHvNf~W=K>spz>86NCfz?XL#P0qL|C0| zRqOI@48hmo&oTlb?mp(43gufjv*q+WlSvsvY#~mN`qqb#?F4p$kkZEO1fTn(K2k56mzUEzAtf$S-IL?K_iAd1_b@=(GmHe@Pgb^wg)`%g%&^ZZ(7;b@A3l4`zUO~((3#~a2 zOULpXHi21TnnBnm?UJCOFioVxl4s}=?ULs^q?p+SqI8$`2%Y+9oc>5nWyOS_MZM%Q zOWTng(Q#$S-rFI#)1A$n@Pn50v}BeL*Q4~dtF#j<1`uD-kQ(Y)28$`*p@{mOqB7H) z>-F9zC#xJ!$_uXFV>}s5xoNF;IRBt6v-gZzw#o_`zX-wUN*9Rfk&kwWPEF#2t{bID zIBPEX(uptKLx1L)IC`~>78#5FsBo`%t9a66E!o*egsZsemZQ3Q-aKFNHR;k`!WF`F zL{aTPJLnVtP#=8Wfx10-l*@dQrgXiexoAsJj)qugK34{}?&dZ6seNEyACq<`&Cfn^ zyJ}er;$I=;71Esj$}fH<_Sq~8WXYwh8`mMkKAo~Dj5a-M#oksU^R~e>crX}d6R1;Z z{X&XugMh5z*K8Usq33Uhm5=+r;X3`oT3xz46UF_o+7q>vKG&uk!lccW`C`q^mR7~B zUaru&io`VQ+XQ6dA2e(qG#Io|uLNL7MUoO+j@!0>q@?_yap3S1>%Mnpy@CG5J9eiE z@GEz$D0iw*PgI&9Na@(kfy{k%(DFKAx7D7A&3gYn@i^wcL~NELM<5d8=XQ`LW@ZS` z4Bh)#45zI}eB5Sit>5x~@U3-;)6q6Dp#+`{Gj>-meU?IGw&%DIq_^&!f%(!KBl1XC zPUkM!<&x~LZbEg`Kq37vTLnMk@OQ*dUN6aJrg`(ep84`?GEF3+Mn1>M!1~NQm)a!6 zY3I%Mhpe)7MPX~7JD8MBb)NlfJ7d-c=vW7JRsN`FR_YI5`Zt%*W{IXxx``17r{wOi zd+G~aO2j>_W|H`@_sBLeOa~Ra+Fb5C^`cS*udR?@AlekJE3fU9Z(w_B2lcP-C#V$I zI*h-5e?LJ13L#Rt1r$u6?E6q)U+%STEzg(;^>b-;GAx?d+`HiLP#HFbrhL5aS-?M* zfahl}R`OtYg|*w2ko^!fyK^DEOGfJ_natS=1d>osr%2D6 z<==~+U}~z#i(#pSzcL-OKjsX53D(BSe#4PfJTLop-|*(#`NZYhUdrlfqt~vJfjm}} z{5}rKpyh!og~?S~FW1)=70r03(+o-5Bg?&P=EMt>V9Q+)(!qi)ce0s(IA@i84Jm&2 z=K8I2R9!?n#ib^qrQ!v=V`cT)<`j=V;(NU~#bGmZuL-s!(@~~rb#AJE*+;jmR&FTg zW5_VfYylGN+g2sGA)&rORV>kRYIK`xk}7oS?)lX5o`ss#?qbY-UMXGs~nAbG3B)yFnf`JA8tk%e7zi zlO=95s=BO&ZVN^yA3o|nUF!CsVp@*2%Y$GOR7 zc;=tt5E|><)6-p^1VxI7>fR6=L@!TvA@tnTRKO@ymr)y zS{?X$SWC*Bq)ueAq^a1e&5~daGxR>b!=2Oz9b_nsuQ)Kj_q^^uwBf|}{NyPVz}B1V zH6K!jxvrZ*$ro9&#sQ5U;pvfir-*n>hkB(KDlL7wB;HC$`)IT!aqINGI4a&<)vqz` zwexDhCPniZkj-!XHrV&NV?3E2qr*SnL-nG6jD8`-eCPO!>ch2zUbcFMR0*}%8TF44 zY!ZuA{Kx7)6b$at_y3k5rtha#&yH@VRwt&%5a1)Tk5fk7J?`?0K7!h@iVa(6eat+p zK|isQPP5ng=+2$1D9S1(kB`uMZHH|UWS~e9^yQD(obIPy4^2!AA0V?I1X%Hhxe)SC zKCgB!#Ne8c%4-Bp;Ek|+PSY9H?f22pVFB1*$+Wf1mXk5MHUq1NRWk@AVfp&OE6co`V>M3}8X_@08Wdw?aAe`{l5d+rx zNMpUQAl#=}@SGE}8$SC&rZ$)`@c})PZ6=2B2&z);_pVc-n7YqS5gkC&c;M+7A$EYE zJ-{80cR-z*Qzmzes9(!u|M>!woU)8>&9O9#Z)4PUK zv|ZxYue}Sur{nNU38RcJu>^IBtY7_bv(U{Q|BOgJ{cE-rlpkBww}#j+{SlAvexjTzr(k+UZO{XF5n<~tE!%y?)n&#OJlsnZ<4h$q_MDf+cT6%a( z-f?a=l)QVi1H{o@LrJDH*CF$GDhHUV3`3LYB~>L{LzQ7af{J|&ca}wsqbTX9_^wku z=C8b_B~*3>Eiq$4nuDsZd~(o4%^KVAHq!;8_Kv?e4#4x!wPj}1m8Pupg>NLG@RJLbWKG>)kdWZR_N|D73tjl@s?TrV?~5TTqcEG zR7_+I#tCmoD*Be~uD|%?D$2ZK@q!hi{wXZK#ANtdUPQ6aC6 z`gEZctvvTxG0peei|XjpzvM!0k$O7dzVk0in(v^Ktt9?o&jpKd7Is<;{V1O-9pi$^db=A{@*OY`IDLXdQI z104QHX40YnUieGPYNeSjYJGOr$jRZHH`y*KQKL|7$w2?~z zBj`o|#wqc9#V>*!Qi8`X=m`jxP$eXmgD^hUiz<&Oz0aa#d%YrC_PQeQK7JhPo2Sj~ z822vT5;ARQ>Sku@JNbRon*e|+0F-qzd3}=mZT5c96kRmvlG&d-fvL8rEQ+aigcKOj*{_81sY+=-P;U8Q7?7)OhNXqSe55FY zJIonPlc`B3(L9ar$tf4?J7gAr=fzciZqUv~Hp5~peiXUx_;^Y*O<@d|Hg1&vqN3{f z6Bf?LPLN=EiL_E06=l=nZq+mnUw$cx{A|V7QALH-Dn`s(Iz{Om|b7C_J60LT#u z5lZBLw6vlOFH$2Ja9^}kk7(T!p3#Gse8Y%IaMG*sNtx<|VH(A)#p7nZ@=0v5m#98RDY)qSh+&B)e=_ZYYFo;{g|89xLH={I!!*4%|ByV z5tlUm{EqUMCN(3cFw4prFz6LN`;L%PTHB41KTGH-@jq&rKJQYVk<5RQm;W;*TfW#y zwT`u&(nud7<(pPIpC)I=N(KJ}H#bzW(rKu~xW?jNO8Rk5QCgo}IMRDn{ zh@ROXMJxM#d{N#chm(zEnpTx=wLGgPN8fn%m#Yan_*9SD90v37qBoxwW#`tMj4R<^-=;cp(l+jm^Ma_Dz-z;l zpZKBzWaVxj$n|WFS~kzy5bt`=_$}V3wwaS1T5a25lvi9$!AQ?OF{Qb3=+mpE%F+xC zj3jsIRXVvk?Z10GzOz1J(lo<0$7GAiP`rW?bytx9lYv)=Eb*OdAR69-y|X~!YWd)7 zL~!yqUnY5&u?>|TflRWbG0{B31l=u0@)#GEegxLzAJZogH@C zdbgy~62bfGE*;Fln?la-KF)*9>&E2WTc_sy(^Lg?!~jFI`#ftUc%j`+`rC@8Xo`tu zdYgms&@zT~Ok?m1wJRNCz%Re6EAvlX+|Mv?!(-8ClbkZnl>1BXQ1pOpdT}xAfLj@Q zMLDGni+WdnE?u##Z$LMs=HU0Pph2{v50mfV47G|&)Tcljd%_qTDWBR1TrF{10%pPw zkG(L5VjFD71W{Xk$m-W&&HcZ06tGuJW#B@xcyS@&HX+UEt$sd4v_3;I5;&LF2R3k? z285E`7MJXI#H`Cn3U67vrcS)e@6w{TEfG;L<0PAzay6r1qX&25h=|c%=Dq6leJvBo zL8ZE7_~6dvLe9tUXI{*A9zcC=?iA;6>Ba{>Q7vzzY~L-fH>P9WuR(}Ca3)W9*T~6P z+WSk~+vcLeo_K1KK7AqiU7FDel`iY}o?5vsoC!}}SX?*1t)hp(uHj3a9PaD|M#9$! zIhcgioPk~TM>bzcEY-3XqI#D5iOy-?7SCF;4$Kj+cs07+CXINKsM{#e+#0{I*s|HV z+R^n2^v!h9uXPKOXsm`Y*=nt0eDauTe-hV7Ep2N#_mHl>!}`vnxngenx?2S`sjPH# z^%zzwR@BsOteWjLpQF*gNn?!>$Ud5@;BD|6Wg&-lJE2_C?<-`%0_xT&>vFOOl*X$)U0@uCTW4~66g_nx$8u!nf!CE)mY zs=ZJX=p;Z;9>4Hs940%);}J4OJjo&!^b=xDW`^g&$J$%eD%TH*?xnx;zOD33#QN&k z)~2Oji4tC8=AM)xyd$&AxOYYSg!`*WeJ_mEmI_P%9S(m4Wcd0x!QWar*UAXyf7uHxXrlYTYswjMX zalWybUT-x>|CIX#M6ew7+5$FkG=hDw8K1ZO_s+>tb zi=m^un;*48+eQ}cNtY-Z9f4jgbrkh(OIr9*KWUHDM;Y4lZl0s=Z%5rON8P7K-8e_x z5l7uhN8Lk5-IOa)A~dLk9(LMqa5X+S8a|7soxx974d4zmxzBh3yA>YpplDb@$ssIH6@s`4xkC)xety0R+nnuKCBI?JBoyNV4}_Vb31_A`L7S zSme^d**Lwg3G>tyH&!KGcGLStsLSOvtvmVwv3_-(P@FWetDeTEd{2efmHBr}!J~BH zxMwq+i9hZ!bH@`%&T428SsR-F&ICP&?~Ov?V6A zQ|+qwTo5yLdc&ae)7;TiYsp9k{o)bh#UmB3FUs28$sXebRe-NFGLESBbD*2wlkIi0 z`1Nkctpc;#Js7e&q|~35Qhe zd_Rp+q^~qf6s&M1*(lNA8rH8g%N%+?BHDU#9W<#{vaA)`hPvDH&TrDFLR6bmBa@!^ z>2P=kqSRWJCJc29JVD|8UzMF{IMiDl$1Ra1k}{Jh(iItFy9g}^DY9f6%(#;*QGi|k$SGz%1k=!mMHJ9j*8!1B-1Sq+;!y~(-*{#hSc+^LtIt%2o5u#*gF zNqo%W?>c3}GN}%IY4_wH^7^1Qwd(-2sQ~DTdMJR}v6`Cua+a3CI9y|$13hcTVHZ62?=r+t$ zM6b%q9v0Mf@xl+Oj6V9O>f#bKU?J`t}fnRQ7|AuK)&R&}dfRsI(j9 zrWmZ{Y_lv+CL*xPf!|?N>6gL~k7T5n^@#1*e)Nbf&T3@Mbpim;giBX&O=hL^%Ue15 z1=#FY*_1aNKt4cyu8ldQYWO&6;+RaOv?JqT(wlz$<4W4jX~`Gn#r<9}`nS;0P8D+3 zqXvSa!kFtmc^i!vA>&FK-2-INJ(r%k$_dKz?-KS477(Op$MGM^Zs9XVi|(2Kbz4{h zQIiRT=C*Sm2UpJ@LM_G9A<<@?*i@#-)8n7-A*oEXx z37A4xQbbi7Rf>*&sl7JlXkxY}3T2Rdd0A5T4Hk3$qumE7!GI;Z_N(iJ%ZS9Wjy8@e zc4Vcl1J*FOafWq-dxqzIZ9Xs$cCg_F56^EM>1@MLnK@zLrDs9Qg(+DrQuB(b`cES~ zZ7zQ(;|V8=h5H;mtC3bYIrZ|b(y9cvkjE!DzqR^aM1;F#m`OXetf^W}NpW$G&TGQ$ zcXyU~#Lyu+og@>97zDAz#aW26#w{XdkaDE?$cyz}aW?V;q-eT#*5ge}L4GcI_ue6G zG42s+39WwlxdDaJ%FK=~9>qB#5s*j2=c=8`$uLp?k~qxF77AEbsH(`AggBaTpbpVX zgN(Ycpv~PkBS+yk<8Yxf>G}jp5L5b}QM2FQT^GgG47g={jj!GAOfA;C;|Q9H{%BZ> zFnoddzR>Nk7w>?HJk%>eoPA^?fn2H$O)?TQqQ zUE(sJjLW^MA*Jrn4MKN8$m9>>AASQ(ZU2}|b?LCjCM9T0!UeM`JvF)%CiSkyE@a7s z7_gGg0V_ueBXRc0IzO6J8pw7k!Q5Ng8)H1YSxsK=%hS+n;Lp4g_sgugw0`y-4p&y~ zwd_*i+ZNkjJRQYnr~YtVk3E@g-W9E)WlwWN(sfd)(Rd?`F2BOTkp6E9Cm`(HiqIay zv<5_0CZ=5}zKNNOC-P@t*<8on8OC9h^;S1F6B<=4L2_9=W& zv4VRyOsA(r&Ld%gsG1*M0Snf*?lg2wL=lc{_pzPlI>L2>5^YOi!7q|J^X+Lr;?`JV zQFwAo>(12962sD&WGY(+CXx!TN$O@*W6garZsy+f95?d-%-eN%4X&5fJCDpso5sUs zntdSq0Ac+g4t_BHE21GZN4<((`N=yZix`A|XU3sLS=_Sc3?@4$)dXIild+qPOaT61Zj z4>)gMJU17$Oaqq)IOG#+Ful_D*(Joz9kR3G=lxOOkSn$@m=e3Ry0KV7a#VBl+$#QI zHH&Q{U1YqlLZlFnTeKGwfhJscz^W7T4jleJ)>oO?D*9yjbb$f1(udar9`FdcN%dR! zEr0(|L+ck@-5iNAwo>2@t(;ydn(Z|5pnO_UN=e=0tmK(GJjjdCke8`R(YT9Lhia6Ax{Q^=S$H7)6 zpRYNLDP~|)^8Iv&8ONE?t+Qj3+ Date: Fri, 12 Nov 2021 11:25:15 -0500 Subject: [PATCH 670/766] Move all PacketLib local channel classes to Geyser --- .../bungeecord/GeyserBungeeInjector.java | 15 +- .../platform/spigot/GeyserSpigotInjector.java | 4 +- .../velocity/GeyserVelocityInjector.java | 4 +- connector/pom.xml | 11 +- .../geysermc/connector/GeyserConnector.java | 18 +- .../common/connection/ChannelWrapper.java | 265 ++++++++++++++++++ .../DefaultChannelPipelinePublic.java | 38 +++ .../{ => connection}/GeyserInjector.java | 3 +- .../LocalChannelWithRemoteAddress.java | 45 +++ .../connection/LocalChannelWrapper.java | 70 +++++ .../connection/LocalServerChannelWrapper.java | 46 +++ .../common/connection/LocalSession.java | 142 ++++++++++ .../network/session/GeyserSession.java | 38 +-- 13 files changed, 658 insertions(+), 41 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java create mode 100644 connector/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java rename connector/src/main/java/org/geysermc/connector/common/{ => connection}/GeyserInjector.java (98%) create mode 100644 connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java create mode 100644 connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java create mode 100644 connector/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java create mode 100644 connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java index 25b36a14e..310ae0c54 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java @@ -25,7 +25,6 @@ package org.geysermc.platform.bungeecord; -import com.github.steveice10.packetlib.io.local.LocalServerChannelWrapper; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; @@ -42,7 +41,9 @@ import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.netty.PipelineUtils; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.GeyserInjector; +import org.geysermc.connector.common.connection.GeyserInjector; +import org.geysermc.connector.common.connection.LocalServerChannelWrapper; +import org.geysermc.connector.common.connection.LocalSession; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -122,7 +123,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener { ChannelFuture channelFuture = (new ServerBootstrap() .channel(LocalServerChannelWrapper.class) - .childHandler(new ChannelInitializer() { + .childHandler(new ChannelInitializer<>() { @Override protected void initChannel(Channel ch) throws Exception { if (proxy.getConfig().getServers() == null) { @@ -156,6 +157,14 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener { this.proxy.getPluginManager().registerListener(this.plugin, this); this.eventRegistered = true; } + + // Only affects Waterfall, but there is no sure way to differentiate between a proxy with this patch and a proxy without this patch + // Patch causing the issue: https://github.com/PaperMC/Waterfall/blob/7e6af4cef64d5d377a6ffd00a534379e6efa94cf/BungeeCord-Patches/0045-Don-t-use-a-bytebuf-for-packet-decoding.patch + // If native compression is enabled, then this line is tripped up if a heap buffer is sent over in such a situation + // as a new direct buffer is not created with that patch (HeapByteBufs throw an UnsupportedOperationException here): + // https://github.com/SpigotMC/BungeeCord/blob/a283aaf724d4c9a815540cd32f3aafaa72df9e05/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java#L43 + // This issue could be mitigated down the line by preventing Bungee from setting compression + LocalSession.createDirectByteBufAllocator(); } @Override diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java index fcf4b2eaf..10062a260 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java @@ -25,7 +25,6 @@ package org.geysermc.platform.spigot; -import com.github.steveice10.packetlib.io.local.LocalServerChannelWrapper; import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; @@ -33,7 +32,8 @@ import io.netty.channel.local.LocalAddress; import io.netty.util.concurrent.DefaultThreadFactory; import org.bukkit.Bukkit; import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.GeyserInjector; +import org.geysermc.connector.common.connection.GeyserInjector; +import org.geysermc.connector.common.connection.LocalServerChannelWrapper; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java index d13427faa..ea22586ba 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java @@ -25,13 +25,13 @@ package org.geysermc.platform.velocity; -import com.github.steveice10.packetlib.io.local.LocalServerChannelWrapper; import com.velocitypowered.api.proxy.ProxyServer; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.local.LocalAddress; import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.GeyserInjector; +import org.geysermc.connector.common.connection.GeyserInjector; +import org.geysermc.connector.common.connection.LocalServerChannelWrapper; import java.lang.reflect.Field; import java.util.function.Supplier; diff --git a/connector/pom.xml b/connector/pom.xml index 755828467..b9b7b5732 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -163,15 +163,20 @@ - com.github.RednedEpic - PacketLib - 9d4b476 + com.github.steveice10 + packetlib + 2.1-SNAPSHOT compile io.netty netty-all + + + io.netty.incubator + netty-incubator-transport-native-io_uring + diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 70550eedd..b9bb453ce 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.steveice10.mc.protocol.MinecraftConstants; +import com.github.steveice10.packetlib.tcp.TcpSession; import com.nukkitx.network.raknet.RakNetConstants; import com.nukkitx.network.util.EventLoops; import com.nukkitx.protocol.bedrock.BedrockServer; @@ -46,12 +47,12 @@ import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.metrics.Metrics; import org.geysermc.connector.network.ConnectorServerEventHandler; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.Registries; import org.geysermc.connector.network.translators.PacketTranslatorRegistry; +import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.world.WorldManager; +import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.registry.Registries; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.skin.FloodgateSkinUploader; import org.geysermc.connector.utils.*; @@ -70,8 +71,12 @@ import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.security.Key; import java.text.DecimalFormat; -import java.util.*; -import java.util.concurrent.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.UUID; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -191,6 +196,9 @@ public class GeyserConnector { } } + // Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves + TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false; + TimeSyncer timeSyncer = null; if (config.getRemote().getAuthType() == AuthType.FLOODGATE) { timeSyncer = new TimeSyncer(Constants.NTP_SERVER); diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java b/connector/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java new file mode 100644 index 000000000..71ab16651 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2019-2021 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.connector.common.connection; + +import io.netty.buffer.ByteBufAllocator; +import io.netty.channel.*; +import io.netty.util.Attribute; +import io.netty.util.AttributeKey; + +import java.net.SocketAddress; + +public class ChannelWrapper implements Channel { + protected final Channel source; + private volatile SocketAddress remoteAddress; + + public ChannelWrapper(Channel channel) { + this.source = channel; + } + + @Override + public SocketAddress localAddress() { + return source.localAddress(); + } + + @Override + public SocketAddress remoteAddress() { + if (remoteAddress == null) { + return source.remoteAddress(); + } + return remoteAddress; + } + + public void remoteAddress(SocketAddress socketAddress) { + remoteAddress = socketAddress; + } + + @Override + public ChannelId id() { + return source.id(); + } + + @Override + public EventLoop eventLoop() { + return source.eventLoop(); + } + + @Override + public Channel parent() { + return source.parent(); + } + + @Override + public ChannelConfig config() { + return source.config(); + } + + @Override + public boolean isOpen() { + return source.isOpen(); + } + + @Override + public boolean isRegistered() { + return source.isRegistered(); + } + + @Override + public boolean isActive() { + return source.isActive(); + } + + @Override + public ChannelMetadata metadata() { + return source.metadata(); + } + + @Override + public ChannelFuture closeFuture() { + return source.closeFuture(); + } + + @Override + public boolean isWritable() { + return source.isWritable(); + } + + @Override + public long bytesBeforeUnwritable() { + return source.bytesBeforeUnwritable(); + } + + @Override + public long bytesBeforeWritable() { + return source.bytesBeforeWritable(); + } + + @Override + public Unsafe unsafe() { + return source.unsafe(); + } + + @Override + public ChannelPipeline pipeline() { + return source.pipeline(); + } + + @Override + public ByteBufAllocator alloc() { + return source.alloc(); + } + + @Override + public ChannelFuture bind(SocketAddress socketAddress) { + return source.bind(socketAddress); + } + + @Override + public ChannelFuture connect(SocketAddress socketAddress) { + return source.connect(socketAddress); + } + + @Override + public ChannelFuture connect(SocketAddress socketAddress, SocketAddress socketAddress1) { + return source.connect(socketAddress, socketAddress1); + } + + @Override + public ChannelFuture disconnect() { + return source.disconnect(); + } + + @Override + public ChannelFuture close() { + return source.disconnect(); + } + + @Override + public ChannelFuture deregister() { + return source.deregister(); + } + + @Override + public ChannelFuture bind(SocketAddress socketAddress, ChannelPromise channelPromise) { + return source.bind(socketAddress, channelPromise); + } + + @Override + public ChannelFuture connect(SocketAddress socketAddress, ChannelPromise channelPromise) { + return source.connect(socketAddress, channelPromise); + } + + @Override + public ChannelFuture connect(SocketAddress socketAddress, SocketAddress socketAddress1, ChannelPromise channelPromise) { + return source.connect(socketAddress, socketAddress1, channelPromise); + } + + @Override + public ChannelFuture disconnect(ChannelPromise channelPromise) { + return source.disconnect(channelPromise); + } + + @Override + public ChannelFuture close(ChannelPromise channelPromise) { + return source.close(channelPromise); + } + + @Override + public ChannelFuture deregister(ChannelPromise channelPromise) { + return source.deregister(channelPromise); + } + + @Override + public Channel read() { + source.read(); + return this; + } + + @Override + public ChannelFuture write(Object o) { + return source.write(o); + } + + @Override + public ChannelFuture write(Object o, ChannelPromise channelPromise) { + return source.write(o, channelPromise); + } + + @Override + public Channel flush() { + return source.flush(); + } + + @Override + public ChannelFuture writeAndFlush(Object o, ChannelPromise channelPromise) { + return source.writeAndFlush(o, channelPromise); + } + + @Override + public ChannelFuture writeAndFlush(Object o) { + return source.writeAndFlush(o); + } + + @Override + public ChannelPromise newPromise() { + return source.newPromise(); + } + + @Override + public ChannelProgressivePromise newProgressivePromise() { + return source.newProgressivePromise(); + } + + @Override + public ChannelFuture newSucceededFuture() { + return source.newSucceededFuture(); + } + + @Override + public ChannelFuture newFailedFuture(Throwable throwable) { + return source.newFailedFuture(throwable); + } + + @Override + public ChannelPromise voidPromise() { + return source.voidPromise(); + } + + @Override + public Attribute attr(AttributeKey attributeKey) { + return source.attr(attributeKey); + } + + @Override + public boolean hasAttr(AttributeKey attributeKey) { + return source.hasAttr(attributeKey); + } + + @Override + public int compareTo(Channel o) { + return source.compareTo(o); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java b/connector/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java new file mode 100644 index 000000000..4749eeb4c --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019-2021 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.connector.common.connection; + +import io.netty.channel.Channel; +import io.netty.channel.DefaultChannelPipeline; + +/** + * Exists solely to make DefaultChannelPipeline's protected constructor public + */ +public class DefaultChannelPipelinePublic extends DefaultChannelPipeline { + public DefaultChannelPipelinePublic(Channel channel) { + super(channel); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java b/connector/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java rename to connector/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java index f7da49727..443e805eb 100644 --- a/connector/src/main/java/org/geysermc/connector/common/GeyserInjector.java +++ b/connector/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common; +package org.geysermc.connector.common.connection; import io.netty.channel.ChannelFuture; import lombok.Getter; @@ -47,7 +47,6 @@ public abstract class GeyserInjector { protected SocketAddress serverSocketAddress; /** - * * @param bootstrap the bootstrap of the Geyser instance. */ public void initializeLocalChannel(GeyserBootstrap bootstrap) { diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java b/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java new file mode 100644 index 000000000..6cd01d591 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019-2021 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.connector.common.connection; + +import io.netty.channel.local.LocalChannel; + +import java.net.InetSocketAddress; + +/** + * Client -> server storing the spoofed remote address. + */ +public class LocalChannelWithRemoteAddress extends LocalChannel { + private InetSocketAddress spoofedAddress; + + public InetSocketAddress spoofedRemoteAddress() { + return spoofedAddress; + } + + public void spoofedRemoteAddress(InetSocketAddress socketAddress) { + this.spoofedAddress = socketAddress; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java b/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java new file mode 100644 index 000000000..ad9b3e8f7 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2019-2021 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.connector.common.connection; + +import io.netty.channel.DefaultChannelPipeline; +import io.netty.channel.local.LocalChannel; +import io.netty.channel.local.LocalServerChannel; + +import java.net.InetSocketAddress; + +public class LocalChannelWrapper extends LocalChannel { + private final ChannelWrapper wrapper; + /** + * {@link #newChannelPipeline()} is called during super, so this exists until the wrapper can be initialized. + */ + private volatile ChannelWrapper tempWrapper; + + public LocalChannelWrapper() { + wrapper = new ChannelWrapper(this); + } + + public LocalChannelWrapper(LocalServerChannel parent, LocalChannel peer) { + super(parent, peer); + if (tempWrapper == null) { + this.wrapper = new ChannelWrapper(this); + } else { + this.wrapper = tempWrapper; + } + wrapper.remoteAddress(new InetSocketAddress(0)); + } + + public ChannelWrapper wrapper() { + return wrapper; + } + + @Override + protected DefaultChannelPipeline newChannelPipeline() { + if (wrapper != null) { + return new DefaultChannelPipelinePublic(wrapper); + } else if (tempWrapper != null) { + return new DefaultChannelPipelinePublic(tempWrapper); + } else { + tempWrapper = new ChannelWrapper(this); + return new DefaultChannelPipelinePublic(tempWrapper); + } + } +} diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java b/connector/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java new file mode 100644 index 000000000..3c37709ec --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019-2021 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.connector.common.connection; + +import io.netty.channel.local.LocalChannel; +import io.netty.channel.local.LocalServerChannel; + +/** + * If the incoming channel if an instance of LocalChannelWithRemoteAddress, this server creates a LocalChannelWrapper + * for the other end and attaches the spoofed remote address + */ +public class LocalServerChannelWrapper extends LocalServerChannel { + @Override + protected LocalChannel newLocalChannel(LocalChannel peer) { + // LocalChannel here should be an instance of LocalChannelWithRemoteAddress, which we can use to set the "remote address" on the other end + if (peer instanceof LocalChannelWithRemoteAddress) { + LocalChannelWrapper channel = new LocalChannelWrapper(this, peer); + channel.wrapper().remoteAddress(((LocalChannelWithRemoteAddress) peer).spoofedRemoteAddress()); + return channel; + } + return super.newLocalChannel(peer); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java b/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java new file mode 100644 index 000000000..882bd3957 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2019-2021 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.connector.common.connection; + +import com.github.steveice10.packetlib.BuiltinFlags; +import com.github.steveice10.packetlib.packet.PacketProtocol; +import com.github.steveice10.packetlib.tcp.*; +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBufAllocator; +import io.netty.channel.*; +import io.netty.channel.unix.PreferredDirectByteBufAllocator; +import io.netty.handler.codec.haproxy.*; + +import java.net.Inet4Address; +import java.net.InetSocketAddress; +import java.net.SocketAddress; + +/** + * Manages a Minecraft Java session over our LocalChannel implementations. + */ +public final class LocalSession extends TcpSession { + private static DefaultEventLoopGroup DEFAULT_EVENT_LOOP_GROUP; + private static PreferredDirectByteBufAllocator PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR = null; + + private final SocketAddress targetAddress; + private final String clientIp; + + public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol) { + super(host, port, protocol); + this.targetAddress = targetAddress; + this.clientIp = clientIp; + } + + @Override + public void connect() { + if (this.disconnected) { + throw new IllegalStateException("Session has already been disconnected."); + } + + if (DEFAULT_EVENT_LOOP_GROUP == null) { + DEFAULT_EVENT_LOOP_GROUP = new DefaultEventLoopGroup(); + } + + try { + final Bootstrap bootstrap = new Bootstrap(); + bootstrap.channel(LocalChannelWithRemoteAddress.class); + bootstrap.handler(new ChannelInitializer() { + @Override + public void initChannel(LocalChannelWithRemoteAddress channel) { + channel.spoofedRemoteAddress(new InetSocketAddress(clientIp, 0)); + getPacketProtocol().newClientSession(LocalSession.this); + + refreshReadTimeoutHandler(channel); + refreshWriteTimeoutHandler(channel); + + ChannelPipeline pipeline = channel.pipeline(); + pipeline.addLast("encryption", new TcpPacketEncryptor(LocalSession.this)); + pipeline.addLast("sizer", new TcpPacketSizer(LocalSession.this)); + pipeline.addLast("codec", new TcpPacketCodec(LocalSession.this)); + pipeline.addLast("manager", LocalSession.this); + + addHAProxySupport(pipeline); + } + }).group(DEFAULT_EVENT_LOOP_GROUP).option(ChannelOption.CONNECT_TIMEOUT_MILLIS, getConnectTimeout() * 1000); + + if (PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR != null) { + bootstrap.option(ChannelOption.ALLOCATOR, PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR); + } + + bootstrap.remoteAddress(targetAddress); + + bootstrap.connect().addListener((future) -> { + if (!future.isSuccess()) { + exceptionCaught(null, future.cause()); + } + }); + } catch(Throwable t) { + exceptionCaught(null, t); + } + } + + // TODO duplicate code + private void addHAProxySupport(ChannelPipeline pipeline) { + InetSocketAddress clientAddress = getFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS); + if (getFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, false) && clientAddress != null) { + pipeline.addFirst("proxy-protocol-packet-sender", new ChannelInboundHandlerAdapter() { + @Override + public void channelActive(ChannelHandlerContext ctx) throws Exception { + HAProxyProxiedProtocol proxiedProtocol = clientAddress.getAddress() instanceof Inet4Address ? HAProxyProxiedProtocol.TCP4 : HAProxyProxiedProtocol.TCP6; + InetSocketAddress remoteAddress; + if (ctx.channel().remoteAddress() instanceof InetSocketAddress) { + remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress(); + } else { + remoteAddress = new InetSocketAddress(host, port); + } + ctx.channel().writeAndFlush(new HAProxyMessage( + HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, proxiedProtocol, + clientAddress.getAddress().getHostAddress(), remoteAddress.getAddress().getHostAddress(), + clientAddress.getPort(), remoteAddress.getPort() + )); + ctx.pipeline().remove(this); + ctx.pipeline().remove("proxy-protocol-encoder"); + super.channelActive(ctx); + } + }); + pipeline.addFirst("proxy-protocol-encoder", HAProxyMessageEncoder.INSTANCE); + } + } + + /** + * Should only be called when direct ByteBufs should be preferred. At this moment, this should only be called on BungeeCord. + */ + public static void createDirectByteBufAllocator() { + if (PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR == null) { + PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR = new PreferredDirectByteBufAllocator(); + PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR.updateAllocator(ByteBufAllocator.DEFAULT); + } + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 2efb74a32..6a357251b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -50,6 +50,7 @@ import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.event.session.*; import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpClientSession; +import com.github.steveice10.packetlib.tcp.TcpSession; import com.nukkitx.math.GenericMath; import com.nukkitx.math.vector.*; import com.nukkitx.protocol.bedrock.BedrockPacket; @@ -76,6 +77,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.common.AuthType; +import org.geysermc.connector.common.connection.LocalSession; import org.geysermc.connector.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ItemFrameEntity; @@ -123,7 +125,7 @@ public class GeyserSession implements CommandSender { * If this is manually called, ensure that any exceptions are properly handled. */ private final EventLoop eventLoop; - private TcpClientSession downstream; + private TcpSession downstream; @Setter private AuthData authData; @Setter @@ -715,8 +717,14 @@ public class GeyserSession implements CommandSender { // Start ticking tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); - downstream = new TcpClientSession(this.remoteAddress, this.remotePort, protocol); - disableSrvResolving(); + if (connector.getBootstrap().getSocketAddress() != null) { + // We're going to connect through the JVM and not through TCP + downstream = new LocalSession(this.remoteAddress, this.remotePort, + connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), this.protocol); + } else { + downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol); + disableSrvResolving(); + } if (connector.getConfig().getRemote().isUseProxyProtocol()) { downstream.setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true); downstream.setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress()); @@ -793,7 +801,7 @@ public class GeyserSession implements CommandSender { loggingIn = false; loggedIn = true; - if (downstream.isInternallyConnecting()) { + if (downstream instanceof LocalSession) { // Connected directly to the server connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect_internal", authData.getName(), protocol.getProfile().getName())); @@ -860,7 +868,7 @@ public class GeyserSession implements CommandSender { disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason()); } - if (downstream != null && downstream.isInternallyConnecting()) { + if (downstream instanceof LocalSession) { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); } else { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); @@ -890,26 +898,8 @@ public class GeyserSession implements CommandSender { if (!daylightCycle) { setDaylightCycle(true); } - boolean internalConnect = false; - if (connector.getBootstrap().getSocketAddress() != null) { - try { - // Only affects Waterfall, but there is no sure way to differentiate between a proxy with this patch and a proxy without this patch - // Patch causing the issue: https://github.com/PaperMC/Waterfall/blob/7e6af4cef64d5d377a6ffd00a534379e6efa94cf/BungeeCord-Patches/0045-Don-t-use-a-bytebuf-for-packet-decoding.patch - // If native compression is enabled, then this line is tripped up if a heap buffer is sent over in such a situation - // as a new direct buffer is not created with that patch (HeapByteBufs throw an UnsupportedOperationException here): - // https://github.com/SpigotMC/BungeeCord/blob/a283aaf724d4c9a815540cd32f3aafaa72df9e05/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java#L43 - // This issue could be mitigated down the line by preventing Bungee from setting compression - downstream.setFlag(BuiltinFlags.USE_ONLY_DIRECT_BUFFERS, connector.getPlatformType() == PlatformType.BUNGEECORD); - downstream.connectInternal(connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress()); - internalConnect = true; - } catch (Exception e) { - e.printStackTrace(); - } - } - if (!internalConnect) { - downstream.connect(); - } + downstream.connect(); } public void disconnect(String reason) { From adbadbbba4594fa507c8ee2d92dce9eec40ae386 Mon Sep 17 00:00:00 2001 From: David Choo Date: Fri, 12 Nov 2021 20:36:01 -0500 Subject: [PATCH 671/766] Prevent blocks destroyed by pistons from moving on Geyser-Spigot (#2627) --- .../spigot/world/GeyserPistonListener.java | 8 ++++-- .../world/block/BlockStateValues.java | 21 +++++++++++++++ .../world/block/entity/PistonBlockEntity.java | 26 ++----------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java index 39fefb2de..0732c2901 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java @@ -110,8 +110,12 @@ public class GeyserPistonListener implements Listener { List blocks = isExtend ? ((BlockPistonExtendEvent) event).getBlocks() : ((BlockPistonRetractEvent) event).getBlocks(); for (Block block : blocks) { Location attachedLocation = block.getLocation(); - attachedBlocks.put(getVector(attachedLocation), worldManager.getBlockNetworkId(player, block, - attachedLocation.getBlockX(), attachedLocation.getBlockY(), attachedLocation.getBlockZ())); + int blockId = worldManager.getBlockNetworkId(player, block, + attachedLocation.getBlockX(), attachedLocation.getBlockY(), attachedLocation.getBlockZ()); + // Ignore blocks that will be destroyed + if (BlockStateValues.canPistonMoveBlock(blockId, isExtend)) { + attachedBlocks.put(getVector(attachedLocation), blockId); + } } blocksFilled = true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java index 78470e3e1..160842550 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.JsonNode; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntityTranslator; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.utils.Direction; @@ -335,6 +336,26 @@ public class BlockStateValues { return BlockRegistries.JAVA_BLOCKS.getOrDefault(state, BlockMapping.AIR).getPistonBehavior() == PistonBehavior.DESTROY; } + public static boolean canPistonMoveBlock(int javaId, boolean isPushing) { + if (javaId == JAVA_AIR_ID) { + return true; + } + // Pistons can only be moved if they aren't extended + if (PistonBlockEntityTranslator.isBlock(javaId)) { + return !PISTON_VALUES.get(javaId); + } + BlockMapping block = BlockRegistries.JAVA_BLOCKS.getOrDefault(javaId, BlockMapping.AIR); + // Bedrock, End portal frames, etc. can't be moved + if (block.getHardness() == -1.0d) { + return false; + } + return switch (block.getPistonBehavior()) { + case BLOCK, DESTROY -> false; + case PUSH_ONLY -> isPushing; // Glazed terracotta can only be pushed + default -> !block.isBlockEntity(); // Pistons can't move block entities + }; + } + /** * Skull variations are part of the namespaced ID in Java Edition, but part of the block entity tag in Bedrock. * This gives a byte variant ID that Bedrock can use. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java index b255fa5d7..c1f01e1f5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java @@ -43,9 +43,7 @@ import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.CollisionManager; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.utils.*; import java.util.LinkedList; @@ -256,7 +254,7 @@ public class PistonBlockEntity { if (blockId == BlockStateValues.JAVA_AIR_ID) { continue; } - if (canMoveBlock(blockId, action == PistonValueType.PUSHING)) { + if (BlockStateValues.canPistonMoveBlock(blockId, action == PistonValueType.PUSHING)) { attachedBlocks.put(blockPos, blockId); if (BlockStateValues.isBlockSticky(blockId)) { // For honey blocks and slime blocks check the blocks adjacent to it @@ -276,7 +274,7 @@ public class PistonBlockEntity { continue; } int adjacentBlockId = session.getConnector().getWorldManager().getBlockAt(session, adjacentPos); - if (adjacentBlockId != BlockStateValues.JAVA_AIR_ID && BlockStateValues.isBlockAttached(blockId, adjacentBlockId) && canMoveBlock(adjacentBlockId, false)) { + if (adjacentBlockId != BlockStateValues.JAVA_AIR_ID && BlockStateValues.isBlockAttached(blockId, adjacentBlockId) && BlockStateValues.canPistonMoveBlock(adjacentBlockId, false)) { // If it is another slime/honey block we need to check its adjacent blocks if (BlockStateValues.isBlockSticky(adjacentBlockId)) { blocksToCheck.add(adjacentPos); @@ -303,26 +301,6 @@ public class PistonBlockEntity { } } - private boolean canMoveBlock(int javaId, boolean isPushing) { - if (javaId == BlockStateValues.JAVA_AIR_ID) { - return true; - } - // Pistons can only be moved if they aren't extended - if (PistonBlockEntityTranslator.isBlock(javaId)) { - return !BlockStateValues.getPistonValues().get(javaId); - } - BlockMapping block = BlockRegistries.JAVA_BLOCKS.getOrDefault(javaId, BlockMapping.AIR); - // Bedrock, End portal frames, etc. can't be moved - if (block.getHardness() == -1.0d) { - return false; - } - return switch (block.getPistonBehavior()) { - case BLOCK, DESTROY -> false; - case PUSH_ONLY -> isPushing; // Glazed terracotta can only be pushed - default -> !block.isBlockEntity(); // Pistons can't move block entities - }; - } - /** * Get the unit vector for the direction of movement * From 768b09e7fdb58a98395c2d043435e899028523db Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 12 Nov 2021 22:44:15 -0500 Subject: [PATCH 672/766] Update to latest MCProtocolLib with Mojang mappings --- .../spigot/world/GeyserPistonListener.java | 2 +- connector/pom.xml | 6 +-- .../command/defaults/OffhandCommand.java | 6 +-- .../command/defaults/StatisticsCommand.java | 6 +-- .../entity/AreaEffectCloudEntity.java | 2 +- .../geysermc/connector/entity/BoatEntity.java | 2 +- .../entity/living/monster/ShulkerEntity.java | 2 +- .../network/session/GeyserSession.java | 37 +++++++--------- .../session/cache/AdvancementsCache.java | 8 ++-- .../network/session/cache/BookEditCache.java | 4 +- .../network/session/cache/TagCache.java | 6 +-- .../network/session/cache/TeleportCache.java | 2 +- .../translators/PacketTranslatorRegistry.java | 8 ++-- .../BedrockAdventureSettingsTranslator.java | 4 +- .../bedrock/BedrockAnimateTranslator.java | 10 ++--- .../BedrockBlockEntityDataTranslator.java | 10 ++--- .../bedrock/BedrockBookEditTranslator.java | 4 +- .../BedrockCommandBlockUpdateTranslator.java | 10 ++--- .../BedrockCommandRequestTranslator.java | 4 +- .../BedrockContainerCloseTranslator.java | 4 +- .../bedrock/BedrockFilterTextTranslator.java | 4 +- ...BedrockInventoryTransactionTranslator.java | 42 +++++++++---------- .../BedrockItemFrameDropItemTranslator.java | 4 +- .../BedrockLecternUpdateTranslator.java | 16 +++---- .../BedrockMobEquipmentTranslator.java | 10 ++--- .../BedrockMoveEntityAbsoluteTranslator.java | 6 +-- .../BedrockNetworkStackLatencyTranslator.java | 4 +- .../bedrock/BedrockPlayerInputTranslator.java | 12 +++--- .../bedrock/BedrockRespawnTranslator.java | 4 +- .../bedrock/BedrockShowCreditsTranslator.java | 4 +- .../bedrock/BedrockTextTranslator.java | 7 ++-- .../entity/BedrockEntityEventTranslator.java | 4 +- .../player/BedrockActionTranslator.java | 40 +++++++++--------- .../entity/player/BedrockEmoteTranslator.java | 6 +-- .../player/BedrockInteractTranslator.java | 12 +++--- .../player/BedrockMovePlayerTranslator.java | 12 +++--- .../player/BedrockRiderJumpTranslator.java | 6 +-- .../network/translators/effect/Effect.java | 6 +-- .../translators/effect/PlaySoundEffect.java | 4 +- .../translators/effect/SoundEventEffect.java | 4 +- .../translators/effect/SoundLevelEffect.java | 4 +- .../inventory/click/ClickPlan.java | 4 +- .../BeaconInventoryTranslator.java | 4 +- .../EnchantingInventoryTranslator.java | 4 +- .../LecternInventoryTranslator.java | 8 ++-- .../translators/LoomInventoryTranslator.java | 4 +- .../PlayerInventoryTranslator.java | 6 +-- .../StonecutterInventoryTranslator.java | 4 +- .../java/JavaAdvancementsTabTranslator.java | 9 ++-- .../java/JavaAdvancementsTranslator.java | 10 ++--- .../java/JavaBossBarTranslator.java | 8 ++-- .../translators/java/JavaChatTranslator.java | 8 ++-- .../java/JavaDeclareCommandsTranslator.java | 8 ++-- .../java/JavaDeclareRecipesTranslator.java | 8 ++-- .../java/JavaDeclareTagsTranslator.java | 8 ++-- .../java/JavaDifficultyTranslator.java | 9 ++-- .../java/JavaDisconnectPacket.java | 8 ++-- ...or.java => JavaGameProfileTranslator.java} | 8 ++-- .../java/JavaJoinGameTranslator.java | 20 ++++----- .../java/JavaKeepAliveTranslator.java | 8 ++-- .../java/JavaLoginDisconnectTranslator.java | 8 ++-- .../JavaLoginPluginRequestTranslator.java | 13 +++--- .../translators/java/JavaPingPacket.java | 12 +++--- .../java/JavaPluginMessageTranslator.java | 12 +++--- ...nslator.java => JavaRecipeTranslator.java} | 8 ++-- .../java/JavaRespawnTranslator.java | 8 ++-- .../java/JavaStatisticsTranslator.java | 8 ++-- .../entity/JavaEntityAnimationTranslator.java | 10 ++--- .../entity/JavaEntityAttachTranslator.java | 8 ++-- .../JavaEntityCollectItemTranslator.java | 8 ++-- .../entity/JavaEntityEffectTranslator.java | 8 ++-- .../entity/JavaEntityEquipmentTranslator.java | 8 ++-- .../entity/JavaEntityHeadLookTranslator.java | 12 +++--- .../entity/JavaEntityMetadataTranslator.java | 8 ++-- .../JavaEntityPositionRotationTranslator.java | 8 ++-- .../entity/JavaEntityPositionTranslator.java | 12 +++--- .../JavaEntityPropertiesTranslator.java | 12 +++--- .../JavaEntityRemoveEffectTranslator.java | 8 ++-- .../entity/JavaEntityRotationTranslator.java | 8 ++-- .../JavaEntitySetPassengersTranslator.java | 8 ++-- .../entity/JavaEntityStatusTranslator.java | 8 ++-- .../entity/JavaEntityTeleportTranslator.java | 11 +++-- .../entity/JavaEntityVelocityTranslator.java | 8 ++-- .../JavaMoveVehicleTranslator.java} | 10 ++--- .../entity/JavaRemoveEntitiesTranslator.java | 8 ++-- .../player/JavaPlayerAbilitiesTranslator.java | 8 ++-- .../player/JavaPlayerActionAckTranslator.java | 8 ++-- .../JavaPlayerChangeHeldItemTranslator.java | 8 ++-- .../player/JavaPlayerHealthTranslator.java | 8 ++-- .../player/JavaPlayerListEntryTranslator.java | 8 ++-- .../JavaPlayerPositionRotationTranslator.java | 12 +++--- .../JavaPlayerSetExperienceTranslator.java | 8 ++-- .../spawn/JavaSpawnEntityTranslator.java | 8 ++-- .../spawn/JavaSpawnExpOrbTranslator.java | 11 +++-- .../JavaSpawnLivingEntityTranslator.java | 8 ++-- .../spawn/JavaSpawnPaintingTranslator.java | 8 ++-- .../spawn/JavaSpawnPlayerTranslator.java | 8 ++-- .../JavaBlockBreakAnimTranslator.java | 10 ++--- .../JavaBlockChangeTranslator.java | 14 +++---- .../JavaBlockValueTranslator.java | 12 +++--- .../JavaChunkDataTranslator.java | 10 ++--- .../JavaExplosionTranslator.java | 12 +++--- .../JavaMapDataTranslator.java | 17 ++++---- .../JavaMultiBlockChangeTranslator.java | 13 +++--- .../JavaNotifyClientTranslator.java | 22 +++++----- .../JavaPlayBuiltinSoundTranslator.java | 10 ++--- .../JavaPlayEffectTranslator.java | 12 +++--- .../JavaPlaySoundTranslator.java | 14 +++---- .../JavaSpawnParticleTranslator.java | 12 +++--- .../JavaSpawnPositionTranslator.java | 15 ++++--- .../JavaStopSoundTranslator.java | 14 +++---- .../JavaUnloadChunkTranslator.java | 10 ++--- .../JavaUpdateTileEntityTranslator.java | 12 +++--- .../JavaUpdateTimeTranslator.java | 10 ++--- .../JavaUpdateViewDistanceTranslator.java | 11 +++-- .../JavaUpdateViewPositionTranslator.java | 11 +++-- .../JavaInitializeBorderTranslator.java | 10 ++--- .../border/JavaSetBorderCenterTranslator.java | 10 ++--- .../JavaSetBorderLerpSizeTranslator.java | 10 ++--- .../border/JavaSetBorderSizeTranslator.java | 10 ++--- .../JavaSetBorderWarningDelayTranslator.java | 10 ++--- ...avaSetBorderWarningDistanceTranslator.java | 10 ++--- .../JavaDisplayScoreboardTranslator.java | 8 ++-- .../JavaScoreboardObjectiveTranslator.java | 8 ++-- .../java/scoreboard/JavaTeamTranslator.java | 8 ++-- .../scoreboard/JavaUpdateScoreTranslator.java | 8 ++-- .../java/title/JavaClearTitlesTranslator.java | 8 ++-- .../title/JavaSetActionBarTextTranslator.java | 8 ++-- .../title/JavaSetSubtitleTextTranslator.java | 8 ++-- .../title/JavaSetTitleTextTranslator.java | 8 ++-- .../JavaSetTitlesAnimationTranslator.java | 8 ++-- .../window/JavaCloseWindowTranslator.java | 8 ++-- .../window/JavaOpenHorseWindowTranslator.java | 8 ++-- .../java/window/JavaOpenWindowTranslator.java | 14 +++---- .../java/window/JavaSetSlotTranslator.java | 10 ++--- .../JavaTradeListTranslator.java | 10 ++--- .../window/JavaWindowItemsTranslator.java | 8 ++-- .../window/JavaWindowPropertyTranslator.java | 8 ++-- .../translators/world/GeyserWorldManager.java | 8 ++-- .../world/block/entity/PistonBlockEntity.java | 2 +- .../connector/registry/Registries.java | 4 +- .../loader/ParticleTypesRegistryLoader.java | 2 +- .../loader/SoundEffectsRegistryLoader.java | 2 +- .../connector/utils/BedrockMapIcon.java | 2 +- .../geysermc/connector/utils/BlockUtils.java | 2 +- .../connector/utils/DimensionUtils.java | 4 +- .../geysermc/connector/utils/Direction.java | 2 +- .../geysermc/connector/utils/EffectUtils.java | 2 +- .../connector/utils/InventoryUtils.java | 12 +++--- .../connector/utils/PluginMessageUtils.java | 4 +- 150 files changed, 652 insertions(+), 662 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaLoginSuccessTranslator.java => JavaGameProfileTranslator.java} (88%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaUnlockRecipesTranslator.java => JavaRecipeTranslator.java} (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world/JavaVehicleMoveTranslator.java => entity/JavaMoveVehicleTranslator.java} (81%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaBlockBreakAnimTranslator.java (90%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaBlockChangeTranslator.java (90%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaBlockValueTranslator.java (93%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaChunkDataTranslator.java (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaExplosionTranslator.java (89%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaMapDataTranslator.java (84%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaMultiBlockChangeTranslator.java (79%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaNotifyClientTranslator.java (91%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaPlayBuiltinSoundTranslator.java (93%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaPlayEffectTranslator.java (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaPlaySoundTranslator.java (84%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaSpawnParticleTranslator.java (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaSpawnPositionTranslator.java (84%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaStopSoundTranslator.java (87%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUnloadChunkTranslator.java (87%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateTileEntityTranslator.java (90%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateTimeTranslator.java (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateViewDistanceTranslator.java (80%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/JavaUpdateViewPositionTranslator.java (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaInitializeBorderTranslator.java (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderCenterTranslator.java (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderLerpSizeTranslator.java (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderSizeTranslator.java (83%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderWarningDelayTranslator.java (81%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => level}/border/JavaSetBorderWarningDistanceTranslator.java (80%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{world => window}/JavaTradeListTranslator.java (94%) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java index 39fefb2de..9810334f6 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java @@ -25,7 +25,7 @@ package org.geysermc.platform.spigot.world; -import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValueType; +import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3i; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; diff --git a/connector/pom.xml b/connector/pom.xml index b9b7b5732..0b9913ea2 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -147,9 +147,9 @@ compile - com.github.GeyserMC - MCProtocolLib - c2985e8 + com.github.steveice10 + mcprotocollib + 1.17.1-3-SNAPSHOT compile diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java index 47ca821b9..ea6062063 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java @@ -26,8 +26,8 @@ package org.geysermc.connector.command.defaults; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.command.GeyserCommand; @@ -46,7 +46,7 @@ public class OffhandCommand extends GeyserCommand { return; } - ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, + ServerboundPlayerActionPacket releaseItemPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, BlockFace.DOWN); session.sendDownstreamPacket(releaseItemPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java index 3502941d5..7c2c13816 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java @@ -26,7 +26,7 @@ package org.geysermc.connector.command.defaults; import com.github.steveice10.mc.protocol.data.game.ClientRequest; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.command.GeyserCommand; @@ -43,8 +43,8 @@ public class StatisticsCommand extends GeyserCommand { if (session == null) return; session.setWaitingForStatistics(true); - ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.STATS); - session.sendDownstreamPacket(clientRequestPacket); + ServerboundClientCommandPacket ServerboundClientCommandPacket = new ServerboundClientCommandPacket(ClientRequest.STATS); + session.sendDownstreamPacket(ServerboundClientCommandPacket); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java index 218275ae8..48283818e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java @@ -26,7 +26,7 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.world.particle.Particle; +import com.github.steveice10.mc.protocol.data.game.level.particle.Particle; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index 4cc9fea0e..369b86a8e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -72,7 +72,7 @@ public class BoatEntity extends Entity { MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); moveEntityPacket.setRuntimeEntityId(geyserId); - // Minimal glitching when ServerVehicleMovePacket is sent + // Minimal glitching when ClientboundMoveVehiclePacket is sent moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityType.PLAYER.getOffset() - this.entityType.getOffset()) : this.position); moveEntityPacket.setRotation(getBedrockRotation()); moveEntityPacket.setOnGround(isOnGround); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java index 142c0012b..2402e4330 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java @@ -26,7 +26,7 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 6a357251b..949b0937a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -40,12 +40,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; -import com.github.steveice10.mc.protocol.packet.handshake.client.HandshakePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; -import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; +import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; +import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.event.session.*; import com.github.steveice10.packetlib.packet.Packet; @@ -376,7 +376,7 @@ public class GeyserSession implements CommandSender { private long lastMovementTimestamp = System.currentTimeMillis(); /** - * Used to send a ClientVehicleMovePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms + * Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms */ @Setter private long lastVehicleMoveTimestamp = System.currentTimeMillis(); @@ -737,7 +737,7 @@ public class GeyserSession implements CommandSender { @Override public void packetSending(PacketSendingEvent event) { //todo move this somewhere else - if (event.getPacket() instanceof HandshakePacket) { + if (event.getPacket() instanceof ClientIntentionPacket) { String addressSuffix; if (floodgate) { byte[] encryptedData; @@ -778,21 +778,16 @@ public class GeyserSession implements CommandSender { addressSuffix = ""; } - HandshakePacket handshakePacket = event.getPacket(); + ClientIntentionPacket intentionPacket = event.getPacket(); String address; if (connector.getConfig().getRemote().isForwardHost()) { address = clientData.getServerAddress().split(":")[0]; } else { - address = handshakePacket.getHostname(); + address = intentionPacket.getHostname(); } - event.setPacket(new HandshakePacket( - handshakePacket.getProtocolVersion(), - address + addressSuffix, - handshakePacket.getPort(), - handshakePacket.getIntent() - )); + event.setPacket(intentionPacket.withHostname(address + addressSuffix)); } } @@ -963,7 +958,7 @@ public class GeyserSession implements CommandSender { Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround(), false); // A null return value cancels the packet if (position != null) { - ClientPlayerPositionPacket packet = new ClientPlayerPositionPacket(playerEntity.isOnGround(), + ServerboundMovePlayerPosPacket packet = new ServerboundMovePlayerPosPacket(playerEntity.isOnGround(), position.getX(), position.getY(), position.getZ()); sendDownstreamPacket(packet); } @@ -1242,10 +1237,10 @@ public class GeyserSession implements CommandSender { TeleportCache entry = it.next().getValue(); int nextID = entry.getTeleportConfirmId(); if (nextID <= teleportID) { - ClientTeleportConfirmPacket teleportConfirmPacket = new ClientTeleportConfirmPacket(nextID); + ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(nextID); sendDownstreamPacket(teleportConfirmPacket); // Servers (especially ones like Hypixel) expect exact coordinates given back to them. - ClientPlayerPositionRotationPacket positionPacket = new ClientPlayerPositionRotationPacket(playerEntity.isOnGround(), + ServerboundMovePlayerPosRotPacket positionPacket = new ServerboundMovePlayerPosRotPacket(playerEntity.isOnGround(), entry.getX(), entry.getY(), entry.getZ(), entry.getYaw(), entry.getPitch()); sendDownstreamPacket(positionPacket); it.remove(); @@ -1320,7 +1315,7 @@ public class GeyserSession implements CommandSender { } private void sendDownstreamPacket0(Packet packet) { - if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == LoginPluginResponsePacket.class) { + if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { downstream.send(packet); } else { connector.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); @@ -1400,7 +1395,7 @@ public class GeyserSession implements CommandSender { if (spectator && !flying) { // We're "flying locked" in this gamemode flying = true; - ClientPlayerAbilitiesPacket abilitiesPacket = new ClientPlayerAbilitiesPacket(true); + ServerboundPlayerAbilitiesPacket abilitiesPacket = new ServerboundPlayerAbilitiesPacket(true); sendDownstreamPacket(abilitiesPacket); } flags.add(AdventureSetting.FLYING); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java index 98ec5b262..8831e140c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.session.cache; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientAdvancementTabPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.network.session.GeyserSession; @@ -113,7 +113,7 @@ public class AdvancementsCache { buildAndShowListForm(); } else { // Send a packet indicating that we intend to open this particular advancement window - ClientAdvancementTabPacket packet = new ClientAdvancementTabPacket(id); + ServerboundSeenAdvancementsPacket packet = new ServerboundSeenAdvancementsPacket(id); session.sendDownstreamPacket(packet); // Wait for a response there } @@ -152,7 +152,7 @@ public class AdvancementsCache { SimpleFormResponse response = form.parseResponse(responseData); if (!response.isCorrect()) { // Indicate that we have closed the current advancement tab - session.sendDownstreamPacket(new ClientAdvancementTabPacket()); + session.sendDownstreamPacket(new ServerboundSeenAdvancementsPacket()); return; } @@ -176,7 +176,7 @@ public class AdvancementsCache { } else { buildAndShowMenuForm(); // Indicate that we have closed the current advancement tab - session.sendDownstreamPacket(new ClientAdvancementTabPacket()); + session.sendDownstreamPacket(new ServerboundSeenAdvancementsPacket()); } }); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java index d2ee8f552..193a1d41a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.session.cache; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEditBookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundEditBookPacket; import lombok.Setter; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; @@ -39,7 +39,7 @@ import org.geysermc.connector.network.session.GeyserSession; public class BookEditCache { private final GeyserSession session; @Setter - private ClientEditBookPacket packet; + private ServerboundEditBookPacket packet; /** * Stores the last time a book update packet was sent to the server. */ diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java index e10e4dad5..221ab36c3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.session.cache; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareTagsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.geysermc.connector.registry.type.BlockMapping; @@ -34,7 +34,7 @@ import org.geysermc.connector.registry.type.ItemMapping; import java.util.Map; /** - * Manages information sent from the {@link ServerDeclareTagsPacket}. If that packet is not sent, all lists here + * Manages information sent from the {@link ClientboundUpdateTagsPacket}. If that packet is not sent, all lists here * will remain empty, matching Java Edition behavior. */ public class TagCache { @@ -61,7 +61,7 @@ public class TagCache { clear(); } - public void loadPacket(ServerDeclareTagsPacket packet) { + public void loadPacket(ClientboundUpdateTagsPacket packet) { Map blockTags = packet.getTags().get("minecraft:block"); this.leaves = IntList.of(blockTags.get("minecraft:leaves")); this.wool = IntList.of(blockTags.get("minecraft:wool")); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java index 17b96aeb1..6f40481db 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java @@ -33,7 +33,7 @@ import lombok.RequiredArgsConstructor; * Represents a teleport ID and corresponding coordinates that need to be confirmed.
* * The vanilla Java client, after getting a - * {@link com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket}, + * {@link com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket}, * adjusts the player's positions and immediately sends a teleport back. However, we want to acknowledge that the * Bedrock player actually moves close to that point, so we store the teleport until we get a movement packet from * Bedrock that the teleport was successful. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 56735f98d..d86830d20 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListDataPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateLightPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.protocol.bedrock.BedrockPacket; import io.netty.channel.EventLoop; @@ -73,8 +73,8 @@ public class PacketTranslatorRegistry { } } - IGNORED_PACKETS.add(ServerUpdateLightPacket.class); // Light is handled on Bedrock for us - IGNORED_PACKETS.add(ServerPlayerListDataPacket.class); // Cant be implemented in bedrock + IGNORED_PACKETS.add(ClientboundLightUpdatePacket.class); // Light is handled on Bedrock for us + IGNORED_PACKETS.add(ClientboundTabListPacket.class); // Cant be implemented in Bedrock } private PacketTranslatorRegistry() { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index a9ae9db6d..8a978fac3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; @@ -47,7 +47,7 @@ public class BedrockAdventureSettingsTranslator extends PacketTranslator { case SWING_ARM -> // Delay so entity damage can be processed first session.scheduleInEventLoop(() -> - session.sendDownstreamPacket(new ClientPlayerSwingArmPacket(Hand.MAIN_HAND)), + session.sendDownstreamPacket(new ServerboundSwingPacket(Hand.MAIN_HAND)), 25, TimeUnit.MILLISECONDS ); @@ -57,12 +57,12 @@ public class BedrockAnimateTranslator extends PacketTranslator { case ROW_LEFT -> { // Packet value is a float of how long one has been rowing, so we convert that into a boolean session.setSteeringLeft(packet.getRowingTime() > 0.0); - ClientSteerBoatPacket steerLeftPacket = new ClientSteerBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); + ServerboundPaddleBoatPacket steerLeftPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); session.sendDownstreamPacket(steerLeftPacket); } case ROW_RIGHT -> { session.setSteeringRight(packet.getRowingTime() > 0.0); - ClientSteerBoatPacket steerRightPacket = new ClientSteerBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); + ServerboundPaddleBoatPacket steerRightPacket = new ServerboundPaddleBoatPacket(session.isSteeringLeft(), session.isSteeringRight()); session.sendDownstreamPacket(steerRightPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java index a5575bb82..6f94085ae 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateJigsawBlockPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientUpdateSignPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetJigsawBlockPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.connector.network.session.GeyserSession; @@ -105,8 +105,8 @@ public class BedrockBlockEntityDataTranslator extends PacketTranslator title = null; } - session.getBookEditCache().setPacket(new ClientEditBookPacket(session.getPlayerInventory().getHeldItemSlot(), networkPages, title)); + session.getBookEditCache().setPacket(new ServerboundEditBookPacket(session.getPlayerInventory().getHeldItemSlot(), networkPages, title)); // There won't be any more book updates after this, so we can try sending the edit packet immediately if (packet.getAction() == BookEditPacket.Action.SIGN_BOOK) { session.getBookEditCache().checkForSend(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java index 4a87776b1..a64e9c784 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -26,9 +26,9 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.data.game.world.block.CommandBlockMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateCommandBlockMinecartPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientUpdateCommandBlockPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandMinecartPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -52,12 +52,12 @@ public class BedrockCommandBlockUpdateTranslator extends PacketTranslator 1; - ClientPlayerActionPacket dropAllPacket = new ClientPlayerActionPacket( + ServerboundPlayerActionPacket dropAllPacket = new ServerboundPlayerActionPacket( dropAll ? PlayerAction.DROP_ITEM_STACK : PlayerAction.DROP_ITEM, BlockUtils.POSITION_ZERO, BlockFace.DOWN @@ -128,9 +128,9 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { - ClientPlayerUseItemPacket itemPacket = new ClientPlayerUseItemPacket(Hand.MAIN_HAND); + ServerboundUseItemPacket itemPacket = new ServerboundUseItemPacket(Hand.MAIN_HAND); session.sendDownstreamPacket(itemPacket); }, 5, TimeUnit.MILLISECONDS)); } @@ -280,7 +280,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { @@ -317,7 +317,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator currentJavaPage) { for (int i = currentJavaPage; i < newJavaPage; i++) { - ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 2); + ServerboundContainerButtonClickPacket clickButtonPacket = new ServerboundContainerButtonClickPacket(session.getOpenInventory().getId(), 2); session.sendDownstreamPacket(clickButtonPacket); } } else { for (int i = currentJavaPage; i > newJavaPage; i--) { - ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 1); + ServerboundContainerButtonClickPacket clickButtonPacket = new ServerboundContainerButtonClickPacket(session.getOpenInventory().getId(), 1); session.sendDownstreamPacket(clickButtonPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java index 4e53e0c4e..26dd340f6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; import org.geysermc.connector.network.session.GeyserSession; @@ -54,14 +54,14 @@ public class BedrockMobEquipmentTranslator extends PacketTranslator session.sendDownstreamPacket(new ClientPlayerUseItemPacket(Hand.MAIN_HAND)), + session.getConnector().getGeneralThreadPool().schedule(() -> session.sendDownstreamPacket(new ServerboundUseItemPacket(Hand.MAIN_HAND)), 50, TimeUnit.MILLISECONDS); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java index 6b3ad4467..b1e894d0a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.connector.entity.BoatEntity; @@ -66,10 +66,10 @@ public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator 0) { if (session.getConnector().getConfig().isForwardPlayerPing()) { - ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(pingId); + ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(pingId); session.sendDownstreamPacket(keepAlivePacket); } return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java index 27289b5d2..8cc7568b5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientSteerVehiclePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPlayerInputPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.PlayerInputPacket; @@ -47,11 +47,11 @@ public class BedrockPlayerInputTranslator extends PacketTranslator { session.sendUpstreamPacket(movePlayerPacket); } - ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); + ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java index 0252817ef..8feadb180 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java @@ -30,7 +30,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.data.game.ClientRequest; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; @Translator(packet = ShowCreditsPacket.class) @@ -39,7 +39,7 @@ public class BedrockShowCreditsTranslator extends PacketTranslator { return; } - ClientChatPacket chatPacket = new ClientChatPacket(message); + ServerboundChatPacket chatPacket = new ServerboundChatPacket(message); session.sendDownstreamPacket(chatPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index ae2acc21b..7b19dee44 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.bedrock.entity; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSelectTradePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSelectTradePacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.connector.entity.Entity; @@ -51,7 +51,7 @@ public class BedrockEntityEventTranslator extends PacketTranslator { - ClientSelectTradePacket selectTradePacket = new ClientSelectTradePacket(packet.getData()); + ServerboundSelectTradePacket selectTradePacket = new ServerboundSelectTradePacket(packet.getData()); session.sendDownstreamPacket(selectTradePacket); session.scheduleInEventLoop(() -> { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java index ab652434c..497de45f8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java @@ -27,8 +27,8 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.*; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.*; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.*; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -80,27 +80,27 @@ public class BedrockActionTranslator extends PacketTranslator { public void translate(GeyserSession session, EmotePacket packet) { if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now - ClientPlayerActionPacket swapHandsPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, + ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, BlockFace.DOWN); session.sendDownstreamPacket(swapHandsPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java index cb101c231..9a307d076 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java @@ -28,8 +28,8 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerInteractEntityPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; @@ -62,17 +62,17 @@ public class BedrockInteractTranslator extends PacketTranslator if (session.getPlayerInventory().getItemInHand().getJavaId() == session.getItemMappings().getStoredItems().shield().getJavaId()) { break; } - ClientPlayerInteractEntityPacket interactPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(), + ServerboundInteractPacket interactPacket = new ServerboundInteractPacket((int) entity.getEntityId(), InteractAction.INTERACT, Hand.MAIN_HAND, session.isSneaking()); session.sendDownstreamPacket(interactPacket); break; case DAMAGE: - ClientPlayerInteractEntityPacket attackPacket = new ClientPlayerInteractEntityPacket((int) entity.getEntityId(), + ServerboundInteractPacket attackPacket = new ServerboundInteractPacket((int) entity.getEntityId(), InteractAction.ATTACK, Hand.MAIN_HAND, session.isSneaking()); session.sendDownstreamPacket(attackPacket); break; case LEAVE_VEHICLE: - ClientPlayerStatePacket sneakPacket = new ClientPlayerStatePacket((int) entity.getEntityId(), PlayerState.START_SNEAKING); + ServerboundPlayerCommandPacket sneakPacket = new ServerboundPlayerCommandPacket((int) entity.getEntityId(), PlayerState.START_SNEAKING); session.sendDownstreamPacket(sneakPacket); session.setRidingVehicleEntity(null); break; @@ -101,7 +101,7 @@ public class BedrockInteractTranslator extends PacketTranslator if (ridingEntity instanceof AbstractHorseEntity) { if (ridingEntity.getMetadata().getFlags().getFlag(EntityFlag.TAMED)) { // We should request to open the horse inventory instead - ClientPlayerStatePacket openHorseWindowPacket = new ClientPlayerStatePacket((int) session.getPlayerEntity().getEntityId(), PlayerState.OPEN_HORSE_INVENTORY); + ServerboundPlayerCommandPacket openHorseWindowPacket = new ServerboundPlayerCommandPacket((int) session.getPlayerEntity().getEntityId(), PlayerState.OPEN_HORSE_INVENTORY); session.sendDownstreamPacket(openHorseWindowPacket); } } else { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index fb7979afd..85d3a945e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -25,9 +25,9 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerRotPacket; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; @@ -81,7 +81,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator { +@Translator(packet = ClientboundSelectAdvancementsTabPacket.class) +public class JavaAdvancementsTabTranslator extends PacketTranslator { + @Override - public void translate(GeyserSession session, ServerAdvancementTabPacket packet) { + public void translate(GeyserSession session, ClientboundSelectAdvancementsTabPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId()); advancementsCache.buildAndShowListForm(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java index 01de50c21..46aac1212 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerAdvancementsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -38,11 +38,11 @@ import org.geysermc.connector.utils.LocaleUtils; import java.util.Map; -@Translator(packet = ServerAdvancementsPacket.class) -public class JavaAdvancementsTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateAdvancementsPacket.class) +public class JavaAdvancementsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerAdvancementsPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateAdvancementsPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); if (packet.isReset()) { advancementsCache.getStoredAdvancements().clear(); @@ -72,7 +72,7 @@ public class JavaAdvancementsTranslator extends PacketTranslator { +@Translator(packet = ClientboundBossEventPacket.class) +public class JavaBossBarTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBossBarPacket packet) { + public void translate(GeyserSession session, ClientboundBossEventPacket packet) { BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); switch (packet.getAction()) { case ADD: diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java index 57e473267..0b6683f8b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerChatPacket.class) -public class JavaChatTranslator extends PacketTranslator { +@Translator(packet = ClientboundChatPacket.class) +public class JavaChatTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerChatPacket packet) { + public void translate(GeyserSession session, ClientboundChatPacket packet) { TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java index 92dc83c37..61e8be4a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCommandsPacket; import com.nukkitx.protocol.bedrock.data.command.CommandData; import com.nukkitx.protocol.bedrock.data.command.CommandEnumData; import com.nukkitx.protocol.bedrock.data.command.CommandParam; @@ -53,8 +53,8 @@ import org.geysermc.connector.utils.EntityUtils; import java.util.*; -@Translator(packet = ServerDeclareCommandsPacket.class) -public class JavaDeclareCommandsTranslator extends PacketTranslator { +@Translator(packet = ClientboundCommandsPacket.class) +public class JavaDeclareCommandsTranslator extends PacketTranslator { private static final String[] ALL_EFFECT_IDENTIFIERS = EntityUtils.getAllEffectIdentifiers(); private static final String[] ENUM_BOOLEAN = {"true", "false"}; @@ -98,7 +98,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateRecipesPacket.class) +public class JavaDeclareRecipesTranslator extends PacketTranslator { /** * Required to use the specified cartography table recipes */ @@ -71,7 +71,7 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion()); // Get the last known network ID (first used for the pregenerated recipes) and increment from there. int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java index c72ab4543..a6c532919 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java @@ -25,16 +25,16 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareTagsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerDeclareTagsPacket.class) -public class JavaDeclareTagsTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateTagsPacket.class) +public class JavaDeclareTagsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDeclareTagsPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) { session.getTagCache().loadPacket(packet); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java index b6299cc35..56c32ca95 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java @@ -25,18 +25,17 @@ package org.geysermc.connector.network.translators.java; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; - -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDifficultyPacket; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; -@Translator(packet = ServerDifficultyPacket.class) -public class JavaDifficultyTranslator extends PacketTranslator { +@Translator(packet = ClientboundChangeDifficultyPacket.class) +public class JavaDifficultyTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDifficultyPacket packet) { + public void translate(GeyserSession session, ClientboundChangeDifficultyPacket packet) { SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket(); setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal()); session.sendUpstreamPacket(setDifficultyPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java index b5b2e83a3..72a9646fe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDisconnectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerDisconnectPacket.class) -public class JavaDisconnectPacket extends PacketTranslator { +@Translator(packet = ClientboundDisconnectPacket.class) +public class JavaDisconnectPacket extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDisconnectPacket packet) { + public void translate(GeyserSession session, ClientboundDisconnectPacket packet) { session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java similarity index 88% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java index e3350c5eb..326ad97ac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginSuccessTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.auth.data.GameProfile; -import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket; +import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; @@ -34,11 +34,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.skin.SkinManager; -@Translator(packet = LoginSuccessPacket.class) -public class JavaLoginSuccessTranslator extends PacketTranslator { +@Translator(packet = ClientboundGameProfilePacket.class) +public class JavaGameProfileTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LoginSuccessPacket packet) { + public void translate(GeyserSession session, ClientboundGameProfilePacket packet) { PlayerEntity playerEntity = session.getPlayerEntity(); AuthType remoteAuthType = session.getRemoteAuthType(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java index b0332e23e..932b205a0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java @@ -28,9 +28,9 @@ package org.geysermc.connector.network.translators.java; import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference; import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility; import com.github.steveice10.mc.protocol.data.game.setting.SkinPart; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; @@ -47,12 +47,12 @@ import org.geysermc.connector.utils.PluginMessageUtils; import java.util.Arrays; import java.util.List; -@Translator(packet = ServerJoinGamePacket.class) -public class JavaJoinGameTranslator extends PacketTranslator { +@Translator(packet = ClientboundLoginPacket.class) +public class JavaJoinGameTranslator extends PacketTranslator { private static final List SKIN_PART_VALUES = Arrays.asList(SkinPart.values()); @Override - public void translate(GeyserSession session, ServerJoinGamePacket packet) { + public void translate(GeyserSession session, ClientboundLoginPacket packet) { PlayerEntity entity = session.getPlayerEntity(); entity.setEntityId(packet.getEntityId()); @@ -100,14 +100,14 @@ public class JavaJoinGameTranslator extends PacketTranslator { +@Translator(packet = ClientboundKeepAlivePacket.class) +public class JavaKeepAliveTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerKeepAlivePacket packet) { + public void translate(GeyserSession session, ClientboundKeepAlivePacket packet) { if (!session.getConnector().getConfig().isForwardPlayerPing()) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java index b596a336d..9773a237a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.login.server.LoginDisconnectPacket; +import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = LoginDisconnectPacket.class) -public class JavaLoginDisconnectTranslator extends PacketTranslator { +@Translator(packet = ClientboundLoginDisconnectPacket.class) +public class JavaLoginDisconnectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LoginDisconnectPacket packet) { + public void translate(GeyserSession session, ClientboundLoginDisconnectPacket packet) { // The client doesn't manually get disconnected so we have to do it ourselves session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java index 2ed285208..9f734acc4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java @@ -25,21 +25,20 @@ package org.geysermc.connector.network.translators.java; +import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundCustomQueryPacket; +import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; -import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestPacket; - -@Translator(packet = LoginPluginRequestPacket.class) -public class JavaLoginPluginRequestTranslator extends PacketTranslator { +@Translator(packet = ClientboundCustomQueryPacket.class) +public class JavaLoginPluginRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LoginPluginRequestPacket packet) { + public void translate(GeyserSession session, ClientboundCustomQueryPacket packet) { // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. // Note: Fabric Networking API v1 will not let the client log in without sending this session.sendDownstreamPacket( - new LoginPluginResponsePacket(packet.getMessageId(), null) + new ServerboundCustomQueryPacket(packet.getMessageId(), null) ); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java index c2dc3454d..1d090eb19 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPongPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPingPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; // Why does this packet exist? Whatever, we better implement it -@Translator(packet = ServerPingPacket.class) -public class JavaPingPacket extends PacketTranslator { +@Translator(packet = ClientboundPingPacket.class) +public class JavaPingPacket extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPingPacket packet) { - session.sendDownstreamPacket(new ClientPongPacket(packet.getId())); + public void translate(GeyserSession session, ClientboundPingPacket packet) { + session.sendDownstreamPacket(new ServerboundPongPacket(packet.getId())); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index 6b49c764b..2b5926b2c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; import com.google.common.base.Charsets; import com.nukkitx.protocol.bedrock.packet.TransferPacket; import org.geysermc.connector.GeyserConnector; @@ -41,12 +41,12 @@ import org.geysermc.cumulus.util.FormType; import java.nio.charset.StandardCharsets; -@Translator(packet = ServerPluginMessagePacket.class) -public class JavaPluginMessageTranslator extends PacketTranslator { +@Translator(packet = ClientboundCustomPayloadPacket.class) +public class JavaPluginMessageTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override - public void translate(GeyserSession session, ServerPluginMessagePacket packet) { + public void translate(GeyserSession session, ClientboundCustomPayloadPacket packet) { // The only plugin messages it has to listen for are Floodgate plugin messages if (session.getRemoteAuthType() != AuthType.FLOODGATE) { return; @@ -77,7 +77,7 @@ public class JavaPluginMessageTranslator extends PacketTranslator { +@Translator(packet = ClientboundRecipePacket.class) +public class JavaRecipeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUnlockRecipesPacket packet) { + public void translate(GeyserSession session, ClientboundRecipePacket packet) { if (packet.getAction() == UnlockRecipesAction.REMOVE) { session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes())); } else { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java index 0b9d16827..0ae81482c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; @@ -39,11 +39,11 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.ChunkUtils; import org.geysermc.connector.utils.DimensionUtils; -@Translator(packet = ServerRespawnPacket.class) -public class JavaRespawnTranslator extends PacketTranslator { +@Translator(packet = ClientboundRespawnPacket.class) +public class JavaRespawnTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerRespawnPacket packet) { + public void translate(GeyserSession session, ClientboundRespawnPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); entity.setHealth(entity.getMaxHealth()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java index 15c6452ed..69a82efe0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStatisticsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.StatisticsUtils; -@Translator(packet = ServerStatisticsPacket.class) -public class JavaStatisticsTranslator extends PacketTranslator { +@Translator(packet = ClientboundAwardStatsPacket.class) +public class JavaStatisticsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerStatisticsPacket packet) { + public void translate(GeyserSession session, ClientboundAwardStatsPacket packet) { session.updateStatistics(packet.getStatistics()); if (session.isWaitingForStatistics()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java index 57bacc658..95a1628df 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityAnimationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AnimateEntityPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; @@ -36,11 +36,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.DimensionUtils; -@Translator(packet = ServerEntityAnimationPacket.class) -public class JavaEntityAnimationTranslator extends PacketTranslator { +@Translator(packet = ClientboundAnimatePacket.class) +public class JavaEntityAnimationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityAnimationPacket packet) { + public void translate(GeyserSession session, ClientboundAnimatePacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); @@ -56,7 +56,7 @@ public class JavaEntityAnimationTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEntityLinkPacket.class) +public class JavaEntityAttachTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityAttachPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityLinkPacket packet) { Entity holderId; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java index 70b93472f..8bc497b8d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityCollectItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTakeItemEntityPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.TakeItemEntityPacket; @@ -40,11 +40,11 @@ import org.geysermc.connector.network.translators.Translator; * In Java, this is called for item entities, experience orbs and arrows * Bedrock uses it for arrows and item entities, but not experience orbs. */ -@Translator(packet = ServerEntityCollectItemPacket.class) -public class JavaEntityCollectItemTranslator extends PacketTranslator { +@Translator(packet = ClientboundTakeItemEntityPacket.class) +public class JavaEntityCollectItemTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityCollectItemPacket packet) { + public void translate(GeyserSession session, ClientboundTakeItemEntityPacket packet) { // Collected entity is the other entity Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId()); if (collectedEntity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java index d99b11a49..3e8c056cb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.EntityUtils; -@Translator(packet = ServerEntityEffectPacket.class) -public class JavaEntityEffectTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateMobEffectPacket.class) +public class JavaEntityEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityEffectPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java index f297f1a38..3df6df2b0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEquipmentPacket; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.LivingEntity; @@ -35,11 +35,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.item.ItemTranslator; -@Translator(packet = ServerEntityEquipmentPacket.class) -public class JavaEntityEquipmentTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEquipmentPacket.class) +public class JavaEntityEquipmentTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityEquipmentPacket packet) { + public void translate(GeyserSession session, ClientboundSetEquipmentPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java index 5120e8c3a..97a4f16d5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java @@ -25,20 +25,22 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityHeadLookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityHeadLookPacket.class) -public class JavaEntityHeadLookTranslator extends PacketTranslator { +@Translator(packet = ClientboundRotateHeadPacket.class) +public class JavaEntityHeadLookTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityHeadLookPacket packet) { - Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); + public void translate(GeyserSession session, ClientboundRotateHeadPacket packet) { + Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java index 02ec44ad1..d55a4e747 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityMetadataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -34,11 +34,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.InteractiveTagManager; import org.geysermc.connector.utils.LanguageUtils; -@Translator(packet = ServerEntityMetadataPacket.class) -public class JavaEntityMetadataTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEntityDataPacket.class) +public class JavaEntityMetadataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityMetadataPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityDataPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java index 733725936..419010a2f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosRotPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityPositionRotationPacket.class) -public class JavaEntityPositionRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveEntityPosRotPacket.class) +public class JavaEntityPositionRotationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityPositionRotationPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityPosRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java index 67f8fe1b6..f43afbe9b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java @@ -25,20 +25,22 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityPositionPacket.class) -public class JavaEntityPositionTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveEntityPosPacket.class) +public class JavaEntityPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityPositionPacket packet) { - Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); + public void translate(GeyserSession session, ClientboundMoveEntityPosPacket packet) { + Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java index c3937a1e3..9f00a1832 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java @@ -25,26 +25,26 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityPropertiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateAttributesPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityPropertiesPacket.class) -public class JavaEntityPropertiesTranslator extends PacketTranslator { +@Translator(packet = ClientboundUpdateAttributesPacket.class) +public class JavaEntityPropertiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityPropertiesPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateAttributesPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); } else { entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } - if (!(entity instanceof LivingEntity)) return; + if (!(entity instanceof LivingEntity livingEntity)) return; - ((LivingEntity) entity).updateBedrockAttributes(session, packet.getAttributes()); + livingEntity.updateBedrockAttributes(session, packet.getAttributes()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java index 131fa2505..efb1ed75b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRemoveEffectPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.EntityUtils; -@Translator(packet = ServerEntityRemoveEffectPacket.class) -public class JavaEntityRemoveEffectTranslator extends PacketTranslator { +@Translator(packet = ClientboundRemoveMobEffectPacket.class) +public class JavaEntityRemoveEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityRemoveEffectPacket packet) { + public void translate(GeyserSession session, ClientboundRemoveMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java index 71e005899..846914ebe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerEntityRotationPacket.class) -public class JavaEntityRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveEntityRotPacket.class) +public class JavaEntityRotationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityRotationPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java index da282648b..081f59f37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntitySetPassengersPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetPassengersPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; @@ -39,11 +39,11 @@ import org.geysermc.connector.utils.EntityUtils; import java.util.Arrays; -@Translator(packet = ServerEntitySetPassengersPacket.class) -public class JavaEntitySetPassengersTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetPassengersPacket.class) +public class JavaEntitySetPassengersTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntitySetPassengersPacket packet) { + public void translate(GeyserSession session, ClientboundSetPassengersPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java index 8eafdd8bb..1c943ce8b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,11 +41,11 @@ import org.geysermc.connector.network.translators.Translator; import java.util.concurrent.ThreadLocalRandom; -@Translator(packet = ServerEntityStatusPacket.class) -public class JavaEntityStatusTranslator extends PacketTranslator { +@Translator(packet = ClientboundEntityEventPacket.class) +public class JavaEntityStatusTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityStatusPacket packet) { + public void translate(GeyserSession session, ClientboundEntityEventPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java index 35dcacfec..bbc852cfe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java @@ -25,19 +25,18 @@ package org.geysermc.connector.network.translators.java.entity; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTeleportEntityPacket; +import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket; -import com.nukkitx.math.vector.Vector3f; - -@Translator(packet = ServerEntityTeleportPacket.class) -public class JavaEntityTeleportTranslator extends PacketTranslator { +@Translator(packet = ClientboundTeleportEntityPacket.class) +public class JavaEntityTeleportTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityTeleportPacket packet) { + public void translate(GeyserSession session, ClientboundTeleportEntityPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java index 28d0d977f..c563b84d7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java @@ -32,15 +32,15 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityVelocityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityMotionPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; -@Translator(packet = ServerEntityVelocityPacket.class) -public class JavaEntityVelocityTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetEntityMotionPacket.class) +public class JavaEntityVelocityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerEntityVelocityPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityMotionPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java similarity index 81% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java index 2f984517c..28a007931 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerVehicleMovePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerVehicleMovePacket.class) -public class JavaVehicleMoveTranslator extends PacketTranslator { +@Translator(packet = ClientboundMoveVehiclePacket.class) +public class JavaMoveVehicleTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerVehicleMovePacket packet) { + public void translate(GeyserSession session, ClientboundMoveVehiclePacket packet) { Entity entity = session.getRidingVehicleEntity(); if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java index 0b1e021e2..e0592f34d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerRemoveEntitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerRemoveEntitiesPacket.class) -public class JavaRemoveEntitiesTranslator extends PacketTranslator { +@Translator(packet = ClientboundRemoveEntitiesPacket.class) +public class JavaRemoveEntitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerRemoveEntitiesPacket packet) { + public void translate(GeyserSession session, ClientboundRemoveEntitiesPacket packet) { for (int entityId : packet.getEntityIds()) { Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java index 4b0152fcb..a03bfceb1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -25,16 +25,16 @@ package org.geysermc.connector.network.translators.java.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerPlayerAbilitiesPacket.class) -public class JavaPlayerAbilitiesTranslator extends PacketTranslator { +@Translator(packet = ClientboundPlayerAbilitiesPacket.class) +public class JavaPlayerAbilitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerAbilitiesPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerAbilitiesPacket packet) { session.setCanFly(packet.isCanFly()); session.setFlying(packet.isFlying()); session.sendAdventureSettings(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java index 8c9aa0142..1037bcb85 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerActionAckPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundBlockBreakAckPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; @@ -36,11 +36,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.ChunkUtils; -@Translator(packet = ServerPlayerActionAckPacket.class) -public class JavaPlayerActionAckTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockBreakAckPacket.class) +public class JavaPlayerActionAckTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerActionAckPacket packet) { + public void translate(GeyserSession session, ClientboundBlockBreakAckPacket packet) { ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) { LevelEventPacket stopBreak = new LevelEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java index 27e16ee12..184aabfad 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerChangeHeldItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetCarriedItemPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerPlayerChangeHeldItemPacket.class) -public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetCarriedItemPacket.class) +public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerChangeHeldItemPacket packet) { + public void translate(GeyserSession session, ClientboundSetCarriedItemPacket packet) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java index 20403a610..79a9e61e1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.player; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.SetHealthPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; @@ -37,11 +37,11 @@ import org.geysermc.connector.network.translators.Translator; import java.util.List; -@Translator(packet = ServerPlayerHealthPacket.class) -public class JavaPlayerHealthTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetHealthPacket.class) +public class JavaPlayerHealthTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerHealthPacket packet) { + public void translate(GeyserSession session, ClientboundSetHealthPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); int health = (int) Math.ceil(packet.getHealth()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java index f1989b2e1..0ce643971 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.PlayerListEntry; import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPlayerListEntryPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.connector.GeyserConnector; @@ -37,10 +37,10 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.skin.SkinManager; -@Translator(packet = ServerPlayerListEntryPacket.class) -public class JavaPlayerListEntryTranslator extends PacketTranslator { +@Translator(packet = ClientboundPlayerInfoPacket.class) +public class JavaPlayerListEntryTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerListEntryPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerInfoPacket packet) { if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java index 6b1778464..95e6f1f8e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PositionElement; -import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; @@ -46,11 +46,11 @@ import org.geysermc.connector.utils.ChunkUtils; import org.geysermc.connector.utils.EntityUtils; import org.geysermc.connector.utils.LanguageUtils; -@Translator(packet = ServerPlayerPositionRotationPacket.class) -public class JavaPlayerPositionRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundPlayerPositionPacket.class) +public class JavaPlayerPositionRotationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerPositionRotationPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerPositionPacket packet) { if (!session.isLoggedIn()) return; @@ -81,7 +81,7 @@ public class JavaPlayerPositionRotationTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetExperiencePacket.class) +public class JavaPlayerSetExperienceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayerSetExperiencePacket packet) { + public void translate(GeyserSession session, ClientboundSetExperiencePacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java index e53358ac2..dc5c7b459 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockDat import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddEntityPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.*; import org.geysermc.connector.entity.player.PlayerEntity; @@ -42,11 +42,11 @@ import org.geysermc.connector.utils.LanguageUtils; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -@Translator(packet = ServerSpawnEntityPacket.class) -public class JavaSpawnEntityTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddEntityPacket.class) +public class JavaSpawnEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnEntityPacket packet) { + public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java index 6fd0e6094..56cf457da 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network.translators.java.entity.spawn; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddExperienceOrbPacket; +import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ExpOrbEntity; import org.geysermc.connector.entity.type.EntityType; @@ -32,14 +34,11 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnExpOrbPacket; -import com.nukkitx.math.vector.Vector3f; - -@Translator(packet = ServerSpawnExpOrbPacket.class) -public class JavaSpawnExpOrbTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddExperienceOrbPacket.class) +public class JavaSpawnExpOrbTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnExpOrbPacket packet) { + public void translate(GeyserSession session, ClientboundAddExperienceOrbPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Entity entity = new ExpOrbEntity( diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java index 46d47e808..b6414b2ac 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnLivingEntityPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddMobPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.type.EntityType; @@ -38,11 +38,11 @@ import org.geysermc.connector.utils.LanguageUtils; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -@Translator(packet = ServerSpawnLivingEntityPacket.class) -public class JavaSpawnLivingEntityTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddMobPacket.class) +public class JavaSpawnLivingEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnLivingEntityPacket packet) { + public void translate(GeyserSession session, ClientboundAddMobPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getHeadYaw()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java index 1d5ee4736..595b77d33 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPaintingPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.PaintingEntity; import org.geysermc.connector.network.session.GeyserSession; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.PaintingType; -@Translator(packet = ServerSpawnPaintingPacket.class) -public class JavaSpawnPaintingTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddPaintingPacket.class) +public class JavaSpawnPaintingTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnPaintingPacket packet) { + public void translate(GeyserSession session, ClientboundAddPaintingPacket packet) { Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); PaintingEntity entity = new PaintingEntity(packet.getEntityId(), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java index 6df3666b6..d574da825 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.entity.spawn; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.entity.player.PlayerEntity; @@ -35,11 +35,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.skin.SkinManager; -@Translator(packet = ServerSpawnPlayerPacket.class) -public class JavaSpawnPlayerTranslator extends PacketTranslator { +@Translator(packet = ClientboundAddPlayerPacket.class) +public class JavaSpawnPlayerTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnPlayerPacket packet) { + public void translate(GeyserSession session, ClientboundAddPlayerPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java index da2e74604..1e64eb565 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockBreakAnimTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockBreakAnimPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockDestructionPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -37,11 +37,11 @@ import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.utils.BlockUtils; -@Translator(packet = ServerBlockBreakAnimPacket.class) -public class JavaBlockBreakAnimTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockDestructionPacket.class) +public class JavaBlockBreakAnimTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBlockBreakAnimPacket packet) { + public void translate(GeyserSession session, ClientboundBlockDestructionPacket packet) { int state = session.getConnector().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); int breakTime = (int) (65535 / Math.ceil(BlockUtils.getBreakTime(session, BlockRegistries.JAVA_BLOCKS.get(state), ItemMapping.AIR, new CompoundTag(""), false) * 20)); LevelEventPacket levelEventPacket = new LevelEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java index 78ee1238e..8ed714710 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockChangePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; @@ -38,11 +38,11 @@ import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHan import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.ChunkUtils; -@Translator(packet = ServerBlockChangePacket.class) -public class JavaBlockChangeTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockUpdatePacket.class) +public class JavaBlockChangeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBlockChangePacket packet) { + public void translate(GeyserSession session, ClientboundBlockUpdatePacket packet) { Position pos = packet.getRecord().getPosition(); boolean updatePlacement = session.getConnector().getPlatformType() != PlatformType.SPIGOT && // Spigot simply listens for the block place event session.getConnector().getWorldManager().getBlockAt(session, pos) != packet.getRecord().getBlock(); @@ -53,7 +53,7 @@ public class JavaBlockChangeTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockEventPacket.class) +public class JavaBlockValueTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerBlockValuePacket packet) { + public void translate(GeyserSession session, ClientboundBlockEventPacket packet) { BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java index baa2d6781..139924858 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.chunk.Column; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerChunkDataPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkPacket; import com.nukkitx.nbt.NBTOutputStream; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; @@ -46,11 +46,11 @@ import org.geysermc.connector.utils.ChunkUtils; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD; -@Translator(packet = ServerChunkDataPacket.class) -public class JavaChunkDataTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelChunkPacket.class) +public class JavaChunkDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerChunkDataPacket packet) { + public void translate(GeyserSession session, ClientboundLevelChunkPacket packet) { if (session.isSpawned()) { ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java similarity index 89% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java index 721e40c8e..c8af1d1d7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaExplosionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.block.ExplodedBlockRecord; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerExplosionPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.ExplodedBlockRecord; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -40,11 +40,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.ChunkUtils; -@Translator(packet = ServerExplosionPacket.class) -public class JavaExplosionTranslator extends PacketTranslator { +@Translator(packet = ClientboundExplodePacket.class) +public class JavaExplosionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerExplosionPacket packet) { + public void translate(GeyserSession session, ClientboundExplodePacket packet) { for (ExplodedBlockRecord record : packet.getExploded()) { Vector3i pos = Vector3i.from(packet.getX() + record.getX(), packet.getY() + record.getY(), packet.getZ() + record.getZ()); ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, pos); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java similarity index 84% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java index 7fee63437..ad080e1f0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java @@ -23,14 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.map.MapData; -import com.github.steveice10.mc.protocol.data.game.world.map.MapIcon; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMapDataPacket; +import com.github.steveice10.mc.protocol.data.game.level.map.MapData; +import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.data.MapDecoration; import com.nukkitx.protocol.bedrock.data.MapTrackedObject; -import com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -38,11 +37,11 @@ import org.geysermc.connector.utils.BedrockMapIcon; import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.MapColor; -@Translator(packet = ServerMapDataPacket.class) -public class JavaMapDataTranslator extends PacketTranslator { +@Translator(packet = ClientboundMapItemDataPacket.class) +public class JavaMapDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerMapDataPacket packet) { - ClientboundMapItemDataPacket mapItemDataPacket = new ClientboundMapItemDataPacket(); + public void translate(GeyserSession session, ClientboundMapItemDataPacket packet) { + com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket mapItemDataPacket = new com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket(); boolean shouldStore = false; mapItemDataPacket.setUniqueMapId(packet.getMapId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java similarity index 79% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java index 2a4115af7..1d3409af9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaMultiBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java @@ -23,21 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeRecord; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.ChunkUtils; -import com.github.steveice10.mc.protocol.data.game.world.block.BlockChangeRecord; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerMultiBlockChangePacket; - -@Translator(packet = ServerMultiBlockChangePacket.class) -public class JavaMultiBlockChangeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSectionBlocksUpdatePacket.class) +public class JavaMultiBlockChangeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerMultiBlockChangePacket packet) { + public void translate(GeyserSession session, ClientboundSectionBlocksUpdatePacket packet) { for (BlockChangeRecord record : packet.getRecords()) { ChunkUtils.updateBlock(session, record.getBlock(), record.getPosition()); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java similarity index 91% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java index 282712172..3b9948530 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.ClientRequest; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.data.game.world.notify.EnterCreditsValue; -import com.github.steveice10.mc.protocol.data.game.world.notify.RainStrengthValue; -import com.github.steveice10.mc.protocol.data.game.world.notify.RespawnScreenValue; -import com.github.steveice10.mc.protocol.data.game.world.notify.ThunderStrengthValue; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientRequestPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket; +import com.github.steveice10.mc.protocol.data.game.level.notify.EnterCreditsValue; +import com.github.steveice10.mc.protocol.data.game.level.notify.RainStrengthValue; +import com.github.steveice10.mc.protocol.data.game.level.notify.RespawnScreenValue; +import com.github.steveice10.mc.protocol.data.game.level.notify.ThunderStrengthValue; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundGameEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -45,11 +45,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.translators.PlayerInventoryTranslator; import org.geysermc.connector.utils.LocaleUtils; -@Translator(packet = ServerNotifyClientPacket.class) -public class JavaNotifyClientTranslator extends PacketTranslator { +@Translator(packet = ClientboundGameEventPacket.class) +public class JavaNotifyClientTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerNotifyClientPacket packet) { + public void translate(GeyserSession session, ClientboundGameEventPacket packet) { PlayerEntity entity = session.getPlayerEntity(); switch (packet.getNotification()) { @@ -126,7 +126,7 @@ public class JavaNotifyClientTranslator extends PacketTranslator { - ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); + ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } case FIRST_TIME -> { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java index f5ae7ff07..49d36ca38 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayBuiltinSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayBuiltinSoundPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; @@ -40,11 +40,11 @@ import org.geysermc.connector.utils.SoundUtils; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; -@Translator(packet = ServerPlayBuiltinSoundPacket.class) -public class JavaPlayBuiltinSoundTranslator extends PacketTranslator { +@Translator(packet = ClientboundSoundPacket.class) +public class JavaPlayBuiltinSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayBuiltinSoundPacket packet) { + public void translate(GeyserSession session, ClientboundSoundPacket packet) { String packetSound = packet.getSound().getName(); SoundMapping soundMapping = Registries.SOUNDS.get(packetSound); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java index 2018fe211..83eefb10b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.effect.*; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket; +import com.github.steveice10.mc.protocol.data.game.level.effect.*; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; @@ -45,11 +45,11 @@ import org.geysermc.connector.utils.LocaleUtils; import java.util.Collections; import java.util.Locale; -@Translator(packet = ServerPlayEffectPacket.class) -public class JavaPlayEffectTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelEventPacket.class) +public class JavaPlayEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlayEffectPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { // Separate case since each RecordEffectData in Java is an individual track in Bedrock if (packet.getEffect() == SoundEffect.RECORD) { RecordEffectData recordEffectData = (RecordEffectData) packet.getData(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java similarity index 84% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java index 1f1ac0d12..0ad48e02c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaPlaySoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.sound.BuiltinSound; -import com.github.steveice10.mc.protocol.data.game.world.sound.CustomSound; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket; +import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; +import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundCustomSoundPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.connector.network.session.GeyserSession; @@ -36,11 +36,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; -@Translator(packet = ServerPlaySoundPacket.class) -public class JavaPlaySoundTranslator extends PacketTranslator { +@Translator(packet = ClientboundCustomSoundPacket.class) +public class JavaPlaySoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerPlaySoundPacket packet) { + public void translate(GeyserSession session, ClientboundCustomSoundPacket packet) { String packetSound; if (packet.getSound() instanceof BuiltinSound) { packetSound = ((BuiltinSound) packet.getSound()).getName(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java index 3efd8e468..961dc7fd1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnParticleTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.world.particle.*; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket; +import com.github.steveice10.mc.protocol.data.game.level.particle.*; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelParticlesPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -46,11 +46,11 @@ import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; -@Translator(packet = ServerSpawnParticlePacket.class) -public class JavaSpawnParticleTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelParticlesPacket.class) +public class JavaSpawnParticleTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnParticlePacket packet) { + public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) { Function particleCreateFunction = createParticle(session, packet.getParticle()); if (particleCreateFunction != null) { if (packet.getAmount() == 0) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java similarity index 84% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java index 16e507440..ae96ada79 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaSpawnPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java @@ -23,22 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; - -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket; -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; import org.geysermc.connector.utils.DimensionUtils; -@Translator(packet = ServerSpawnPositionPacket.class) -public class JavaSpawnPositionTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetDefaultSpawnPositionPacket.class) +public class JavaSpawnPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSpawnPositionPacket packet) { + public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) { SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket(); spawnPositionPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); spawnPositionPacket.setSpawnForced(true); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java similarity index 87% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java index 93241310f..07d6791fd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaStopSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.world.sound.BuiltinSound; -import com.github.steveice10.mc.protocol.data.game.world.sound.CustomSound; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerStopSoundPacket; +import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; +import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -35,11 +35,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; -@Translator(packet = ServerStopSoundPacket.class) -public class JavaStopSoundTranslator extends PacketTranslator { +@Translator(packet = ClientboundStopSoundPacket.class) +public class JavaStopSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerStopSoundPacket packet) { + public void translate(GeyserSession session, ClientboundStopSoundPacket packet) { // Runs if all sounds are stopped if (packet.getSound() == null) { StopSoundPacket stopPacket = new StopSoundPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java similarity index 87% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java index d651eceae..fdc43e758 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUnloadChunkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUnloadChunkPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; import com.nukkitx.math.vector.Vector3i; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.Translator; import java.util.Iterator; -@Translator(packet = ServerUnloadChunkPacket.class) -public class JavaUnloadChunkTranslator extends PacketTranslator { +@Translator(packet = ClientboundForgetLevelChunkPacket.class) +public class JavaUnloadChunkTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUnloadChunkPacket packet) { + public void translate(GeyserSession session, ClientboundForgetLevelChunkPacket packet) { session.getChunkCache().removeChunk(packet.getX(), packet.getZ()); //Checks if a skull is in an unloaded chunk then removes it diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java similarity index 90% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java index 9acceb0a5..2f38dd8e9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTileEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.data.game.world.block.UpdatedTileType; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket; +import com.github.steveice10.mc.protocol.data.game.level.block.UpdatedTileType; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEntityDataPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; @@ -41,11 +41,11 @@ import org.geysermc.connector.network.translators.world.block.entity.RequiresBlo import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; import org.geysermc.connector.utils.BlockEntityUtils; -@Translator(packet = ServerUpdateTileEntityPacket.class) -public class JavaUpdateTileEntityTranslator extends PacketTranslator { +@Translator(packet = ClientboundBlockEntityDataPacket.class) +public class JavaUpdateTileEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateTileEntityPacket packet) { + public void translate(GeyserSession session, ClientboundBlockEntityDataPacket packet) { String id = BlockEntityUtils.getBedrockBlockEntityId(packet.getType().name()); if (packet.getNbt().isEmpty()) { // Fixes errors in servers sending empty NBT BlockEntityUtils.updateBlockEntity(session, NbtMap.EMPTY, packet.getPosition()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java similarity index 85% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java index 3564177e1..e478fb3a5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateTimeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTimePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; import com.nukkitx.protocol.bedrock.packet.SetTimePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerUpdateTimePacket.class) -public class JavaUpdateTimeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetTimePacket.class) +public class JavaUpdateTimeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateTimePacket packet) { + public void translate(GeyserSession session, ClientboundSetTimePacket packet) { // Bedrock sends a GameRulesChangedPacket if there is no daylight cycle // Java just sends a negative long if there is no daylight cycle long time = packet.getTime(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java similarity index 80% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java index 155af39b6..faa6e7867 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewDistanceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java @@ -23,19 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateViewDistancePacket; - -@Translator(packet = ServerUpdateViewDistancePacket.class) -public class JavaUpdateViewDistanceTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetChunkCacheRadiusPacket.class) +public class JavaUpdateViewDistanceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateViewDistancePacket packet) { + public void translate(GeyserSession session, ClientboundSetChunkCacheRadiusPacket packet) { session.setRenderDistance(packet.getViewDistance()); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java similarity index 82% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java index a4ce170bf..ced4545c9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaUpdateViewPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java @@ -23,21 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.level; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.ChunkUtils; - -import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateViewPositionPacket; import com.nukkitx.math.vector.Vector3i; -@Translator(packet = ServerUpdateViewPositionPacket.class) -public class JavaUpdateViewPositionTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetChunkCacheCenterPacket.class) +public class JavaUpdateViewPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerUpdateViewPositionPacket packet) { + public void translate(GeyserSession session, ClientboundSetChunkCacheCenterPacket packet) { if (!session.isSpawned() && session.getLastChunkPosition() == null) { ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4)); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java similarity index 85% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java index 05632cefa..1a3ed5b30 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaInitializeBorderTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerInitializeBorderPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.nukkitx.math.vector.Vector2d; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerInitializeBorderPacket.class) -public class JavaInitializeBorderTranslator extends PacketTranslator { +@Translator(packet = ClientboundInitializeBorderPacket.class) +public class JavaInitializeBorderTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerInitializeBorderPacket packet) { + public void translate(GeyserSession session, ClientboundInitializeBorderPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); worldBorder.setOldDiameter(packet.getOldSize()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java similarity index 82% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java index 3d755fce1..85ad2512e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderCenterTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderCenterPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.nukkitx.math.vector.Vector2d; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderCenterPacket.class) -public class JavaSetBorderCenterTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderCenterPacket.class) +public class JavaSetBorderCenterTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderCenterPacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderCenterPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java similarity index 82% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java index b54a67b31..bfead0466 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderLerpSizeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderLerpSizePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderLerpSizePacket.class) -public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderLerpSizePacket.class) +public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderLerpSizePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderLerpSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getOldSize()); worldBorder.setNewDiameter(packet.getNewSize()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java similarity index 83% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java index 3b90019ad..0de9f339c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderSizeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderSizePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderSizePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderSizePacket.class) -public class JavaSetBorderSizeTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderSizePacket.class) +public class JavaSetBorderSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderSizePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getSize()); worldBorder.setNewDiameter(packet.getSize()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java similarity index 81% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java index b3b718b30..850a7186e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDelayTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderWarningDelayPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDelayPacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderWarningDelayPacket.class) -public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderWarningDelayPacket.class) +public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderWarningDelayPacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderWarningDelayPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningDelay(packet.getWarningDelay()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java similarity index 80% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java index 21d1d9209..33a984357 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/border/JavaSetBorderWarningDistanceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world.border; +package org.geysermc.connector.network.translators.java.level.border; -import com.github.steveice10.mc.protocol.packet.ingame.server.world.border.ServerSetBorderWarningDistancePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDistancePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldBorder; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetBorderWarningDistancePacket.class) -public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetBorderWarningDistancePacket.class) +public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetBorderWarningDistancePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderWarningDistancePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningBlocks(packet.getWarningBlocks()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java index a56e59fe7..27544b94c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerDisplayScoreboardPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.cache.WorldCache; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; -@Translator(packet = ServerDisplayScoreboardPacket.class) -public class JavaDisplayScoreboardTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetDisplayObjectivePacket.class) +public class JavaDisplayScoreboardTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerDisplayScoreboardPacket packet) { + public void translate(GeyserSession session, ClientboundSetDisplayObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java index 09e5df391..ad7069503 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerScoreboardObjectivePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetObjectivePacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.entity.player.PlayerEntity; @@ -41,12 +41,12 @@ import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.scoreboard.UpdateType; -@Translator(packet = ServerScoreboardObjectivePacket.class) -public class JavaScoreboardObjectiveTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetObjectivePacket.class) +public class JavaScoreboardObjectiveTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override - public void translate(GeyserSession session, ServerScoreboardObjectivePacket packet) { + public void translate(GeyserSession session, ClientboundSetObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java index 95ea9be73..5de4abe83 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetPlayerTeamPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserLogger; import org.geysermc.connector.network.session.GeyserSession; @@ -43,12 +43,12 @@ import org.geysermc.connector.scoreboard.UpdateType; import java.util.Arrays; import java.util.Set; -@Translator(packet = ServerTeamPacket.class) -public class JavaTeamTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetPlayerTeamPacket.class) +public class JavaTeamTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override - public void translate(GeyserSession session, ServerTeamPacket packet) { + public void translate(GeyserSession session, ClientboundSetPlayerTeamPacket packet) { if (logger.isDebug()) { logger.debug("Team packet " + packet.getTeamName() + " " + packet.getAction() + " " + Arrays.toString(packet.getPlayers())); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java index 79d625fc7..c4d5b8ec3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; -import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerUpdateScorePacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetScorePacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.connector.GeyserConnector; @@ -42,8 +42,8 @@ import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.utils.LanguageUtils; -@Translator(packet = ServerUpdateScorePacket.class) -public class JavaUpdateScoreTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetScorePacket.class) +public class JavaUpdateScoreTranslator extends PacketTranslator { private final GeyserLogger logger; public JavaUpdateScoreTranslator() { @@ -51,7 +51,7 @@ public class JavaUpdateScoreTranslator extends PacketTranslator { +@Translator(packet = ClientboundClearTitlesPacket.class) +public class JavaClearTitlesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerClearTitlesPacket packet) { + public void translate(GeyserSession session, ClientboundClearTitlesPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); // TODO handle packet.isResetTimes() titlePacket.setType(SetTitlePacket.Type.CLEAR); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java index 516568b37..207599770 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetActionBarTextPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerSetActionBarTextPacket.class) -public class JavaSetActionBarTextTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetActionBarTextPacket.class) +public class JavaSetActionBarTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetActionBarTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetActionBarTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java index ee246ea11..e17debf6b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetSubtitleTextPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetSubtitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerSetSubtitleTextPacket.class) -public class JavaSetSubtitleTextTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetSubtitleTextPacket.class) +public class JavaSetSubtitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetSubtitleTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetSubtitleTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java index ddaa5b677..fb335fc76 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java @@ -25,18 +25,18 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetTitleTextPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; -@Translator(packet = ServerSetTitleTextPacket.class) -public class JavaSetTitleTextTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetTitleTextPacket.class) +public class JavaSetTitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetTitleTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetTitleTextPacket packet) { String text; if (packet.getText() == null) { // This can happen, see https://github.com/KyoriPowered/adventure/issues/447 text = " "; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java index 7514eef4c..20dcc9b3c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.title; -import com.github.steveice10.mc.protocol.packet.ingame.server.title.ServerSetTitlesAnimationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitlesAnimationPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -@Translator(packet = ServerSetTitlesAnimationPacket.class) -public class JavaSetTitlesAnimationTranslator extends PacketTranslator { +@Translator(packet = ClientboundSetTitlesAnimationPacket.class) +public class JavaSetTitlesAnimationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetTitlesAnimationPacket packet) { + public void translate(GeyserSession session, ClientboundSetTitlesAnimationPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.TIMES); titlePacket.setText(""); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java index 419f4fc50..096e90684 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java @@ -25,17 +25,17 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerCloseWindowPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerClosePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.InventoryUtils; -@Translator(packet = ServerCloseWindowPacket.class) -public class JavaCloseWindowTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerClosePacket.class) +public class JavaCloseWindowTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerCloseWindowPacket packet) { + public void translate(GeyserSession session, ClientboundContainerClosePacket packet) { // Sometimes the server can request a window close of ID 0... when the window isn't even open // Don't confirm in this instance InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java index ecd74332b..aea462509 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenHorseWindowPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundHorseScreenOpenPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; @@ -49,8 +49,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -@Translator(packet = ServerOpenHorseWindowPacket.class) -public class JavaOpenHorseWindowTranslator extends PacketTranslator { +@Translator(packet = ClientboundHorseScreenOpenPacket.class) +public class JavaOpenHorseWindowTranslator extends PacketTranslator { private static final NbtMap ARMOR_SLOT; private static final NbtMap CARPET_SLOT; @@ -98,7 +98,7 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator { +@Translator(packet = ClientboundOpenScreenPacket.class) +public class JavaOpenWindowTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerOpenWindowPacket packet) { + public void translate(GeyserSession session, ClientboundOpenScreenPacket packet) { if (packet.getWindowId() == 0) { return; } InventoryTranslator newTranslator = InventoryTranslator.INVENTORY_TRANSLATORS.get(packet.getType()); Inventory openInventory = session.getOpenInventory(); - //No translator exists for this window type. Close all windows and return. + // No translator exists for this window type. Close all windows and return. if (newTranslator == null) { if (openInventory != null) { InventoryUtils.closeInventory(session, openInventory.getId(), true); } - ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(packet.getWindowId()); + ServerboundContainerClosePacket closeWindowPacket = new ServerboundContainerClosePacket(packet.getWindowId()); session.sendDownstreamPacket(closeWindowPacket); return; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java index 27f932c98..388d19984 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData; import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetSlotPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; @@ -54,11 +54,11 @@ import java.util.Objects; import java.util.UUID; import java.util.concurrent.TimeUnit; -@Translator(packet = ServerSetSlotPacket.class) -public class JavaSetSlotTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerSetSlotPacket.class) +public class JavaSetSlotTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSetSlotPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetSlotPacket packet) { if (packet.getWindowId() == 255) { //cursor GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); session.getPlayerInventory().setCursor(newItem, session); @@ -92,7 +92,7 @@ public class JavaSetSlotTranslator extends PacketTranslator } } - private static void updateCraftingGrid(GeyserSession session, ServerSetSlotPacket packet, Inventory inventory, InventoryTranslator translator) { + private static void updateCraftingGrid(GeyserSession session, ClientboundContainerSetSlotPacket packet, Inventory inventory, InventoryTranslator translator) { if (packet.getSlot() == 0) { int gridSize; if (translator instanceof PlayerInventoryTranslator) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java index 556f8b95d..546c1ddfc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaTradeListTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.world; +package org.geysermc.connector.network.translators.java.window; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerTradeListPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundMerchantOffersPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; @@ -47,11 +47,11 @@ import org.geysermc.connector.registry.type.ItemMapping; import java.util.ArrayList; import java.util.List; -@Translator(packet = ServerTradeListPacket.class) -public class JavaTradeListTranslator extends PacketTranslator { +@Translator(packet = ClientboundMerchantOffersPacket.class) +public class JavaTradeListTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerTradeListPacket packet) { + public void translate(GeyserSession session, ClientboundMerchantOffersPacket packet) { Inventory openInventory = session.getOpenInventory(); if (!(openInventory instanceof MerchantContainer merchantInventory && openInventory.getId() == packet.getWindowId())) { return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java index 542001dfb..589f0f6bb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowItemsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetContentPacket; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; @@ -34,11 +34,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; -@Translator(packet = ServerWindowItemsPacket.class) -public class JavaWindowItemsTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerSetContentPacket.class) +public class JavaWindowItemsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerWindowItemsPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetContentPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java index 512c797d2..7ce45b086 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.window; -import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerWindowPropertyPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetDataPacket; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -33,11 +33,11 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; -@Translator(packet = ServerWindowPropertyPacket.class) -public class JavaWindowPropertyTranslator extends PacketTranslator { +@Translator(packet = ClientboundContainerSetDataPacket.class) +public class JavaWindowPropertyTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerWindowPropertyPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetDataPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId()); if (inventory == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java index b797232dc..52d9c9b4a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.world; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; @@ -82,7 +82,7 @@ public class GeyserWorldManager extends WorldManager { @Override public void setGameRule(GeyserSession session, String name, Object value) { - session.sendDownstreamPacket(new ClientChatPacket("/gamerule " + name + " " + value)); + session.sendDownstreamPacket(new ServerboundChatPacket("/gamerule " + name + " " + value)); gameruleCache.put(name, String.valueOf(value)); } @@ -108,12 +108,12 @@ public class GeyserWorldManager extends WorldManager { @Override public void setPlayerGameMode(GeyserSession session, GameMode gameMode) { - session.sendDownstreamPacket(new ClientChatPacket("/gamemode " + gameMode.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase())); } @Override public void setDifficulty(GeyserSession session, Difficulty difficulty) { - session.sendDownstreamPacket(new ClientChatPacket("/difficulty " + difficulty.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase())); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java index b255fa5d7..f698d43f2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.world.block.entity; -import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValueType; +import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 3447bdfc8..7487d5723 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -27,8 +27,8 @@ package org.geysermc.connector.registry; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; -import com.github.steveice10.mc.protocol.data.game.world.effect.SoundEffect; -import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; +import com.github.steveice10.mc.protocol.data.game.level.effect.SoundEffect; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java index 4284506f9..9de4b946f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java @@ -26,7 +26,7 @@ package org.geysermc.connector.registry.loader; import com.fasterxml.jackson.databind.JsonNode; -import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.protocol.bedrock.data.LevelEventType; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.connector.registry.type.ParticleMapping; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java index 4e44ac095..93f1e3fc4 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEffectsRegistryLoader.java @@ -26,7 +26,7 @@ package org.geysermc.connector.registry.loader; import com.fasterxml.jackson.databind.JsonNode; -import com.github.steveice10.mc.protocol.data.game.world.effect.SoundEffect; +import com.github.steveice10.mc.protocol.data.game.level.effect.SoundEffect; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; diff --git a/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java b/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java index 95e0f809d..8b9a5dca3 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.world.map.MapIconType; +import com.github.steveice10.mc.protocol.data.game.level.map.MapIconType; import lombok.Getter; public enum BedrockMapIcon { diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index 723d0bd99..86b40093e 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -196,7 +196,7 @@ public class BlockUtils { /** * Given a position, return the position if a block were located on the specified block face. * @param blockPos the block position - * @param face the face of the block - see {@link com.github.steveice10.mc.protocol.data.game.world.block.BlockFace} + * @param face the face of the block - see {@link com.github.steveice10.mc.protocol.data.game.level.block.BlockFace} * @return the block position with the block face accounted for */ public static Vector3i getBlockPosition(Vector3i blockPos, int face) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java index 632e17280..a1668acf0 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java @@ -119,8 +119,8 @@ public class DimensionUtils { } /** - * Determines the new dimension based on the {@link CompoundTag} sent by either the {@link com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket} - * or {@link com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket}. + * Determines the new dimension based on the {@link CompoundTag} sent by either the {@link com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket} + * or {@link com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket}. * * @param dimensionTag the packet's dimension tag. * @return the dimension identifier. diff --git a/connector/src/main/java/org/geysermc/connector/utils/Direction.java b/connector/src/main/java/org/geysermc/connector/utils/Direction.java index 7cde4a0ac..5a6bea349 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/Direction.java +++ b/connector/src/main/java/org/geysermc/connector/utils/Direction.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.world.block.value.PistonValue; +import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue; import com.nukkitx.math.vector.Vector3i; import lombok.Getter; diff --git a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java index b79476e9c..692b26d85 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.world.particle.ParticleType; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.protocol.bedrock.data.LevelEventType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.Registries; diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java index d5978a7f5..3d61d428a 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java @@ -27,8 +27,8 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientMoveItemToHotbarPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundPickItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCreativeModeSlotPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; @@ -210,7 +210,7 @@ public class InventoryUtils { } // If this is the item we're looking for if (geyserItem.getJavaId() == itemStack.getId() && Objects.equals(geyserItem.getNbt(), itemStack.getNbt())) { - ClientMoveItemToHotbarPacket packetToSend = new ClientMoveItemToHotbarPacket(i); // https://wiki.vg/Protocol#Pick_Item + ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item session.sendDownstreamPacket(packetToSend); return; } @@ -220,7 +220,7 @@ public class InventoryUtils { if (session.getGameMode() == GameMode.CREATIVE) { int slot = findEmptyHotbarSlot(inventory); - ClientCreativeInventoryActionPacket actionPacket = new ClientCreativeInventoryActionPacket(slot, + ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket(slot, itemStack); if ((slot - 36) != inventory.getHeldItemSlot()) { setHotbarItem(session, slot); @@ -275,7 +275,7 @@ public class InventoryUtils { continue; } - ClientMoveItemToHotbarPacket packetToSend = new ClientMoveItemToHotbarPacket(i); // https://wiki.vg/Protocol#Pick_Item + ServerboundPickItemPacket packetToSend = new ServerboundPickItemPacket(i); // https://wiki.vg/Protocol#Pick_Item session.sendDownstreamPacket(packetToSend); return; } @@ -286,7 +286,7 @@ public class InventoryUtils { ItemMapping mapping = session.getItemMappings().getMapping(itemName); if (mapping != null) { - ClientCreativeInventoryActionPacket actionPacket = new ClientCreativeInventoryActionPacket(slot, + ServerboundSetCreativeModeSlotPacket actionPacket = new ServerboundSetCreativeModeSlotPacket(slot, new ItemStack(mapping.getJavaId())); if ((slot - 36) != inventory.getHeldItemSlot()) { setHotbarItem(session, slot); diff --git a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java b/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java index a914f699e..686dadd17 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java @@ -25,7 +25,7 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; @@ -74,7 +74,7 @@ public class PluginMessageUtils { } public static void sendMessage(GeyserSession session, String channel, byte[] data) { - session.sendDownstreamPacket(new ClientPluginMessagePacket(channel, data)); + session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, data)); } private static byte[] writeVarInt(int value) { From 84ae28f2c21c737b575bc7f11dd4f4e226e70877 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 12 Nov 2021 23:01:45 -0500 Subject: [PATCH 673/766] Update translator class names to match Mojang mappings --- .../main/java/org/geysermc/connector/entity/Entity.java | 8 ++++---- .../translators/MerchantInventoryTranslator.java | 2 +- ...sticsTranslator.java => JavaAwardStatsTranslator.java} | 2 +- ...ossBarTranslator.java => JavaBossEventTranslator.java} | 3 ++- ...ranslator.java => JavaChangeDifficultyTranslator.java} | 2 +- ...ommandsTranslator.java => JavaCommandsTranslator.java} | 2 +- ...geTranslator.java => JavaCustomPayloadTranslator.java} | 2 +- ...uestTranslator.java => JavaCustomQueryTranslator.java} | 5 ++++- ...isconnectPacket.java => JavaDisconnectTranslator.java} | 2 +- ...vaJoinGameTranslator.java => JavaLoginTranslator.java} | 2 +- ...ator.java => JavaSelectAdvancementsTabTranslator.java} | 2 +- ...nslator.java => JavaUpdateAdvancementsTranslator.java} | 2 +- ...esTranslator.java => JavaUpdateRecipesTranslator.java} | 2 +- ...eTagsTranslator.java => JavaUpdateTagsTranslator.java} | 2 +- ...nimationTranslator.java => JavaAnimateTranslator.java} | 2 +- ...atusTranslator.java => JavaEntityEventTranslator.java} | 2 +- ...ranslator.java => JavaMoveEntityPosRotTranslator.java} | 2 +- ...onTranslator.java => JavaMoveEntityPosTranslator.java} | 2 +- ...onTranslator.java => JavaMoveEntityRotTranslator.java} | 2 +- ...Translator.java => JavaRemoveMobEffectTranslator.java} | 2 +- ...dLookTranslator.java => JavaRotateHeadTranslator.java} | 2 +- ...taTranslator.java => JavaSetEntityDataTranslator.java} | 2 +- ...chTranslator.java => JavaSetEntityLinkTranslator.java} | 2 +- ...Translator.java => JavaSetEntityMotionTranslator.java} | 6 ++++-- ...entTranslator.java => JavaSetEquipmentTranslator.java} | 2 +- ...rsTranslator.java => JavaSetPassengersTranslator.java} | 2 +- ...mTranslator.java => JavaTakeItemEntityTranslator.java} | 2 +- ...tTranslator.java => JavaTeleportEntityTranslator.java} | 2 +- ...ranslator.java => JavaUpdateAttributesTranslator.java} | 2 +- ...Translator.java => JavaUpdateMobEffectTranslator.java} | 2 +- ...ckTranslator.java => JavaBlockBreakAckTranslator.java} | 2 +- ...EntryTranslator.java => JavaPlayerInfoTranslator.java} | 2 +- ...nTranslator.java => JavaPlayerPositionTranslator.java} | 2 +- ...mTranslator.java => JavaSetCarriedItemTranslator.java} | 2 +- ...ceTranslator.java => JavaSetExperienceTranslator.java} | 2 +- ...HealthTranslator.java => JavaSetHealthTranslator.java} | 2 +- ...EntityTranslator.java => JavaAddEntityTranslator.java} | 2 +- ...ranslator.java => JavaAddExperienceOrbTranslator.java} | 2 +- ...ingEntityTranslator.java => JavaAddMobTranslator.java} | 2 +- ...tingTranslator.java => JavaAddPaintingTranslator.java} | 2 +- ...PlayerTranslator.java => JavaAddPlayerTranslator.java} | 2 +- ...ranslator.java => JavaBlockDestructionTranslator.java} | 2 +- ...Translator.java => JavaBlockEntityDataTranslator.java} | 2 +- ...ValueTranslator.java => JavaBlockEventTranslator.java} | 2 +- ...angeTranslator.java => JavaBlockUpdateTranslator.java} | 2 +- ...oundTranslator.java => JavaCustomSoundTranslator.java} | 2 +- ...xplosionTranslator.java => JavaExplodeTranslator.java} | 2 +- ...ranslator.java => JavaForgetLevelChunkTranslator.java} | 2 +- ...ClientTranslator.java => JavaGameEventTranslator.java} | 2 +- ...kDataTranslator.java => JavaLevelChunkTranslator.java} | 2 +- ...ffectTranslator.java => JavaLevelEventTranslator.java} | 2 +- ...eTranslator.java => JavaLevelParticlesTranslator.java} | 2 +- ...DataTranslator.java => JavaMapItemDataTranslator.java} | 3 ++- ...slator.java => JavaSectionBlocksUpdateTranslator.java} | 2 +- ...slator.java => JavaSetChunkCacheCenterTranslator.java} | 2 +- ...slator.java => JavaSetChunkCacheRadiusTranslator.java} | 2 +- ...or.java => JavaSetDefaultSpawnPositionTranslator.java} | 2 +- ...dateTimeTranslator.java => JavaSetTimeTranslator.java} | 2 +- ...iltinSoundTranslator.java => JavaSoundTranslator.java} | 2 +- ...slator.java => JavaSetDisplayObjectiveTranslator.java} | 2 +- ...iveTranslator.java => JavaSetObjectiveTranslator.java} | 2 +- ...amTranslator.java => JavaSetPlayerTeamTranslator.java} | 2 +- ...teScoreTranslator.java => JavaSetScoreTranslator.java} | 4 ++-- ...wTranslator.java => JavaContainerCloseTranslator.java} | 2 +- ...slator.java => JavaContainerSetContentTranslator.java} | 2 +- ...ranslator.java => JavaContainerSetDataTranslator.java} | 2 +- ...ranslator.java => JavaContainerSetSlotTranslator.java} | 2 +- ...Translator.java => JavaHorseScreenOpenTranslator.java} | 2 +- ...tTranslator.java => JavaMerchantOffersTranslator.java} | 2 +- ...indowTranslator.java => JavaOpenScreenTranslator.java} | 2 +- 70 files changed, 82 insertions(+), 75 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaStatisticsTranslator.java => JavaAwardStatsTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaBossBarTranslator.java => JavaBossEventTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaDifficultyTranslator.java => JavaChangeDifficultyTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaDeclareCommandsTranslator.java => JavaCommandsTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaPluginMessageTranslator.java => JavaCustomPayloadTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaLoginPluginRequestTranslator.java => JavaCustomQueryTranslator.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaDisconnectPacket.java => JavaDisconnectTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaJoinGameTranslator.java => JavaLoginTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaAdvancementsTabTranslator.java => JavaSelectAdvancementsTabTranslator.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaAdvancementsTranslator.java => JavaUpdateAdvancementsTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaDeclareRecipesTranslator.java => JavaUpdateRecipesTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaDeclareTagsTranslator.java => JavaUpdateTagsTranslator.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityAnimationTranslator.java => JavaAnimateTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityStatusTranslator.java => JavaEntityEventTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityPositionRotationTranslator.java => JavaMoveEntityPosRotTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityPositionTranslator.java => JavaMoveEntityPosTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityRotationTranslator.java => JavaMoveEntityRotTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityRemoveEffectTranslator.java => JavaRemoveMobEffectTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityHeadLookTranslator.java => JavaRotateHeadTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityMetadataTranslator.java => JavaSetEntityDataTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityAttachTranslator.java => JavaSetEntityLinkTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityVelocityTranslator.java => JavaSetEntityMotionTranslator.java} (93%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityEquipmentTranslator.java => JavaSetEquipmentTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntitySetPassengersTranslator.java => JavaSetPassengersTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityCollectItemTranslator.java => JavaTakeItemEntityTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityTeleportTranslator.java => JavaTeleportEntityTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityPropertiesTranslator.java => JavaUpdateAttributesTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/{JavaEntityEffectTranslator.java => JavaUpdateMobEffectTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/{JavaPlayerActionAckTranslator.java => JavaBlockBreakAckTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/{JavaPlayerListEntryTranslator.java => JavaPlayerInfoTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/{JavaPlayerPositionRotationTranslator.java => JavaPlayerPositionTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/{JavaPlayerChangeHeldItemTranslator.java => JavaSetCarriedItemTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/{JavaPlayerSetExperienceTranslator.java => JavaSetExperienceTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/{JavaPlayerHealthTranslator.java => JavaSetHealthTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/{JavaSpawnEntityTranslator.java => JavaAddEntityTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/{JavaSpawnExpOrbTranslator.java => JavaAddExperienceOrbTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/{JavaSpawnLivingEntityTranslator.java => JavaAddMobTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/{JavaSpawnPaintingTranslator.java => JavaAddPaintingTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/{JavaSpawnPlayerTranslator.java => JavaAddPlayerTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaBlockBreakAnimTranslator.java => JavaBlockDestructionTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaUpdateTileEntityTranslator.java => JavaBlockEntityDataTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaBlockValueTranslator.java => JavaBlockEventTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaBlockChangeTranslator.java => JavaBlockUpdateTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaPlaySoundTranslator.java => JavaCustomSoundTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaExplosionTranslator.java => JavaExplodeTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaUnloadChunkTranslator.java => JavaForgetLevelChunkTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaNotifyClientTranslator.java => JavaGameEventTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaChunkDataTranslator.java => JavaLevelChunkTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaPlayEffectTranslator.java => JavaLevelEventTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaSpawnParticleTranslator.java => JavaLevelParticlesTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaMapDataTranslator.java => JavaMapItemDataTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaMultiBlockChangeTranslator.java => JavaSectionBlocksUpdateTranslator.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaUpdateViewPositionTranslator.java => JavaSetChunkCacheCenterTranslator.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaUpdateViewDistanceTranslator.java => JavaSetChunkCacheRadiusTranslator.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaSpawnPositionTranslator.java => JavaSetDefaultSpawnPositionTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaUpdateTimeTranslator.java => JavaSetTimeTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaPlayBuiltinSoundTranslator.java => JavaSoundTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/{JavaDisplayScoreboardTranslator.java => JavaSetDisplayObjectiveTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/{JavaScoreboardObjectiveTranslator.java => JavaSetObjectiveTranslator.java} (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/{JavaTeamTranslator.java => JavaSetPlayerTeamTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/{JavaUpdateScoreTranslator.java => JavaSetScoreTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaCloseWindowTranslator.java => JavaContainerCloseTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaWindowItemsTranslator.java => JavaContainerSetContentTranslator.java} (96%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaWindowPropertyTranslator.java => JavaContainerSetDataTranslator.java} (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaSetSlotTranslator.java => JavaContainerSetSlotTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaOpenHorseWindowTranslator.java => JavaHorseScreenOpenTranslator.java} (99%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaTradeListTranslator.java => JavaMerchantOffersTranslator.java} (98%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/window/{JavaOpenWindowTranslator.java => JavaOpenScreenTranslator.java} (98%) diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index fe0077d5d..a965b35da 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -186,7 +186,7 @@ public class Entity { } /** - * Teleports an entity to a new location. Used in JavaEntityTeleportTranslator. + * Teleports an entity to a new location. Used in JavaTeleportEntityTranslator. * @param session GeyserSession. * @param position The new position of the entity. * @param yaw The new yaw of the entity. @@ -198,7 +198,7 @@ public class Entity { } /** - * Updates an entity's head position. Used in JavaEntityHeadLookTranslator. + * Updates an entity's head position. Used in JavaRotateHeadTranslator. * @param session GeyserSession. * @param headYaw The new head rotation of the entity. */ @@ -207,7 +207,7 @@ public class Entity { } /** - * Updates an entity's position and rotation. Used in JavaEntityPositionRotationTranslator. + * Updates an entity's position and rotation. Used in JavaMoveEntityPosRotTranslator. * @param session GeyserSession * @param moveX The new X offset of the current position. * @param moveY The new Y offset of the current position. @@ -221,7 +221,7 @@ public class Entity { } /** - * Updates an entity's rotation. Used in JavaEntityRotationTranslator. + * Updates an entity's rotation. Used in JavaMoveEntityRotTranslator. * @param session GeyserSession. * @param yaw The new yaw of the entity. * @param pitch The new pitch of the entity. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java index 63531ba8a..ef6e30494 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java @@ -119,7 +119,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { @Override public void openInventory(GeyserSession session, Inventory inventory) { - //Handled in JavaTradeListTranslator + //Handled in JavaMerchantOffersTranslator //TODO: send a blank inventory here in case the villager doesn't send a TradeList packet } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java index 69a82efe0..141079755 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaStatisticsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.StatisticsUtils; @Translator(packet = ClientboundAwardStatsPacket.class) -public class JavaStatisticsTranslator extends PacketTranslator { +public class JavaAwardStatsTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAwardStatsPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java index 889e31e4d..eae326538 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossBarTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java @@ -33,7 +33,8 @@ import org.geysermc.connector.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBossEventPacket; @Translator(packet = ClientboundBossEventPacket.class) -public class JavaBossBarTranslator extends PacketTranslator { +public class JavaBossEventTranslator extends PacketTranslator { + @Override public void translate(GeyserSession session, ClientboundBossEventPacket packet) { BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java index 56c32ca95..37660ef99 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDifficultyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.Translator; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; @Translator(packet = ClientboundChangeDifficultyPacket.class) -public class JavaDifficultyTranslator extends PacketTranslator { +public class JavaChangeDifficultyTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundChangeDifficultyPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java index 61e8be4a5..ddc05b62f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java @@ -54,7 +54,7 @@ import org.geysermc.connector.utils.EntityUtils; import java.util.*; @Translator(packet = ClientboundCommandsPacket.class) -public class JavaDeclareCommandsTranslator extends PacketTranslator { +public class JavaCommandsTranslator extends PacketTranslator { private static final String[] ALL_EFFECT_IDENTIFIERS = EntityUtils.getAllEffectIdentifiers(); private static final String[] ENUM_BOOLEAN = {"true", "false"}; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java index 2b5926b2c..b0989f674 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.cumulus.util.FormType; import java.nio.charset.StandardCharsets; @Translator(packet = ClientboundCustomPayloadPacket.class) -public class JavaPluginMessageTranslator extends PacketTranslator { +public class JavaCustomPayloadTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java index 9f734acc4..69567957c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginPluginRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java @@ -31,8 +31,11 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +/** + * For the login cycle. + */ @Translator(packet = ClientboundCustomQueryPacket.class) -public class JavaLoginPluginRequestTranslator extends PacketTranslator { +public class JavaCustomQueryTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundCustomQueryPacket packet) { // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java index 72a9646fe..58493b14d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.chat.MessageTranslator; @Translator(packet = ClientboundDisconnectPacket.class) -public class JavaDisconnectPacket extends PacketTranslator { +public class JavaDisconnectTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundDisconnectPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java index 932b205a0..dc4678ae2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaJoinGameTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java @@ -48,7 +48,7 @@ import java.util.Arrays; import java.util.List; @Translator(packet = ClientboundLoginPacket.class) -public class JavaJoinGameTranslator extends PacketTranslator { +public class JavaLoginTranslator extends PacketTranslator { private static final List SKIN_PART_VALUES = Arrays.asList(SkinPart.values()); @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java index f9659f038..16e5f9de9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTabTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.Translator; * Indicates that the client should open a particular advancement tab */ @Translator(packet = ClientboundSelectAdvancementsTabPacket.class) -public class JavaAdvancementsTabTranslator extends PacketTranslator { +public class JavaSelectAdvancementsTabTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSelectAdvancementsTabPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java index 46aac1212..cd1a5dbec 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAdvancementsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.utils.LocaleUtils; import java.util.Map; @Translator(packet = ClientboundUpdateAdvancementsPacket.class) -public class JavaAdvancementsTranslator extends PacketTranslator { +public class JavaUpdateAdvancementsTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundUpdateAdvancementsPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java index b0dff45de..9306453bc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java @@ -59,7 +59,7 @@ import static org.geysermc.connector.utils.InventoryUtils.LAST_RECIPE_NET_ID; * Bedrock REQUIRES a CraftingDataPacket to be sent in order to craft anything. */ @Translator(packet = ClientboundUpdateRecipesPacket.class) -public class JavaDeclareRecipesTranslator extends PacketTranslator { +public class JavaUpdateRecipesTranslator extends PacketTranslator { /** * Required to use the specified cartography table recipes */ diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java index a6c532919..4330b2e91 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareTagsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java @@ -31,7 +31,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundUpdateTagsPacket.class) -public class JavaDeclareTagsTranslator extends PacketTranslator { +public class JavaUpdateTagsTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java index 95a1628df..11fec73b3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAnimationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.DimensionUtils; @Translator(packet = ClientboundAnimatePacket.class) -public class JavaEntityAnimationTranslator extends PacketTranslator { +public class JavaAnimateTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAnimatePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java index 1c943ce8b..9774b2456 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityStatusTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.network.translators.Translator; import java.util.concurrent.ThreadLocalRandom; @Translator(packet = ClientboundEntityEventPacket.class) -public class JavaEntityStatusTranslator extends PacketTranslator { +public class JavaEntityEventTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundEntityEventPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java index 419010a2f..ec9fde618 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundMoveEntityPosRotPacket.class) -public class JavaEntityPositionRotationTranslator extends PacketTranslator { +public class JavaMoveEntityPosRotTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundMoveEntityPosRotPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java index f43afbe9b..e21476a6c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundMoveEntityPosPacket.class) -public class JavaEntityPositionTranslator extends PacketTranslator { +public class JavaMoveEntityPosTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundMoveEntityPosPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java index 846914ebe..36bd6741e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundMoveEntityRotPacket.class) -public class JavaEntityRotationTranslator extends PacketTranslator { +public class JavaMoveEntityRotTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundMoveEntityRotPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java index efb1ed75b..057af9667 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityRemoveEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.EntityUtils; @Translator(packet = ClientboundRemoveMobEffectPacket.class) -public class JavaEntityRemoveEffectTranslator extends PacketTranslator { +public class JavaRemoveMobEffectTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundRemoveMobEffectPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java index 97a4f16d5..3ad40abd0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityHeadLookTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundRotateHeadPacket.class) -public class JavaEntityHeadLookTranslator extends PacketTranslator { +public class JavaRotateHeadTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundRotateHeadPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java index d55a4e747..1172509b9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityMetadataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.utils.InteractiveTagManager; import org.geysermc.connector.utils.LanguageUtils; @Translator(packet = ClientboundSetEntityDataPacket.class) -public class JavaEntityMetadataTranslator extends PacketTranslator { +public class JavaSetEntityDataTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetEntityDataPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java index 672a2d15b..0fd9b0c64 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityAttachTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.network.translators.Translator; * Called when a leash is attached, removed or updated from an entity */ @Translator(packet = ClientboundSetEntityLinkPacket.class) -public class JavaEntityAttachTranslator extends PacketTranslator { +public class JavaSetEntityLinkTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetEntityLinkPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java index c563b84d7..3ec366825 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityVelocityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java @@ -37,13 +37,15 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; @Translator(packet = ClientboundSetEntityMotionPacket.class) -public class JavaEntityVelocityTranslator extends PacketTranslator { +public class JavaSetEntityMotionTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetEntityMotionPacket packet) { - Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); + Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); } if (entity == null) return; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java index 3df6df2b0..2b5cceb37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.item.ItemTranslator; @Translator(packet = ClientboundSetEquipmentPacket.class) -public class JavaEntityEquipmentTranslator extends PacketTranslator { +public class JavaSetEquipmentTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetEquipmentPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java index 081f59f37..dc6553492 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntitySetPassengersTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.connector.utils.EntityUtils; import java.util.Arrays; @Translator(packet = ClientboundSetPassengersPacket.class) -public class JavaEntitySetPassengersTranslator extends PacketTranslator { +public class JavaSetPassengersTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetPassengersPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java index 8bc497b8d..b56414c47 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityCollectItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java @@ -41,7 +41,7 @@ import org.geysermc.connector.network.translators.Translator; * Bedrock uses it for arrows and item entities, but not experience orbs. */ @Translator(packet = ClientboundTakeItemEntityPacket.class) -public class JavaEntityCollectItemTranslator extends PacketTranslator { +public class JavaTakeItemEntityTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundTakeItemEntityPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java index bbc852cfe..8fbd234a9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityTeleportTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java @@ -33,7 +33,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundTeleportEntityPacket.class) -public class JavaEntityTeleportTranslator extends PacketTranslator { +public class JavaTeleportEntityTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundTeleportEntityPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java index 9f00a1832..84946c208 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityPropertiesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java @@ -33,7 +33,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundUpdateAttributesPacket.class) -public class JavaEntityPropertiesTranslator extends PacketTranslator { +public class JavaUpdateAttributesTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundUpdateAttributesPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java index 3e8c056cb..f8c276896 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.EntityUtils; @Translator(packet = ClientboundUpdateMobEffectPacket.class) -public class JavaEntityEffectTranslator extends PacketTranslator { +public class JavaUpdateMobEffectTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundUpdateMobEffectPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java index 1037bcb85..c2941a5ae 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerActionAckTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.ChunkUtils; @Translator(packet = ClientboundBlockBreakAckPacket.class) -public class JavaPlayerActionAckTranslator extends PacketTranslator { +public class JavaBlockBreakAckTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundBlockBreakAckPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java index 0ce643971..587481c18 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerListEntryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.skin.SkinManager; @Translator(packet = ClientboundPlayerInfoPacket.class) -public class JavaPlayerListEntryTranslator extends PacketTranslator { +public class JavaPlayerInfoTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundPlayerInfoPacket packet) { if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java index 95e6f1f8e..1c3866adf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionRotationTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java @@ -47,7 +47,7 @@ import org.geysermc.connector.utils.EntityUtils; import org.geysermc.connector.utils.LanguageUtils; @Translator(packet = ClientboundPlayerPositionPacket.class) -public class JavaPlayerPositionRotationTranslator extends PacketTranslator { +public class JavaPlayerPositionTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundPlayerPositionPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java index 184aabfad..c36a21dec 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerChangeHeldItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundSetCarriedItemPacket.class) -public class JavaPlayerChangeHeldItemTranslator extends PacketTranslator { +public class JavaSetCarriedItemTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetCarriedItemPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java index b90c5b7f3..61427b3b2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerSetExperienceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.Translator; import java.util.Arrays; @Translator(packet = ClientboundSetExperiencePacket.class) -public class JavaPlayerSetExperienceTranslator extends PacketTranslator { +public class JavaSetExperienceTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetExperiencePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java index 79a9e61e1..11e8ab21b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerHealthTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.network.translators.Translator; import java.util.List; @Translator(packet = ClientboundSetHealthPacket.class) -public class JavaPlayerHealthTranslator extends PacketTranslator { +public class JavaSetHealthTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetHealthPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java index dc5c7b459..fb22e2cc2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java @@ -43,7 +43,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @Translator(packet = ClientboundAddEntityPacket.class) -public class JavaSpawnEntityTranslator extends PacketTranslator { +public class JavaAddEntityTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java index 56cf457da..263170f95 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnExpOrbTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundAddExperienceOrbPacket.class) -public class JavaSpawnExpOrbTranslator extends PacketTranslator { +public class JavaAddExperienceOrbTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAddExperienceOrbPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java index b6414b2ac..f1fe12c26 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnLivingEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java @@ -39,7 +39,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @Translator(packet = ClientboundAddMobPacket.class) -public class JavaSpawnLivingEntityTranslator extends PacketTranslator { +public class JavaAddMobTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAddMobPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java index 595b77d33..790e79ecf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPaintingTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.PaintingType; @Translator(packet = ClientboundAddPaintingPacket.class) -public class JavaSpawnPaintingTranslator extends PacketTranslator { +public class JavaAddPaintingTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAddPaintingPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java index d574da825..0cf689f77 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaSpawnPlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.skin.SkinManager; @Translator(packet = ClientboundAddPlayerPacket.class) -public class JavaSpawnPlayerTranslator extends PacketTranslator { +public class JavaAddPlayerTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAddPlayerPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java index 1e64eb565..3b0e4d891 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockBreakAnimTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.utils.BlockUtils; @Translator(packet = ClientboundBlockDestructionPacket.class) -public class JavaBlockBreakAnimTranslator extends PacketTranslator { +public class JavaBlockDestructionTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundBlockDestructionPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java index 2f38dd8e9..5ef32f151 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTileEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.network.translators.world.block.entity.SkullBlockE import org.geysermc.connector.utils.BlockEntityUtils; @Translator(packet = ClientboundBlockEntityDataPacket.class) -public class JavaUpdateTileEntityTranslator extends PacketTranslator { +public class JavaBlockEntityDataTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundBlockEntityDataPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockValueTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockValueTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java index 3b103c5ed..ec19e67db 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockValueTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java @@ -45,7 +45,7 @@ import org.geysermc.connector.network.translators.world.block.entity.PistonBlock import org.geysermc.connector.utils.Direction; @Translator(packet = ClientboundBlockEventPacket.class) -public class JavaBlockValueTranslator extends PacketTranslator { +public class JavaBlockEventTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundBlockEventPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java index 8ed714710..67174434a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.ChunkUtils; @Translator(packet = ClientboundBlockUpdatePacket.class) -public class JavaBlockChangeTranslator extends PacketTranslator { +public class JavaBlockUpdateTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundBlockUpdatePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java index 0ad48e02c..34f685b22 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlaySoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; @Translator(packet = ClientboundCustomSoundPacket.class) -public class JavaPlaySoundTranslator extends PacketTranslator { +public class JavaCustomSoundTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundCustomSoundPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java index c8af1d1d7..f8a2bc286 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplosionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java @@ -41,7 +41,7 @@ import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.utils.ChunkUtils; @Translator(packet = ClientboundExplodePacket.class) -public class JavaExplosionTranslator extends PacketTranslator { +public class JavaExplodeTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundExplodePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java index fdc43e758..696ec3d92 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUnloadChunkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; import java.util.Iterator; @Translator(packet = ClientboundForgetLevelChunkPacket.class) -public class JavaUnloadChunkTranslator extends PacketTranslator { +public class JavaForgetLevelChunkTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundForgetLevelChunkPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java index 3b9948530..f9eca2e74 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java @@ -46,7 +46,7 @@ import org.geysermc.connector.network.translators.inventory.translators.PlayerIn import org.geysermc.connector.utils.LocaleUtils; @Translator(packet = ClientboundGameEventPacket.class) -public class JavaNotifyClientTranslator extends PacketTranslator { +public class JavaGameEventTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundGameEventPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java index 139924858..3673f48e0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaChunkDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java @@ -47,7 +47,7 @@ import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD; @Translator(packet = ClientboundLevelChunkPacket.class) -public class JavaChunkDataTranslator extends PacketTranslator { +public class JavaLevelChunkTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundLevelChunkPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java index 83eefb10b..d57190abf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayEffectTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java @@ -46,7 +46,7 @@ import java.util.Collections; import java.util.Locale; @Translator(packet = ClientboundLevelEventPacket.class) -public class JavaPlayEffectTranslator extends PacketTranslator { +public class JavaLevelEventTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java index 961dc7fd1..3a5f6b446 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnParticleTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java @@ -47,7 +47,7 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; @Translator(packet = ClientboundLevelParticlesPacket.class) -public class JavaSpawnParticleTranslator extends PacketTranslator { +public class JavaLevelParticlesTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java index ad080e1f0..e0b76f06d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java @@ -38,7 +38,8 @@ import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.MapColor; @Translator(packet = ClientboundMapItemDataPacket.class) -public class JavaMapDataTranslator extends PacketTranslator { +public class JavaMapItemDataTranslator extends PacketTranslator { + @Override public void translate(GeyserSession session, ClientboundMapItemDataPacket packet) { com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket mapItemDataPacket = new com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java index 1d3409af9..0a94fe1f8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMultiBlockChangeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java @@ -33,7 +33,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.ChunkUtils; @Translator(packet = ClientboundSectionBlocksUpdatePacket.class) -public class JavaMultiBlockChangeTranslator extends PacketTranslator { +public class JavaSectionBlocksUpdateTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSectionBlocksUpdatePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java index ced4545c9..6ddbf8eea 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java @@ -33,7 +33,7 @@ import org.geysermc.connector.utils.ChunkUtils; import com.nukkitx.math.vector.Vector3i; @Translator(packet = ClientboundSetChunkCacheCenterPacket.class) -public class JavaUpdateViewPositionTranslator extends PacketTranslator { +public class JavaSetChunkCacheCenterTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetChunkCacheCenterPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java similarity index 94% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java index faa6e7867..29c2ed094 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateViewDistanceTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java @@ -31,7 +31,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundSetChunkCacheRadiusPacket.class) -public class JavaUpdateViewDistanceTranslator extends PacketTranslator { +public class JavaSetChunkCacheRadiusTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetChunkCacheRadiusPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java index ae96ada79..025b09882 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSpawnPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.DimensionUtils; @Translator(packet = ClientboundSetDefaultSpawnPositionPacket.class) -public class JavaSpawnPositionTranslator extends PacketTranslator { +public class JavaSetDefaultSpawnPositionTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java index e478fb3a5..1c2081bc3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaUpdateTimeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @Translator(packet = ClientboundSetTimePacket.class) -public class JavaUpdateTimeTranslator extends PacketTranslator { +public class JavaSetTimeTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetTimePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java index 49d36ca38..dbf331aa2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaPlayBuiltinSoundTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java @@ -41,7 +41,7 @@ import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.SoundMapping; @Translator(packet = ClientboundSoundPacket.class) -public class JavaPlayBuiltinSoundTranslator extends PacketTranslator { +public class JavaSoundTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSoundPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java index 27544b94c..be4f4ce8a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaDisplayScoreboardTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.scoreboard.Scoreboard; import org.geysermc.connector.scoreboard.ScoreboardUpdater; @Translator(packet = ClientboundSetDisplayObjectivePacket.class) -public class JavaDisplayScoreboardTranslator extends PacketTranslator { +public class JavaSetDisplayObjectiveTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundSetDisplayObjectivePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java index ad7069503..b74d58175 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaScoreboardObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java @@ -42,7 +42,7 @@ import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.scoreboard.UpdateType; @Translator(packet = ClientboundSetObjectivePacket.class) -public class JavaScoreboardObjectiveTranslator extends PacketTranslator { +public class JavaSetObjectiveTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java index 5de4abe83..8d288917a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java @@ -44,7 +44,7 @@ import java.util.Arrays; import java.util.Set; @Translator(packet = ClientboundSetPlayerTeamPacket.class) -public class JavaTeamTranslator extends PacketTranslator { +public class JavaSetPlayerTeamTranslator extends PacketTranslator { private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java index c4d5b8ec3..7b37dc455 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaUpdateScoreTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java @@ -43,10 +43,10 @@ import org.geysermc.connector.scoreboard.ScoreboardUpdater; import org.geysermc.connector.utils.LanguageUtils; @Translator(packet = ClientboundSetScorePacket.class) -public class JavaUpdateScoreTranslator extends PacketTranslator { +public class JavaSetScoreTranslator extends PacketTranslator { private final GeyserLogger logger; - public JavaUpdateScoreTranslator() { + public JavaSetScoreTranslator() { logger = GeyserConnector.getInstance().getLogger(); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerCloseTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerCloseTranslator.java index 096e90684..6cf787eba 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaCloseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerCloseTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.utils.InventoryUtils; @Translator(packet = ClientboundContainerClosePacket.class) -public class JavaCloseWindowTranslator extends PacketTranslator { +public class JavaContainerCloseTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundContainerClosePacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetContentTranslator.java similarity index 96% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetContentTranslator.java index 589f0f6bb..5e62c0d63 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowItemsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetContentTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; @Translator(packet = ClientboundContainerSetContentPacket.class) -public class JavaWindowItemsTranslator extends PacketTranslator { +public class JavaContainerSetContentTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundContainerSetContentPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetDataTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetDataTranslator.java index 7ce45b086..fcba1fc97 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaWindowPropertyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetDataTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.utils.InventoryUtils; @Translator(packet = ClientboundContainerSetDataPacket.class) -public class JavaWindowPropertyTranslator extends PacketTranslator { +public class JavaContainerSetDataTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundContainerSetDataPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetSlotTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetSlotTranslator.java index 388d19984..57098c76e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaSetSlotTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaContainerSetSlotTranslator.java @@ -55,7 +55,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; @Translator(packet = ClientboundContainerSetSlotPacket.class) -public class JavaSetSlotTranslator extends PacketTranslator { +public class JavaContainerSetSlotTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundContainerSetSlotPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaHorseScreenOpenTranslator.java similarity index 99% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaHorseScreenOpenTranslator.java index aea462509..ec1b0ccb3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenHorseWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaHorseScreenOpenTranslator.java @@ -50,7 +50,7 @@ import java.util.Collections; import java.util.List; @Translator(packet = ClientboundHorseScreenOpenPacket.class) -public class JavaOpenHorseWindowTranslator extends PacketTranslator { +public class JavaHorseScreenOpenTranslator extends PacketTranslator { private static final NbtMap ARMOR_SLOT; private static final NbtMap CARPET_SLOT; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaMerchantOffersTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaMerchantOffersTranslator.java index 546c1ddfc..baa5ff2b7 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaTradeListTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaMerchantOffersTranslator.java @@ -48,7 +48,7 @@ import java.util.ArrayList; import java.util.List; @Translator(packet = ClientboundMerchantOffersPacket.class) -public class JavaTradeListTranslator extends PacketTranslator { +public class JavaMerchantOffersTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundMerchantOffersPacket packet) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenScreenTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenScreenTranslator.java index 24c1d022b..36d4e606a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenWindowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaOpenScreenTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.connector.utils.InventoryUtils; import org.geysermc.connector.utils.LocaleUtils; @Translator(packet = ClientboundOpenScreenPacket.class) -public class JavaOpenWindowTranslator extends PacketTranslator { +public class JavaOpenScreenTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundOpenScreenPacket packet) { From 59e6fc02852623d2a3d9b64c7bd041cb9f165338 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 12 Nov 2021 23:03:24 -0500 Subject: [PATCH 674/766] Properly name ClientboundPingPacket translator --- .../java/{JavaPingPacket.java => JavaPingTranslator.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{JavaPingPacket.java => JavaPingTranslator.java} (95%) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java index 1d090eb19..060ddef93 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingPacket.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java @@ -33,7 +33,7 @@ import org.geysermc.connector.network.translators.Translator; // Why does this packet exist? Whatever, we better implement it @Translator(packet = ClientboundPingPacket.class) -public class JavaPingPacket extends PacketTranslator { +public class JavaPingTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundPingPacket packet) { From 393c2b0f915090db930b1ee5912caacda46dcbde Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 13 Nov 2021 11:03:55 -0500 Subject: [PATCH 675/766] Handle chunks on the player thread --- .../geysermc/connector/GeyserConnector.java | 7 +- .../common/connection/LocalSession.java | 2 +- .../configuration/GeyserConfiguration.java | 2 - .../GeyserJacksonConfiguration.java | 3 - .../geysermc/connector/entity/BoatEntity.java | 12 +- .../connector/entity/ItemFrameEntity.java | 9 +- .../geysermc/connector/entity/TNTEntity.java | 32 ++-- .../connector/entity/player/PlayerEntity.java | 4 +- .../geysermc/connector/metrics/Metrics.java | 2 +- .../network/UpstreamPacketHandler.java | 26 +-- .../network/session/GeyserSession.java | 62 +++++--- .../network/session/cache/FormCache.java | 3 +- .../BedrockMapInfoRequestTranslator.java | 3 +- .../BedrockMobEquipmentTranslator.java | 2 +- .../BedrockNetworkStackLatencyTranslator.java | 3 +- ...edrockServerSettingsRequestTranslator.java | 2 +- ...SetLocalPlayerAsInitializedTranslator.java | 25 +-- .../translators/java/JavaLoginTranslator.java | 22 ++- .../player/JavaPlayerInfoTranslator.java | 2 +- .../java/level/JavaLevelChunkTranslator.java | 148 +++++++++--------- .../entity/SkullBlockEntityTranslator.java | 15 +- .../ping/GeyserLegacyPingPassthrough.java | 2 +- .../connector/skin/FloodgateSkinUploader.java | 4 +- .../geysermc/connector/skin/SkinManager.java | 42 +++-- .../geysermc/connector/skin/SkinProvider.java | 2 +- .../connector/skin/SkullSkinManager.java | 16 +- .../connector/utils/CooldownUtils.java | 3 +- connector/src/main/resources/config.yml | 3 - 28 files changed, 219 insertions(+), 239 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index b9bb453ce..21f457a62 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -36,6 +36,7 @@ import com.nukkitx.protocol.bedrock.BedrockServer; import io.netty.channel.epoll.Epoll; import io.netty.channel.kqueue.KQueue; import io.netty.util.NettyRuntime; +import io.netty.util.concurrent.DefaultThreadFactory; import io.netty.util.internal.SystemPropertyUtil; import lombok.Getter; import lombok.Setter; @@ -118,7 +119,7 @@ public class GeyserConnector { private volatile boolean shuttingDown = false; - private final ScheduledExecutorService generalThreadPool; + private final ScheduledExecutorService scheduledThread; private final BedrockServer bedrockServer; private final PlatformType platformType; @@ -144,7 +145,7 @@ public class GeyserConnector { logger.info(""); logger.info("******************************************"); - this.generalThreadPool = Executors.newScheduledThreadPool(config.getGeneralThreadPool()); + this.scheduledThread = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("Geyser Scheduled Thread")); logger.setDebug(config.isDebugMode()); @@ -404,7 +405,7 @@ public class GeyserConnector { bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done")); } - generalThreadPool.shutdown(); + scheduledThread.shutdown(); bedrockServer.close(); if (timeSyncer != null) { timeSyncer.shutdown(); diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java b/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java index 882bd3957..7bd08a732 100644 --- a/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java +++ b/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java @@ -97,7 +97,7 @@ public final class LocalSession extends TcpSession { exceptionCaught(null, future.cause()); } }); - } catch(Throwable t) { + } catch (Throwable t) { exceptionCaught(null, t); } } diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java index a3fe89c1b..2e05b0c18 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java @@ -68,8 +68,6 @@ public interface GeyserConfiguration { boolean isDebugMode(); - int getGeneralThreadPool(); - boolean isAllowThirdPartyCapes(); boolean isAllowThirdPartyEars(); diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java index da2840f76..c6967adf1 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java @@ -96,9 +96,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration @JsonProperty("debug-mode") private boolean debugMode = false; - @JsonProperty("general-thread-pool") - private int generalThreadPool = 32; - @JsonProperty("allow-third-party-capes") private boolean allowThirdPartyCapes = true; diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index 369b86a8e..025747940 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -133,9 +133,7 @@ public class BoatEntity extends Entity { // Get the entity by the first stored passenger and convey motion in this manner Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); if (entity != null) { - session.getConnector().getGeneralThreadPool().execute(() -> - updateLeftPaddle(session, entity) - ); + updateLeftPaddle(session, entity); } } } else { @@ -150,9 +148,7 @@ public class BoatEntity extends Entity { if (!this.passengers.isEmpty()) { Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); if (entity != null) { - session.getConnector().getGeneralThreadPool().execute(() -> - updateRightPaddle(session, entity) - ); + updateRightPaddle(session, entity); } } } else { @@ -180,7 +176,7 @@ public class BoatEntity extends Entity { paddleTimeLeft += ROWING_SPEED; sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_LEFT, paddleTimeLeft); - session.getConnector().getGeneralThreadPool().schedule(() -> + session.scheduleInEventLoop(() -> updateLeftPaddle(session, rower), 100, TimeUnit.MILLISECONDS @@ -193,7 +189,7 @@ public class BoatEntity extends Entity { paddleTimeRight += ROWING_SPEED; sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_RIGHT, paddleTimeRight); - session.getConnector().getGeneralThreadPool().schedule(() -> + session.scheduleInEventLoop(() -> updateRightPaddle(session, rower), 100, TimeUnit.MILLISECONDS diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java index cf40a3df1..6411a4f55 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java @@ -42,8 +42,6 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.registry.type.ItemMapping; -import java.util.concurrent.TimeUnit; - /** * Item frames are an entity in Java but a block entity in Bedrock. */ @@ -99,11 +97,8 @@ public class ItemFrameEntity extends Entity { session.getItemFrameCache().put(bedrockPosition, this); - // Delay is required, or else loading in frames on chunk load is sketchy at best - session.getConnector().getGeneralThreadPool().schedule(() -> { - updateBlock(session); - session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId); - }, 500, TimeUnit.MILLISECONDS); + updateBlock(session); + session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId); valid = true; } diff --git a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java b/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java index 1d70d9d5f..08ffa0dbc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java @@ -29,13 +29,11 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -public class TNTEntity extends Entity { +public class TNTEntity extends Entity implements Tickable { private int currentTick; @@ -49,16 +47,26 @@ public class TNTEntity extends Entity { currentTick = (int) entityMetadata.getValue(); metadata.getFlags().setFlag(EntityFlag.IGNITED, true); metadata.put(EntityData.FUSE_LENGTH, currentTick); - ScheduledFuture future = session.getConnector().getGeneralThreadPool().scheduleAtFixedRate(() -> { - if (currentTick % 5 == 0) { - metadata.put(EntityData.FUSE_LENGTH, currentTick); - } - currentTick--; - super.updateBedrockMetadata(entityMetadata, session); - }, 50, 50, TimeUnit.MILLISECONDS); // 5 ticks - session.getConnector().getGeneralThreadPool().schedule(() -> future.cancel(true), (int) entityMetadata.getValue() / 20, TimeUnit.SECONDS); } super.updateBedrockMetadata(entityMetadata, session); } + + @Override + public void tick(GeyserSession session) { + if (currentTick == 0) { + // No need to update the fuse when there is none + return; + } + + if (currentTick % 5 == 0) { + metadata.put(EntityData.FUSE_LENGTH, currentTick); + + SetEntityDataPacket packet = new SetEntityDataPacket(); + packet.setRuntimeEntityId(geyserId); + packet.getMetadata().put(EntityData.FUSE_LENGTH, currentTick); + session.sendUpstreamPacket(packet); + } + currentTick--; + } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 08f9f1bb4..5b948ef37 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -129,7 +129,7 @@ public class PlayerEntity extends LivingEntity { if (session.getEntityCache().getPlayerEntity(uuid) == null) return; - if (session.getUpstream().isInitialized() && session.getEntityCache().getEntityByGeyserId(geyserId) == null) { + if (session.getEntityCache().getEntityByGeyserId(geyserId) == null) { session.getEntityCache().spawnEntity(this); } else { spawnEntity(session); @@ -288,7 +288,7 @@ public class PlayerEntity extends LivingEntity { linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false, false)); // Delay, or else spawned-in players won't get the link // TODO: Find a better solution. This problem also exists with item frames - session.getConnector().getGeneralThreadPool().schedule(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS); + session.scheduleInEventLoop(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS); if (isLeft) { leftParrot = parrot; } else { diff --git a/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java b/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java index 6ebca3f8c..b33afaec0 100644 --- a/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java +++ b/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java @@ -114,7 +114,7 @@ public class Metrics { * Starts the Scheduler which submits our data every 30 minutes. */ private void startSubmitting() { - connector.getGeneralThreadPool().scheduleAtFixedRate(this::submitData, 1, 30, TimeUnit.MINUTES); + connector.getScheduledThread().scheduleAtFixedRate(this::submitData, 1, 30, TimeUnit.MINUTES); // Submit the data every 30 minutes, first time after 1 minutes to give other plugins enough time to start // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! // WARNING: Just don't do it! diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 42e24458f..4a51c9ca5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -104,6 +104,8 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { } resourcePacksInfo.setForcedToAccept(GeyserConnector.getInstance().getConfig().isForceResourcePacks()); session.sendUpstreamPacket(resourcePacksInfo); + + LanguageUtils.loadGeyserLocale(session.getLocale()); return true; } @@ -111,7 +113,12 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { public boolean handle(ResourcePackClientResponsePacket packet) { switch (packet.getStatus()) { case COMPLETED: - session.connect(); + if (connector.getConfig().getRemote().getAuthType() != AuthType.ONLINE) { + session.authenticate(session.getAuthData().getName()); + } else if (!couldLoginUserByName(session.getAuthData().getName())) { + // We must spawn the white world + session.connect(); + } connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.connect", session.getAuthData().getName())); break; @@ -182,9 +189,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().getName())); session.setMicrosoftAccount(info.isMicrosoftAccount()); session.authenticate(info.getEmail(), info.getPassword()); - - // TODO send a message to bedrock user telling them they are connected (if nothing like a motd - // somes from the Java server w/in a few seconds) return true; } } @@ -192,20 +196,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { return false; } - @Override - public boolean handle(SetLocalPlayerAsInitializedPacket packet) { - LanguageUtils.loadGeyserLocale(session.getLocale()); - - if (!session.isLoggedIn() && !session.isLoggingIn() && session.getRemoteAuthType() == AuthType.ONLINE) { - // TODO it is safer to key authentication on something that won't change (UUID, not username) - if (!couldLoginUserByName(session.getAuthData().getName())) { - LoginEncryptionUtils.buildAndShowLoginWindow(session); - } - // else we were able to log the user in - } - return translateAndDefault(packet); - } - @Override public boolean handle(MovePlayerPacket packet) { if (session.isLoggingIn()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 949b0937a..c3836b4cf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -229,6 +229,8 @@ public class GeyserSession implements CommandSender { private Vector2i lastChunkPosition = null; private int renderDistance; + private boolean sentSpawnPacket; + private boolean loggedIn; private boolean loggingIn; @@ -501,6 +503,10 @@ public class GeyserSession implements CommandSender { disconnect(disconnectReason.name()); connector.getSessionManager().removeSession(this); }); + + this.remoteAddress = connector.getConfig().getRemote().getAddress(); + this.remotePort = connector.getConfig().getRemote().getPort(); + this.remoteAuthType = connector.getConfig().getRemote().getAuthType(); } /** @@ -508,9 +514,7 @@ public class GeyserSession implements CommandSender { */ public void connect() { startGame(); - this.remoteAddress = connector.getConfig().getRemote().getAddress(); - this.remotePort = connector.getConfig().getRemote().getPort(); - this.remoteAuthType = connector.getConfig().getRemote().getAuthType(); + sentSpawnPacket = true; // Set the hardcoded shield ID to the ID we just defined in StartGamePacket upstream.getSession().getHardcodedBlockingId().set(this.itemMappings.getStoredItems().shield().getBedrockId()); @@ -685,27 +689,36 @@ public class GeyserSession implements CommandSender { if (loggedIn || closed) { return; } - try { - msaAuthenticationService.login(); - GameProfile profile = msaAuthenticationService.getSelectedProfile(); - if (profile == null) { - // Java account is offline - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + CompletableFuture.supplyAsync(() -> { + try { + msaAuthenticationService.login(); + GameProfile profile = msaAuthenticationService.getSelectedProfile(); + if (profile == null) { + // Java account is offline + disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + return null; + } + + return new MinecraftProtocol(profile, msaAuthenticationService.getAccessToken()); + } catch (RequestException e) { + throw new CompletionException(e); + } + }).whenComplete((response, ex) -> { + if (ex != null) { + if (!(ex instanceof CompletionException completionException) || !(completionException.getCause() instanceof AuthPendingException)) { + connector.getLogger().error("Failed to log in with Microsoft code!", ex); + disconnect(ex.toString()); + } else { + // Wait one second before trying again + connector.getScheduledThread().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); + } return; } - - protocol = new MinecraftProtocol(profile, msaAuthenticationService.getAccessToken()); - - connectDownstream(); - } catch (RequestException e) { - if (!(e instanceof AuthPendingException)) { - connector.getLogger().error("Failed to log in with Microsoft code!", e); - disconnect(e.toString()); - } else { - // Wait one second before trying again - connector.getGeneralThreadPool().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); + if (!closed) { + this.protocol = response; + connectDownstream(); } - } + }); } /** @@ -725,6 +738,7 @@ public class GeyserSession implements CommandSender { downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol); disableSrvResolving(); } + if (connector.getConfig().getRemote().isUseProxyProtocol()) { downstream.setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true); downstream.setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress()); @@ -1133,7 +1147,11 @@ public class GeyserSession implements CommandSender { StartGamePacket startGamePacket = new StartGamePacket(); startGamePacket.setUniqueEntityId(playerEntity.getGeyserId()); startGamePacket.setRuntimeEntityId(playerEntity.getGeyserId()); - startGamePacket.setPlayerGameType(GameType.SURVIVAL); + startGamePacket.setPlayerGameType(switch (gameMode) { + case CREATIVE -> GameType.CREATIVE; + case ADVENTURE -> GameType.ADVENTURE; + default -> GameType.SURVIVAL; + }); startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0)); startGamePacket.setRotation(Vector2f.from(1, 1)); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java index 954a2b033..73475673c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java @@ -65,8 +65,7 @@ public class FormCache { NetworkStackLatencyPacket latencyPacket = new NetworkStackLatencyPacket(); latencyPacket.setFromServer(true); latencyPacket.setTimestamp(-System.currentTimeMillis()); - session.getConnector().getGeneralThreadPool().schedule( - () -> session.sendUpstreamPacket(latencyPacket), + session.scheduleInEventLoop(() -> session.sendUpstreamPacket(latencyPacket), 500, TimeUnit.MILLISECONDS); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java index 4b4c5b20d..50d5d1c8c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java @@ -27,7 +27,6 @@ package org.geysermc.connector.network.translators.bedrock; import com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.packet.MapInfoRequestPacket; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -44,7 +43,7 @@ public class BedrockMapInfoRequestTranslator extends PacketTranslator session.sendUpstreamPacket(mapPacket), + session.scheduleInEventLoop(() -> session.sendUpstreamPacket(mapPacket), 100, TimeUnit.MILLISECONDS); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java index 26dd340f6..4fa35bb46 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java @@ -61,7 +61,7 @@ public class BedrockMobEquipmentTranslator extends PacketTranslator session.sendDownstreamPacket(new ServerboundUseItemPacket(Hand.MAIN_HAND)), + session.scheduleInEventLoop(() -> session.sendDownstreamPacket(new ServerboundUseItemPacket(Hand.MAIN_HAND)), 50, TimeUnit.MILLISECONDS); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java index cf1c0a1b5..91d60ce66 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java @@ -76,8 +76,7 @@ public class BedrockNetworkStackLatencyTranslator extends PacketTranslator session.sendUpstreamPacket(attributesPacket), + session.scheduleInEventLoop(() -> session.sendUpstreamPacket(attributesPacket), 500, TimeUnit.MILLISECONDS); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java index 2b2ec2917..5fe778513 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java @@ -43,7 +43,7 @@ public class BedrockServerSettingsRequestTranslator extends PacketTranslator { + session.scheduleInEventLoop(() -> { ServerSettingsResponsePacket serverSettingsResponsePacket = new ServerSettingsResponsePacket(); serverSettingsResponsePacket.setFormData(window.getJsonData()); serverSettingsResponsePacket.setFormId(windowId); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index c52513c4d..5288a62fa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -25,14 +25,12 @@ package org.geysermc.connector.network.translators.bedrock; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; -import org.geysermc.connector.entity.player.PlayerEntity; +import org.geysermc.connector.common.AuthType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.skin.SkinManager; -import org.geysermc.connector.skin.SkullSkinManager; +import org.geysermc.connector.utils.LoginEncryptionUtils; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator { @@ -41,23 +39,12 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) { if (!session.getUpstream().isInitialized()) { session.getUpstream().setInitialized(true); - session.login(); - for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) { - if (!entity.isValid()) { - SkinManager.requestAndHandleSkinAndCape(entity, session, null); - entity.sendPlayer(session); + if (session.getRemoteAuthType() == AuthType.ONLINE) { + if (!session.isLoggedIn()) { + LoginEncryptionUtils.buildAndShowLoginWindow(session); } - } - - // Send Skulls - for (PlayerEntity entity : session.getSkullCache().values()) { - entity.spawnEntity(session); - - SkullSkinManager.requestAndHandleSkin(entity, session, (skin) -> { - entity.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); - entity.updateBedrockMetadata(session); - }); + // else we were able to log the user in } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java index dc4678ae2..9384a3515 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java @@ -70,19 +70,25 @@ public class JavaLoginTranslator extends PacketTranslator { - try { - if (session.isClosed()) { - return; - } - ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, column, yOffset); - ChunkSection[] sections = chunkData.sections(); + ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, column, yOffset); + ChunkSection[] sections = chunkData.sections(); - // Find highest section - int sectionCount = sections.length - 1; - while (sectionCount >= 0 && sections[sectionCount] == null) { - sectionCount--; - } - sectionCount++; + // Find highest section + int sectionCount = sections.length - 1; + while (sectionCount >= 0 && sections[sectionCount] == null) { + sectionCount--; + } + sectionCount++; - // Estimate chunk size - int size = 0; - for (int i = 0; i < sectionCount; i++) { - ChunkSection section = sections[i]; - size += (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).estimateNetworkSize(); - } - size += ChunkUtils.EMPTY_CHUNK_DATA.length; // Consists only of biome data - size += 1; // Border blocks - size += 1; // Extra data length (always 0) - size += chunkData.blockEntities().length * 64; // Conservative estimate of 64 bytes per tile entity + // Estimate chunk size + int size = 0; + for (int i = 0; i < sectionCount; i++) { + ChunkSection section = sections[i]; + size += (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).estimateNetworkSize(); + } + size += ChunkUtils.EMPTY_CHUNK_DATA.length; // Consists only of biome data + size += 1; // Border blocks + size += 1; // Extra data length (always 0) + size += chunkData.blockEntities().length * 64; // Conservative estimate of 64 bytes per tile entity - // Allocate output buffer - ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(size); - byte[] payload; - try { - for (int i = 0; i < sectionCount; i++) { - ChunkSection section = sections[i]; - (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).writeToNetwork(byteBuf); - } - - // At this point we're dealing with Bedrock chunk sections - boolean overworld = session.getChunkCache().isExtendedHeight(); - int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4; - for (int i = 0; i < sectionCount; i++) { - int biomeYOffset = dimensionOffset + i; - if (biomeYOffset < yOffset) { - // Ignore this biome section since it goes below the height of the Java world - byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); - continue; - } - BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf); - } - - // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections - int remainingEmptyBiomes = 32 - sectionCount; - for (int i = 0; i < remainingEmptyBiomes; i++) { - byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); - } - - byteBuf.writeByte(0); // Border blocks - Edu edition only - VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now - - // Encode tile entities into buffer - NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(new ByteBufOutputStream(byteBuf)); - for (NbtMap blockEntity : chunkData.blockEntities()) { - nbtStream.writeTag(blockEntity); - } - - // Copy data into byte[], because the protocol lib really likes things that are s l o w - byteBuf.readBytes(payload = new byte[byteBuf.readableBytes()]); - } finally { - byteBuf.release(); // Release buffer to allow buffer pooling to be useful - } - - LevelChunkPacket levelChunkPacket = new LevelChunkPacket(); - levelChunkPacket.setSubChunksLength(sectionCount); - levelChunkPacket.setCachingEnabled(false); - levelChunkPacket.setChunkX(column.getX()); - levelChunkPacket.setChunkZ(column.getZ()); - levelChunkPacket.setData(payload); - session.sendUpstreamPacket(levelChunkPacket); - } catch (Exception ex) { - ex.printStackTrace(); + // Allocate output buffer + ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(size); + byte[] payload; + try { + for (int i = 0; i < sectionCount; i++) { + ChunkSection section = sections[i]; + (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).writeToNetwork(byteBuf); } - }); + + // At this point we're dealing with Bedrock chunk sections + boolean overworld = session.getChunkCache().isExtendedHeight(); + int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4; + for (int i = 0; i < sectionCount; i++) { + int biomeYOffset = dimensionOffset + i; + if (biomeYOffset < yOffset) { + // Ignore this biome section since it goes below the height of the Java world + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + continue; + } + BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf); + } + + // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections + int remainingEmptyBiomes = 32 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + } + + byteBuf.writeByte(0); // Border blocks - Edu edition only + VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now + + // Encode tile entities into buffer + NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(new ByteBufOutputStream(byteBuf)); + for (NbtMap blockEntity : chunkData.blockEntities()) { + nbtStream.writeTag(blockEntity); + } + + // Copy data into byte[], because the protocol lib really likes things that are s l o w + byteBuf.readBytes(payload = new byte[byteBuf.readableBytes()]); + } catch (IOException e) { + session.getConnector().getLogger().error("IO error while encoding chunk", e); + return; + } finally { + byteBuf.release(); // Release buffer to allow buffer pooling to be useful + } + + LevelChunkPacket levelChunkPacket = new LevelChunkPacket(); + levelChunkPacket.setSubChunksLength(sectionCount); + levelChunkPacket.setCachingEnabled(false); + levelChunkPacket.setChunkX(column.getX()); + levelChunkPacket.setChunkZ(column.getZ()); + levelChunkPacket.setData(payload); + session.sendUpstreamPacket(levelChunkPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index 90458ca71..0306e65f3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -141,15 +141,12 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements // Cache entity session.getSkullCache().put(blockPosition, player); - // Only send to session if we are initialized, otherwise it will happen then. - if (session.getUpstream().isInitialized()) { - player.spawnEntity(session); + player.spawnEntity(session); - SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.scheduleInEventLoop(() -> { - // Delay to minimize split-second "player" pop-in - player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); - player.updateBedrockMetadata(session); - }, 250, TimeUnit.MILLISECONDS))); - } + SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.scheduleInEventLoop(() -> { + // Delay to minimize split-second "player" pop-in + player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); + player.updateBedrockMetadata(session); + }, 250, TimeUnit.MILLISECONDS))); } } diff --git a/connector/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java b/connector/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java index a1a2d474b..5781a60d4 100644 --- a/connector/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java +++ b/connector/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java @@ -62,7 +62,7 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn // Ensure delay is not zero int interval = (connector.getConfig().getPingPassthroughInterval() == 0) ? 1 : connector.getConfig().getPingPassthroughInterval(); connector.getLogger().debug("Scheduling ping passthrough at an interval of " + interval + " second(s)."); - connector.getGeneralThreadPool().scheduleAtFixedRate(pingPassthrough, 1, interval, TimeUnit.SECONDS); + connector.getScheduledThread().scheduleAtFixedRate(pingPassthrough, 1, interval, TimeUnit.SECONDS); return pingPassthrough; } return null; diff --git a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java index cf76c529a..9dce59acc 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java +++ b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java @@ -212,14 +212,14 @@ public final class FloodgateSkinUploader { private void reconnectLater(GeyserConnector connector) { // we ca only reconnect when the thread pool is open - if (connector.getGeneralThreadPool().isShutdown() || closed) { + if (connector.getScheduledThread().isShutdown() || closed) { logger.info("The skin uploader has been closed"); return; } long additionalTime = ThreadLocalRandom.current().nextInt(7); // we don't have to check the result. onClose will handle that for us - connector.getGeneralThreadPool() + connector.getScheduledThread() .schedule(client::reconnect, 8 + additionalTime, TimeUnit.SECONDS); } diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java b/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java index 70f9f8ff5..6815d7550 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java @@ -167,31 +167,29 @@ public class SkinManager { } } - if (session.getUpstream().isInitialized()) { - PlayerListPacket.Entry updatedEntry = buildEntryManually( - session, - entity.getUuid(), - entity.getUsername(), - entity.getGeyserId(), - skin.getTextureUrl(), - skin.getSkinData(), - cape.getCapeId(), - cape.getCapeData(), - geometry - ); + PlayerListPacket.Entry updatedEntry = buildEntryManually( + session, + entity.getUuid(), + entity.getUsername(), + entity.getGeyserId(), + skin.getTextureUrl(), + skin.getSkinData(), + cape.getCapeId(), + cape.getCapeData(), + geometry + ); - PlayerListPacket playerAddPacket = new PlayerListPacket(); - playerAddPacket.setAction(PlayerListPacket.Action.ADD); - playerAddPacket.getEntries().add(updatedEntry); - session.sendUpstreamPacket(playerAddPacket); + PlayerListPacket playerAddPacket = new PlayerListPacket(); + playerAddPacket.setAction(PlayerListPacket.Action.ADD); + playerAddPacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerAddPacket); - if (!entity.isPlayerList()) { - PlayerListPacket playerRemovePacket = new PlayerListPacket(); - playerRemovePacket.setAction(PlayerListPacket.Action.REMOVE); - playerRemovePacket.getEntries().add(updatedEntry); - session.sendUpstreamPacket(playerRemovePacket); - } + if (!entity.isPlayerList()) { + PlayerListPacket playerRemovePacket = new PlayerListPacket(); + playerRemovePacket.setAction(PlayerListPacket.Action.REMOVE); + playerRemovePacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerRemovePacket); } } catch (Exception e) { GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java index 567e52ace..7e25fed6f 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java @@ -101,7 +101,7 @@ public class SkinProvider { // Schedule Daily Image Expiry if we are caching them if (GeyserConnector.getInstance().getConfig().getCacheImages() > 0) { - GeyserConnector.getInstance().getGeneralThreadPool().scheduleAtFixedRate(() -> { + GeyserConnector.getInstance().getScheduledThread().scheduleAtFixedRate(() -> { File cacheFolder = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").toFile(); if (!cacheFolder.exists()) { return; diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java b/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java index 40ef47f99..ca02afdbe 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java @@ -55,15 +55,13 @@ public class SkullSkinManager extends SkinManager { SkinProvider.requestSkin(entity.getUuid(), data.skinUrl(), true) .whenCompleteAsync((skin, throwable) -> { try { - if (session.getUpstream().isInitialized()) { - PlayerSkinPacket packet = new PlayerSkinPacket(); - packet.setUuid(entity.getUuid()); - packet.setOldSkinName(""); - packet.setNewSkinName(skin.getTextureUrl()); - packet.setSkin(buildSkullEntryManually(skin.getTextureUrl(), skin.getSkinData())); - packet.setTrustedSkin(true); - session.sendUpstreamPacket(packet); - } + PlayerSkinPacket packet = new PlayerSkinPacket(); + packet.setUuid(entity.getUuid()); + packet.setOldSkinName(""); + packet.setNewSkinName(skin.getTextureUrl()); + packet.setSkin(buildSkullEntryManually(skin.getTextureUrl(), skin.getSkinData())); + packet.setTrustedSkin(true); + session.sendUpstreamPacket(packet); } catch (Exception e) { GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); } diff --git a/connector/src/main/java/org/geysermc/connector/utils/CooldownUtils.java b/connector/src/main/java/org/geysermc/connector/utils/CooldownUtils.java index 583c2ddae..4b2704803 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/CooldownUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/CooldownUtils.java @@ -92,7 +92,8 @@ public class CooldownUtils { titlePacket.setPlatformOnlineId(""); session.sendUpstreamPacket(titlePacket); if (hasCooldown(session)) { - session.getConnector().getGeneralThreadPool().schedule(() -> computeCooldown(session, sessionPreference, lastHitTime), 50, TimeUnit.MILLISECONDS); // Updated per tick. 1000 divided by 20 ticks equals 50 + session.scheduleInEventLoop(() -> + computeCooldown(session, sessionPreference, lastHitTime), 50, TimeUnit.MILLISECONDS); // Updated per tick. 1000 divided by 20 ticks equals 50 } else { SetTitlePacket removeTitlePacket = new SetTitlePacket(); if (sessionPreference == CooldownType.ACTIONBAR) { diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 1d5198e3f..f690b50ee 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -110,9 +110,6 @@ max-players: 100 # If debug messages should be sent through console debug-mode: false -# Thread pool size -general-thread-pool: 32 - # Allow third party capes to be visible. Currently allowing: # OptiFine capes, LabyMod capes, 5Zig capes and MinecraftCapes allow-third-party-capes: true From 6b012778d8d1d69ba43c642ad5b3c064a3a0ba00 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 13 Nov 2021 23:49:31 -0500 Subject: [PATCH 676/766] Initial update to 1.18 protocol --- connector/pom.xml | 2 +- .../network/session/cache/ChunkCache.java | 17 +- .../translators/java/JavaLoginTranslator.java | 3 +- .../level/JavaBlockEntityDataTranslator.java | 5 +- .../java/level/JavaLevelChunkTranslator.java | 141 ------- .../JavaLevelChunkWithLightTranslator.java | 361 ++++++++++++++++++ .../translators/world/BiomeTranslator.java | 48 ++- .../block/entity/BlockEntityTranslator.java | 6 +- .../translators/world/chunk/GeyserColumn.java | 22 +- .../geysermc/connector/utils/ChunkUtils.java | 216 +---------- 10 files changed, 415 insertions(+), 406 deletions(-) delete mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java diff --git a/connector/pom.xml b/connector/pom.xml index 0b9913ea2..1b6e9fc4e 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -149,7 +149,7 @@ com.github.steveice10 mcprotocollib - 1.17.1-3-SNAPSHOT + 1.18-pre-SNAPSHOT compile diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java index 6154ff65f..b9f3b4db6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java @@ -25,8 +25,7 @@ package org.geysermc.connector.network.session.cache; -import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; -import com.github.steveice10.mc.protocol.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import lombok.Getter; @@ -57,14 +56,14 @@ public class ChunkCache { chunks = cache ? new Long2ObjectOpenHashMap<>() : null; } - public void addToCache(Column chunk) { + public void addToCache(int x, int z, DataPalette[] chunks) { if (!cache) { return; } - long chunkPosition = MathUtils.chunkPositionToLong(chunk.getX(), chunk.getZ()); - GeyserColumn geyserColumn = GeyserColumn.from(this, chunk); - chunks.put(chunkPosition, geyserColumn); + long chunkPosition = MathUtils.chunkPositionToLong(x, z); + GeyserColumn geyserColumn = GeyserColumn.from(chunks); + this.chunks.put(chunkPosition, geyserColumn); } /** @@ -90,11 +89,11 @@ public class ChunkCache { return; } - Chunk chunk = column.getChunks()[(y - minY) >> 4]; + DataPalette chunk = column.getChunks()[(y - minY) >> 4]; if (chunk == null) { if (block != BlockStateValues.JAVA_AIR_ID) { // A previously empty chunk, which is no longer empty as a block has been added to it - chunk = new Chunk(); + chunk = DataPalette.createForChunk(); // Fixes the chunk assuming that all blocks is the `block` variable we are updating. /shrug chunk.getPalette().stateToId(BlockStateValues.JAVA_AIR_ID); column.getChunks()[(y - minY) >> 4] = chunk; @@ -122,7 +121,7 @@ public class ChunkCache { return BlockStateValues.JAVA_AIR_ID; } - Chunk chunk = column.getChunks()[(y - minY) >> 4]; + DataPalette chunk = column.getChunks()[(y - minY) >> 4]; if (chunk != null) { return chunk.get(x & 0xF, y & 0xF, z & 0xF); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java index 9384a3515..cbcbe9f1d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java @@ -106,7 +106,8 @@ public class JavaLoginTranslator extends PacketTranslator { - - @Override - public void translate(GeyserSession session, ClientboundLevelChunkPacket packet) { - if (session.isSpawned()) { - ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); - } - - session.getChunkCache().addToCache(packet.getColumn()); - Column column = packet.getColumn(); - - // Ensure that, if the player is using lower world heights, the position is not offset - int yOffset = session.getChunkCache().getChunkMinY(); - - ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, column, yOffset); - ChunkSection[] sections = chunkData.sections(); - - // Find highest section - int sectionCount = sections.length - 1; - while (sectionCount >= 0 && sections[sectionCount] == null) { - sectionCount--; - } - sectionCount++; - - // Estimate chunk size - int size = 0; - for (int i = 0; i < sectionCount; i++) { - ChunkSection section = sections[i]; - size += (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).estimateNetworkSize(); - } - size += ChunkUtils.EMPTY_CHUNK_DATA.length; // Consists only of biome data - size += 1; // Border blocks - size += 1; // Extra data length (always 0) - size += chunkData.blockEntities().length * 64; // Conservative estimate of 64 bytes per tile entity - - // Allocate output buffer - ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer(size); - byte[] payload; - try { - for (int i = 0; i < sectionCount; i++) { - ChunkSection section = sections[i]; - (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).writeToNetwork(byteBuf); - } - - // At this point we're dealing with Bedrock chunk sections - boolean overworld = session.getChunkCache().isExtendedHeight(); - int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4; - for (int i = 0; i < sectionCount; i++) { - int biomeYOffset = dimensionOffset + i; - if (biomeYOffset < yOffset) { - // Ignore this biome section since it goes below the height of the Java world - byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); - continue; - } - BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf); - } - - // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections - int remainingEmptyBiomes = 32 - sectionCount; - for (int i = 0; i < remainingEmptyBiomes; i++) { - byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); - } - - byteBuf.writeByte(0); // Border blocks - Edu edition only - VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now - - // Encode tile entities into buffer - NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(new ByteBufOutputStream(byteBuf)); - for (NbtMap blockEntity : chunkData.blockEntities()) { - nbtStream.writeTag(blockEntity); - } - - // Copy data into byte[], because the protocol lib really likes things that are s l o w - byteBuf.readBytes(payload = new byte[byteBuf.readableBytes()]); - } catch (IOException e) { - session.getConnector().getLogger().error("IO error while encoding chunk", e); - return; - } finally { - byteBuf.release(); // Release buffer to allow buffer pooling to be useful - } - - LevelChunkPacket levelChunkPacket = new LevelChunkPacket(); - levelChunkPacket.setSubChunksLength(sectionCount); - levelChunkPacket.setCachingEnabled(false); - levelChunkPacket.setChunkX(column.getX()); - levelChunkPacket.setChunkZ(column.getZ()); - levelChunkPacket.setData(payload); - session.sendUpstreamPacket(levelChunkPacket); - } -} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java new file mode 100644 index 000000000..b6e7880f0 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -0,0 +1,361 @@ +/* + * Copyright (c) 2019-2021 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.connector.network.translators.java.level; + +import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; +import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; +import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; +import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; +import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityInfo; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.StringTag; +import com.github.steveice10.opennbt.tag.builtin.Tag; +import com.github.steveice10.packetlib.io.NetInput; +import com.github.steveice10.packetlib.io.stream.StreamNetInput; +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.nbt.NBTOutputStream; +import com.nukkitx.nbt.NbtMap; +import com.nukkitx.nbt.NbtUtils; +import com.nukkitx.network.VarInts; +import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.ByteBufOutputStream; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.world.BiomeTranslator; +import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; +import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; +import org.geysermc.connector.network.translators.world.chunk.BlockStorage; +import org.geysermc.connector.network.translators.world.chunk.ChunkSection; +import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; +import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; +import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.utils.BlockEntityUtils; +import org.geysermc.connector.utils.ChunkUtils; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; + +import static org.geysermc.connector.utils.ChunkUtils.*; + +@Translator(packet = ClientboundLevelChunkWithLightPacket.class) +public class JavaLevelChunkWithLightTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacket packet) { + if (session.isSpawned()) { + ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); + } + + //todo session.getChunkCache().addToCache(packet.getColumn()); + + // Ensure that, if the player is using lower world heights, the position is not offset + int yOffset = session.getChunkCache().getChunkMinY(); + + // Temporarily stores compound tags of Bedrock-only block entities + List bedrockOnlyBlockEntities = new ArrayList<>(); + DataPalette[] javaChunks = new DataPalette[session.getChunkCache().getChunkHeightY()]; + DataPalette[] javaBiomes = new DataPalette[session.getChunkCache().getChunkHeightY()]; + + BitSet waterloggedPaletteIds = new BitSet(); + BitSet pistonOrFlowerPaletteIds = new BitSet(); + + boolean overworld = session.getChunkCache().isExtendedHeight(); + int maxBedrockSectionY = ((overworld ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT) >> 4) - 1; + + int sectionCount; + byte[] payload; + ByteBuf byteBuf = null; + ChunkSection[] sections = new ChunkSection[javaChunks.length - yOffset]; + + try { + NetInput in = new StreamNetInput(new ByteArrayInputStream(packet.getChunkData())); + for (int sectionY = 0; sectionY < session.getChunkCache().getChunkHeightY(); sectionY++) { + int bedrockSectionY = sectionY + (yOffset - ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4)); + if (bedrockSectionY < 0 || maxBedrockSectionY < bedrockSectionY) { + // Ignore this chunk section since it goes outside the bounds accepted by the Bedrock client + continue; + } + + Chunk javaSection = Chunk.read(in); + javaChunks[sectionY] = javaSection.getChunkData(); + javaBiomes[sectionY] = javaSection.getBiomeData(); + + // No need to encode an empty section... + if (javaSection.isBlockCountEmpty()) { + continue; + } + + Palette javaPalette = javaSection.getChunkData().getPalette(); + BitStorage javaData = javaSection.getChunkData().getStorage(); + + if (javaPalette instanceof GlobalPalette) { + // As this is the global palette, simply iterate through the whole chunk section once + ChunkSection section = new ChunkSection(session.getBlockMappings().getBedrockAirId()); + for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { + int javaId = javaData.get(yzx); + int bedrockId = session.getBlockMappings().getBedrockBlockId(javaId); + int xzy = indexYZXtoXZY(yzx); + section.getBlockStorageArray()[0].setFullBlock(xzy, bedrockId); + + if (BlockRegistries.WATERLOGGED.get().contains(javaId)) { + section.getBlockStorageArray()[1].setFullBlock(xzy, session.getBlockMappings().getBedrockWaterId()); + } + + // Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock + if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) { + bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, + Vector3i.from((packet.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (packet.getZ() << 4) + ((yzx >> 4) & 0xF)), + javaId + )); + } + } + sections[bedrockSectionY] = section; + continue; + } + + IntList bedrockPalette = new IntArrayList(javaPalette.size()); + waterloggedPaletteIds.clear(); + pistonOrFlowerPaletteIds.clear(); + + // Iterate through palette and convert state IDs to Bedrock, doing some additional checks as we go + for (int i = 0; i < javaPalette.size(); i++) { + int javaId = javaPalette.idToState(i); + bedrockPalette.add(session.getBlockMappings().getBedrockBlockId(javaId)); + + if (BlockRegistries.WATERLOGGED.get().contains(javaId)) { + waterloggedPaletteIds.set(i); + } + + // Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock + if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) { + pistonOrFlowerPaletteIds.set(i); + } + } + + // Add Bedrock-exclusive block entities + // We only if the palette contained any blocks that are Bedrock-exclusive block entities to avoid iterating through the whole block data + // for no reason, as most sections will not contain any pistons or flower pots + if (!pistonOrFlowerPaletteIds.isEmpty()) { + for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { + int paletteId = javaData.get(yzx); + if (pistonOrFlowerPaletteIds.get(paletteId)) { + bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, + Vector3i.from((packet.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (packet.getZ() << 4) + ((yzx >> 4) & 0xF)), + javaPalette.idToState(paletteId) + )); + } + } + } + + BitArray bedrockData = BitArrayVersion.forBitsCeil(javaData.getBitsPerEntry()).createArray(BlockStorage.SIZE); + BlockStorage layer0 = new BlockStorage(bedrockData, bedrockPalette); + BlockStorage[] layers; + + // Convert data array from YZX to XZY coordinate order + if (waterloggedPaletteIds.isEmpty()) { + // No blocks are waterlogged, simply convert coordinate order + // This could probably be optimized further... + for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { + bedrockData.set(indexYZXtoXZY(yzx), javaData.get(yzx)); + } + + layers = new BlockStorage[]{ layer0 }; + } else { + // The section contains waterlogged blocks, we need to convert coordinate order AND generate a V1 block storage for + // layer 1 with palette ID 1 indicating water + int[] layer1Data = new int[BlockStorage.SIZE >> 5]; + for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { + int paletteId = javaData.get(yzx); + int xzy = indexYZXtoXZY(yzx); + bedrockData.set(xzy, paletteId); + + if (waterloggedPaletteIds.get(paletteId)) { + layer1Data[xzy >> 5] |= 1 << (xzy & 0x1F); + } + } + + // V1 palette + IntList layer1Palette = new IntArrayList(2); + layer1Palette.add(session.getBlockMappings().getBedrockAirId()); // Air - see BlockStorage's constructor for more information + layer1Palette.add(session.getBlockMappings().getBedrockWaterId()); + + layers = new BlockStorage[]{ layer0, new BlockStorage(BitArrayVersion.V1.createArray(BlockStorage.SIZE, layer1Data), layer1Palette) }; + } + + sections[bedrockSectionY] = new ChunkSection(layers); + } + + session.getChunkCache().addToCache(packet.getX(), packet.getZ(), javaChunks); + + BlockEntityInfo[] blockEntities = packet.getBlockEntities(); + NbtMap[] bedrockBlockEntities = new NbtMap[blockEntities.length + bedrockOnlyBlockEntities.size()]; + int blockEntityCount = 0; + while (blockEntityCount < blockEntities.length) { + BlockEntityInfo blockEntity = blockEntities[blockEntityCount]; + CompoundTag tag = blockEntity.getNbt(); + // TODO use the actual name + String tagName; + if (tag != null) { + Tag idTag = tag.get("id"); + if (idTag != null) { + tagName = (String) idTag.getValue(); + } else { + tagName = "Empty"; + // Sometimes legacy tags have their ID be a StringTag with empty value + for (Tag subTag : tag) { + if (subTag instanceof StringTag stringTag) { + if (stringTag.getValue().isEmpty()) { + tagName = stringTag.getName(); + break; + } + } + } + if (tagName.equals("Empty")) { + GeyserConnector.getInstance().getLogger().debug("Got tag with no id: " + tag.getValue()); + } + } + } else { + tagName = "Empty"; + } + + String id = BlockEntityUtils.getBedrockBlockEntityId(tagName); + int x = blockEntity.getX(); + int y = blockEntity.getY(); + int z = blockEntity.getZ(); + + // Get the Java block state ID from block entity position + DataPalette section = javaChunks[(blockEntity.getY() >> 4) - yOffset]; + int blockState = section.get(x & 0xF, y & 0xF, z & 0xF); + + if (tagName.equals("minecraft:lectern") && BlockStateValues.getLecternBookStates().get(blockState)) { + // If getLecternBookStates is false, let's just treat it like a normal block entity + bedrockBlockEntities[blockEntityCount] = session.getConnector().getWorldManager().getLecternDataAt( + session, blockEntity.getX(), blockEntity.getY(), blockEntity.getZ(), true); + blockEntityCount++; + continue; + } + + BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(id); + bedrockBlockEntities[blockEntityCount] = blockEntityTranslator.getBlockEntityTag(tagName, x, y, z, tag, blockState); + + // Check for custom skulls + if (session.getPreferencesCache().showCustomSkulls() && tag != null && tag.contains("SkullOwner")) { + SkullBlockEntityTranslator.spawnPlayer(session, tag, blockState); + } + blockEntityCount++; + } + + // Append Bedrock-exclusive block entities to output array + for (NbtMap tag : bedrockOnlyBlockEntities) { + bedrockBlockEntities[blockEntityCount] = tag; + blockEntityCount++; + } + + // Find highest section + sectionCount = sections.length - 1; + while (sectionCount >= 0 && sections[sectionCount] == null) { + sectionCount--; + } + sectionCount++; + + // Estimate chunk size + int size = 0; + for (int i = 0; i < sectionCount; i++) { + ChunkSection section = sections[i]; + size += (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).estimateNetworkSize(); + } + size += ChunkUtils.EMPTY_CHUNK_DATA.length; // Consists only of biome data + size += 1; // Border blocks + size += 1; // Extra data length (always 0) + size += bedrockBlockEntities.length * 64; // Conservative estimate of 64 bytes per tile entity + + // Allocate output buffer + byteBuf = ByteBufAllocator.DEFAULT.buffer(size); + for (int i = 0; i < sectionCount; i++) { + ChunkSection section = sections[i]; + (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).writeToNetwork(byteBuf); + } + + // At this point we're dealing with Bedrock chunk sections + int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4; + for (int i = 0; i < sectionCount; i++) { + int biomeYOffset = dimensionOffset + i; + if (biomeYOffset < yOffset) { + // Ignore this biome section since it goes below the height of the Java world + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + continue; + } + BiomeTranslator.toNewBedrockBiome(session, javaBiomes[i]).writeToNetwork(byteBuf); + } + + // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections + int remainingEmptyBiomes = 32 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + } + + byteBuf.writeByte(0); // Border blocks - Edu edition only + VarInts.writeUnsignedInt(byteBuf, 0); // extra data length, 0 for now + + // Encode tile entities into buffer + NBTOutputStream nbtStream = NbtUtils.createNetworkWriter(new ByteBufOutputStream(byteBuf)); + for (NbtMap blockEntity : bedrockBlockEntities) { + nbtStream.writeTag(blockEntity); + } + + // Copy data into byte[], because the protocol lib really likes things that are s l o w + byteBuf.readBytes(payload = new byte[byteBuf.readableBytes()]); + } catch (IOException e) { + session.getConnector().getLogger().error("IO error while encoding chunk", e); + return; + } finally { + if (byteBuf != null) { + byteBuf.release(); // Release buffer to allow buffer pooling to be useful + } + } + + LevelChunkPacket levelChunkPacket = new LevelChunkPacket(); + levelChunkPacket.setSubChunksLength(sectionCount); + levelChunkPacket.setCachingEnabled(false); + levelChunkPacket.setChunkX(packet.getX()); + levelChunkPacket.setChunkZ(packet.getZ()); + levelChunkPacket.setData(payload); + session.sendUpstreamPacket(levelChunkPacket); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java index baac1abc1..542b3002e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network.translators.world; +import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; +import com.github.steveice10.mc.protocol.data.game.chunk.palette.SingletonPalette; import com.github.steveice10.opennbt.tag.builtin.*; import it.unimi.dsi.fastutil.ints.Int2IntMap; import org.geysermc.connector.network.session.GeyserSession; @@ -98,33 +100,37 @@ public class BiomeTranslator { return bedrockData; } - public static BlockStorage toNewBedrockBiome(GeyserSession session, int[] biomeData, int ySection) { + public static BlockStorage toNewBedrockBiome(GeyserSession session, DataPalette biomeData) { Int2IntMap biomeTranslations = session.getBiomeTranslations(); // As of 1.17.10: the client expects the same format as a chunk but filled with biomes - BlockStorage storage = new BlockStorage(0); + // As of 1.18 this is the same as Java Edition - int biomeY = ySection << 2; - int javaOffsetY = biomeY << 4; - // Each section of biome corresponding to a chunk section contains 4 * 4 * 4 entries - for (int i = 0; i < 64; i++) { - int javaId = biomeData[javaOffsetY | i]; - int x = i & 3; - int y = (i >> 4) & 3; - int z = (i >> 2) & 3; - // Get the Bedrock biome ID override - int biomeId = biomeTranslations.get(javaId); - int idx = storage.idFor(biomeId); - // Convert biome coordinates into block coordinates - // Bedrock expects a full 4096 blocks - for (int blockX = x << 2; blockX < (x << 2) + 4; blockX++) { - for (int blockZ = z << 2; blockZ < (z << 2) + 4; blockZ++) { - for (int blockY = y << 2; blockY < (y << 2) + 4; blockY++) { - storage.getBitArray().set(ChunkSection.blockPosition(blockX, blockY, blockZ), idx); + if (biomeData.getPalette() instanceof SingletonPalette palette) { + int biomeId = biomeTranslations.get(palette.idToState(0)); + return new BlockStorage(biomeId); + } else { + BlockStorage storage = new BlockStorage(0); + + // Each section of biome corresponding to a chunk section contains 4 * 4 * 4 entries + for (int i = 0; i < 64; i++) { + int javaId = biomeData.getPalette().idToState(biomeData.getStorage().get(i)); + int x = i & 3; + int y = (i >> 4) & 3; + int z = (i >> 2) & 3; + // Get the Bedrock biome ID override + int biomeId = biomeTranslations.get(javaId); + int idx = storage.idFor(biomeId); + // Convert biome coordinates into block coordinates + // Bedrock expects a full 4096 blocks + for (int blockX = x << 2; blockX < (x << 2) + 4; blockX++) { + for (int blockZ = z << 2; blockZ < (z << 2) + 4; blockZ++) { + for (int blockY = y << 2; blockY < (y << 2) + 4; blockY++) { + storage.getBitArray().set(ChunkSection.blockPosition(blockX, blockY, blockZ), idx); + } } } } + return storage; } - - return storage; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java index 41843e96a..a9edb95be 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java @@ -42,11 +42,7 @@ public abstract class BlockEntityTranslator { public abstract void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState); - public NbtMap getBlockEntityTag(String id, CompoundTag tag, int blockState) { - int x = ((IntTag) tag.getValue().get("x")).getValue(); - int y = ((IntTag) tag.getValue().get("y")).getValue(); - int z = ((IntTag) tag.getValue().get("z")).getValue(); - + public NbtMap getBlockEntityTag(String id, int x, int y, int z, CompoundTag tag, int blockState) { NbtMapBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(id), x, y, z); translateTag(tagBuilder, tag, blockState); return tagBuilder.build(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserColumn.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserColumn.java index 3da5787a5..785616f44 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserColumn.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserColumn.java @@ -25,33 +25,21 @@ package org.geysermc.connector.network.translators.world.chunk; -import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; -import com.github.steveice10.mc.protocol.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; import lombok.Getter; -import org.geysermc.connector.network.session.cache.ChunkCache; /** - * Acts as a lightweight version of {@link Column} that doesn't store - * biomes or heightmaps. + * Acts as a lightweight chunk class that doesn't store biomes, heightmaps or block entities. */ public class GeyserColumn { @Getter - private final Chunk[] chunks; + private final DataPalette[] chunks; - private GeyserColumn(Chunk[] chunks) { + private GeyserColumn(DataPalette[] chunks) { this.chunks = chunks; } - public static GeyserColumn from(ChunkCache chunkCache, Column column) { - int chunkHeightY = chunkCache.getChunkHeightY(); - Chunk[] chunks; - if (chunkHeightY < column.getChunks().length) { - chunks = new Chunk[chunkHeightY]; - // TODO addresses https://github.com/Steveice10/MCProtocolLib/pull/598#issuecomment-862782392 - System.arraycopy(column.getChunks(), 0, chunks, 0, chunks.length); - } else { - chunks = column.getChunks(); - } + public static GeyserColumn from(DataPalette[] chunks) { return new GeyserColumn(chunks); } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index a8fc5f7f8..1a6952453 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -25,13 +25,10 @@ package org.geysermc.connector.utils; -import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; -import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; -import com.github.steveice10.mc.protocol.data.game.chunk.Column; -import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; -import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.opennbt.tag.builtin.*; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.DoubleTag; +import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.nukkitx.math.vector.Vector2i; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; @@ -40,27 +37,16 @@ import com.nukkitx.protocol.bedrock.packet.NetworkChunkPublisherUpdatePacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; import lombok.experimental.UtilityClass; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.entity.ItemFrameEntity; import org.geysermc.connector.entity.player.SkullPlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; import org.geysermc.connector.network.translators.world.chunk.BlockStorage; import org.geysermc.connector.network.translators.world.chunk.ChunkSection; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; import org.geysermc.connector.registry.BlockRegistries; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; - import static org.geysermc.connector.network.translators.world.block.BlockStateValues.JAVA_AIR_ID; @UtilityClass @@ -73,8 +59,8 @@ public class ChunkUtils { /** * The maximum chunk height Bedrock Edition will accept, from the lowest point to the highest. */ - private static final int MAXIMUM_ACCEPTED_HEIGHT = 256; - private static final int MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD = 384; + public static final int MAXIMUM_ACCEPTED_HEIGHT = 256; + public static final int MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD = 384; public static final byte[] EMPTY_CHUNK_DATA; public static final byte[] EMPTY_BIOME_DATA; @@ -106,200 +92,10 @@ public class ChunkUtils { } } - private static int indexYZXtoXZY(int yzx) { + public static int indexYZXtoXZY(int yzx) { return (yzx >> 8) | (yzx & 0x0F0) | ((yzx & 0x00F) << 8); } - public static ChunkData translateToBedrock(GeyserSession session, Column column, int yOffset) { - Chunk[] javaSections = column.getChunks(); - ChunkSection[] sections = new ChunkSection[javaSections.length - yOffset]; - - // Temporarily stores compound tags of Bedrock-only block entities - List bedrockOnlyBlockEntities = new ArrayList<>(); - - BitSet waterloggedPaletteIds = new BitSet(); - BitSet pistonOrFlowerPaletteIds = new BitSet(); - - boolean overworld = session.getChunkCache().isExtendedHeight(); - int maxBedrockSectionY = ((overworld ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT) >> 4) - 1; - - for (int sectionY = 0; sectionY < javaSections.length; sectionY++) { - int bedrockSectionY = sectionY + (yOffset - ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4)); - if (bedrockSectionY < 0 || maxBedrockSectionY < bedrockSectionY) { - // Ignore this chunk section since it goes outside the bounds accepted by the Bedrock client - continue; - } - - Chunk javaSection = javaSections[sectionY]; - - // No need to encode an empty section... - if (javaSection == null || javaSection.isEmpty()) { - continue; - } - - Palette javaPalette = javaSection.getPalette(); - BitStorage javaData = javaSection.getStorage(); - - if (javaPalette instanceof GlobalPalette) { - // As this is the global palette, simply iterate through the whole chunk section once - ChunkSection section = new ChunkSection(session.getBlockMappings().getBedrockAirId()); - for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { - int javaId = javaData.get(yzx); - int bedrockId = session.getBlockMappings().getBedrockBlockId(javaId); - int xzy = indexYZXtoXZY(yzx); - section.getBlockStorageArray()[0].setFullBlock(xzy, bedrockId); - - if (BlockRegistries.WATERLOGGED.get().contains(javaId)) { - section.getBlockStorageArray()[1].setFullBlock(xzy, session.getBlockMappings().getBedrockWaterId()); - } - - // Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock - if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) { - bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, - Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), - javaId - )); - } - } - sections[bedrockSectionY] = section; - continue; - } - - IntList bedrockPalette = new IntArrayList(javaPalette.size()); - waterloggedPaletteIds.clear(); - pistonOrFlowerPaletteIds.clear(); - - // Iterate through palette and convert state IDs to Bedrock, doing some additional checks as we go - for (int i = 0; i < javaPalette.size(); i++) { - int javaId = javaPalette.idToState(i); - bedrockPalette.add(session.getBlockMappings().getBedrockBlockId(javaId)); - - if (BlockRegistries.WATERLOGGED.get().contains(javaId)) { - waterloggedPaletteIds.set(i); - } - - // Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock - if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) { - pistonOrFlowerPaletteIds.set(i); - } - } - - // Add Bedrock-exclusive block entities - // We only if the palette contained any blocks that are Bedrock-exclusive block entities to avoid iterating through the whole block data - // for no reason, as most sections will not contain any pistons or flower pots - if (!pistonOrFlowerPaletteIds.isEmpty()) { - for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { - int paletteId = javaData.get(yzx); - if (pistonOrFlowerPaletteIds.get(paletteId)) { - bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, - Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), - javaPalette.idToState(paletteId) - )); - } - } - } - - BitArray bedrockData = BitArrayVersion.forBitsCeil(javaData.getBitsPerEntry()).createArray(BlockStorage.SIZE); - BlockStorage layer0 = new BlockStorage(bedrockData, bedrockPalette); - BlockStorage[] layers; - - // Convert data array from YZX to XZY coordinate order - if (waterloggedPaletteIds.isEmpty()) { - // No blocks are waterlogged, simply convert coordinate order - // This could probably be optimized further... - for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { - bedrockData.set(indexYZXtoXZY(yzx), javaData.get(yzx)); - } - - layers = new BlockStorage[]{ layer0 }; - } else { - // The section contains waterlogged blocks, we need to convert coordinate order AND generate a V1 block storage for - // layer 1 with palette ID 1 indicating water - int[] layer1Data = new int[BlockStorage.SIZE >> 5]; - for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { - int paletteId = javaData.get(yzx); - int xzy = indexYZXtoXZY(yzx); - bedrockData.set(xzy, paletteId); - - if (waterloggedPaletteIds.get(paletteId)) { - layer1Data[xzy >> 5] |= 1 << (xzy & 0x1F); - } - } - - // V1 palette - IntList layer1Palette = new IntArrayList(2); - layer1Palette.add(session.getBlockMappings().getBedrockAirId()); // Air - see BlockStorage's constructor for more information - layer1Palette.add(session.getBlockMappings().getBedrockWaterId()); - - layers = new BlockStorage[]{ layer0, new BlockStorage(BitArrayVersion.V1.createArray(BlockStorage.SIZE, layer1Data), layer1Palette) }; - } - - sections[bedrockSectionY] = new ChunkSection(layers); - } - - CompoundTag[] blockEntities = column.getTileEntities(); - NbtMap[] bedrockBlockEntities = new NbtMap[blockEntities.length + bedrockOnlyBlockEntities.size()]; - int i = 0; - while (i < blockEntities.length) { - CompoundTag tag = blockEntities[i]; - String tagName; - Tag idTag = tag.get("id"); - if (idTag != null) { - tagName = (String) idTag.getValue(); - } else { - tagName = "Empty"; - // Sometimes legacy tags have their ID be a StringTag with empty value - for (Tag subTag : tag) { - if (subTag instanceof StringTag stringTag) { - if (stringTag.getValue().isEmpty()) { - tagName = stringTag.getName(); - break; - } - } - } - if (tagName.equals("Empty")) { - GeyserConnector.getInstance().getLogger().debug("Got tag with no id: " + tag.getValue()); - } - } - - String id = BlockEntityUtils.getBedrockBlockEntityId(tagName); - int x = (int) tag.get("x").getValue(); - int y = (int) tag.get("y").getValue(); - int z = (int) tag.get("z").getValue(); - - // Get Java blockstate ID from block entity position - int blockState = 0; - Chunk section = column.getChunks()[(y >> 4) - yOffset]; - if (section != null) { - blockState = section.get(x & 0xF, y & 0xF, z & 0xF); - } - - if (tagName.equals("minecraft:lectern") && BlockStateValues.getLecternBookStates().get(blockState)) { - // If getLecternBookStates is false, let's just treat it like a normal block entity - bedrockBlockEntities[i] = session.getConnector().getWorldManager().getLecternDataAt(session, x, y, z, true); - i++; - continue; - } - - BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(id); - bedrockBlockEntities[i] = blockEntityTranslator.getBlockEntityTag(tagName, tag, blockState); - - // Check for custom skulls - if (session.getPreferencesCache().showCustomSkulls() && tag.contains("SkullOwner")) { - SkullBlockEntityTranslator.spawnPlayer(session, tag, blockState); - } - i++; - } - - // Append Bedrock-exclusive block entities to output array - for (NbtMap tag : bedrockOnlyBlockEntities) { - bedrockBlockEntities[i] = tag; - i++; - } - - return new ChunkData(sections, bedrockBlockEntities); - } - public static void updateChunkPosition(GeyserSession session, Vector3i position) { Vector2i chunkPos = session.getLastChunkPosition(); Vector2i newChunkPos = Vector2i.from(position.getX() >> 4, position.getZ() >> 4); From 363171b80cea01adbeb1f82309f0632f4f8c36cf Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 13 Nov 2021 23:52:11 -0500 Subject: [PATCH 677/766] Add BungeeCommandExecutor random changes and remove completed TODO --- .../bungeecord/command/GeyserBungeeCommandExecutor.java | 4 ---- .../java/level/JavaLevelChunkWithLightTranslator.java | 2 -- 2 files changed, 6 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index 44edeb336..ad15ead91 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -35,20 +35,16 @@ import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.Collections; public class GeyserBungeeCommandExecutor extends Command implements TabExecutor { - private final CommandExecutor commandExecutor; - private final GeyserConnector connector; public GeyserBungeeCommandExecutor(GeyserConnector connector) { super("geyser"); this.commandExecutor = new CommandExecutor(connector); - this.connector = connector; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java index b6e7880f0..9e1705846 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -82,8 +82,6 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator Date: Sat, 13 Nov 2021 23:07:24 -0600 Subject: [PATCH 678/766] Update to new renames in MCProtocolLib --- .../spigot/GeyserSpigotPingPassthrough.java | 4 +- .../platform/spigot/GeyserSpigotPlugin.java | 4 +- .../GeyserSpigot1_11CraftingListener.java | 4 +- .../GeyserSpigotLegacyNativeWorldManager.java | 4 +- .../manager/GeyserSpigotWorldManager.java | 4 +- .../sponge/GeyserSpongePingPassthrough.java | 4 +- .../geysermc/connector/GeyserConnector.java | 2 - .../command/defaults/StatisticsCommand.java | 4 +- .../command/defaults/VersionCommand.java | 8 +- .../org/geysermc/connector/dump/DumpInfo.java | 13 ++- .../connector/inventory/AnvilContainer.java | 6 +- .../connector/inventory/BeaconContainer.java | 6 +- .../inventory/CartographyContainer.java | 6 +- .../connector/inventory/Container.java | 6 +- .../inventory/EnchantingContainer.java | 6 +- .../inventory/Generic3X3Container.java | 6 +- .../connector/inventory/Inventory.java | 12 +-- .../connector/inventory/LecternContainer.java | 6 +- .../inventory/MerchantContainer.java | 8 +- .../inventory/StonecutterContainer.java | 6 +- .../network/ConnectorServerEventHandler.java | 8 +- ...ckProtocol.java => MinecraftProtocol.java} | 39 ++++++++- .../connector/network/QueryPacketHandler.java | 2 +- .../network/UpstreamPacketHandler.java | 8 +- .../network/session/GeyserSession.java | 4 +- .../session/cache/AdvancementsCache.java | 2 +- .../network/session/cache/BookEditCache.java | 2 +- .../network/session/cache/ChunkCache.java | 38 ++++----- .../BedrockBlockEntityDataTranslator.java | 2 +- .../bedrock/BedrockBookEditTranslator.java | 2 +- .../BedrockCommandBlockUpdateTranslator.java | 4 +- .../BedrockContainerCloseTranslator.java | 2 +- .../bedrock/BedrockFilterTextTranslator.java | 2 +- .../BedrockLecternUpdateTranslator.java | 4 +- .../bedrock/BedrockRespawnTranslator.java | 4 +- .../bedrock/BedrockShowCreditsTranslator.java | 4 +- .../entity/BedrockEntityEventTranslator.java | 4 +- .../inventory/InventoryTranslator.java | 54 ++++++------- .../translators/inventory/click/Click.java | 22 ++--- .../inventory/click/ClickPlan.java | 10 +-- .../translators/AnvilInventoryTranslator.java | 9 +-- .../translators/BaseInventoryTranslator.java | 6 +- .../BeaconInventoryTranslator.java | 11 ++- .../CartographyInventoryTranslator.java | 9 +-- .../EnchantingInventoryTranslator.java | 10 +-- .../Generic3X3InventoryTranslator.java | 11 ++- .../LecternInventoryTranslator.java | 10 +-- .../translators/LoomInventoryTranslator.java | 2 +- .../MerchantInventoryTranslator.java | 6 +- .../PlayerInventoryTranslator.java | 6 +- .../StonecutterInventoryTranslator.java | 11 ++- .../item/translators/BannerTranslator.java | 4 +- .../item/translators/CompassTranslator.java | 4 +- .../item/translators/PotionTranslator.java | 4 +- .../translators/TippedArrowTranslator.java | 6 +- .../java/entity/JavaAnimateTranslator.java | 2 +- .../JavaContainerCloseTranslator.java | 6 +- .../JavaContainerSetContentTranslator.java | 6 +- .../JavaContainerSetDataTranslator.java | 6 +- .../JavaContainerSetSlotTranslator.java | 10 +-- .../JavaHorseScreenOpenTranslator.java | 8 +- .../JavaMerchantOffersTranslator.java | 10 +-- .../JavaOpenScreenTranslator.java | 16 ++-- .../level/JavaBlockEntityDataTranslator.java | 4 +- .../java/level/JavaBlockUpdateTranslator.java | 24 +++--- .../java/level/JavaExplodeTranslator.java | 6 +- .../java/level/JavaGameEventTranslator.java | 4 +- ...=> JavaLevelChunkWithLightTranslator.java} | 31 ++++--- .../java/level/JavaLevelEventTranslator.java | 80 +++++++++---------- .../JavaSectionBlocksUpdateTranslator.java | 6 +- .../translators/world/BiomeTranslator.java | 4 +- .../entity/CampfireBlockEntityTranslator.java | 4 +- .../world/chunk/EmptyChunkProvider.java | 4 +- .../{GeyserColumn.java => GeyserChunk.java} | 26 +++--- ...nkSection.java => GeyserChunkSection.java} | 10 +-- .../event/LevelEventTransformer.java} | 8 +- .../event/PlaySoundEventTransformer.java} | 40 +--------- .../event/SoundEventEventTransformer.java} | 24 +----- .../event/SoundLevelEventTransformer.java} | 19 +---- .../ping/GeyserLegacyPingPassthrough.java | 4 +- .../connector/registry/Registries.java | 13 ++- .../loader/PotionMixRegistryLoader.java | 4 +- ...er.java => SoundEventsRegistryLoader.java} | 37 +++++---- .../populator/BlockRegistryPopulator.java | 4 +- .../registry/type/BlockMappings.java | 4 +- .../connector/registry/type/ItemMapping.java | 4 +- .../geysermc/connector/utils/ChunkUtils.java | 26 +++--- .../connector/utils/InventoryUtils.java | 4 +- .../geysermc/connector/utils/LocaleUtils.java | 4 +- 89 files changed, 435 insertions(+), 472 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/{BedrockProtocol.java => MinecraftProtocol.java} (71%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaContainerCloseTranslator.java (87%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaContainerSetContentTranslator.java (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaContainerSetDataTranslator.java (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaContainerSetSlotTranslator.java (97%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaHorseScreenOpenTranslator.java (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaMerchantOffersTranslator.java (95%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/{window => inventory}/JavaOpenScreenTranslator.java (88%) rename connector/src/main/java/org/geysermc/connector/network/translators/java/level/{JavaLevelChunkTranslator.java => JavaLevelChunkWithLightTranslator.java} (85%) rename connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/{GeyserColumn.java => GeyserChunk.java} (71%) rename connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/{ChunkSection.java => GeyserChunkSection.java} (94%) rename connector/src/main/java/org/geysermc/connector/network/translators/{effect/Effect.java => world/event/LevelEventTransformer.java} (86%) rename connector/src/main/java/org/geysermc/connector/network/translators/{effect/PlaySoundEffect.java => world/event/PlaySoundEventTransformer.java} (72%) rename connector/src/main/java/org/geysermc/connector/network/translators/{effect/SoundEventEffect.java => world/event/SoundEventEventTransformer.java} (82%) rename connector/src/main/java/org/geysermc/connector/network/translators/{effect/SoundLevelEffect.java => world/event/SoundLevelEventTransformer.java} (83%) rename connector/src/main/java/org/geysermc/connector/registry/loader/{SoundEffectsRegistryLoader.java => SoundEventsRegistryLoader.java} (68%) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java index c34d96db2..23e9554dc 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java @@ -25,13 +25,13 @@ package org.geysermc.platform.spigot; -import com.github.steveice10.mc.protocol.MinecraftConstants; import lombok.AllArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.util.CachedServerIcon; import org.geysermc.connector.common.ping.GeyserPingInfo; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.ping.IGeyserPingPassthrough; import javax.annotation.Nonnull; @@ -52,7 +52,7 @@ public class GeyserSpigotPingPassthrough implements IGeyserPingPassthrough { Bukkit.getPluginManager().callEvent(event); GeyserPingInfo geyserPingInfo = new GeyserPingInfo(event.getMotd(), new GeyserPingInfo.Players(event.getMaxPlayers(), event.getNumPlayers()), - new GeyserPingInfo.Version(Bukkit.getVersion(), MinecraftConstants.PROTOCOL_VERSION) // thanks Spigot for not exposing this, just default to latest + new GeyserPingInfo.Version(Bukkit.getVersion(), MinecraftProtocol.getJavaProtocolVersion()) // thanks Spigot for not exposing this, just default to latest ); Bukkit.getOnlinePlayers().stream().map(Player::getName).forEach(geyserPingInfo.getPlayerList()::add); return geyserPingInfo; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java index 38d3fb6c6..c7b732fe9 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java @@ -25,7 +25,6 @@ package org.geysermc.platform.spigot; -import com.github.steveice10.mc.protocol.MinecraftConstants; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.protocol.ProtocolPathEntry; @@ -39,6 +38,7 @@ import org.geysermc.connector.command.CommandManager; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.dump.BootstrapDumpInfo; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough; @@ -342,7 +342,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { */ private boolean isViaVersionNeeded() { ProtocolVersion serverVersion = getServerProtocolVersion(); - List protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftConstants.PROTOCOL_VERSION, + List protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(), serverVersion.getVersion()); if (protocolList == null) { // No translation needed! diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index 1fa5ef87b..726ffa66a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -25,7 +25,6 @@ package org.geysermc.platform.spigot.world; -import com.github.steveice10.mc.protocol.MinecraftConstants; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; @@ -48,6 +47,7 @@ import org.bukkit.inventory.Recipe; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.utils.InventoryUtils; @@ -73,7 +73,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { public GeyserSpigot1_11CraftingListener(GeyserConnector connector) { this.connector = connector; this.mappingData1_12to1_13 = Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getMappingData(); - this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftConstants.PROTOCOL_VERSION, + this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(), ProtocolVersion.v1_13.getVersion()); } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java index 253caf670..b187ab358 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java @@ -25,7 +25,6 @@ package org.geysermc.platform.spigot.world.manager; -import com.github.steveice10.mc.protocol.MinecraftConstants; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.MappingData; import com.viaversion.viaversion.api.protocol.ProtocolPathEntry; @@ -33,6 +32,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntList; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.platform.spigot.GeyserSpigotPlugin; @@ -50,7 +50,7 @@ public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorl IntList allBlockStates = adapter.getAllBlockStates(); oldToNewBlockId = new Int2IntOpenHashMap(allBlockStates.size()); ProtocolVersion serverVersion = plugin.getServerProtocolVersion(); - List protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftConstants.PROTOCOL_VERSION, + List protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(), serverVersion.getVersion()); for (int oldBlockId : allBlockStates) { int newBlockId = oldBlockId; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java index a0e97c51a..70ee86530 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -25,7 +25,6 @@ package org.geysermc.platform.spigot.world.manager; -import com.github.steveice10.mc.protocol.MinecraftConstants; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; @@ -39,6 +38,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.Plugin; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; import org.geysermc.connector.network.translators.world.GeyserWorldManager; @@ -57,7 +57,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { /** * The current client protocol version for ViaVersion usage. */ - protected static final int CLIENT_PROTOCOL_VERSION = MinecraftConstants.PROTOCOL_VERSION; + protected static final int CLIENT_PROTOCOL_VERSION = MinecraftProtocol.getJavaProtocolVersion(); private final Plugin plugin; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java index 8d63fca6e..a516bff8c 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java @@ -25,8 +25,8 @@ package org.geysermc.platform.sponge; -import com.github.steveice10.mc.protocol.MinecraftConstants; import org.geysermc.connector.common.ping.GeyserPingInfo; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.spongepowered.api.MinecraftVersion; import org.spongepowered.api.Sponge; @@ -73,7 +73,7 @@ public class GeyserSpongePingPassthrough implements IGeyserPingPassthrough { ), new GeyserPingInfo.Version( event.getResponse().getVersion().getName(), - MinecraftConstants.PROTOCOL_VERSION) // thanks for also not exposing this sponge + MinecraftProtocol.getJavaProtocolVersion()) // thanks for also not exposing this sponge ); event.getResponse().getPlayers().get().getProfiles().stream() .map(GameProfile::getName) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 21f457a62..fd2432a4c 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -28,7 +28,6 @@ package org.geysermc.connector; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.steveice10.mc.protocol.MinecraftConstants; import com.github.steveice10.packetlib.tcp.TcpSession; import com.nukkitx.network.raknet.RakNetConstants; import com.nukkitx.network.util.EventLoops; @@ -93,7 +92,6 @@ public class GeyserConnector { public static final String NAME = "Geyser"; public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs public static final String VERSION = "DEV"; // A fallback for running in IDEs - public static final String MINECRAFT_VERSION = MinecraftConstants.GAME_VERSION; // Change if multiple version strings are supported /** * Oauth client ID for Microsoft authentication diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java index 7c2c13816..f458e3003 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java @@ -25,7 +25,7 @@ package org.geysermc.connector.command.defaults; -import com.github.steveice10.mc.protocol.data.game.ClientRequest; +import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; @@ -43,7 +43,7 @@ public class StatisticsCommand extends GeyserCommand { if (session == null) return; session.setWaitingForStatistics(true); - ServerboundClientCommandPacket ServerboundClientCommandPacket = new ServerboundClientCommandPacket(ClientRequest.STATS); + ServerboundClientCommandPacket ServerboundClientCommandPacket = new ServerboundClientCommandPacket(ClientCommand.STATS); session.sendDownstreamPacket(ServerboundClientCommandPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java index c85759154..ab979ccff 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java @@ -31,7 +31,7 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.FileUtils; import org.geysermc.connector.utils.LanguageUtils; @@ -56,15 +56,15 @@ public class VersionCommand extends GeyserCommand { @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { String bedrockVersions; - List supportedCodecs = BedrockProtocol.SUPPORTED_BEDROCK_CODECS; + List supportedCodecs = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS; if (supportedCodecs.size() > 1) { bedrockVersions = supportedCodecs.get(0).getMinecraftVersion() + " - " + supportedCodecs.get(supportedCodecs.size() - 1).getMinecraftVersion(); } else { - bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion(); + bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion(); } sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), - GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions)); + GeyserConnector.NAME, GeyserConnector.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) { diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index 4d8eeefaf..c65bbbc51 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -27,7 +27,6 @@ package org.geysermc.connector.dump; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.JsonNode; -import com.github.steveice10.mc.protocol.MinecraftConstants; import com.google.common.hash.Hashing; import com.google.common.io.ByteSource; import com.google.common.io.Files; @@ -39,7 +38,7 @@ import lombok.Getter; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.common.serializer.AsteriskSerializer; import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.FileUtils; @@ -191,11 +190,11 @@ public class DumpInfo { private final int javaProtocol; MCInfo() { - this.bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList(); - this.bedrockProtocols = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList(); - this.defaultBedrockProtocol = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion(); - this.javaVersion = MinecraftConstants.GAME_VERSION; - this.javaProtocol = MinecraftConstants.PROTOCOL_VERSION; + this.bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList(); + this.bedrockProtocols = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList(); + this.defaultBedrockProtocol = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion(); + this.javaVersion = MinecraftProtocol.getJavaVersion(); + this.javaProtocol = MinecraftProtocol.getJavaProtocolVersion(); } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java index 71b5cbda9..cc9ebb2e8 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java @@ -25,13 +25,13 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; /** * Used to determine if rename packets should be sent. */ public class AnvilContainer extends Container { - public AnvilContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public AnvilContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java index 3798d9009..7f6463714 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.Setter; @@ -35,7 +35,7 @@ public class BeaconContainer extends Container { private int primaryId; private int secondaryId; - public BeaconContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public BeaconContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java index 0ac93b431..6743cd0c9 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java @@ -25,10 +25,10 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; public class CartographyContainer extends Container { - public CartographyContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public CartographyContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Container.java b/connector/src/main/java/org/geysermc/connector/inventory/Container.java index d61b2b71d..d992ba224 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/Container.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/Container.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; import org.geysermc.connector.network.session.GeyserSession; @@ -44,8 +44,8 @@ public class Container extends Inventory { */ private boolean isUsingRealBlock = false; - public Container(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType); + public Container(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType); this.playerInventory = playerInventory; this.containerSize = this.size + InventoryTranslator.PLAYER_INVENTORY_SIZE; } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java index e8c935649..985f293ac 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; @@ -41,8 +41,8 @@ public class EnchantingContainer extends Container { @Getter private final GeyserEnchantOption[] geyserEnchantOptions; - public EnchantingContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public EnchantingContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); enchantOptions = new EnchantOptionData[3]; geyserEnchantOptions = new GeyserEnchantOption[3]; diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java b/connector/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java index 080e11982..f709ad998 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import org.geysermc.connector.network.session.GeyserSession; @@ -38,8 +38,8 @@ public class Generic3X3Container extends Container { @Getter private boolean isDropper = false; - public Generic3X3Container(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public Generic3X3Container(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java index a9c8029a9..545585335 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; @@ -58,7 +58,7 @@ public class Inventory { * Used for smooth transitions between two windows of the same type. */ @Getter - protected final WindowType windowType; + protected final ContainerType containerType; @Getter @Setter @@ -81,15 +81,15 @@ public class Inventory { @Setter private boolean pending = false; - protected Inventory(int id, int size, WindowType windowType) { - this("Inventory", id, size, windowType); + protected Inventory(int id, int size, ContainerType containerType) { + this("Inventory", id, size, containerType); } - protected Inventory(String title, int id, int size, WindowType windowType) { + protected Inventory(String title, int id, int size, ContainerType containerType) { this.title = title; this.id = id; this.size = size; - this.windowType = windowType; + this.containerType = containerType; this.items = new GeyserItemStack[size]; Arrays.fill(items, GeyserItemStack.EMPTY); } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/LecternContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/LecternContainer.java index be1b8b34b..1a5ac635e 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/LecternContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/LecternContainer.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import lombok.Getter; @@ -39,7 +39,7 @@ public class LecternContainer extends Container { @Getter @Setter private Vector3i position; - public LecternContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public LecternContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java index 5941b2a7d..fd3be0bd2 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java @@ -25,8 +25,8 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.entity.Entity; @@ -37,7 +37,7 @@ public class MerchantContainer extends Container { private Entity villager; private VillagerTrade[] villagerTrades; - public MerchantContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public MerchantContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java index d558fab34..b818fe77d 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java @@ -25,7 +25,7 @@ package org.geysermc.connector.inventory; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; import lombok.Setter; @@ -39,8 +39,8 @@ public class StonecutterContainer extends Container { @Setter private int stonecutterButton = -1; - public StonecutterContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { - super(title, id, size, windowType, playerInventory); + public StonecutterContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { + super(title, id, size, containerType, playerInventory); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index 65f1d8d7d..bf7153319 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -50,7 +50,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { /* The following constants are all used to ensure the ping does not reach a length where it is unparsable by the Bedrock client */ - private static final int MINECRAFT_VERSION_BYTES_LENGTH = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length; + private static final int MINECRAFT_VERSION_BYTES_LENGTH = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length; private static final int BRAND_BYTES_LENGTH = GeyserConnector.NAME.getBytes(StandardCharsets.UTF_8).length; /** * The MOTD, sub-MOTD and Minecraft version ({@link #MINECRAFT_VERSION_BYTES_LENGTH}) combined cannot reach this length. @@ -104,8 +104,8 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { pong.setEdition("MCPE"); pong.setGameType("Survival"); // Can only be Survival or Creative as of 1.16.210.59 pong.setNintendoLimited(false); - pong.setProtocolVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()); - pong.setVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); // Required to not be empty as of 1.16.210.59. Can only contain . and numbers. + pong.setProtocolVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()); + pong.setVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); // Required to not be empty as of 1.16.210.59. Can only contain . and numbers. pong.setIpv4Port(config.getBedrock().getPort()); if (config.isPassthroughMotd() && pingInfo != null && pingInfo.getDescription() != null) { @@ -170,7 +170,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { bedrockServerSession.setCompressionLevel(connector.getConfig().getBedrock().getCompressionLevel()); bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession, eventLoopGroup.next()))); // Set the packet codec to default just in case we need to send disconnect packets. - bedrockServerSession.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC); + bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java similarity index 71% rename from connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java rename to connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java index fa95c8f37..3ef8a7bce 100644 --- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java @@ -25,6 +25,8 @@ package org.geysermc.connector.network; +import com.github.steveice10.mc.protocol.codec.MinecraftCodec; +import com.github.steveice10.mc.protocol.codec.PacketCodec; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; @@ -34,9 +36,9 @@ import java.util.List; import java.util.StringJoiner; /** - * Contains information about the supported Bedrock protocols in Geyser. + * Contains information about the supported protocols in Geyser. */ -public class BedrockProtocol { +public class MinecraftProtocol { /** * Default Bedrock codec that should act as a fallback. Should represent the latest available * release of the game that Geyser supports. @@ -47,6 +49,12 @@ public class BedrockProtocol { */ public static final List SUPPORTED_BEDROCK_CODECS = new ArrayList<>(); + /** + * Java codec that is supported. We only ever support one version for + * Java Edition. + */ + private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC; + static { SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC); SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC); @@ -66,6 +74,33 @@ public class BedrockProtocol { return null; } + /** + * Gets the {@link PacketCodec} for Minecraft: Java Edition. + * + * @return the packet codec for Minecraft: Java Edition + */ + public static PacketCodec getJavaCodec() { + return DEFAULT_JAVA_CODEC; + } + + /** + * Gets the supported Minecraft: Java Edition version name. + * + * @return the supported Minecraft: Java Edition version name + */ + public static String getJavaVersion() { + return DEFAULT_JAVA_CODEC.getMinecraftVersion(); + } + + /** + * Gets the supported Minecraft: Java Edition protocol version. + * + * @return the supported Minecraft: Java Edition protocol version + */ + public static int getJavaProtocolVersion() { + return DEFAULT_JAVA_CODEC.getProtocolVersion(); + } + /** * @return a string showing all supported versions for this Geyser instance */ diff --git a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java index 89e2669bb..7c696c36d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java @@ -175,7 +175,7 @@ public class QueryPacketHandler { gameData.put("hostname", motd); gameData.put("gametype", "SMP"); gameData.put("game_id", "MINECRAFT"); - gameData.put("version", GeyserConnector.NAME + " (" + GeyserConnector.GIT_VERSION + ") " + BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); + gameData.put("version", GeyserConnector.NAME + " (" + GeyserConnector.GIT_VERSION + ") " + MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); gameData.put("plugins", ""); gameData.put("map", map); gameData.put("numplayers", currentPlayerCount); diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index 4a51c9ca5..773f2cc5c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -66,15 +66,15 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { return true; } - BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(loginPacket.getProtocolVersion()); + BedrockPacketCodec packetCodec = MinecraftProtocol.getBedrockCodec(loginPacket.getProtocolVersion()); if (packetCodec == null) { - String supportedVersions = BedrockProtocol.getAllSupportedVersions(); - if (loginPacket.getProtocolVersion() > BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { + String supportedVersions = MinecraftProtocol.getAllSupportedVersions(); + if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { // Too early to determine session locale session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); return true; - } else if (loginPacket.getProtocolVersion() < BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { + } else if (loginPacket.getProtocolVersion() < MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); return true; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index c3836b4cf..33df29f9f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -34,7 +34,7 @@ import com.github.steveice10.mc.auth.service.MojangAuthenticationService; import com.github.steveice10.mc.auth.service.MsaAuthenticationService; import com.github.steveice10.mc.protocol.MinecraftConstants; import com.github.steveice10.mc.protocol.MinecraftProtocol; -import com.github.steveice10.mc.protocol.data.SubProtocol; +import com.github.steveice10.mc.protocol.data.ProtocolState; import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -1333,7 +1333,7 @@ public class GeyserSession implements CommandSender { } private void sendDownstreamPacket0(Packet packet) { - if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { + if (protocol.getState().equals(ProtocolState.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { downstream.send(packet); } else { connector.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java index 8831e140c..e53c2cd04 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.session.cache; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSeenAdvancementsPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java index 193a1d41a..69b56104c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.session.cache; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundEditBookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; import lombok.Setter; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java index 6154ff65f..1fd3ddd5e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java @@ -26,19 +26,19 @@ package org.geysermc.connector.network.session.cache; import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; -import com.github.steveice10.mc.protocol.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.chunk.GeyserColumn; +import org.geysermc.connector.network.translators.world.chunk.GeyserChunk; import org.geysermc.connector.utils.MathUtils; public class ChunkCache { private final boolean cache; - private final Long2ObjectMap chunks; + private final Long2ObjectMap chunks; @Setter private int minY; @@ -57,20 +57,20 @@ public class ChunkCache { chunks = cache ? new Long2ObjectOpenHashMap<>() : null; } - public void addToCache(Column chunk) { + public void addToCache(Chunk chunk) { if (!cache) { return; } long chunkPosition = MathUtils.chunkPositionToLong(chunk.getX(), chunk.getZ()); - GeyserColumn geyserColumn = GeyserColumn.from(this, chunk); - chunks.put(chunkPosition, geyserColumn); + GeyserChunk geyserChunk = GeyserChunk.from(this, chunk); + chunks.put(chunkPosition, geyserChunk); } /** * Doesn't check for cache enabled, so don't use this without checking that first! */ - private GeyserColumn getChunk(int chunkX, int chunkZ) { + private GeyserChunk getChunk(int chunkX, int chunkZ) { long chunkPosition = MathUtils.chunkPositionToLong(chunkX, chunkZ); return chunks.getOrDefault(chunkPosition, null); } @@ -80,31 +80,31 @@ public class ChunkCache { return; } - GeyserColumn column = this.getChunk(x >> 4, z >> 4); - if (column == null) { + GeyserChunk chunk = this.getChunk(x >> 4, z >> 4); + if (chunk == null) { return; } - if (y < minY || ((y - minY) >> 4) > column.getChunks().length - 1) { + if (y < minY || ((y - minY) >> 4) > chunk.getSections().length - 1) { // Y likely goes above or below the height limit of this world return; } - Chunk chunk = column.getChunks()[(y - minY) >> 4]; - if (chunk == null) { + ChunkSection section = chunk.getSections()[(y - minY) >> 4]; + if (section == null) { if (block != BlockStateValues.JAVA_AIR_ID) { // A previously empty chunk, which is no longer empty as a block has been added to it - chunk = new Chunk(); + section = new ChunkSection(); // Fixes the chunk assuming that all blocks is the `block` variable we are updating. /shrug - chunk.getPalette().stateToId(BlockStateValues.JAVA_AIR_ID); - column.getChunks()[(y - minY) >> 4] = chunk; + section.getPalette().stateToId(BlockStateValues.JAVA_AIR_ID); + chunk.getSections()[(y - minY) >> 4] = section; } else { // Nothing to update return; } } - chunk.set(x & 0xF, y & 0xF, z & 0xF, block); + section.set(x & 0xF, y & 0xF, z & 0xF, block); } public int getBlockAt(int x, int y, int z) { @@ -112,17 +112,17 @@ public class ChunkCache { return BlockStateValues.JAVA_AIR_ID; } - GeyserColumn column = this.getChunk(x >> 4, z >> 4); + GeyserChunk column = this.getChunk(x >> 4, z >> 4); if (column == null) { return BlockStateValues.JAVA_AIR_ID; } - if (y < minY || ((y - minY) >> 4) > column.getChunks().length - 1) { + if (y < minY || ((y - minY) >> 4) > column.getSections().length - 1) { // Y likely goes above or below the height limit of this world return BlockStateValues.JAVA_AIR_ID; } - Chunk chunk = column.getChunks()[(y - minY) >> 4]; + ChunkSection chunk = column.getSections()[(y - minY) >> 4]; if (chunk != null) { return chunk.get(x & 0xF, y & 0xF, z & 0xF); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java index 6f94085ae..df8ab45f8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetJigsawBlockPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetJigsawBlockPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java index 5fa6cd369..605afd0a1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundEditBookPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java index a64e9c784..509a7c865 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -27,8 +27,8 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandMinecartPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandBlockPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java index 3f1228b94..f08f9a4ea 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.MerchantContainer; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java index 32051c7c6..8abff259c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundRenameItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket; import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; import org.geysermc.connector.inventory.AnvilContainer; import org.geysermc.connector.inventory.CartographyContainer; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java index aeb670504..5c905dfe6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket; import org.geysermc.connector.inventory.LecternContainer; import org.geysermc.connector.network.session.GeyserSession; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java index 8a9fb5a3d..8a70ada6f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; -import com.github.steveice10.mc.protocol.data.game.ClientRequest; +import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; @@ -68,7 +68,7 @@ public class BedrockRespawnTranslator extends PacketTranslator { session.sendUpstreamPacket(movePlayerPacket); } - ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN); + ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java index 8feadb180..ffdfe4f35 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java @@ -29,7 +29,7 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; -import com.github.steveice10.mc.protocol.data.game.ClientRequest; +import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; @@ -39,7 +39,7 @@ public class BedrockShowCreditsTranslator extends PacketTranslator INVENTORY_TRANSLATORS = new HashMap<>() { + public static final Map INVENTORY_TRANSLATORS = new HashMap<>() { { /* Player Inventory */ put(null, PLAYER_INVENTORY_TRANSLATOR); /* Chest UIs */ - put(WindowType.GENERIC_9X1, new SingleChestInventoryTranslator(9)); - put(WindowType.GENERIC_9X2, new SingleChestInventoryTranslator(18)); - put(WindowType.GENERIC_9X3, new SingleChestInventoryTranslator(27)); - put(WindowType.GENERIC_9X4, new DoubleChestInventoryTranslator(36)); - put(WindowType.GENERIC_9X5, new DoubleChestInventoryTranslator(45)); - put(WindowType.GENERIC_9X6, new DoubleChestInventoryTranslator(54)); + put(ContainerType.GENERIC_9X1, new SingleChestInventoryTranslator(9)); + put(ContainerType.GENERIC_9X2, new SingleChestInventoryTranslator(18)); + put(ContainerType.GENERIC_9X3, new SingleChestInventoryTranslator(27)); + put(ContainerType.GENERIC_9X4, new DoubleChestInventoryTranslator(36)); + put(ContainerType.GENERIC_9X5, new DoubleChestInventoryTranslator(45)); + put(ContainerType.GENERIC_9X6, new DoubleChestInventoryTranslator(54)); /* Furnaces */ - put(WindowType.FURNACE, new FurnaceInventoryTranslator()); - put(WindowType.BLAST_FURNACE, new BlastFurnaceInventoryTranslator()); - put(WindowType.SMOKER, new SmokerInventoryTranslator()); + put(ContainerType.FURNACE, new FurnaceInventoryTranslator()); + put(ContainerType.BLAST_FURNACE, new BlastFurnaceInventoryTranslator()); + put(ContainerType.SMOKER, new SmokerInventoryTranslator()); /* Specific Inventories */ - put(WindowType.ANVIL, new AnvilInventoryTranslator()); - put(WindowType.BEACON, new BeaconInventoryTranslator()); - put(WindowType.BREWING_STAND, new BrewingInventoryTranslator()); - put(WindowType.CARTOGRAPHY, new CartographyInventoryTranslator()); - put(WindowType.CRAFTING, new CraftingInventoryTranslator()); - put(WindowType.ENCHANTMENT, new EnchantingInventoryTranslator()); - put(WindowType.HOPPER, new HopperInventoryTranslator()); - put(WindowType.GENERIC_3X3, new Generic3X3InventoryTranslator()); - put(WindowType.GRINDSTONE, new GrindstoneInventoryTranslator()); - put(WindowType.LOOM, new LoomInventoryTranslator()); - put(WindowType.MERCHANT, new MerchantInventoryTranslator()); - put(WindowType.SHULKER_BOX, new ShulkerInventoryTranslator()); - put(WindowType.SMITHING, new SmithingInventoryTranslator()); - put(WindowType.STONECUTTER, new StonecutterInventoryTranslator()); + put(ContainerType.ANVIL, new AnvilInventoryTranslator()); + put(ContainerType.BEACON, new BeaconInventoryTranslator()); + put(ContainerType.BREWING_STAND, new BrewingInventoryTranslator()); + put(ContainerType.CARTOGRAPHY, new CartographyInventoryTranslator()); + put(ContainerType.CRAFTING, new CraftingInventoryTranslator()); + put(ContainerType.ENCHANTMENT, new EnchantingInventoryTranslator()); + put(ContainerType.HOPPER, new HopperInventoryTranslator()); + put(ContainerType.GENERIC_3X3, new Generic3X3InventoryTranslator()); + put(ContainerType.GRINDSTONE, new GrindstoneInventoryTranslator()); + put(ContainerType.LOOM, new LoomInventoryTranslator()); + put(ContainerType.MERCHANT, new MerchantInventoryTranslator()); + put(ContainerType.SHULKER_BOX, new ShulkerInventoryTranslator()); + put(ContainerType.SMITHING, new SmithingInventoryTranslator()); + put(ContainerType.STONECUTTER, new StonecutterInventoryTranslator()); /* Lectern */ - put(WindowType.LECTERN, new LecternInventoryTranslator()); + put(ContainerType.LECTERN, new LecternInventoryTranslator()); } }; @@ -118,7 +118,7 @@ public abstract class InventoryTranslator { public abstract int javaSlotToBedrock(int javaSlot); public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot); public abstract SlotType getSlotType(int javaSlot); - public abstract Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory); + public abstract Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory); /** * Should be overwritten in cases where specific inventories should reject an item being in a specific spot. diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java index d3666a9e9..4c0ea7709 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java @@ -25,21 +25,23 @@ package org.geysermc.connector.network.translators.inventory.click; -import com.github.steveice10.mc.protocol.data.game.window.*; +import com.github.steveice10.mc.protocol.data.game.inventory.ClickItemAction; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType; +import com.github.steveice10.mc.protocol.data.game.inventory.*; import lombok.AllArgsConstructor; @AllArgsConstructor public enum Click { - LEFT(WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK), - RIGHT(WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK), - LEFT_SHIFT(WindowAction.SHIFT_CLICK_ITEM, ShiftClickItemParam.LEFT_CLICK), - DROP_ONE(WindowAction.DROP_ITEM, DropItemParam.DROP_FROM_SELECTED), - DROP_ALL(WindowAction.DROP_ITEM, DropItemParam.DROP_SELECTED_STACK), - LEFT_OUTSIDE(WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK), - RIGHT_OUTSIDE(WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK); + LEFT(ContainerActionType.CLICK_ITEM, ClickItemAction.LEFT_CLICK), + RIGHT(ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK), + LEFT_SHIFT(ContainerActionType.SHIFT_CLICK_ITEM, ShiftClickItemAction.LEFT_CLICK), + DROP_ONE(ContainerActionType.DROP_ITEM, DropItemAction.DROP_FROM_SELECTED), + DROP_ALL(ContainerActionType.DROP_ITEM, DropItemAction.DROP_SELECTED_STACK), + LEFT_OUTSIDE(ContainerActionType.CLICK_ITEM, ClickItemAction.LEFT_CLICK), + RIGHT_OUTSIDE(ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK); public static final int OUTSIDE_SLOT = -999; - public final WindowAction windowAction; - public final WindowActionParam actionParam; + public final ContainerActionType actionType; + public final ContainerAction action; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java index 9bcdb4ed2..d6063b98d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.inventory.click; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.window.WindowAction; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClickPacket; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; @@ -111,7 +111,7 @@ public class ClickPlan { ItemStack clickedItemStack; if (!planIter.hasNext() && refresh) { clickedItemStack = InventoryUtils.REFRESH_ITEM; - } else if (action.click.windowAction == WindowAction.DROP_ITEM || action.slot == Click.OUTSIDE_SLOT) { + } else if (action.click.actionType == ContainerActionType.DROP_ITEM || action.slot == Click.OUTSIDE_SLOT) { clickedItemStack = null; } else { clickedItemStack = getItem(action.slot).getItemStack(); @@ -126,8 +126,8 @@ public class ClickPlan { inventory.getId(), inventory.getStateId(), action.slot, - action.click.windowAction, - action.click.actionParam, + action.click.actionType, + action.click.action, clickedItemStack, affectedSlots ); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java index 9aef64b36..c4d7195c6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java @@ -25,9 +25,8 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.connector.inventory.AnvilContainer; import org.geysermc.connector.inventory.Inventory; @@ -37,7 +36,7 @@ import org.geysermc.connector.network.translators.inventory.updater.UIInventoryU public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { public AnvilInventoryTranslator() { - super(3, "minecraft:anvil[facing=north]", ContainerType.ANVIL, UIInventoryUpdater.INSTANCE, + super(3, "minecraft:anvil[facing=north]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.ANVIL, UIInventoryUpdater.INSTANCE, "minecraft:chipped_anvil", "minecraft:damaged_anvil"); } @@ -72,7 +71,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new AnvilContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new AnvilContainer(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java index 5b3be5b27..4211e9902 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.connector.inventory.Container; @@ -95,7 +95,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator { } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new Container(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new Container(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java index a940e0dd9..2fb26847a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java @@ -25,13 +25,12 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetBeaconPacket; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetBeaconPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.BeaconPaymentStackRequestActionData; @@ -53,7 +52,7 @@ import java.util.Collections; public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator { public BeaconInventoryTranslator() { - super(1, new BlockInventoryHolder("minecraft:beacon", ContainerType.BEACON) { + super(1, new BlockInventoryHolder("minecraft:beacon", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.BEACON) { @Override protected boolean checkInteractionPosition(GeyserSession session) { // Since we can't fall back to a virtual inventory, let's make opening one easier @@ -144,7 +143,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new BeaconContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new BeaconContainer(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java index ef00f9343..3d9520a0a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java @@ -25,9 +25,8 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.connector.inventory.CartographyContainer; import org.geysermc.connector.inventory.GeyserItemStack; @@ -39,7 +38,7 @@ import org.geysermc.connector.network.translators.inventory.updater.UIInventoryU public class CartographyInventoryTranslator extends AbstractBlockInventoryTranslator { public CartographyInventoryTranslator() { - super(3, "minecraft:cartography_table", ContainerType.CARTOGRAPHY, UIInventoryUpdater.INSTANCE); + super(3, "minecraft:cartography_table", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.CARTOGRAPHY, UIInventoryUpdater.INSTANCE); } @Override @@ -88,7 +87,7 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new CartographyContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new CartographyContainer(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java index 99bdcf204..18254dee5 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData; @@ -47,7 +47,7 @@ import java.util.Collections; public class EnchantingInventoryTranslator extends AbstractBlockInventoryTranslator { public EnchantingInventoryTranslator() { - super(2, "minecraft:enchanting_table", ContainerType.ENCHANTMENT, UIInventoryUpdater.INSTANCE); + super(2, "minecraft:enchanting_table", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.ENCHANTMENT, UIInventoryUpdater.INSTANCE); } @Override @@ -167,7 +167,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new EnchantingContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new EnchantingContainer(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java index ceac1b2c1..a77716c91 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java @@ -25,9 +25,8 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.connector.inventory.Generic3X3Container; import org.geysermc.connector.inventory.Inventory; @@ -41,13 +40,13 @@ import org.geysermc.connector.network.translators.inventory.updater.ContainerInv */ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTranslator { public Generic3X3InventoryTranslator() { - super(9, "minecraft:dispenser[facing=north,triggered=false]", ContainerType.DISPENSER, ContainerInventoryUpdater.INSTANCE, + super(9, "minecraft:dispenser[facing=north,triggered=false]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DISPENSER, ContainerInventoryUpdater.INSTANCE, "minecraft:dropper"); } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new Generic3X3Container(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new Generic3X3Container(name, windowId, this.size, containerType, playerInventory); } @Override @@ -55,7 +54,7 @@ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTransla ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); // Required for opening the real block - otherwise, if the container type is incorrect, it refuses to open - containerOpenPacket.setType(((Generic3X3Container) inventory).isDropper() ? ContainerType.DROPPER : ContainerType.DISPENSER); + containerOpenPacket.setType(((Generic3X3Container) inventory).isDropper() ? com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DROPPER : com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DISPENSER); containerOpenPacket.setBlockPosition(inventory.getHolderPosition()); containerOpenPacket.setUniqueEntityId(inventory.getHolderId()); session.sendUpstreamPacket(containerOpenPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java index 2bdf0cd0d..cc94ffff3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java @@ -25,9 +25,9 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.nukkitx.math.vector.Vector3i; @@ -158,8 +158,8 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new LecternContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new LecternContainer(name, windowId, this.size, containerType, playerInventory); } public static NbtMapBuilder getBaseLecternTag(int x, int y, int z, int totalPages) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java index 5210193ee..bc2991f7f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.nukkitx.nbt.NbtMap; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java index ef6e30494..5f20a9d03 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.inventory.translators; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; @@ -149,7 +149,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new MerchantContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new MerchantContainer(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java index 65bfc50cd..fa54b1223 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java @@ -27,8 +27,8 @@ package org.geysermc.connector.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCreativeModeSlotPacket; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket; import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; @@ -465,7 +465,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { throw new UnsupportedOperationException(); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java index d1373b34a..3c508b851 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java @@ -26,10 +26,9 @@ package org.geysermc.connector.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.window.WindowType; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket; +import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData; @@ -49,7 +48,7 @@ import org.geysermc.connector.network.translators.item.ItemTranslator; public class StonecutterInventoryTranslator extends AbstractBlockInventoryTranslator { public StonecutterInventoryTranslator() { - super(2, "minecraft:stonecutter[facing=north]", ContainerType.STONECUTTER, UIInventoryUpdater.INSTANCE); + super(2, "minecraft:stonecutter[facing=north]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.STONECUTTER, UIInventoryUpdater.INSTANCE); } @Override @@ -131,7 +130,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) { - return new StonecutterContainer(name, windowId, this.size, windowType, playerInventory); + public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) { + return new StonecutterContainer(name, windowId, this.size, containerType, playerInventory); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java index e85426647..d00bf9d40 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.registry.Registries; @@ -81,7 +81,7 @@ public class BannerTranslator extends ItemTranslator { } public BannerTranslator() { - appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) + appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) .getItems() .values() .stream() diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java index 13780ac49..cf2e90fdf 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.item.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.registry.Registries; @@ -44,7 +44,7 @@ public class CompassTranslator extends ItemTranslator { private final List appliedItems; public CompassTranslator() { - appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) + appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) .getItems() .values() .stream() diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java index 2908754aa..82e8fb6b8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.network.translators.item.Potion; @@ -47,7 +47,7 @@ public class PotionTranslator extends ItemTranslator { private final List appliedItems; public PotionTranslator() { - appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) + appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) .getItems() .values() .stream() diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java index ebc3936de..575f3ba74 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.item.TippedArrowPotion; @@ -46,12 +46,12 @@ public class TippedArrowTranslator extends ItemTranslator { private final List appliedItems; - private static final int TIPPED_ARROW_JAVA_ID = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) + private static final int TIPPED_ARROW_JAVA_ID = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) .getMapping("minecraft:tipped_arrow") .getJavaId(); public TippedArrowTranslator() { - appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) + appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) .getItems() .values() .stream() diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java index 11fec73b3..68e374d37 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java @@ -56,7 +56,7 @@ public class JavaAnimateTranslator extends PacketTranslator updateCraftingGrid(session, packet, inventory, translator), 150, TimeUnit.MILLISECONDS)); GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); - if (packet.getWindowId() == 0 && !(translator instanceof PlayerInventoryTranslator)) { + if (packet.getContainerId() == 0 && !(translator instanceof PlayerInventoryTranslator)) { // In rare cases, the window ID can still be 0 but Java treats it as valid session.getPlayerInventory().setItem(packet.getSlot(), newItem, session); InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR.updateSlot(session, session.getPlayerInventory(), packet.getSlot()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaHorseScreenOpenTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java similarity index 95% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaHorseScreenOpenTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java index ec1b0ccb3..7eb00ea65 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/window/JavaHorseScreenOpenTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.window; +package org.geysermc.connector.network.translators.java.inventory; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundHorseScreenOpenPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; @@ -105,7 +105,7 @@ public class JavaHorseScreenOpenTranslator extends PacketTranslator= 2 && + if (packet.getType() == BlockEntityType.COMMAND_BLOCK && session.getOpPermissionLevel() >= 2 && session.getGameMode() == GameMode.CREATIVE && packet.getNbt().size() > 5) { ContainerOpenPacket openPacket = new ContainerOpenPacket(); openPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java index 67174434a..f0042ae00 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java @@ -43,10 +43,10 @@ public class JavaBlockUpdateTranslator extends PacketTranslator { - ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN); + ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); } case FIRST_TIME -> { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java similarity index 85% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java rename to connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java index 7a13198a2..700742888 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -25,8 +25,8 @@ package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.chunk.Column; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkPacket; +import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket; import com.nukkitx.nbt.NBTOutputStream; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; @@ -35,12 +35,11 @@ import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufOutputStream; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.world.BiomeTranslator; -import org.geysermc.connector.network.translators.world.chunk.ChunkSection; +import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import org.geysermc.connector.utils.ChunkUtils; import java.io.IOException; @@ -48,23 +47,23 @@ import java.io.IOException; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT; import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD; -@Translator(packet = ClientboundLevelChunkPacket.class) -public class JavaLevelChunkTranslator extends PacketTranslator { +@Translator(packet = ClientboundLevelChunkWithLightPacket.class) +public class JavaLevelChunkWithLightTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelChunkPacket packet) { + public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacket packet) { if (session.isSpawned()) { ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); } - session.getChunkCache().addToCache(packet.getColumn()); - Column column = packet.getColumn(); + session.getChunkCache().addToCache(packet.getChunk()); + Chunk chunk = packet.getChunk(); // Ensure that, if the player is using lower world heights, the position is not offset int yOffset = session.getChunkCache().getChunkMinY(); - ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, column, yOffset); - ChunkSection[] sections = chunkData.sections(); + ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, chunk, yOffset); + GeyserChunkSection[] sections = chunkData.sections(); // Find highest section int sectionCount = sections.length - 1; @@ -76,7 +75,7 @@ public class JavaLevelChunkTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH); - ComposterEffectData composterEffectData = (ComposterEffectData) packet.getData(); + ComposterEventData composterEventData = (ComposterEventData) packet.getData(); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); - switch (composterEffectData) { + switch (composterEventData) { case FILL -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL); case FILL_SUCCESS -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL_LAYER); } @@ -153,9 +160,9 @@ public class JavaLevelEventTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_SHOOT); - SmokeEffectData smokeEffectData = (SmokeEffectData) packet.getData(); + SmokeEventData smokeEventData = (SmokeEventData) packet.getData(); int data = 0; - switch (smokeEffectData) { + switch (smokeEventData) { case DOWN -> { data = 4; pos = pos.add(0, -0.9f, 0); @@ -189,14 +196,14 @@ public class JavaLevelEventTranslator extends PacketTranslator { effectPacket.setType(LevelEventType.PARTICLE_DESTROY_BLOCK); - BreakBlockEffectData breakBlockEffectData = (BreakBlockEffectData) packet.getData(); - effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEffectData.getBlockState())); + BreakBlockEventData breakBlockEventData = (BreakBlockEventData) packet.getData(); + effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEventData.getBlockState())); } case BREAK_SPLASH_POTION -> { effectPacket.setType(LevelEventType.PARTICLE_POTION_SPLASH); effectPacket.setPosition(pos.add(0, -0.5f, 0)); - BreakPotionEffectData splashPotionData = (BreakPotionEffectData) packet.getData(); + BreakPotionEventData splashPotionData = (BreakPotionEventData) packet.getData(); effectPacket.setData(splashPotionData.getPotionId()); LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); @@ -211,17 +218,17 @@ public class JavaLevelEventTranslator extends PacketTranslator effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); case MOB_SPAWN -> effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java case BONEMEAL_GROW_WITH_SOUND, BONEMEAL_GROW -> { - effectPacket.setType((particleEffect == ParticleEffect.BONEMEAL_GROW + effectPacket.setType((particleEvent == ParticleEvent.BONEMEAL_GROW && session.getUpstream().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion()) ? LevelEventType.PARTICLE_TURTLE_EGG : LevelEventType.PARTICLE_CROP_GROWTH); - BonemealGrowEffectData growEffectData = (BonemealGrowEffectData) packet.getData(); - effectPacket.setData(growEffectData.getParticleCount()); + BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData(); + effectPacket.setData(growEventData.getParticleCount()); } case ENDERDRAGON_FIREBALL_EXPLODE -> { effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); // TODO - DragonFireballEffectData fireballEffectData = (DragonFireballEffectData) packet.getData(); - if (fireballEffectData == DragonFireballEffectData.HAS_SOUND) { + DragonFireballEventData fireballEventData = (DragonFireballEventData) packet.getData(); + if (fireballEventData == DragonFireballEventData.HAS_SOUND) { LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); soundEventPacket.setSound(SoundEvent.EXPLODE); soundEventPacket.setPosition(pos); @@ -252,24 +259,13 @@ public class JavaLevelEventTranslator extends PacketTranslator { - effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP); - } - case ELECTRIC_SPARK -> { - // Matches with a Bedrock server but doesn't seem to match up with Java - effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK); - } - case WAX_ON -> { - effectPacket.setType(LevelEventType.PARTICLE_WAX_ON); - } - case WAX_OFF -> { - effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF); - } - case SCRAPE -> { - effectPacket.setType(LevelEventType.PARTICLE_SCRAPE); - } + case DRIPSTONE_DRIP -> effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP); + case ELECTRIC_SPARK -> effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK); // Matches with a Bedrock server but doesn't seem to match up with Java + case WAX_ON -> effectPacket.setType(LevelEventType.PARTICLE_WAX_ON); + case WAX_OFF -> effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF); + case SCRAPE -> effectPacket.setType(LevelEventType.PARTICLE_SCRAPE); default -> { - GeyserConnector.getInstance().getLogger().debug("Unhandled particle effect: " + particleEffect.name()); + GeyserConnector.getInstance().getLogger().debug("Unhandled particle event: " + particleEvent.name()); return; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java index 0a94fe1f8..11958b832 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.connector.network.translators.java.level; -import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeRecord; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -37,8 +37,8 @@ public class JavaSectionBlocksUpdateTranslator extends PacketTranslator> RECIPES = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); /** - * A mapped registry holding the available records, with the ID of the record being the key, and the {@link SoundEvent} + * A mapped registry holding the available records, with the ID of the record being the key, and the {@link com.nukkitx.protocol.bedrock.data.SoundEvent} * as the value. */ - public static final SimpleMappedRegistry RECORDS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + public static final SimpleMappedRegistry RECORDS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); /** * A mapped registry holding sound identifiers to their corresponding {@link SoundMapping}. @@ -121,9 +120,9 @@ public class Registries { public static final SimpleMappedRegistry SOUNDS = SimpleMappedRegistry.create("mappings/sounds.json", SoundRegistryLoader::new); /** - * A mapped registry holding {@link SoundEffect}s to their corresponding {@link Effect}. + * A mapped registry holding {@link SoundEvent}s to their corresponding {@link LevelEventTransformer}. */ - public static final SimpleMappedRegistry SOUND_EFFECTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEffectsRegistryLoader::new); + public static final SimpleMappedRegistry SOUND_EVENTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEventsRegistryLoader::new); /** * A mapped registry holding {@link SoundHandler}s to their corresponding {@link SoundInteractionHandler}. diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java index 7c43a21fd..0eff07bb2 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java @@ -26,7 +26,7 @@ package org.geysermc.connector.registry.loader; import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.network.translators.item.Potion; @@ -103,7 +103,7 @@ public class PotionMixRegistryLoader implements RegistryLoader> { +public class SoundEventsRegistryLoader extends EffectRegistryLoader> { @Override - public Map load(String input) { + public Map load(String input) { this.loadFile(input); Iterator> effectsIterator = this.get(input).fields(); - Map soundEffects = new Object2ObjectOpenHashMap<>(); + Map soundEffects = new Object2ObjectOpenHashMap<>(); while (effectsIterator.hasNext()) { Map.Entry entry = effectsIterator.next(); JsonNode node = entry.getValue(); try { String type = node.get("type").asText(); - SoundEffect javaEffect = null; - Effect effect = null; + SoundEvent javaEffect = null; + LevelEventTransformer transformer = null; switch (type) { case "soundLevel" -> { - javaEffect = SoundEffect.valueOf(entry.getKey()); + javaEffect = SoundEvent.valueOf(entry.getKey()); LevelEventType levelEventType = LevelEventType.valueOf(node.get("name").asText()); int data = node.has("data") ? node.get("data").intValue() : 0; - effect = new SoundLevelEffect(levelEventType, data); + transformer = new SoundLevelEventTransformer(levelEventType, data); } case "soundEvent" -> { - javaEffect = SoundEffect.valueOf(entry.getKey()); - SoundEvent soundEvent = SoundEvent.valueOf(node.get("name").asText()); + javaEffect = SoundEvent.valueOf(entry.getKey()); + com.nukkitx.protocol.bedrock.data.SoundEvent soundEvent = com.nukkitx.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText()); String identifier = node.has("identifier") ? node.get("identifier").asText() : ""; int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1; - effect = new SoundEventEffect(soundEvent, identifier, extraData); + transformer = new SoundEventEventTransformer(soundEvent, identifier, extraData); } case "playSound" -> { - javaEffect = SoundEffect.valueOf(entry.getKey()); + javaEffect = SoundEvent.valueOf(entry.getKey()); String name = node.get("name").asText(); float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f; boolean pitchSub = node.has("pitch_sub") && node.get("pitch_sub").booleanValue(); float pitchMul = node.has("pitch_mul") ? node.get("pitch_mul").floatValue() : 1.0f; float pitchAdd = node.has("pitch_add") ? node.get("pitch_add").floatValue() : 0.0f; boolean relative = !node.has("relative") || node.get("relative").booleanValue(); - effect = new PlaySoundEffect(name, volume, pitchSub, pitchMul, pitchAdd, relative); + transformer = new PlaySoundEventTransformer(name, volume, pitchSub, pitchMul, pitchAdd, relative); } } if (javaEffect != null) { - soundEffects.put(javaEffect, effect); + soundEffects.put(javaEffect, transformer); } } catch (Exception e) { GeyserConnector.getInstance().getLogger().warning("Failed to map sound effect " + entry.getKey() + " : " + e.toString()); diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index 30cd7c1cc..a4388388a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -39,7 +39,7 @@ import it.unimi.dsi.fastutil.objects.ObjectIntPair; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.network.translators.world.chunk.BlockStorage; -import org.geysermc.connector.network.translators.world.chunk.ChunkSection; +import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.registry.type.BlockMappings; @@ -200,7 +200,7 @@ public class BlockRegistryPopulator { builder.bedrockBlockStates(blocksTag); BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion) - .emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) + .emptyChunkSection(new GeyserChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) .javaToBedrockBlocks(javaToBedrockBlocks) .javaIdentifierToBedrockTag(javaIdentifierToBedrockTag) .itemFrames(itemFrames) diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java index 0c92d6a4c..c07f2edfa 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java @@ -31,7 +31,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Builder; import lombok.Value; -import org.geysermc.connector.network.translators.world.chunk.ChunkSection; +import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import java.util.Map; @@ -44,7 +44,7 @@ public class BlockMappings { int blockStateVersion; - ChunkSection emptyChunkSection; + GeyserChunkSection emptyChunkSection; int[] javaToBedrockBlocks; diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java b/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java index fff00950b..4da25893f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java @@ -28,7 +28,7 @@ package org.geysermc.connector.registry.type; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Value; -import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.MinecraftProtocol; import org.geysermc.connector.registry.BlockRegistries; @Value @@ -36,7 +36,7 @@ import org.geysermc.connector.registry.BlockRegistries; @EqualsAndHashCode public class ItemMapping { public static final ItemMapping AIR = new ItemMapping("minecraft:air", "minecraft:air", 0, 0, 0, - BlockRegistries.BLOCKS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(), + BlockRegistries.BLOCKS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(), 64, null, null, null); String javaIdentifier; diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index a8fc5f7f8..6532d3452 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -27,7 +27,7 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; -import com.github.steveice10.mc.protocol.data.game.chunk.Column; +import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection; import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; @@ -52,7 +52,7 @@ import org.geysermc.connector.network.translators.world.block.entity.BedrockOnly import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; import org.geysermc.connector.network.translators.world.chunk.BlockStorage; -import org.geysermc.connector.network.translators.world.chunk.ChunkSection; +import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; import org.geysermc.connector.registry.BlockRegistries; @@ -110,9 +110,9 @@ public class ChunkUtils { return (yzx >> 8) | (yzx & 0x0F0) | ((yzx & 0x00F) << 8); } - public static ChunkData translateToBedrock(GeyserSession session, Column column, int yOffset) { - Chunk[] javaSections = column.getChunks(); - ChunkSection[] sections = new ChunkSection[javaSections.length - yOffset]; + public static ChunkData translateToBedrock(GeyserSession session, Chunk chunk, int yOffset) { + ChunkSection[] javaSections = chunk.getSections(); + GeyserChunkSection[] sections = new GeyserChunkSection[javaSections.length - yOffset]; // Temporarily stores compound tags of Bedrock-only block entities List bedrockOnlyBlockEntities = new ArrayList<>(); @@ -130,7 +130,7 @@ public class ChunkUtils { continue; } - Chunk javaSection = javaSections[sectionY]; + ChunkSection javaSection = javaSections[sectionY]; // No need to encode an empty section... if (javaSection == null || javaSection.isEmpty()) { @@ -142,7 +142,7 @@ public class ChunkUtils { if (javaPalette instanceof GlobalPalette) { // As this is the global palette, simply iterate through the whole chunk section once - ChunkSection section = new ChunkSection(session.getBlockMappings().getBedrockAirId()); + GeyserChunkSection section = new GeyserChunkSection(session.getBlockMappings().getBedrockAirId()); for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) { int javaId = javaData.get(yzx); int bedrockId = session.getBlockMappings().getBedrockBlockId(javaId); @@ -156,7 +156,7 @@ public class ChunkUtils { // Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) { bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, - Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), + Vector3i.from((chunk.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (chunk.getZ() << 4) + ((yzx >> 4) & 0xF)), javaId )); } @@ -192,7 +192,7 @@ public class ChunkUtils { int paletteId = javaData.get(yzx); if (pistonOrFlowerPaletteIds.get(paletteId)) { bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session, - Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)), + Vector3i.from((chunk.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (chunk.getZ() << 4) + ((yzx >> 4) & 0xF)), javaPalette.idToState(paletteId) )); } @@ -234,10 +234,10 @@ public class ChunkUtils { layers = new BlockStorage[]{ layer0, new BlockStorage(BitArrayVersion.V1.createArray(BlockStorage.SIZE, layer1Data), layer1Palette) }; } - sections[bedrockSectionY] = new ChunkSection(layers); + sections[bedrockSectionY] = new GeyserChunkSection(layers); } - CompoundTag[] blockEntities = column.getTileEntities(); + CompoundTag[] blockEntities = chunk.getBlockEntities(); NbtMap[] bedrockBlockEntities = new NbtMap[blockEntities.length + bedrockOnlyBlockEntities.size()]; int i = 0; while (i < blockEntities.length) { @@ -269,7 +269,7 @@ public class ChunkUtils { // Get Java blockstate ID from block entity position int blockState = 0; - Chunk section = column.getChunks()[(y >> 4) - yOffset]; + ChunkSection section = chunk.getSections()[(y >> 4) - yOffset]; if (section != null) { blockState = section.get(x & 0xF, y & 0xF, z & 0xF); } @@ -453,6 +453,6 @@ public class ChunkUtils { session.getWorldBorder().setWorldCoordinateScale(coordinateScale); } - public record ChunkData(ChunkSection[] sections, NbtMap[] blockEntities) { + public record ChunkData(GeyserChunkSection[] sections, NbtMap[] blockEntities) { } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java index 3d61d428a..c046865f8 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java @@ -27,8 +27,8 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundPickItemPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCreativeModeSlotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; diff --git a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java index 10fb4ba85..623c4ba84 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java @@ -28,9 +28,9 @@ package org.geysermc.connector.utils; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; -import com.github.steveice10.mc.protocol.MinecraftConstants; import lombok.Getter; import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.network.MinecraftProtocol; import java.io.*; import java.nio.file.Files; @@ -69,7 +69,7 @@ public class LocaleUtils { // Get the url for the latest version of the games manifest String latestInfoURL = ""; for (Version version : versionManifest.getVersions()) { - if (version.getId().equals(MinecraftConstants.GAME_VERSION)) { + if (version.getId().equals(MinecraftProtocol.getJavaVersion())) { latestInfoURL = version.getUrl(); break; } From 15f26999dd06c7d1ba0cdda8ddd68a5d10688ab4 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 14 Nov 2021 12:06:07 -0500 Subject: [PATCH 679/766] Update to new block entity changes --- .../ShulkerInventoryTranslator.java | 3 +- .../level/JavaBlockEntityDataTranslator.java | 17 +++----- .../JavaLevelChunkWithLightTranslator.java | 39 +++---------------- .../world/block/BlockStateValues.java | 5 ++- .../world/block/DoubleChestValue.java | 32 +++++++-------- .../entity/BannerBlockEntityTranslator.java | 3 +- .../entity/BeaconBlockEntityTranslator.java | 3 +- .../entity/BedBlockEntityTranslator.java | 3 +- .../world/block/entity/BlockEntity.java | 8 ++-- .../block/entity/BlockEntityTranslator.java | 5 ++- .../entity/CampfireBlockEntityTranslator.java | 3 +- .../CommandBlockBlockEntityTranslator.java | 3 +- .../DoubleChestBlockEntityTranslator.java | 21 +++++----- .../entity/EmptyBlockEntityTranslator.java | 1 - .../EndGatewayBlockEntityTranslator.java | 3 +- .../JigsawBlockBlockEntityTranslator.java | 3 +- .../ShulkerBoxBlockEntityTranslator.java | 3 +- .../entity/SignBlockEntityTranslator.java | 3 +- .../entity/SkullBlockEntityTranslator.java | 3 +- .../entity/SpawnerBlockEntityTranslator.java | 7 +++- .../connector/registry/Registries.java | 3 +- .../loader/BlockEntityRegistryLoader.java | 30 ++++++++++++-- .../connector/utils/BlockEntityUtils.java | 37 +++++++----------- 23 files changed, 117 insertions(+), 121 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java index 4f28d0e4e..7dafb862a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java @@ -25,6 +25,7 @@ package org.geysermc.connector.network.translators.inventory.translators; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; @@ -42,7 +43,7 @@ import org.geysermc.connector.registry.Registries; public class ShulkerInventoryTranslator extends AbstractBlockInventoryTranslator { public ShulkerInventoryTranslator() { super(27, new BlockInventoryHolder("minecraft:shulker_box[facing=north]", ContainerType.CONTAINER) { - private final BlockEntityTranslator shulkerBoxTranslator = Registries.BLOCK_ENTITIES.get("ShulkerBox"); + private final BlockEntityTranslator shulkerBoxTranslator = Registries.BLOCK_ENTITIES.get(BlockEntityType.SHULKER_BOX); @Override protected boolean isValidBlock(String[] javaBlockString) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java index 95f70f3c9..8f33742c6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java @@ -30,7 +30,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEntityDataPacket; import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.connector.network.session.GeyserSession; @@ -47,13 +46,7 @@ public class JavaBlockEntityDataTranslator extends PacketTranslator= 2 && - session.getGameMode() == GameMode.CREATIVE && packet.getNbt().size() > 5) { + session.getGameMode() == GameMode.CREATIVE && packet.getNbt() != null && packet.getNbt().size() > 5) { ContainerOpenPacket openPacket = new ContainerOpenPacket(); openPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); openPacket.setId((byte) 1); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java index 3ac2e5646..69950be97 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -31,10 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityInfo; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.github.steveice10.opennbt.tag.builtin.Tag; import com.github.steveice10.packetlib.io.NetInput; import com.github.steveice10.packetlib.io.stream.StreamNetInput; import com.nukkitx.math.vector.Vector3i; @@ -48,7 +47,6 @@ import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufOutputStream; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; -import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -227,41 +225,16 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator> 4) - yOffset]; + DataPalette section = javaChunks[(y >> 4) - yOffset]; int blockState = section.get(x & 0xF, y & 0xF, z & 0xF); - if (tagName.equals("minecraft:lectern") && BlockStateValues.getLecternBookStates().get(blockState)) { + if (type == BlockEntityType.LECTERN && BlockStateValues.getLecternBookStates().get(blockState)) { // If getLecternBookStates is false, let's just treat it like a normal block entity bedrockBlockEntities[blockEntityCount] = session.getConnector().getWorldManager().getLecternDataAt( session, blockEntity.getX(), blockEntity.getY(), blockEntity.getZ(), true); @@ -269,8 +242,8 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); + public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); /** * A mapped registry containing which holds block IDs to its {@link BlockCollision}. diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java index a58cca7ca..5e9d156a1 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java @@ -25,14 +25,38 @@ package org.geysermc.connector.registry.loader; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.connector.network.translators.world.block.entity.BlockEntity; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.connector.network.translators.world.block.entity.EmptyBlockEntityTranslator; +import org.geysermc.connector.utils.FileUtils; + +import java.lang.reflect.InvocationTargetException; +import java.util.Map; /** * Loads block entities from the given classpath. */ -public class BlockEntityRegistryLoader extends AnnotatedRegistryLoader { - public BlockEntityRegistryLoader() { - super(BlockEntity.class, BlockEntity::name); +public class BlockEntityRegistryLoader implements RegistryLoader> { + + @Override + public Map load(String input) { + // Overridden so one translator can be applied to multiple block entity types + Object2ObjectMap entries = new Object2ObjectOpenHashMap<>(); + entries.defaultReturnValue(new EmptyBlockEntityTranslator()); + for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(input)) { + try { + BlockEntity annotation = clazz.getAnnotation(BlockEntity.class); + BlockEntityTranslator translator = (BlockEntityTranslator) clazz.getConstructor().newInstance(); + for (BlockEntityType type : annotation.type()) { + entries.put(type, translator); + } + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ex) { + ex.printStackTrace(); + } + } + return entries; } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java index 500c0d723..38ffa80f5 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java @@ -26,6 +26,7 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; @@ -50,41 +51,33 @@ public class BlockEntityUtils { /** * Contains a list of irregular block entity name translations that can't be fit into the regex */ - public static final Map BLOCK_ENTITY_TRANSLATIONS = new HashMap() { + public static final Map BLOCK_ENTITY_TRANSLATIONS = new HashMap<>() { { // Bedrock/Java differences - put("minecraft:enchanting_table", "EnchantTable"); - put("minecraft:jigsaw", "JigsawBlock"); - put("minecraft:piston_head", "PistonArm"); - put("minecraft:trapped_chest", "Chest"); + put(BlockEntityType.ENCHANTING_TABLE, "EnchantTable"); + put(BlockEntityType.JIGSAW, "JigsawBlock"); + put(BlockEntityType.PISTON, "PistonArm"); + put(BlockEntityType.TRAPPED_CHEST, "Chest"); // There are some legacy IDs sent but as far as I can tell they are not needed for things to work properly } }; - private static final BlockEntityTranslator EMPTY_TRANSLATOR = Registries.BLOCK_ENTITIES.get("Empty"); - static { // Seeing as there are only two - and, hopefully, will only ever be two - we can hardcode this - BEDROCK_ONLY_BLOCK_ENTITIES.add((BedrockOnlyBlockEntity) Registries.BLOCK_ENTITIES.get().get("Chest")); + BEDROCK_ONLY_BLOCK_ENTITIES.add((BedrockOnlyBlockEntity) Registries.BLOCK_ENTITIES.get().get(BlockEntityType.CHEST)); BEDROCK_ONLY_BLOCK_ENTITIES.add(new FlowerPotBlockEntityTranslator()); } - public static String getBedrockBlockEntityId(String id) { + public static String getBedrockBlockEntityId(BlockEntityType type) { // These are the only exceptions when it comes to block entity ids - String value = BLOCK_ENTITY_TRANSLATIONS.get(id); + String value = BLOCK_ENTITY_TRANSLATIONS.get(type); if (value != null) { return value; } - id = id.replace("minecraft:", "") - .replace("_", " "); + String id = type.name(); // Split at every space or capital letter - for the latter, some legacy Java block entity tags are the correct format already - String[] words; - if (!id.toUpperCase().equals(id)) { // Otherwise we get [S, K, U, L, L] - words = id.split("(?=[A-Z])| "); // Split at every space or note or before every capital letter - } else { - words = id.split(" "); - } + String[] words = id.split("_");; for (int i = 0; i < words.length; i++) { words[i] = words[i].substring(0, 1).toUpperCase() + words[i].substring(1).toLowerCase(); } @@ -92,12 +85,8 @@ public class BlockEntityUtils { return String.join("", words); } - public static BlockEntityTranslator getBlockEntityTranslator(String name) { - BlockEntityTranslator blockEntityTranslator = Registries.BLOCK_ENTITIES.get(name); - if (blockEntityTranslator != null) { - return blockEntityTranslator; - } - return EMPTY_TRANSLATOR; + public static BlockEntityTranslator getBlockEntityTranslator(BlockEntityType type) { + return Registries.BLOCK_ENTITIES.get(type); } public static void updateBlockEntity(GeyserSession session, @Nonnull NbtMap blockEntity, Position position) { From 98ee3880b0a089e91f8b0c83e123f735e07f3bf4 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 14 Nov 2021 13:38:19 -0500 Subject: [PATCH 680/766] Remove unnecessary Getter annotation --- .../connector/network/translators/world/chunk/GeyserChunk.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java index f833fd86f..995c1e600 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java @@ -26,12 +26,11 @@ package org.geysermc.connector.network.translators.world.chunk; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; -import lombok.Getter; /** * Acts as a lightweight chunk class that doesn't store biomes, heightmaps or block entities. */ -public record GeyserChunk(@Getter DataPalette[] sections) { +public record GeyserChunk(DataPalette[] sections) { public static GeyserChunk from(DataPalette[] sections) { return new GeyserChunk(sections); From 61f20217a918ad167cafbed668f35fa4d7c88bcf Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 14 Nov 2021 13:52:48 -0500 Subject: [PATCH 681/766] Fix some block entity inconsistencies --- .../level/JavaBlockEntityDataTranslator.java | 2 +- .../JavaLevelChunkWithLightTranslator.java | 17 +++++++++-------- .../entity/SkullBlockEntityTranslator.java | 5 +---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java index 8f33742c6..d68823d1a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java @@ -61,7 +61,7 @@ public class JavaBlockEntityDataTranslator extends PacketTranslator> 4) - yOffset]; - int blockState = section.get(x & 0xF, y & 0xF, z & 0xF); + int blockState = section.get(x, y & 0xF, z); if (type == BlockEntityType.LECTERN && BlockStateValues.getLecternBookStates().get(blockState)) { // If getLecternBookStates is false, let's just treat it like a normal block entity - bedrockBlockEntities[blockEntityCount] = session.getConnector().getWorldManager().getLecternDataAt( - session, blockEntity.getX(), blockEntity.getY(), blockEntity.getZ(), true); - blockEntityCount++; + bedrockBlockEntities[blockEntityCount++] = session.getConnector().getWorldManager().getLecternDataAt( + session, x + chunkBlockX, y, z + chunkBlockZ, true); continue; } BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(type); - bedrockBlockEntities[blockEntityCount] = blockEntityTranslator.getBlockEntityTag(type, x, y, z, tag, blockState); + bedrockBlockEntities[blockEntityCount] = blockEntityTranslator.getBlockEntityTag(type, x + chunkBlockX, y, z + chunkBlockZ, tag, blockState); // Check for custom skulls if (session.getPreferencesCache().showCustomSkulls() && tag != null && tag.contains("SkullOwner")) { - SkullBlockEntityTranslator.spawnPlayer(session, tag, blockState); + SkullBlockEntityTranslator.spawnPlayer(session, tag, x + chunkBlockX, y, z + chunkBlockZ, blockState); } blockEntityCount++; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index 0acc01a7d..0dc92bbfe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -85,10 +85,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements return CompletableFuture.completedFuture(null); } - public static void spawnPlayer(GeyserSession session, CompoundTag tag, int blockState) { - int posX = (int) tag.get("x").getValue(); - int posY = (int) tag.get("y").getValue(); - int posZ = (int) tag.get("z").getValue(); + public static void spawnPlayer(GeyserSession session, CompoundTag tag, int posX, int posY, int posZ, int blockState) { float x = posX + .5f; float y = posY - .01f; float z = posZ + .5f; From badee15c46415e55b9357da2841b582b9c761233 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 14 Nov 2021 17:59:14 -0500 Subject: [PATCH 682/766] Implement V0 bits-per-block for Bedrock This also improves sending empty chunks by having an empty BlockStorage array. The empty biome data has shrunk from 32k bytes to 65. With thanks to @dktapps. --- .../JavaLevelChunkWithLightTranslator.java | 31 +++++++++- .../translators/world/BiomeTranslator.java | 4 +- .../translators/world/chunk/BlockStorage.java | 2 +- .../world/chunk/bitarray/BitArray.java | 10 +++ .../world/chunk/bitarray/BitArrayVersion.java | 5 +- .../SingletonBitArray.java} | 61 +++++++++++-------- .../populator/BlockRegistryPopulator.java | 3 - .../registry/type/BlockMappings.java | 3 - .../geysermc/connector/utils/ChunkUtils.java | 22 ++++++- 9 files changed, 105 insertions(+), 36 deletions(-) rename connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/{EmptyChunkProvider.java => bitarray/SingletonBitArray.java} (52%) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java index eded821a8..18ed24c64 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; +import com.github.steveice10.mc.protocol.data.game.chunk.palette.SingletonPalette; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityInfo; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket; @@ -47,6 +48,7 @@ import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufOutputStream; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.ints.IntLists; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -59,6 +61,7 @@ import org.geysermc.connector.network.translators.world.chunk.BlockStorage; import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; +import org.geysermc.connector.network.translators.world.chunk.bitarray.SingletonBitArray; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.BlockEntityUtils; import org.geysermc.connector.utils.ChunkUtils; @@ -145,6 +148,22 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator VarInts.writeInt(buffer, id)); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java index 5c278eb9c..c9621b144 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java @@ -25,6 +25,9 @@ package org.geysermc.connector.network.translators.world.chunk.bitarray; +import com.nukkitx.network.VarInts; +import io.netty.buffer.ByteBuf; + public interface BitArray { void set(int index, int value); @@ -33,6 +36,13 @@ public interface BitArray { int size(); + /** + * Overridden if the bit array implementation does not require size. + */ + default void writeSizeToNetwork(ByteBuf buffer, int size) { + VarInts.writeInt(buffer, size); + } + int[] getWords(); BitArrayVersion getVersion(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java index f45e9f6b9..d39a1216f 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java @@ -35,7 +35,8 @@ public enum BitArrayVersion { V4(4, 8, V5), V3(3, 10, V4), // 2 bit padding V2(2, 16, V3), - V1(1, 32, V2); + V1(1, 32, V2), + V0(0, 0, V1); private static final BitArrayVersion[] VALUES = values(); @@ -94,6 +95,8 @@ public enum BitArrayVersion { if (this == V3 || this == V5 || this == V6) { // Padded palettes aren't able to use bitwise operations due to their padding. return new PaddedBitArray(this, size, words); + } else if (this == V0) { + return new SingletonBitArray(); } else { return new Pow2BitArray(this, size, words); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/EmptyChunkProvider.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java similarity index 52% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/EmptyChunkProvider.java rename to connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java index afef277ab..db4e05301 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/EmptyChunkProvider.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java @@ -23,36 +23,49 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk; +package org.geysermc.connector.network.translators.world.chunk.bitarray; -import com.nukkitx.nbt.NBTOutputStream; -import com.nukkitx.nbt.NbtMap; -import com.nukkitx.nbt.NbtUtils; -import lombok.Getter; +import io.netty.buffer.ByteBuf; -import java.io.ByteArrayOutputStream; -import java.io.IOException; +public class SingletonBitArray implements BitArray { + public static final SingletonBitArray INSTANCE = new SingletonBitArray(); -public class EmptyChunkProvider { - @Getter - private final byte[] emptyLevelChunkData; - @Getter - private final GeyserChunkSection emptySection; + private static final int[] EMPTY_ARRAY = new int[0]; - public EmptyChunkProvider(int airId) { - BlockStorage emptyStorage = new BlockStorage(airId); - emptySection = new GeyserChunkSection(new BlockStorage[]{emptyStorage}); + public SingletonBitArray() { + } - try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { - outputStream.write(new byte[258]); // Biomes + Border Size + Extra Data Size + @Override + public void set(int index, int value) { + } - try (NBTOutputStream stream = NbtUtils.createNetworkWriter(outputStream)) { - stream.writeTag(NbtMap.EMPTY); - } + @Override + public int get(int index) { + return 0; + } - emptyLevelChunkData = outputStream.toByteArray(); - } catch (IOException e) { - throw new AssertionError("Unable to generate empty level chunk data"); - } + @Override + public int size() { + return 1; + } + + @Override + public void writeSizeToNetwork(ByteBuf buffer, int size) { + // no-op - size is fixed + } + + @Override + public int[] getWords() { + return EMPTY_ARRAY; + } + + @Override + public BitArrayVersion getVersion() { + return BitArrayVersion.V0; + } + + @Override + public SingletonBitArray copy() { + return new SingletonBitArray(); } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java index a4388388a..2beaeff79 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java @@ -38,8 +38,6 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIntPair; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.chunk.BlockStorage; -import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.registry.type.BlockMapping; import org.geysermc.connector.registry.type.BlockMappings; @@ -200,7 +198,6 @@ public class BlockRegistryPopulator { builder.bedrockBlockStates(blocksTag); BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion) - .emptyChunkSection(new GeyserChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)})) .javaToBedrockBlocks(javaToBedrockBlocks) .javaIdentifierToBedrockTag(javaIdentifierToBedrockTag) .itemFrames(itemFrames) diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java index c07f2edfa..8e1cd6a1a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java @@ -31,7 +31,6 @@ import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Builder; import lombok.Value; -import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; import java.util.Map; @@ -44,8 +43,6 @@ public class BlockMappings { int blockStateVersion; - GeyserChunkSection emptyChunkSection; - int[] javaToBedrockBlocks; NbtList bedrockBlockStates; diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 8db82c0ae..48e1a9622 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -36,6 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.NetworkChunkPublisherUpdatePacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import it.unimi.dsi.fastutil.ints.IntLists; import lombok.experimental.UtilityClass; import org.geysermc.connector.entity.ItemFrameEntity; import org.geysermc.connector.entity.player.SkullPlayerEntity; @@ -43,6 +44,8 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; import org.geysermc.connector.network.translators.world.chunk.BlockStorage; +import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; +import org.geysermc.connector.network.translators.world.chunk.bitarray.SingletonBitArray; import org.geysermc.connector.registry.BlockRegistries; import static org.geysermc.connector.network.translators.world.block.BlockStateValues.JAVA_AIR_ID; @@ -60,13 +63,30 @@ public class ChunkUtils { public static final int MAXIMUM_ACCEPTED_HEIGHT = 256; public static final int MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD = 384; + /** + * An empty subchunk. + */ + public static final byte[] SERIALIZED_CHUNK_DATA; + /** + * An empty chunk that can be safely passed on to a LevelChunkPacket with subcounts set to 0. + */ public static final byte[] EMPTY_CHUNK_DATA; public static final byte[] EMPTY_BIOME_DATA; static { ByteBuf byteBuf = Unpooled.buffer(); try { - BlockStorage blockStorage = new BlockStorage(0); + new GeyserChunkSection(new BlockStorage[0]) + .writeToNetwork(byteBuf); + SERIALIZED_CHUNK_DATA = new byte[byteBuf.readableBytes()]; + byteBuf.readBytes(SERIALIZED_CHUNK_DATA); + } finally { + byteBuf.release(); + } + + byteBuf = Unpooled.buffer(); + try { + BlockStorage blockStorage = new BlockStorage(SingletonBitArray.INSTANCE, IntLists.singleton(0)); blockStorage.writeToNetwork(byteBuf); EMPTY_BIOME_DATA = new byte[byteBuf.readableBytes()]; From 581c24f2e9b25050dc51cd19f0eeeb31a20a19b8 Mon Sep 17 00:00:00 2001 From: David Choo Date: Sun, 14 Nov 2021 20:15:25 -0500 Subject: [PATCH 683/766] Fix some anvil level cost situations (#2578) --- connector/pom.xml | 6 + .../connector/inventory/AnvilContainer.java | 39 +- .../bedrock/BedrockFilterTextTranslator.java | 31 +- .../translators/chat/MessageTranslator.java | 28 ++ .../translators/AnvilInventoryTranslator.java | 15 +- .../updater/AnvilInventoryUpdater.java | 460 ++++++++++++++++++ .../network/translators/item/Enchantment.java | 12 + .../translators/item/StoredItemMappings.java | 2 + .../connector/registry/Registries.java | 8 + .../loader/EnchantmentRegistryLoader.java | 95 ++++ .../populator/ItemRegistryPopulator.java | 12 +- .../registry/type/EnchantmentData.java | 35 ++ .../registry/type/GeyserMappingItem.java | 4 + .../connector/registry/type/ItemMapping.java | 8 +- .../geysermc/connector/utils/ItemUtils.java | 15 + connector/src/main/resources/mappings | 2 +- .../chat/MessageTranslatorTest.java | 10 + 17 files changed, 767 insertions(+), 15 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java create mode 100644 connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java create mode 100644 connector/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java diff --git a/connector/pom.xml b/connector/pom.xml index 755828467..483afad1d 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -228,6 +228,12 @@ ${adventure.version} compile + + net.kyori + adventure-text-serializer-plain + ${adventure.version} + compile + junit diff --git a/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java b/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java index 71b5cbda9..10451772c 100644 --- a/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java +++ b/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java @@ -26,12 +26,49 @@ package org.geysermc.connector.inventory; import com.github.steveice10.mc.protocol.data.game.window.WindowType; +import com.nukkitx.protocol.bedrock.data.inventory.ItemData; +import lombok.Getter; +import lombok.Setter; /** - * Used to determine if rename packets should be sent. + * Used to determine if rename packets should be sent and stores + * the expected level cost for AnvilInventoryUpdater */ +@Getter @Setter public class AnvilContainer extends Container { + /** + * Stores the level cost received as a window property from Java + */ + private int javaLevelCost = 0; + /** + * A flag to specify whether javaLevelCost can be used as it can + * be outdated or not sent at all. + */ + private boolean useJavaLevelCost = false; + + /** + * The new name of the item as received from Bedrock + */ + private String newName = null; + + private GeyserItemStack lastInput = GeyserItemStack.EMPTY; + private GeyserItemStack lastMaterial = GeyserItemStack.EMPTY; + + private int lastTargetSlot = -1; + public AnvilContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) { super(title, id, size, windowType, playerInventory); } + + public GeyserItemStack getInput() { + return getItem(0); + } + + public GeyserItemStack getMaterial() { + return getItem(1); + } + + public GeyserItemStack getResult() { + return getItem(2); + } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java index 681ca432c..354280c08 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java @@ -32,6 +32,8 @@ import org.geysermc.connector.inventory.CartographyContainer; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.connector.utils.ItemUtils; /** * Used to send strings to the server and filter out unwanted words. @@ -47,12 +49,31 @@ public class BedrockFilterTextTranslator extends PacketTranslator= MAX_LEVEL_COST) { + // Items can still be renamed when the level cost for renaming exceeds 40 + totalCost = MAX_LEVEL_COST - 1; + } + } + return totalCost; + } + + /** + * Calculate the levels needed to repair an item with its repair material + * E.g. iron_sword + iron_ingot + * + * @param session Geyser session + * @param input an item with durability + * @param material the item's respective repair material + * @return the number of levels needed or 0 if it is not possible to repair any further + */ + private int calcRepairLevelCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + int newDamage = getDamage(input); + int unitRepair = Math.min(newDamage, input.getMapping(session).getMaxDamage() / 4); + if (unitRepair <= 0) { + // No damage to repair + return -1; + } + for (int i = 0; i < material.getAmount(); i++) { + newDamage -= unitRepair; + unitRepair = Math.min(newDamage, input.getMapping(session).getMaxDamage() / 4); + if (unitRepair <= 0) { + return i + 1; + } + } + return material.getAmount(); + } + + /** + * Calculate the levels cost for repairing items by combining two of the same item + * + * @param session Geyser session + * @param input an item with durability + * @param material a matching item + * @return the number of levels needed or 0 if it is not possible to repair any further + */ + private int calcMergeRepairCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + // If the material item is damaged 112% or more, then the input item will not be repaired + if (getDamage(input) > 0 && getDamage(material) < (material.getMapping(session).getMaxDamage() * 112 / 100)) { + return 2; + } + return 0; + } + + /** + * Calculate the levels needed for combining the enchantments of two items + * + * @param session Geyser session + * @param input an item with durability + * @param material a matching item + * @param bedrock True to count enchantments like Bedrock, False to count like Java + * @return the number of levels needed or -1 if no enchantments can be applied + */ + private int calcMergeEnchantmentCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material, boolean bedrock) { + boolean hasCompatible = false; + Object2IntMap combinedEnchantments = getEnchantments(session, input, bedrock); + int cost = 0; + for (Object2IntMap.Entry entry : getEnchantments(session, material, bedrock).object2IntEntrySet()) { + JavaEnchantment enchantment = entry.getKey(); + EnchantmentData data = Registries.ENCHANTMENTS.get(enchantment); + if (data == null) { + GeyserConnector.getInstance().getLogger().debug("Java enchantment not in registry: " + enchantment); + continue; + } + + boolean canApply = isEnchantedBook(session, input) || data.validItems().contains(input.getJavaId()); + for (JavaEnchantment incompatible : data.incompatibleEnchantments()) { + if (combinedEnchantments.containsKey(incompatible)) { + canApply = false; + if (!bedrock) { + cost++; + } + } + } + + if (canApply || (!bedrock && session.getGameMode() == GameMode.CREATIVE)) { + int currentLevel = combinedEnchantments.getOrDefault(enchantment, 0); + int newLevel = entry.getIntValue(); + if (newLevel == currentLevel) { + newLevel++; + } + newLevel = Math.max(currentLevel, newLevel); + if (newLevel > data.maxLevel()) { + newLevel = data.maxLevel(); + } + combinedEnchantments.put(enchantment, newLevel); + + int rarityMultiplier = data.rarityMultiplier(); + if (isEnchantedBook(session, material) && rarityMultiplier > 1) { + rarityMultiplier /= 2; + } + if (bedrock) { + if (newLevel > currentLevel) { + hasCompatible = true; + } + if (enchantment == JavaEnchantment.IMPALING) { + // Multiplier is halved on Bedrock for some reason + rarityMultiplier /= 2; + } else if (enchantment == JavaEnchantment.SWEEPING) { + // Doesn't exist on Bedrock + rarityMultiplier = 0; + } + cost += rarityMultiplier * (newLevel - currentLevel); + } else { + hasCompatible = true; + cost += rarityMultiplier * newLevel; + } + } + } + + if (!hasCompatible) { + return -1; + } + return cost; + } + + private Object2IntMap getEnchantments(GeyserSession session, GeyserItemStack itemStack, boolean bedrock) { + if (itemStack.getNbt() == null) { + return Object2IntMaps.emptyMap(); + } + Object2IntMap enchantments = new Object2IntOpenHashMap<>(); + Tag enchantmentTag; + if (isEnchantedBook(session, itemStack)) { + enchantmentTag = itemStack.getNbt().get("StoredEnchantments"); + } else { + enchantmentTag = itemStack.getNbt().get("Enchantments"); + } + if (enchantmentTag instanceof ListTag listTag) { + for (Tag tag : listTag.getValue()) { + if (tag instanceof CompoundTag enchantTag) { + if (enchantTag.get("id") instanceof StringTag javaEnchId) { + JavaEnchantment enchantment = JavaEnchantment.getByJavaIdentifier(javaEnchId.getValue()); + if (enchantment == null) { + GeyserConnector.getInstance().getLogger().debug("Unknown java enchantment: " + javaEnchId.getValue()); + continue; + } + + Tag javaEnchLvl = enchantTag.get("lvl"); + if (!(javaEnchLvl instanceof ShortTag || javaEnchLvl instanceof IntTag)) + continue; + + // Handle duplicate enchantments + if (bedrock) { + enchantments.putIfAbsent(enchantment, ((Number) javaEnchLvl.getValue()).intValue()); + } else { + enchantments.mergeInt(enchantment, ((Number) javaEnchLvl.getValue()).intValue(), Math::max); + } + } + } + } + } + return enchantments; + } + + private boolean isEnchantedBook(GeyserSession session, GeyserItemStack itemStack) { + return itemStack.getJavaId() == session.getItemMappings().getStoredItems().enchantedBook().getJavaId(); + } + + private boolean isCombining(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + return isEnchantedBook(session, material) || (input.getJavaId() == material.getJavaId() && hasDurability(session, input)); + } + + private boolean isRepairing(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + Set repairMaterials = input.getMapping(session).getRepairMaterials(); + return repairMaterials != null && repairMaterials.contains(material.getMapping(session).getJavaIdentifier()); + } + + private boolean isRenaming(GeyserSession session, AnvilContainer anvilContainer, boolean bedrock) { + if (anvilContainer.getResult().isEmpty()) { + return false; + } + // This should really check the name field in all cases, but that requires the localized name + // of the item which can change depending on NBT and Minecraft Edition + String originalName = ItemUtils.getCustomName(anvilContainer.getInput().getNbt()); + if (bedrock && originalName != null && anvilContainer.getNewName() != null) { + // Check text and formatting + String legacyOriginalName = MessageTranslator.convertMessageLenient(originalName, session.getLocale()); + return !legacyOriginalName.equals(anvilContainer.getNewName()); + } + return !Objects.equals(originalName, ItemUtils.getCustomName(anvilContainer.getResult().getNbt())); + } + + private int getTagIntValueOr(GeyserItemStack itemStack, String tagName, int defaultValue) { + if (itemStack.getNbt() != null) { + Tag tag = itemStack.getNbt().get(tagName); + if (tag != null && tag.getValue() instanceof Number value) { + return value.intValue(); + } + } + return defaultValue; + } + + private int getRepairCost(GeyserItemStack itemStack) { + return getTagIntValueOr(itemStack, "RepairCost", 0); + } + + private boolean hasDurability(GeyserSession session, GeyserItemStack itemStack) { + if (itemStack.getMapping(session).getMaxDamage() > 0) { + return getTagIntValueOr(itemStack, "Unbreakable", 0) == 0; + } + return false; + } + + private int getDamage(GeyserItemStack itemStack) { + return getTagIntValueOr(itemStack, "Damage", 0); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java index 14b918a4f..947f9e6ed 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java @@ -147,6 +147,18 @@ public enum Enchantment { */ public static final String[] ALL_JAVA_IDENTIFIERS; + public static JavaEnchantment getByJavaIdentifier(String javaIdentifier) { + if (!javaIdentifier.startsWith("minecraft:")) { + javaIdentifier = "minecraft:" + javaIdentifier; + } + for (int i = 0; i < ALL_JAVA_IDENTIFIERS.length; i++) { + if (ALL_JAVA_IDENTIFIERS[i].equalsIgnoreCase(javaIdentifier)) { + return VALUES[i]; + } + } + return null; + } + static { ALL_JAVA_IDENTIFIERS = new String[VALUES.length]; for (int i = 0; i < ALL_JAVA_IDENTIFIERS.length; i++) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java index 7f8456d6a..6bbdb7421 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java @@ -43,6 +43,7 @@ public class StoredItemMappings { private final ItemMapping barrier; private final ItemMapping compass; private final ItemMapping crossbow; + private final ItemMapping enchantedBook; private final ItemMapping fishingRod; private final ItemMapping lodestoneCompass; private final ItemMapping milkBucket; @@ -58,6 +59,7 @@ public class StoredItemMappings { this.barrier = load(itemMappings, "barrier"); this.compass = load(itemMappings, "compass"); this.crossbow = load(itemMappings, "crossbow"); + this.enchantedBook = load(itemMappings, "enchanted_book"); this.fishingRod = load(itemMappings, "fishing_rod"); this.lodestoneCompass = load(itemMappings, "lodestone_compass"); this.milkBucket = load(itemMappings, "milk_bucket"); diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 3447bdfc8..43b28a530 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -39,12 +39,14 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; import org.geysermc.connector.network.translators.effect.Effect; +import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; import org.geysermc.connector.network.translators.sound.SoundHandler; import org.geysermc.connector.network.translators.sound.SoundInteractionHandler; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; import org.geysermc.connector.registry.loader.*; import org.geysermc.connector.registry.populator.ItemRegistryPopulator; import org.geysermc.connector.registry.populator.RecipeRegistryPopulator; +import org.geysermc.connector.registry.type.EnchantmentData; import org.geysermc.connector.registry.type.ItemMappings; import org.geysermc.connector.registry.type.ParticleMapping; import org.geysermc.connector.registry.type.SoundMapping; @@ -82,6 +84,11 @@ public class Registries { */ public static final VersionedRegistry>> CRAFTING_DATA = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new)); + /** + * A registry holding data of all the known enchantments. + */ + public static final SimpleMappedRegistry ENCHANTMENTS; + /** * A registry holding a CompoundTag of the known entity identifiers. */ @@ -140,5 +147,6 @@ public class Registries { // Create registries that require other registries to load first POTION_MIXES = SimpleRegistry.create(PotionMixRegistryLoader::new); + ENCHANTMENTS = SimpleMappedRegistry.create("mappings/enchantments.json", EnchantmentRegistryLoader::new); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java new file mode 100644 index 000000000..d1a100a55 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2019-2021 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.connector.registry.loader; + +import com.fasterxml.jackson.databind.JsonNode; +import it.unimi.dsi.fastutil.ints.IntOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntSet; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.network.BedrockProtocol; +import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.connector.registry.Registries; +import org.geysermc.connector.registry.type.EnchantmentData; +import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.connector.utils.FileUtils; + +import java.io.InputStream; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.Map; + +public class EnchantmentRegistryLoader implements RegistryLoader> { + @Override + public Map load(String input) { + InputStream enchantmentsStream = FileUtils.getResource(input); + JsonNode enchantmentsNode; + try { + enchantmentsNode = GeyserConnector.JSON_MAPPER.readTree(enchantmentsStream); + } catch (Exception e) { + throw new AssertionError("Unable to load enchantment data", e); + } + + Map enchantments = new EnumMap<>(JavaEnchantment.class); + Iterator> it = enchantmentsNode.fields(); + while (it.hasNext()) { + Map.Entry entry = it.next(); + JavaEnchantment key = JavaEnchantment.getByJavaIdentifier(entry.getKey()); + JsonNode node = entry.getValue(); + int rarityMultiplier = switch (node.get("rarity").textValue()) { + case "common" -> 1; + case "uncommon" -> 2; + case "rare" -> 4; + case "very_rare" -> 8; + default -> throw new IllegalStateException("Unexpected value: " + node.get("rarity").textValue()); + }; + int maxLevel = node.get("max_level").asInt(); + + EnumSet incompatibleEnchantments = EnumSet.noneOf(JavaEnchantment.class); + JsonNode incompatibleEnchantmentsNode = node.get("incompatible_enchantments"); + if (incompatibleEnchantmentsNode != null) { + for (JsonNode incompatibleNode : incompatibleEnchantmentsNode) { + incompatibleEnchantments.add(JavaEnchantment.getByJavaIdentifier(incompatibleNode.textValue())); + } + } + + IntSet validItems = new IntOpenHashSet(); + for (JsonNode itemNode : node.get("valid_items")) { + String javaIdentifier = itemNode.textValue(); + ItemMapping itemMapping = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier); + if (itemMapping != null) { + validItems.add(itemMapping.getJavaId()); + } else { + throw new NullPointerException("No item entry exists for java identifier: " + javaIdentifier); + } + } + + EnchantmentData enchantmentData = new EnchantmentData(rarityMultiplier, maxLevel, incompatibleEnchantments, validItems); + enchantments.put(key, enchantmentData); + } + return enchantments; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 0251103d0..e1b6a45b6 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -38,10 +38,7 @@ import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.v448.Bedrock_v448; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.*; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.network.translators.item.StoredItemMappings; @@ -377,7 +374,12 @@ public class ItemRegistryPopulator { .bedrockId(bedrockId) .bedrockData(mappingItem.getBedrockData()) .bedrockBlockId(bedrockBlockId) - .stackSize(stackSize); + .stackSize(stackSize) + .maxDamage(mappingItem.getMaxDamage()); + + if (mappingItem.getRepairMaterials() != null) { + mappingBuilder = mappingBuilder.repairMaterials(new ObjectOpenHashSet<>(mappingItem.getRepairMaterials())); + } if (mappingItem.getToolType() != null) { if (mappingItem.getToolTier() != null) { diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java b/connector/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java new file mode 100644 index 000000000..cd16a093a --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019-2021 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.connector.registry.type; + +import it.unimi.dsi.fastutil.ints.IntSet; +import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; + +import java.util.Set; + +public record EnchantmentData(int rarityMultiplier, int maxLevel, Set incompatibleEnchantments, + IntSet validItems) { +} diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java b/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java index da91c412e..12e5544b7 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java @@ -28,6 +28,8 @@ package org.geysermc.connector.registry.type; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; +import java.util.List; + /** * Represents Geyser's own serialized item information before being processed per-version */ @@ -40,4 +42,6 @@ public class GeyserMappingItem { @JsonProperty("stack_size") int stackSize = 64; @JsonProperty("tool_type") String toolType; @JsonProperty("tool_tier") String toolTier; + @JsonProperty("max_damage") int maxDamage = 0; + @JsonProperty("repair_materials") List repairMaterials; } diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java b/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java index fff00950b..46789a69a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java @@ -31,13 +31,15 @@ import lombok.Value; import org.geysermc.connector.network.BedrockProtocol; import org.geysermc.connector.registry.BlockRegistries; +import java.util.Set; + @Value @Builder @EqualsAndHashCode public class ItemMapping { public static final ItemMapping AIR = new ItemMapping("minecraft:air", "minecraft:air", 0, 0, 0, BlockRegistries.BLOCKS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(), - 64, null, null, null); + 64, null, null, null, 0, null); String javaIdentifier; String bedrockIdentifier; @@ -57,6 +59,10 @@ public class ItemMapping { String translationString; + int maxDamage; + + Set repairMaterials; + /** * Gets if this item is a block. * diff --git a/connector/src/main/java/org/geysermc/connector/utils/ItemUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ItemUtils.java index db4e9e2e1..8bd2edfd1 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ItemUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ItemUtils.java @@ -58,4 +58,19 @@ public class ItemUtils { } return original; } + + /** + * @param itemTag the NBT tag of the item + * @return the custom name of the item + */ + public static String getCustomName(CompoundTag itemTag) { + if (itemTag != null) { + if (itemTag.get("display") instanceof CompoundTag displayTag) { + if (displayTag.get("Name") instanceof StringTag nameTag) { + return nameTag.getValue(); + } + } + } + return null; + } } diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 7ff1b6567..5b6239f0a 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 7ff1b6567b56c7b0b8e28786b9bbc30abfaededf +Subproject commit 5b6239f0a43ec9a38d65ed53b8d1bfaf564c1c3b diff --git a/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java b/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java index 649e96425..cfb2bbc97 100644 --- a/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java +++ b/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java @@ -81,6 +81,16 @@ public class MessageTranslatorTest { Assert.assertEquals("Unimplemented formatting chars not stripped", "Bold Underline", MessageTranslator.convertMessageLenient("§m§nBold Underline")); } + @Test + public void convertToPlainText() { + Assert.assertEquals("JSON message is not handled properly", "Many colors here", MessageTranslator.convertToPlainText("{\"extra\":[{\"color\":\"red\",\"text\":\"M\"},{\"color\":\"gold\",\"text\":\"a\"},{\"color\":\"yellow\",\"text\":\"n\"},{\"color\":\"green\",\"text\":\"y \"},{\"color\":\"aqua\",\"text\":\"c\"},{\"color\":\"dark_purple\",\"text\":\"o\"},{\"color\":\"red\",\"text\":\"l\"},{\"color\":\"gold\",\"text\":\"o\"},{\"color\":\"yellow\",\"text\":\"r\"},{\"color\":\"green\",\"text\":\"s \"},{\"color\":\"aqua\",\"text\":\"h\"},{\"color\":\"dark_purple\",\"text\":\"e\"},{\"color\":\"red\",\"text\":\"r\"},{\"color\":\"gold\",\"text\":\"e\"}],\"text\":\"\"}", "en_US")); + Assert.assertEquals("Legacy formatted message is not handled properly (Colors)", "Many colors here", MessageTranslator.convertToPlainText("§cM§6a§en§ay §bc§5o§cl§6o§er§as §bh§5e§cr§6e", "en_US")); + Assert.assertEquals("Legacy formatted message is not handled properly (Style)", "Obf Bold Strikethrough Underline Italic Reset", MessageTranslator.convertToPlainText("§kObf §lBold §mStrikethrough §nUnderline §oItalic §rReset", "en_US")); + Assert.assertEquals("Valid lenient JSON is not handled properly", "Strange", MessageTranslator.convertToPlainText("§rStrange", "en_US")); + Assert.assertEquals("Empty message is not handled properly", "", MessageTranslator.convertToPlainText("", "en_US")); + Assert.assertEquals("Whitespace is not preserved", " ", MessageTranslator.convertToPlainText(" ", "en_US")); + } + @Test public void testNullTextPacket() { DefaultComponentSerializer.get().deserialize("null"); From b92b49b5e492fc8dd6061ff925a8149bdfb4cbe3 Mon Sep 17 00:00:00 2001 From: YHDiamond <47502993+YHDiamond@users.noreply.github.com> Date: Wed, 17 Nov 2021 21:42:54 -0500 Subject: [PATCH 684/766] Handle a string possibly being null (#2638) An NPE can be thrown if message is null and `message.isBlank()` is called. --- .../connector/network/translators/chat/MessageTranslator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java index 55087de0f..a668b3906 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java @@ -147,6 +147,9 @@ public class MessageTranslator { * @return Bedrock formatted message */ public static String convertMessageLenient(String message, String locale) { + if (message == null) { + return ""; + } if (message.isBlank()) { return message; } From 11997ed82bf1efff53974549846166a017513e5a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 17 Nov 2021 22:02:38 -0500 Subject: [PATCH 685/766] Entity refactory aaaaaaAAAAAAA --- .../geysermc/connector/GeyserConnector.java | 2 + .../command/defaults/OffhandCommand.java | 4 +- .../connector/entity/AbstractArrowEntity.java | 42 +- .../entity/AreaEffectCloudEntity.java | 55 +- .../geysermc/connector/entity/BoatEntity.java | 136 ++- .../entity/CommandBlockMinecartEntity.java | 35 +- .../entity/DefaultBlockMinecartEntity.java | 76 +- .../connector/entity/EnderCrystalEntity.java | 34 +- .../org/geysermc/connector/entity/Entity.java | 342 +++--- .../connector/entity/EntityDefinition.java | 140 +++ .../connector/entity/EntityDefinitions.java | 999 ++++++++++++++++++ ...ity.java => EntityMetadataTranslator.java} | 27 +- .../connector/entity/ExpOrbEntity.java | 11 +- .../connector/entity/FallingBlockEntity.java | 21 +- .../connector/entity/FireworkEntity.java | 189 ++-- .../connector/entity/FishingHookEntity.java | 69 +- .../entity/FurnaceMinecartEntity.java | 30 +- .../geysermc/connector/entity/ItemEntity.java | 90 +- .../connector/entity/ItemFrameEntity.java | 102 +- .../entity/ItemedFireballEntity.java | 21 +- .../connector/entity/LeashKnotEntity.java | 8 +- .../connector/entity/LightningEntity.java | 10 +- .../connector/entity/LivingEntity.java | 115 +- .../connector/entity/MinecartEntity.java | 67 +- .../connector/entity/PaintingEntity.java | 11 +- .../entity/SpawnerMinecartEntity.java | 13 +- .../geysermc/connector/entity/TNTEntity.java | 30 +- .../connector/entity/ThrowableEntity.java | 67 +- .../connector/entity/ThrowableItemEntity.java | 29 +- .../connector/entity/ThrownPotionEntity.java | 44 +- .../geysermc/connector/entity/Tickable.java | 4 +- .../connector/entity/TippedArrowEntity.java | 33 +- .../connector/entity/TridentEntity.java | 18 +- .../connector/entity/WitherSkullEntity.java | 33 +- .../entity/factory/BaseEntityFactory.java | 39 + .../entity/factory/EntityFactory.java | 31 + .../factory/ExperienceOrbEntityFactory.java | 36 + .../entity/factory/PaintingEntityFactory.java | 38 + .../entity/living/AbstractFishEntity.java | 17 +- .../entity/living/AgeableEntity.java | 43 +- .../entity/living/AmbientEntity.java | 11 +- .../entity/living/ArmorStandEntity.java | 301 +++--- .../connector/entity/living/BatEntity.java | 19 +- .../entity/living/CreatureEntity.java | 11 +- .../connector/entity/living/FlyingEntity.java | 11 +- .../entity/living/GlowSquidEntity.java | 15 +- .../connector/entity/living/GolemEntity.java | 9 +- .../entity/living/IronGolemEntity.java | 13 +- .../entity/living/MagmaCubeEntity.java | 26 +- .../connector/entity/living/MobEntity.java | 66 ++ .../connector/entity/living/SlimeEntity.java | 19 +- .../entity/living/SnowGolemEntity.java | 21 +- .../connector/entity/living/SquidEntity.java | 43 +- .../connector/entity/living/WaterEntity.java | 9 +- .../entity/living/animal/AnimalEntity.java | 8 +- .../entity/living/animal/AxolotlEntity.java | 33 +- .../entity/living/animal/BeeEntity.java | 49 +- .../entity/living/animal/ChickenEntity.java | 8 +- .../entity/living/animal/FoxEntity.java | 32 +- .../entity/living/animal/GoatEntity.java | 23 +- .../entity/living/animal/HoglinEntity.java | 30 +- .../entity/living/animal/MooshroomEntity.java | 18 +- .../entity/living/animal/OcelotEntity.java | 18 +- .../entity/living/animal/PandaEntity.java | 81 +- .../entity/living/animal/PigEntity.java | 18 +- .../entity/living/animal/PolarBearEntity.java | 18 +- .../living/animal/PufferFishEntity.java | 21 +- .../entity/living/animal/RabbitEntity.java | 51 +- .../entity/living/animal/SheepEntity.java | 22 +- .../entity/living/animal/StriderEntity.java | 56 +- .../living/animal/TropicalFishEntity.java | 24 +- .../entity/living/animal/TurtleEntity.java | 23 +- .../animal/horse/AbstractHorseEntity.java | 89 +- .../animal/horse/ChestedHorseEntity.java | 20 +- .../living/animal/horse/HorseEntity.java | 21 +- .../living/animal/horse/LlamaEntity.java | 61 +- .../animal/horse/TraderLlamaEntity.java | 14 +- .../living/animal/tameable/CatEntity.java | 83 +- .../living/animal/tameable/ParrotEntity.java | 19 +- .../animal/tameable/TameableEntity.java | 53 +- .../living/animal/tameable/WolfEntity.java | 65 +- .../merchant/AbstractMerchantEntity.java | 13 +- .../living/merchant/VillagerEntity.java | 56 +- .../monster/AbstractSkeletonEntity.java | 21 +- .../living/monster/BasePiglinEntity.java | 30 +- .../entity/living/monster/BlazeEntity.java | 20 +- .../entity/living/monster/CreeperEntity.java | 36 +- .../living/monster/ElderGuardianEntity.java | 17 +- .../living/monster/EnderDragonEntity.java | 114 +- .../living/monster/EnderDragonPartEntity.java | 16 +- .../entity/living/monster/EndermanEntity.java | 51 +- .../entity/living/monster/GhastEntity.java | 19 +- .../entity/living/monster/GiantEntity.java | 11 +- .../entity/living/monster/GuardianEntity.java | 35 +- .../entity/living/monster/MonsterEntity.java | 9 +- .../entity/living/monster/PhantomEntity.java | 27 +- .../entity/living/monster/PiglinEntity.java | 42 +- .../entity/living/monster/ShulkerEntity.java | 49 +- .../entity/living/monster/SkeletonEntity.java | 25 +- .../entity/living/monster/SpiderEntity.java | 20 +- .../entity/living/monster/VexEntity.java | 23 +- .../entity/living/monster/WitherEntity.java | 72 +- .../entity/living/monster/ZoglinEntity.java | 23 +- .../entity/living/monster/ZombieEntity.java | 37 +- .../living/monster/ZombieVillagerEntity.java | 44 +- .../living/monster/ZombifiedPiglinEntity.java | 11 +- .../monster/raid/AbstractIllagerEntity.java | 9 +- .../living/monster/raid/PillagerEntity.java | 24 +- .../monster/raid/RaidParticipantEntity.java | 9 +- .../raid/SpellcasterIllagerEntity.java | 40 +- .../living/monster/raid/VindicatorEntity.java | 19 +- .../connector/entity/player/PlayerEntity.java | 231 ++-- .../entity/player/SessionPlayerEntity.java | 38 +- .../entity/player/SkullPlayerEntity.java | 36 +- .../connector/entity/type/EntityType.java | 214 ---- .../network/session/GeyserSession.java | 22 +- .../network/session/cache/EntityCache.java | 22 +- .../network/session/cache/PistonCache.java | 2 +- .../network/session/cache/WorldBorder.java | 9 +- .../BedrockAdventureSettingsTranslator.java | 2 +- .../BedrockBlockPickRequestTranslator.java | 4 +- .../BedrockEntityPickRequestTranslator.java | 17 +- ...BedrockInventoryTransactionTranslator.java | 24 +- .../BedrockLecternUpdateTranslator.java | 6 +- .../BedrockMoveEntityAbsoluteTranslator.java | 28 +- .../bedrock/BedrockPlayerInputTranslator.java | 11 +- .../bedrock/BedrockRespawnTranslator.java | 2 +- .../entity/BedrockEntityEventTranslator.java | 4 +- .../player/BedrockActionTranslator.java | 18 +- .../entity/player/BedrockEmoteTranslator.java | 4 +- .../player/BedrockInteractTranslator.java | 6 +- .../player/BedrockMovePlayerTranslator.java | 21 +- .../collision/CollisionManager.java | 33 +- .../MerchantInventoryTranslator.java | 22 +- .../java/JavaCommandsTranslator.java | 4 +- .../translators/java/JavaLoginTranslator.java | 2 +- .../entity/JavaEntityEventTranslator.java | 20 +- .../JavaMoveEntityPosRotTranslator.java | 2 +- .../entity/JavaMoveEntityPosTranslator.java | 2 +- .../entity/JavaMoveEntityRotTranslator.java | 2 +- .../entity/JavaMoveVehicleTranslator.java | 2 +- .../java/entity/JavaRotateHeadTranslator.java | 2 +- .../entity/JavaSetEntityDataTranslator.java | 33 +- .../entity/JavaSetEntityLinkTranslator.java | 21 +- .../entity/JavaSetEquipmentTranslator.java | 2 +- .../entity/JavaSetPassengersTranslator.java | 42 +- .../entity/JavaTeleportEntityTranslator.java | 2 +- .../player/JavaPlayerInfoTranslator.java | 5 +- .../player/JavaPlayerPositionTranslator.java | 30 +- .../entity/spawn/JavaAddEntityTranslator.java | 79 +- .../spawn/JavaAddExperienceOrbTranslator.java | 4 +- .../entity/spawn/JavaAddMobTranslator.java | 29 +- .../spawn/JavaAddPaintingTranslator.java | 6 +- .../entity/spawn/JavaAddPlayerTranslator.java | 12 +- .../JavaHorseScreenOpenTranslator.java | 2 +- .../JavaMerchantOffersTranslator.java | 8 +- .../level/JavaForgetLevelChunkTranslator.java | 2 +- .../JavaSetObjectiveTranslator.java | 2 +- .../scoreboard/JavaSetScoreTranslator.java | 2 +- .../sound/EntitySoundInteractionHandler.java | 2 +- .../FeedBabySoundInteractionHandler.java | 2 +- .../MilkEntitySoundInteractionHandler.java | 2 +- .../entity/SkullBlockEntityTranslator.java | 17 +- .../entity/SpawnerBlockEntityTranslator.java | 11 +- .../connector/registry/Registries.java | 22 +- .../connector/scoreboard/Scoreboard.java | 6 +- .../geysermc/connector/utils/BlockUtils.java | 2 +- .../geysermc/connector/utils/ChunkUtils.java | 4 +- .../geysermc/connector/utils/EntityUtils.java | 48 +- .../utils/InteractiveTagManager.java | 65 +- 170 files changed, 4003 insertions(+), 2836 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java create mode 100644 connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java rename connector/src/main/java/org/geysermc/connector/entity/{living/InsentientEntity.java => EntityMetadataTranslator.java} (57%) create mode 100644 connector/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java create mode 100644 connector/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java create mode 100644 connector/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java create mode 100644 connector/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java create mode 100644 connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index fd2432a4c..a33c51952 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -44,6 +44,7 @@ import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.command.CommandManager; import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.metrics.Metrics; import org.geysermc.connector.network.ConnectorServerEventHandler; import org.geysermc.connector.network.session.GeyserSession; @@ -153,6 +154,7 @@ public class GeyserConnector { BlockRegistries.init(); Registries.init(); + EntityDefinitions.init(); ItemTranslator.init(); MessageTranslator.init(); LocaleUtils.init(); diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java index ea6062063..06d554ece 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java @@ -25,8 +25,8 @@ package org.geysermc.connector.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.data.game.level.block.BlockFace; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.CommandSender; @@ -47,7 +47,7 @@ public class OffhandCommand extends GeyserCommand { } ServerboundPlayerActionPacket releaseItemPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, - BlockFace.DOWN); + Direction.DOWN); session.sendDownstreamPacket(releaseItemPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java index 54bec7257..f51516dc6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java @@ -26,37 +26,43 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class AbstractArrowEntity extends Entity { - public AbstractArrowEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AbstractArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Set the correct texture if using the resource pack - metadata.getFlags().setFlag(EntityFlag.BRIBED, entityType == EntityType.SPECTRAL_ARROW); + dirtyMetadata.getFlags().setFlag(EntityFlag.BRIBED, definition.entityType() == EntityType.SPECTRAL_ARROW); setMotion(motion); } + public void setArrowFlags(EntityMetadata entityMetadata) { + byte data = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + + setFlag(EntityFlag.CRITICAL, (data & 0x01) == 0x01); + } + + // Ignore the rotation sent by the Java server since the + // Java client calculates the rotation from the motion @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { - byte data = (byte) entityMetadata.getValue(); - - metadata.getFlags().setFlag(EntityFlag.CRITICAL, (data & 0x01) == 0x01); - } - - super.updateBedrockMetadata(entityMetadata, session); + public void setYaw(float yaw) { } @Override - public void setRotation(Vector3f rotation) { - // Ignore the rotation sent by the Java server since the - // Java client calculates the rotation from the motion + public void setPitch(float pitch) { + } + + @Override + public void setHeadYaw(float headYaw) { } @Override @@ -64,8 +70,8 @@ public class AbstractArrowEntity extends Entity { super.setMotion(motion); double horizontalSpeed = Math.sqrt(motion.getX() * motion.getX() + motion.getZ() * motion.getZ()); - float yaw = (float) Math.toDegrees(Math.atan2(motion.getX(), motion.getZ())); - float pitch = (float) Math.toDegrees(Math.atan2(motion.getY(), horizontalSpeed)); - rotation = Vector3f.from(yaw, pitch, yaw); + this.yaw = (float) Math.toDegrees(Math.atan2(motion.getX(), motion.getZ())); + this.pitch = (float) Math.toDegrees(Math.atan2(motion.getY(), horizontalSpeed)); + this.headYaw = yaw; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java index 48283818e..1c2830232 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java @@ -26,44 +26,47 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.level.particle.Particle; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.EffectUtils; +import java.util.UUID; + public class AreaEffectCloudEntity extends Entity { - public AreaEffectCloudEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - - // Without this the cloud doesn't appear, - metadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, 600); - - // This disabled client side shrink of the cloud - metadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f); - metadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_RATE, -0.005f); - metadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, -0.5f); - - metadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + public AreaEffectCloudEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { - metadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, entityMetadata.getValue()); - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * (float) entityMetadata.getValue()); - } else if (entityMetadata.getId() == 9) { - metadata.put(EntityData.EFFECT_COLOR, entityMetadata.getValue()); - } else if (entityMetadata.getId() == 11) { - Particle particle = (Particle) entityMetadata.getValue(); - int particleId = EffectUtils.getParticleId(session, particle.getType()); - if (particleId != -1) { - metadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId); - } + protected void initializeMetadata() { + super.initializeMetadata(); + // Without this the cloud doesn't appear, + dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, 600); + + // This disabled client side shrink of the cloud + dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f); + dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_RATE, -0.005f); + dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, -0.5f); + + setFlag(EntityFlag.FIRE_IMMUNE, true); + } + + public void setRadius(EntityMetadata entityMetadata) { + float value = ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, value); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * value); + } + + public void setParticle(EntityMetadata entityMetadata) { + Particle particle = entityMetadata.getValue(); + int particleId = EffectUtils.getParticleId(session, particle.getType()); + if (particleId != -1) { + dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId); } - super.updateBedrockMetadata(entityMetadata, session); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index 025747940..7069f5cfb 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -26,13 +26,16 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; -import org.geysermc.connector.entity.type.EntityType; +import lombok.Getter; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; import java.util.concurrent.TimeUnit; public class BoatEntity extends Entity { @@ -52,28 +55,36 @@ public class BoatEntity extends Entity { private boolean isPaddlingRight; private float paddleTimeRight; + /** + * Saved for using the "pick" functionality on a boat. + */ + @Getter + private int variant; + // Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it private final float ROWING_SPEED = 0.05f; - public BoatEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position.add(0d, entityType.getOffset(), 0d), motion, rotation.add(90, 0, 90)); + public BoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + // Initial rotation is incorrect + super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); // Required to be able to move on land 1.16.200+ or apply gravity not in the water 1.16.100+ - metadata.put(EntityData.IS_BUOYANT, (byte) 1); - metadata.put(EntityData.BUOYANCY_DATA, BUOYANCY_DATA); + dirtyMetadata.put(EntityData.IS_BUOYANT, (byte) 1); + dirtyMetadata.put(EntityData.BUOYANCY_DATA, BUOYANCY_DATA); } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { // We don't include the rotation (y) as it causes the boat to appear sideways - setPosition(position.add(0d, this.entityType.getOffset(), 0d)); - setRotation(Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90)); + setPosition(position.add(0d, this.definition.offset(), 0d)); + this.yaw = yaw + 90; + this.headYaw = yaw + 90; setOnGround(isOnGround); MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); moveEntityPacket.setRuntimeEntityId(geyserId); // Minimal glitching when ClientboundMoveVehiclePacket is sent - moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityType.PLAYER.getOffset() - this.entityType.getOffset()) : this.position); + moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityDefinitions.PLAYER.offset() - this.definition.offset()) : this.position); moveEntityPacket.setRotation(getBedrockRotation()); moveEntityPacket.setOnGround(isOnGround); moveEntityPacket.setTeleported(teleported); @@ -84,91 +95,62 @@ public class BoatEntity extends Entity { /** * Move the boat without making the adjustments needed to translate from Java */ - public void moveAbsoluteWithoutAdjustments(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - super.moveAbsolute(session, position, Vector3f.from(rotation.getX(), 0, rotation.getX()), isOnGround, teleported); + public void moveAbsoluteWithoutAdjustments(Vector3f position, float yaw, boolean isOnGround, boolean teleported) { + super.moveAbsolute(position, yaw, 0, yaw, isOnGround, teleported); } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - super.moveRelative(session, relX, relY, relZ, Vector3f.from(rotation.getX(), 0, rotation.getX()), isOnGround); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + super.moveRelative(relX, relY, relZ, yaw, 0, yaw, isOnGround); } @Override - public void updatePositionAndRotation(GeyserSession session, double moveX, double moveY, double moveZ, float yaw, float pitch, boolean isOnGround) { - moveRelative(session, moveX, moveY, moveZ, yaw + 90, pitch, isOnGround); + public void updatePositionAndRotation(double moveX, double moveY, double moveZ, float yaw, float pitch, boolean isOnGround) { + moveRelative(moveX, moveY, moveZ, yaw + 90, pitch, isOnGround); } @Override - public void updateRotation(GeyserSession session, float yaw, float pitch, boolean isOnGround) { - moveRelative(session, 0, 0, 0, Vector3f.from(yaw + 90, 0, 0), isOnGround); + public void updateRotation(float yaw, float pitch, boolean isOnGround) { + moveRelative(0, 0, 0, yaw + 90, 0, 0, isOnGround); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Time since last hit - if (entityMetadata.getId() == 8) { - metadata.put(EntityData.HURT_TIME, entityMetadata.getValue()); - } + public void setVariant(EntityMetadata entityMetadata) { + variant = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.VARIANT, variant); + } - // Rocking direction - if (entityMetadata.getId() == 9) { - metadata.put(EntityData.HURT_DIRECTION, entityMetadata.getValue()); - } - - // 'Health' in Bedrock, damage taken in Java - if (entityMetadata.getId() == 10) { - // Not exactly health but it makes motion in Bedrock - metadata.put(EntityData.HEALTH, 40 - ((int) (float) entityMetadata.getValue())); - } - - if (entityMetadata.getId() == 11) { - metadata.put(EntityData.VARIANT, entityMetadata.getValue()); - } else if (entityMetadata.getId() == 12) { - isPaddlingLeft = (boolean) entityMetadata.getValue(); - if (isPaddlingLeft) { - // Java sends simply "true" and "false" (is_paddling_left), Bedrock keeps sending packets as you're rowing - // This is an asynchronous method that emulates Bedrock rowing until "false" is sent. - paddleTimeLeft = 0f; - if (!this.passengers.isEmpty()) { - // Get the entity by the first stored passenger and convey motion in this manner - Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); - if (entity != null) { - updateLeftPaddle(session, entity); - } + public void setPaddlingLeft(EntityMetadata entityMetadata) { + isPaddlingLeft = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + if (isPaddlingLeft) { + // Java sends simply "true" and "false" (is_paddling_left), Bedrock keeps sending packets as you're rowing + // This is an asynchronous method that emulates Bedrock rowing until "false" is sent. + paddleTimeLeft = 0f; + if (!this.passengers.isEmpty()) { + // Get the entity by the first stored passenger and convey motion in this manner + Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); + if (entity != null) { + updateLeftPaddle(session, entity); } - } else { - // Indicate that the row position should be reset - metadata.put(EntityData.ROW_TIME_LEFT, 0.0f); } + } else { + // Indicate that the row position should be reset + dirtyMetadata.put(EntityData.ROW_TIME_LEFT, 0.0f); } - else if (entityMetadata.getId() == 13) { - isPaddlingRight = (boolean) entityMetadata.getValue(); - if (isPaddlingRight) { - paddleTimeRight = 0f; - if (!this.passengers.isEmpty()) { - Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); - if (entity != null) { - updateRightPaddle(session, entity); - } - } - } else { - metadata.put(EntityData.ROW_TIME_RIGHT, 0.0f); - } - } else if (entityMetadata.getId() == 14) { - // Possibly - I don't think this does anything? - metadata.put(EntityData.BOAT_BUBBLE_TIME, entityMetadata.getValue()); - } - - super.updateBedrockMetadata(entityMetadata, session); } - @Override - public void updateBedrockMetadata(GeyserSession session) { - super.updateBedrockMetadata(session); - - // As these indicate to reset rowing, remove them until it is time to send them out again. - metadata.remove(EntityData.ROW_TIME_LEFT); - metadata.remove(EntityData.ROW_TIME_RIGHT); + public void setPaddlingRight(EntityMetadata entityMetadata) { + isPaddlingRight = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + if (isPaddlingRight) { + paddleTimeRight = 0f; + if (!this.passengers.isEmpty()) { + Entity entity = session.getEntityCache().getEntityByJavaId(this.passengers.iterator().nextLong()); + if (entity != null) { + updateRightPaddle(session, entity); + } + } + } else { + dirtyMetadata.put(EntityData.ROW_TIME_RIGHT, 0.0f); + } } private void updateLeftPaddle(GeyserSession session, Entity rower) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java index c04e9f0b7..fcd4e05a3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java @@ -25,42 +25,33 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import net.kyori.adventure.text.Component; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; + +import java.util.UUID; public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { - public CommandBlockMinecartEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - // Required, or else the GUI will not open - metadata.put(EntityData.CONTAINER_TYPE, (byte) 16); - metadata.put(EntityData.CONTAINER_BASE_SIZE, 1); - // Required, or else the client does not bother to send a packet back with the new information - metadata.put(EntityData.COMMAND_BLOCK_ENABLED, (byte) 1); + public CommandBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 14) { - metadata.put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue()); - } - if (entityMetadata.getId() == 15) { - metadata.put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage((Component) entityMetadata.getValue())); - } - super.updateBedrockMetadata(entityMetadata, session); + protected void initializeMetadata() { + // Required, or else the GUI will not open + dirtyMetadata.put(EntityData.CONTAINER_TYPE, (byte) 16); + dirtyMetadata.put(EntityData.CONTAINER_BASE_SIZE, 1); + // Required, or else the client does not bother to send a packet back with the new information + dirtyMetadata.put(EntityData.COMMAND_BLOCK_ENABLED, (byte) 1); } /** * By default, the command block shown is purple on Bedrock, which does not match Java Edition's orange. */ @Override - public void updateDefaultBlockMetadata(GeyserSession session) { - metadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getCommandBlockRuntimeId()); - metadata.put(EntityData.DISPLAY_OFFSET, 6); + public void updateDefaultBlockMetadata() { + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getCommandBlockRuntimeId()); + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java index 5df7ae440..f4991b312 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + /** * This class is used as a base for minecarts with a default block to display like furnaces and spawners */ @@ -40,53 +43,48 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { public int customBlockOffset = 0; public boolean showCustomBlock = false; - public DefaultBlockMinecartEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public DefaultBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - metadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); + dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); } @Override - public void spawnEntity(GeyserSession session) { - updateDefaultBlockMetadata(session); - super.spawnEntity(session); + public void spawnEntity() { + updateDefaultBlockMetadata(); + super.spawnEntity(); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { + public void setCustomBlock(EntityMetadata entityMetadata) { + customBlock = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); - // Custom block - if (entityMetadata.getId() == 11) { - customBlock = (int) entityMetadata.getValue(); - - if (showCustomBlock) { - metadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); - } + if (showCustomBlock) { + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); } - - // Custom block offset - if (entityMetadata.getId() == 12) { - customBlockOffset = (int) entityMetadata.getValue(); - - if (showCustomBlock) { - metadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); - } - } - - // If the custom block should be enabled - if (entityMetadata.getId() == 13) { - if ((boolean) entityMetadata.getValue()) { - showCustomBlock = true; - metadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); - metadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); - } else { - showCustomBlock = false; - updateDefaultBlockMetadata(session); - } - } - - super.updateBedrockMetadata(entityMetadata, session); } - public void updateDefaultBlockMetadata(GeyserSession session) { } + @Override + public void setCustomBlockOffset(EntityMetadata entityMetadata) { + customBlockOffset = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + + if (showCustomBlock) { + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); + } + } + + @Override + public void setShowCustomBlock(EntityMetadata entityMetadata) { + if (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()) { + showCustomBlock = true; + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); + } else { + showCustomBlock = false; + updateDefaultBlockMetadata(); + } + } + + public void updateDefaultBlockMetadata() { + } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java index e4b60980f..a39c479f8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java @@ -31,33 +31,31 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class EnderCrystalEntity extends Entity { - public EnderCrystalEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - - // Bedrock 1.16.100+ - prevents the entity from appearing on fire itself when fire is underneath it - metadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + public EnderCrystalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { + protected void initializeMetadata() { + super.initializeMetadata(); + // Bedrock 1.16.100+ - prevents the entity from appearing on fire itself when fire is underneath it + dirtyMetadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + } + + public void setBlockTarget(EntityMetadata entityMetadata) { // Show beam // Usually performed client-side on Bedrock except for Ender Dragon respawn event - if (entityMetadata.getId() == 8) { - if (entityMetadata.getValue() instanceof Position pos) { - metadata.put(EntityData.BLOCK_TARGET, Vector3i.from(pos.getX(), pos.getY(), pos.getZ())); - } else { - metadata.put(EntityData.BLOCK_TARGET, Vector3i.ZERO); - } + Position position = entityMetadata.getValue(); + if (position != null) { + dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.from(position.getX(), position.getY(), position.getZ())); + } else { + dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.ZERO); } - // There is a base located on the ender crystal - if (entityMetadata.getId() == 9) { - metadata.getFlags().setFlag(EntityFlag.SHOW_BOTTOM, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index a965b35da..bdeacc9dc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -26,8 +26,10 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; @@ -38,19 +40,24 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.utils.MathUtils; +import java.util.UUID; + @Getter @Setter public class Entity { + protected final GeyserSession session; + protected long entityId; protected final long geyserId; + protected UUID uuid; protected Vector3f position; protected Vector3f motion; @@ -58,85 +65,120 @@ public class Entity { /** * x = Yaw, y = Pitch, z = HeadYaw */ - protected Vector3f rotation; + protected float yaw; + protected float pitch; + protected float headYaw; /** * Saves if the entity should be on the ground. Otherwise entities like parrots are flapping when rotating */ protected boolean onGround; - protected EntityType entityType; + protected EntityDefinition definition; protected boolean valid; - protected LongOpenHashSet passengers = new LongOpenHashSet(); - protected EntityDataMap metadata = new EntityDataMap(); + /* Metadata about this specific entity */ + @Setter(AccessLevel.NONE) + protected float boundingBoxHeight; + @Setter(AccessLevel.NONE) + protected float boundingBoxWidth; + /* Metadata end */ + + protected LongOpenHashSet passengers = new LongOpenHashSet(); + /** + * A container to store temporary metadata before it's sent to Bedrock. + */ + protected final EntityDataMap dirtyMetadata = new EntityDataMap(); + /** + * The entity flags for the Bedrock entity. + * These must always be saved - if flags are updated and the other values aren't present, the Bedrock client will + * think they are set to false. + */ + @Getter(AccessLevel.NONE) + protected final EntityFlags flags = new EntityFlags(); + /** + * Indicates if flags have been updated and need to be sent to the client. + */ + @Getter(AccessLevel.NONE) + @Setter(AccessLevel.PROTECTED) // For players + private boolean flagsDirty = false; + + public Entity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + this.session = session; - public Entity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { this.entityId = entityId; this.geyserId = geyserId; - this.entityType = entityType; + this.uuid = uuid; + this.definition = definition; this.motion = motion; - this.rotation = rotation; + this.yaw = yaw; + this.pitch = pitch; + this.headYaw = headYaw; this.valid = false; setPosition(position); setAir(getMaxAir()); - metadata.put(EntityData.SCALE, 1f); - metadata.put(EntityData.COLOR, 0); - metadata.put(EntityData.MAX_AIR_SUPPLY, getMaxAir()); - metadata.put(EntityData.LEASH_HOLDER_EID, -1L); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight()); - metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); - EntityFlags flags = new EntityFlags(); - flags.setFlag(EntityFlag.HAS_GRAVITY, true); - flags.setFlag(EntityFlag.HAS_COLLISION, true); - flags.setFlag(EntityFlag.CAN_SHOW_NAME, true); - flags.setFlag(EntityFlag.CAN_CLIMB, true); - metadata.putFlags(flags); + initializeMetadata(); } - public void spawnEntity(GeyserSession session) { + /** + * Called on entity spawn. Used to populate the entity metadata and flags with default values. + */ + protected void initializeMetadata() { + dirtyMetadata.put(EntityData.SCALE, 1f); + dirtyMetadata.put(EntityData.COLOR, 0); + dirtyMetadata.put(EntityData.MAX_AIR_SUPPLY, getMaxAir()); + setDimensions(Pose.STANDING); + setFlag(EntityFlag.HAS_GRAVITY, true); + setFlag(EntityFlag.HAS_COLLISION, true); + setFlag(EntityFlag.CAN_SHOW_NAME, true); + setFlag(EntityFlag.CAN_CLIMB, true); + } + + public void spawnEntity() { AddEntityPacket addEntityPacket = new AddEntityPacket(); - addEntityPacket.setIdentifier(entityType.getIdentifier()); + addEntityPacket.setIdentifier(definition.identifier()); addEntityPacket.setRuntimeEntityId(geyserId); addEntityPacket.setUniqueEntityId(geyserId); addEntityPacket.setPosition(position); addEntityPacket.setMotion(motion); addEntityPacket.setRotation(getBedrockRotation()); - addEntityPacket.setEntityType(entityType.getType()); - addEntityPacket.getMetadata().putAll(metadata); + addEntityPacket.setEntityType(definition.bedrockId()); + addEntityPacket.getMetadata().putFlags(flags) + .putAll(dirtyMetadata); addAdditionalSpawnData(addEntityPacket); valid = true; session.sendUpstreamPacket(addEntityPacket); - session.getConnector().getLogger().debug("Spawned entity " + entityType + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); + dirtyMetadata.clear(); + flagsDirty = false; + + session.getConnector().getLogger().debug("Spawned entity " + getClass().getName() + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); } /** * To be overridden in other entity classes, if additional things need to be done to the spawn entity packet. */ public void addAdditionalSpawnData(AddEntityPacket addEntityPacket) { - } /** * Despawns the entity * - * @param session The GeyserSession * @return can be deleted */ - public boolean despawnEntity(GeyserSession session) { + public boolean despawnEntity() { if (!valid) return true; for (long passenger : passengers) { // Make sure all passengers on the despawned entity are updated Entity entity = session.getEntityCache().getEntityByJavaId(passenger); if (entity == null) continue; - entity.getMetadata().getOrCreateFlags().setFlag(EntityFlag.RIDING, false); - entity.updateBedrockMetadata(session); + entity.setFlag(EntityFlag.RIDING, false); + entity.updateBedrockMetadata(); } RemoveEntityPacket removeEntityPacket = new RemoveEntityPacket(); @@ -147,12 +189,14 @@ public class Entity { return true; } - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, float yaw, float pitch, boolean isOnGround) { - moveRelative(session, relX, relY, relZ, Vector3f.from(yaw, pitch, this.rotation.getZ()), isOnGround); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, boolean isOnGround) { + moveRelative(relX, relY, relZ, yaw, pitch, this.headYaw, isOnGround); } - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - setRotation(rotation); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + setYaw(yaw); + setPitch(pitch); + setHeadYaw(headYaw); setOnGround(isOnGround); this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ); @@ -166,13 +210,16 @@ public class Entity { session.sendUpstreamPacket(moveEntityPacket); } - public void moveAbsolute(GeyserSession session, Vector3f position, float yaw, float pitch, boolean isOnGround, boolean teleported) { - moveAbsolute(session, position, Vector3f.from(yaw, pitch, this.rotation.getZ()), isOnGround, teleported); + public void moveAbsolute(Vector3f position, float yaw, float pitch, boolean isOnGround, boolean teleported) { + moveAbsolute(position, yaw, pitch, this.headYaw, isOnGround, teleported); } - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { setPosition(position); - setRotation(rotation); + // Setters are intentional so it can be overridden in places like AbstractArrowEntity + setYaw(yaw); + setPitch(pitch); + setHeadYaw(headYaw); setOnGround(isOnGround); MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); @@ -187,28 +234,25 @@ public class Entity { /** * Teleports an entity to a new location. Used in JavaTeleportEntityTranslator. - * @param session GeyserSession. * @param position The new position of the entity. * @param yaw The new yaw of the entity. * @param pitch The new pitch of the entity. * @param isOnGround Whether the entity is currently on the ground. */ - public void teleport(GeyserSession session, Vector3f position, float yaw, float pitch, boolean isOnGround) { - moveAbsolute(session, position, yaw, pitch, isOnGround, false); + public void teleport(Vector3f position, float yaw, float pitch, boolean isOnGround) { + moveAbsolute(position, yaw, pitch, isOnGround, false); } /** * Updates an entity's head position. Used in JavaRotateHeadTranslator. - * @param session GeyserSession. * @param headYaw The new head rotation of the entity. */ - public void updateHeadLookRotation(GeyserSession session, float headYaw) { - moveRelative(session, 0, 0, 0, Vector3f.from(headYaw, rotation.getY(), rotation.getZ()), onGround); + public void updateHeadLookRotation(float headYaw) { + moveRelative(0, 0, 0, headYaw, pitch, this.headYaw, onGround); } /** * Updates an entity's position and rotation. Used in JavaMoveEntityPosRotTranslator. - * @param session GeyserSession * @param moveX The new X offset of the current position. * @param moveY The new Y offset of the current position. * @param moveZ The new Z offset of the current position. @@ -216,106 +260,115 @@ public class Entity { * @param pitch The new pitch of the entity. * @param isOnGround Whether the entity is currently on the ground. */ - public void updatePositionAndRotation(GeyserSession session, double moveX, double moveY, double moveZ, float yaw, float pitch, boolean isOnGround) { - moveRelative(session, moveX, moveY, moveZ, Vector3f.from(rotation.getX(), pitch, yaw), isOnGround); + public void updatePositionAndRotation(double moveX, double moveY, double moveZ, float yaw, float pitch, boolean isOnGround) { + moveRelative(moveX, moveY, moveZ, this.yaw, pitch, yaw, isOnGround); } /** * Updates an entity's rotation. Used in JavaMoveEntityRotTranslator. - * @param session GeyserSession. * @param yaw The new yaw of the entity. * @param pitch The new pitch of the entity. * @param isOnGround Whether the entity is currently on the ground. */ - public void updateRotation(GeyserSession session, float yaw, float pitch, boolean isOnGround) { - updatePositionAndRotation(session, 0, 0, 0, yaw, pitch, isOnGround); + public void updateRotation(float yaw, float pitch, boolean isOnGround) { + updatePositionAndRotation(0, 0, 0, yaw, pitch, isOnGround); + } + + public final boolean getFlag(EntityFlag flag) { + return flags.getFlag(flag); } /** - * Applies the Java metadata to the local Bedrock metadata copy - * @param entityMetadata the Java entity metadata - * @param session GeyserSession + * Updates a flag value and determines if the flags would need synced with the Bedrock client. */ - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - switch (entityMetadata.getId()) { - case 0: - if (entityMetadata.getType() == MetadataType.BYTE) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.ON_FIRE, ((xd & 0x01) == 0x01) && !metadata.getFlags().getFlag(EntityFlag.FIRE_IMMUNE)); // Otherwise immune entities sometimes flicker onfire - metadata.getFlags().setFlag(EntityFlag.SNEAKING, (xd & 0x02) == 0x02); - metadata.getFlags().setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08); - // Swimming is ignored here and instead we rely on the pose - metadata.getFlags().setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80); - - setInvisible(session, (xd & 0x20) == 0x20); - } - break; - case 1: // Air/bubbles - setAir((int) entityMetadata.getValue()); - break; - case 2: // custom name - setDisplayName(session, (Component) entityMetadata.getValue()); - break; - case 3: // is custom name visible - setDisplayNameVisible(entityMetadata); - break; - case 4: // silent - metadata.getFlags().setFlag(EntityFlag.SILENT, (boolean) entityMetadata.getValue()); - break; - case 5: // no gravity - metadata.getFlags().setFlag(EntityFlag.HAS_GRAVITY, !(boolean) entityMetadata.getValue()); - break; - case 6: // Pose change - typically used for bounding box and not animation - Pose pose = (Pose) entityMetadata.getValue(); - - metadata.getFlags().setFlag(EntityFlag.SLEEPING, pose.equals(Pose.SLEEPING)); - // Triggered when crawling - metadata.getFlags().setFlag(EntityFlag.SWIMMING, pose.equals(Pose.SWIMMING)); - setDimensions(pose); - break; - case 7: // Freezing ticks - // The value that Java edition gives us is in ticks, but Bedrock uses a float percentage of the strength 0.0 -> 1.0 - // The Java client caps its freezing tick percentage at 140 - int freezingTicks = Math.min((int) entityMetadata.getValue(), 140); - setFreezing(session, freezingTicks / 140f); - break; - } + public final void setFlag(EntityFlag flag, boolean value) { + flagsDirty |= flags.setFlag(flag, value); } /** * Sends the Bedrock metadata to the client - * @param session GeyserSession */ - public void updateBedrockMetadata(GeyserSession session) { - if (!valid) return; + public void updateBedrockMetadata() { + if (!valid) { + return; + } - SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); - entityDataPacket.setRuntimeEntityId(geyserId); - entityDataPacket.getMetadata().putAll(metadata); - session.sendUpstreamPacket(entityDataPacket); - } + if (!dirtyMetadata.isEmpty() || flagsDirty) { + SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); + entityDataPacket.setRuntimeEntityId(geyserId); + entityDataPacket.getMetadata().putFlags(flags); + entityDataPacket.getMetadata().putAll(dirtyMetadata); + session.sendUpstreamPacket(entityDataPacket); - /** - * If true, the entity should be shaking on the client's end. - * - * @return whether {@link EntityFlag#SHAKING} should be set to true. - */ - protected boolean isShaking(GeyserSession session) { - return false; - } - - protected void setDisplayName(GeyserSession session, Component name) { - if (name != null) { - String displayName = MessageTranslator.convertMessage(name, session.getLocale()); - metadata.put(EntityData.NAMETAG, displayName); - } else if (!metadata.getString(EntityData.NAMETAG).isEmpty()) { - // Clear nametag - metadata.put(EntityData.NAMETAG, ""); + dirtyMetadata.clear(); + flagsDirty = false; } } - protected void setDisplayNameVisible(EntityMetadata entityMetadata) { - metadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); + public void setFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.ON_FIRE, ((xd & 0x01) == 0x01) && !getFlag(EntityFlag.FIRE_IMMUNE)); // Otherwise immune entities sometimes flicker onfire + setFlag(EntityFlag.SNEAKING, (xd & 0x02) == 0x02); + setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08); + // Swimming is ignored here and instead we rely on the pose + setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80); + + setInvisible((xd & 0x20) == 0x20); + } + + /** + * Set a boolean - whether the entity is invisible or visible + * + * @param value true if the entity is invisible + */ + protected void setInvisible(boolean value) { + setFlag(EntityFlag.INVISIBLE, value); + } + + /** + * Set an int from 0 - this entity's maximum air - (air / maxAir) represents the percentage of bubbles left + */ + public final void setAir(EntityMetadata entityMetadata) { + setAir(((IntEntityMetadata) entityMetadata).getPrimitiveValue()); + } + + protected void setAir(int amount) { + dirtyMetadata.put(EntityData.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); + } + + protected int getMaxAir() { + return 300; + } + + public void setDisplayName(EntityMetadata entityMetadata) { + Component name = entityMetadata.getValue(); + if (name != null) { + String displayName = MessageTranslator.convertMessage(name, session.getLocale()); + dirtyMetadata.put(EntityData.NAMETAG, displayName); + } else if (!dirtyMetadata.getString(EntityData.NAMETAG).isEmpty()) { //TODO + // Clear nametag + dirtyMetadata.put(EntityData.NAMETAG, ""); + } + } + + public void setDisplayNameVisible(EntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)); + } + + public void setGravity(EntityMetadata entityMetadata) { + setFlag(EntityFlag.HAS_GRAVITY, !((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + } + + /** + * Usually used for bounding box and not animation. + */ + public void setPose(EntityMetadata entityMetadata) { + Pose pose = entityMetadata.getValue(); + + setFlag(EntityFlag.SLEEPING, pose.equals(Pose.SLEEPING)); + // Triggered when crawling + setFlag(EntityFlag.SWIMMING, pose.equals(Pose.SWIMMING)); + setDimensions(pose); } /** @@ -323,38 +376,33 @@ public class Entity { */ protected void setDimensions(Pose pose) { // No flexibility options for basic entities - //TODO don't even set this for basic entities since we already set it on entity initialization - metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight()); + if (boundingBoxHeight != definition.height() || boundingBoxWidth != definition.width()) { + boundingBoxWidth = definition.width(); + boundingBoxHeight = definition.height(); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); + } } /** * Set a float from 0-1 - how strong the "frozen" overlay should be on screen. */ - protected void setFreezing(GeyserSession session, float amount) { - metadata.put(EntityData.FREEZING_EFFECT_STRENGTH, amount); + public float setFreezing(EntityMetadata entityMetadata) { + // The value that Java edition gives us is in ticks, but Bedrock uses a float percentage of the strength 0.0 -> 1.0 + // The Java client caps its freezing tick percentage at 140 + int freezingTicks = Math.min(((IntEntityMetadata) entityMetadata).getPrimitiveValue(), 140); + float freezingPercentage = freezingTicks / 140f; + dirtyMetadata.put(EntityData.FREEZING_EFFECT_STRENGTH, freezingPercentage); + return freezingPercentage; } /** - * Set an int from 0 - this entity's maximum air - (air / maxAir) represents the percentage of bubbles left - * @param amount the amount of air - */ - protected void setAir(int amount) { - metadata.put(EntityData.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); - } - - protected int getMaxAir() { - return 300; - } - - /** - * Set a boolean - whether the entity is invisible or visible + * If true, the entity should be shaking on the client's end. * - * @param session the Geyser session - * @param value true if the entity is invisible + * @return whether {@link EntityFlag#SHAKING} should be set to true. */ - protected void setInvisible(GeyserSession session, boolean value) { - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, value); + protected boolean isShaking() { + return false; } /** @@ -363,7 +411,7 @@ public class Entity { * @return the bedrock rotation */ public Vector3f getBedrockRotation() { - return Vector3f.from(rotation.getY(), rotation.getZ(), rotation.getX()); + return Vector3f.from(pitch, headYaw, yaw); } @SuppressWarnings("unchecked") diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java new file mode 100644 index 000000000..c4100d95d --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.geysermc.connector.entity.factory.BaseEntityFactory; +import org.geysermc.connector.entity.factory.EntityFactory; +import org.geysermc.connector.registry.Registries; + +import java.util.List; +import java.util.Locale; +import java.util.function.BiConsumer; + +/** + * Represents data for an entity. This includes properties such as height and width, as well as the list of entity + * metadata translators needed to translate the properties sent from the server. The translators are structured in such + * a way that inserting a new one (for example in version updates) is convenient. + * + * @param the entity type this definition represents + */ +public record EntityDefinition(EntityFactory factory, EntityType entityType, int bedrockId, String identifier, + float width, float height, float offset, List> translators) { + + public static Builder inherited(BaseEntityFactory factory, EntityDefinition parent) { + return inherited((EntityFactory) factory, parent); + } + + public static Builder inherited(EntityFactory factory, EntityDefinition parent) { + return new Builder<>(factory, parent.entityType, parent.bedrockId, parent.identifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators)); + } + + public static Builder builder(EntityFactory factory) { + return new Builder<>(factory); + } + + @Setter + @Accessors(fluent = true, chain = true) + public static class Builder { + private final EntityFactory factory; + private EntityType type; + private int bedrockId; + private String identifier; + private float width; + private float height; + private float offset; + private final List> translators; + + private Builder(EntityFactory factory) { + this.factory = factory; + translators = new ObjectArrayList<>(); + } + + public Builder(EntityFactory factory, EntityType type, int bedrockId, String identifier, float width, float height, float offset, List> translators) { + this.factory = factory; + this.type = type; + this.bedrockId = bedrockId; + this.identifier = identifier; + this.width = width; + this.height = height; + this.offset = offset; + this.translators = translators; + } + + /** + * Sets the height and width as one value + */ + public Builder heightAndWidth(float value) { + height = value; + width = value; + return this; + } + + /** + * Resets the identifier as well + */ + public Builder type(EntityType type) { + this.type = type; + identifier = null; + return this; + } + + public Builder addTranslator(MetadataType type, BiConsumer> translateFunction) { + translators.add(new EntityMetadataTranslator<>(type, translateFunction)); + return this; + } + + public Builder addTranslator(EntityMetadataTranslator translator) { + translators.add(translator); + return this; + } + + public EntityDefinition build() { + return build(true); + } + + /** + * @param register whether to register this entity in the Registries for entity types. Generally this should be + * set to false if we're not expecting this entity to spawn from the network. + */ + public EntityDefinition build(boolean register) { + if (identifier == null && type != null) { + identifier = "minecraft:" + type.name().toLowerCase(Locale.ROOT); + } + EntityDefinition definition = new EntityDefinition<>(factory, type, bedrockId, identifier, width, height, offset, translators); + if (register && definition.entityType() != null) { + Registries.ENTITY_DEFINITIONS.get().putIfAbsent(definition.entityType(), definition); + Registries.JAVA_ENTITY_IDENTIFIERS.get().putIfAbsent(definition.identifier(), definition); + } + return definition; + } + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java new file mode 100644 index 000000000..926c86c29 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java @@ -0,0 +1,999 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import net.kyori.adventure.text.Component; +import org.geysermc.connector.entity.factory.BaseEntityFactory; +import org.geysermc.connector.entity.factory.EntityFactory; +import org.geysermc.connector.entity.factory.ExperienceOrbEntityFactory; +import org.geysermc.connector.entity.factory.PaintingEntityFactory; +import org.geysermc.connector.entity.living.*; +import org.geysermc.connector.entity.living.animal.*; +import org.geysermc.connector.entity.living.animal.horse.*; +import org.geysermc.connector.entity.living.animal.tameable.CatEntity; +import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; +import org.geysermc.connector.entity.living.animal.tameable.TameableEntity; +import org.geysermc.connector.entity.living.animal.tameable.WolfEntity; +import org.geysermc.connector.entity.living.merchant.AbstractMerchantEntity; +import org.geysermc.connector.entity.living.merchant.VillagerEntity; +import org.geysermc.connector.entity.living.monster.*; +import org.geysermc.connector.entity.living.monster.raid.PillagerEntity; +import org.geysermc.connector.entity.living.monster.raid.RaidParticipantEntity; +import org.geysermc.connector.entity.living.monster.raid.SpellcasterIllagerEntity; +import org.geysermc.connector.entity.living.monster.raid.VindicatorEntity; +import org.geysermc.connector.entity.player.PlayerEntity; +import org.geysermc.connector.network.translators.chat.MessageTranslator; + +public final class EntityDefinitions { + public static final EntityDefinition AREA_EFFECT_CLOUD; + public static final EntityDefinition ARMOR_STAND; + public static final EntityDefinition ARROW; + public static final EntityDefinition AXOLOTL; + public static final EntityDefinition BAT; + public static final EntityDefinition BEE; + public static final EntityDefinition BLAZE; + public static final EntityDefinition BOAT; + public static final EntityDefinition CAT; + public static final EntityDefinition CAVE_SPIDER; + public static final EntityDefinition CHICKEN; + public static final EntityDefinition CREEPER; + public static final EntityDefinition COD; + public static final EntityDefinition COW; + public static final EntityDefinition DONKEY; + public static final EntityDefinition DOLPHIN; + public static final EntityDefinition DRAGON_FIREBALL; + public static final EntityDefinition DROWNED; + public static final EntityDefinition ELDER_GUARDIAN; + public static final EntityDefinition ENDERMAN; + public static final EntityDefinition ENDERMITE; + public static final EntityDefinition ENDER_DRAGON; + public static final EntityDefinition END_CRYSTAL; + public static final EntityDefinition EVOKER; + public static final EntityDefinition EVOKER_FANGS; + public static final EntityDefinition EXPERIENCE_ORB; + public static final EntityDefinition EYE_OF_ENDER; + public static final EntityDefinition FALLING_BLOCK; + public static final EntityDefinition FIREBALL; + public static final EntityDefinition FISHING_BOBBER; + public static final EntityDefinition FIREWORK_ROCKET; + public static final EntityDefinition FOX; + public static final EntityDefinition GIANT; + public static final EntityDefinition GHAST; + public static final EntityDefinition GLOW_ITEM_FRAME; + public static final EntityDefinition GLOW_SQUID; + public static final EntityDefinition GOAT; + public static final EntityDefinition GUARDIAN; + public static final EntityDefinition HOGLIN; + public static final EntityDefinition HORSE; + public static final EntityDefinition HUSK; + public static final EntityDefinition ILLUSIONER; // Not present on Bedrock + public static final EntityDefinition IRON_GOLEM; + public static final EntityDefinition ITEM; + public static final EntityDefinition ITEM_FRAME; + public static final EntityDefinition LEASH_KNOT; + public static final EntityDefinition LIGHTNING_BOLT; + public static final EntityDefinition LLAMA; + public static final EntityDefinition LLAMA_SPIT; + public static final EntityDefinition MAGMA_CUBE; + public static final EntityDefinition MINECART; + public static final EntityDefinition MINECART_CHEST; + public static final EntityDefinition MINECART_COMMAND_BLOCK; + public static final EntityDefinition MINECART_HOPPER; + public static final EntityDefinition MINECART_FURNACE; // Not present on Bedrock + public static final EntityDefinition MINECART_SPAWNER; // Not present on Bedrock + public static final EntityDefinition MINECART_TNT; + public static final EntityDefinition MOOSHROOM; + public static final EntityDefinition MULE; + public static final EntityDefinition OCELOT; + public static final EntityDefinition PAINTING; + public static final EntityDefinition PANDA; + public static final EntityDefinition PARROT; + public static final EntityDefinition PHANTOM; + public static final EntityDefinition PIG; + public static final EntityDefinition PIGLIN; + public static final EntityDefinition PIGLIN_BRUTE; + public static final EntityDefinition PILLAGER; + public static final EntityDefinition PLAYER; + public static final EntityDefinition POLAR_BEAR; + public static final EntityDefinition PRIMED_TNT; + public static final EntityDefinition PUFFERFISH; + public static final EntityDefinition RABBIT; + public static final EntityDefinition RAVAGER; + public static final EntityDefinition SALMON; + public static final EntityDefinition SHEEP; + public static final EntityDefinition SHULKER; + public static final EntityDefinition SHULKER_BULLET; + public static final EntityDefinition SILVERFISH; + public static final EntityDefinition SKELETON; + public static final EntityDefinition SKELETON_HORSE; + public static final EntityDefinition SLIME; + public static final EntityDefinition SMALL_FIREBALL; + public static final EntityDefinition SNOWBALL; + public static final EntityDefinition SNOW_GOLEM; + public static final EntityDefinition SPECTRAL_ARROW; + public static final EntityDefinition SPIDER; + public static final EntityDefinition SQUID; + public static final EntityDefinition STRAY; + public static final EntityDefinition STRIDER; + public static final EntityDefinition THROWN_EGG; + public static final EntityDefinition THROWN_ENDERPEARL; + public static final EntityDefinition THROWN_EXP_BOTTLE; + public static final EntityDefinition THROWN_POTION; + public static final EntityDefinition TROPICAL_FISH; + public static final EntityDefinition TURTLE; + public static final EntityDefinition TRADER_LLAMA; + public static final EntityDefinition TRIDENT; + public static final EntityDefinition WANDERING_TRADER; + public static final EntityDefinition WITCH; + public static final EntityDefinition WITHER; + public static final EntityDefinition WITHER_SKELETON; + public static final EntityDefinition WITHER_SKULL; + public static final EntityDefinition WOLF; + public static final EntityDefinition VILLAGER; + public static final EntityDefinition VINDICATOR; + public static final EntityDefinition VEX; + public static final EntityDefinition ZOGLIN; + public static final EntityDefinition ZOMBIE; + public static final EntityDefinition ZOMBIE_HORSE; + public static final EntityDefinition ZOMBIE_VILLAGER; + public static final EntityDefinition ZOMBIFIED_PIGLIN; + + /** + * Is not sent over the network + */ + public static final EntityDefinition ENDER_DRAGON_PART; + /** + * Special Bedrock type + */ + public static final EntityDefinition WITHER_SKULL_DANGEROUS; + + static { + EntityDefinition entityBase = EntityDefinition.builder((BaseEntityFactory) Entity::new) + .addTranslator(MetadataType.BYTE, Entity::setFlags) + .addTranslator(MetadataType.INT, Entity::setAir) // Air/bubbles + .addTranslator(MetadataType.OPTIONAL_CHAT, Entity::setDisplayName) + .addTranslator(MetadataType.BOOLEAN, Entity::setDisplayNameVisible) + .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.SILENT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, Entity::setGravity) + .addTranslator(MetadataType.POSE, Entity::setPose) + .addTranslator(MetadataType.INT, Entity::setFreezing) + .build(); + + // Extends entity + { + AREA_EFFECT_CLOUD = EntityDefinition.inherited(AreaEffectCloudEntity::new, entityBase) + .type(EntityType.AREA_EFFECT_CLOUD) + .bedrockId(95) + .height(0.5f).width(1.0f) + .addTranslator(MetadataType.FLOAT, AreaEffectCloudEntity::setRadius) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) + .addTranslator(null) // Waiting + .addTranslator(MetadataType.PARTICLE, AreaEffectCloudEntity::setParticle) + .build(); + BOAT = EntityDefinition.inherited(BoatEntity::new, entityBase) + .type(EntityType.BOAT) + .bedrockId(90) + .height(0.6f).width(1.6f) + .offset(0.35f) + .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_TIME, entityMetadata.getValue())) // Time since last hit + .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_DIRECTION, entityMetadata.getValue())) // Rocking direction + .addTranslator(MetadataType.FLOAT, (boatEntity, entityMetadata) -> + // 'Health' in Bedrock, damage taken in Java - it makes motion in Bedrock + boatEntity.getDirtyMetadata().put(EntityData.HEALTH, 40 - ((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue()))) + .addTranslator(MetadataType.INT, BoatEntity::setVariant) + .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingLeft) + .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingRight) + .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything + .build(); + DRAGON_FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) + .type(EntityType.DRAGON_FIREBALL) + .bedrockId(79) + .heightAndWidth(1.0f) + .build(); + END_CRYSTAL = EntityDefinition.inherited(EnderCrystalEntity::new, entityBase) + .type(EntityType.END_CRYSTAL) + .bedrockId(71) + .heightAndWidth(2.0f) + .addTranslator(MetadataType.OPTIONAL_POSITION, EnderCrystalEntity::setBlockTarget) + .addTranslator(MetadataType.BOOLEAN, + (enderCrystalEntity, entityMetadata) -> enderCrystalEntity.setFlag(EntityFlag.SHOW_BOTTOM, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) // There is a base located on the ender crystal + .build(); + EXPERIENCE_ORB = EntityDefinition.inherited((ExperienceOrbEntityFactory) ExpOrbEntity::new, entityBase) + .type(EntityType.EXPERIENCE_ORB) + .bedrockId(69) + .identifier("minecraft:xp_orb") + .build(); + EVOKER_FANGS = EntityDefinition.inherited(entityBase.factory(), entityBase) + .type(EntityType.EVOKER_FANGS) + .bedrockId(103) + .height(0.8f).width(0.5f) + .identifier("minecraft:evocation_fang") + .build(); + EYE_OF_ENDER = EntityDefinition.inherited(Entity::new, entityBase) + .type(EntityType.EYE_OF_ENDER) + .bedrockId(70) + .heightAndWidth(0.25f) + .identifier("minecraft:eye_of_ender_signal") + .build(); + FALLING_BLOCK = EntityDefinition.inherited(new EntityFactory() { + }, entityBase) // TODO + .type(EntityType.FALLING_BLOCK) + .bedrockId(66) + .heightAndWidth(0.98f) + .build(); + FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) + .type(EntityType.FIREBALL) + .bedrockId(85) + .heightAndWidth(1.0f) + .build(); + FIREWORK_ROCKET = EntityDefinition.inherited(FireworkEntity::new, entityBase) + .type(EntityType.FIREWORK_ROCKET) + .bedrockId(72) + .heightAndWidth(0.25f) + .identifier("minecraft:fireworks_rocket") + .addTranslator(MetadataType.ITEM, FireworkEntity::setFireworkItem) + .addTranslator(MetadataType.OPTIONAL_VARINT, FireworkEntity::setPlayerGliding) + .build(); + FISHING_BOBBER = EntityDefinition.inherited(new EntityFactory() { + }, entityBase) //TODO + .type(EntityType.FISHING_BOBBER) + .bedrockId(77) + .identifier("minecraft:fishing_book") + .addTranslator(MetadataType.INT, FishingHookEntity::setHookedEntity) + .build(); + ITEM = EntityDefinition.inherited(ItemEntity::new, entityBase) + .type(EntityType.ITEM) + .bedrockId(64) + .heightAndWidth(0.25f) + .offset(0.125f) + .addTranslator(MetadataType.ITEM, ItemEntity::setItem) + .build(); + LEASH_KNOT = EntityDefinition.inherited(LeashKnotEntity::new, entityBase) + .type(EntityType.LEASH_KNOT) + .bedrockId(88) + .height(0.5f).width(0.375f) + .build(); + LIGHTNING_BOLT = EntityDefinition.inherited(LightningEntity::new, entityBase) + .type(EntityType.LIGHTNING_BOLT) + .bedrockId(93) + .build(); + LLAMA_SPIT = EntityDefinition.inherited(ThrowableEntity::new, entityBase) + .type(EntityType.LLAMA_SPIT) + .bedrockId(102) + .heightAndWidth(0.25f) + .build(); + PAINTING = EntityDefinition.inherited((PaintingEntityFactory) PaintingEntity::new, entityBase) + .type(EntityType.PAINTING) + .bedrockId(83) + .build(); + PRIMED_TNT = EntityDefinition.inherited(TNTEntity::new, entityBase) + .type(EntityType.PRIMED_TNT) + .bedrockId(65) + .heightAndWidth(0.98f) + .identifier("minecraft:tnt") + .addTranslator(MetadataType.INT, TNTEntity::setFuseLength) + .build(); + SHULKER_BULLET = EntityDefinition.inherited(ThrowableEntity::new, entityBase) + .type(EntityType.SHULKER_BULLET) + .bedrockId(76) + .heightAndWidth(0.3125f) + .build(); + SMALL_FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) + .type(EntityType.SMALL_FIREBALL) + .bedrockId(94) + .heightAndWidth(0.3125f) + .build(); + SNOWBALL = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) + .type(EntityType.SNOWBALL) + .bedrockId(81) + .heightAndWidth(0.25f) + .build(); + THROWN_ENDERPEARL = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) + .type(EntityType.THROWN_ENDERPEARL) + .bedrockId(87) + .heightAndWidth(0.25f) + .identifier("minecraft:ender_pearl") + .build(); + THROWN_EGG = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) + .type(EntityType.THROWN_EGG) + .bedrockId(82) + .heightAndWidth(0.25f) + .identifier("minecraft:egg") + .build(); + THROWN_EXP_BOTTLE = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) + .type(EntityType.THROWN_EXP_BOTTLE) + .bedrockId(68) + .heightAndWidth(0.25f) + .identifier("minecraft:xp_bottle") + .build(); + THROWN_POTION = EntityDefinition.inherited(ThrownPotionEntity::new, entityBase) + .type(EntityType.THROWN_POTION) + .bedrockId(86) + .heightAndWidth(0.25f) + .identifier("minecraft:splash_potion") + .addTranslator(MetadataType.ITEM, ThrownPotionEntity::setPotion) + .build(); + + EntityDefinition abstractArrowBase = EntityDefinition.inherited(AbstractArrowEntity::new, entityBase) + .addTranslator(MetadataType.BYTE, AbstractArrowEntity::setArrowFlags) + .addTranslator(null) // "Piercing level" + .build(); + ARROW = EntityDefinition.inherited(TippedArrowEntity::new, abstractArrowBase) + .type(EntityType.ARROW) + .bedrockId(80) + .heightAndWidth(0.25f) + .addTranslator(MetadataType.INT, TippedArrowEntity::setPotionEffectColor) + .build(); + SPECTRAL_ARROW = EntityDefinition.inherited(abstractArrowBase.factory(), abstractArrowBase) + .type(EntityType.SPECTRAL_ARROW) + .bedrockId(80) + .heightAndWidth(0.25f) + .identifier("minecraft:arrow") + .build(); + TRIDENT = EntityDefinition.inherited(TridentEntity::new, abstractArrowBase) // TODO remove class + .type(EntityType.TRIDENT) + .bedrockId(73) + .identifier("minecraft:thrown_trident") + .addTranslator(null) // Loyalty + .addTranslator(MetadataType.BOOLEAN, (tridentEntity, entityMetadata) -> tridentEntity.setFlag(EntityFlag.ENCHANTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .build(); + + // Item frames are handled differently as they are blocks, not items, in Bedrock + ITEM_FRAME = EntityDefinition.inherited(new EntityFactory() { + }, entityBase) // TODO + .type(EntityType.ITEM_FRAME) + .addTranslator(MetadataType.ITEM, ItemFrameEntity::setItemInFrame) + .addTranslator(MetadataType.ITEM, ItemFrameEntity::setItemRotation) + .build(); + GLOW_ITEM_FRAME = EntityDefinition.inherited(ITEM_FRAME.factory(), ITEM_FRAME) + .type(EntityType.GLOW_ITEM_FRAME) + .build(); + + MINECART = EntityDefinition.inherited(MinecartEntity::new, entityBase) + .type(EntityType.MINECART) + .bedrockId(84) + .height(0.7f).width(0.98f) + .offset(0.35f) + .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HEALTH, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HURT_DIRECTION, entityMetadata.getValue())) // Direction in which the minecart is shaking + .addTranslator(MetadataType.FLOAT, (minecartEntity, entityMetadata) -> + // Power in Java, time in Bedrock + minecartEntity.getDirtyMetadata().put(EntityData.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15))) + .addTranslator(MetadataType.BLOCK_STATE, MinecartEntity::setCustomBlock) + .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset) + .addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock) + .build(); + MINECART_CHEST = EntityDefinition.inherited(MINECART.factory(), MINECART) + .type(EntityType.MINECART_CHEST) + .identifier("minecraft:chest_minecart") + .build(); + MINECART_COMMAND_BLOCK = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) + .type(EntityType.MINECART_COMMAND_BLOCK) + .bedrockId(100) + .identifier("minecraft:command_block_minecart") + .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) + .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) + .build(); + MINECART_FURNACE = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) + .type(EntityType.MINECART_FURNACE) + .identifier("minecraft:minecart") + .addTranslator(MetadataType.BOOLEAN, FurnaceMinecartEntity::setHasFuel) + .build(); + MINECART_HOPPER = EntityDefinition.inherited(MINECART.factory(), MINECART) + .type(EntityType.MINECART_HOPPER) + .identifier("minecraft:hopper_minecart") + .build(); + MINECART_SPAWNER = EntityDefinition.inherited(SpawnerMinecartEntity::new, MINECART) + .type(EntityType.MINECART_SPAWNER) + .identifier("minecraft:minecart") + .build(); + MINECART_TNT = EntityDefinition.inherited(MINECART.factory(), MINECART) + .type(EntityType.MINECART_TNT) + .identifier("minecraft:tnt_minecart") + .build(); + + WITHER_SKULL = EntityDefinition.inherited(WitherSkullEntity::new, entityBase) + .type(EntityType.WITHER_SKULL) + .bedrockId(89) + .heightAndWidth(0.3125f) + .addTranslator(MetadataType.BOOLEAN, WitherSkullEntity::setDangerous) + .build(); + WITHER_SKULL_DANGEROUS = EntityDefinition.inherited(WITHER_SKULL.factory(), WITHER_SKULL) + .bedrockId(91) + .build(false); + } + + EntityDefinition livingEntityBase = EntityDefinition.inherited(LivingEntity::new, entityBase) + .addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags) + .addTranslator(MetadataType.FLOAT, LivingEntity::setHealth) + .addTranslator(MetadataType.FLOAT, + (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) + .addTranslator(MetadataType.BOOLEAN, + (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0))) + .addTranslator(null) // Arrow count + .addTranslator(null) // Stinger count + .addTranslator(MetadataType.POSITION, LivingEntity::setBedPosition) + .build(); + + ARMOR_STAND = EntityDefinition.inherited(ArmorStandEntity::new, livingEntityBase) + .type(EntityType.ARMOR_STAND) + .bedrockId(61) + .height(1.975f).width(0.5f) + .addTranslator(MetadataType.BYTE, ArmorStandEntity::setArmorStandFlags) + .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setHeadRotation) + .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setBodyRotation) + .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setLeftArmRotation) + .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setRightArmRotation) + .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setLeftLegRotation) + .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setRightLegRotation) + .build(); + PLAYER = EntityDefinition.inherited(null, livingEntityBase) + .type(EntityType.PLAYER) + .bedrockId(63) + .height(1.8f).width(0.6f) + .offset(1.62f) + .addTranslator(MetadataType.FLOAT, PlayerEntity::setAbsorptionHearts) + .addTranslator(null) // Player score + .addTranslator(MetadataType.BYTE, PlayerEntity::setSkinVisibility) + .addTranslator(null) // Player main hand + .addTranslator(MetadataType.NBT_TAG, PlayerEntity::setLeftParrot) + .addTranslator(MetadataType.NBT_TAG, PlayerEntity::setRightParrot) + .build(); + + EntityDefinition mobEntityBase = EntityDefinition.inherited(MobEntity::new, livingEntityBase) + .addTranslator(MetadataType.BYTE, MobEntity::setMobFlags) + .build(); + + // Extends mob + { + BAT = EntityDefinition.inherited(BatEntity::new, mobEntityBase) + .type(EntityType.BAT) + .bedrockId(19) + .height(0.9f).width(0.5f) + .addTranslator(MetadataType.BYTE, BatEntity::setBatFlags) + .build(); + BLAZE = EntityDefinition.inherited(BlazeEntity::new, mobEntityBase) + .type(EntityType.BLAZE) + .bedrockId(43) + .height(1.8f).width(0.6f) + .addTranslator(MetadataType.BYTE, BlazeEntity::setBlazeFlags) + .build(); + CAVE_SPIDER = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) + .type(EntityType.CAVE_SPIDER) + .bedrockId(40) + .height(0.5f).width(0.7f) + .build(); + CREEPER = EntityDefinition.inherited(CreeperEntity::new, mobEntityBase) + .type(EntityType.CREEPER) + .bedrockId(33) + .height(1.7f).width(0.6f) + .offset(1.62f) + .addTranslator(MetadataType.INT, CreeperEntity::setSwelling) + .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.POWERED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, CreeperEntity::setIgnited) + .build(); + DOLPHIN = EntityDefinition.inherited(WaterEntity::new, mobEntityBase) + .type(EntityType.DOLPHIN) + .bedrockId(31) + .height(0.6f).width(0.9f) + //TODO check + .addTranslator(null) // treasure position + .addTranslator(null) // "got fish" + .addTranslator(null) // "moistness level" + .build(); + ENDERMAN = EntityDefinition.inherited(EndermanEntity::new, mobEntityBase) + .type(EntityType.ENDERMAN) + .bedrockId(38) + .height(2.9f).width(0.6f) + .addTranslator(MetadataType.BLOCK_STATE, EndermanEntity::setCarriedBlock) + .addTranslator(MetadataType.BOOLEAN, EndermanEntity::setScreaming) + .addTranslator(MetadataType.BOOLEAN, EndermanEntity::setAngry) + .build(); + ENDERMITE = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) + .type(EntityType.ENDERMITE) + .bedrockId(55) + .height(0.3f).width(0.4f) + .build(); + ENDER_DRAGON = EntityDefinition.inherited(EnderDragonEntity::new, mobEntityBase) + .type(EntityType.ENDER_DRAGON) + .bedrockId(53) + .addTranslator(MetadataType.INT, EnderDragonEntity::setPhase) + .build(); + GHAST = EntityDefinition.inherited(GhastEntity::new, mobEntityBase) + .type(EntityType.GHAST) + .bedrockId(41) + .heightAndWidth(4.0f) + .addTranslator(MetadataType.BOOLEAN, GhastEntity::setGhastAttacking) + .build(); + GIANT = EntityDefinition.inherited(GiantEntity::new, mobEntityBase) + .type(EntityType.GIANT) + .bedrockId(32) + .height(1.8f).width(1.6f) + .offset(1.62f) + .identifier("minecraft:zombie") + .build(); + IRON_GOLEM = EntityDefinition.inherited(IronGolemEntity::new, mobEntityBase) + .type(EntityType.IRON_GOLEM) + .bedrockId(20) + .height(2.7f).width(1.4f) + .build(); + PHANTOM = EntityDefinition.inherited(PhantomEntity::new, mobEntityBase) + .type(EntityType.PHANTOM) + .bedrockId(58) + .height(0.5f).width(0.9f) + .offset(0.6f) + .addTranslator(MetadataType.INT, PhantomEntity::setPhantomScale) + .build(); + SILVERFISH = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) + .type(EntityType.SILVERFISH) + .bedrockId(39) + .height(0.3f).width(0.4f) + .build(); + SHULKER = EntityDefinition.inherited(ShulkerEntity::new, mobEntityBase) + .type(EntityType.SHULKER) + .bedrockId(54) + .heightAndWidth(1f) + .addTranslator(MetadataType.DIRECTION, ShulkerEntity::setAttachedFace) + .addTranslator(MetadataType.BYTE, ShulkerEntity::setShulkerHeight) + .addTranslator(MetadataType.BYTE, ShulkerEntity::setShulkerColor) + .build(); + SKELETON = EntityDefinition.inherited(SkeletonEntity::new, mobEntityBase) + .type(EntityType.SKELETON) + .bedrockId(34) + .height(1.8f).width(0.6f) + .offset(1.62f) + .addTranslator(MetadataType.BOOLEAN, SkeletonEntity::setConvertingToStray) + .build(); + SNOW_GOLEM = EntityDefinition.inherited(SnowGolemEntity::new, mobEntityBase) + .type(EntityType.SNOW_GOLEM) + .bedrockId(21) + .height(1.9f).width(0.7f) + .addTranslator(MetadataType.BYTE, SnowGolemEntity::setSnowGolemFlags) + .build(); + SPIDER = EntityDefinition.inherited(SpiderEntity::new, mobEntityBase) + .type(EntityType.SPIDER) + .bedrockId(35) + .height(0.9f).width(1.4f) + .offset(1f) + .addTranslator(MetadataType.BYTE, SpiderEntity::setSpiderFlags) + .build(); + SQUID = EntityDefinition.inherited(SquidEntity::new, mobEntityBase) + .type(EntityType.SQUID) + .bedrockId(17) + .heightAndWidth(0.8f) + .build(); + STRAY = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) + .type(EntityType.STRAY) + .bedrockId(46) + .height(1.8f).width(0.6f) + .offset(1.62f) + .build(); + VEX = EntityDefinition.inherited(VexEntity::new, mobEntityBase) + .type(EntityType.VEX) + .bedrockId(105) + .height(0.8f).width(0.4f) + .addTranslator(MetadataType.BYTE, VexEntity::setVexFlags) + .build(); + WITHER = EntityDefinition.inherited(WitherEntity::new, mobEntityBase) + .type(EntityType.WITHER) + .bedrockId(52) + .height(3.5f).width(0.9f) + .addTranslator(MetadataType.INT, WitherEntity::setTarget1) + .addTranslator(MetadataType.INT, WitherEntity::setTarget2) + .addTranslator(MetadataType.INT, WitherEntity::setTarget3) + .addTranslator(MetadataType.INT, WitherEntity::setInvulnerableTicks) + .build(); + WITHER_SKELETON = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) + .type(EntityType.WITHER_SKELETON) + .bedrockId(48) + .height(2.4f).width(0.7f) + .build(); + ZOGLIN = EntityDefinition.inherited(ZoglinEntity::new, mobEntityBase) + .type(EntityType.ZOGLIN) + .bedrockId(126) + .height(1.4f).width(1.3965f) + .addTranslator(MetadataType.BOOLEAN, ZoglinEntity::setBaby) + .build(); + ZOMBIE = EntityDefinition.inherited(ZombieEntity::new, mobEntityBase) + .type(EntityType.ZOMBIE) + .bedrockId(32) + .height(1.8f).width(0.6f) + .offset(1.62f) + .addTranslator(MetadataType.BOOLEAN, ZombieEntity::setZombieBaby) + .addTranslator(null) // "set special type", doesn't do anything + .addTranslator(MetadataType.BOOLEAN, ZombieEntity::setConvertingToDrowned) + .build(); + ZOMBIE_VILLAGER = EntityDefinition.inherited(ZombieVillagerEntity::new, ZOMBIE) + .type(EntityType.ZOMBIE_VILLAGER) + .bedrockId(44) + .height(1.8f).width(0.6f) + .offset(1.62f) + .identifier("minecraft:zombie_villager_v2") + .addTranslator(MetadataType.BOOLEAN, ZombieVillagerEntity::setTransforming) + .addTranslator(MetadataType.VILLAGER_DATA, ZombieVillagerEntity::setZombieVillagerData) + .build(); + ZOMBIFIED_PIGLIN = EntityDefinition.inherited(ZombifiedPiglinEntity::new, ZOMBIE) //TODO test how zombie entity metadata is handled? + .type(EntityType.ZOMBIFIED_PIGLIN) + .bedrockId(36) + .height(1.95f).width(0.6f) + .offset(1.62f) + .identifier("minecraft:zombie_pigman") + .build(); + + DROWNED = EntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) + .type(EntityType.DROWNED) + .bedrockId(110) + .height(1.95f).width(0.6f) + .build(); + HUSK = EntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) + .type(EntityType.HUSK) + .bedrockId(47) + .build(); + + GUARDIAN = EntityDefinition.inherited(GuardianEntity::new, mobEntityBase) + .type(EntityType.GUARDIAN) + .bedrockId(49) + .heightAndWidth(0.85f) + .addTranslator(null) // Moving //TODO + .addTranslator(MetadataType.INT, GuardianEntity::setGuardianTarget) + .build(); + ELDER_GUARDIAN = EntityDefinition.inherited(ElderGuardianEntity::new, GUARDIAN) + .type(EntityType.ELDER_GUARDIAN) + .bedrockId(50) + .heightAndWidth(1.9975f) + .build(); + + SLIME = EntityDefinition.inherited(SlimeEntity::new, mobEntityBase) + .type(EntityType.SLIME) + .bedrockId(37) + .heightAndWidth(0.51f) + .addTranslator(MetadataType.INT, SlimeEntity::setScale) + .build(); + MAGMA_CUBE = EntityDefinition.inherited(MagmaCubeEntity::new, SLIME) + .type(EntityType.MAGMA_CUBE) + .bedrockId(42) + .build(); + + EntityDefinition abstractFishEntityBase = EntityDefinition.inherited(AbstractFishEntity::new, mobEntityBase) + .addTranslator(null) // From bucket + .build(); + COD = EntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) + .type(EntityType.COD) + .bedrockId(112) + .height(0.25f).width(0.5f) + .build(); + PUFFERFISH = EntityDefinition.inherited(PufferFishEntity::new, abstractFishEntityBase) + .type(EntityType.PUFFERFISH) + .bedrockId(108) + .heightAndWidth(0.7f) + .addTranslator(MetadataType.INT, PufferFishEntity::setPufferfishSize) + .build(); + SALMON = EntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) + .type(EntityType.SALMON) + .bedrockId(109) + .height(0.5f).width(0.7f) + .build(); + TROPICAL_FISH = EntityDefinition.inherited(TropicalFishEntity::new, abstractFishEntityBase) + .type(EntityType.TROPICAL_FISH) + .bedrockId(111) + .heightAndWidth(0.6f) + .identifier("minecraft:tropicalfish") + .build(); + + EntityDefinition abstractPiglinEntityBase = EntityDefinition.inherited(BasePiglinEntity::new, mobEntityBase) + .addTranslator(MetadataType.BOOLEAN, BasePiglinEntity::setImmuneToZombification) + .build(); + PIGLIN = EntityDefinition.inherited(PiglinEntity::new, abstractPiglinEntityBase) + .type(EntityType.PIGLIN) + .bedrockId(123) + .height(1.95f).width(0.6f) + .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setBaby) + .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setChargingCrossbow) + .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setDancing) + .build(); + PIGLIN_BRUTE = EntityDefinition.inherited(abstractPiglinEntityBase.factory(), abstractPiglinEntityBase) + .type(EntityType.PIGLIN_BRUTE) + .bedrockId(127) + .height(1.95f).width(0.6f) + .build(); + + GLOW_SQUID = EntityDefinition.inherited(GlowSquidEntity::new, SQUID) + .type(EntityType.GLOW_SQUID) + .addTranslator(null) // Set dark ticks remaining, possible TODO + .build(); + + EntityDefinition raidParticipantEntityBase = EntityDefinition.inherited(RaidParticipantEntity::new, mobEntityBase) + .addTranslator(null) // Celebrating //TODO + .build(); + EntityDefinition spellcasterEntityBase = EntityDefinition.inherited(SpellcasterIllagerEntity::new, raidParticipantEntityBase) + .addTranslator(MetadataType.BYTE, SpellcasterIllagerEntity::setSpellType) + .build(); + EVOKER = EntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) + .type(EntityType.EVOKER) + .bedrockId(104) + .height(1.95f).width(0.6f) + .identifier("minecraft:evocation_illager") + .build(); + ILLUSIONER = EntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) + .type(EntityType.ILLUSIONER) + .bedrockId(104) + .height(1.95f).width(0.6f) + .identifier("minecraft:evocation_illager") + .build(); + PILLAGER = EntityDefinition.inherited(PillagerEntity::new, raidParticipantEntityBase) + .type(EntityType.PILLAGER) + .bedrockId(114) + .height(1.8f).width(0.6f) + .offset(1.62f) + .addTranslator(null) // Charging; doesn't have an equivalent on Bedrock //TODO check + .build(); + RAVAGER = EntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) + .type(EntityType.RAVAGER) + .bedrockId(59) + .height(1.9f).width(1.2f) + .build(); + VINDICATOR = EntityDefinition.inherited(VindicatorEntity::new, raidParticipantEntityBase) + .type(EntityType.VINDICATOR) + .bedrockId(57) + .height(1.8f).width(0.6f) + .offset(1.62f) + .build(); + WITCH = EntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) + .type(EntityType.WITCH) + .bedrockId(45) + .height(1.8f).width(0.6f) + .offset(1.62f) + .build(); + } + + EntityDefinition ageableEntityBase = EntityDefinition.inherited(AgeableEntity::new, mobEntityBase) + .addTranslator(MetadataType.BOOLEAN, AgeableEntity::setBaby) + .build(); + + // Extends ageable + { + AXOLOTL = EntityDefinition.inherited(AxolotlEntity::new, ageableEntityBase) + .type(EntityType.AXOLOTL) + .height(0.42f).width(0.7f) + .addTranslator(MetadataType.INT, AxolotlEntity::setVariant) + .addTranslator(MetadataType.BOOLEAN, AxolotlEntity::setPlayingDead) + .build(); + BEE = EntityDefinition.inherited(BeeEntity::new, ageableEntityBase) + .type(EntityType.BEE) + .bedrockId(122) + .heightAndWidth(0.6f) + .addTranslator(MetadataType.BYTE, BeeEntity::setBeeFlags) + .addTranslator(MetadataType.INT, BeeEntity::setAngerTime) + .build(); + CHICKEN = EntityDefinition.inherited(ChickenEntity::new, ageableEntityBase) + .type(EntityType.CHICKEN) + .bedrockId(10) + .height(0.7f).width(0.4f) + .build(); + COW = EntityDefinition.inherited(AnimalEntity::new, ageableEntityBase) + .type(EntityType.COW) + .bedrockId(11) + .height(1.4f).width(0.9f) + .build(); + FOX = EntityDefinition.inherited(FoxEntity::new, ageableEntityBase) + .type(EntityType.FOX) + .bedrockId(121) + .height(0.5f).width(1.25f) + .addTranslator(MetadataType.INT, FoxEntity::setFoxVariant) + .addTranslator(MetadataType.BYTE, FoxEntity::setFoxFlags) + .build(); + HOGLIN = EntityDefinition.inherited(HoglinEntity::new, ageableEntityBase) + .type(EntityType.HOGLIN) + .bedrockId(124) + .height(1.4f).width(1.3965f) + .addTranslator(MetadataType.BOOLEAN, HoglinEntity::setImmuneToZombification) + .build(); + GOAT = EntityDefinition.inherited(GoatEntity::new, ageableEntityBase) + .type(EntityType.GOAT) + .height(1.3f).width(0.9f) + .addTranslator(MetadataType.BOOLEAN, GoatEntity::setScreamer) + .build(); + MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase) // TODO remove class + .type(EntityType.MOOSHROOM) + .bedrockId(16) + .height(1.4f).width(0.9f) + .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue().equals("brown") ? 1 : 0)) + .build(); + OCELOT = EntityDefinition.inherited(OcelotEntity::new, ageableEntityBase) + .type(EntityType.OCELOT) + .bedrockId(22) + .height(0.35f).width(0.3f) + .addTranslator(MetadataType.BOOLEAN, (ocelotEntity, entityMetadata) -> ocelotEntity.setFlag(EntityFlag.TRUSTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .build(); + PANDA = EntityDefinition.inherited(PandaEntity::new, ageableEntityBase) + .type(EntityType.PANDA) + .bedrockId(113) + .height(1.25f).width(1.125f) + .addTranslator(null) // Unhappy counter + .addTranslator(null) // Sneeze counter + .addTranslator(MetadataType.INT, PandaEntity::setEatingCounter) + .addTranslator(MetadataType.BYTE, PandaEntity::setMainGene) + .addTranslator(MetadataType.BYTE, PandaEntity::setHiddenGene) + .addTranslator(MetadataType.BYTE, PandaEntity::setPandaFlags) + .build(); + PIG = EntityDefinition.inherited(PigEntity::new, ageableEntityBase) + .type(EntityType.PIG) + .bedrockId(12) + .heightAndWidth(0.9f) + .addTranslator(MetadataType.BOOLEAN, (pigEntity, entityMetadata) -> pigEntity.setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(null) // Boost time + .build(); + POLAR_BEAR = EntityDefinition.inherited(PolarBearEntity::new, ageableEntityBase) + .type(EntityType.POLAR_BEAR) + .bedrockId(28) + .height(1.4f).width(1.3f) + .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.STANDING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .build(); + RABBIT = EntityDefinition.inherited(RabbitEntity::new, ageableEntityBase) + .type(EntityType.RABBIT) + .bedrockId(18) + .height(0.5f).width(0.4f) + .addTranslator(MetadataType.INT, RabbitEntity::setRabbitVariant) + .build(); + SHEEP = EntityDefinition.inherited(SheepEntity::new, ageableEntityBase) + .type(EntityType.SHEEP) + .bedrockId(13) + .heightAndWidth(0.9f) + .addTranslator(MetadataType.BYTE, SheepEntity::setSheepFlags) + .build(); + STRIDER = EntityDefinition.inherited(StriderEntity::new, ageableEntityBase) + .type(EntityType.STRIDER) + .bedrockId(125) + .height(1.7f).width(0.9f) + .addTranslator(null) // Boost time + .addTranslator(MetadataType.BOOLEAN, StriderEntity::setCold) + .addTranslator(MetadataType.BOOLEAN, StriderEntity::setSaddled) + .build(); + TURTLE = EntityDefinition.inherited(TurtleEntity::new, ageableEntityBase) + .type(EntityType.TURTLE) + .bedrockId(74) + .height(0.4f).width(1.2f) + .addTranslator(MetadataType.BOOLEAN, TurtleEntity::setPregnant) + .addTranslator(MetadataType.BOOLEAN, TurtleEntity::setLayingEgg) + .build(); + + EntityDefinition abstractVillagerEntityBase = EntityDefinition.inherited(AbstractMerchantEntity::new, ageableEntityBase) + .addTranslator(null) // Unhappy ticks + .build(); + VILLAGER = EntityDefinition.inherited(VillagerEntity::new, abstractVillagerEntityBase) + .type(EntityType.VILLAGER) + .bedrockId(15) + .height(1.8f).width(0.6f) + .offset(1.62f) + .identifier("minecraft:villager_v2") + .addTranslator(MetadataType.VILLAGER_DATA, VillagerEntity::setVillagerData) + .build(); + WANDERING_TRADER = EntityDefinition.inherited(abstractVillagerEntityBase.factory(), abstractVillagerEntityBase) + .type(EntityType.WANDERING_TRADER) + .bedrockId(118) + .height(1.8f).width(0.6f) + .offset(1.62f) + .build(); + } + + // Horses + { + EntityDefinition abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase) + .addTranslator(MetadataType.BYTE, AbstractHorseEntity::setHorseFlags) + .addTranslator(null) // UUID of owner + .build(); + HORSE = EntityDefinition.inherited(HorseEntity::new, abstractHorseEntityBase) + .type(EntityType.HORSE) + .bedrockId(23) + .height(1.6f).width(1.3965f) + .addTranslator(MetadataType.BYTE, HorseEntity::setHorseVariant) + .build(); + SKELETON_HORSE = EntityDefinition.inherited(abstractHorseEntityBase.factory(), abstractHorseEntityBase) + .type(EntityType.SKELETON_HORSE) + .bedrockId(26) + .height(1.6f).width(1.3965f) + .build(); + ZOMBIE_HORSE = EntityDefinition.inherited(abstractHorseEntityBase.factory(), abstractHorseEntityBase) + .type(EntityType.ZOMBIE_HORSE) + .bedrockId(27) + .height(1.6f).width(1.3965f) + .build(); + EntityDefinition chestedHorseEntityBase = EntityDefinition.inherited(ChestedHorseEntity::new, abstractHorseEntityBase) + .addTranslator(MetadataType.BOOLEAN, (horseEntity, entityMetadata) -> horseEntity.setFlag(EntityFlag.CHESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .build(); + DONKEY = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) + .type(EntityType.DONKEY) + .bedrockId(24) + .height(1.6f).width(1.3965f) + .build(); + MULE = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) + .type(EntityType.MULE) + .bedrockId(25) + .height(1.6f).width(1.3965f) + .build(); + LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) + .type(EntityType.LLAMA) + .bedrockId(29) + .height(1.87f).width(0.9f) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.STRENGTH, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) + .build(); + TRADER_LLAMA = EntityDefinition.inherited(TraderLlamaEntity::new, LLAMA) + .type(EntityType.TRADER_LLAMA) + .identifier("minecraft:llama") + .build(); + } + + EntityDefinition tameableEntityBase = EntityDefinition.inherited(TameableEntity::new, ageableEntityBase) + .addTranslator(MetadataType.BYTE, TameableEntity::setTameableFlags) + .addTranslator(MetadataType.OPTIONAL_UUID, TameableEntity::setOwner) + .build(); + CAT = EntityDefinition.inherited(CatEntity::new, tameableEntityBase) + .type(EntityType.CAT) + .bedrockId(75) + .height(0.35f).width(0.3f) + .addTranslator(MetadataType.INT, CatEntity::setCatVariant) + .addTranslator(MetadataType.BOOLEAN, CatEntity::setResting) + .addTranslator(null) // "resting state one" //TODO + .addTranslator(MetadataType.INT, CatEntity::setCollarColor) + .build(); + PARROT = EntityDefinition.inherited(ParrotEntity::new, tameableEntityBase) + .type(EntityType.PARROT) + .bedrockId(30) + .height(0.9f).width(0.5f) + .addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) // Parrot color + .build(); + WOLF = EntityDefinition.inherited(WolfEntity::new, tameableEntityBase) + .type(EntityType.WOLF) + .bedrockId(14) + .height(0.85f).width(0.6f) + // "Begging" on wiki.vg, "Interested" in Nukkit - the tilt of the head + .addTranslator(MetadataType.BOOLEAN, (wolfEntity, entityMetadata) -> wolfEntity.setFlag(EntityFlag.INTERESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.INT, WolfEntity::setCollarColor) + .addTranslator(MetadataType.INT, WolfEntity::setWolfAngerTime) + .build(); + + // As of 1.18 these don't track entity data at all + ENDER_DRAGON_PART = EntityDefinition.builder(null) + .bedrockId(32) + .identifier("minecraft:armor_stand") // Emulated + .build(); + } + + public static void init() { + // no-op + } + + private EntityDefinitions() { + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java b/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java similarity index 57% rename from connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java rename to connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java index d0f99cdb9..e0936559d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/InsentientEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java @@ -23,29 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.entity.type.EntityType; -import org.geysermc.connector.network.session.GeyserSession; -public class InsentientEntity extends LivingEntity { +import java.util.function.BiConsumer; - public InsentientEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } +/** + * Translates a given Java {@link EntityMetadata} into a similar/same construct for Bedrock + */ - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 15 && entityMetadata.getType() == MetadataType.BYTE) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.NO_AI, (xd & 0x01) == 0x01); - } - - super.updateBedrockMetadata(entityMetadata, session); - } +public record EntityMetadataTranslator( + MetadataType acceptedType, + BiConsumer> translateFunction) { } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java index f6fbcde9d..14dacc4cd 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java @@ -27,22 +27,21 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; public class ExpOrbEntity extends Entity { private final int amount; - public ExpOrbEntity(int amount, long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ExpOrbEntity(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position) { + super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); this.amount = amount; } @Override - public void spawnEntity(GeyserSession session) { - this.metadata.put(EntityData.EXPERIENCE_VALUE, amount); - super.spawnEntity(session); + protected void initializeMetadata() { + super.initializeMetadata(); + this.dirtyMetadata.put(EntityData.EXPERIENCE_VALUE, amount); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java index a82118c21..5c5b4dde8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java @@ -26,31 +26,32 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class FallingBlockEntity extends Entity { private final int javaId; - public FallingBlockEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation, int javaId) { - super(entityId, geyserId, entityType, position, motion, rotation); + public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { + super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); this.javaId = javaId; } @Override - public void spawnEntity(GeyserSession session) { - this.metadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); - super.spawnEntity(session); + protected void initializeMetadata() { + super.initializeMetadata(); + this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { + public void setGravity(EntityMetadata entityMetadata) { + super.setGravity(entityMetadata); // Set the NO_AI flag based on the no gravity flag to prevent movement - if (entityMetadata.getId() == 5) { - this.metadata.getFlags().setFlag(EntityFlag.NO_AI, (boolean) entityMetadata.getValue()); - } + setFlag(EntityFlag.NO_AI, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java index 9de2102d5..fae7ca421 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java @@ -37,7 +37,6 @@ import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.FireworkColor; import org.geysermc.connector.utils.MathUtils; @@ -46,118 +45,116 @@ import org.geysermc.floodgate.util.DeviceOs; import java.util.ArrayList; import java.util.List; import java.util.OptionalInt; +import java.util.UUID; public class FireworkEntity extends Entity { - public FireworkEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public FireworkEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { - ItemStack item = (ItemStack) entityMetadata.getValue(); - if (item == null) { - return; - } - CompoundTag tag = item.getNbt(); + public void setFireworkItem(EntityMetadata entityMetadata) { + ItemStack item = entityMetadata.getValue(); + if (item == null) { + return; + } + CompoundTag tag = item.getNbt(); - if (tag == null) { - return; - } + if (tag == null) { + return; + } - // TODO: Remove once Mojang fixes bugs with fireworks crashing clients on these specific devices. - // https://bugs.mojang.com/browse/MCPE-89115 - if (session.getClientData().getDeviceOs() == DeviceOs.XBOX - || session.getClientData().getDeviceOs() == DeviceOs.PS4) { - return; - } + // TODO: Remove once Mojang fixes bugs with fireworks crashing clients on these specific devices. + // https://bugs.mojang.com/browse/MCPE-89115 + if (session.getClientData().getDeviceOs() == DeviceOs.XBOX + || session.getClientData().getDeviceOs() == DeviceOs.PS4) { + return; + } - CompoundTag fireworks = tag.get("Fireworks"); - if (fireworks == null) { - // Thank you Mineplex very cool - return; - } + CompoundTag fireworks = tag.get("Fireworks"); + if (fireworks == null) { + // Thank you Mineplex very cool + return; + } - NbtMapBuilder fireworksBuilder = NbtMap.builder(); - if (fireworks.get("Flight") != null) { - fireworksBuilder.putByte("Flight", MathUtils.getNbtByte(fireworks.get("Flight").getValue())); - } + NbtMapBuilder fireworksBuilder = NbtMap.builder(); + if (fireworks.get("Flight") != null) { + fireworksBuilder.putByte("Flight", MathUtils.getNbtByte(fireworks.get("Flight").getValue())); + } - List explosions = new ArrayList<>(); - if (fireworks.get("Explosions") != null) { - for (Tag effect : ((ListTag) fireworks.get("Explosions")).getValue()) { - CompoundTag effectData = (CompoundTag) effect; - NbtMapBuilder effectBuilder = NbtMap.builder(); + List explosions = new ArrayList<>(); + if (fireworks.get("Explosions") != null) { + for (Tag effect : ((ListTag) fireworks.get("Explosions")).getValue()) { + CompoundTag effectData = (CompoundTag) effect; + NbtMapBuilder effectBuilder = NbtMap.builder(); - if (effectData.get("Type") != null) { - effectBuilder.putByte("FireworkType", MathUtils.getNbtByte(effectData.get("Type").getValue())); - } - - if (effectData.get("Colors") != null) { - int[] oldColors = (int[]) effectData.get("Colors").getValue(); - byte[] colors = new byte[oldColors.length]; - - int i = 0; - for (int color : oldColors) { - colors[i++] = FireworkColor.fromJavaRGB(color); - } - - effectBuilder.putByteArray("FireworkColor", colors); - } - - if (effectData.get("FadeColors") != null) { - int[] oldColors = (int[]) effectData.get("FadeColors").getValue(); - byte[] colors = new byte[oldColors.length]; - - int i = 0; - for (int color : oldColors) { - colors[i++] = FireworkColor.fromJavaRGB(color); - } - - effectBuilder.putByteArray("FireworkFade", colors); - } - - if (effectData.get("Trail") != null) { - effectBuilder.putByte("FireworkTrail", MathUtils.getNbtByte(effectData.get("Trail").getValue())); - } - - if (effectData.get("Flicker") != null) { - effectBuilder.putByte("FireworkFlicker", MathUtils.getNbtByte(effectData.get("Flicker").getValue())); - } - - explosions.add(effectBuilder.build()); + if (effectData.get("Type") != null) { + effectBuilder.putByte("FireworkType", MathUtils.getNbtByte(effectData.get("Type").getValue())); } - } - fireworksBuilder.putList("Explosions", NbtType.COMPOUND, explosions); + if (effectData.get("Colors") != null) { + int[] oldColors = (int[]) effectData.get("Colors").getValue(); + byte[] colors = new byte[oldColors.length]; - NbtMapBuilder builder = NbtMap.builder(); - builder.put("Fireworks", fireworksBuilder.build()); - metadata.put(EntityData.DISPLAY_ITEM, builder.build()); - } else if (entityMetadata.getId() == 9) { - OptionalInt optional = (OptionalInt) entityMetadata.getValue(); - // Checks if the firework has an entity ID (used when a player is gliding) - // and checks to make sure the player that is gliding is the one getting sent the packet - // or else every player near the gliding player will boost too. - if (optional.isPresent() && optional.getAsInt() == session.getPlayerEntity().getEntityId()) { - PlayerEntity entity = session.getPlayerEntity(); - float yaw = entity.getRotation().getX(); - float pitch = entity.getRotation().getY(); - // Uses math from NukkitX - entity.setMotion(Vector3f.from( - -Math.sin(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * 2, - -Math.sin(Math.toRadians(pitch)) * 2, - Math.cos(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * 2)); - // Need to update the EntityMotionPacket or else the player won't boost - SetEntityMotionPacket entityMotionPacket = new SetEntityMotionPacket(); - entityMotionPacket.setRuntimeEntityId(entity.getGeyserId()); - entityMotionPacket.setMotion(entity.getMotion()); + int i = 0; + for (int color : oldColors) { + colors[i++] = FireworkColor.fromJavaRGB(color); + } - session.sendUpstreamPacket(entityMotionPacket); + effectBuilder.putByteArray("FireworkColor", colors); + } + + if (effectData.get("FadeColors") != null) { + int[] oldColors = (int[]) effectData.get("FadeColors").getValue(); + byte[] colors = new byte[oldColors.length]; + + int i = 0; + for (int color : oldColors) { + colors[i++] = FireworkColor.fromJavaRGB(color); + } + + effectBuilder.putByteArray("FireworkFade", colors); + } + + if (effectData.get("Trail") != null) { + effectBuilder.putByte("FireworkTrail", MathUtils.getNbtByte(effectData.get("Trail").getValue())); + } + + if (effectData.get("Flicker") != null) { + effectBuilder.putByte("FireworkFlicker", MathUtils.getNbtByte(effectData.get("Flicker").getValue())); + } + + explosions.add(effectBuilder.build()); } } - super.updateBedrockMetadata(entityMetadata, session); + fireworksBuilder.putList("Explosions", NbtType.COMPOUND, explosions); + + NbtMapBuilder builder = NbtMap.builder(); + builder.put("Fireworks", fireworksBuilder.build()); + dirtyMetadata.put(EntityData.DISPLAY_ITEM, builder.build()); + } + + public void setPlayerGliding(EntityMetadata entityMetadata) { + OptionalInt optional = entityMetadata.getValue(); + // Checks if the firework has an entity ID (used when a player is gliding) + // and checks to make sure the player that is gliding is the one getting sent the packet + // or else every player near the gliding player will boost too. + if (optional.isPresent() && optional.getAsInt() == session.getPlayerEntity().getEntityId()) { + PlayerEntity entity = session.getPlayerEntity(); + float yaw = entity.getYaw(); + float pitch = entity.getPitch(); + // Uses math from NukkitX + entity.setMotion(Vector3f.from( + -Math.sin(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * 2, + -Math.sin(Math.toRadians(pitch)) * 2, + Math.cos(Math.toRadians(yaw)) * Math.cos(Math.toRadians(pitch)) * 2)); + // Need to update the EntityMotionPacket or else the player won't boost + SetEntityMotionPacket entityMotionPacket = new SetEntityMotionPacket(); + entityMotionPacket.setRuntimeEntityId(entity.getGeyserId()); + entityMotionPacket.setMotion(entity.getMotion()); + + session.sendUpstreamPacket(entityMotionPacket); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index 565614143..2493ef588 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -26,12 +26,12 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; @@ -40,6 +40,7 @@ import org.geysermc.connector.registry.BlockRegistries; import org.geysermc.connector.utils.BlockPositionIterator; import org.geysermc.connector.utils.BlockUtils; +import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; public class FishingHookEntity extends ThrowableEntity { @@ -50,41 +51,44 @@ public class FishingHookEntity extends ThrowableEntity { private boolean inWater = false; - public FishingHookEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation, PlayerEntity owner) { - super(entityId, geyserId, entityType, position, motion, rotation); + public FishingHookEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { + super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f); this.boundingBox = new BoundingBox(0.125, 0.125, 0.125, 0.25, 0.25, 0.25); // In Java, the splash sound depends on the entity's velocity, but in Bedrock the volume doesn't change. // This splash can be confused with the sound from catching a fish. This silences the splash from Bedrock, // so that it can be handled by moveAbsoluteImmediate. - this.metadata.putFloat(EntityData.BOUNDING_BOX_HEIGHT, 128); + this.dirtyMetadata.putFloat(EntityData.BOUNDING_BOX_HEIGHT, 128); - this.metadata.put(EntityData.OWNER_EID, owner.getGeyserId()); + this.dirtyMetadata.put(EntityData.OWNER_EID, owner.getGeyserId()); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { // Hooked entity - int hookedEntityId = (int) entityMetadata.getValue() - 1; - Entity entity = session.getEntityCache().getEntityByJavaId(hookedEntityId); - if (entity == null && session.getPlayerEntity().getEntityId() == hookedEntityId) { - entity = session.getPlayerEntity(); - } + public void spawnEntity() { - if (entity != null) { - metadata.put(EntityData.TARGET_EID, entity.getGeyserId()); - hooked = true; - } else { - hooked = false; - } + super.spawnEntity(); + } + + public void setHookedEntity(EntityMetadata entityMetadata) { + int hookedEntityId = ((IntEntityMetadata) entityMetadata).getPrimitiveValue() - 1; + Entity entity; + if (session.getPlayerEntity().getEntityId() == hookedEntityId) { + entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(hookedEntityId); } - super.updateBedrockMetadata(entityMetadata, session); + if (entity != null) { + dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); + hooked = true; + } else { + hooked = false; + } } @Override - protected void moveAbsoluteImmediate(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + protected void moveAbsoluteImmediate(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { boundingBox.setMiddleX(position.getX()); boundingBox.setMiddleY(position.getY() + boundingBox.getSizeY() / 2); boundingBox.setMiddleZ(position.getZ()); @@ -123,14 +127,14 @@ public class FishingHookEntity extends ThrowableEntity { inWater = touchingWater; if (!collided) { - super.moveAbsoluteImmediate(session, position, rotation, isOnGround, teleported); + super.moveAbsoluteImmediate(position, yaw, pitch, headYaw, isOnGround, teleported); } else { - super.moveAbsoluteImmediate(session, this.position, rotation, true, true); + super.moveAbsoluteImmediate(this.position, yaw, pitch, headYaw, true, true); } } private void sendSplashSound(GeyserSession session) { - if (!metadata.getFlags().getFlag(EntityFlag.SILENT)) { + if (!getFlag(EntityFlag.SILENT)) { float volume = (float) (0.2f * Math.sqrt(0.2 * (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) + motion.getY() * motion.getY())); if (volume > 1) { volume = 1; @@ -145,39 +149,38 @@ public class FishingHookEntity extends ThrowableEntity { } @Override - public void tick(GeyserSession session) { - if (hooked || !isInAir(session) && !isInWater(session) || isOnGround()) { + public void tick() { + if (hooked || !isInAir() && !isInWater() || isOnGround()) { motion = Vector3f.ZERO; return; } - float gravity = getGravity(session); + float gravity = getGravity(); motion = motion.down(gravity); - moveAbsoluteImmediate(session, position.add(motion), rotation, onGround, false); + moveAbsoluteImmediate(position.add(motion), yaw, pitch, headYaw, onGround, false); - float drag = getDrag(session); + float drag = getDrag(); motion = motion.mul(drag); } @Override - protected float getGravity(GeyserSession session) { - if (!isInWater(session) && !onGround) { + protected float getGravity() { + if (!isInWater() && !onGround) { return 0.03f; } return 0; } /** - * @param session the session of the Bedrock client. * @return true if this entity is currently in air. */ - protected boolean isInAir(GeyserSession session) { + protected boolean isInAir() { int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); return block == BlockStateValues.JAVA_AIR_ID; } @Override - protected float getDrag(GeyserSession session) { + protected float getDrag() { return 0.92f; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java index fea1e62bd..d6791a15b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java @@ -26,33 +26,29 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; -public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { +import java.util.UUID; +public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { private boolean hasFuel = false; - public FurnaceMinecartEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public FurnaceMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setHasFuel(EntityMetadata entityMetadata) { + hasFuel = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + updateDefaultBlockMetadata(); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 14 && !showCustomBlock) { - hasFuel = (boolean) entityMetadata.getValue(); - updateDefaultBlockMetadata(session); - } - - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - public void updateDefaultBlockMetadata(GeyserSession session) { - metadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(hasFuel ? BlockStateValues.JAVA_FURNACE_LIT_ID : BlockStateValues.JAVA_FURNACE_ID)); - metadata.put(EntityData.DISPLAY_OFFSET, 6); + public void updateDefaultBlockMetadata() { + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(hasFuel ? BlockStateValues.JAVA_FURNACE_LIT_ID : BlockStateValues.JAVA_FURNACE_ID)); + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java index ba354c525..ab5e2906e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java @@ -34,23 +34,24 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import java.util.UUID; + public class ItemEntity extends ThrowableEntity { protected ItemData item; private int waterLevel = -1; - public ItemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void spawnEntity(GeyserSession session) { + public void spawnEntity() { if (item == null) { return; } @@ -58,36 +59,59 @@ public class ItemEntity extends ThrowableEntity { AddItemEntityPacket itemPacket = new AddItemEntityPacket(); itemPacket.setRuntimeEntityId(geyserId); itemPacket.setUniqueEntityId(geyserId); - itemPacket.setPosition(position.add(0d, this.entityType.getOffset(), 0d)); + itemPacket.setPosition(position.add(0d, this.definition.offset(), 0d)); itemPacket.setMotion(motion); itemPacket.setFromFishing(false); itemPacket.setItemInHand(item); - itemPacket.getMetadata().putAll(metadata); + itemPacket.getMetadata().putAll(dirtyMetadata); session.sendUpstreamPacket(itemPacket); } @Override - public void tick(GeyserSession session) { - if (isInWater(session)) { + public void tick() { + if (isInWater()) { return; } if (!onGround || (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) > 0.00001) { - float gravity = getGravity(session); + float gravity = getGravity(); motion = motion.down(gravity); - moveAbsoluteImmediate(session, position.add(motion), rotation, onGround, false); - float drag = getDrag(session); + moveAbsoluteImmediate(position.add(motion), yaw, pitch, headYaw, onGround, false); + float drag = getDrag(); motion = motion.mul(drag, 0.98f, drag); } } + public void setItem(EntityMetadata entityMetadata) { + ItemData item = ItemTranslator.translateToBedrock(session, entityMetadata.getValue()); + if (this.item == null) { + this.item = item; + spawnEntity(); + } else if (item.equals(this.item, false, true, true)) { + // Don't bother respawning the entity if items are equal + if (this.item.getCount() != item.getCount()) { + // Just item count updated; let's make this easy + this.item = item; + EntityEventPacket packet = new EntityEventPacket(); + packet.setRuntimeEntityId(geyserId); + packet.setType(EntityEventType.UPDATE_ITEM_STACK_SIZE); + packet.setData(this.item.getCount()); + session.sendUpstreamPacket(packet); + } + } else { + this.item = item; + despawnEntity(); + spawnEntity(); + } + } + @Override - protected void moveAbsoluteImmediate(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - float offset = entityType.getOffset(); + protected void moveAbsoluteImmediate(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { + float offset = definition.offset(); if (waterLevel == 0) { // Item is in a full block of water // Move the item entity down so it doesn't float above the water - offset = -entityType.getOffset(); + offset = -definition.offset(); } - super.moveAbsoluteImmediate(session, position.add(0, offset, 0), Vector3f.ZERO, isOnGround, teleported); + super.moveAbsoluteImmediate(position.add(0, offset, 0), 0, 0, 0, isOnGround, teleported); this.position = position; int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); @@ -95,8 +119,8 @@ public class ItemEntity extends ThrowableEntity { } @Override - protected float getGravity(GeyserSession session) { - if (metadata.getFlags().getFlag(EntityFlag.HAS_GRAVITY) && !onGround && !isInWater(session)) { + protected float getGravity() { + if (getFlag(EntityFlag.HAS_GRAVITY) && !onGround && !isInWater()) { // Gravity can change if the item is in water/lava, but // the server calculates the motion & position for us return 0.04f; @@ -105,7 +129,7 @@ public class ItemEntity extends ThrowableEntity { } @Override - protected float getDrag(GeyserSession session) { + protected float getDrag() { if (onGround) { Vector3i groundBlockPos = position.toInt().down(1); int blockState = session.getConnector().getWorldManager().getBlockAt(session, groundBlockPos); @@ -115,35 +139,7 @@ public class ItemEntity extends ThrowableEntity { } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { - ItemData item = ItemTranslator.translateToBedrock(session, (ItemStack) entityMetadata.getValue()); - if (this.item == null) { - this.item = item; - spawnEntity(session); - } else if (item.equals(this.item, false, true, true)) { - // Don't bother respawning the entity if items are equal - if (this.item.getCount() != item.getCount()) { - // Just item count updated; let's make this easy - this.item = item; - EntityEventPacket packet = new EntityEventPacket(); - packet.setRuntimeEntityId(geyserId); - packet.setType(EntityEventType.UPDATE_ITEM_STACK_SIZE); - packet.setData(this.item.getCount()); - session.sendUpstreamPacket(packet); - } - } else { - this.item = item; - despawnEntity(session); - spawnEntity(session); - } - } - - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - protected boolean isInWater(GeyserSession session) { + protected boolean isInWater() { return waterLevel != -1; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java index 6411a4f55..5730fdaff 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java @@ -27,7 +27,9 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.entity.object.HangingDirection; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; @@ -37,29 +39,25 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import lombok.Getter; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + /** * Item frames are an entity in Java but a block entity in Bedrock. */ public class ItemFrameEntity extends Entity { - - /** - * Used to construct the block entity tag on spawning. - */ - private final HangingDirection direction; /** * Used for getting the Bedrock block position. * Blocks deal with integers whereas entities deal with floats. */ - private Vector3i bedrockPosition; + private final Vector3i bedrockPosition; /** * Specific block 'state' we are emulating in Bedrock. */ - private int bedrockRuntimeId; + private final int bedrockRuntimeId; /** * Rotation of item in frame. */ @@ -73,16 +71,16 @@ public class ItemFrameEntity extends Entity { */ @Getter private ItemStack heldItem = null; + /** + * Determines if this entity needs updated on the client end/ + */ + private boolean changed = true; - public ItemFrameEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation, HangingDirection direction) { - super(entityId, geyserId, entityType, position, motion, rotation); - this.direction = direction; - } + public ItemFrameEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 0f); - @Override - public void spawnEntity(GeyserSession session) { NbtMapBuilder blockBuilder = NbtMap.builder() - .putString("name", this.entityType == EntityType.GLOW_ITEM_FRAME ? "minecraft:glow_frame" : "minecraft:frame") + .putString("name", this.definition.entityType() == EntityType.GLOW_ITEM_FRAME ? "minecraft:glow_frame" : "minecraft:frame") .putInt("version", session.getBlockMappings().getBlockStateVersion()); NbtMapBuilder statesBuilder = NbtMap.builder() .putInt("facing_direction", direction.ordinal()) @@ -96,18 +94,26 @@ public class ItemFrameEntity extends Entity { bedrockPosition = Vector3i.from(position.getFloorX(), position.getFloorY(), position.getFloorZ()); session.getItemFrameCache().put(bedrockPosition, this); + } - updateBlock(session); + @Override + protected void initializeMetadata() { + // lol nah don't do anything + // This isn't a real entity for Bedrock so it isn't going to do anything + } + + @Override + public void spawnEntity() { + updateBlock(); session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId); valid = true; } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8 && entityMetadata.getValue() != null) { - this.heldItem = (ItemStack) entityMetadata.getValue(); + public void setItemInFrame(EntityMetadata entityMetadata) { + if (entityMetadata.getValue() != null) { + this.heldItem = entityMetadata.getValue(); ItemData itemData = ItemTranslator.translateToBedrock(session, heldItem); - ItemMapping mapping = session.getItemMappings().getMapping((ItemStack) entityMetadata.getValue()); + ItemMapping mapping = session.getItemMappings().getMapping(entityMetadata.getValue()); NbtMapBuilder builder = NbtMap.builder(); builder.putByte("Count", (byte) itemData.getCount()); @@ -121,34 +127,30 @@ public class ItemFrameEntity extends Entity { tag.putFloat("ItemDropChance", 1.0f); tag.putFloat("ItemRotation", rotation); cachedTag = tag.build(); - updateBlock(session); - } - else if (entityMetadata.getId() == 8 && entityMetadata.getValue() == null && cachedTag != null) { + changed = true; + } else if (cachedTag != null) { cachedTag = getDefaultTag(); - updateBlock(session); - } - else if (entityMetadata.getId() == 9) { - rotation = ((int) entityMetadata.getValue()) * 45; - if (cachedTag == null) { - updateBlock(session); - return; - } - NbtMapBuilder builder = cachedTag.toBuilder(); - builder.putFloat("ItemRotation", rotation); - cachedTag = builder.build(); - updateBlock(session); - } - else { - updateBlock(session); + changed = true; } } + public void setItemRotation(EntityMetadata entityMetadata) { + rotation = ((IntEntityMetadata) entityMetadata).getPrimitiveValue() * 45; + if (cachedTag == null) { + return; + } + NbtMapBuilder builder = cachedTag.toBuilder(); + builder.putFloat("ItemRotation", rotation); + cachedTag = builder.build(); + changed = true; + } + @Override - public boolean despawnEntity(GeyserSession session) { + public boolean despawnEntity() { UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); updateBlockPacket.setDataLayer(0); updateBlockPacket.setBlockPosition(bedrockPosition); - updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockAirId()); + updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockAirId()); //TODO maybe set this to the world block or another item frame? updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); @@ -166,15 +168,23 @@ public class ItemFrameEntity extends Entity { builder.putInt("y", bedrockPosition.getY()); builder.putInt("z", bedrockPosition.getZ()); builder.putByte("isMovable", (byte) 1); - builder.putString("id", this.entityType == EntityType.GLOW_ITEM_FRAME ? "GlowItemFrame" : "ItemFrame"); + builder.putString("id", this.definition.entityType() == EntityType.GLOW_ITEM_FRAME ? "GlowItemFrame" : "ItemFrame"); return builder.build(); } + @Override + public void updateBedrockMetadata() { + updateBlock(); + } + /** * Updates the item frame as a block - * @param session GeyserSession. */ - public void updateBlock(GeyserSession session) { + public void updateBlock() { + if (!changed) { + // Don't send a block update packet - nothing changed + return; + } UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); updateBlockPacket.setDataLayer(0); updateBlockPacket.setBlockPosition(bedrockPosition); @@ -193,6 +203,8 @@ public class ItemFrameEntity extends Entity { } session.sendUpstreamPacket(blockEntityDataPacket); + + changed = false; } /** diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java index 58a3b6f6c..16f361683 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java @@ -26,9 +26,10 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class ItemedFireballEntity extends ThrowableEntity { private final Vector3f acceleration; @@ -37,8 +38,8 @@ public class ItemedFireballEntity extends ThrowableEntity { */ protected int futureTicks = 3; - public ItemedFireballEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, Vector3f.ZERO, rotation); + public ItemedFireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw); float magnitude = motion.length(); if (magnitude != 0) { @@ -48,28 +49,28 @@ public class ItemedFireballEntity extends ThrowableEntity { } } - private Vector3f tickMovement(GeyserSession session, Vector3f position) { + private Vector3f tickMovement(Vector3f position) { position = position.add(motion); - float drag = getDrag(session); + float drag = getDrag(); motion = motion.add(acceleration).mul(drag); return position; } @Override - protected void moveAbsoluteImmediate(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + protected void moveAbsoluteImmediate(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { // Advance the position by a few ticks before sending it to Bedrock Vector3f lastMotion = motion; Vector3f newPosition = position; for (int i = 0; i < futureTicks; i++) { - newPosition = tickMovement(session, newPosition); + newPosition = tickMovement(newPosition); } - super.moveAbsoluteImmediate(session, newPosition, rotation, isOnGround, teleported); + super.moveAbsoluteImmediate(newPosition, yaw, pitch, headYaw, isOnGround, teleported); this.position = position; this.motion = lastMotion; } @Override - public void tick(GeyserSession session) { - moveAbsoluteImmediate(session, tickMovement(session, position), rotation, false, false); + public void tick() { + moveAbsoluteImmediate(tickMovement(position), yaw, pitch, headYaw, false, false); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java index a10a30a8d..c5697346e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java @@ -26,13 +26,15 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class LeashKnotEntity extends Entity { - public LeashKnotEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { + public LeashKnotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Position is incorrect by default - super(entityId, geyserId, entityType, position.add(0.5f, 0.25f, 0.5f), motion, rotation); + super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java index 2255519e5..d9c5655b3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java @@ -27,20 +27,20 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; public class LightningEntity extends Entity { - public LightningEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public LightningEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void spawnEntity(GeyserSession session) { - super.spawnEntity(session); + public void spawnEntity() { + super.spawnEntity(); // Add these two sound effects - they're done completely clientside on Java Edition as of 1.17.1 ThreadLocalRandom random = ThreadLocalRandom.current(); diff --git a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java index 44a9859d5..28f97a2a3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java @@ -29,6 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.AttributeData; @@ -43,7 +45,6 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.utils.AttributeUtils; @@ -52,6 +53,7 @@ import org.geysermc.connector.utils.ChunkUtils; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.UUID; @Getter @Setter @@ -74,82 +76,87 @@ public class LivingEntity extends Entity { */ private boolean isMaxFrozenState = false; - public LivingEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + @Override + protected void initializeMetadata() { + super.initializeMetadata(); // Matches Bedrock behavior; is always set to this - metadata.put(EntityData.HEALTH, 1); + dirtyMetadata.put(EntityData.HEALTH, 1); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - switch (entityMetadata.getId()) { - case 8 -> { // blocking - byte xd = (byte) entityMetadata.getValue(); + public void setLivingEntityFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); - //blocking gets triggered when using a bow, but if we set USING_ITEM for all items, it may look like - //you're "mining" with ex. a shield. - ItemMapping shield = session.getItemMappings().getStoredItems().shield(); - boolean isUsingShield = (getHand().getId() == shield.getBedrockId() || - getHand().equals(ItemData.AIR) && getOffHand().getId() == shield.getBedrockId()); - metadata.getFlags().setFlag(EntityFlag.USING_ITEM, (xd & 0x01) == 0x01 && !isUsingShield); - metadata.getFlags().setFlag(EntityFlag.BLOCKING, (xd & 0x01) == 0x01); + // Blocking gets triggered when using a bow, but if we set USING_ITEM for all items, it may look like + // you're "mining" with ex. a shield. + ItemMapping shield = session.getItemMappings().getStoredItems().shield(); + boolean isUsingShield = (getHand().getId() == shield.getBedrockId() || + getHand().equals(ItemData.AIR) && getOffHand().getId() == shield.getBedrockId()); + setFlag(EntityFlag.USING_ITEM, (xd & 0x01) == 0x01 && !isUsingShield); + setFlag(EntityFlag.BLOCKING, (xd & 0x01) == 0x01); - // Riptide spin attack - metadata.getFlags().setFlag(EntityFlag.DAMAGE_NEARBY_MOBS, (xd & 0x04) == 0x04); - } - case 9 -> { - this.health = (float) entityMetadata.getValue(); + // Riptide spin attack + setFlag(EntityFlag.DAMAGE_NEARBY_MOBS, (xd & 0x04) == 0x04); + } - AttributeData healthData = createHealthAttribute(); - UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); - attributesPacket.setRuntimeEntityId(geyserId); - attributesPacket.setAttributes(Collections.singletonList(healthData)); - session.sendUpstreamPacket(attributesPacket); - } - case 10 -> metadata.put(EntityData.EFFECT_COLOR, entityMetadata.getValue()); - case 11 -> metadata.put(EntityData.EFFECT_AMBIENT, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); - case 14 -> { // Bed Position - Position bedPosition = (Position) entityMetadata.getValue(); - if (bedPosition != null) { - metadata.put(EntityData.BED_POSITION, Vector3i.from(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ())); - int bed = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); - // Bed has to be updated, or else player is floating in the air - ChunkUtils.updateBlock(session, bed, bedPosition); - // Indicate that the player should enter the sleep cycle - // Has to be a byte or it does not work - // (Bed position is what actually triggers sleep - "pose" is only optional) - metadata.put(EntityData.PLAYER_FLAGS, (byte) 2); - } else { - // Player is no longer sleeping - metadata.put(EntityData.PLAYER_FLAGS, (byte) 0); - } - } + public void setHealth(EntityMetadata entityMetadata) { + this.health = ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(); + + AttributeData healthData = createHealthAttribute(); + UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); + attributesPacket.setRuntimeEntityId(geyserId); + attributesPacket.setAttributes(Collections.singletonList(healthData)); + session.sendUpstreamPacket(attributesPacket); + } + + public Vector3i setBedPosition(EntityMetadata entityMetadata) { + Position bedPosition = entityMetadata.getValue(); + if (bedPosition != null) { + Vector3i vector = Vector3i.from(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ()); + dirtyMetadata.put(EntityData.BED_POSITION, vector); + int bed = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); + // Bed has to be updated, or else player is floating in the air + ChunkUtils.updateBlock(session, bed, bedPosition); + // Indicate that the player should enter the sleep cycle + // Has to be a byte or it does not work + // (Bed position is what actually triggers sleep - "pose" is only optional) + dirtyMetadata.put(EntityData.PLAYER_FLAGS, (byte) 2); + return vector; + } else { + // Player is no longer sleeping + dirtyMetadata.put(EntityData.PLAYER_FLAGS, (byte) 0); + return null; } - - super.updateBedrockMetadata(entityMetadata, session); } @Override - protected boolean isShaking(GeyserSession session) { + protected boolean isShaking() { return isMaxFrozenState; } @Override protected void setDimensions(Pose pose) { if (pose == Pose.SLEEPING) { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.2f); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.2f); + boundingBoxWidth = 0.2f; + boundingBoxHeight = 0.2f; + if (boundingBoxWidth != definition.width() || boundingBoxHeight != definition.height()) { + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); + } } else { super.setDimensions(pose); } } @Override - protected void setFreezing(GeyserSession session, float amount) { - super.setFreezing(session, amount); - this.isMaxFrozenState = amount >= 1.0f; - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); + public float setFreezing(EntityMetadata entityMetadata) { + float freezingPercentage = super.setFreezing(entityMetadata); + this.isMaxFrozenState = freezingPercentage >= 1.0f; + setFlag(EntityFlag.SHAKING, isShaking()); + return freezingPercentage; } /** diff --git a/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java index 6ab9a1b22..5b514310d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java @@ -26,63 +26,42 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class MinecartEntity extends Entity { - public MinecartEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position.add(0d, entityType.getOffset(), 0d), motion, rotation); + public MinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw); + } + + public void setCustomBlock(EntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(((IntEntityMetadata) entityMetadata).getPrimitiveValue())); + } + + public void setCustomBlockOffset(EntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, entityMetadata.getValue()); + } + + public void setShowCustomBlock(EntityMetadata entityMetadata) { + // If the custom block should be enabled + // Needs a byte based off of Java's boolean + dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - - if (entityMetadata.getId() == 8) { - metadata.put(EntityData.HEALTH, entityMetadata.getValue()); - } - - // Direction in which the minecart is shaking - if (entityMetadata.getId() == 9) { - metadata.put(EntityData.HURT_DIRECTION, entityMetadata.getValue()); - } - - // Power in Java, time in Bedrock - if (entityMetadata.getId() == 10) { - metadata.put(EntityData.HURT_TIME, Math.min((int) (float) entityMetadata.getValue(), 15)); - } - - if (!(this instanceof DefaultBlockMinecartEntity)) { // Handled in the DefaultBlockMinecartEntity class - // Custom block - if (entityMetadata.getId() == 11) { - metadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId((int) entityMetadata.getValue())); - } - - // Custom block offset - if (entityMetadata.getId() == 12) { - metadata.put(EntityData.DISPLAY_OFFSET, entityMetadata.getValue()); - } - - // If the custom block should be enabled - if (entityMetadata.getId() == 13) { - // Needs a byte based off of Java's boolean - metadata.put(EntityData.CUSTOM_DISPLAY, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); - } - } - - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - super.moveAbsolute(session, position.add(0d, this.entityType.getOffset(), 0d), rotation, isOnGround, teleported); + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { + super.moveAbsolute(position.add(0d, this.definition.offset(), 0d), yaw, pitch, headYaw, isOnGround, teleported); } @Override public Vector3f getBedrockRotation() { // Note: minecart rotation on rails does not care about the actual rotation value - return Vector3f.from(0, rotation.getX(), 0); + return Vector3f.from(0, yaw, 0); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java index b620e598b..e164883c5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java @@ -27,23 +27,24 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.PaintingType; +import java.util.UUID; + public class PaintingEntity extends Entity { private static final double OFFSET = -0.46875; private final PaintingType paintingName; private final int direction; - public PaintingEntity(long entityId, long geyserId, Vector3f position, PaintingType paintingName, int direction) { - super(entityId, geyserId, EntityType.PAINTING, position, Vector3f.ZERO, Vector3f.ZERO); + public PaintingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) { + super(session, entityId, geyserId, uuid, EntityDefinitions.PAINTING, position, Vector3f.ZERO, 0f, 0f, 0f); this.paintingName = paintingName; this.direction = direction; } @Override - public void spawnEntity(GeyserSession session) { + public void spawnEntity() { AddPaintingPacket addPaintingPacket = new AddPaintingPacket(); addPaintingPacket.setUniqueEntityId(geyserId); addPaintingPacket.setRuntimeEntityId(geyserId); @@ -58,7 +59,7 @@ public class PaintingEntity extends Entity { } @Override - public void updateHeadLookRotation(GeyserSession session, float headYaw) { + public void updateHeadLookRotation(float headYaw) { // Do nothing, as head look messes up paintings } diff --git a/connector/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java index c6d4c3aa5..0cf159f0e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java @@ -27,19 +27,20 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import java.util.UUID; + public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity { - public SpawnerMinecartEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public SpawnerMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateDefaultBlockMetadata(GeyserSession session) { - metadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(BlockStateValues.JAVA_SPAWNER_ID)); - metadata.put(EntityData.DISPLAY_OFFSET, 6); + public void updateDefaultBlockMetadata() { + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(BlockStateValues.JAVA_SPAWNER_ID)); + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java b/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java index 08ffa0dbc..39482b16e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java @@ -26,41 +26,37 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; -public class TNTEntity extends Entity implements Tickable { +import java.util.UUID; +public class TNTEntity extends Entity implements Tickable { private int currentTick; - public TNTEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public TNTEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setFuseLength(EntityMetadata entityMetadata) { + currentTick = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.IGNITED, true); + dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { - currentTick = (int) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.IGNITED, true); - metadata.put(EntityData.FUSE_LENGTH, currentTick); - } - - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - public void tick(GeyserSession session) { + public void tick() { if (currentTick == 0) { // No need to update the fuse when there is none return; } if (currentTick % 5 == 0) { - metadata.put(EntityData.FUSE_LENGTH, currentTick); + dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); SetEntityDataPacket packet = new SetEntityDataPacket(); packet.setRuntimeEntityId(geyserId); diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java index 1ba18bfd7..5c181fe0f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java @@ -25,15 +25,17 @@ package org.geysermc.connector.entity; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import java.util.UUID; + /** * Used as a class for any object-like entity that moves as a projectile */ @@ -41,8 +43,8 @@ public class ThrowableEntity extends Entity implements Tickable { protected Vector3f lastJavaPosition; - public ThrowableEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ThrowableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.lastJavaPosition = position; } @@ -52,14 +54,14 @@ public class ThrowableEntity extends Entity implements Tickable { * Java clients assume the next positions of moving items. Bedrock needs to be explicitly told positions */ @Override - public void tick(GeyserSession session) { - moveAbsoluteImmediate(session, position.add(motion), rotation, onGround, false); - float drag = getDrag(session); - float gravity = getGravity(session); + public void tick() { + moveAbsoluteImmediate(position.add(motion), yaw, pitch, headYaw, onGround, false); + float drag = getDrag(); + float gravity = getGravity(); motion = motion.mul(drag).down(gravity); } - protected void moveAbsoluteImmediate(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + protected void moveAbsoluteImmediate(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { MoveEntityDeltaPacket moveEntityDeltaPacket = new MoveEntityDeltaPacket(); moveEntityDeltaPacket.setRuntimeEntityId(geyserId); @@ -86,19 +88,21 @@ public class ThrowableEntity extends Entity implements Tickable { } setPosition(position); - if (this.rotation.getX() != rotation.getX()) { + if (this.yaw != yaw) { moveEntityDeltaPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_YAW); - moveEntityDeltaPacket.setYaw(rotation.getX()); + moveEntityDeltaPacket.setYaw(yaw); + this.yaw = yaw; } - if (this.rotation.getY() != rotation.getY()) { + if (this.pitch != pitch) { moveEntityDeltaPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_PITCH); - moveEntityDeltaPacket.setPitch(rotation.getY()); + moveEntityDeltaPacket.setPitch(pitch); + this.pitch = pitch; } - if (this.rotation.getZ() != rotation.getZ()) { + if (this.headYaw != headYaw) { moveEntityDeltaPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_HEAD_YAW); - moveEntityDeltaPacket.setHeadYaw(rotation.getZ()); + moveEntityDeltaPacket.setHeadYaw(headYaw); + this.headYaw = headYaw; } - setRotation(rotation); if (!moveEntityDeltaPacket.getFlags().isEmpty()) { session.sendUpstreamPacket(moveEntityDeltaPacket); @@ -108,14 +112,12 @@ public class ThrowableEntity extends Entity implements Tickable { /** * Get the gravity of this entity type. Used for applying gravity while the entity is in motion. * - * @param session the session of the Bedrock client. * @return the amount of gravity to apply to this entity while in motion. */ - protected float getGravity(GeyserSession session) { - if (metadata.getFlags().getFlag(EntityFlag.HAS_GRAVITY)) { - switch (entityType) { + protected float getGravity() { + if (getFlag(EntityFlag.HAS_GRAVITY)) { + switch (definition.entityType()) { case THROWN_POTION: - case LINGERING_POTION: return 0.05f; case THROWN_EXP_BOTTLE: return 0.07f; @@ -134,16 +136,14 @@ public class ThrowableEntity extends Entity implements Tickable { } /** - * @param session the session of the Bedrock client. * @return the drag that should be multiplied to the entity's motion */ - protected float getDrag(GeyserSession session) { - if (isInWater(session)) { + protected float getDrag() { + if (isInWater()) { return 0.8f; } else { - switch (entityType) { + switch (definition.entityType()) { case THROWN_POTION: - case LINGERING_POTION: case THROWN_EXP_BOTTLE: case SNOWBALL: case THROWN_EGG: @@ -162,34 +162,33 @@ public class ThrowableEntity extends Entity implements Tickable { } /** - * @param session the session of the Bedrock client. * @return true if this entity is currently in water. */ - protected boolean isInWater(GeyserSession session) { + protected boolean isInWater() { int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); return BlockStateValues.getWaterLevel(block) != -1; } @Override - public boolean despawnEntity(GeyserSession session) { - if (entityType == EntityType.THROWN_ENDERPEARL) { + public boolean despawnEntity() { + if (definition.entityType() == EntityType.THROWN_ENDERPEARL) { LevelEventPacket particlePacket = new LevelEventPacket(); particlePacket.setType(LevelEventType.PARTICLE_TELEPORT); particlePacket.setPosition(position); session.sendUpstreamPacket(particlePacket); } - return super.despawnEntity(session); + return super.despawnEntity(); } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - moveAbsoluteImmediate(session, lastJavaPosition.add(relX, relY, relZ), rotation, isOnGround, false); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + moveAbsoluteImmediate(lastJavaPosition.add(relX, relY, relZ), yaw, pitch, headYaw, isOnGround, false); lastJavaPosition = position; } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - moveAbsoluteImmediate(session, position, rotation, isOnGround, teleported); + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { + moveAbsoluteImmediate(position, yaw, pitch, headYaw, isOnGround, teleported); lastJavaPosition = position; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java index 38a6204d4..d1800f716 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java @@ -27,9 +27,10 @@ package org.geysermc.connector.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + /** * Used as a class for any projectile entity that looks like an item */ @@ -40,37 +41,37 @@ public class ThrowableItemEntity extends ThrowableEntity { private int age; private boolean invisible; - public ThrowableItemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); + public ThrowableItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + setFlag(EntityFlag.INVISIBLE, true); invisible = false; } - private void checkVisibility(GeyserSession session) { - if (invisible != metadata.getFlags().getFlag(EntityFlag.INVISIBLE)) { + private void checkVisibility() { + if (invisible != getFlag(EntityFlag.INVISIBLE)) { if (!invisible) { Vector3f playerPos = session.getPlayerEntity().getPosition(); // Prevent projectiles from blocking the player's screen if (age >= 4 || position.distanceSquared(playerPos) > 16) { - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, false); - updateBedrockMetadata(session); + setFlag(EntityFlag.INVISIBLE, false); + updateBedrockMetadata(); } } else { - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); - updateBedrockMetadata(session); + setFlag(EntityFlag.INVISIBLE, true); + updateBedrockMetadata(); } } age++; } @Override - public void tick(GeyserSession session) { - checkVisibility(session); - super.tick(session); + public void tick() { + checkVisibility(); + super.tick(); } @Override - protected void setInvisible(GeyserSession session, boolean value) { + protected void setInvisible(boolean value) { invisible = value; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java index 578a460b6..6f5b6a88e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java @@ -27,50 +27,44 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.Potion; import org.geysermc.connector.registry.type.ItemMapping; import java.util.EnumSet; +import java.util.UUID; public class ThrownPotionEntity extends ThrowableItemEntity { private static final EnumSet NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD); - public ThrownPotionEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ThrownPotionEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8 && entityMetadata.getType() == MetadataType.ITEM) { - ItemStack itemStack = (ItemStack) entityMetadata.getValue(); - ItemMapping mapping = session.getItemMappings().getMapping(itemStack); - if (mapping.getJavaIdentifier().endsWith("potion") && itemStack.getNbt() != null) { - Tag potionTag = itemStack.getNbt().get("Potion"); - if (potionTag instanceof StringTag) { - Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); - if (potion != null) { - metadata.put(EntityData.POTION_AUX_VALUE, potion.getBedrockId()); - metadata.getFlags().setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); - } else { - metadata.put(EntityData.POTION_AUX_VALUE, 0); - GeyserConnector.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); - } + public void setPotion(EntityMetadata entityMetadata) { + ItemStack itemStack = entityMetadata.getValue(); + ItemMapping mapping = session.getItemMappings().getMapping(itemStack); + if (mapping.getJavaIdentifier().endsWith("potion") && itemStack.getNbt() != null) { + Tag potionTag = itemStack.getNbt().get("Potion"); + if (potionTag instanceof StringTag) { + Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); + if (potion != null) { + dirtyMetadata.put(EntityData.POTION_AUX_VALUE, potion.getBedrockId()); + setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); + } else { + dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); + GeyserConnector.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); } - - boolean isLingering = mapping.getJavaIdentifier().equals("minecraft:lingering_potion"); - metadata.getFlags().setFlag(EntityFlag.LINGERING, isLingering); } - } - super.updateBedrockMetadata(entityMetadata, session); + boolean isLingering = mapping.getJavaIdentifier().equals("minecraft:lingering_potion"); + setFlag(EntityFlag.LINGERING, isLingering); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/Tickable.java b/connector/src/main/java/org/geysermc/connector/entity/Tickable.java index a7d571ccb..f5f0188fc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Tickable.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Tickable.java @@ -25,11 +25,9 @@ package org.geysermc.connector.entity; -import org.geysermc.connector.network.session.GeyserSession; - /** * Implemented onto anything that should have code ran every Minecraft tick - 50 milliseconds. */ public interface Tickable { - void tick(GeyserSession session); + void tick(); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java b/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java index f7b63435f..d05cb5d2a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java @@ -26,38 +26,35 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.item.TippedArrowPotion; +import java.util.UUID; + /** * Internally this is known as TippedArrowEntity but is used with tipped arrows and normal arrows */ public class TippedArrowEntity extends AbstractArrowEntity { - public TippedArrowEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public TippedArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Arrow potion effect color - if (entityMetadata.getId() == 10) { - int potionColor = (int) entityMetadata.getValue(); - // -1 means no color - if (potionColor == -1) { - metadata.put(EntityData.CUSTOM_DISPLAY, 0); + public void setPotionEffectColor(EntityMetadata entityMetadata) { + int potionColor = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + // -1 means no color + if (potionColor == -1) { + dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); + } else { + TippedArrowPotion potion = TippedArrowPotion.getByJavaColor(potionColor); + if (potion != null && potion.getJavaColor() != -1) { + dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) potion.getBedrockId()); } else { - TippedArrowPotion potion = TippedArrowPotion.getByJavaColor(potionColor); - if (potion != null && potion.getJavaColor() != -1) { - metadata.put(EntityData.CUSTOM_DISPLAY, (byte) potion.getBedrockId()); - } else { - metadata.put(EntityData.CUSTOM_DISPLAY, 0); - } + dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); } } - super.updateBedrockMetadata(entityMetadata, session); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/TridentEntity.java b/connector/src/main/java/org/geysermc/connector/entity/TridentEntity.java index 19ec27692..5c53ce357 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/TridentEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/TridentEntity.java @@ -25,24 +25,14 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class TridentEntity extends AbstractArrowEntity { - public TridentEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 11) { - metadata.getFlags().setFlag(EntityFlag.ENCHANTED, (boolean) entityMetadata.getValue()); - } - - super.updateBedrockMetadata(entityMetadata, session); + public TridentEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java b/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java index 6209538dc..936a6c091 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java @@ -26,35 +26,34 @@ package org.geysermc.connector.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class WitherSkullEntity extends ItemedFireballEntity { private boolean isCharged; - public WitherSkullEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public WitherSkullEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.futureTicks = 1; } - @Override - protected float getDrag(GeyserSession session) { - return isCharged ? 0.73f : super.getDrag(session); + public void setDangerous(EntityMetadata entityMetadata) { + boolean newDangerous = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + if (newDangerous != isCharged) { + isCharged = newDangerous; + // Is an entirely new entity in Bedrock but just a metadata type in Java + definition = isCharged ? EntityDefinitions.WITHER_SKULL_DANGEROUS : EntityDefinitions.WITHER_SKULL; + despawnEntity(); + spawnEntity(); + } } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 8) { - boolean newIsCharged = (boolean) entityMetadata.getValue(); - if (newIsCharged != isCharged) { - isCharged = newIsCharged; - entityType = isCharged ? EntityType.WITHER_SKULL_DANGEROUS : EntityType.WITHER_SKULL; - despawnEntity(session); - spawnEntity(session); - } - } - super.updateBedrockMetadata(entityMetadata, session); + protected float getDrag() { + return isCharged ? 0.73f : super.getDrag(); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java b/connector/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java new file mode 100644 index 000000000..67b0e5609 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity.factory; + +import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; + +@FunctionalInterface +public interface BaseEntityFactory extends EntityFactory { + + T create(GeyserSession session, long javaId, long bedrockId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java b/connector/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java new file mode 100644 index 000000000..542b9a018 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity.factory; + +import org.geysermc.connector.entity.Entity; + +public interface EntityFactory { +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java b/connector/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java new file mode 100644 index 000000000..41d8db1c8 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity.factory; + +import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.ExpOrbEntity; +import org.geysermc.connector.network.session.GeyserSession; + +@FunctionalInterface +public interface ExperienceOrbEntityFactory extends EntityFactory { + + ExpOrbEntity create(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position); +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java b/connector/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java new file mode 100644 index 000000000..95bac4c44 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity.factory; + +import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.PaintingEntity; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.utils.PaintingType; + +import java.util.UUID; + +public interface PaintingEntityFactory extends EntityFactory { + + PaintingEntity create(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction); +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java index 3b80c05fc..43bbf4544 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java @@ -27,16 +27,19 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class AbstractFishEntity extends WaterEntity { - public AbstractFishEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AbstractFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - metadata.getFlags().setFlag(EntityFlag.CAN_SWIM, true); - metadata.getFlags().setFlag(EntityFlag.BREATHING, true); - metadata.getFlags().setFlag(EntityFlag.CAN_CLIMB, false); - metadata.getFlags().setFlag(EntityFlag.HAS_GRAVITY, false); + setFlag(EntityFlag.CAN_SWIM, true); + setFlag(EntityFlag.BREATHING, true); + setFlag(EntityFlag.CAN_CLIMB, false); + setFlag(EntityFlag.HAS_GRAVITY, false); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java index 8f8166d07..b864b8e7b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java @@ -26,29 +26,46 @@ package org.geysermc.connector.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class AgeableEntity extends CreatureEntity { - public AgeableEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AgeableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - boolean isBaby = (boolean) entityMetadata.getValue(); - metadata.put(EntityData.SCALE, isBaby ? .55f : 1f); - metadata.getFlags().setFlag(EntityFlag.BABY, isBaby); + public void setBaby(EntityMetadata entityMetadata) { + boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize()); + setFlag(EntityFlag.BABY, isBaby); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight() * (isBaby ? 0.55f : 1f)); - metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth() * (isBaby ? 0.55f : 1f)); - } + // TODO save this? + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, definition.height() * (isBaby ? getBabySize() : getAdultSize())); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, definition.width() * (isBaby ? getBabySize() : getAdultSize())); + } - super.updateBedrockMetadata(entityMetadata, session); + /** + * The scale that should be used when this entity is not a baby. + */ + protected float getAdultSize() { + return 1f; + } + + /** + * The scale that should be used when this entity is a baby. + */ + protected float getBabySize() { + return 0.55f; + } + + public boolean isBaby() { + return getFlag(EntityFlag.BABY); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java index cc5fd2111..38e3483a6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; -public class AmbientEntity extends InsentientEntity { +import java.util.UUID; - public AmbientEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); +public class AmbientEntity extends MobEntity { + + public AmbientEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java index 6a87097a1..904de233f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java @@ -26,18 +26,22 @@ package org.geysermc.connector.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Rotation; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; +import net.kyori.adventure.text.Component; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class ArmorStandEntity extends LivingEntity { // These are used to store the state of the armour stand for use when handling invisibility @@ -72,162 +76,150 @@ public class ArmorStandEntity extends LivingEntity { * Whether we should update the position of this armor stand after metadata updates. */ private boolean positionUpdateRequired = false; - private GeyserSession session; - public ArmorStandEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ArmorStandEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void spawnEntity(GeyserSession session) { - this.session = session; - this.rotation = Vector3f.from(rotation.getX(), rotation.getX(), rotation.getX()); - super.spawnEntity(session); + public void spawnEntity() { + this.pitch = yaw; + this.headYaw = yaw; + super.spawnEntity(); } @Override - public boolean despawnEntity(GeyserSession session) { + public boolean despawnEntity() { if (secondEntity != null) { - secondEntity.despawnEntity(session); + secondEntity.despawnEntity(); } - return super.despawnEntity(session); + return super.despawnEntity(); } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { if (secondEntity != null) { - secondEntity.moveRelative(session, relX, relY, relZ, rotation, isOnGround); + secondEntity.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, isOnGround); } - super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); + super.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, isOnGround); } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { if (secondEntity != null) { - secondEntity.moveAbsolute(session, applyOffsetToPosition(position), rotation, isOnGround, teleported); + secondEntity.moveAbsolute(applyOffsetToPosition(position), yaw, pitch, headYaw, isOnGround, teleported); } else if (positionRequiresOffset) { // Fake the height to be above where it is so the nametag appears in the right location for invisible non-marker armour stands position = applyOffsetToPosition(position); } - super.moveAbsolute(session, position, Vector3f.from(rotation.getX(), rotation.getX(), rotation.getX()), isOnGround, teleported); + super.moveAbsolute(position, yaw, yaw, yaw, isOnGround, teleported); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 2) { + public void setDisplayName(EntityMetadata entityMetadata) { + super.setDisplayName(entityMetadata); + updateSecondEntityStatus(false); + } + + public void setArmorStandFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + + // isSmall + boolean newIsSmall = (xd & 0x01) == 0x01; + if (newIsSmall != isSmall) { + if (positionRequiresOffset) { + // Fix new inconsistency with offset + this.position = fixOffsetForSize(position, newIsSmall); + positionUpdateRequired = true; + } + + isSmall = newIsSmall; + if (!isMarker) { + toggleSmallStatus(); + } + } + + // setMarker + boolean oldIsMarker = isMarker; + isMarker = (xd & 0x10) == 0x10; + if (oldIsMarker != isMarker) { + if (isMarker) { + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); + dirtyMetadata.put(EntityData.SCALE, 0f); + } else { + toggleSmallStatus(); + } + updateSecondEntityStatus(false); - } else if (entityMetadata.getId() == 15 && entityMetadata.getType() == MetadataType.BYTE) { - byte xd = (byte) entityMetadata.getValue(); - - // isSmall - boolean newIsSmall = (xd & 0x01) == 0x01; - if (newIsSmall != isSmall) { - if (positionRequiresOffset) { - // Fix new inconsistency with offset - this.position = fixOffsetForSize(position, newIsSmall); - positionUpdateRequired = true; - } - - isSmall = newIsSmall; - if (!isMarker) { - toggleSmallStatus(); - } - } - - // setMarker - boolean oldIsMarker = isMarker; - isMarker = (xd & 0x10) == 0x10; - if (oldIsMarker != isMarker) { - if (isMarker) { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); - metadata.put(EntityData.SCALE, 0f); - } else { - toggleSmallStatus(); - } - - updateSecondEntityStatus(false); - } - - // The following values don't do anything on normal Bedrock. - // But if given a resource pack, then we can use these values to control armor stand visual properties - metadata.getFlags().setFlag(EntityFlag.ANGRY, (xd & 0x04) != 0x04); // Has arms - metadata.getFlags().setFlag(EntityFlag.ADMIRING, (xd & 0x08) == 0x08); // Has no baseplate - } else { - EntityData dataLeech = null; - EntityFlag negativeXToggle = null; - EntityFlag negativeYToggle = null; - EntityFlag negativeZToggle = null; - switch (entityMetadata.getId()) { - case 16 -> { // Head - dataLeech = EntityData.MARK_VARIANT; - negativeXToggle = EntityFlag.INTERESTED; - negativeYToggle = EntityFlag.CHARGED; - negativeZToggle = EntityFlag.POWERED; - } - case 17 -> { // Body - dataLeech = EntityData.VARIANT; - negativeXToggle = EntityFlag.IN_LOVE; - negativeYToggle = EntityFlag.CELEBRATING; - negativeZToggle = EntityFlag.CELEBRATING_SPECIAL; - } - case 18 -> { // Left arm - dataLeech = EntityData.TRADE_TIER; - negativeXToggle = EntityFlag.CHARGING; - negativeYToggle = EntityFlag.CRITICAL; - negativeZToggle = EntityFlag.DANCING; - } - case 19 -> { // Right arm - dataLeech = EntityData.MAX_TRADE_TIER; - negativeXToggle = EntityFlag.ELDER; - negativeYToggle = EntityFlag.EMOTING; - negativeZToggle = EntityFlag.IDLING; - } - case 20 -> { // Left leg - dataLeech = EntityData.SKIN_ID; - negativeXToggle = EntityFlag.IS_ILLAGER_CAPTAIN; - negativeYToggle = EntityFlag.IS_IN_UI; - negativeZToggle = EntityFlag.LINGERING; - } - case 21 -> { // Right leg - dataLeech = EntityData.HURT_DIRECTION; - negativeXToggle = EntityFlag.IS_PREGNANT; - negativeYToggle = EntityFlag.SHEARED; - negativeZToggle = EntityFlag.STALKING; - } - } - if (dataLeech != null) { - // Indicate that rotation should be checked - metadata.getFlags().setFlag(EntityFlag.BRIBED, true); - - Rotation rotation = (Rotation) entityMetadata.getValue(); - int rotationX = getRotation(rotation.getPitch()); - int rotationY = getRotation(rotation.getYaw()); - int rotationZ = getRotation(rotation.getRoll()); - // The top bit acts like binary and determines if each rotation goes above 100 - // We don't do this for the negative values out of concerns of the number being too big - int topBit = (Math.abs(rotationX) >= 100 ? 4 : 0) + (Math.abs(rotationY) >= 100 ? 2 : 0) + (Math.abs(rotationZ) >= 100 ? 1 : 0); - int value = (topBit * 1000000) + ((Math.abs(rotationX) % 100) * 10000) + ((Math.abs(rotationY) % 100) * 100) + (Math.abs(rotationZ) % 100); - metadata.put(dataLeech, value); - // Set the entity flags if a value is negative - metadata.getFlags().setFlag(negativeXToggle, rotationX < 0); - metadata.getFlags().setFlag(negativeYToggle, rotationY < 0); - metadata.getFlags().setFlag(negativeZToggle, rotationZ < 0); - } - } - if (secondEntity != null) { - secondEntity.updateBedrockMetadata(entityMetadata, session); } + + // The following values don't do anything on normal Bedrock. + // But if given a resource pack, then we can use these values to control armor stand visual properties + setFlag(EntityFlag.ANGRY, (xd & 0x04) != 0x04); // Has arms + setFlag(EntityFlag.ADMIRING, (xd & 0x08) == 0x08); // Has no baseplate + } + + public void setHeadRotation(EntityMetadata entityMetadata) { + onRotationUpdate(EntityData.MARK_VARIANT, EntityFlag.INTERESTED, EntityFlag.CHARGED, EntityFlag.POWERED, entityMetadata.getValue()); + } + + public void setBodyRotation(EntityMetadata entityMetadata) { + onRotationUpdate(EntityData.VARIANT, EntityFlag.IN_LOVE, EntityFlag.CELEBRATING, EntityFlag.CELEBRATING_SPECIAL, entityMetadata.getValue()); + } + + public void setLeftArmRotation(EntityMetadata entityMetadata) { + onRotationUpdate(EntityData.TRADE_TIER, EntityFlag.CHARGING, EntityFlag.CRITICAL, EntityFlag.DANCING, entityMetadata.getValue()); + } + + public void setRightArmRotation(EntityMetadata entityMetadata) { + onRotationUpdate(EntityData.MAX_TRADE_TIER, EntityFlag.ELDER, EntityFlag.EMOTING, EntityFlag.IDLING, entityMetadata.getValue()); + } + + public void setLeftLegRotation(EntityMetadata entityMetadata) { + onRotationUpdate(EntityData.SKIN_ID, EntityFlag.IS_ILLAGER_CAPTAIN, EntityFlag.IS_IN_UI, EntityFlag.LINGERING, entityMetadata.getValue()); + } + + public void setRightLegRotation(EntityMetadata entityMetadata) { + onRotationUpdate(EntityData.HURT_DIRECTION, EntityFlag.IS_PREGNANT, EntityFlag.SHEARED, EntityFlag.STALKING, entityMetadata.getValue()); + } + + /** + * Updates rotation on the armor stand by hijacking other unused Bedrock entity data/flags. + * Do note: as of recent Bedrock versions there is a custom entity data system that can be replaced with this, + * but at this time there is no need to implement this. + * + * @param dataLeech the entity data to "leech" off of that stores a compressed version of the rotation + * @param negativeXToggle the flag to set true if the X value of rotation is negative + * @param negativeYToggle the flag to set true if the Y value of rotation is negative + * @param negativeZToggle the flag to set true if the Z value of rotation is negative + * @param rotation the Java rotation value + */ + private void onRotationUpdate(EntityData dataLeech, EntityFlag negativeXToggle, EntityFlag negativeYToggle, EntityFlag negativeZToggle, Rotation rotation) { + // Indicate that rotation should be checked + setFlag(EntityFlag.BRIBED, true); + + int rotationX = getRotation(rotation.getPitch()); + int rotationY = getRotation(rotation.getYaw()); + int rotationZ = getRotation(rotation.getRoll()); + // The top bit acts like binary and determines if each rotation goes above 100 + // We don't do this for the negative values out of concerns of the number being too big + int topBit = (Math.abs(rotationX) >= 100 ? 4 : 0) + (Math.abs(rotationY) >= 100 ? 2 : 0) + (Math.abs(rotationZ) >= 100 ? 1 : 0); + int value = (topBit * 1000000) + ((Math.abs(rotationX) % 100) * 10000) + ((Math.abs(rotationY) % 100) * 100) + (Math.abs(rotationZ) % 100); + dirtyMetadata.put(dataLeech, value); + // Set the entity flags if a value is negative + setFlag(negativeXToggle, rotationX < 0); + setFlag(negativeYToggle, rotationY < 0); + setFlag(negativeZToggle, rotationZ < 0); } @Override - public void updateBedrockMetadata(GeyserSession session) { + public void updateBedrockMetadata() { if (secondEntity != null) { - secondEntity.updateBedrockMetadata(session); + secondEntity.updateBedrockMetadata(); } - super.updateBedrockMetadata(session); + super.updateBedrockMetadata(); if (positionUpdateRequired) { positionUpdateRequired = false; updatePosition(); @@ -235,7 +227,7 @@ public class ArmorStandEntity extends LivingEntity { } @Override - protected void setInvisible(GeyserSession session, boolean value) { + protected void setInvisible(boolean value) { // Check if the armour stand is invisible and store accordingly if (primaryEntity) { isInvisible = value; @@ -289,7 +281,7 @@ public class ArmorStandEntity extends LivingEntity { if (!primaryEntity) return; if (!isInvisible || isMarker) { // It is either impossible to show armor, or the armor stand isn't invisible. We good. - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, false); + setFlag(EntityFlag.INVISIBLE, false); updateOffsetRequirement(false); if (positionUpdateRequired) { positionUpdateRequired = false; @@ -297,13 +289,13 @@ public class ArmorStandEntity extends LivingEntity { } if (secondEntity != null) { - secondEntity.despawnEntity(session); + secondEntity.despawnEntity(); secondEntity = null; } return; } //boolean isNametagEmpty = metadata.getString(EntityData.NAMETAG).isEmpty() || metadata.getByte(EntityData.NAMETAG_ALWAYS_SHOW, (byte) -1) == (byte) 0; - may not be necessary? - boolean isNametagEmpty = metadata.getString(EntityData.NAMETAG).isEmpty(); + boolean isNametagEmpty = dirtyMetadata.getString(EntityData.NAMETAG).isEmpty(); // TODO if (!isNametagEmpty && (!helmet.equals(ItemData.AIR) || !chestplate.equals(ItemData.AIR) || !leggings.equals(ItemData.AIR) || !boots.equals(ItemData.AIR) || !hand.equals(ItemData.AIR) || !offHand.equals(ItemData.AIR))) { // If the second entity exists, no need to recreate it. @@ -312,8 +304,8 @@ public class ArmorStandEntity extends LivingEntity { // Create the second entity. It doesn't need to worry about the items, but it does need to worry about // the metadata as it will hold the name tag. - secondEntity = new ArmorStandEntity(0, session.getEntityCache().getNextEntityId().incrementAndGet(), - EntityType.ARMOR_STAND, position, motion, rotation); + secondEntity = new ArmorStandEntity(session, 0, session.getEntityCache().getNextEntityId().incrementAndGet(), null, + EntityDefinitions.ARMOR_STAND, position, motion, yaw, pitch, headYaw); secondEntity.primaryEntity = false; if (!this.positionRequiresOffset) { // Ensure the offset is applied for the 0 scale @@ -321,52 +313,51 @@ public class ArmorStandEntity extends LivingEntity { } // Copy metadata secondEntity.isSmall = isSmall; - secondEntity.getMetadata().putAll(metadata); - // Copy the flags so they aren't the same object in memory - secondEntity.getMetadata().putFlags(metadata.getFlags().copy()); + secondEntity.getDirtyMetadata().putAll(dirtyMetadata); //TODO check + secondEntity.flags.merge(this.flags); // Guarantee this copy is NOT invisible - secondEntity.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); + secondEntity.setFlag(EntityFlag.INVISIBLE, false); // Scale to 0 to show nametag - secondEntity.getMetadata().put(EntityData.SCALE, 0.0f); + secondEntity.getDirtyMetadata().put(EntityData.SCALE, 0.0f); // No bounding box as we don't want to interact with this entity - secondEntity.getMetadata().put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); - secondEntity.getMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); - secondEntity.spawnEntity(session); + secondEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); + secondEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); + secondEntity.spawnEntity(); // Reset scale of the proper armor stand - this.metadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); + this.dirtyMetadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); // Set the proper armor stand to invisible to show armor - this.metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); + setFlag(EntityFlag.INVISIBLE, true); // Update the position of the armor stand updateOffsetRequirement(false); } else if (isNametagEmpty) { // We can just make an invisible entity // Reset scale of the proper armor stand - metadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); + dirtyMetadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); // Set the proper armor stand to invisible to show armor - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); + setFlag(EntityFlag.INVISIBLE, true); // Update offset updateOffsetRequirement(false); if (secondEntity != null) { - secondEntity.despawnEntity(session); + secondEntity.despawnEntity(); secondEntity = null; } } else { // Nametag is not empty and there is no armor // We don't need to make a new entity - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, false); - metadata.put(EntityData.SCALE, 0.0f); + setFlag(EntityFlag.INVISIBLE, false); + dirtyMetadata.put(EntityData.SCALE, 0.0f); // As the above is applied, we need an offset updateOffsetRequirement(true); if (secondEntity != null) { - secondEntity.despawnEntity(session); + secondEntity.despawnEntity(); secondEntity = null; } } if (sendMetadata) { - this.updateBedrockMetadata(session); + this.updateBedrockMetadata(); } } @@ -385,16 +376,16 @@ public class ArmorStandEntity extends LivingEntity { * If this armor stand is not a marker, set its bounding box size and scale. */ private void toggleSmallStatus() { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, isSmall ? 0.25f : entityType.getWidth()); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, isSmall ? 0.9875f : entityType.getHeight()); - metadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, isSmall ? 0.25f : definition.width()); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, isSmall ? 0.9875f : definition.height()); + dirtyMetadata.put(EntityData.SCALE, isSmall ? 0.55f : 1f); } /** * @return the selected position with the position offset applied. */ private Vector3f applyOffsetToPosition(Vector3f position) { - return position.add(0d, entityType.getHeight() * (isSmall ? 0.55d : 1d), 0d); + return position.add(0d, definition.height() * (isSmall ? 0.55d : 1d), 0d); } /** @@ -402,14 +393,14 @@ public class ArmorStandEntity extends LivingEntity { */ private Vector3f fixOffsetForSize(Vector3f position, boolean isNowSmall) { position = removeOffsetFromPosition(position); - return position.add(0d, entityType.getHeight() * (isNowSmall ? 0.55d : 1d), 0d); + return position.add(0d, definition.height() * (isNowSmall ? 0.55d : 1d), 0d); } /** * @return the selected position with the position offset removed. */ private Vector3f removeOffsetFromPosition(Vector3f position) { - return position.sub(0d, entityType.getHeight() * (isSmall ? 0.55d : 1d), 0d); + return position.sub(0d, definition.height() * (isSmall ? 0.55d : 1d), 0d); } /** @@ -434,7 +425,7 @@ public class ArmorStandEntity extends LivingEntity { MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); moveEntityPacket.setRuntimeEntityId(geyserId); moveEntityPacket.setPosition(position); - moveEntityPacket.setRotation(Vector3f.from(rotation.getX(), rotation.getX(), rotation.getX())); + moveEntityPacket.setRotation(Vector3f.from(yaw, yaw, yaw)); moveEntityPacket.setOnGround(onGround); moveEntityPacket.setTeleported(false); session.sendUpstreamPacket(moveEntityPacket); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java index 110c02e06..4f5bd1ead 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java @@ -26,23 +26,22 @@ package org.geysermc.connector.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class BatEntity extends AmbientEntity { - public BatEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public BatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.RESTING, (xd & 0x01) == 0x01); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setBatFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.RESTING, (xd & 0x01) == 0x01); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java index e2cc5a6f4..e0407e0fc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; -public class CreatureEntity extends InsentientEntity { +import java.util.UUID; - public CreatureEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); +public class CreatureEntity extends MobEntity { + + public CreatureEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java index 6bcfe79f1..1cf362985 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; -public class FlyingEntity extends InsentientEntity { +import java.util.UUID; - public FlyingEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); +public class FlyingEntity extends MobEntity { + + public FlyingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java index b68c5d224..f99c9ee4d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java @@ -25,19 +25,14 @@ package org.geysermc.connector.entity.living; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; -public class GlowSquidEntity extends SquidEntity { - public GlowSquidEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } +import java.util.UUID; - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - // TODO "dark ticks remaining" ??? does this have a Bedrock equivalent? +public class GlowSquidEntity extends SquidEntity { + public GlowSquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java index 2f202ee9f..da88f5acc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class GolemEntity extends CreatureEntity { - public GolemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public GolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java index a7b7a55c6..21e495239 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java @@ -28,15 +28,18 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class IronGolemEntity extends GolemEntity { - public IronGolemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public IronGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that we should show cracks through a resource pack - metadata.getFlags().setFlag(EntityFlag.BRIBED, true); + setFlag(EntityFlag.BRIBED, true); // Required, or else the overlay is black - metadata.put(EntityData.COLOR_2, (byte) 0); + dirtyMetadata.put(EntityData.COLOR_2, (byte) 0); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java index fb2726d1d..bdbac85a7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java @@ -27,32 +27,34 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class MagmaCubeEntity extends SlimeEntity { - public MagmaCubeEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public MagmaCubeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - updateJump(session, isOnGround); - super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + updateJump(isOnGround); + super.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, isOnGround); } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - updateJump(session, isOnGround); - super.moveAbsolute(session, position, rotation, isOnGround, teleported); + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { + updateJump(isOnGround); + super.moveAbsolute(position, yaw, pitch, headYaw, isOnGround, teleported); } - public void updateJump(GeyserSession session, boolean newOnGround) { + public void updateJump(boolean newOnGround) { if (newOnGround != onGround) { // Add the jumping effect to the magma cube - metadata.put(EntityData.CLIENT_EVENT, (byte) (newOnGround ? 1 : 2)); - updateBedrockMetadata(session); + dirtyMetadata.put(EntityData.CLIENT_EVENT, (byte) (newOnGround ? 1 : 2)); + updateBedrockMetadata(); } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java new file mode 100644 index 000000000..3c603a61e --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2019-2021 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.connector.entity.living; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import lombok.Getter; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.entity.LivingEntity; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; + +public class MobEntity extends LivingEntity { + /** + * If another mob is holding this mob by a leash, this variable tracks their Bedrock entity ID. + */ + @Getter + private long leashHolderBedrockId; + + public MobEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + @Override + protected void initializeMetadata() { + super.initializeMetadata(); + setLeashHolderBedrockId(-1); + } + + public void setMobFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.NO_AI, (xd & 0x01) == 0x01); + } + + public void setLeashHolderBedrockId(long bedrockId) { + this.leashHolderBedrockId = bedrockId; + dirtyMetadata.put(EntityData.LEASH_HOLDER_EID, bedrockId); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java index f08fcc796..b533a6613 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java @@ -26,22 +26,21 @@ package org.geysermc.connector.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; -public class SlimeEntity extends InsentientEntity { +import java.util.UUID; - public SlimeEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); +public class SlimeEntity extends MobEntity { + + public SlimeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - this.metadata.put(EntityData.SCALE, 0.10f + (int) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setScale(EntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.SCALE, 0.10f + ((IntEntityMetadata) entityMetadata).getPrimitiveValue()); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java index 6bfb23564..7dafd4853 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java @@ -26,24 +26,23 @@ package org.geysermc.connector.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class SnowGolemEntity extends GolemEntity { - public SnowGolemEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public SnowGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - byte xd = (byte) entityMetadata.getValue(); - // Handle the visibility of the pumpkin - metadata.getFlags().setFlag(EntityFlag.SHEARED, (xd & 0x10) != 0x10); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setSnowGolemFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + // Handle the visibility of the pumpkin + setFlag(EntityFlag.SHEARED, (xd & 0x10) != 0x10); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java index bf18b97a0..18c1ec9a8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java @@ -28,28 +28,25 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.Tickable; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import java.util.UUID; + public class SquidEntity extends WaterEntity implements Tickable { - - private float pitch; - private float yaw; - private float targetPitch; private float targetYaw; private boolean inWater; - public SquidEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - this.yaw = rotation.getX(); + public SquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void tick(GeyserSession session) { + public void tick() { boolean pitchChanged; boolean yawChanged; float oldPitch = pitch; @@ -82,25 +79,33 @@ public class SquidEntity extends WaterEntity implements Tickable { } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); - checkInWater(session); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + super.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, isOnGround); + checkInWater(); } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { - super.moveAbsolute(session, position, rotation, isOnGround, teleported); - checkInWater(session); + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { + super.moveAbsolute(position, yaw, pitch, headYaw, isOnGround, teleported); + checkInWater(); } @Override - public void setRotation(Vector3f rotation) { + public void setYaw(float yaw) { // Let the Java server control yaw when the squid is out of water if (!inWater) { - yaw = rotation.getX(); + this.yaw = yaw; } } + @Override + public void setPitch(float pitch) { + } + + @Override + public void setHeadYaw(float headYaw) { + } + @Override public void setMotion(Vector3f motion) { super.setMotion(motion); @@ -115,8 +120,8 @@ public class SquidEntity extends WaterEntity implements Tickable { return Vector3f.from(pitch, yaw, yaw); } - private void checkInWater(GeyserSession session) { - if (getMetadata().getFlags().getFlag(EntityFlag.RIDING)) { + private void checkInWater() { + if (getFlag(EntityFlag.RIDING)) { inWater = false; } else { int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java index 9b90ba72e..4766841ac 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class WaterEntity extends CreatureEntity { - public WaterEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public WaterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java index 2495eab0a..7ef8f107e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java @@ -26,15 +26,17 @@ package org.geysermc.connector.entity.living.animal; import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.AgeableEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class AnimalEntity extends AgeableEntity { - public AnimalEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AnimalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } /** diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java index 0968cecb0..53c70d13e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java @@ -26,32 +26,33 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class AxolotlEntity extends AnimalEntity { - public AxolotlEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AxolotlEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 17) { - int variant = (int) entityMetadata.getValue(); - switch (variant) { - case 1 -> variant = 3; // Java - "Wild" (brown) - case 3 -> variant = 1; // Java - cyan - } - metadata.put(EntityData.VARIANT, variant); - } - else if (entityMetadata.getId() == 18) { - metadata.getFlags().setFlag(EntityFlag.PLAYING_DEAD, (boolean) entityMetadata.getValue()); + public void setVariant(EntityMetadata entityMetadata) { + int variant = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + switch (variant) { + case 1 -> variant = 3; // Java - "Wild" (brown) + case 3 -> variant = 1; // Java - cyan } + dirtyMetadata.put(EntityData.VARIANT, variant); + } + + public void setPlayingDead(EntityMetadata entityMetadata) { + setFlag(EntityFlag.PLAYING_DEAD, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java index 07136252a..12366c4cd 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java @@ -26,43 +26,44 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class BeeEntity extends AnimalEntity { - public BeeEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public BeeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - byte xd = (byte) entityMetadata.getValue(); - // Bee is performing sting attack; trigger animation - if ((xd & 0x02) == 0x02) { - EntityEventPacket packet = new EntityEventPacket(); - packet.setRuntimeEntityId(geyserId); - packet.setType(EntityEventType.ATTACK_START); - packet.setData(0); - session.sendUpstreamPacket(packet); - } - // If the bee has stung - metadata.put(EntityData.MARK_VARIANT, (xd & 0x04) == 0x04 ? 1 : 0); - // If the bee has nectar or not - metadata.getFlags().setFlag(EntityFlag.POWERED, (xd & 0x08) == 0x08); + public void setBeeFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + // Bee is performing sting attack; trigger animation + if ((xd & 0x02) == 0x02) { + EntityEventPacket packet = new EntityEventPacket(); + packet.setRuntimeEntityId(geyserId); + packet.setType(EntityEventType.ATTACK_START); + packet.setData(0); + session.sendUpstreamPacket(packet); } - if (entityMetadata.getId() == 18) { - // Converting "anger time" to a boolean - metadata.getFlags().setFlag(EntityFlag.ANGRY, (int) entityMetadata.getValue() > 0); - } - super.updateBedrockMetadata(entityMetadata, session); + // If the bee has stung + dirtyMetadata.put(EntityData.MARK_VARIANT, (xd & 0x04) == 0x04 ? 1 : 0); + // If the bee has nectar or not + setFlag(EntityFlag.POWERED, (xd & 0x08) == 0x08); + } + + public void setAngerTime(EntityMetadata entityMetadata) { + // Converting "anger time" to a boolean + setFlag(EntityFlag.ANGRY, ((IntEntityMetadata) entityMetadata).getPrimitiveValue() > 0); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java index c7eb62c6e..b1031209f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java @@ -26,14 +26,16 @@ package org.geysermc.connector.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class ChickenEntity extends AnimalEntity { - public ChickenEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ChickenEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java index 26da89612..7016753ba 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java @@ -26,32 +26,32 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class FoxEntity extends AnimalEntity { - public FoxEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public FoxEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - metadata.put(EntityData.VARIANT, entityMetadata.getValue()); - } - if (entityMetadata.getId() == 18) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); - metadata.getFlags().setFlag(EntityFlag.SNEAKING, (xd & 0x04) == 0x04); - metadata.getFlags().setFlag(EntityFlag.INTERESTED, (xd & 0x08) == 0x08); - metadata.getFlags().setFlag(EntityFlag.SLEEPING, (xd & 0x20) == 0x20); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setFoxVariant(EntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.VARIANT, entityMetadata.getValue()); + } + + public void setFoxFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); + setFlag(EntityFlag.SNEAKING, (xd & 0x04) == 0x04); + setFlag(EntityFlag.INTERESTED, (xd & 0x08) == 0x08); + setFlag(EntityFlag.SLEEPING, (xd & 0x20) == 0x20); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java index a43998f27..6bf7cd336 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java @@ -27,12 +27,15 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import lombok.Getter; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class GoatEntity extends AnimalEntity { private static final float LONG_JUMPING_HEIGHT = 1.3f * 0.7f; private static final float LONG_JUMPING_WIDTH = 0.9f * 0.7f; @@ -40,24 +43,20 @@ public class GoatEntity extends AnimalEntity { @Getter private boolean isScreamer; - public GoatEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public GoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 17) { - // Not used in Bedrock Edition - isScreamer = (boolean) entityMetadata.getValue(); - } + public void setScreamer(EntityMetadata entityMetadata) { + // Metadata not used in Bedrock Edition + isScreamer = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); } @Override protected void setDimensions(Pose pose) { if (pose == Pose.LONG_JUMPING) { - metadata.put(EntityData.BOUNDING_BOX_WIDTH, LONG_JUMPING_WIDTH); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, LONG_JUMPING_HEIGHT); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, LONG_JUMPING_WIDTH); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, LONG_JUMPING_HEIGHT); } else { super.setDimensions(pose); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java index d782dc53e..6493810c4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java @@ -26,34 +26,32 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; import org.geysermc.connector.utils.DimensionUtils; +import java.util.UUID; + public class HoglinEntity extends AnimalEntity { private boolean isImmuneToZombification; - public HoglinEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public HoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setImmuneToZombification(EntityMetadata entityMetadata) { + // Apply shaking effect if not in the nether and zombification is possible + this.isImmuneToZombification = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SHAKING, isShaking()); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - // Immune to zombification? - // Apply shaking effect if not in the nether and zombification is possible - this.isImmuneToZombification = (boolean) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); - } - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - protected boolean isShaking(GeyserSession session) { - return (!isImmuneToZombification && !session.getDimension().equals(DimensionUtils.NETHER)) || super.isShaking(session); + protected boolean isShaking() { + return (!isImmuneToZombification && !session.getDimension().equals(DimensionUtils.NETHER)) || super.isShaking(); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java index e2e22c73d..2047b8afe 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java @@ -25,23 +25,15 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class MooshroomEntity extends AnimalEntity { - public MooshroomEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - metadata.put(EntityData.VARIANT, entityMetadata.getValue().equals("brown") ? 1 : 0); - } - super.updateBedrockMetadata(entityMetadata, session); + public MooshroomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java index 98e7140cd..ed4f8133b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java @@ -25,25 +25,17 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class OcelotEntity extends AnimalEntity { - public OcelotEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - metadata.getFlags().setFlag(EntityFlag.TRUSTING, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + public OcelotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java index 39049d91a..ff66d30a8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java @@ -26,57 +26,60 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; -public class PandaEntity extends AnimalEntity { +import java.util.UUID; +public class PandaEntity extends AnimalEntity { private int mainGene; private int hiddenGene; - public PandaEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public PandaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 19) { - metadata.getFlags().setFlag(EntityFlag.EATING, (int) entityMetadata.getValue() > 0); - metadata.put(EntityData.EATING_COUNTER, entityMetadata.getValue()); - if ((int) entityMetadata.getValue() != 0) { - // Particles and sound - EntityEventPacket packet = new EntityEventPacket(); - packet.setRuntimeEntityId(geyserId); - packet.setType(EntityEventType.EATING_ITEM); - packet.setData(session.getItemMappings().getStoredItems().bamboo().getBedrockId() << 16); - session.sendUpstreamPacket(packet); - } + public void setEatingCounter(EntityMetadata entityMetadata) { + int count = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.EATING, count > 0); + dirtyMetadata.put(EntityData.EATING_COUNTER, count); + if (count != 0) { + // Particles and sound + EntityEventPacket packet = new EntityEventPacket(); + packet.setRuntimeEntityId(geyserId); + packet.setType(EntityEventType.EATING_ITEM); + packet.setData(session.getItemMappings().getStoredItems().bamboo().getBedrockId() << 16); + session.sendUpstreamPacket(packet); } - if (entityMetadata.getId() == 20) { - mainGene = (int) (byte) entityMetadata.getValue(); - updateAppearance(); - } - if (entityMetadata.getId() == 21) { - hiddenGene = (int) (byte) entityMetadata.getValue(); - updateAppearance(); - } - if (entityMetadata.getId() == 22) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SNEEZING, (xd & 0x02) == 0x02); - metadata.getFlags().setFlag(EntityFlag.ROLLING, (xd & 0x04) == 0x04); - metadata.getFlags().setFlag(EntityFlag.SITTING, (xd & 0x08) == 0x08); - // Required to put these both for sitting to actually show - metadata.put(EntityData.SITTING_AMOUNT, (xd & 0x08) == 0x08 ? 1f : 0f); - metadata.put(EntityData.SITTING_AMOUNT_PREVIOUS, (xd & 0x08) == 0x08 ? 1f : 0f); - metadata.getFlags().setFlag(EntityFlag.LAYING_DOWN, (xd & 0x10) == 0x10); - } - super.updateBedrockMetadata(entityMetadata, session); + } + + public void setMainGene(EntityMetadata entityMetadata) { + mainGene = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + updateAppearance(); + } + + public void setHiddenGene(EntityMetadata entityMetadata) { + hiddenGene = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + updateAppearance(); + } + + public void setPandaFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SNEEZING, (xd & 0x02) == 0x02); + setFlag(EntityFlag.ROLLING, (xd & 0x04) == 0x04); + setFlag(EntityFlag.SITTING, (xd & 0x08) == 0x08); + // Required to put these both for sitting to actually show + dirtyMetadata.put(EntityData.SITTING_AMOUNT, (xd & 0x08) == 0x08 ? 1f : 0f); + dirtyMetadata.put(EntityData.SITTING_AMOUNT_PREVIOUS, (xd & 0x08) == 0x08 ? 1f : 0f); + setFlag(EntityFlag.LAYING_DOWN, (xd & 0x10) == 0x10); } @Override @@ -93,14 +96,14 @@ public class PandaEntity extends AnimalEntity { // Main gene is a recessive trait if (mainGene == hiddenGene) { // Main and hidden genes match; this is what the panda looks like. - metadata.put(EntityData.VARIANT, mainGene); + dirtyMetadata.put(EntityData.VARIANT, mainGene); } else { // Genes have no effect on appearance - metadata.put(EntityData.VARIANT, 0); + dirtyMetadata.put(EntityData.VARIANT, 0); } } else { // No need to worry about hidden gene - metadata.put(EntityData.VARIANT, mainGene); + dirtyMetadata.put(EntityData.VARIANT, mainGene); } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java index ba6bfd553..8fe4fde06 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java @@ -25,25 +25,17 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class PigEntity extends AnimalEntity { - public PigEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - metadata.getFlags().setFlag(EntityFlag.SADDLED, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + public PigEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java index 893def315..4eb5d79fc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java @@ -25,25 +25,17 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class PolarBearEntity extends AnimalEntity { - public PolarBearEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - metadata.getFlags().setFlag(EntityFlag.STANDING, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + public PolarBearEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java index 0ddd581f8..e2c9039de 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java @@ -26,25 +26,24 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.AbstractFishEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class PufferFishEntity extends AbstractFishEntity { - public PufferFishEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public PufferFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - int puffsize = (int) entityMetadata.getValue(); - metadata.put(EntityData.PUFFERFISH_SIZE, (byte) puffsize); - metadata.put(EntityData.VARIANT, puffsize); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setPufferfishSize(EntityMetadata entityMetadata) { + int puffsize = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.PUFFERFISH_SIZE, (byte) puffsize); + dirtyMetadata.put(EntityData.VARIANT, puffsize); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java index 0f0e1fb3e..2d6a0d96a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java @@ -26,42 +26,49 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class RabbitEntity extends AnimalEntity { - public RabbitEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public RabbitEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 16) { - metadata.put(EntityData.SCALE, .55f); - boolean isBaby = (boolean) entityMetadata.getValue(); - if (isBaby) { - metadata.put(EntityData.SCALE, .35f); - metadata.getFlags().setFlag(EntityFlag.BABY, true); - } - } else if (entityMetadata.getId() == 17) { - int variant = (int) entityMetadata.getValue(); + public void setBaby(EntityMetadata entityMetadata) { + super.setBaby(entityMetadata); + } - // Change the killer bunny to display as white since it only exists on Java Edition - boolean isKillerBunny = variant == 99; - if (isKillerBunny) { - variant = 1; - } - // Allow the resource pack to adjust to the killer bunny - metadata.getFlags().setFlag(EntityFlag.BRIBED, isKillerBunny); + public void setRabbitVariant(EntityMetadata entityMetadata) { + int variant = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); - metadata.put(EntityData.VARIANT, variant); + // Change the killer bunny to display as white since it only exists on Java Edition + boolean isKillerBunny = variant == 99; + if (isKillerBunny) { + variant = 1; } + // Allow the resource pack to adjust to the killer bunny + setFlag(EntityFlag.BRIBED, isKillerBunny); + + dirtyMetadata.put(EntityData.VARIANT, variant); + } + + @Override + protected float getAdultSize() { + return 0.55f; + } + + @Override + protected float getBabySize() { + return 0.35f; } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java index f723eff2b..c063188c5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java @@ -26,26 +26,24 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class SheepEntity extends AnimalEntity { - public SheepEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public SheepEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SHEARED, (xd & 0x10) == 0x10); - metadata.put(EntityData.COLOR, xd); - } - - super.updateBedrockMetadata(entityMetadata, session); + public void setSheepFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SHEARED, (xd & 0x10) == 0x10); + dirtyMetadata.put(EntityData.COLOR, xd); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java index 83c1e3674..d31bf4a4e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java @@ -26,70 +26,70 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class StriderEntity extends AnimalEntity { private boolean isCold = false; - public StriderEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public StriderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - metadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); - metadata.getFlags().setFlag(EntityFlag.BREATHING, true); + setFlag(EntityFlag.FIRE_IMMUNE, true); + setFlag(EntityFlag.BREATHING, true); + } + + public void setCold(EntityMetadata entityMetadata) { + isCold = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + } + + public void setSaddled(EntityMetadata entityMetadata) { + setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 18) { - isCold = (boolean) entityMetadata.getValue(); - } - if (entityMetadata.getId() == 19) { - metadata.getFlags().setFlag(EntityFlag.SADDLED, (boolean) entityMetadata.getValue()); - } - - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - public void updateBedrockMetadata(GeyserSession session) { + public void updateBedrockMetadata() { // Make sure they are not shaking when riding another entity // Needs to copy the parent state - if (metadata.getFlags().getFlag(EntityFlag.RIDING)) { + if (getFlag(EntityFlag.RIDING)) { boolean parentShaking = false; + //TODO optimize for (Entity ent : session.getEntityCache().getEntities().values()) { if (ent.getPassengers().contains(entityId) && ent instanceof StriderEntity) { - parentShaking = ent.getMetadata().getFlags().getFlag(EntityFlag.SHAKING); + parentShaking = ent.getFlag(EntityFlag.SHAKING); break; } } - metadata.getFlags().setFlag(EntityFlag.BREATHING, !parentShaking); - metadata.getFlags().setFlag(EntityFlag.SHAKING, parentShaking); + setFlag(EntityFlag.BREATHING, !parentShaking); + setFlag(EntityFlag.SHAKING, parentShaking); } else { - metadata.getFlags().setFlag(EntityFlag.BREATHING, !isCold); - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); + setFlag(EntityFlag.BREATHING, !isCold); + setFlag(EntityFlag.SHAKING, isShaking()); } // Update the passengers if we have any for (long passenger : passengers) { Entity passengerEntity = session.getEntityCache().getEntityByJavaId(passenger); if (passengerEntity != null) { - passengerEntity.updateBedrockMetadata(session); + passengerEntity.updateBedrockMetadata(); } } - super.updateBedrockMetadata(session); + super.updateBedrockMetadata(); } @Override - protected boolean isShaking(GeyserSession session) { - return isCold || super.isShaking(session); + protected boolean isShaking() { + return isCold || super.isShaking(); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java index d16eb2ece..cd652f6a3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java @@ -26,15 +26,17 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableList; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import it.unimi.dsi.fastutil.ints.IntList; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.AbstractFishEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import java.util.List; +import java.util.UUID; public class TropicalFishEntity extends AbstractFishEntity { @@ -47,21 +49,17 @@ public class TropicalFishEntity extends AbstractFishEntity { private static final List VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish"); private static final List COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black"); - public TropicalFishEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public TropicalFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - int varNumber = (int) entityMetadata.getValue(); + public void setFishVariant(EntityMetadata entityMetadata) { + int varNumber = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); - metadata.put(EntityData.VARIANT, getShape(varNumber)); // Shape 0-1 - metadata.put(EntityData.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 - metadata.put(EntityData.COLOR, getBaseColor(varNumber)); // Base color 0-15 - metadata.put(EntityData.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15 - } - super.updateBedrockMetadata(entityMetadata, session); + dirtyMetadata.put(EntityData.VARIANT, getShape(varNumber)); // Shape 0-1 + dirtyMetadata.put(EntityData.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 + dirtyMetadata.put(EntityData.COLOR, getBaseColor(varNumber)); // Base color 0-15 + dirtyMetadata.put(EntityData.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15 } public static int getShape(int variant) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java index b26b21ee2..28ff2d836 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java @@ -26,26 +26,27 @@ package org.geysermc.connector.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class TurtleEntity extends AnimalEntity { - public TurtleEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public TurtleEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 18) { - metadata.getFlags().setFlag(EntityFlag.IS_PREGNANT, (boolean) entityMetadata.getValue()); - } else if (entityMetadata.getId() == 19) { - metadata.getFlags().setFlag(EntityFlag.LAYING_EGG, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setPregnant(EntityMetadata entityMetadata) { + setFlag(EntityFlag.IS_PREGNANT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + } + + public void setLayingEgg(EntityMetadata entityMetadata) { + setFlag(EntityFlag.LAYING_EGG, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java index e255d2856..27a359d63 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java @@ -26,6 +26,7 @@ package org.geysermc.connector.entity.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.google.common.collect.ImmutableSet; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -34,13 +35,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.attribute.GeyserAttributeType; import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; import java.util.Set; +import java.util.UUID; public class AbstractHorseEntity extends AnimalEntity { /** @@ -50,18 +52,22 @@ public class AbstractHorseEntity extends AnimalEntity { private static final Set DONKEY_AND_HORSE_FOODS = ImmutableSet.of("golden_apple", "enchanted_golden_apple", "golden_carrot", "sugar", "apple", "wheat", "hay_block"); - public AbstractHorseEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AbstractHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Specifies the size of the entity's inventory. Required to place slots in the entity. - metadata.put(EntityData.CONTAINER_BASE_SIZE, 2); + dirtyMetadata.put(EntityData.CONTAINER_BASE_SIZE, getContainerBaseSize()); - metadata.getFlags().setFlag(EntityFlag.WASD_CONTROLLED, true); + setFlag(EntityFlag.WASD_CONTROLLED, true); + } + + protected int getContainerBaseSize() { + return 2; } @Override - public void spawnEntity(GeyserSession session) { - super.spawnEntity(session); + public void spawnEntity() { + super.spawnEntity(); // Add horse jump strength attribute to allow donkeys and mules to jump, if they don't send the attribute themselves. // Confirmed broken without this code by making a new donkey in vanilla 1.17.1 @@ -73,49 +79,44 @@ public class AbstractHorseEntity extends AnimalEntity { session.sendUpstreamPacket(attributesPacket); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - byte xd = (byte) entityMetadata.getValue(); - boolean tamed = (xd & 0x02) == 0x02; - boolean saddled = (xd & 0x04) == 0x04; - metadata.getFlags().setFlag(EntityFlag.TAMED, tamed); - metadata.getFlags().setFlag(EntityFlag.SADDLED, saddled); - metadata.getFlags().setFlag(EntityFlag.EATING, (xd & 0x10) == 0x10); - metadata.getFlags().setFlag(EntityFlag.STANDING, (xd & 0x20) == 0x20); + public void setHorseFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + boolean tamed = (xd & 0x02) == 0x02; + boolean saddled = (xd & 0x04) == 0x04; + setFlag(EntityFlag.TAMED, tamed); + setFlag(EntityFlag.SADDLED, saddled); + setFlag(EntityFlag.EATING, (xd & 0x10) == 0x10); + setFlag(EntityFlag.STANDING, (xd & 0x20) == 0x20); - // HorseFlags - // Bred 0x10 - // Eating 0x20 - // Open mouth 0x80 - int horseFlags = 0x0; - horseFlags = (xd & 0x40) == 0x40 ? horseFlags | 0x80 : horseFlags; + // HorseFlags + // Bred 0x10 + // Eating 0x20 + // Open mouth 0x80 + int horseFlags = 0x0; + horseFlags = (xd & 0x40) == 0x40 ? horseFlags | 0x80 : horseFlags; - // Only set eating when we don't have mouth open so a player interaction doesn't trigger the eating animation - horseFlags = (xd & 0x10) == 0x10 && (xd & 0x40) != 0x40 ? horseFlags | 0x20 : horseFlags; + // Only set eating when we don't have mouth open so a player interaction doesn't trigger the eating animation + horseFlags = (xd & 0x10) == 0x10 && (xd & 0x40) != 0x40 ? horseFlags | 0x20 : horseFlags; - // Set the flags into the display item - metadata.put(EntityData.DISPLAY_ITEM, horseFlags); + // Set the flags into the display item + dirtyMetadata.put(EntityData.DISPLAY_ITEM, horseFlags); - // Send the eating particles - // We use the wheat metadata as static particles since Java - // doesn't send over what item was used to feed the horse - if ((xd & 0x40) == 0x40) { - EntityEventPacket entityEventPacket = new EntityEventPacket(); - entityEventPacket.setRuntimeEntityId(geyserId); - entityEventPacket.setType(EntityEventType.EATING_ITEM); - entityEventPacket.setData(session.getItemMappings().getStoredItems().wheat().getBedrockId() << 16); - session.sendUpstreamPacket(entityEventPacket); - } - - // Set container type if tamed - metadata.put(EntityData.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0); - - // Shows the jump meter - metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, saddled); + // Send the eating particles + // We use the wheat metadata as static particles since Java + // doesn't send over what item was used to feed the horse + if ((xd & 0x40) == 0x40) { + EntityEventPacket entityEventPacket = new EntityEventPacket(); + entityEventPacket.setRuntimeEntityId(geyserId); + entityEventPacket.setType(EntityEventType.EATING_ITEM); + entityEventPacket.setData(session.getItemMappings().getStoredItems().wheat().getBedrockId() << 16); + session.sendUpstreamPacket(entityEventPacket); } - super.updateBedrockMetadata(entityMetadata, session); + // Set container type if tamed + dirtyMetadata.put(EntityData.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0); + + // Shows the jump meter + setFlag(EntityFlag.CAN_POWER_JUMP, saddled); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java index e4f0cc241..5ccbb4ea7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java @@ -25,26 +25,20 @@ package org.geysermc.connector.entity.living.animal.horse; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class ChestedHorseEntity extends AbstractHorseEntity { - public ChestedHorseEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - - metadata.put(EntityData.CONTAINER_BASE_SIZE, 16); + public ChestedHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 19) { - metadata.getFlags().setFlag(EntityFlag.CHESTED, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + protected int getContainerBaseSize() { + return 16; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java index 87155005d..97354d047 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java @@ -26,24 +26,23 @@ package org.geysermc.connector.entity.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class HorseEntity extends AbstractHorseEntity { - public HorseEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public HorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 19) { - metadata.put(EntityData.VARIANT, ((int) entityMetadata.getValue()) & 255); - metadata.put(EntityData.MARK_VARIANT, (((int) entityMetadata.getValue()) >> 8) % 5); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setHorseVariant(EntityMetadata entityMetadata) { + int value = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.VARIANT, value & 255); + dirtyMetadata.put(EntityData.MARK_VARIANT, (value >> 8) % 5); } - } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java index 14e625c81..1c4e5155e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java @@ -26,54 +26,47 @@ package org.geysermc.connector.entity.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class LlamaEntity extends ChestedHorseEntity { - public LlamaEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public LlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - metadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength + dirtyMetadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Strength - if (entityMetadata.getId() == 20) { - metadata.put(EntityData.STRENGTH, entityMetadata.getValue()); + /** + * Color equipped on the llama + */ + public void setCarpetedColor(EntityMetadata entityMetadata) { + // Bedrock treats llama decoration as armor + MobArmorEquipmentPacket equipmentPacket = new MobArmorEquipmentPacket(); + equipmentPacket.setRuntimeEntityId(geyserId); + // -1 means no armor + int carpetIndex = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + if (carpetIndex > -1 && carpetIndex <= 15) { + // The damage value is the dye color that Java sends us, for pre-1.16.220 + // The item is always going to be a carpet + equipmentPacket.setChestplate(session.getItemMappings().getCarpets().get(carpetIndex)); + } else { + equipmentPacket.setChestplate(ItemData.AIR); } - // Color equipped on the llama - if (entityMetadata.getId() == 21) { - // Bedrock treats llama decoration as armor - MobArmorEquipmentPacket equipmentPacket = new MobArmorEquipmentPacket(); - equipmentPacket.setRuntimeEntityId(geyserId); - // -1 means no armor - int carpetIndex = (int) entityMetadata.getValue(); - if (carpetIndex > -1 && carpetIndex <= 15) { - // The damage value is the dye color that Java sends us, for pre-1.16.220 - // The item is always going to be a carpet - equipmentPacket.setChestplate(session.getItemMappings().getCarpets().get(carpetIndex)); - } else { - equipmentPacket.setChestplate(ItemData.AIR); - } - // Required to fill out the rest of the equipment or Bedrock ignores it, including above else statement if removing armor - equipmentPacket.setBoots(ItemData.AIR); - equipmentPacket.setHelmet(ItemData.AIR); - equipmentPacket.setLeggings(ItemData.AIR); + // Required to fill out the rest of the equipment or Bedrock ignores it, including above else statement if removing armor + equipmentPacket.setBoots(ItemData.AIR); + equipmentPacket.setHelmet(ItemData.AIR); + equipmentPacket.setLeggings(ItemData.AIR); - session.sendUpstreamPacket(equipmentPacket); - } - // Color of the llama - if (entityMetadata.getId() == 22) { - metadata.put(EntityData.VARIANT, entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + session.sendUpstreamPacket(equipmentPacket); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java index 77059ae35..b8bfcdca6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java @@ -27,18 +27,20 @@ package org.geysermc.connector.entity.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class TraderLlamaEntity extends LlamaEntity { - public TraderLlamaEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public TraderLlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void spawnEntity(GeyserSession session) { - this.metadata.put(EntityData.MARK_VARIANT, 1); - super.spawnEntity(session); + protected void initializeMetadata() { + super.initializeMetadata(); + this.dirtyMetadata.put(EntityData.MARK_VARIANT, 1); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java index f22124409..a4fe27535 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java @@ -26,58 +26,71 @@ package org.geysermc.connector.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class CatEntity extends TameableEntity { private byte collarColor; - public CatEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public CatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateRotation(GeyserSession session, float yaw, float pitch, boolean isOnGround) { - moveRelative(session, 0, 0, 0, Vector3f.from(this.rotation.getX(), pitch, yaw), isOnGround); + public void updateRotation(float yaw, float pitch, boolean isOnGround) { + moveRelative(0, 0, 0, yaw, pitch, yaw, isOnGround); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 16) { - metadata.put(EntityData.SCALE, (boolean) entityMetadata.getValue() ? 0.4f : 0.8f); - } else if (entityMetadata.getId() == 17) { - // Update collar color if tamed - if (metadata.getFlags().getFlag(EntityFlag.TAMED)) { - metadata.put(EntityData.COLOR, collarColor); - } + protected float getAdultSize() { + return 0.8f; + } + + @Override + protected float getBabySize() { + return 0.4f; + } + + @Override + public void setTameableFlags(EntityMetadata entityMetadata) { + super.setTameableFlags(entityMetadata); + // Update collar color if tamed + if (getFlag(EntityFlag.TAMED)) { + dirtyMetadata.put(EntityData.COLOR, collarColor); } - if (entityMetadata.getId() == 19) { - // Different colors in Java and Bedrock for some reason - int metadataValue = (int) entityMetadata.getValue(); - int variantColor = switch (metadataValue) { - case 0 -> 8; - case 8 -> 0; - case 9 -> 10; - case 10 -> 9; - default -> metadataValue; - }; - metadata.put(EntityData.VARIANT, variantColor); - } - if (entityMetadata.getId() == 20) { - metadata.getFlags().setFlag(EntityFlag.RESTING, (boolean) entityMetadata.getValue()); - } - if (entityMetadata.getId() == 22) { - collarColor = (byte) (int) entityMetadata.getValue(); - // Needed or else wild cats are a red color - if (metadata.getFlags().getFlag(EntityFlag.TAMED)) { - metadata.put(EntityData.COLOR, collarColor); - } + } + + public void setCatVariant(EntityMetadata entityMetadata) { + // Different colors in Java and Bedrock for some reason + int metadataValue = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + int variantColor = switch (metadataValue) { + case 0 -> 8; + case 8 -> 0; + case 9 -> 10; + case 10 -> 9; + default -> metadataValue; + }; + dirtyMetadata.put(EntityData.VARIANT, variantColor); + } + + public void setResting(EntityMetadata entityMetadata) { + setFlag(EntityFlag.RESTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + } + + public void setCollarColor(EntityMetadata entityMetadata) { + collarColor = (byte) ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + // Needed or else wild cats are a red color + if (getFlag(EntityFlag.TAMED)) { + dirtyMetadata.put(EntityData.COLOR, collarColor); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java index 1bb75931e..763d489e4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java @@ -25,26 +25,17 @@ package org.geysermc.connector.entity.living.animal.tameable; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class ParrotEntity extends TameableEntity { - public ParrotEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Parrot color - if (entityMetadata.getId() == 19) { - metadata.put(EntityData.VARIANT, entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + public ParrotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java index 923e13712..a07ce3b9b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java @@ -26,46 +26,51 @@ package org.geysermc.connector.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import lombok.Getter; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import java.util.UUID; public class TameableEntity extends AnimalEntity { + /** + * Used in the interactive tag manager to track if the session player owns this entity + */ + @Getter + protected long ownerBedrockId; - public TameableEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public TameableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); - metadata.getFlags().setFlag(EntityFlag.ANGRY, (xd & 0x02) == 0x02); - metadata.getFlags().setFlag(EntityFlag.TAMED, (xd & 0x04) == 0x04); - } + public void setTameableFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); + setFlag(EntityFlag.ANGRY, (xd & 0x02) == 0x02); + setFlag(EntityFlag.TAMED, (xd & 0x04) == 0x04); + } + public void setOwner(EntityMetadata entityMetadata) { // Note: Must be set for wolf collar color to work - if (entityMetadata.getId() == 18) { - if (entityMetadata.getValue() != null) { - // Owner UUID of entity - Entity entity = session.getEntityCache().getPlayerEntity((UUID) entityMetadata.getValue()); - // Used as both a check since the player isn't in the entity cache and a normal fallback - if (entity == null) { - entity = session.getPlayerEntity(); - } - // Translate to entity ID - metadata.put(EntityData.OWNER_EID, entity.getGeyserId()); - } else { - metadata.put(EntityData.OWNER_EID, 0L); // Reset + if (entityMetadata.getValue() != null) { + // Owner UUID of entity + Entity entity = session.getEntityCache().getPlayerEntity(entityMetadata.getValue()); + // Used as both a check since the player isn't in the entity cache and a normal fallback + if (entity == null) { + entity = session.getPlayerEntity(); } + // Translate to entity ID + ownerBedrockId = entity.getGeyserId(); + } else { + // Reset + ownerBedrockId = 0L; } - super.updateBedrockMetadata(entityMetadata, session); + dirtyMetadata.put(EntityData.OWNER_EID, ownerBedrockId); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java index 183719dbb..5d6bcf1e3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java @@ -26,15 +26,18 @@ package org.geysermc.connector.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableSet; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; import java.util.Set; +import java.util.UUID; public class WolfEntity extends TameableEntity { /** @@ -47,49 +50,45 @@ public class WolfEntity extends TameableEntity { private byte collarColor; - public WolfEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public WolfEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - //Reset wolf color - if (entityMetadata.getId() == 17) { - byte xd = (byte) entityMetadata.getValue(); - boolean angry = (xd & 0x02) == 0x02; - if (angry) { - metadata.put(EntityData.COLOR, (byte) 0); - } + public void setTameableFlags(EntityMetadata entityMetadata) { + super.setFlags(entityMetadata); + // Reset wolf color + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + boolean angry = (xd & 0x02) == 0x02; + if (angry) { + dirtyMetadata.put(EntityData.COLOR, (byte) 0); + } + } + + public void setCollarColor(EntityMetadata entityMetadata) { + collarColor = (byte) ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + if (getFlag(EntityFlag.ANGRY)) { + return; } - // "Begging" on wiki.vg, "Interested" in Nukkit - the tilt of the head - if (entityMetadata.getId() == 19) { - metadata.getFlags().setFlag(EntityFlag.INTERESTED, (boolean) entityMetadata.getValue()); + dirtyMetadata.put(EntityData.COLOR, collarColor); + if (ownerBedrockId == 0) { + // If a color is set and there is no owner entity ID, set one. + // Otherwise, the entire wolf is set to that color: https://user-images.githubusercontent.com/9083212/99209989-92691200-2792-11eb-911d-9a315c955be9.png + dirtyMetadata.put(EntityData.OWNER_EID, session.getPlayerEntity().getGeyserId()); } + } - // Wolf collar color - // Relies on EntityData.OWNER_EID being set in TameableEntity.java - if (entityMetadata.getId() == 20 && !metadata.getFlags().getFlag(EntityFlag.ANGRY)) { - metadata.put(EntityData.COLOR, collarColor = (byte) (int) entityMetadata.getValue()); - if (!metadata.containsKey(EntityData.OWNER_EID)) { - // If a color is set and there is no owner entity ID, set one. - // Otherwise, the entire wolf is set to that color: https://user-images.githubusercontent.com/9083212/99209989-92691200-2792-11eb-911d-9a315c955be9.png - metadata.put(EntityData.OWNER_EID, session.getPlayerEntity().getGeyserId()); - } - } - - // Wolf anger (1.16+) - if (entityMetadata.getId() == 21) { - metadata.getFlags().setFlag(EntityFlag.ANGRY, (int) entityMetadata.getValue() != 0); - metadata.put(EntityData.COLOR, (int) entityMetadata.getValue() != 0 ? (byte) 0 : collarColor); - } - - super.updateBedrockMetadata(entityMetadata, session); + // 1.16+ + public void setWolfAngerTime(EntityMetadata entityMetadata) { + int time = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.ANGRY, time != 0); + dirtyMetadata.put(EntityData.COLOR, time != 0 ? (byte) 0 : collarColor); } @Override public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { // Cannot be a baby to eat these foods - return WOLF_FOODS.contains(javaIdentifierStripped) && !metadata.getFlags().getFlag(EntityFlag.BABY); + return WOLF_FOODS.contains(javaIdentifierStripped) && !getFlag(EntityFlag.BABY); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java index 84b6772b0..da7e0b357 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java @@ -26,18 +26,15 @@ package org.geysermc.connector.entity.living.merchant; import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.AgeableEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class AbstractMerchantEntity extends AgeableEntity { - public AbstractMerchantEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - } - - @Override - public void teleport(GeyserSession session, Vector3f position, float yaw, float pitch, boolean isOnGround) { - super.teleport(session, position, yaw - 180, pitch, isOnGround); + public AbstractMerchantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java index f64d9f0cd..234b065d4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java @@ -26,6 +26,7 @@ package org.geysermc.connector.entity.living.merchant; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; @@ -34,12 +35,12 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; -import org.geysermc.connector.entity.type.EntityType; +import lombok.Getter; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.BlockRegistries; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.UUID; public class VillagerEntity extends AbstractMerchantEntity { @@ -79,32 +80,41 @@ public class VillagerEntity extends AbstractMerchantEntity { VILLAGER_REGIONS.put(6, 6); } - public VillagerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + private Vector3i bedPosition; + /** + * Used in the interactive tag manager + */ + @Getter + private boolean canTradeWith; + + public VillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setVillagerData(EntityMetadata entityMetadata) { + VillagerData villagerData = entityMetadata.getValue(); + // Profession + int profession = VILLAGER_PROFESSIONS.get(villagerData.getProfession()); + canTradeWith = profession != 14 && profession != 0; // Not a notwit and not professionless + dirtyMetadata.put(EntityData.VARIANT, profession); + //metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason? + // Region + dirtyMetadata.put(EntityData.MARK_VARIANT, VILLAGER_REGIONS.get(villagerData.getType())); + // Trade tier - different indexing in Bedrock + dirtyMetadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 18) { - VillagerData villagerData = (VillagerData) entityMetadata.getValue(); - // Profession - metadata.put(EntityData.VARIANT, VILLAGER_PROFESSIONS.get(villagerData.getProfession())); - //metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason? - // Region - metadata.put(EntityData.MARK_VARIANT, VILLAGER_REGIONS.get(villagerData.getType())); - // Trade tier - different indexing in Bedrock - metadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); - } - super.updateBedrockMetadata(entityMetadata, session); + public Vector3i setBedPosition(EntityMetadata entityMetadata) { + return bedPosition = super.setBedPosition(entityMetadata); } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { // The bed block position, if it exists - Vector3i bedPosition; - if (!metadata.getFlags().getFlag(EntityFlag.SLEEPING) || (bedPosition = metadata.getPos(EntityData.BED_POSITION, null)) == null) { + if (!getFlag(EntityFlag.SLEEPING) || bedPosition == null) { // No need to worry about extra processing to compensate for sleeping - super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); + super.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, isOnGround); return; } @@ -133,7 +143,9 @@ public class VillagerEntity extends AbstractMerchantEntity { zOffset = .5f; } - setRotation(rotation); + setYaw(yaw); + setPitch(pitch); + setHeadYaw(headYaw); setOnGround(isOnGround); this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java index bc17e27ca..9997dd968 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java @@ -26,24 +26,25 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class AbstractSkeletonEntity extends MonsterEntity { - public AbstractSkeletonEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AbstractSkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 15) { - byte xd = (byte) entityMetadata.getValue(); - // A bit of a loophole so the hands get raised - set the target ID to its own ID - metadata.put(EntityData.TARGET_EID, ((xd & 4) == 4) ? geyserId : 0); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setMobFlags(EntityMetadata entityMetadata) { + super.setMobFlags(entityMetadata); + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + // A bit of a loophole so the hands get raised - set the target ID to its own ID + dirtyMetadata.put(EntityData.TARGET_EID, ((xd & 4) == 4) ? geyserId : 0); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java index cccdaf7d2..e092d3099 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java @@ -26,32 +26,30 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.DimensionUtils; +import java.util.UUID; + public class BasePiglinEntity extends MonsterEntity { private boolean isImmuneToZombification; - public BasePiglinEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public BasePiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setImmuneToZombification(EntityMetadata entityMetadata) { + // Apply shaking effect if not in the nether and zombification is possible + this.isImmuneToZombification = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SHAKING, isShaking()); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - // Immune to zombification? - // Apply shaking effect if not in the nether and zombification is possible - this.isImmuneToZombification = (boolean) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); - } - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - protected boolean isShaking(GeyserSession session) { - return (!isImmuneToZombification && !session.getDimension().equals(DimensionUtils.NETHER)) || super.isShaking(session); + protected boolean isShaking() { + return (!isImmuneToZombification && !session.getDimension().equals(DimensionUtils.NETHER)) || super.isShaking(); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java index 6e1bdce53..33afdf81d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java @@ -26,24 +26,22 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class BlazeEntity extends MonsterEntity { - public BlazeEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public BlazeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.ON_FIRE, (xd & 0x01) == 0x01); - } - - super.updateBedrockMetadata(entityMetadata, session); + public void setBlazeFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.ON_FIRE, (xd & 0x01) == 0x01); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java index a1dc02821..0f561f8d2 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java @@ -26,38 +26,34 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; -public class CreeperEntity extends MonsterEntity { +import java.util.UUID; +public class CreeperEntity extends MonsterEntity { /** - * Whether the creeper has been ignited and is using ID 17. - * In this instance we ignore ID 15 since it's sending us -1 which confuses poor Bedrock. + * Whether the creeper has been ignited and is using {@link #setIgnited(EntityMetadata)}. + * In this instance we ignore {@link #setSwelling(EntityMetadata)} since it's sending us -1 which confuses poor Bedrock. */ private boolean ignitedByFlintAndSteel = false; - public CreeperEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public CreeperEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - if (!ignitedByFlintAndSteel) { - metadata.getFlags().setFlag(EntityFlag.IGNITED, (int) entityMetadata.getValue() == 1); - } - } - if (entityMetadata.getId() == 17) { - metadata.getFlags().setFlag(EntityFlag.POWERED, (boolean) entityMetadata.getValue()); - } - if (entityMetadata.getId() == 18) { - ignitedByFlintAndSteel = (boolean) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.IGNITED, ignitedByFlintAndSteel); + public void setSwelling(EntityMetadata entityMetadata) { + if (!ignitedByFlintAndSteel) { + setFlag(EntityFlag.IGNITED, ((IntEntityMetadata) entityMetadata).getPrimitiveValue() == 1); } + } - super.updateBedrockMetadata(entityMetadata, session); + public void setIgnited(EntityMetadata entityMetadata) { + ignitedByFlintAndSteel = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.IGNITED, ignitedByFlintAndSteel); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java index bfbb74af9..ce98218cd 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java @@ -27,14 +27,21 @@ package org.geysermc.connector.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class ElderGuardianEntity extends GuardianEntity { - public ElderGuardianEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - // Otherwise it just looks like a normal guardian but bigger - metadata.getFlags().setFlag(EntityFlag.ELDER, true); + public ElderGuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } + @Override + protected void initializeMetadata() { + super.initializeMetadata(); + // Otherwise it just looks like a normal guardian but bigger + setFlag(EntityFlag.ELDER, true); + } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java index d3d6e30d5..ff149c5b7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java @@ -26,6 +26,7 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -33,17 +34,18 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; import lombok.Data; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.Tickable; -import org.geysermc.connector.entity.living.InsentientEntity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.living.MobEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.DimensionUtils; import java.util.Random; +import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicLong; -public class EnderDragonEntity extends InsentientEntity implements Tickable { +public class EnderDragonEntity extends MobEntity implements Tickable { /** * The Ender Dragon has multiple hit boxes, which * are each its own invisible entity @@ -78,46 +80,47 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { private float wingPosition; private float lastWingPosition; - public EnderDragonEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - - metadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + public EnderDragonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { // Phase - phase = (int) entityMetadata.getValue(); - phaseTicks = 0; - metadata.getFlags().setFlag(EntityFlag.SITTING, isSitting()); - } - - super.updateBedrockMetadata(entityMetadata, session); - - if (entityMetadata.getId() == 9) { - if (phase == 9 && this.health <= 0) { // Dying phase - EntityEventPacket entityEventPacket = new EntityEventPacket(); - entityEventPacket.setType(EntityEventType.ENDER_DRAGON_DEATH); - entityEventPacket.setRuntimeEntityId(geyserId); - entityEventPacket.setData(0); - session.sendUpstreamPacket(entityEventPacket); - } - } + protected void initializeMetadata() { + super.initializeMetadata(); + setFlag(EntityFlag.FIRE_IMMUNE, true); } @Override - public void spawnEntity(GeyserSession session) { - super.spawnEntity(session); + public void setHealth(EntityMetadata entityMetadata) { + super.setHealth(entityMetadata); + if (phase == 9 && this.health <= 0) { // Dying phase + EntityEventPacket entityEventPacket = new EntityEventPacket(); + entityEventPacket.setType(EntityEventType.ENDER_DRAGON_DEATH); + entityEventPacket.setRuntimeEntityId(geyserId); + entityEventPacket.setData(0); + session.sendUpstreamPacket(entityEventPacket); + } + } + + public void setPhase(EntityMetadata entityMetadata) { + phase = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + phaseTicks = 0; + setFlag(EntityFlag.SITTING, isSitting()); + } + + @Override + public void spawnEntity() { + super.spawnEntity(); AtomicLong nextEntityId = session.getEntityCache().getNextEntityId(); - head = new EnderDragonPartEntity(entityId + 1, nextEntityId.incrementAndGet(), EntityType.ENDER_DRAGON_PART, 1, 1); - neck = new EnderDragonPartEntity(entityId + 2, nextEntityId.incrementAndGet(), EntityType.ENDER_DRAGON_PART, 3, 3); - body = new EnderDragonPartEntity(entityId + 3, nextEntityId.incrementAndGet(), EntityType.ENDER_DRAGON_PART, 5, 3); - leftWing = new EnderDragonPartEntity(entityId + 4, nextEntityId.incrementAndGet(), EntityType.ENDER_DRAGON_PART, 4, 2); - rightWing = new EnderDragonPartEntity(entityId + 5, nextEntityId.incrementAndGet(), EntityType.ENDER_DRAGON_PART, 4, 2); + head = new EnderDragonPartEntity(session, entityId + 1, nextEntityId.incrementAndGet(), 1, 1); + neck = new EnderDragonPartEntity(session, entityId + 2, nextEntityId.incrementAndGet(), 3, 3); + body = new EnderDragonPartEntity(session, entityId + 3, nextEntityId.incrementAndGet(), 5, 3); + leftWing = new EnderDragonPartEntity(session, entityId + 4, nextEntityId.incrementAndGet(), 4, 2); + rightWing = new EnderDragonPartEntity(session, entityId + 5, nextEntityId.incrementAndGet(), 4, 2); tail = new EnderDragonPartEntity[3]; for (int i = 0; i < 3; i++) { - tail[i] = new EnderDragonPartEntity(entityId + 6 + i, nextEntityId.incrementAndGet(), EntityType.ENDER_DRAGON_PART, 2, 2); + tail[i] = new EnderDragonPartEntity(session, entityId + 6 + i, nextEntityId.incrementAndGet(), 2, 2); } allParts = new EnderDragonPartEntity[]{head, neck, body, leftWing, rightWing, tail[0], tail[1], tail[2]}; @@ -128,7 +131,7 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { for (int i = 0; i < segmentHistory.length; i++) { segmentHistory[i] = new Segment(); - segmentHistory[i].yaw = rotation.getZ(); + segmentHistory[i].yaw = headYaw; segmentHistory[i].y = position.getY(); } } @@ -141,29 +144,27 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { } @Override - public boolean despawnEntity(GeyserSession session) { + public boolean despawnEntity() { for (EnderDragonPartEntity part : allParts) { - part.despawnEntity(session); + part.despawnEntity(); } - return super.despawnEntity(session); + return super.despawnEntity(); } @Override - public void tick(GeyserSession session) { - effectTick(session); - if (!metadata.getFlags().getFlag(EntityFlag.NO_AI) && isAlive()) { + public void tick() { + effectTick(); + if (!getFlag(EntityFlag.NO_AI) && isAlive()) { pushSegment(); - updateBoundingBoxes(session); + updateBoundingBoxes(); } } /** * Updates the positions of the Ender Dragon's multiple bounding boxes - * - * @param session GeyserSession. */ - private void updateBoundingBoxes(GeyserSession session) { - Vector3f facingDir = Vector3f.createDirectionDeg(0, rotation.getZ()); + private void updateBoundingBoxes() { + Vector3f facingDir = Vector3f.createDirectionDeg(0, headYaw); Segment baseSegment = getSegment(5); // Used to angle the head, neck, and tail when the dragon flies up/down float pitch = (float) Math.toRadians(10 * (baseSegment.getY() - getSegment(10).getY())); @@ -182,7 +183,7 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { neck.setPosition(facingDir.up(pitchY).mul(pitchXZ, 1, -pitchXZ).mul(5.5f).up(headDuck)); body.setPosition(facingDir.mul(0.5f, 0f, -0.5f)); - Vector3f wingPos = Vector3f.createDirectionDeg(0, 90f - rotation.getZ()).mul(4.5f).up(2f); + Vector3f wingPos = Vector3f.createDirectionDeg(0, 90f - headYaw).mul(4.5f).up(2f); rightWing.setPosition(wingPos); leftWing.setPosition(wingPos.mul(-1, 1, -1)); // Mirror horizontally @@ -191,24 +192,23 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { float distance = (i + 1) * 2f; // Curls the tail when the dragon turns Segment targetSegment = getSegment(12 + 2 * i); - float angle = rotation.getZ() + targetSegment.yaw - baseSegment.yaw; + float angle = headYaw + targetSegment.yaw - baseSegment.yaw; float tailYOffset = targetSegment.y - baseSegment.y - (distance + 1.5f) * pitchY + 1.5f; tail[i].setPosition(Vector3f.createDirectionDeg(0, angle).mul(distance).add(tailBase).mul(-pitchXZ, 1, pitchXZ).up(tailYOffset)); } // Send updated positions for (EnderDragonPartEntity part : allParts) { - part.moveAbsolute(session, part.getPosition().add(position), Vector3f.ZERO, false, false); + part.moveAbsolute(part.getPosition().add(position), 0, 0, 0, false, false); } } /** * Handles the particles and sounds of the Ender Dragon - * @param session GeyserSession. */ - private void effectTick(GeyserSession session) { + private void effectTick() { Random random = ThreadLocalRandom.current(); - if (!metadata.getFlags().getFlag(EntityFlag.SILENT)) { + if (!getFlag(EntityFlag.SILENT)) { if (Math.cos(wingPosition * 2f * Math.PI) <= -0.3f && Math.cos(lastWingPosition * 2f * Math.PI) >= -0.3f) { PlaySoundPacket playSoundPacket = new PlaySoundPacket(); playSoundPacket.setSound("mob.enderdragon.flap"); @@ -219,14 +219,14 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { } if (!isSitting() && !isHovering() && ticksTillNextGrowl-- == 0) { - playGrowlSound(session); + playGrowlSound(); ticksTillNextGrowl = 200 + random.nextInt(200); } lastWingPosition = wingPosition; } if (isAlive()) { - if (metadata.getFlags().getFlag(EntityFlag.NO_AI)) { + if (getFlag(EntityFlag.NO_AI)) { wingPosition = 0.5f; } else if (isHovering() || isSitting()) { wingPosition += 0.1f; @@ -237,7 +237,7 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { phaseTicks++; if (phase == 3) { // Landing Phase - float headHeight = head.getMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); + float headHeight = head.getDirtyMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); //TODO Vector3f headCenter = head.getPosition().up(headHeight * 0.5f); for (int i = 0; i < 8; i++) { @@ -262,7 +262,7 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { } } } else if (phase == 7) { // Sitting Attacking Phase - playGrowlSound(session); + playGrowlSound(); } else if (phase == 9) { // Dying Phase // Send explosion particles as the dragon move towards the end portal if (phaseTicks % 10 == 0) { @@ -279,7 +279,7 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { } } - private void playGrowlSound(GeyserSession session) { + private void playGrowlSound() { Random random = ThreadLocalRandom.current(); PlaySoundPacket playSoundPacket = new PlaySoundPacket(); playSoundPacket.setSound("mob.enderdragon.growl"); @@ -306,7 +306,7 @@ public class EnderDragonEntity extends InsentientEntity implements Tickable { */ private void pushSegment() { latestSegment = (latestSegment + 1) % segmentHistory.length; - segmentHistory[latestSegment].yaw = rotation.getZ(); + segmentHistory[latestSegment].yaw = headYaw; segmentHistory[latestSegment].y = position.getY(); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java index 288a3e423..ed1985057 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java @@ -29,15 +29,17 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinitions; +import org.geysermc.connector.network.session.GeyserSession; public class EnderDragonPartEntity extends Entity { - public EnderDragonPartEntity(long entityId, long geyserId, EntityType entityType, float width, float height) { - super(entityId, geyserId, entityType, Vector3f.ZERO, Vector3f.ZERO, Vector3f.ZERO); - metadata.put(EntityData.BOUNDING_BOX_WIDTH, width); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); - metadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + public EnderDragonPartEntity(GeyserSession session, long entityId, long geyserId, float width, float height) { + super(session, entityId, geyserId, null, EntityDefinitions.ENDER_DRAGON_PART, Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); + + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, width); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); + setFlag(EntityFlag.INVISIBLE, true); + setFlag(EntityFlag.FIRE_IMMUNE, true); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java index e187d7f0b..94265f7e4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java @@ -26,41 +26,46 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class EndermanEntity extends MonsterEntity { - public EndermanEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public EndermanEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Held block - if (entityMetadata.getId() == 16) { - metadata.put(EntityData.CARRIED_BLOCK, session.getBlockMappings().getBedrockBlockId((int) entityMetadata.getValue())); - } - // "Is screaming" - controls sound - if (entityMetadata.getId() == 17) { - if ((boolean) entityMetadata.getValue()) { - LevelSoundEvent2Packet packet = new LevelSoundEvent2Packet(); - packet.setSound(SoundEvent.STARE); - packet.setPosition(this.position); - packet.setExtraData(-1); - packet.setIdentifier("minecraft:enderman"); - session.sendUpstreamPacket(packet); - } + public void setCarriedBlock(EntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.CARRIED_BLOCK, session.getBlockMappings().getBedrockBlockId(((IntEntityMetadata) entityMetadata).getPrimitiveValue())); + } + + /** + * Controls the screaming sound + */ + public void setScreaming(EntityMetadata entityMetadata) { + //TODO see if Bedrock controls this differently + // Java Edition this controls which ambient sound is used + if (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()) { + LevelSoundEvent2Packet packet = new LevelSoundEvent2Packet(); + packet.setSound(SoundEvent.STARE); + packet.setPosition(this.position); + packet.setExtraData(-1); + packet.setIdentifier("minecraft:enderman"); + session.sendUpstreamPacket(packet); } + } + + public void setAngry(EntityMetadata entityMetadata) { // "Is staring/provoked" - controls visuals - if (entityMetadata.getId() == 18) { - metadata.getFlags().setFlag(EntityFlag.ANGRY, (boolean) entityMetadata.getValue()); - } - super.updateBedrockMetadata(entityMetadata, session); + setFlag(EntityFlag.ANGRY, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java index 22d91ec36..e281db30b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java @@ -26,24 +26,23 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.FlyingEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class GhastEntity extends FlyingEntity { - public GhastEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public GhastEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - // If the ghast is attacking - metadata.put(EntityData.CHARGE_AMOUNT, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setGhastAttacking(EntityMetadata entityMetadata) { + // If the ghast is attacking + dirtyMetadata.put(EntityData.CHARGE_AMOUNT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java index 65b406d54..0b1f894f1 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java @@ -27,13 +27,16 @@ package org.geysermc.connector.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class GiantEntity extends MonsterEntity { - public GiantEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public GiantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - metadata.put(EntityData.SCALE, 6f); + dirtyMetadata.put(EntityData.SCALE, 6f); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java index 0b28cd53e..caffb5d9e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java @@ -26,33 +26,34 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class GuardianEntity extends MonsterEntity { - public GuardianEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public GuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - Entity entity = session.getEntityCache().getEntityByJavaId((int) entityMetadata.getValue()); - if (entity == null && session.getPlayerEntity().getEntityId() == (Integer) entityMetadata.getValue()) { - entity = session.getPlayerEntity(); - } - - if (entity != null) { - metadata.put(EntityData.TARGET_EID, entity.getGeyserId()); - } else { - metadata.put(EntityData.TARGET_EID, (long) 0); - } + public void setGuardianTarget(EntityMetadata entityMetadata) { + int entityId = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + Entity entity; + if (session.getPlayerEntity().getEntityId() == entityId) { + entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(entityId); } - super.updateBedrockMetadata(entityMetadata, session); + if (entity != null) { + dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); + } else { + dirtyMetadata.put(EntityData.TARGET_EID, (long) 0); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java index 06a04d4c5..d83b72cd0 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java @@ -26,12 +26,15 @@ package org.geysermc.connector.entity.living.monster; import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.CreatureEntity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class MonsterEntity extends CreatureEntity { - public MonsterEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public MonsterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java index bfa1ea724..651d1aa66 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java @@ -26,28 +26,27 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.FlyingEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class PhantomEntity extends FlyingEntity { - public PhantomEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public PhantomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { // Size - int size = (int) entityMetadata.getValue(); - float modelScale = 1f + 0.15f * size; - float boundsScale = (1f + (0.2f * size) / EntityType.PHANTOM.getWidth()) / modelScale; + public void setPhantomScale(EntityMetadata entityMetadata) { + int size = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + float modelScale = 1f + 0.15f * size; + float boundsScale = (1f + (0.2f * size) / definition.width()) / modelScale; - metadata.put(EntityData.BOUNDING_BOX_WIDTH, boundsScale * EntityType.PHANTOM.getWidth()); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundsScale * EntityType.PHANTOM.getHeight()); - metadata.put(EntityData.SCALE, modelScale); - } - super.updateBedrockMetadata(entityMetadata, session); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundsScale * definition.width()); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundsScale * definition.height()); + dirtyMetadata.put(EntityData.SCALE, modelScale); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java index 860f6dfd3..61fb36bf4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java @@ -26,44 +26,40 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class PiglinEntity extends BasePiglinEntity { - public PiglinEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public PiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - boolean isBaby = (boolean) entityMetadata.getValue(); - if (isBaby) { - metadata.put(EntityData.SCALE, .55f); - metadata.getFlags().setFlag(EntityFlag.BABY, true); - } - } - if (entityMetadata.getId() == 18) { - metadata.getFlags().setFlag(EntityFlag.CHARGING, (boolean) entityMetadata.getValue()); - } - if (entityMetadata.getId() == 19) { - metadata.getFlags().setFlag(EntityFlag.DANCING, (boolean) entityMetadata.getValue()); - } + public void setBaby(EntityMetadata entityMetadata) { + boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f); + setFlag(EntityFlag.BABY, isBaby); + } - super.updateBedrockMetadata(entityMetadata, session); + public void setChargingCrossbow(EntityMetadata entityMetadata) { + setFlag(EntityFlag.CHARGING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + } + + public void setDancing(EntityMetadata entityMetadata) { + setFlag(EntityFlag.DANCING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); } @Override public void updateOffHand(GeyserSession session) { // Check if the Piglin is holding Gold and set the ADMIRING flag accordingly so its pose updates - boolean changed = metadata.getFlags().setFlag(EntityFlag.ADMIRING, session.getTagCache().shouldPiglinAdmire(session.getItemMappings().getMapping(this.offHand))); - if (changed) { - super.updateBedrockMetadata(session); - } + setFlag(EntityFlag.ADMIRING, session.getTagCache().shouldPiglinAdmire(session.getItemMappings().getMapping(this.offHand))); + super.updateBedrockMetadata(); super.updateOffHand(session); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java index 2402e4330..e16df7211 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java @@ -26,44 +26,43 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.GolemEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.utils.Direction; + +import java.util.UUID; public class ShulkerEntity extends GolemEntity { - public ShulkerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ShulkerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that invisibility should be fixed through the resource pack - metadata.getFlags().setFlag(EntityFlag.BRIBED, true); + setFlag(EntityFlag.BRIBED, true); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - BlockFace blockFace = (BlockFace) entityMetadata.getValue(); - metadata.put(EntityData.SHULKER_ATTACH_FACE, (byte) blockFace.ordinal()); - } + public void setAttachedFace(EntityMetadata entityMetadata) { + Direction direction = entityMetadata.getValue(); + dirtyMetadata.put(EntityData.SHULKER_ATTACH_FACE, (byte) direction.ordinal()); + } - if (entityMetadata.getId() == 17) { - int height = (byte) entityMetadata.getValue(); - metadata.put(EntityData.SHULKER_PEEK_ID, height); - } + public void setShulkerHeight(EntityMetadata entityMetadata) { + int height = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.SHULKER_PEEK_ID, height); + } - if (entityMetadata.getId() == 18) { - byte color = (byte) entityMetadata.getValue(); - if (color == 16) { - // 16 is default on both editions - metadata.put(EntityData.VARIANT, 16); - } else { - // Every other shulker color is offset 15 in bedrock edition - metadata.put(EntityData.VARIANT, Math.abs(color - 15)); - } + public void setShulkerColor(EntityMetadata entityMetadata) { + byte color = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + if (color == 16) { + // 16 is default on both editions + dirtyMetadata.put(EntityData.VARIANT, 16); + } else { + // Every other shulker color is offset 15 in bedrock edition + dirtyMetadata.put(EntityData.VARIANT, Math.abs(color - 15)); } - super.updateBedrockMetadata(entityMetadata, session); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java index 44c1d1f85..984590db1 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java @@ -26,29 +26,28 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class SkeletonEntity extends AbstractSkeletonEntity { private boolean convertingToStray = false; - public SkeletonEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public SkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setConvertingToStray(EntityMetadata entityMetadata) { + this.convertingToStray = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SHAKING, isShaking()); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 16) { - this.convertingToStray = (boolean) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); - } - } - - @Override - protected boolean isShaking(GeyserSession session) { + protected boolean isShaking() { return convertingToStray; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java index 65c30289a..f2f151eae 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java @@ -26,24 +26,22 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class SpiderEntity extends MonsterEntity { - public SpiderEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public SpiderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.WALL_CLIMBING, (xd & 0x01) == 0x01); - } - - super.updateBedrockMetadata(entityMetadata, session); + public void setSpiderFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.WALL_CLIMBING, (xd & 0x01) == 0x01); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java index 990a2f3a9..d6e05b387 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java @@ -26,25 +26,24 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class VexEntity extends MonsterEntity { - public VexEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public VexEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - byte xd = (byte) entityMetadata.getValue(); - // Set the target to the player to force the attack animation - // even if the player isn't the target as we dont get the target on Java - metadata.put(EntityData.TARGET_EID, (xd & 0x01) == 0x01 ? session.getPlayerEntity().getGeyserId() : 0); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setVexFlags(EntityMetadata entityMetadata) { + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + // Set the target to the player to force the attack animation + // even if the player isn't the target as we dont get the target on Java + dirtyMetadata.put(EntityData.TARGET_EID, (xd & 0x01) == 0x01 ? session.getPlayerEntity().getGeyserId() : 0); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java index d6d7f8074..befb464fe 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java @@ -26,52 +26,62 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class WitherEntity extends MonsterEntity { - public WitherEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); - - metadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); + public WitherEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - long targetID = 0; + protected void initializeMetadata() { + super.initializeMetadata(); + dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); + } - if (entityMetadata.getId() >= 16 && entityMetadata.getId() <= 18) { - Entity entity = session.getEntityCache().getEntityByJavaId((int) entityMetadata.getValue()); - if (entity == null && session.getPlayerEntity().getEntityId() == (int) entityMetadata.getValue()) { - entity = session.getPlayerEntity(); - } + public void setTarget1(EntityMetadata entityMetadata) { + setTargetId(EntityData.WITHER_TARGET_1, entityMetadata); + } - if (entity != null) { - targetID = entity.getGeyserId(); - } + public void setTarget2(EntityMetadata entityMetadata) { + setTargetId(EntityData.WITHER_TARGET_2, entityMetadata); + } + + public void setTarget3(EntityMetadata entityMetadata) { + setTargetId(EntityData.WITHER_TARGET_3, entityMetadata); + } + + private void setTargetId(EntityData entityData, EntityMetadata entityMetadata) { + int entityId = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + Entity entity; + if (session.getPlayerEntity().getEntityId() == entityId) { + entity = session.getPlayerEntity(); + } else { + entity = session.getEntityCache().getEntityByJavaId(entityId); } - if (entityMetadata.getId() == 16) { - metadata.put(EntityData.WITHER_TARGET_1, targetID); - } else if (entityMetadata.getId() == 17) { - metadata.put(EntityData.WITHER_TARGET_2, targetID); - } else if (entityMetadata.getId() == 18) { - metadata.put(EntityData.WITHER_TARGET_3, targetID); - } else if (entityMetadata.getId() == 19) { - metadata.put(EntityData.WITHER_INVULNERABLE_TICKS, entityMetadata.getValue()); - - // Show the shield for the first few seconds of spawning (like Java) - if ((int) entityMetadata.getValue() >= 165) { - metadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 0); - } else { - metadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); - } + if (entity != null) { + dirtyMetadata.put(entityData, entity.getGeyserId()); } + } - super.updateBedrockMetadata(entityMetadata, session); + public void setInvulnerableTicks(EntityMetadata entityMetadata) { + int value = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.WITHER_INVULNERABLE_TICKS, value); + + // Show the shield for the first few seconds of spawning (like Java) + if (value >= 165) { + dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 0); + } else { + dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); + } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java index dde19927d..4773b2d80 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java @@ -26,27 +26,24 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class ZoglinEntity extends MonsterEntity { - public ZoglinEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ZoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - boolean isBaby = (boolean) entityMetadata.getValue(); - if (isBaby) { - metadata.put(EntityData.SCALE, .55f); - metadata.getFlags().setFlag(EntityFlag.BABY, true); - } - } - super.updateBedrockMetadata(entityMetadata, session); + public void setBaby(EntityMetadata entityMetadata) { + boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f); + setFlag(EntityFlag.BABY, isBaby); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java index bae593e4f..fd9218cd7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java @@ -26,34 +26,35 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class ZombieEntity extends MonsterEntity { private boolean convertingToDrowned = false; - public ZombieEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ZombieEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setZombieBaby(EntityMetadata entityMetadata) { + boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + dirtyMetadata.put(EntityData.SCALE, isBaby ? .55f : 1.0f); + setFlag(EntityFlag.BABY, isBaby); + } + + public void setConvertingToDrowned(EntityMetadata entityMetadata) { + convertingToDrowned = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.SHAKING, isShaking()); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 16) { - boolean isBaby = (boolean) entityMetadata.getValue(); - metadata.put(EntityData.SCALE, isBaby ? .55f : 1.0f); - metadata.getFlags().setFlag(EntityFlag.BABY, isBaby); - } else if (entityMetadata.getId() == 18) { - convertingToDrowned = (boolean) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); - } - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - protected boolean isShaking(GeyserSession session) { - return convertingToDrowned || super.isShaking(session); + protected boolean isShaking() { + return convertingToDrowned || super.isShaking(); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java index 2e3308ec1..744d3e559 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java @@ -27,39 +27,39 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.merchant.VillagerEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class ZombieVillagerEntity extends ZombieEntity { private boolean isTransforming; - public ZombieVillagerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ZombieVillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); + } + + public void setTransforming(EntityMetadata entityMetadata) { + isTransforming = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.IS_TRANSFORMING, isTransforming); + setFlag(EntityFlag.SHAKING, isShaking()); + } + + public void setZombieVillagerData(EntityMetadata entityMetadata) { + VillagerData villagerData = entityMetadata.getValue(); + dirtyMetadata.put(EntityData.VARIANT, VillagerEntity.VILLAGER_PROFESSIONS.get(villagerData.getProfession())); // Actually works properly with the OptionalPack + dirtyMetadata.put(EntityData.MARK_VARIANT, VillagerEntity.VILLAGER_REGIONS.get(villagerData.getType())); + // Used with the OptionalPack + dirtyMetadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 19) { - isTransforming = (boolean) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.IS_TRANSFORMING, (boolean) entityMetadata.getValue()); - metadata.getFlags().setFlag(EntityFlag.SHAKING, isShaking(session)); - } - if (entityMetadata.getId() == 20) { - VillagerData villagerData = (VillagerData) entityMetadata.getValue(); - metadata.put(EntityData.VARIANT, VillagerEntity.VILLAGER_PROFESSIONS.get(villagerData.getProfession())); // Actually works properly with the OptionalPack - metadata.put(EntityData.MARK_VARIANT, VillagerEntity.VILLAGER_REGIONS.get(villagerData.getType())); - // Used with the OptionalPack - metadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); - } - super.updateBedrockMetadata(entityMetadata, session); - } - - @Override - protected boolean isShaking(GeyserSession session) { - return isTransforming || super.isShaking(session); + protected boolean isShaking() { + return isTransforming || super.isShaking(); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java index ad00145bc..ddfd3184b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java @@ -27,13 +27,16 @@ package org.geysermc.connector.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class ZombifiedPiglinEntity extends ZombieEntity { - public ZombifiedPiglinEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public ZombifiedPiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); - metadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + setFlag(EntityFlag.FIRE_IMMUNE, true); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java index e0fa18001..8350ae775 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java @@ -26,11 +26,14 @@ package org.geysermc.connector.entity.living.monster.raid; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class AbstractIllagerEntity extends RaidParticipantEntity { - public AbstractIllagerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public AbstractIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java index 325cac7ab..d2cb661c6 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java @@ -27,26 +27,28 @@ package org.geysermc.connector.entity.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; +import java.util.UUID; + public class PillagerEntity extends AbstractIllagerEntity { - public PillagerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public PillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateMainHand(GeyserSession session) { - checkForCrossbow(session); + public void updateMainHand(GeyserSession session) { //TODO + checkForCrossbow(); super.updateMainHand(session); } @Override public void updateOffHand(GeyserSession session) { - checkForCrossbow(session); + checkForCrossbow(); super.updateOffHand(session); } @@ -54,15 +56,13 @@ public class PillagerEntity extends AbstractIllagerEntity { /** * Check for a crossbow in either the mainhand or offhand. If one exists, indicate that the pillager should be posing */ - protected void checkForCrossbow(GeyserSession session) { + protected void checkForCrossbow() { ItemMapping crossbow = session.getItemMappings().getStoredItems().crossbow(); boolean hasCrossbow = this.hand.getId() == crossbow.getBedrockId() || this.offHand.getId() == crossbow.getBedrockId(); - boolean usingItemChanged = metadata.getFlags().setFlag(EntityFlag.USING_ITEM, hasCrossbow); - boolean chargedChanged = metadata.getFlags().setFlag(EntityFlag.CHARGED, hasCrossbow); + setFlag(EntityFlag.USING_ITEM, hasCrossbow); + setFlag(EntityFlag.CHARGED, hasCrossbow); - if (usingItemChanged || chargedChanged) { - updateBedrockMetadata(session); - } + updateBedrockMetadata(); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java index 15248f454..fcfd50425 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java @@ -26,12 +26,15 @@ package org.geysermc.connector.entity.living.monster.raid; import com.nukkitx.math.vector.Vector3f; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.monster.MonsterEntity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; public class RaidParticipantEntity extends MonsterEntity { - public RaidParticipantEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public RaidParticipantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java index 693220dda..23485750d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java @@ -26,38 +26,38 @@ package org.geysermc.connector.entity.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class SpellcasterIllagerEntity extends AbstractIllagerEntity { private static final int SUMMON_VEX_PARTICLE_COLOR = (179 << 16) | (179 << 8) | 204; private static final int ATTACK_PARTICLE_COLOR = (102 << 16) | (77 << 8) | 89; private static final int WOLOLO_PARTICLE_COLOR = (179 << 16) | (128 << 8) | 51; - public SpellcasterIllagerEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public SpellcasterIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // OptionalPack usage - metadata.getFlags().setFlag(EntityFlag.BRIBED, this.entityType == EntityType.ILLUSIONER); + dirtyMetadata.getFlags().setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - if (entityMetadata.getId() == 17) { - int spellType = (int) (byte) entityMetadata.getValue(); - // Summon vex, attack, or wololo - metadata.getFlags().setFlag(EntityFlag.CASTING, spellType == 1 || spellType == 2 || spellType == 3); - int rgbData = switch (spellType) { - // Set the spell color based on Java values - case 1 -> SUMMON_VEX_PARTICLE_COLOR; - case 2 -> ATTACK_PARTICLE_COLOR; - case 3 -> WOLOLO_PARTICLE_COLOR; - default -> 0; - }; - metadata.put(EntityData.EVOKER_SPELL_COLOR, rgbData); - } - super.updateBedrockMetadata(entityMetadata, session); + public void setSpellType(EntityMetadata entityMetadata) { + int spellType = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + // Summon vex, attack, or wololo + setFlag(EntityFlag.CASTING, spellType == 1 || spellType == 2 || spellType == 3); + int rgbData = switch (spellType) { + // Set the spell color based on Java values + case 1 -> SUMMON_VEX_PARTICLE_COLOR; + case 2 -> ATTACK_PARTICLE_COLOR; + case 3 -> WOLOLO_PARTICLE_COLOR; + default -> 0; + }; + dirtyMetadata.put(EntityData.EVOKER_SPELL_COLOR, rgbData); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java index 4a9360393..74616806c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java @@ -26,24 +26,25 @@ package org.geysermc.connector.entity.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; +import java.util.UUID; + public class VindicatorEntity extends AbstractIllagerEntity { - public VindicatorEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, entityType, position, motion, rotation); + public VindicatorEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { + public void setMobFlags(EntityMetadata entityMetadata) { + super.setMobFlags(entityMetadata); // Allow the axe to be shown if necessary - if (entityMetadata.getId() == 15) { - byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.ANGRY, (xd & 4) == 4); - } - super.updateBedrockMetadata(entityMetadata, session); + byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + setFlag(EntityFlag.ANGRY, (xd & 4) == 4); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 5b948ef37..cfa78e08a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -28,6 +28,8 @@ package org.geysermc.connector.entity.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -45,9 +47,9 @@ import lombok.Setter; import net.kyori.adventure.text.Component; import org.geysermc.connector.common.ChatColor; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.scoreboard.Objective; @@ -57,13 +59,11 @@ import org.geysermc.connector.scoreboard.UpdateType; import javax.annotation.Nullable; import java.util.Collections; -import java.util.UUID; import java.util.concurrent.TimeUnit; @Getter @Setter public class PlayerEntity extends LivingEntity { private GameProfile profile; - private UUID uuid; private String username; private boolean playerList = true; // Player is in the player list @@ -76,34 +76,37 @@ public class PlayerEntity extends LivingEntity { */ private ParrotEntity rightParrot; - public PlayerEntity(GameProfile gameProfile, long entityId, long geyserId, Vector3f position, Vector3f motion, Vector3f rotation) { - super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation); + public PlayerEntity(GeyserSession session, long entityId, long geyserId, GameProfile gameProfile, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + super(session, entityId, geyserId, gameProfile.getId(), EntityDefinitions.PLAYER, position, motion, yaw, pitch, headYaw); profile = gameProfile; - uuid = gameProfile.getId(); username = gameProfile.getName(); - - // For the OptionalPack, set all bits as invisible by default as this matches Java Edition behavior - metadata.put(EntityData.MARK_VARIANT, 0xff); } @Override - public void spawnEntity(GeyserSession session) { + protected void initializeMetadata() { + super.initializeMetadata(); + // For the OptionalPack, set all bits as invisible by default as this matches Java Edition behavior + dirtyMetadata.put(EntityData.MARK_VARIANT, 0xff); + } + + @Override + public void spawnEntity() { // Check to see if the player should have a belowname counterpart added Objective objective = session.getWorldCache().getScoreboard().getObjectiveSlots().get(ScoreboardPosition.BELOW_NAME); if (objective != null) { - setBelowNameText(session, objective); + setBelowNameText(objective); } // The name can't be updated later (the entity metadata for it is ignored), so we need to check for this now - updateDisplayName(session, null, false); + updateDisplayName(null, false); AddPlayerPacket addPlayerPacket = new AddPlayerPacket(); addPlayerPacket.setUuid(uuid); addPlayerPacket.setUsername(username); addPlayerPacket.setRuntimeEntityId(geyserId); addPlayerPacket.setUniqueEntityId(geyserId); - addPlayerPacket.setPosition(position.sub(0, EntityType.PLAYER.getOffset(), 0)); + addPlayerPacket.setPosition(position.sub(0, definition.offset(), 0)); addPlayerPacket.setRotation(getBedrockRotation()); addPlayerPacket.setMotion(motion); addPlayerPacket.setHand(hand); @@ -111,7 +114,11 @@ public class PlayerEntity extends LivingEntity { addPlayerPacket.getAdventureSettings().setPlayerPermission(PlayerPermission.MEMBER); addPlayerPacket.setDeviceId(""); addPlayerPacket.setPlatformChatId(""); - addPlayerPacket.getMetadata().putAll(metadata); + addPlayerPacket.getMetadata().putAll(dirtyMetadata); + addPlayerPacket.getMetadata().putFlags(flags); + + dirtyMetadata.clear(); + setFlagsDirty(false); long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId); if (linkedEntityId != -1) { @@ -125,21 +132,23 @@ public class PlayerEntity extends LivingEntity { session.sendUpstreamPacket(addPlayerPacket); } - public void sendPlayer(GeyserSession session) { + public void sendPlayer() { if (session.getEntityCache().getPlayerEntity(uuid) == null) return; if (session.getEntityCache().getEntityByGeyserId(geyserId) == null) { session.getEntityCache().spawnEntity(this); } else { - spawnEntity(session); + spawnEntity(); } } @Override - public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { + public void moveAbsolute(Vector3f position, float yaw, float pitch, float headYaw, boolean isOnGround, boolean teleported) { setPosition(position); - setRotation(rotation); + setYaw(yaw); + setPitch(pitch); + setHeadYaw(headYaw); setOnGround(isOnGround); @@ -156,16 +165,18 @@ public class PlayerEntity extends LivingEntity { session.sendUpstreamPacket(movePlayerPacket); if (leftParrot != null) { - leftParrot.moveAbsolute(session, position, rotation, true, teleported); + leftParrot.moveAbsolute(position, yaw, pitch, headYaw, true, teleported); } if (rightParrot != null) { - rightParrot.moveAbsolute(session, position, rotation, true, teleported); + rightParrot.moveAbsolute(position, yaw, pitch, headYaw, true, teleported); } } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - setRotation(rotation); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + setYaw(yaw); + setPitch(pitch); + setHeadYaw(headYaw); this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ); setOnGround(isOnGround); @@ -178,27 +189,27 @@ public class PlayerEntity extends LivingEntity { movePlayerPacket.setMode(MovePlayerPacket.Mode.NORMAL); // If the player is moved while sleeping, we have to adjust their y, so it appears // correctly on Bedrock. This fixes GSit's lay. - if (metadata.getFlags().getFlag(EntityFlag.SLEEPING)) { - Vector3i bedPosition = metadata.getPos(EntityData.BED_POSITION); + if (dirtyMetadata.getFlags().getFlag(EntityFlag.SLEEPING)) { + Vector3i bedPosition = dirtyMetadata.getPos(EntityData.BED_POSITION); if (bedPosition != null && (bedPosition.getY() == 0 || bedPosition.distanceSquared(position.toInt()) > 4)) { // Force the player movement by using a teleport - movePlayerPacket.setPosition(Vector3f.from(position.getX(), position.getY() - entityType.getOffset() + 0.2f, position.getZ())); + movePlayerPacket.setPosition(Vector3f.from(position.getX(), position.getY() - definition.offset() + 0.2f, position.getZ())); movePlayerPacket.setMode(MovePlayerPacket.Mode.TELEPORT); movePlayerPacket.setTeleportationCause(MovePlayerPacket.TeleportationCause.UNKNOWN); } } session.sendUpstreamPacket(movePlayerPacket); if (leftParrot != null) { - leftParrot.moveRelative(session, relX, relY, relZ, rotation, true); + leftParrot.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, true); } if (rightParrot != null) { - rightParrot.moveRelative(session, relX, relY, relZ, rotation, true); + rightParrot.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, true); } } @Override - public void updateHeadLookRotation(GeyserSession session, float headYaw) { - moveRelative(session, 0, 0, 0, Vector3f.from(rotation.getX(), rotation.getY(), headYaw), onGround); + public void updateHeadLookRotation(float headYaw) { + moveRelative(0, 0, 0, yaw, pitch, headYaw, onGround); MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); movePlayerPacket.setRuntimeEntityId(geyserId); movePlayerPacket.setPosition(position); @@ -208,19 +219,19 @@ public class PlayerEntity extends LivingEntity { } @Override - public void updatePositionAndRotation(GeyserSession session, double moveX, double moveY, double moveZ, float yaw, float pitch, boolean isOnGround) { - moveRelative(session, moveX, moveY, moveZ, yaw, pitch, isOnGround); + public void updatePositionAndRotation(double moveX, double moveY, double moveZ, float yaw, float pitch, boolean isOnGround) { + moveRelative(moveX, moveY, moveZ, yaw, pitch, isOnGround); if (leftParrot != null) { - leftParrot.moveRelative(session, moveX, moveY, moveZ, yaw, pitch, isOnGround); + leftParrot.moveRelative(moveX, moveY, moveZ, yaw, pitch, isOnGround); } if (rightParrot != null) { - rightParrot.moveRelative(session, moveX, moveY, moveZ, yaw, pitch, isOnGround); + rightParrot.moveRelative(moveX, moveY, moveZ, yaw, pitch, isOnGround); } } @Override - public void updateRotation(GeyserSession session, float yaw, float pitch, boolean isOnGround) { - super.updateRotation(session, yaw, pitch, isOnGround); + public void updateRotation(float yaw, float pitch, boolean isOnGround) { + super.updateRotation(yaw, pitch, isOnGround); // Both packets need to be sent or else player head rotation isn't correctly updated MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); movePlayerPacket.setRuntimeEntityId(geyserId); @@ -230,86 +241,90 @@ public class PlayerEntity extends LivingEntity { movePlayerPacket.setMode(MovePlayerPacket.Mode.HEAD_ROTATION); session.sendUpstreamPacket(movePlayerPacket); if (leftParrot != null) { - leftParrot.updateRotation(session, yaw, pitch, isOnGround); + leftParrot.updateRotation(yaw, pitch, isOnGround); } if (rightParrot != null) { - rightParrot.updateRotation(session, yaw, pitch, isOnGround); + rightParrot.updateRotation(yaw, pitch, isOnGround); } } @Override public void setPosition(Vector3f position) { - super.setPosition(position.add(0, entityType.getOffset(), 0)); + super.setPosition(position.add(0, definition.offset(), 0)); } - @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - + public void setAbsorptionHearts(EntityMetadata entityMetadata) { // Extra hearts - is not metadata but an attribute on Bedrock - if (entityMetadata.getId() == 15) { - UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); - attributesPacket.setRuntimeEntityId(geyserId); - // Setting to a higher maximum since plugins/datapacks can probably extend the Bedrock soft limit - attributesPacket.setAttributes(Collections.singletonList( - new AttributeData("minecraft:absorption", 0.0f, 1024f, (float) entityMetadata.getValue(), 0.0f))); - session.sendUpstreamPacket(attributesPacket); - } + UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); + attributesPacket.setRuntimeEntityId(geyserId); + // Setting to a higher maximum since plugins/datapacks can probably extend the Bedrock soft limit + attributesPacket.setAttributes(Collections.singletonList( + new AttributeData("minecraft:absorption", 0.0f, 1024f, ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 0.0f))); + session.sendUpstreamPacket(attributesPacket); + } - if (entityMetadata.getId() == 17) { - // OptionalPack usage for toggling skin bits - // In Java Edition, a bit being set means that part should be enabled - // However, to ensure that the pack still works on other servers, we invert the bit so all values by default - // are true (0). - metadata.put(EntityData.MARK_VARIANT, ~((byte) entityMetadata.getValue()) & 0xff); - } + public void setSkinVisibility(EntityMetadata entityMetadata) { + // OptionalPack usage for toggling skin bits + // In Java Edition, a bit being set means that part should be enabled + // However, to ensure that the pack still works on other servers, we invert the bit so all values by default + // are true (0). + dirtyMetadata.put(EntityData.MARK_VARIANT, ~((ByteEntityMetadata) entityMetadata).getPrimitiveValue() & 0xff); + } - // Parrot occupying shoulder - if (entityMetadata.getId() == 19 || entityMetadata.getId() == 20) { - CompoundTag tag = (CompoundTag) entityMetadata.getValue(); - boolean isLeft = entityMetadata.getId() == 19; - if (tag != null && !tag.isEmpty()) { - if ((isLeft && leftParrot != null) || (!isLeft && rightParrot != null)) { - // No need to update a parrot's data when it already exists - return; - } - // The parrot is a separate entity in Bedrock, but part of the player entity in Java - ParrotEntity parrot = new ParrotEntity(0, session.getEntityCache().getNextEntityId().incrementAndGet(), - EntityType.PARROT, position, motion, rotation); - parrot.spawnEntity(session); - parrot.getMetadata().put(EntityData.VARIANT, tag.get("Variant").getValue()); - // Different position whether the parrot is left or right - float offset = isLeft ? 0.4f : -0.4f; - parrot.getMetadata().put(EntityData.RIDER_SEAT_POSITION, Vector3f.from(offset, -0.22, -0.1)); - parrot.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, 1); - parrot.updateBedrockMetadata(session); - SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); - EntityLinkData.Type type = isLeft ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER; - linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false, false)); - // Delay, or else spawned-in players won't get the link - // TODO: Find a better solution. This problem also exists with item frames - session.scheduleInEventLoop(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS); - if (isLeft) { - leftParrot = parrot; - } else { - rightParrot = parrot; - } + public void setLeftParrot(EntityMetadata entityMetadata) { + setParrot(entityMetadata.getValue(), true); + } + + public void setRightParrot(EntityMetadata entityMetadata) { + setParrot(entityMetadata.getValue(), false); + } + + /** + * Sets the parrot occupying the shoulder. Bedrock Edition requires a full entity whereas Java Edition just + * spawns it from the NBT data provided + */ + private void setParrot(CompoundTag tag, boolean isLeft) { + if (tag != null && !tag.isEmpty()) { + if ((isLeft && leftParrot != null) || (!isLeft && rightParrot != null)) { + // No need to update a parrot's data when it already exists + return; + } + // The parrot is a separate entity in Bedrock, but part of the player entity in Java //TODO is a UUID provided in NBT? + ParrotEntity parrot = new ParrotEntity(session, 0, session.getEntityCache().getNextEntityId().incrementAndGet(), + null, EntityDefinitions.PARROT, position, motion, yaw, pitch, headYaw); + parrot.spawnEntity(); + parrot.getDirtyMetadata().put(EntityData.VARIANT, tag.get("Variant").getValue()); + // Different position whether the parrot is left or right + float offset = isLeft ? 0.4f : -0.4f; + parrot.getDirtyMetadata().put(EntityData.RIDER_SEAT_POSITION, Vector3f.from(offset, -0.22, -0.1)); + parrot.getDirtyMetadata().put(EntityData.RIDER_ROTATION_LOCKED, 1); + parrot.updateBedrockMetadata(); + SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); + EntityLinkData.Type type = isLeft ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER; + linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false, false)); + // Delay, or else spawned-in players won't get the link + // TODO: Find a better solution. + session.scheduleInEventLoop(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS); + if (isLeft) { + leftParrot = parrot; } else { - Entity parrot = isLeft ? leftParrot : rightParrot; - if (parrot != null) { - parrot.despawnEntity(session); - if (isLeft) { - leftParrot = null; - } else { - rightParrot = null; - } + rightParrot = parrot; + } + } else { + Entity parrot = isLeft ? leftParrot : rightParrot; + if (parrot != null) { + parrot.despawnEntity(); + if (isLeft) { + leftParrot = null; + } else { + rightParrot = null; } } } } @Override - protected void setDisplayName(GeyserSession session, Component name) { + public void setDisplayName(EntityMetadata entityMetadata) { // Doesn't do anything for players } @@ -317,7 +332,7 @@ public class PlayerEntity extends LivingEntity { /** * @param useGivenTeam even if there is no team, update the username in the entity metadata anyway, and don't look for a team */ - public void updateDisplayName(GeyserSession session, @Nullable Team team, boolean useGivenTeam) { + public void updateDisplayName(@Nullable Team team, boolean useGivenTeam) { if (team == null && !useGivenTeam) { // Only search for the team if we are not supposed to use the given team // If the given team is null, this is intentional that we are being removed from the team @@ -343,12 +358,12 @@ public class PlayerEntity extends LivingEntity { // The name is not visible to the session player; clear name newDisplayName = ""; } - needsUpdate = useGivenTeam && !newDisplayName.equals(metadata.getString(EntityData.NAMETAG, null)); - metadata.put(EntityData.NAMETAG, newDisplayName); + needsUpdate = useGivenTeam && !newDisplayName.equals(dirtyMetadata.getString(EntityData.NAMETAG, null)); + dirtyMetadata.put(EntityData.NAMETAG, newDisplayName); } else if (useGivenTeam) { // The name has reset, if it was previously something else - needsUpdate = !newDisplayName.equals(metadata.getString(EntityData.NAMETAG)); - metadata.put(EntityData.NAMETAG, this.username); + needsUpdate = !newDisplayName.equals(dirtyMetadata.getString(EntityData.NAMETAG)); + dirtyMetadata.put(EntityData.NAMETAG, this.username); } else { needsUpdate = false; } @@ -363,7 +378,7 @@ public class PlayerEntity extends LivingEntity { } @Override - protected void setDisplayNameVisible(EntityMetadata entityMetadata) { + public void setDisplayNameVisible(EntityMetadata entityMetadata) { // Doesn't do anything for players } @@ -378,11 +393,13 @@ public class PlayerEntity extends LivingEntity { return; } } - metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); + if (height != boundingBoxHeight || definition.width() != boundingBoxWidth) { + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, definition.width()); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); + } } - public void setBelowNameText(GeyserSession session, Objective objective) { + public void setBelowNameText(Objective objective) { if (objective != null && objective.getUpdateType() != UpdateType.REMOVE) { int amount; Score score = objective.getScores().get(username); @@ -393,7 +410,7 @@ public class PlayerEntity extends LivingEntity { } String displayString = amount + " " + objective.getDisplayName(); - metadata.put(EntityData.SCORE_TAG, displayString); + dirtyMetadata.put(EntityData.SCORE_TAG, displayString); if (valid) { // Already spawned - we still need to run the rest of this code because the spawn packet will be // providing the information @@ -405,7 +422,7 @@ public class PlayerEntity extends LivingEntity { } else { // Always remove the score tag first, then check for valid. // That way the score tag is removed if the player was spawned, then despawned, and is being respawned - if (metadata.remove(EntityData.SCORE_TAG) != null && valid) { + if (dirtyMetadata.remove(EntityData.SCORE_TAG) != null && valid) { SetEntityDataPacket packet = new SetEntityDataPacket(); packet.setRuntimeEntityId(geyserId); packet.getMetadata().put(EntityData.SCORE_TAG, ""); diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java index 373ff6f43..d8a3e5492 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java @@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -62,21 +63,21 @@ public class SessionPlayerEntity extends PlayerEntity { private final GeyserSession session; public SessionPlayerEntity(GeyserSession session) { - super(new GameProfile(UUID.randomUUID(), "unknown"), 1, 1, Vector3f.ZERO, Vector3f.ZERO, Vector3f.ZERO); + super(session, 1, 1, new GameProfile(UUID.randomUUID(), "unknown"), Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); valid = true; this.session = session; } @Override - public void spawnEntity(GeyserSession session) { + public void spawnEntity() { // Already logged in } @Override - public void moveRelative(GeyserSession session, double relX, double relY, double relZ, Vector3f rotation, boolean isOnGround) { - super.moveRelative(session, relX, relY, relZ, rotation, isOnGround); - session.getCollisionManager().updatePlayerBoundingBox(this.position.down(entityType.getOffset())); + public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) { + super.moveRelative(relX, relY, relZ, yaw, pitch, headYaw, isOnGround); + session.getCollisionManager().updatePlayerBoundingBox(this.position.down(definition.offset())); } @Override @@ -99,24 +100,25 @@ public class SessionPlayerEntity extends PlayerEntity { } @Override - public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - super.updateBedrockMetadata(entityMetadata, session); - if (entityMetadata.getId() == 0) { - session.setSwimmingInWater((((byte) entityMetadata.getValue()) & 0x10) == 0x10 && metadata.getFlags().getFlag(EntityFlag.SPRINTING)); - refreshSpeed = true; - } else if (entityMetadata.getId() == 6) { - session.setPose((Pose) entityMetadata.getValue()); - refreshSpeed = true; - } + public void setFlags(EntityMetadata entityMetadata) { + super.setFlags(entityMetadata); + session.setSwimmingInWater((((ByteEntityMetadata) entityMetadata).getPrimitiveValue() & 0x10) == 0x10 && getFlag(EntityFlag.SPRINTING)); + refreshSpeed = true; + } + + @Override + public void setPose(EntityMetadata entityMetadata) { + super.setPose(entityMetadata); + session.setPose(entityMetadata.getValue()); + refreshSpeed = true; } public float getMaxHealth() { return maxHealth; } - @Override public void setHealth(float health) { - super.setHealth(health); + this.health = health; } @Override @@ -138,8 +140,8 @@ public class SessionPlayerEntity extends PlayerEntity { } @Override - public void updateBedrockMetadata(GeyserSession session) { - super.updateBedrockMetadata(session); + public void updateBedrockMetadata() { + super.updateBedrockMetadata(); if (refreshSpeed) { AttributeData speedAttribute = session.adjustSpeed(); if (speedAttribute != null) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java index 61b5af38e..c2c41d0dc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java @@ -34,7 +34,6 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; import lombok.Getter; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; /** @@ -49,31 +48,34 @@ public class SkullPlayerEntity extends PlayerEntity { @Getter private final int blockState; - public SkullPlayerEntity(GameProfile gameProfile, long geyserId, Vector3f position, Vector3f rotation, int blockState) { - super(gameProfile, 0, geyserId, position, Vector3f.ZERO, rotation); + public SkullPlayerEntity(GeyserSession session, long geyserId, GameProfile gameProfile, Vector3f position, float rotation, int blockState) { + super(session, 0, geyserId, gameProfile, position, Vector3f.ZERO, rotation, 0, rotation); this.blockState = blockState; setPlayerList(false); + } - //Set bounding box to almost nothing so the skull is able to be broken and not cause entity to cast a shadow - metadata.clear(); - metadata.put(EntityData.SCALE, 1.08f); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.001f); - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.001f); - metadata.getOrCreateFlags().setFlag(EntityFlag.CAN_SHOW_NAME, false); - metadata.getFlags().setFlag(EntityFlag.INVISIBLE, true); // Until the skin is loaded + @Override + protected void initializeMetadata() { + // Deliberately do not call super + // Set bounding box to almost nothing so the skull is able to be broken and not cause entity to cast a shadow + dirtyMetadata.put(EntityData.SCALE, 1.08f); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.001f); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.001f); + setFlag(EntityFlag.CAN_SHOW_NAME, false); + setFlag(EntityFlag.INVISIBLE, true); // Until the skin is loaded } /** * Overwritten so each entity doesn't check for a linked entity */ @Override - public void spawnEntity(GeyserSession session) { + public void spawnEntity() { AddPlayerPacket addPlayerPacket = new AddPlayerPacket(); addPlayerPacket.setUuid(getUuid()); addPlayerPacket.setUsername(getUsername()); addPlayerPacket.setRuntimeEntityId(geyserId); addPlayerPacket.setUniqueEntityId(geyserId); - addPlayerPacket.setPosition(position.sub(0, EntityType.PLAYER.getOffset(), 0)); + addPlayerPacket.setPosition(position.sub(0, definition.offset(), 0)); addPlayerPacket.setRotation(getBedrockRotation()); addPlayerPacket.setMotion(motion); addPlayerPacket.setHand(hand); @@ -81,14 +83,18 @@ public class SkullPlayerEntity extends PlayerEntity { addPlayerPacket.getAdventureSettings().setPlayerPermission(PlayerPermission.MEMBER); addPlayerPacket.setDeviceId(""); addPlayerPacket.setPlatformChatId(""); - addPlayerPacket.getMetadata().putAll(metadata); + addPlayerPacket.getMetadata().putAll(dirtyMetadata); + addPlayerPacket.getMetadata().putFlags(flags); + + dirtyMetadata.clear(); + setFlagsDirty(false); valid = true; session.sendUpstreamPacket(addPlayerPacket); } - public void despawnEntity(GeyserSession session, Vector3i position) { - this.despawnEntity(session); + public void despawnEntity(Vector3i position) { + this.despawnEntity(); session.getSkullCache().remove(position, this); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index 85f6fde5b..517864e14 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -26,222 +26,8 @@ package org.geysermc.connector.entity.type; import lombok.Getter; -import org.geysermc.connector.entity.*; -import org.geysermc.connector.entity.living.*; -import org.geysermc.connector.entity.living.animal.*; -import org.geysermc.connector.entity.living.animal.horse.*; -import org.geysermc.connector.entity.living.animal.tameable.CatEntity; -import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; -import org.geysermc.connector.entity.living.animal.tameable.WolfEntity; -import org.geysermc.connector.entity.living.merchant.AbstractMerchantEntity; -import org.geysermc.connector.entity.living.merchant.VillagerEntity; -import org.geysermc.connector.entity.living.monster.*; -import org.geysermc.connector.entity.living.monster.raid.*; -import org.geysermc.connector.entity.player.PlayerEntity; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; @Getter public enum EntityType { - CHICKEN(ChickenEntity.class, 10, 0.7f, 0.4f), - COW(AnimalEntity.class, 11, 1.4f, 0.9f), - PIG(PigEntity.class, 12, 0.9f), - SHEEP(SheepEntity.class, 13, 1.3f, 0.9f), - WOLF(WolfEntity.class, 14, 0.85f, 0.6f), - VILLAGER(VillagerEntity.class, 15, 1.8f, 0.6f, 0.6f, 1.62f, "minecraft:villager_v2"), - MOOSHROOM(MooshroomEntity.class, 16, 1.4f, 0.9f), - SQUID(SquidEntity.class, 17, 0.8f), - RABBIT(RabbitEntity.class, 18, 0.5f, 0.4f), - BAT(BatEntity.class, 19, 0.9f, 0.5f), - IRON_GOLEM(IronGolemEntity.class, 20, 2.7f, 1.4f), - SNOW_GOLEM(SnowGolemEntity.class, 21, 1.9f, 0.7f), - OCELOT(OcelotEntity.class, 22, 0.35f, 0.3f), - HORSE(HorseEntity.class, 23, 1.6f, 1.3965f), - DONKEY(ChestedHorseEntity.class, 24, 1.6f, 1.3965f), - MULE(ChestedHorseEntity.class, 25, 1.6f, 1.3965f), - SKELETON_HORSE(AbstractHorseEntity.class, 26, 1.6f, 1.3965f), - ZOMBIE_HORSE(AbstractHorseEntity.class, 27, 1.6f, 1.3965f), - POLAR_BEAR(PolarBearEntity.class, 28, 1.4f, 1.3f), - LLAMA(LlamaEntity.class, 29, 1.87f, 0.9f), - TRADER_LLAMA(TraderLlamaEntity.class, 29, 1.187f, 0.9f, 0f, 0f, "minecraft:llama"), - PARROT(ParrotEntity.class, 30, 0.9f, 0.5f), - DOLPHIN(WaterEntity.class, 31, 0.6f, 0.9f), - ZOMBIE(ZombieEntity.class, 32, 1.8f, 0.6f, 0.6f, 1.62f), - GIANT(GiantEntity.class, 32, 1.8f, 0.6f, 0.6f, 1.62f, "minecraft:zombie"), - CREEPER(CreeperEntity.class, 33, 1.7f, 0.6f, 0.6f, 1.62f), - SKELETON(SkeletonEntity.class, 34, 1.8f, 0.6f, 0.6f, 1.62f), - SPIDER(SpiderEntity.class, 35, 0.9f, 1.4f, 1.4f, 1f), - ZOMBIFIED_PIGLIN(ZombifiedPiglinEntity.class, 36, 1.95f, 0.6f, 0.6f, 1.62f, "minecraft:zombie_pigman"), - SLIME(SlimeEntity.class, 37, 0.51f), - ENDERMAN(EndermanEntity.class, 38, 2.9f, 0.6f), - SILVERFISH(MonsterEntity.class, 39, 0.3f, 0.4f), - CAVE_SPIDER(MonsterEntity.class, 40, 0.5f, 0.7f), - GHAST(GhastEntity.class, 41, 4.0f), - MAGMA_CUBE(MagmaCubeEntity.class, 42, 0.51f), - BLAZE(BlazeEntity.class, 43, 1.8f, 0.6f), - ZOMBIE_VILLAGER(ZombieVillagerEntity.class, 44, 1.8f, 0.6f, 0.6f, 1.62f, "minecraft:zombie_villager_v2"), - WITCH(RaidParticipantEntity.class, 45, 1.8f, 0.6f, 0.6f, 1.62f), - STRAY(AbstractSkeletonEntity.class, 46, 1.8f, 0.6f, 0.6f, 1.62f), - HUSK(ZombieEntity.class, 47, 1.8f, 0.6f, 0.6f, 1.62f), - WITHER_SKELETON(AbstractSkeletonEntity.class, 48, 2.4f, 0.7f), - GUARDIAN(GuardianEntity.class, 49, 0.85f), - ELDER_GUARDIAN(ElderGuardianEntity.class, 50, 1.9975f), - NPC(PlayerEntity.class, 51, 1.8f, 0.6f, 0.6f, 1.62f), - WITHER(WitherEntity.class, 52, 3.5f, 0.9f), - ENDER_DRAGON(EnderDragonEntity.class, 53, 0f, 0f), - SHULKER(ShulkerEntity.class, 54, 1f, 1f), - ENDERMITE(MonsterEntity.class, 55, 0.3f, 0.4f), - AGENT(Entity.class, 56, 0f), - VINDICATOR(VindicatorEntity.class, 57, 1.8f, 0.6f, 0.6f, 1.62f), - PILLAGER(PillagerEntity.class, 114, 1.8f, 0.6f, 0.6f, 1.62f), - WANDERING_TRADER(AbstractMerchantEntity.class, 118, 1.8f, 0.6f, 0.6f, 1.62f), - PHANTOM(PhantomEntity.class, 58, 0.5f, 0.9f, 0.9f, 0.6f), - RAVAGER(RaidParticipantEntity.class, 59, 1.9f, 1.2f), - - ARMOR_STAND(ArmorStandEntity.class, 61, 1.975f, 0.5f), - TRIPOD_CAMERA(Entity.class, 62, 0f), - PLAYER(PlayerEntity.class, 63, 1.8f, 0.6f, 0.6f, 1.62f), - ITEM(ItemEntity.class, 64, 0.25f, 0.25f, 0.25f, 0.125f), - PRIMED_TNT(TNTEntity.class, 65, 0.98f, 0.98f, 0.98f, 0f, "minecraft:tnt"), - FALLING_BLOCK(FallingBlockEntity.class, 66, 0.98f, 0.98f), - MOVING_BLOCK(Entity.class, 67, 0f), - THROWN_EXP_BOTTLE(ThrowableItemEntity.class, 68, 0.25f, 0.25f, 0f, 0f, "minecraft:xp_bottle"), - EXPERIENCE_ORB(ExpOrbEntity.class, 69, 0f, 0f, 0f, 0f, "minecraft:xp_orb"), - EYE_OF_ENDER(Entity.class, 70, 0.25f, 0.25f, 0f, 0f, "minecraft:eye_of_ender_signal"), - END_CRYSTAL(EnderCrystalEntity.class, 71, 2.0f, 2.0f, 2.0f, 0f, "minecraft:ender_crystal"), - FIREWORK_ROCKET(FireworkEntity.class, 72, 0.25f, 0.25f, 0.25f, 0f, "minecraft:fireworks_rocket"), - TRIDENT(TridentEntity.class, 73, 0f, 0f, 0f, 0f, "minecraft:thrown_trident"), - TURTLE(TurtleEntity.class, 74, 0.4f, 1.2f), - CAT(CatEntity.class, 75, 0.35f, 0.3f), - SHULKER_BULLET(ThrowableEntity.class, 76, 0.3125f), - FISHING_BOBBER(FishingHookEntity.class, 77, 0f, 0f, 0f, 0f, "minecraft:fishing_hook"), - CHALKBOARD(Entity.class, 78, 0f), - DRAGON_FIREBALL(ItemedFireballEntity.class, 79, 1.0f), - ARROW(TippedArrowEntity.class, 80, 0.25f, 0.25f), - SPECTRAL_ARROW(AbstractArrowEntity.class, 80, 0.25f, 0.25f, 0.25f, 0f, "minecraft:arrow"), - SNOWBALL(ThrowableItemEntity.class, 81, 0.25f), - THROWN_EGG(ThrowableItemEntity.class, 82, 0.25f, 0.25f, 0.25f, 0f, "minecraft:egg"), - PAINTING(PaintingEntity.class, 83, 0f), - MINECART(MinecartEntity.class, 84, 0.7f, 0.98f, 0.98f, 0.35f), - FIREBALL(ItemedFireballEntity.class, 85, 1.0f), - THROWN_POTION(ThrownPotionEntity.class, 86, 0.25f, 0.25f, 0.25f, 0f, "minecraft:splash_potion"), - THROWN_ENDERPEARL(ThrowableItemEntity.class, 87, 0.25f, 0.25f, 0.25f, 0f, "minecraft:ender_pearl"), - LEASH_KNOT(LeashKnotEntity.class, 88, 0.5f, 0.375f), - WITHER_SKULL(WitherSkullEntity.class, 89, 0.3125f), - BOAT(BoatEntity.class, 90, 0.6f, 1.6f, 1.6f, 0.35f), - WITHER_SKULL_DANGEROUS(WitherSkullEntity.class, 91, 0f), - LIGHTNING_BOLT(LightningEntity.class, 93, 0f), - SMALL_FIREBALL(ItemedFireballEntity.class, 94, 0.3125f), - AREA_EFFECT_CLOUD(AreaEffectCloudEntity.class, 95, 0.5f, 1.0f), - MINECART_HOPPER(MinecartEntity.class, 96, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:hopper_minecart"), - MINECART_TNT(MinecartEntity.class, 97, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:tnt_minecart"), - MINECART_CHEST(MinecartEntity.class, 98, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:chest_minecart"), - MINECART_FURNACE(FurnaceMinecartEntity.class, 98, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:minecart"), - MINECART_SPAWNER(SpawnerMinecartEntity.class, 98, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:minecart"), - MINECART_COMMAND_BLOCK(CommandBlockMinecartEntity.class, 100, 0.7f, 0.98f, 0.98f, 0.35f, "minecraft:command_block_minecart"), - LINGERING_POTION(ThrowableEntity.class, 101, 0f), - LLAMA_SPIT(ThrowableEntity.class, 102, 0.25f), - EVOKER_FANGS(Entity.class, 103, 0.8f, 0.5f, 0.5f, 0f, "minecraft:evocation_fang"), - EVOKER(SpellcasterIllagerEntity.class, 104, 1.95f, 0.6f, 0.6f, 0f, "minecraft:evocation_illager"), - VEX(VexEntity.class, 105, 0.8f, 0.4f), - ICE_BOMB(Entity.class, 106, 0f), - BALLOON(Entity.class, 107, 0f), - PUFFERFISH(PufferFishEntity.class, 108, 0.7f, 0.7f), - SALMON(AbstractFishEntity.class, 109, 0.5f, 0.7f), - DROWNED(ZombieEntity.class, 110, 1.95f, 0.6f), - TROPICAL_FISH(TropicalFishEntity.class, 111, 0.6f, 0.6f, 0f, 0f, "minecraft:tropicalfish"), - COD(AbstractFishEntity.class, 112, 0.25f, 0.5f), - PANDA(PandaEntity.class, 113, 1.25f, 1.125f, 1.825f), - FOX(FoxEntity.class, 121, 0.5f, 1.25f), - BEE(BeeEntity.class, 122, 0.6f, 0.6f), - STRIDER(StriderEntity.class, 125, 1.7f, 0.9f, 0f, 0f, "minecraft:strider"), - HOGLIN(HoglinEntity.class, 124, 1.4f, 1.3965f, 1.3965f, 0f, "minecraft:hoglin"), - ZOGLIN(ZoglinEntity.class, 126, 1.4f, 1.3965f, 1.3965f, 0f, "minecraft:zoglin"), - PIGLIN(PiglinEntity.class, 123, 1.95f, 0.6f, 0.6f, 0f, "minecraft:piglin"), - PIGLIN_BRUTE(BasePiglinEntity.class, 127, 1.95f, 0.6f, 0.6f, 0f, "minecraft:piglin_brute"), - AXOLOTL(AxolotlEntity.class, 0, 0.42f, 0.7f, 0.7f, 0f, "minecraft:axolotl"), - GLOW_SQUID(GlowSquidEntity.class, 0, 0.8f, 0.8f, 0.8f, 0f, "minecraft:glow_squid"), - GOAT(GoatEntity.class, 0, 1.3f, 0.9f, 0.9f, 0f, "minecraft:goat"), - MARKER(Entity.class, 0, 0, 0, 0, 0, "minecraft:marker"), // Only should be used for ALL_JAVA_IDENTIFIERS - - /** - * Item frames are handled differently since they are a block in Bedrock. - */ - ITEM_FRAME(ItemFrameEntity.class, 0, 0, 0), - GLOW_ITEM_FRAME(ItemFrameEntity.class, 0, 0, 0), - - /** - * Not an entity in Bedrock, so we replace it with an evoker - */ - ILLUSIONER(SpellcasterIllagerEntity.class, 104, 1.8f, 0.6f, 0.6f, 1.62f, "minecraft:evocation_illager"), - - /** - * Not an entity in Bedrock, but used for the Ender Dragon's multiple hitboxes - */ - ENDER_DRAGON_PART(EnderDragonPartEntity.class, 32, 0, 0, 0, 0, "minecraft:armor_stand"); - - /** - * A list of all Java identifiers for use with command suggestions - */ - public static final String[] ALL_JAVA_IDENTIFIERS; - private static final EntityType[] VALUES = values(); - - static { - List allJavaIdentifiers = new ArrayList<>(); - for (EntityType type : VALUES) { - if (type == AGENT || type == BALLOON || type == CHALKBOARD || type == NPC || type == TRIPOD_CAMERA || type == ENDER_DRAGON_PART) { - continue; - } - allJavaIdentifiers.add("minecraft:" + type.name().toLowerCase(Locale.ROOT)); - } - ALL_JAVA_IDENTIFIERS = allJavaIdentifiers.toArray(new String[0]); - } - - private final Class entityClass; - private final int type; - private final float height; - private final float width; - private final float length; - private final float offset; - private final String identifier; - - EntityType(Class entityClass, int type, float height) { - //noinspection SuspiciousNameCombination - this(entityClass, type, height, height); - } - - EntityType(Class entityClass, int type, float height, float width) { - this(entityClass, type, height, width, width); - } - - EntityType(Class entityClass, int type, float height, float width, float length) { - this(entityClass, type, height, width, length, 0f); - } - - EntityType(Class entityClass, int type, float height, float width, float length, float offset) { - this(entityClass, type, height, width, length, offset, null); - } - - EntityType(Class entityClass, int type, float height, float width, float length, float offset, String identifier) { - this.entityClass = entityClass; - this.type = type; - this.height = height; - this.width = width; - this.length = length; - this.offset = offset + 0.00001f; - this.identifier = identifier == null ? "minecraft:" + name().toLowerCase() : identifier; - } - - public static EntityType getFromIdentifier(String identifier) { - for (EntityType type : VALUES) { - if (type.identifier.equals(identifier)) { - return type; - } - } - - return null; - } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 33df29f9f..ef545746b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -532,7 +532,7 @@ public class GeyserSession implements CommandSender { upstream.sendPacket(biomeDefinitionListPacket); AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); - entityPacket.setIdentifiers(Registries.ENTITY_IDENTIFIERS.get()); + entityPacket.setIdentifiers(Registries.BEDROCK_ENTITY_IDENTIFIERS.get()); upstream.sendPacket(entityPacket); CreativeContentPacket creativePacket = new CreativeContentPacket(); @@ -999,7 +999,7 @@ public class GeyserSession implements CommandSender { for (Tickable entity : entityCache.getTickableEntities()) { - entity.tick(this); + entity.tick(); } } catch (Throwable throwable) { throwable.printStackTrace(); @@ -1030,7 +1030,7 @@ public class GeyserSession implements CommandSender { collisionManager.updateScaffoldingFlags(false); } - playerEntity.updateBedrockMetadata(this); + playerEntity.updateBedrockMetadata(); if (mouseoverEntity != null) { // Horses, etc can change their property depending on if you're sneaking @@ -1040,17 +1040,17 @@ public class GeyserSession implements CommandSender { private void setSneakingPose(boolean sneaking) { this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING; - playerEntity.getMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, sneaking ? 1.5f : playerEntity.getEntityType().getHeight()); - playerEntity.getMetadata().getFlags().setFlag(EntityFlag.SNEAKING, sneaking); + playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, sneaking ? 1.5f : playerEntity.getDefinition().height()); + playerEntity.setFlag(EntityFlag.SNEAKING, sneaking); collisionManager.updatePlayerBoundingBox(); } public void setSwimming(boolean swimming) { this.pose = swimming ? Pose.SWIMMING : Pose.STANDING; - playerEntity.getMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, swimming ? 0.6f : playerEntity.getEntityType().getHeight()); - playerEntity.getMetadata().getFlags().setFlag(EntityFlag.SWIMMING, swimming); - playerEntity.updateBedrockMetadata(this); + playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, swimming ? 0.6f : playerEntity.getDefinition().height()); + playerEntity.setFlag(EntityFlag.SWIMMING, swimming); + playerEntity.updateBedrockMetadata(); } public void setFlying(boolean flying) { @@ -1059,7 +1059,7 @@ public class GeyserSession implements CommandSender { if (sneaking) { // update bounding box as it is not reduced when flying setSneakingPose(!flying); - playerEntity.updateBedrockMetadata(this); + playerEntity.updateBedrockMetadata(); } } @@ -1072,7 +1072,7 @@ public class GeyserSession implements CommandSender { AttributeData currentPlayerSpeed = playerEntity.getAttributes().get(GeyserAttributeType.MOVEMENT_SPEED); if (currentPlayerSpeed != null) { if ((pose.equals(Pose.SNEAKING) && !sneaking && collisionManager.isUnderSlab()) || - (!swimmingInWater && playerEntity.getMetadata().getFlags().getFlag(EntityFlag.SWIMMING) && !collisionManager.isPlayerInWater())) { + (!swimmingInWater && playerEntity.getDirtyMetadata().getFlags().getFlag(EntityFlag.SWIMMING) && !collisionManager.isPlayerInWater())) { // Either of those conditions means that Bedrock goes zoom when they shouldn't be AttributeData speedAttribute = GeyserAttributeType.MOVEMENT_SPEED.getAttribute(originalSpeedAttribute / 3.32f); playerEntity.getAttributes().put(GeyserAttributeType.MOVEMENT_SPEED, speedAttribute); @@ -1282,7 +1282,7 @@ public class GeyserSession implements CommandSender { if (resendID != -1) { connector.getLogger().debug("Resending teleport " + resendID); TeleportCache teleport = teleportMap.get(resendID); - getPlayerEntity().moveAbsolute(this, Vector3f.from(teleport.getX(), teleport.getY(), teleport.getZ()), + getPlayerEntity().moveAbsolute(Vector3f.from(teleport.getX(), teleport.getY(), teleport.getZ()), teleport.getYaw(), teleport.getPitch(), playerEntity.isOnGround(), true); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java index 3ff547c95..10b7159aa 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java @@ -31,7 +31,6 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Getter; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Tickable; @@ -46,8 +45,6 @@ import java.util.concurrent.atomic.AtomicLong; * for that player (e.g. seeing vanished players from /vanish) */ public class EntityCache { - private final GeyserSession session; - @Getter private final Long2ObjectMap entities = new Long2ObjectOpenHashMap<>(); /** @@ -63,13 +60,12 @@ public class EntityCache { private final AtomicLong nextEntityId = new AtomicLong(2L); public EntityCache(GeyserSession session) { - this.session = session; cachedPlayerEntityLinks.defaultReturnValue(-1L); } public void spawnEntity(Entity entity) { if (cacheEntity(entity)) { - entity.spawnEntity(session); + entity.spawnEntity(); if (entity instanceof Tickable) { // Start ticking it @@ -89,7 +85,7 @@ public class EntityCache { } public boolean removeEntity(Entity entity, boolean force) { - if (entity != null && entity.isValid() && (force || entity.despawnEntity(session))) { + if (entity != null && entity.isValid() && (force || entity.despawnEntity())) { long geyserId = entityIdTranslations.remove(entity.getEntityId()); entities.remove(geyserId); @@ -102,9 +98,9 @@ public class EntityCache { } public void removeAllEntities() { - List entities = new ArrayList<>(session.getEntityCache().getEntities().values()); + List entities = new ArrayList<>(this.entities.values()); for (Entity entity : entities) { - session.getEntityCache().removeEntity(entity, false); + removeEntity(entity, false); } // As a precaution @@ -119,16 +115,6 @@ public class EntityCache { return entities.get(entityIdTranslations.get(javaId)); } - public Set getEntitiesByType(Class entityType) { - Set entitiesOfType = new ObjectOpenHashSet<>(); - for (Entity entity : (entityType == PlayerEntity.class ? playerEntities : entities).values()) { - if (entity.is(entityType)) { - entitiesOfType.add(entity.as(entityType)); - } - } - return entitiesOfType; - } - public void addPlayerEntity(PlayerEntity entity) { playerEntities.put(entity.getUuid(), entity); } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java index a0bed9ad4..14efca357 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java @@ -121,7 +121,7 @@ public class PistonCache { SessionPlayerEntity playerEntity = session.getPlayerEntity(); boolean isOnGround = playerDisplacement.getY() > 0 || playerEntity.isOnGround(); Vector3d position = session.getCollisionManager().getPlayerBoundingBox().getBottomCenter(); - playerEntity.moveAbsolute(session, position.toFloat(), playerEntity.getRotation(), isOnGround, true); + playerEntity.moveAbsolute(position.toFloat(), playerEntity.getYaw(), playerEntity.getPitch(), playerEntity.getHeadYaw(), isOnGround, true); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java index f312bb8b4..9d51f82d2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java @@ -33,8 +33,8 @@ import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.PlayerFogPacket; import lombok.Getter; import lombok.Setter; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import javax.annotation.Nonnull; @@ -150,9 +150,8 @@ public class WorldBorder { PlayerEntity playerEntity = session.getPlayerEntity(); // Move the player back, but allow gravity to take place // Teleported = true makes going back better, but disconnects the player from their mounted entity - playerEntity.moveAbsolute(session, - Vector3f.from(playerEntity.getPosition().getX(), (newPosition.getY() - EntityType.PLAYER.getOffset()), playerEntity.getPosition().getZ()), - playerEntity.getRotation(), playerEntity.isOnGround(), session.getRidingVehicleEntity() == null); + playerEntity.moveAbsolute(Vector3f.from(playerEntity.getPosition().getX(), (newPosition.getY() - EntityDefinitions.PLAYER.offset()), playerEntity.getPosition().getZ()), + playerEntity.getYaw(), playerEntity.getPitch(), playerEntity.getHeadYaw(), playerEntity.isOnGround(), session.getRidingVehicleEntity() == null); } return isInWorldBorder; } @@ -261,7 +260,7 @@ public class WorldBorder { } private void drawWall(Vector3f position, boolean drawWallX) { - int initialY = (int) (position.getY() - EntityType.PLAYER.getOffset() - 1); + int initialY = (int) (position.getY() - EntityDefinitions.PLAYER.offset() - 1); for (int y = initialY; y < (initialY + 5); y++) { if (drawWallX) { float x = position.getX(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index 8a978fac3..10138f9a3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -50,7 +50,7 @@ public class BedrockAdventureSettingsTranslator extends PacketTranslator { // Include type of boat in the name - int variant = entity.getMetadata().getInt(EntityData.VARIANT); + int variant = ((BoatEntity) entity).getVariant(); String typeOfBoat = switch (variant) { case 1 -> "spruce"; case 2 -> "birch"; @@ -65,15 +67,16 @@ public class BedrockEntityPickRequestTranslator extends PacketTranslator itemName = "lead"; case MINECART_CHEST, MINECART_COMMAND_BLOCK, MINECART_FURNACE, MINECART_HOPPER, MINECART_TNT -> - // Move MINECART to the end of the name - itemName = entity.getEntityType().toString().toLowerCase().replace("minecart_", "") + "_minecart"; + // The Bedrock identifier matches the item name which moves MINECART to the end of the name + // TODO test + itemName = entity.getDefinition().identifier(); case MINECART_SPAWNER -> itemName = "minecart"; // Turns into a normal minecart //case ITEM_FRAME -> Not an entity in Bedrock Edition //case GLOW_ITEM_FRAME -> case ARMOR_STAND, END_CRYSTAL, MINECART, PAINTING -> // No spawn egg, just an item - itemName = entity.getEntityType().toString().toLowerCase(); - default -> itemName = entity.getEntityType().toString().toLowerCase() + "_spawn_egg"; + itemName = entity.getDefinition().entityType().toString().toLowerCase(Locale.ROOT); + default -> itemName = entity.getDefinition().entityType().toString().toLowerCase(Locale.ROOT) + "_spawn_egg"; } String fullItemName = "minecraft:" + itemName; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 06d9a69ee..baa679abc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -26,11 +26,11 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; -import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket; @@ -42,8 +42,8 @@ import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.connector.entity.CommandBlockMinecartEntity; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -92,7 +92,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator - playerPosition = playerPosition.sub(0, (EntityType.PLAYER.getOffset() - 1.27f), 0); + playerPosition = playerPosition.sub(0, (EntityDefinitions.PLAYER.offset() - 1.27f), 0); case SWIMMING, FALL_FLYING, // Elytra SPIN_ATTACK -> // Trident spin attack - playerPosition = playerPosition.sub(0, (EntityType.PLAYER.getOffset() - 0.4f), 0); + playerPosition = playerPosition.sub(0, (EntityDefinitions.PLAYER.offset() - 0.4f), 0); case SLEEPING -> - playerPosition = playerPosition.sub(0, (EntityType.PLAYER.getOffset() - 0.2f), 0); + playerPosition = playerPosition.sub(0, (EntityDefinitions.PLAYER.offset() - 0.2f), 0); } // else, we don't have to modify the position float diffX = playerPosition.getX() - packet.getBlockPosition().getX(); @@ -175,7 +175,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator MAXIMUM_BLOCK_DESTROYING_DISTANCE) { @@ -325,7 +325,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator 0) { sendMovement = true; } @@ -75,16 +75,15 @@ public class BedrockPlayerInputTranslator extends PacketTranslator= 100) { Vector3f vehiclePosition = vehicle.getPosition(); - Vector3f vehicleRotation = vehicle.getRotation(); if (vehicle instanceof BoatEntity) { // Remove some Y position to prevents boats flying up - vehiclePosition = vehiclePosition.down(EntityType.BOAT.getOffset()); + vehiclePosition = vehiclePosition.down(EntityDefinitions.BOAT.offset()); } ServerboundMoveVehiclePacket moveVehiclePacket = new ServerboundMoveVehiclePacket( vehiclePosition.getX(), vehiclePosition.getY(), vehiclePosition.getZ(), - vehicleRotation.getX() - 90, vehicleRotation.getY() + vehicle.getYaw() - 90, vehicle.getPitch() ); session.sendDownstreamPacket(moveVehiclePacket); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java index 8a70ada6f..8d1fda4e8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java @@ -57,7 +57,7 @@ public class BedrockRespawnTranslator extends PacketTranslator { if (entity == null) return; SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); entityDataPacket.setRuntimeEntityId(entity.getGeyserId()); - entityDataPacket.getMetadata().putAll(entity.getMetadata()); + entityDataPacket.getMetadata().putAll(entity.getDirtyMetadata()); session.sendUpstreamPacket(entityDataPacket); MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index 9b25a6486..f46f486e9 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -62,8 +62,8 @@ public class BedrockEntityEventTranslator extends PacketTranslator= 0 && packet.getData() < trades.length) { VillagerTrade trade = merchantInventory.getVillagerTrades()[packet.getData()]; openInventory.setItem(2, GeyserItemStack.from(trade.getOutput()), session); - villager.getMetadata().put(EntityData.TRADE_XP, trade.getXp() + villager.getMetadata().getInt(EntityData.TRADE_XP)); - villager.updateBedrockMetadata(session); + villager.getDirtyMetadata().put(EntityData.TRADE_XP, trade.getXp() + villager.getDirtyMetadata().getInt(EntityData.TRADE_XP)); + villager.updateBedrockMetadata(); } } }, 100, TimeUnit.MILLISECONDS); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java index 497de45f8..cbc01f8ee 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java @@ -26,8 +26,8 @@ package org.geysermc.connector.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.player.*; -import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.*; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; @@ -116,7 +116,7 @@ public class BedrockActionTranslator extends PacketTranslator { if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, - BlockFace.DOWN); + Direction.DOWN); session.sendDownstreamPacket(swapHandsPacket); if (session.getConnector().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java index 9a307d076..fbbc9ffc6 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java @@ -90,8 +90,8 @@ public class BedrockInteractTranslator extends PacketTranslator if (session.getMouseoverEntity() != null) { // No interactive tag should be sent session.setMouseoverEntity(null); - session.getPlayerEntity().getMetadata().put(EntityData.INTERACTIVE_TAG, ""); - session.getPlayerEntity().updateBedrockMetadata(session); + session.getPlayerEntity().getDirtyMetadata().put(EntityData.INTERACTIVE_TAG, ""); + session.getPlayerEntity().updateBedrockMetadata(); } } break; @@ -99,7 +99,7 @@ public class BedrockInteractTranslator extends PacketTranslator if (session.getOpenInventory() == null) { Entity ridingEntity = session.getRidingVehicleEntity(); if (ridingEntity instanceof AbstractHorseEntity) { - if (ridingEntity.getMetadata().getFlags().getFlag(EntityFlag.TAMED)) { + if (ridingEntity.getDirtyMetadata().getFlags().getFlag(EntityFlag.TAMED)) { // We should request to open the horse inventory instead ServerboundPlayerCommandPacket openHorseWindowPacket = new ServerboundPlayerCommandPacket((int) session.getPlayerEntity().getEntityId(), PlayerState.OPEN_HORSE_INVENTORY); session.sendDownstreamPacket(openHorseWindowPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index 85d3a945e..609ee6f2d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -34,8 +34,8 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import org.geysermc.connector.common.ChatColor; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -68,14 +68,17 @@ public class BedrockMovePlayerTranslator extends PacketTranslator INCORRECT_MOVEMENT_THRESHOLD) { PlayerEntity playerEntity = session.getPlayerEntity(); if (pistonCache.getPlayerMotion().equals(Vector3f.ZERO) && !pistonCache.isPlayerSlimeCollision()) { - playerEntity.moveAbsolute(session, position.toFloat(), playerEntity.getRotation(), newOnGround, true); + playerEntity.moveAbsolute(position.toFloat(), playerEntity.getYaw(), playerEntity.getPitch(), playerEntity.getHeadYaw(), newOnGround, true); } } @@ -190,7 +190,7 @@ public class CollisionManager { // Gravity might need to be reset... SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); entityDataPacket.setRuntimeEntityId(entity.getGeyserId()); - entityDataPacket.getMetadata().putAll(entity.getMetadata()); + entityDataPacket.getMetadata().putAll(entity.getDirtyMetadata()); session.sendUpstreamPacket(entityDataPacket); MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); @@ -376,9 +376,9 @@ public class CollisionManager { // at the current location. double originalY = playerBoundingBox.getMiddleY(); double originalHeight = playerBoundingBox.getSizeY(); - double standingY = originalY - (originalHeight / 2.0) + (EntityType.PLAYER.getHeight() / 2.0); + double standingY = originalY - (originalHeight / 2.0) + (EntityDefinitions.PLAYER.height() / 2.0); - playerBoundingBox.setSizeY(EntityType.PLAYER.getHeight()); + playerBoundingBox.setSizeY(EntityDefinitions.PLAYER.height()); playerBoundingBox.setMiddleY(standingY); boolean result = collision.checkIntersection(position, playerBoundingBox); result |= session.getPistonCache().checkCollision(position, playerBoundingBox); @@ -403,18 +403,17 @@ public class CollisionManager { * @param updateMetadata whether we should update metadata if something changed */ public void updateScaffoldingFlags(boolean updateMetadata) { - EntityFlags flags = session.getPlayerEntity().getMetadata().getFlags(); - boolean flagsChanged; + Entity entity = session.getPlayerEntity(); boolean isSneakingWithScaffolding = (touchingScaffolding || onScaffolding) && session.isSneaking(); - flagsChanged = flags.setFlag(EntityFlag.OVER_DESCENDABLE_BLOCK, onScaffolding); - flagsChanged |= flags.setFlag(EntityFlag.IN_ASCENDABLE_BLOCK, touchingScaffolding); - flagsChanged |= flags.setFlag(EntityFlag.OVER_SCAFFOLDING, isSneakingWithScaffolding); + entity.setFlag(EntityFlag.OVER_DESCENDABLE_BLOCK, onScaffolding); + entity.setFlag(EntityFlag.IN_ASCENDABLE_BLOCK, touchingScaffolding); + entity.setFlag(EntityFlag.OVER_SCAFFOLDING, isSneakingWithScaffolding); - flagsChanged |= flags.setFlag(EntityFlag.IN_SCAFFOLDING, touchingScaffolding); + entity.setFlag(EntityFlag.IN_SCAFFOLDING, touchingScaffolding); - if (flagsChanged && updateMetadata) { - session.getPlayerEntity().updateBedrockMetadata(session); + if (updateMetadata) { + session.getPlayerEntity().updateBedrockMetadata(); } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java index 5f20a9d03..be3b09b50 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java @@ -28,7 +28,6 @@ package org.geysermc.connector.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; @@ -36,7 +35,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.MerchantContainer; import org.geysermc.connector.inventory.PlayerInventory; @@ -99,14 +98,15 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); Vector3f pos = session.getPlayerEntity().getPosition().sub(0, 3, 0); - EntityDataMap metadata = new EntityDataMap(); - metadata.put(EntityData.SCALE, 0f); - metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0f); - metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0f); - - Entity villager = new Entity(0, geyserId, EntityType.VILLAGER, pos, Vector3f.ZERO, Vector3f.ZERO); - villager.setMetadata(metadata); - villager.spawnEntity(session); + Entity villager = new Entity(session, 0, geyserId, null, EntityDefinitions.VILLAGER, pos, Vector3f.ZERO, 0f, 0f, 0f) { + @Override + protected void initializeMetadata() { + dirtyMetadata.put(EntityData.SCALE, 0f); + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 0f); + dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0f); + } + }; + villager.spawnEntity(); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); EntityLinkData.Type type = EntityLinkData.Type.PASSENGER; @@ -127,7 +127,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { public void closeInventory(GeyserSession session, Inventory inventory) { MerchantContainer merchantInventory = (MerchantContainer) inventory; if (merchantInventory.getVillager() != null) { - merchantInventory.getVillager().despawnEntity(session); + merchantInventory.getVillager().despawnEntity(); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java index ddc05b62f..8eca69333 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java @@ -43,12 +43,12 @@ import lombok.Getter; import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.item.Enchantment; import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.registry.Registries; import org.geysermc.connector.utils.EntityUtils; import java.util.*; @@ -220,7 +220,7 @@ public class JavaCommandsTranslator extends PacketTranslator BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.get().keySet().toArray(new String[0]); case ITEM_STACK -> session.getItemMappings().getItemNames(); case ITEM_ENCHANTMENT -> Enchantment.JavaEnchantment.ALL_JAVA_IDENTIFIERS; - case ENTITY_SUMMON -> EntityType.ALL_JAVA_IDENTIFIERS; + case ENTITY_SUMMON -> Registries.JAVA_ENTITY_IDENTIFIERS.get().keySet().toArray(new String[0]); //TODO add Marker case COLOR -> VALID_COLORS; case SCOREBOARD_SLOT -> VALID_SCOREBOARD_SLOTS; case MOB_EFFECT -> ALL_EFFECT_IDENTIFIERS; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java index cbcbe9f1d..ca7c92302 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java @@ -92,7 +92,7 @@ public class JavaLoginTranslator extends PacketTranslator { @@ -47,22 +50,30 @@ public class JavaSetEntityDataTranslator extends PacketTranslator> translators = (List>) entity.getDefinition().translators(); + + for (EntityMetadata metadata : packet.getMetadata()) { + if (metadata.getId() >= translators.size()) { + session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + translators.size() + " for entity type " + entity.getDefinition().entityType()); if (session.getConnector().getConfig().isDebugMode()) { - e.printStackTrace(); + session.getConnector().getLogger().debug(metadata.toString()); } + continue; } + + EntityMetadataTranslator translator = (EntityMetadataTranslator) translators.get(metadata.getId()); + if (translator == null) { + // This can safely happen; it means we don't translate this entity metadata + continue; + } + if (translator.acceptedType() != metadata.getType()) { + session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " was received with type " + metadata.getType() + " but we expected " + translator.acceptedType() + " for " + entity.getDefinition().entityType()); + continue; + } + translator.translateFunction().accept(entity, metadata); } - entity.updateBedrockMetadata(session); + entity.updateBedrockMetadata(); // Update the interactive tag, if necessary if (session.getMouseoverEntity() != null && session.getMouseoverEntity().getEntityId() == entity.getEntityId()) { diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java index 0fd9b0c64..27e0481ee 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java @@ -26,11 +26,11 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityLinkPacket; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.living.MobEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -43,15 +43,14 @@ public class JavaSetEntityLinkTranslator extends PacketTranslator 1)); + EntityUtils.updateMountOffset(passenger, entity, false, false, (packet.getPassengerIds().length > 1)); } else { - EntityUtils.updateMountOffset(passenger, entity, session, (packet.getPassengerIds()[0] == passengerId), true, (packet.getPassengerIds().length > 1)); + EntityUtils.updateMountOffset(passenger, entity, (packet.getPassengerIds()[0] == passengerId), true, (packet.getPassengerIds().length > 1)); } // Force an update to the passenger metadata - passenger.updateBedrockMetadata(session); + passenger.updateBedrockMetadata(); } - switch (entity.getEntityType()) { + switch (entity.getDefinition().entityType()) { case HORSE, SKELETON_HORSE, DONKEY, MULE, RAVAGER -> { - entity.getMetadata().put(EntityData.RIDER_MAX_ROTATION, 181.0f); - entity.updateBedrockMetadata(session); + entity.getDirtyMetadata().put(EntityData.RIDER_MAX_ROTATION, 181.0f); + entity.updateBedrockMetadata(); } } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java index 8fbd234a9..89bcb5c0e 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java @@ -43,6 +43,6 @@ public class JavaTeleportEntityTranslator extends PacketTranslator 1); + EntityUtils.updateMountOffset(entity, vehicle, false, false, entity.getPassengers().size() > 1); } // If coordinates are relative, then add to the existing coordinate double newX = packet.getX() + (packet.getRelative().contains(PositionElement.X) ? entity.getPosition().getX() : 0); double newY = packet.getY() + - (packet.getRelative().contains(PositionElement.Y) ? entity.getPosition().getY() - EntityType.PLAYER.getOffset() : 0); + (packet.getRelative().contains(PositionElement.Y) ? entity.getPosition().getY() - EntityDefinitions.PLAYER.offset() : 0); double newZ = packet.getZ() + (packet.getRelative().contains(PositionElement.Z) ? entity.getPosition().getZ() : 0); @@ -121,16 +123,16 @@ public class JavaPlayerPositionTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { - Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); - Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), 0); + float yaw = packet.getYaw(); + float pitch = packet.getPitch(); - org.geysermc.connector.entity.type.EntityType type = EntityUtils.toBedrockEntity(packet.getType()); - if (type == null) { + EntityDefinition definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); + if (definition == null) { session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); return; } - Class entityClass = type.getEntityClass(); - try { - Entity entity; - if (packet.getType() == EntityType.FALLING_BLOCK) { - entity = new FallingBlockEntity(packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), - type, position, motion, rotation, ((FallingBlockData) packet.getData()).getId()); - } else if (packet.getType() == EntityType.ITEM_FRAME || packet.getType() == EntityType.GLOW_ITEM_FRAME) { - // Item frames need the hanging direction - entity = new ItemFrameEntity(packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), - type, position, motion, rotation, (HangingDirection) packet.getData()); - } else if (packet.getType() == EntityType.FISHING_BOBBER) { - // Fishing bobbers need the owner for the line - int ownerEntityId = ((ProjectileData) packet.getData()).getOwnerId(); - Entity owner = session.getEntityCache().getEntityByJavaId(ownerEntityId); - if (owner == null && session.getPlayerEntity().getEntityId() == ownerEntityId) { - owner = session.getPlayerEntity(); - } - // Java clients only spawn fishing hooks with a player as its owner - if (owner instanceof PlayerEntity) { - entity = new FishingHookEntity(packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), - type, position, motion, rotation, (PlayerEntity) owner); - } else { - return; - } - } else if (packet.getType() == EntityType.BOAT) { - // Initial rotation is incorrect - entity = new BoatEntity(packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), - type, position, motion, Vector3f.from(packet.getYaw(), 0, packet.getYaw())); + Entity entity; + if (packet.getType() == EntityType.FALLING_BLOCK) { + entity = new FallingBlockEntity(session, packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), packet.getUuid(), + position, motion, yaw, pitch, ((FallingBlockData) packet.getData()).getId()); + } else if (packet.getType() == EntityType.ITEM_FRAME || packet.getType() == EntityType.GLOW_ITEM_FRAME) { + // Item frames need the hanging direction + entity = new ItemFrameEntity(session, packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), packet.getUuid(), + definition, position, motion, yaw, pitch, (Direction) packet.getData()); + } else if (packet.getType() == EntityType.FISHING_BOBBER) { + // Fishing bobbers need the owner for the line + int ownerEntityId = ((ProjectileData) packet.getData()).getOwnerId(); + Entity owner; + if (session.getPlayerEntity().getEntityId() == ownerEntityId) { + owner = session.getPlayerEntity(); } else { - Constructor entityConstructor = entityClass.getConstructor(long.class, long.class, org.geysermc.connector.entity.type.EntityType.class, - Vector3f.class, Vector3f.class, Vector3f.class); - - entity = entityConstructor.newInstance(packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), - type, position, motion, rotation - ); + owner = session.getEntityCache().getEntityByJavaId(ownerEntityId); } - session.getEntityCache().spawnEntity(entity); - } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) { - ex.printStackTrace(); + // Java clients only spawn fishing hooks with a player as its owner + if (owner instanceof PlayerEntity) { + entity = new FishingHookEntity(session, packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), packet.getUuid(), + position, motion, yaw, pitch, (PlayerEntity) owner); + } else { + return; + } + } else { + entity = ((BaseEntityFactory) definition.factory()).create(session, packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), + packet.getUuid(), definition, position, motion, yaw, pitch, 0f); } + session.getEntityCache().spawnEntity(entity); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java index 263170f95..ec2ab1221 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn. import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.ExpOrbEntity; -import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; @@ -42,8 +41,7 @@ public class JavaAddExperienceOrbTranslator extends PacketTranslator { @@ -45,25 +43,16 @@ public class JavaAddMobTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); + if (definition == null) { session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); return; } - Class entityClass = type.getEntityClass(); - try { - Constructor entityConstructor = entityClass.getConstructor(long.class, long.class, EntityType.class, - Vector3f.class, Vector3f.class, Vector3f.class); - - Entity entity = entityConstructor.newInstance(packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), - type, position, motion, rotation - ); - session.getEntityCache().spawnEntity(entity); - } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException ex) { - ex.printStackTrace(); - } + Entity entity = ((BaseEntityFactory) definition.factory()).create(session, packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), + packet.getUuid(), definition, position, motion, packet.getYaw(), packet.getPitch(), packet.getHeadYaw() + ); + session.getEntityCache().spawnEntity(entity); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java index 790e79ecf..4879166a2 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java @@ -40,9 +40,9 @@ public class JavaAddPaintingTranslator extends PacketTranslator> 4) == packet.getX() && (position.getZ() >> 4) == packet.getZ()) { - session.getSkullCache().get(position).despawnEntity(session); + session.getSkullCache().get(position).despawnEntity(); iterator.remove(); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java index b74d58175..8c1ab9124 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java @@ -73,7 +73,7 @@ public class JavaSetObjectiveTranslator extends PacketTranslator { if (gameProfile == null) { @@ -117,34 +116,34 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements } if (session.getEventLoop().inEventLoop()) { - spawnPlayer(session, gameProfile, blockPosition, entityPosition, entityRotation, blockState); + spawnPlayer(session, gameProfile, blockPosition, entityPosition, rotation, blockState); } else { - session.executeInEventLoop(() -> spawnPlayer(session, gameProfile, blockPosition, entityPosition, entityRotation, blockState)); + session.executeInEventLoop(() -> spawnPlayer(session, gameProfile, blockPosition, entityPosition, rotation, blockState)); } }); } private static void spawnPlayer(GeyserSession session, GameProfile profile, Vector3i blockPosition, - Vector3f entityPosition, Vector3f entityRotation, int blockState) { + Vector3f entityPosition, float rotation, int blockState) { long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); SkullPlayerEntity existingSkull = session.getSkullCache().get(blockPosition); if (existingSkull != null) { // Ensure that two skulls can't spawn on the same point - existingSkull.despawnEntity(session, blockPosition); + existingSkull.despawnEntity(blockPosition); } - SkullPlayerEntity player = new SkullPlayerEntity(profile, geyserId, entityPosition, entityRotation, blockState); + SkullPlayerEntity player = new SkullPlayerEntity(session, geyserId, profile, entityPosition, rotation, blockState); // Cache entity session.getSkullCache().put(blockPosition, player); - player.spawnEntity(session); + player.spawnEntity(); SkullSkinManager.requestAndHandleSkin(player, session, (skin -> session.scheduleInEventLoop(() -> { // Delay to minimize split-second "player" pop-in - player.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false); - player.updateBedrockMetadata(session); + player.setFlag(EntityFlag.INVISIBLE, false); + player.updateBedrockMetadata(); }, 250, TimeUnit.MILLISECONDS))); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java index 579a3196d..88cee13b0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java @@ -29,7 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.EntityDefinition; +import org.geysermc.connector.registry.Registries; @BlockEntity(type = BlockEntityType.MOB_SPAWNER) public class SpawnerBlockEntityTranslator extends BlockEntityTranslator { @@ -72,10 +73,10 @@ public class SpawnerBlockEntityTranslator extends BlockEntityTranslator { .getValue(); builder.put("EntityIdentifier", entityID); - EntityType type = EntityType.getFromIdentifier(entityID); - if (type != null) { - builder.put("DisplayEntityWidth", type.getWidth()); - builder.put("DisplayEntityHeight", type.getHeight()); + EntityDefinition definition = Registries.JAVA_ENTITY_IDENTIFIERS.get(entityID); + if (definition != null) { + builder.put("DisplayEntityWidth", definition.width()); + builder.put("DisplayEntityHeight", definition.height()); builder.put("DisplayEntityScale", 1.0f); } } diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/connector/src/main/java/org/geysermc/connector/registry/Registries.java index 157d01ea3..15fbeb03f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/connector/src/main/java/org/geysermc/connector/registry/Registries.java @@ -25,11 +25,12 @@ package org.geysermc.connector.registry; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent; +import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; -import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; @@ -37,12 +38,14 @@ import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.world.event.LevelEventTransformer; import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; import org.geysermc.connector.network.translators.sound.SoundHandler; import org.geysermc.connector.network.translators.sound.SoundInteractionHandler; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.connector.network.translators.world.event.LevelEventTransformer; import org.geysermc.connector.registry.loader.*; import org.geysermc.connector.registry.populator.ItemRegistryPopulator; import org.geysermc.connector.registry.populator.RecipeRegistryPopulator; @@ -51,6 +54,7 @@ import org.geysermc.connector.registry.type.ItemMappings; import org.geysermc.connector.registry.type.ParticleMapping; import org.geysermc.connector.registry.type.SoundMapping; +import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -59,6 +63,11 @@ import java.util.Set; * Holds all the common registries in Geyser. */ public class Registries { + /** + * A registry holding a CompoundTag of the known entity identifiers. + */ + public static final SimpleRegistry BEDROCK_ENTITY_IDENTIFIERS = SimpleRegistry.create("bedrock/entity_identifiers.dat", RegistryLoaders.NBT); + /** * A registry holding a CompoundTag of all the known biomes. */ @@ -90,9 +99,14 @@ public class Registries { public static final SimpleMappedRegistry ENCHANTMENTS; /** - * A registry holding a CompoundTag of the known entity identifiers. + * A map containing all entity types and their respective Geyser definitions */ - public static final SimpleRegistry ENTITY_IDENTIFIERS = SimpleRegistry.create("bedrock/entity_identifiers.dat", RegistryLoaders.NBT); + public static final SimpleMappedRegistry> ENTITY_DEFINITIONS = SimpleMappedRegistry.create(RegistryLoaders.empty(() -> new EnumMap<>(EntityType.class))); + + /** + * A map containing all Java entity identifiers and their respective Geyser definitions + */ + public static final SimpleMappedRegistry> JAVA_ENTITY_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new)); /** * A versioned registry which holds {@link ItemMappings} for each version. These item mappings contain diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java index 682ff8331..7d0cdea7d 100644 --- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java @@ -117,7 +117,7 @@ public final class Scoreboard { continue; } - entity.setBelowNameText(session, objective); + entity.setBelowNameText(objective); } } } @@ -368,7 +368,7 @@ public final class Scoreboard { for (Entity entity : session.getEntityCache().getEntities().values()) { // This more complex logic is for the future to iterate over all entities, not just players if (entity instanceof PlayerEntity player && names.remove(player.getUsername())) { - player.updateDisplayName(session, team, true); + player.updateDisplayName(team, true); if (names.isEmpty()) { break; } @@ -384,7 +384,7 @@ public final class Scoreboard { for (Entity entity : session.getEntityCache().getEntities().values()) { if (entity instanceof PlayerEntity player) { Team playerTeam = session.getWorldCache().getScoreboard().getTeamFor(player.getUsername()); - player.updateDisplayName(session, playerTeam, true); + player.updateDisplayName(playerTeam, true); } } } diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java index 86b40093e..140577104 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java @@ -196,7 +196,7 @@ public class BlockUtils { /** * Given a position, return the position if a block were located on the specified block face. * @param blockPos the block position - * @param face the face of the block - see {@link com.github.steveice10.mc.protocol.data.game.level.block.BlockFace} + * @param face the face of the block - see {@link com.github.steveice10.mc.protocol.data.game.entity.object.Direction} * @return the block position with the block face accounted for */ public static Vector3i getBlockPosition(Vector3i blockPos, int face) { diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index 48e1a9622..df2923bb5 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -152,7 +152,7 @@ public class ChunkUtils { ItemFrameEntity itemFrameEntity = ItemFrameEntity.getItemFrameEntity(session, position); if (itemFrameEntity != null) { if (blockState == JAVA_AIR_ID) { // Item frame is still present and no block overrides that; refresh it - itemFrameEntity.updateBlock(session); + itemFrameEntity.updateBlock(); // Still update the chunk cache with the new block session.getChunkCache().updateBlock(position.getX(), position.getY(), position.getZ(), blockState); return; @@ -163,7 +163,7 @@ public class ChunkUtils { SkullPlayerEntity skull = session.getSkullCache().get(position); if (skull != null && blockState != skull.getBlockState()) { // Skull is gone - skull.despawnEntity(session, position); + skull.despawnEntity(position); } // Prevent moving_piston from being placed diff --git a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java index fdfb40971..57c0eac73 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java @@ -26,14 +26,14 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.Effect; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.living.ArmorStandEntity; import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.entity.type.EntityType; -import org.geysermc.connector.network.session.GeyserSession; import java.util.Locale; @@ -69,24 +69,10 @@ public final class EntityUtils { }; } - /** - * Converts a MobType to a Bedrock edition EntityType, returns null if the EntityType is not found - * - * @param type The MobType to convert - * @return Converted EntityType - */ - public static EntityType toBedrockEntity(com.github.steveice10.mc.protocol.data.game.entity.type.EntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ex) { - return null; - } - } - private static float getMountedHeightOffset(Entity mount) { - float height = mount.getMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); + float height = mount.getDirtyMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); float mountedHeightOffset = height * 0.75f; - switch (mount.getEntityType()) { + switch (mount.getDefinition().entityType()) { case CHICKEN, SPIDER -> mountedHeightOffset = height * 0.5f; case DONKEY, MULE -> mountedHeightOffset -= 0.25f; case LLAMA -> mountedHeightOffset = height * 0.67f; @@ -94,7 +80,7 @@ public final class EntityUtils { MINECART_COMMAND_BLOCK -> mountedHeightOffset = 0; case BOAT -> mountedHeightOffset = -0.1f; case HOGLIN, ZOGLIN -> { - boolean isBaby = mount.getMetadata().getFlags().getFlag(EntityFlag.BABY); + boolean isBaby = mount.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); mountedHeightOffset = height - (isBaby ? 0.2f : 0.15f); } case PIGLIN -> mountedHeightOffset = height * 0.92f; @@ -107,7 +93,7 @@ public final class EntityUtils { private static float getHeightOffset(Entity passenger) { boolean isBaby; - switch (passenger.getEntityType()) { + switch (passenger.getDefinition().entityType()) { case SKELETON: case STRAY: case WITHER_SKELETON: @@ -124,10 +110,10 @@ public final class EntityUtils { case PIGLIN: case PIGLIN_BRUTE: case ZOMBIFIED_PIGLIN: - isBaby = passenger.getMetadata().getFlags().getFlag(EntityFlag.BABY); + isBaby = passenger.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); return isBaby ? -0.05f : -0.45f; case ZOMBIE: - isBaby = passenger.getMetadata().getFlags().getFlag(EntityFlag.BABY); + isBaby = passenger.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); return isBaby ? 0.0f : -0.45f; case EVOKER: case ILLUSIONER: @@ -148,8 +134,8 @@ public final class EntityUtils { /** * Adjust an entity's height if they have mounted/dismounted an entity. */ - public static void updateMountOffset(Entity passenger, Entity mount, GeyserSession session, boolean rider, boolean riding, boolean moreThanOneEntity) { - passenger.getMetadata().getFlags().setFlag(EntityFlag.RIDING, riding); + public static void updateMountOffset(Entity passenger, Entity mount, boolean rider, boolean riding, boolean moreThanOneEntity) { + passenger.setFlag(EntityFlag.RIDING, riding); if (riding) { // Without the Y offset, Bedrock players will find themselves in the floor when mounting float mountedHeightOffset = getMountedHeightOffset(mount); @@ -158,7 +144,7 @@ public final class EntityUtils { float xOffset = 0; float yOffset = mountedHeightOffset + heightOffset; float zOffset = 0; - switch (mount.getEntityType()) { + switch (mount.getDefinition().entityType()) { case BOAT: // Without the X offset, more than one entity on a boat is stacked on top of each other if (rider && moreThanOneEntity) { @@ -180,17 +166,17 @@ public final class EntityUtils { * Horses are tinier * Players, Minecarts, and Boats have different origins */ - if (passenger.getEntityType() == EntityType.PLAYER && mount.getEntityType() != EntityType.PLAYER) { - yOffset += EntityType.PLAYER.getOffset(); + if (passenger.getDefinition().entityType() == EntityType.PLAYER && mount.getDefinition().entityType() != EntityType.PLAYER) { + yOffset += EntityDefinitions.PLAYER.offset(); } - switch (mount.getEntityType()) { + switch (mount.getDefinition().entityType()) { case MINECART, MINECART_HOPPER, MINECART_TNT, MINECART_CHEST, MINECART_FURNACE, MINECART_SPAWNER, - MINECART_COMMAND_BLOCK, BOAT -> yOffset -= mount.getEntityType().getHeight() * 0.5f; + MINECART_COMMAND_BLOCK, BOAT -> yOffset -= mount.getDefinition().height() * 0.5f; } Vector3f offset = Vector3f.from(xOffset, yOffset, zOffset); - passenger.getMetadata().put(EntityData.RIDER_SEAT_POSITION, offset); + passenger.getDirtyMetadata().put(EntityData.RIDER_SEAT_POSITION, offset); } - passenger.updateBedrockMetadata(session); + passenger.updateBedrockMetadata(); } private EntityUtils() { diff --git a/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java b/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java index 228a8d448..0f7e66250 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java @@ -25,14 +25,17 @@ package org.geysermc.connector.utils; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.living.MobEntity; import org.geysermc.connector.entity.living.animal.AnimalEntity; import org.geysermc.connector.entity.living.animal.horse.HorseEntity; -import org.geysermc.connector.entity.type.EntityType; +import org.geysermc.connector.entity.living.animal.tameable.CatEntity; +import org.geysermc.connector.entity.living.animal.tameable.WolfEntity; +import org.geysermc.connector.entity.living.merchant.VillagerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.type.ItemMapping; @@ -60,26 +63,26 @@ public class InteractiveTagManager { * @param interactEntity the entity that the client is currently facing. */ public static void updateTag(GeyserSession session, Entity interactEntity) { - EntityDataMap entityMetadata = interactEntity.getMetadata(); ItemMapping mapping = session.getPlayerInventory().getItemInHand().getMapping(session); String javaIdentifierStripped = mapping.getJavaIdentifier().replace("minecraft:", ""); + EntityType entityType = interactEntity.getDefinition().entityType(); InteractiveTag interactiveTag = InteractiveTag.NONE; - if (entityMetadata.getLong(EntityData.LEASH_HOLDER_EID) == session.getPlayerEntity().getGeyserId()) { + if (interactEntity instanceof MobEntity mobEntity && mobEntity.getLeashHolderBedrockId() == session.getPlayerEntity().getGeyserId()) { // Unleash the entity interactiveTag = InteractiveTag.REMOVE_LEASH; - } else if (javaIdentifierStripped.equals("saddle") && !entityMetadata.getFlags().getFlag(EntityFlag.SADDLED) && - ((SADDLEABLE_WHEN_TAMED_MOB_TYPES.contains(interactEntity.getEntityType()) && entityMetadata.getFlags().getFlag(EntityFlag.TAMED) && !session.isSneaking()) || - interactEntity.getEntityType() == EntityType.PIG || interactEntity.getEntityType() == EntityType.STRIDER)) { + } else if (javaIdentifierStripped.equals("saddle") && !interactEntity.getFlag(EntityFlag.SADDLED) && + ((SADDLEABLE_WHEN_TAMED_MOB_TYPES.contains(entityType) && interactEntity.getFlag(EntityFlag.TAMED) && !session.isSneaking()) || + entityType == EntityType.PIG || entityType == EntityType.STRIDER)) { // Entity can be saddled and the conditions meet (entity can be saddled and, if needed, is tamed) interactiveTag = InteractiveTag.SADDLE; } else if (javaIdentifierStripped.equals("name_tag") && session.getPlayerInventory().getItemInHand().getNbt() != null && session.getPlayerInventory().getItemInHand().getNbt().contains("display")) { // Holding a named name tag interactiveTag = InteractiveTag.NAME; - } else if (javaIdentifierStripped.equals("lead") && LEASHABLE_MOB_TYPES.contains(interactEntity.getEntityType()) && - entityMetadata.getLong(EntityData.LEASH_HOLDER_EID, -1L) == -1L) { + } else if (interactEntity instanceof MobEntity mobEntity &&javaIdentifierStripped.equals("lead") + && LEASHABLE_MOB_TYPES.contains(entityType) && mobEntity.getLeashHolderBedrockId() == -1L) { // Holding a leash and the mob is leashable for sure // (Plugins can change this behavior so that's something to look into in the far far future) interactiveTag = InteractiveTag.LEASH; @@ -87,17 +90,17 @@ public class InteractiveTagManager { // This animal can be fed interactiveTag = InteractiveTag.FEED; } else { - switch (interactEntity.getEntityType()) { + switch (interactEntity.getDefinition().entityType()) { case BOAT: if (interactEntity.getPassengers().size() < 2) { interactiveTag = InteractiveTag.BOARD_BOAT; } break; case CAT: - if (entityMetadata.getFlags().getFlag(EntityFlag.TAMED) && - entityMetadata.getLong(EntityData.OWNER_EID) == session.getPlayerEntity().getGeyserId()) { + if (interactEntity.getFlag(EntityFlag.TAMED) && + ((CatEntity) interactEntity).getOwnerBedrockId() == session.getPlayerEntity().getGeyserId()) { // Tamed and owned by player - can sit/stand - interactiveTag = entityMetadata.getFlags().getFlag(EntityFlag.SITTING) ? InteractiveTag.STAND : InteractiveTag.SIT; + interactiveTag = interactEntity.getFlag(EntityFlag.SITTING) ? InteractiveTag.STAND : InteractiveTag.SIT; break; } break; @@ -128,7 +131,7 @@ public class InteractiveTagManager { case DONKEY: case LLAMA: case MULE: - if (entityMetadata.getFlags().getFlag(EntityFlag.TAMED) && !entityMetadata.getFlags().getFlag(EntityFlag.CHESTED) + if (interactEntity.getFlag(EntityFlag.TAMED) && !interactEntity.getFlag(EntityFlag.CHESTED) && javaIdentifierStripped.equals("chest")) { // Can attach a chest interactiveTag = InteractiveTag.ATTACH_CHEST; @@ -139,12 +142,12 @@ public class InteractiveTagManager { case SKELETON_HORSE: case TRADER_LLAMA: case ZOMBIE_HORSE: - boolean tamed = entityMetadata.getFlags().getFlag(EntityFlag.TAMED); - if (session.isSneaking() && tamed && (interactEntity instanceof HorseEntity || entityMetadata.getFlags().getFlag(EntityFlag.CHESTED))) { + boolean tamed = interactEntity.getFlag(EntityFlag.TAMED); + if (session.isSneaking() && tamed && (interactEntity instanceof HorseEntity || interactEntity.getFlag(EntityFlag.CHESTED))) { interactiveTag = InteractiveTag.OPEN_CONTAINER; break; } - if (!entityMetadata.getFlags().getFlag(EntityFlag.BABY)) { + if (!interactEntity.getFlag(EntityFlag.BABY)) { // Can't ride a baby if (tamed) { interactiveTag = InteractiveTag.RIDE_HORSE; @@ -165,17 +168,17 @@ public class InteractiveTagManager { interactiveTag = InteractiveTag.OPEN_CONTAINER; break; case PIG: - if (entityMetadata.getFlags().getFlag(EntityFlag.SADDLED)) { + if (interactEntity.getFlag(EntityFlag.SADDLED)) { interactiveTag = InteractiveTag.MOUNT; } break; case PIGLIN: - if (!entityMetadata.getFlags().getFlag(EntityFlag.BABY) && javaIdentifierStripped.equals("gold_ingot")) { + if (!interactEntity.getFlag(EntityFlag.BABY) && javaIdentifierStripped.equals("gold_ingot")) { interactiveTag = InteractiveTag.BARTER; } break; case SHEEP: - if (!entityMetadata.getFlags().getFlag(EntityFlag.SHEARED)) { + if (!interactEntity.getFlag(EntityFlag.SHEARED)) { if (javaIdentifierStripped.equals("shears")) { // Shear the sheep interactiveTag = InteractiveTag.SHEAR; @@ -186,13 +189,13 @@ public class InteractiveTagManager { } break; case STRIDER: - if (entityMetadata.getFlags().getFlag(EntityFlag.SADDLED)) { + if (interactEntity.getFlag(EntityFlag.SADDLED)) { interactiveTag = InteractiveTag.RIDE_STRIDER; } break; case VILLAGER: - if (entityMetadata.getInt(EntityData.VARIANT) != 14 && entityMetadata.getInt(EntityData.VARIANT) != 0 - && entityMetadata.getFloat(EntityData.SCALE) >= 0.75f) { // Not a nitwit, has a profession and is not a baby + VillagerEntity villager = (VillagerEntity) interactEntity; + if (villager.isCanTradeWith() && !villager.isBaby()) { // Not a nitwit, has a profession and is not a baby interactiveTag = InteractiveTag.TRADE; } break; @@ -200,13 +203,13 @@ public class InteractiveTagManager { interactiveTag = InteractiveTag.TRADE; // Since you can always trade with a wandering villager, presumably. break; case WOLF: - if (javaIdentifierStripped.equals("bone") && !entityMetadata.getFlags().getFlag(EntityFlag.TAMED)) { + if (javaIdentifierStripped.equals("bone") && !interactEntity.getFlag(EntityFlag.TAMED)) { // Bone and untamed - can tame interactiveTag = InteractiveTag.TAME; - } else if (entityMetadata.getFlags().getFlag(EntityFlag.TAMED) && - entityMetadata.getLong(EntityData.OWNER_EID) == session.getPlayerEntity().getGeyserId()) { + } else if (interactEntity.getFlag(EntityFlag.TAMED) && + ((WolfEntity) interactEntity).getOwnerBedrockId() == session.getPlayerEntity().getGeyserId()) { // Tamed and owned by player - can sit/stand - interactiveTag = entityMetadata.getFlags().getFlag(EntityFlag.SITTING) ? InteractiveTag.STAND : InteractiveTag.SIT; + interactiveTag = interactEntity.getFlag(EntityFlag.SITTING) ? InteractiveTag.STAND : InteractiveTag.SIT; } break; case ZOMBIE_VILLAGER: @@ -219,15 +222,15 @@ public class InteractiveTagManager { break; } } - session.getPlayerEntity().getMetadata().put(EntityData.INTERACTIVE_TAG, interactiveTag.getValue()); - session.getPlayerEntity().updateBedrockMetadata(session); + session.getPlayerEntity().getDirtyMetadata().put(EntityData.INTERACTIVE_TAG, interactiveTag.getValue()); + session.getPlayerEntity().updateBedrockMetadata(); } /** * All interactive tags in enum form. For potential API usage. */ public enum InteractiveTag { - NONE(true), + NONE((Void) null), IGNITE_CREEPER("creeper"), EDIT, LEAVE_BOAT("exit.boat"), @@ -271,7 +274,7 @@ public class InteractiveTagManager { @Getter private final String value; - InteractiveTag(boolean isNone) { + InteractiveTag(Void isNone) { this.value = ""; } From e0a7887f3f93d4951d745d8ef8ded6a62ab5bc08 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 18 Nov 2021 20:44:03 -0500 Subject: [PATCH 686/766] Entity refactor bug fixes and other 1.18 changes --- .../connector/entity/AbstractArrowEntity.java | 2 +- .../connector/entity/EnderCrystalEntity.java | 2 +- .../org/geysermc/connector/entity/Entity.java | 51 ++++--- .../connector/entity/EntityDefinition.java | 12 +- .../connector/entity/EntityDefinitions.java | 130 ++---------------- .../connector/entity/FishingHookEntity.java | 15 +- ...tityType.java => GeyserDirtyMetadata.java} | 30 +++- .../geysermc/connector/entity/ItemEntity.java | 7 +- .../connector/entity/ItemFrameEntity.java | 8 +- .../connector/entity/LivingEntity.java | 8 +- .../entity/living/ArmorStandEntity.java | 5 +- .../entity/living/animal/AnimalEntity.java | 2 +- .../entity/living/animal/AxolotlEntity.java | 2 +- .../entity/living/animal/BeeEntity.java | 2 +- .../entity/living/animal/ChickenEntity.java | 2 +- .../entity/living/animal/FoxEntity.java | 2 +- .../entity/living/animal/GoatEntity.java | 5 +- .../entity/living/animal/HoglinEntity.java | 2 +- .../entity/living/animal/OcelotEntity.java | 2 +- .../entity/living/animal/PandaEntity.java | 2 +- .../entity/living/animal/PigEntity.java | 2 +- .../entity/living/animal/PolarBearEntity.java | 2 +- .../entity/living/animal/RabbitEntity.java | 2 +- .../entity/living/animal/StriderEntity.java | 2 +- .../entity/living/animal/TurtleEntity.java | 2 +- .../animal/horse/AbstractHorseEntity.java | 2 +- .../living/animal/horse/LlamaEntity.java | 2 +- .../living/animal/tameable/CatEntity.java | 2 +- .../living/animal/tameable/ParrotEntity.java | 2 +- .../living/animal/tameable/WolfEntity.java | 6 +- .../living/monster/EnderDragonEntity.java | 3 +- .../raid/SpellcasterIllagerEntity.java | 2 +- .../connector/entity/player/PlayerEntity.java | 40 +++--- .../entity/player/SessionPlayerEntity.java | 21 +++ .../entity/player/SkullPlayerEntity.java | 3 +- .../network/session/GeyserSession.java | 2 +- .../BedrockAdventureSettingsTranslator.java | 2 +- .../bedrock/BedrockPlayerInputTranslator.java | 4 +- .../bedrock/BedrockRespawnTranslator.java | 7 +- .../entity/BedrockEntityEventTranslator.java | 8 +- .../player/BedrockActionTranslator.java | 6 +- .../player/BedrockInteractTranslator.java | 2 +- .../collision/CollisionManager.java | 9 +- .../java/JavaCommandsTranslator.java | 2 +- .../translators/java/JavaLoginTranslator.java | 5 +- .../entity/JavaEntityEventTranslator.java | 7 +- .../entity/JavaSetEntityDataTranslator.java | 8 +- .../player/JavaPlayerPositionTranslator.java | 6 +- .../JavaHorseScreenOpenTranslator.java | 3 +- .../JavaLevelChunkWithLightTranslator.java | 35 +++-- .../level/JavaLevelParticlesTranslator.java | 8 +- .../FeedBabySoundInteractionHandler.java | 7 +- .../MilkEntitySoundInteractionHandler.java | 2 +- .../loader/ParticleTypesRegistryLoader.java | 9 +- .../populator/ItemRegistryPopulator.java | 4 +- .../registry/type/ParticleMapping.java | 7 +- .../geysermc/connector/utils/ChunkUtils.java | 2 +- .../geysermc/connector/utils/EffectUtils.java | 2 +- .../geysermc/connector/utils/EntityUtils.java | 11 +- .../utils/InteractiveTagManager.java | 2 +- 60 files changed, 243 insertions(+), 301 deletions(-) rename connector/src/main/java/org/geysermc/connector/entity/{type/EntityType.java => GeyserDirtyMetadata.java} (57%) diff --git a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java index f51516dc6..be07a12ce 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java @@ -40,7 +40,7 @@ public class AbstractArrowEntity extends Entity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Set the correct texture if using the resource pack - dirtyMetadata.getFlags().setFlag(EntityFlag.BRIBED, definition.entityType() == EntityType.SPECTRAL_ARROW); + setFlag(EntityFlag.BRIBED, definition.entityType() == EntityType.SPECTRAL_ARROW); setMotion(motion); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java index a39c479f8..df7c041b3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java @@ -45,7 +45,7 @@ public class EnderCrystalEntity extends Entity { protected void initializeMetadata() { super.initializeMetadata(); // Bedrock 1.16.100+ - prevents the entity from appearing on fire itself when fire is underneath it - dirtyMetadata.getFlags().setFlag(EntityFlag.FIRE_IMMUNE, true); + setFlag(EntityFlag.FIRE_IMMUNE, true); } public void setBlockTarget(EntityMetadata entityMetadata) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index bdeacc9dc..3bf5a3a16 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -32,7 +32,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlags; import com.nukkitx.protocol.bedrock.packet.AddEntityPacket; @@ -83,13 +82,15 @@ public class Entity { protected float boundingBoxHeight; @Setter(AccessLevel.NONE) protected float boundingBoxWidth; + @Setter(AccessLevel.NONE) + protected String nametag = ""; /* Metadata end */ protected LongOpenHashSet passengers = new LongOpenHashSet(); /** * A container to store temporary metadata before it's sent to Bedrock. */ - protected final EntityDataMap dirtyMetadata = new EntityDataMap(); + protected final GeyserDirtyMetadata dirtyMetadata = new GeyserDirtyMetadata(); /** * The entity flags for the Bedrock entity. * These must always be saved - if flags are updated and the other values aren't present, the Bedrock client will @@ -146,15 +147,13 @@ public class Entity { addEntityPacket.setPosition(position); addEntityPacket.setMotion(motion); addEntityPacket.setRotation(getBedrockRotation()); - addEntityPacket.setEntityType(definition.bedrockId()); - addEntityPacket.getMetadata().putFlags(flags) - .putAll(dirtyMetadata); + addEntityPacket.getMetadata().putFlags(flags); + dirtyMetadata.apply(addEntityPacket.getMetadata()); addAdditionalSpawnData(addEntityPacket); valid = true; session.sendUpstreamPacket(addEntityPacket); - dirtyMetadata.clear(); flagsDirty = false; session.getConnector().getLogger().debug("Spawned entity " + getClass().getName() + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); @@ -293,15 +292,15 @@ public class Entity { return; } - if (!dirtyMetadata.isEmpty() || flagsDirty) { + if (dirtyMetadata.hasEntries() || flagsDirty) { SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); entityDataPacket.setRuntimeEntityId(geyserId); - entityDataPacket.getMetadata().putFlags(flags); - entityDataPacket.getMetadata().putAll(dirtyMetadata); + if (flagsDirty) { + entityDataPacket.getMetadata().putFlags(flags); + flagsDirty = false; + } + dirtyMetadata.apply(entityDataPacket.getMetadata()); session.sendUpstreamPacket(entityDataPacket); - - dirtyMetadata.clear(); - flagsDirty = false; } } @@ -343,9 +342,9 @@ public class Entity { public void setDisplayName(EntityMetadata entityMetadata) { Component name = entityMetadata.getValue(); if (name != null) { - String displayName = MessageTranslator.convertMessage(name, session.getLocale()); - dirtyMetadata.put(EntityData.NAMETAG, displayName); - } else if (!dirtyMetadata.getString(EntityData.NAMETAG).isEmpty()) { //TODO + nametag = MessageTranslator.convertMessage(name, session.getLocale()); + dirtyMetadata.put(EntityData.NAMETAG, nametag); + } else if (!nametag.isEmpty()) { // Clear nametag dirtyMetadata.put(EntityData.NAMETAG, ""); } @@ -376,14 +375,24 @@ public class Entity { */ protected void setDimensions(Pose pose) { // No flexibility options for basic entities - if (boundingBoxHeight != definition.height() || boundingBoxWidth != definition.width()) { - boundingBoxWidth = definition.width(); - boundingBoxHeight = definition.height(); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); + setBoundingBoxHeight(definition.height()); + setBoundingBoxWidth(definition.width()); + } + + public void setBoundingBoxHeight(float height) { + if (height != boundingBoxHeight) { + boundingBoxHeight = height; dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); } } + public void setBoundingBoxWidth(float width) { + if (width != boundingBoxWidth) { + boundingBoxWidth = width; + dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); + } + } + /** * Set a float from 0-1 - how strong the "frozen" overlay should be on screen. */ @@ -396,6 +405,10 @@ public class Entity { return freezingPercentage; } + public void setRiderSeatPosition(Vector3f position) { + dirtyMetadata.put(EntityData.RIDER_SEAT_POSITION, position); + } + /** * If true, the entity should be shaking on the client's end. * diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java index c4100d95d..e4baf1ed4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java @@ -46,7 +46,7 @@ import java.util.function.BiConsumer; * * @param the entity type this definition represents */ -public record EntityDefinition(EntityFactory factory, EntityType entityType, int bedrockId, String identifier, +public record EntityDefinition(EntityFactory factory, EntityType entityType, String identifier, float width, float height, float offset, List> translators) { public static Builder inherited(BaseEntityFactory factory, EntityDefinition parent) { @@ -54,7 +54,7 @@ public record EntityDefinition(EntityFactory factory, Entit } public static Builder inherited(EntityFactory factory, EntityDefinition parent) { - return new Builder<>(factory, parent.entityType, parent.bedrockId, parent.identifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators)); + return new Builder<>(factory, parent.entityType, parent.identifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators)); } public static Builder builder(EntityFactory factory) { @@ -66,7 +66,6 @@ public record EntityDefinition(EntityFactory factory, Entit public static class Builder { private final EntityFactory factory; private EntityType type; - private int bedrockId; private String identifier; private float width; private float height; @@ -78,10 +77,9 @@ public record EntityDefinition(EntityFactory factory, Entit translators = new ObjectArrayList<>(); } - public Builder(EntityFactory factory, EntityType type, int bedrockId, String identifier, float width, float height, float offset, List> translators) { + public Builder(EntityFactory factory, EntityType type, String identifier, float width, float height, float offset, List> translators) { this.factory = factory; this.type = type; - this.bedrockId = bedrockId; this.identifier = identifier; this.width = width; this.height = height; @@ -129,10 +127,10 @@ public record EntityDefinition(EntityFactory factory, Entit if (identifier == null && type != null) { identifier = "minecraft:" + type.name().toLowerCase(Locale.ROOT); } - EntityDefinition definition = new EntityDefinition<>(factory, type, bedrockId, identifier, width, height, offset, translators); + EntityDefinition definition = new EntityDefinition<>(factory, type, identifier, width, height, offset, translators); if (register && definition.entityType() != null) { Registries.ENTITY_DEFINITIONS.get().putIfAbsent(definition.entityType(), definition); - Registries.JAVA_ENTITY_IDENTIFIERS.get().putIfAbsent(definition.identifier(), definition); + Registries.JAVA_ENTITY_IDENTIFIERS.get().putIfAbsent("minecraft:" + type.name().toLowerCase(Locale.ROOT), definition); } return definition; } diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java index 926c86c29..be51687c0 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java @@ -33,7 +33,6 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import net.kyori.adventure.text.Component; import org.geysermc.connector.entity.factory.BaseEntityFactory; -import org.geysermc.connector.entity.factory.EntityFactory; import org.geysermc.connector.entity.factory.ExperienceOrbEntityFactory; import org.geysermc.connector.entity.factory.PaintingEntityFactory; import org.geysermc.connector.entity.living.*; @@ -52,6 +51,7 @@ import org.geysermc.connector.entity.living.monster.raid.SpellcasterIllagerEntit import org.geysermc.connector.entity.living.monster.raid.VindicatorEntity; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.connector.registry.Registries; public final class EntityDefinitions { public static final EntityDefinition AREA_EFFECT_CLOUD; @@ -192,7 +192,6 @@ public final class EntityDefinitions { { AREA_EFFECT_CLOUD = EntityDefinition.inherited(AreaEffectCloudEntity::new, entityBase) .type(EntityType.AREA_EFFECT_CLOUD) - .bedrockId(95) .height(0.5f).width(1.0f) .addTranslator(MetadataType.FLOAT, AreaEffectCloudEntity::setRadius) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) @@ -201,7 +200,6 @@ public final class EntityDefinitions { .build(); BOAT = EntityDefinition.inherited(BoatEntity::new, entityBase) .type(EntityType.BOAT) - .bedrockId(90) .height(0.6f).width(1.6f) .offset(0.35f) .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_TIME, entityMetadata.getValue())) // Time since last hit @@ -216,12 +214,10 @@ public final class EntityDefinitions { .build(); DRAGON_FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) .type(EntityType.DRAGON_FIREBALL) - .bedrockId(79) .heightAndWidth(1.0f) .build(); END_CRYSTAL = EntityDefinition.inherited(EnderCrystalEntity::new, entityBase) .type(EntityType.END_CRYSTAL) - .bedrockId(71) .heightAndWidth(2.0f) .addTranslator(MetadataType.OPTIONAL_POSITION, EnderCrystalEntity::setBlockTarget) .addTranslator(MetadataType.BOOLEAN, @@ -229,115 +225,94 @@ public final class EntityDefinitions { .build(); EXPERIENCE_ORB = EntityDefinition.inherited((ExperienceOrbEntityFactory) ExpOrbEntity::new, entityBase) .type(EntityType.EXPERIENCE_ORB) - .bedrockId(69) .identifier("minecraft:xp_orb") .build(); EVOKER_FANGS = EntityDefinition.inherited(entityBase.factory(), entityBase) .type(EntityType.EVOKER_FANGS) - .bedrockId(103) .height(0.8f).width(0.5f) .identifier("minecraft:evocation_fang") .build(); EYE_OF_ENDER = EntityDefinition.inherited(Entity::new, entityBase) .type(EntityType.EYE_OF_ENDER) - .bedrockId(70) .heightAndWidth(0.25f) .identifier("minecraft:eye_of_ender_signal") .build(); - FALLING_BLOCK = EntityDefinition.inherited(new EntityFactory() { - }, entityBase) // TODO + FALLING_BLOCK = EntityDefinition.inherited(null, entityBase) .type(EntityType.FALLING_BLOCK) - .bedrockId(66) .heightAndWidth(0.98f) + .addTranslator(null) // "start block position" .build(); FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) .type(EntityType.FIREBALL) - .bedrockId(85) .heightAndWidth(1.0f) .build(); FIREWORK_ROCKET = EntityDefinition.inherited(FireworkEntity::new, entityBase) .type(EntityType.FIREWORK_ROCKET) - .bedrockId(72) .heightAndWidth(0.25f) .identifier("minecraft:fireworks_rocket") .addTranslator(MetadataType.ITEM, FireworkEntity::setFireworkItem) .addTranslator(MetadataType.OPTIONAL_VARINT, FireworkEntity::setPlayerGliding) .build(); - FISHING_BOBBER = EntityDefinition.inherited(new EntityFactory() { - }, entityBase) //TODO + FISHING_BOBBER = EntityDefinition.inherited(null, entityBase) .type(EntityType.FISHING_BOBBER) - .bedrockId(77) .identifier("minecraft:fishing_book") .addTranslator(MetadataType.INT, FishingHookEntity::setHookedEntity) .build(); ITEM = EntityDefinition.inherited(ItemEntity::new, entityBase) .type(EntityType.ITEM) - .bedrockId(64) .heightAndWidth(0.25f) .offset(0.125f) .addTranslator(MetadataType.ITEM, ItemEntity::setItem) .build(); LEASH_KNOT = EntityDefinition.inherited(LeashKnotEntity::new, entityBase) .type(EntityType.LEASH_KNOT) - .bedrockId(88) .height(0.5f).width(0.375f) .build(); LIGHTNING_BOLT = EntityDefinition.inherited(LightningEntity::new, entityBase) .type(EntityType.LIGHTNING_BOLT) - .bedrockId(93) .build(); LLAMA_SPIT = EntityDefinition.inherited(ThrowableEntity::new, entityBase) .type(EntityType.LLAMA_SPIT) - .bedrockId(102) .heightAndWidth(0.25f) .build(); PAINTING = EntityDefinition.inherited((PaintingEntityFactory) PaintingEntity::new, entityBase) .type(EntityType.PAINTING) - .bedrockId(83) .build(); PRIMED_TNT = EntityDefinition.inherited(TNTEntity::new, entityBase) .type(EntityType.PRIMED_TNT) - .bedrockId(65) .heightAndWidth(0.98f) .identifier("minecraft:tnt") .addTranslator(MetadataType.INT, TNTEntity::setFuseLength) .build(); SHULKER_BULLET = EntityDefinition.inherited(ThrowableEntity::new, entityBase) .type(EntityType.SHULKER_BULLET) - .bedrockId(76) .heightAndWidth(0.3125f) .build(); SMALL_FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) .type(EntityType.SMALL_FIREBALL) - .bedrockId(94) .heightAndWidth(0.3125f) .build(); SNOWBALL = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) .type(EntityType.SNOWBALL) - .bedrockId(81) .heightAndWidth(0.25f) .build(); THROWN_ENDERPEARL = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) .type(EntityType.THROWN_ENDERPEARL) - .bedrockId(87) .heightAndWidth(0.25f) .identifier("minecraft:ender_pearl") .build(); THROWN_EGG = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) .type(EntityType.THROWN_EGG) - .bedrockId(82) .heightAndWidth(0.25f) .identifier("minecraft:egg") .build(); THROWN_EXP_BOTTLE = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) .type(EntityType.THROWN_EXP_BOTTLE) - .bedrockId(68) .heightAndWidth(0.25f) .identifier("minecraft:xp_bottle") .build(); THROWN_POTION = EntityDefinition.inherited(ThrownPotionEntity::new, entityBase) .type(EntityType.THROWN_POTION) - .bedrockId(86) .heightAndWidth(0.25f) .identifier("minecraft:splash_potion") .addTranslator(MetadataType.ITEM, ThrownPotionEntity::setPotion) @@ -349,30 +324,26 @@ public final class EntityDefinitions { .build(); ARROW = EntityDefinition.inherited(TippedArrowEntity::new, abstractArrowBase) .type(EntityType.ARROW) - .bedrockId(80) .heightAndWidth(0.25f) .addTranslator(MetadataType.INT, TippedArrowEntity::setPotionEffectColor) .build(); SPECTRAL_ARROW = EntityDefinition.inherited(abstractArrowBase.factory(), abstractArrowBase) .type(EntityType.SPECTRAL_ARROW) - .bedrockId(80) .heightAndWidth(0.25f) .identifier("minecraft:arrow") .build(); TRIDENT = EntityDefinition.inherited(TridentEntity::new, abstractArrowBase) // TODO remove class .type(EntityType.TRIDENT) - .bedrockId(73) .identifier("minecraft:thrown_trident") .addTranslator(null) // Loyalty .addTranslator(MetadataType.BOOLEAN, (tridentEntity, entityMetadata) -> tridentEntity.setFlag(EntityFlag.ENCHANTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); // Item frames are handled differently as they are blocks, not items, in Bedrock - ITEM_FRAME = EntityDefinition.inherited(new EntityFactory() { - }, entityBase) // TODO + ITEM_FRAME = EntityDefinition.inherited(null, entityBase) .type(EntityType.ITEM_FRAME) .addTranslator(MetadataType.ITEM, ItemFrameEntity::setItemInFrame) - .addTranslator(MetadataType.ITEM, ItemFrameEntity::setItemRotation) + .addTranslator(MetadataType.INT, ItemFrameEntity::setItemRotation) .build(); GLOW_ITEM_FRAME = EntityDefinition.inherited(ITEM_FRAME.factory(), ITEM_FRAME) .type(EntityType.GLOW_ITEM_FRAME) @@ -380,7 +351,6 @@ public final class EntityDefinitions { MINECART = EntityDefinition.inherited(MinecartEntity::new, entityBase) .type(EntityType.MINECART) - .bedrockId(84) .height(0.7f).width(0.98f) .offset(0.35f) .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HEALTH, entityMetadata.getValue())) @@ -388,7 +358,7 @@ public final class EntityDefinitions { .addTranslator(MetadataType.FLOAT, (minecartEntity, entityMetadata) -> // Power in Java, time in Bedrock minecartEntity.getDirtyMetadata().put(EntityData.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15))) - .addTranslator(MetadataType.BLOCK_STATE, MinecartEntity::setCustomBlock) + .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlock) .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset) .addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock) .build(); @@ -398,7 +368,6 @@ public final class EntityDefinitions { .build(); MINECART_COMMAND_BLOCK = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) .type(EntityType.MINECART_COMMAND_BLOCK) - .bedrockId(100) .identifier("minecraft:command_block_minecart") .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) @@ -423,30 +392,27 @@ public final class EntityDefinitions { WITHER_SKULL = EntityDefinition.inherited(WitherSkullEntity::new, entityBase) .type(EntityType.WITHER_SKULL) - .bedrockId(89) .heightAndWidth(0.3125f) .addTranslator(MetadataType.BOOLEAN, WitherSkullEntity::setDangerous) .build(); WITHER_SKULL_DANGEROUS = EntityDefinition.inherited(WITHER_SKULL.factory(), WITHER_SKULL) - .bedrockId(91) .build(false); } EntityDefinition livingEntityBase = EntityDefinition.inherited(LivingEntity::new, entityBase) .addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags) .addTranslator(MetadataType.FLOAT, LivingEntity::setHealth) - .addTranslator(MetadataType.FLOAT, + .addTranslator(MetadataType.INT, (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) .addTranslator(MetadataType.BOOLEAN, (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0))) .addTranslator(null) // Arrow count .addTranslator(null) // Stinger count - .addTranslator(MetadataType.POSITION, LivingEntity::setBedPosition) + .addTranslator(MetadataType.OPTIONAL_POSITION, LivingEntity::setBedPosition) .build(); ARMOR_STAND = EntityDefinition.inherited(ArmorStandEntity::new, livingEntityBase) .type(EntityType.ARMOR_STAND) - .bedrockId(61) .height(1.975f).width(0.5f) .addTranslator(MetadataType.BYTE, ArmorStandEntity::setArmorStandFlags) .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setHeadRotation) @@ -458,7 +424,6 @@ public final class EntityDefinitions { .build(); PLAYER = EntityDefinition.inherited(null, livingEntityBase) .type(EntityType.PLAYER) - .bedrockId(63) .height(1.8f).width(0.6f) .offset(1.62f) .addTranslator(MetadataType.FLOAT, PlayerEntity::setAbsorptionHearts) @@ -477,24 +442,20 @@ public final class EntityDefinitions { { BAT = EntityDefinition.inherited(BatEntity::new, mobEntityBase) .type(EntityType.BAT) - .bedrockId(19) .height(0.9f).width(0.5f) .addTranslator(MetadataType.BYTE, BatEntity::setBatFlags) .build(); BLAZE = EntityDefinition.inherited(BlazeEntity::new, mobEntityBase) .type(EntityType.BLAZE) - .bedrockId(43) .height(1.8f).width(0.6f) .addTranslator(MetadataType.BYTE, BlazeEntity::setBlazeFlags) .build(); CAVE_SPIDER = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) .type(EntityType.CAVE_SPIDER) - .bedrockId(40) .height(0.5f).width(0.7f) .build(); CREEPER = EntityDefinition.inherited(CreeperEntity::new, mobEntityBase) .type(EntityType.CREEPER) - .bedrockId(33) .height(1.7f).width(0.6f) .offset(1.62f) .addTranslator(MetadataType.INT, CreeperEntity::setSwelling) @@ -503,7 +464,6 @@ public final class EntityDefinitions { .build(); DOLPHIN = EntityDefinition.inherited(WaterEntity::new, mobEntityBase) .type(EntityType.DOLPHIN) - .bedrockId(31) .height(0.6f).width(0.9f) //TODO check .addTranslator(null) // treasure position @@ -512,7 +472,6 @@ public final class EntityDefinitions { .build(); ENDERMAN = EntityDefinition.inherited(EndermanEntity::new, mobEntityBase) .type(EntityType.ENDERMAN) - .bedrockId(38) .height(2.9f).width(0.6f) .addTranslator(MetadataType.BLOCK_STATE, EndermanEntity::setCarriedBlock) .addTranslator(MetadataType.BOOLEAN, EndermanEntity::setScreaming) @@ -520,47 +479,40 @@ public final class EntityDefinitions { .build(); ENDERMITE = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) .type(EntityType.ENDERMITE) - .bedrockId(55) .height(0.3f).width(0.4f) .build(); ENDER_DRAGON = EntityDefinition.inherited(EnderDragonEntity::new, mobEntityBase) .type(EntityType.ENDER_DRAGON) - .bedrockId(53) .addTranslator(MetadataType.INT, EnderDragonEntity::setPhase) .build(); GHAST = EntityDefinition.inherited(GhastEntity::new, mobEntityBase) .type(EntityType.GHAST) - .bedrockId(41) .heightAndWidth(4.0f) .addTranslator(MetadataType.BOOLEAN, GhastEntity::setGhastAttacking) .build(); GIANT = EntityDefinition.inherited(GiantEntity::new, mobEntityBase) .type(EntityType.GIANT) - .bedrockId(32) .height(1.8f).width(1.6f) .offset(1.62f) .identifier("minecraft:zombie") .build(); IRON_GOLEM = EntityDefinition.inherited(IronGolemEntity::new, mobEntityBase) .type(EntityType.IRON_GOLEM) - .bedrockId(20) .height(2.7f).width(1.4f) + .addTranslator(null) // "is player created", which doesn't seem to do anything clientside .build(); PHANTOM = EntityDefinition.inherited(PhantomEntity::new, mobEntityBase) .type(EntityType.PHANTOM) - .bedrockId(58) .height(0.5f).width(0.9f) .offset(0.6f) .addTranslator(MetadataType.INT, PhantomEntity::setPhantomScale) .build(); SILVERFISH = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) .type(EntityType.SILVERFISH) - .bedrockId(39) .height(0.3f).width(0.4f) .build(); SHULKER = EntityDefinition.inherited(ShulkerEntity::new, mobEntityBase) .type(EntityType.SHULKER) - .bedrockId(54) .heightAndWidth(1f) .addTranslator(MetadataType.DIRECTION, ShulkerEntity::setAttachedFace) .addTranslator(MetadataType.BYTE, ShulkerEntity::setShulkerHeight) @@ -568,44 +520,37 @@ public final class EntityDefinitions { .build(); SKELETON = EntityDefinition.inherited(SkeletonEntity::new, mobEntityBase) .type(EntityType.SKELETON) - .bedrockId(34) .height(1.8f).width(0.6f) .offset(1.62f) .addTranslator(MetadataType.BOOLEAN, SkeletonEntity::setConvertingToStray) .build(); SNOW_GOLEM = EntityDefinition.inherited(SnowGolemEntity::new, mobEntityBase) .type(EntityType.SNOW_GOLEM) - .bedrockId(21) .height(1.9f).width(0.7f) .addTranslator(MetadataType.BYTE, SnowGolemEntity::setSnowGolemFlags) .build(); SPIDER = EntityDefinition.inherited(SpiderEntity::new, mobEntityBase) .type(EntityType.SPIDER) - .bedrockId(35) .height(0.9f).width(1.4f) .offset(1f) .addTranslator(MetadataType.BYTE, SpiderEntity::setSpiderFlags) .build(); SQUID = EntityDefinition.inherited(SquidEntity::new, mobEntityBase) .type(EntityType.SQUID) - .bedrockId(17) .heightAndWidth(0.8f) .build(); STRAY = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) .type(EntityType.STRAY) - .bedrockId(46) .height(1.8f).width(0.6f) .offset(1.62f) .build(); VEX = EntityDefinition.inherited(VexEntity::new, mobEntityBase) .type(EntityType.VEX) - .bedrockId(105) .height(0.8f).width(0.4f) .addTranslator(MetadataType.BYTE, VexEntity::setVexFlags) .build(); WITHER = EntityDefinition.inherited(WitherEntity::new, mobEntityBase) .type(EntityType.WITHER) - .bedrockId(52) .height(3.5f).width(0.9f) .addTranslator(MetadataType.INT, WitherEntity::setTarget1) .addTranslator(MetadataType.INT, WitherEntity::setTarget2) @@ -614,18 +559,15 @@ public final class EntityDefinitions { .build(); WITHER_SKELETON = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) .type(EntityType.WITHER_SKELETON) - .bedrockId(48) .height(2.4f).width(0.7f) .build(); ZOGLIN = EntityDefinition.inherited(ZoglinEntity::new, mobEntityBase) .type(EntityType.ZOGLIN) - .bedrockId(126) .height(1.4f).width(1.3965f) .addTranslator(MetadataType.BOOLEAN, ZoglinEntity::setBaby) .build(); ZOMBIE = EntityDefinition.inherited(ZombieEntity::new, mobEntityBase) .type(EntityType.ZOMBIE) - .bedrockId(32) .height(1.8f).width(0.6f) .offset(1.62f) .addTranslator(MetadataType.BOOLEAN, ZombieEntity::setZombieBaby) @@ -634,7 +576,6 @@ public final class EntityDefinitions { .build(); ZOMBIE_VILLAGER = EntityDefinition.inherited(ZombieVillagerEntity::new, ZOMBIE) .type(EntityType.ZOMBIE_VILLAGER) - .bedrockId(44) .height(1.8f).width(0.6f) .offset(1.62f) .identifier("minecraft:zombie_villager_v2") @@ -643,7 +584,6 @@ public final class EntityDefinitions { .build(); ZOMBIFIED_PIGLIN = EntityDefinition.inherited(ZombifiedPiglinEntity::new, ZOMBIE) //TODO test how zombie entity metadata is handled? .type(EntityType.ZOMBIFIED_PIGLIN) - .bedrockId(36) .height(1.95f).width(0.6f) .offset(1.62f) .identifier("minecraft:zombie_pigman") @@ -651,36 +591,30 @@ public final class EntityDefinitions { DROWNED = EntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) .type(EntityType.DROWNED) - .bedrockId(110) .height(1.95f).width(0.6f) .build(); HUSK = EntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) .type(EntityType.HUSK) - .bedrockId(47) .build(); GUARDIAN = EntityDefinition.inherited(GuardianEntity::new, mobEntityBase) .type(EntityType.GUARDIAN) - .bedrockId(49) .heightAndWidth(0.85f) .addTranslator(null) // Moving //TODO .addTranslator(MetadataType.INT, GuardianEntity::setGuardianTarget) .build(); ELDER_GUARDIAN = EntityDefinition.inherited(ElderGuardianEntity::new, GUARDIAN) .type(EntityType.ELDER_GUARDIAN) - .bedrockId(50) .heightAndWidth(1.9975f) .build(); SLIME = EntityDefinition.inherited(SlimeEntity::new, mobEntityBase) .type(EntityType.SLIME) - .bedrockId(37) .heightAndWidth(0.51f) .addTranslator(MetadataType.INT, SlimeEntity::setScale) .build(); MAGMA_CUBE = EntityDefinition.inherited(MagmaCubeEntity::new, SLIME) .type(EntityType.MAGMA_CUBE) - .bedrockId(42) .build(); EntityDefinition abstractFishEntityBase = EntityDefinition.inherited(AbstractFishEntity::new, mobEntityBase) @@ -688,25 +622,22 @@ public final class EntityDefinitions { .build(); COD = EntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) .type(EntityType.COD) - .bedrockId(112) .height(0.25f).width(0.5f) .build(); PUFFERFISH = EntityDefinition.inherited(PufferFishEntity::new, abstractFishEntityBase) .type(EntityType.PUFFERFISH) - .bedrockId(108) .heightAndWidth(0.7f) .addTranslator(MetadataType.INT, PufferFishEntity::setPufferfishSize) .build(); SALMON = EntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) .type(EntityType.SALMON) - .bedrockId(109) .height(0.5f).width(0.7f) .build(); TROPICAL_FISH = EntityDefinition.inherited(TropicalFishEntity::new, abstractFishEntityBase) .type(EntityType.TROPICAL_FISH) - .bedrockId(111) .heightAndWidth(0.6f) .identifier("minecraft:tropicalfish") + .addTranslator(MetadataType.INT, TropicalFishEntity::setFishVariant) .build(); EntityDefinition abstractPiglinEntityBase = EntityDefinition.inherited(BasePiglinEntity::new, mobEntityBase) @@ -714,7 +645,6 @@ public final class EntityDefinitions { .build(); PIGLIN = EntityDefinition.inherited(PiglinEntity::new, abstractPiglinEntityBase) .type(EntityType.PIGLIN) - .bedrockId(123) .height(1.95f).width(0.6f) .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setBaby) .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setChargingCrossbow) @@ -722,7 +652,6 @@ public final class EntityDefinitions { .build(); PIGLIN_BRUTE = EntityDefinition.inherited(abstractPiglinEntityBase.factory(), abstractPiglinEntityBase) .type(EntityType.PIGLIN_BRUTE) - .bedrockId(127) .height(1.95f).width(0.6f) .build(); @@ -739,37 +668,31 @@ public final class EntityDefinitions { .build(); EVOKER = EntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) .type(EntityType.EVOKER) - .bedrockId(104) .height(1.95f).width(0.6f) .identifier("minecraft:evocation_illager") .build(); ILLUSIONER = EntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) .type(EntityType.ILLUSIONER) - .bedrockId(104) .height(1.95f).width(0.6f) .identifier("minecraft:evocation_illager") .build(); PILLAGER = EntityDefinition.inherited(PillagerEntity::new, raidParticipantEntityBase) .type(EntityType.PILLAGER) - .bedrockId(114) .height(1.8f).width(0.6f) .offset(1.62f) .addTranslator(null) // Charging; doesn't have an equivalent on Bedrock //TODO check .build(); RAVAGER = EntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) .type(EntityType.RAVAGER) - .bedrockId(59) .height(1.9f).width(1.2f) .build(); VINDICATOR = EntityDefinition.inherited(VindicatorEntity::new, raidParticipantEntityBase) .type(EntityType.VINDICATOR) - .bedrockId(57) .height(1.8f).width(0.6f) .offset(1.62f) .build(); WITCH = EntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) .type(EntityType.WITCH) - .bedrockId(45) .height(1.8f).width(0.6f) .offset(1.62f) .build(); @@ -786,34 +709,30 @@ public final class EntityDefinitions { .height(0.42f).width(0.7f) .addTranslator(MetadataType.INT, AxolotlEntity::setVariant) .addTranslator(MetadataType.BOOLEAN, AxolotlEntity::setPlayingDead) + .addTranslator(null) // From bucket .build(); BEE = EntityDefinition.inherited(BeeEntity::new, ageableEntityBase) .type(EntityType.BEE) - .bedrockId(122) .heightAndWidth(0.6f) .addTranslator(MetadataType.BYTE, BeeEntity::setBeeFlags) .addTranslator(MetadataType.INT, BeeEntity::setAngerTime) .build(); CHICKEN = EntityDefinition.inherited(ChickenEntity::new, ageableEntityBase) .type(EntityType.CHICKEN) - .bedrockId(10) .height(0.7f).width(0.4f) .build(); COW = EntityDefinition.inherited(AnimalEntity::new, ageableEntityBase) .type(EntityType.COW) - .bedrockId(11) .height(1.4f).width(0.9f) .build(); FOX = EntityDefinition.inherited(FoxEntity::new, ageableEntityBase) .type(EntityType.FOX) - .bedrockId(121) .height(0.5f).width(1.25f) .addTranslator(MetadataType.INT, FoxEntity::setFoxVariant) .addTranslator(MetadataType.BYTE, FoxEntity::setFoxFlags) .build(); HOGLIN = EntityDefinition.inherited(HoglinEntity::new, ageableEntityBase) .type(EntityType.HOGLIN) - .bedrockId(124) .height(1.4f).width(1.3965f) .addTranslator(MetadataType.BOOLEAN, HoglinEntity::setImmuneToZombification) .build(); @@ -824,19 +743,16 @@ public final class EntityDefinitions { .build(); MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase) // TODO remove class .type(EntityType.MOOSHROOM) - .bedrockId(16) .height(1.4f).width(0.9f) .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue().equals("brown") ? 1 : 0)) .build(); OCELOT = EntityDefinition.inherited(OcelotEntity::new, ageableEntityBase) .type(EntityType.OCELOT) - .bedrockId(22) .height(0.35f).width(0.3f) .addTranslator(MetadataType.BOOLEAN, (ocelotEntity, entityMetadata) -> ocelotEntity.setFlag(EntityFlag.TRUSTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); PANDA = EntityDefinition.inherited(PandaEntity::new, ageableEntityBase) .type(EntityType.PANDA) - .bedrockId(113) .height(1.25f).width(1.125f) .addTranslator(null) // Unhappy counter .addTranslator(null) // Sneeze counter @@ -847,32 +763,27 @@ public final class EntityDefinitions { .build(); PIG = EntityDefinition.inherited(PigEntity::new, ageableEntityBase) .type(EntityType.PIG) - .bedrockId(12) .heightAndWidth(0.9f) .addTranslator(MetadataType.BOOLEAN, (pigEntity, entityMetadata) -> pigEntity.setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(null) // Boost time .build(); POLAR_BEAR = EntityDefinition.inherited(PolarBearEntity::new, ageableEntityBase) .type(EntityType.POLAR_BEAR) - .bedrockId(28) .height(1.4f).width(1.3f) .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.STANDING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); RABBIT = EntityDefinition.inherited(RabbitEntity::new, ageableEntityBase) .type(EntityType.RABBIT) - .bedrockId(18) .height(0.5f).width(0.4f) .addTranslator(MetadataType.INT, RabbitEntity::setRabbitVariant) .build(); SHEEP = EntityDefinition.inherited(SheepEntity::new, ageableEntityBase) .type(EntityType.SHEEP) - .bedrockId(13) .heightAndWidth(0.9f) .addTranslator(MetadataType.BYTE, SheepEntity::setSheepFlags) .build(); STRIDER = EntityDefinition.inherited(StriderEntity::new, ageableEntityBase) .type(EntityType.STRIDER) - .bedrockId(125) .height(1.7f).width(0.9f) .addTranslator(null) // Boost time .addTranslator(MetadataType.BOOLEAN, StriderEntity::setCold) @@ -880,7 +791,6 @@ public final class EntityDefinitions { .build(); TURTLE = EntityDefinition.inherited(TurtleEntity::new, ageableEntityBase) .type(EntityType.TURTLE) - .bedrockId(74) .height(0.4f).width(1.2f) .addTranslator(MetadataType.BOOLEAN, TurtleEntity::setPregnant) .addTranslator(MetadataType.BOOLEAN, TurtleEntity::setLayingEgg) @@ -891,7 +801,6 @@ public final class EntityDefinitions { .build(); VILLAGER = EntityDefinition.inherited(VillagerEntity::new, abstractVillagerEntityBase) .type(EntityType.VILLAGER) - .bedrockId(15) .height(1.8f).width(0.6f) .offset(1.62f) .identifier("minecraft:villager_v2") @@ -899,7 +808,6 @@ public final class EntityDefinitions { .build(); WANDERING_TRADER = EntityDefinition.inherited(abstractVillagerEntityBase.factory(), abstractVillagerEntityBase) .type(EntityType.WANDERING_TRADER) - .bedrockId(118) .height(1.8f).width(0.6f) .offset(1.62f) .build(); @@ -913,18 +821,15 @@ public final class EntityDefinitions { .build(); HORSE = EntityDefinition.inherited(HorseEntity::new, abstractHorseEntityBase) .type(EntityType.HORSE) - .bedrockId(23) .height(1.6f).width(1.3965f) - .addTranslator(MetadataType.BYTE, HorseEntity::setHorseVariant) + .addTranslator(MetadataType.INT, HorseEntity::setHorseVariant) .build(); SKELETON_HORSE = EntityDefinition.inherited(abstractHorseEntityBase.factory(), abstractHorseEntityBase) .type(EntityType.SKELETON_HORSE) - .bedrockId(26) .height(1.6f).width(1.3965f) .build(); ZOMBIE_HORSE = EntityDefinition.inherited(abstractHorseEntityBase.factory(), abstractHorseEntityBase) .type(EntityType.ZOMBIE_HORSE) - .bedrockId(27) .height(1.6f).width(1.3965f) .build(); EntityDefinition chestedHorseEntityBase = EntityDefinition.inherited(ChestedHorseEntity::new, abstractHorseEntityBase) @@ -932,17 +837,14 @@ public final class EntityDefinitions { .build(); DONKEY = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) .type(EntityType.DONKEY) - .bedrockId(24) .height(1.6f).width(1.3965f) .build(); MULE = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) .type(EntityType.MULE) - .bedrockId(25) .height(1.6f).width(1.3965f) .build(); LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) .type(EntityType.LLAMA) - .bedrockId(29) .height(1.87f).width(0.9f) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.STRENGTH, entityMetadata.getValue())) .addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor) @@ -960,7 +862,6 @@ public final class EntityDefinitions { .build(); CAT = EntityDefinition.inherited(CatEntity::new, tameableEntityBase) .type(EntityType.CAT) - .bedrockId(75) .height(0.35f).width(0.3f) .addTranslator(MetadataType.INT, CatEntity::setCatVariant) .addTranslator(MetadataType.BOOLEAN, CatEntity::setResting) @@ -969,13 +870,11 @@ public final class EntityDefinitions { .build(); PARROT = EntityDefinition.inherited(ParrotEntity::new, tameableEntityBase) .type(EntityType.PARROT) - .bedrockId(30) .height(0.9f).width(0.5f) .addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) // Parrot color .build(); WOLF = EntityDefinition.inherited(WolfEntity::new, tameableEntityBase) .type(EntityType.WOLF) - .bedrockId(14) .height(0.85f).width(0.6f) // "Begging" on wiki.vg, "Interested" in Nukkit - the tilt of the head .addTranslator(MetadataType.BOOLEAN, (wolfEntity, entityMetadata) -> wolfEntity.setFlag(EntityFlag.INTERESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) @@ -985,9 +884,10 @@ public final class EntityDefinitions { // As of 1.18 these don't track entity data at all ENDER_DRAGON_PART = EntityDefinition.builder(null) - .bedrockId(32) .identifier("minecraft:armor_stand") // Emulated .build(); + + Registries.JAVA_ENTITY_IDENTIFIERS.get().put("minecraft:marker", null); // We don't need an entity definition for this as it is never sent over the network } public static void init() { diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index 2493ef588..8efb2db83 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -31,6 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; +import lombok.Getter; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.collision.BoundingBox; @@ -46,11 +47,15 @@ import java.util.concurrent.ThreadLocalRandom; public class FishingHookEntity extends ThrowableEntity { private boolean hooked = false; + private boolean inWater = false; + + @Getter + private final boolean isOwnerSessionPlayer; + @Getter + private long bedrockTargetId; private final BoundingBox boundingBox; - private boolean inWater = false; - public FishingHookEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f); @@ -59,8 +64,9 @@ public class FishingHookEntity extends ThrowableEntity { // In Java, the splash sound depends on the entity's velocity, but in Bedrock the volume doesn't change. // This splash can be confused with the sound from catching a fish. This silences the splash from Bedrock, // so that it can be handled by moveAbsoluteImmediate. - this.dirtyMetadata.putFloat(EntityData.BOUNDING_BOX_HEIGHT, 128); + setBoundingBoxHeight(128); + isOwnerSessionPlayer = owner.getGeyserId() == session.getPlayerEntity().getGeyserId(); this.dirtyMetadata.put(EntityData.OWNER_EID, owner.getGeyserId()); } @@ -80,7 +86,8 @@ public class FishingHookEntity extends ThrowableEntity { } if (entity != null) { - dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); + bedrockTargetId = entity.getGeyserId(); + dirtyMetadata.put(EntityData.TARGET_EID, bedrockTargetId); hooked = true; } else { hooked = false; diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java similarity index 57% rename from connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java rename to connector/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java index 517864e14..09cd79562 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java @@ -23,11 +23,33 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.type; +package org.geysermc.connector.entity; -import lombok.Getter; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -@Getter -public enum EntityType { +import java.util.Map; +/** + * A write-only wrapper for temporarily storing entity metadata that will be sent to Bedrock. + */ +public class GeyserDirtyMetadata { + private final Map metadata = new Object2ObjectLinkedOpenHashMap<>(); + + public void put(EntityData entityData, Object value) { + metadata.put(entityData, value); + } + + /** + * Applies the contents of the dirty metadata into the input and clears the contents of our map. + */ + public void apply(EntityDataMap map) { + map.putAll(metadata); + metadata.clear(); + } + + public boolean hasEntries() { + return !metadata.isEmpty(); + } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java index ab5e2906e..04ea9f299 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java @@ -41,7 +41,6 @@ import org.geysermc.connector.network.translators.world.block.BlockStateValues; import java.util.UUID; public class ItemEntity extends ThrowableEntity { - protected ItemData item; private int waterLevel = -1; @@ -63,7 +62,11 @@ public class ItemEntity extends ThrowableEntity { itemPacket.setMotion(motion); itemPacket.setFromFishing(false); itemPacket.setItemInHand(item); - itemPacket.getMetadata().putAll(dirtyMetadata); + itemPacket.getMetadata().putFlags(this.flags); + dirtyMetadata.apply(itemPacket.getMetadata()); + + setFlagsDirty(false); + session.sendUpstreamPacket(itemPacket); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java index 5730fdaff..2ff653a06 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java @@ -104,7 +104,7 @@ public class ItemFrameEntity extends Entity { @Override public void spawnEntity() { - updateBlock(); + updateBlock(true); session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId); valid = true; } @@ -174,14 +174,14 @@ public class ItemFrameEntity extends Entity { @Override public void updateBedrockMetadata() { - updateBlock(); + updateBlock(false); } /** * Updates the item frame as a block */ - public void updateBlock() { - if (!changed) { + public void updateBlock(boolean force) { + if (!changed && !force) { // Don't send a block update packet - nothing changed return; } diff --git a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java index 28f97a2a3..0a7a0da5c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java @@ -140,12 +140,8 @@ public class LivingEntity extends Entity { @Override protected void setDimensions(Pose pose) { if (pose == Pose.SLEEPING) { - boundingBoxWidth = 0.2f; - boundingBoxHeight = 0.2f; - if (boundingBoxWidth != definition.width() || boundingBoxHeight != definition.height()) { - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); - } + setBoundingBoxWidth(0.2f); + setBoundingBoxHeight(0.2f); } else { super.setDimensions(pose); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java index 904de233f..e2d34f2b8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java @@ -294,8 +294,7 @@ public class ArmorStandEntity extends LivingEntity { } return; } - //boolean isNametagEmpty = metadata.getString(EntityData.NAMETAG).isEmpty() || metadata.getByte(EntityData.NAMETAG_ALWAYS_SHOW, (byte) -1) == (byte) 0; - may not be necessary? - boolean isNametagEmpty = dirtyMetadata.getString(EntityData.NAMETAG).isEmpty(); // TODO + boolean isNametagEmpty = nametag.isEmpty(); if (!isNametagEmpty && (!helmet.equals(ItemData.AIR) || !chestplate.equals(ItemData.AIR) || !leggings.equals(ItemData.AIR) || !boots.equals(ItemData.AIR) || !hand.equals(ItemData.AIR) || !offHand.equals(ItemData.AIR))) { // If the second entity exists, no need to recreate it. @@ -313,7 +312,7 @@ public class ArmorStandEntity extends LivingEntity { } // Copy metadata secondEntity.isSmall = isSmall; - secondEntity.getDirtyMetadata().putAll(dirtyMetadata); //TODO check + //secondEntity.getDirtyMetadata().putAll(dirtyMetadata); //TODO check secondEntity.flags.merge(this.flags); // Guarantee this copy is NOT invisible secondEntity.setFlag(EntityFlag.INVISIBLE, false); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java index 7ef8f107e..60d2ba96a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java @@ -44,7 +44,7 @@ public class AnimalEntity extends AgeableEntity { * wheat. * @return true if this is a valid item to breed with for this animal. */ - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { // This is what it defaults to. OK. return javaIdentifierStripped.equals("wheat"); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java index 53c70d13e..e0bfc577e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java @@ -56,7 +56,7 @@ public class AxolotlEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("tropical_fish_bucket"); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java index 12366c4cd..a2524566d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java @@ -67,7 +67,7 @@ public class BeeEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return session.getTagCache().isFlower(mapping); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java index b1031209f..a32262199 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java @@ -39,7 +39,7 @@ public class ChickenEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.contains("seeds"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java index 7016753ba..a10201155 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java @@ -55,7 +55,7 @@ public class FoxEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return session.getTagCache().isFoxFood(mapping); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java index 6bf7cd336..568be2d21 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java @@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import lombok.Getter; import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; @@ -55,8 +54,8 @@ public class GoatEntity extends AnimalEntity { @Override protected void setDimensions(Pose pose) { if (pose == Pose.LONG_JUMPING) { - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, LONG_JUMPING_WIDTH); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, LONG_JUMPING_HEIGHT); + setBoundingBoxWidth(LONG_JUMPING_WIDTH); + setBoundingBoxHeight(LONG_JUMPING_HEIGHT); } else { super.setDimensions(pose); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java index 6493810c4..fb2c68fd2 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java @@ -55,7 +55,7 @@ public class HoglinEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("crimson_fungus"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java index ed4f8133b..945787417 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java @@ -39,7 +39,7 @@ public class OcelotEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("cod") || javaIdentifierStripped.equals("salmon"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java index ff66d30a8..376079387 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java @@ -83,7 +83,7 @@ public class PandaEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("bamboo"); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java index 8fe4fde06..b31470e1b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java @@ -39,7 +39,7 @@ public class PigEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("carrot") || javaIdentifierStripped.equals("potato") || javaIdentifierStripped.equals("beetroot"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java index 4eb5d79fc..c83e6bad4 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java @@ -39,7 +39,7 @@ public class PolarBearEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return false; } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java index 2d6a0d96a..02d6db67e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java @@ -72,7 +72,7 @@ public class RabbitEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("dandelion") || javaIdentifierStripped.equals("carrot") || javaIdentifierStripped.equals("golden_carrot"); } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java index d31bf4a4e..b2934e507 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java @@ -93,7 +93,7 @@ public class StriderEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("warped_fungus"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java index 28ff2d836..495bc64a0 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java @@ -50,7 +50,7 @@ public class TurtleEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("seagrass"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java index 27a359d63..1b3ffbd71 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java @@ -120,7 +120,7 @@ public class AbstractHorseEntity extends AnimalEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return DONKEY_AND_HORSE_FOODS.contains(javaIdentifierStripped); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java index 1c4e5155e..204261620 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java @@ -70,7 +70,7 @@ public class LlamaEntity extends ChestedHorseEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("wheat") || javaIdentifierStripped.equals("hay_block"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java index a4fe27535..035044a93 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java @@ -95,7 +95,7 @@ public class CatEntity extends TameableEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.equals("cod") || javaIdentifierStripped.equals("salmon"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java index 763d489e4..603303a65 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java @@ -39,7 +39,7 @@ public class ParrotEntity extends TameableEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { return javaIdentifierStripped.contains("seeds") || javaIdentifierStripped.equals("cookie"); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java index 5d6bcf1e3..f828ce014 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java @@ -56,7 +56,7 @@ public class WolfEntity extends TameableEntity { @Override public void setTameableFlags(EntityMetadata entityMetadata) { - super.setFlags(entityMetadata); + super.setTameableFlags(entityMetadata); // Reset wolf color byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); boolean angry = (xd & 0x02) == 0x02; @@ -87,8 +87,8 @@ public class WolfEntity extends TameableEntity { } @Override - public boolean canEat(GeyserSession session, String javaIdentifierStripped, ItemMapping mapping) { + public boolean canEat(String javaIdentifierStripped, ItemMapping mapping) { // Cannot be a baby to eat these foods - return WOLF_FOODS.contains(javaIdentifierStripped) && !getFlag(EntityFlag.BABY); + return WOLF_FOODS.contains(javaIdentifierStripped) && !isBaby(); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java index ff149c5b7..3d381972d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java @@ -29,7 +29,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; @@ -237,7 +236,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable { phaseTicks++; if (phase == 3) { // Landing Phase - float headHeight = head.getDirtyMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); //TODO + float headHeight = head.getBoundingBoxHeight(); Vector3f headCenter = head.getPosition().up(headHeight * 0.5f); for (int i = 0; i < 8; i++) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java index 23485750d..1dca4fd0a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java @@ -44,7 +44,7 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { public SpellcasterIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // OptionalPack usage - dirtyMetadata.getFlags().setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); + setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); } public void setSpellType(EntityMetadata entityMetadata) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index cfa78e08a..8c2471526 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -28,6 +28,7 @@ package org.geysermc.connector.entity.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; @@ -67,6 +68,8 @@ public class PlayerEntity extends LivingEntity { private String username; private boolean playerList = true; // Player is in the player list + private Vector3i bedPosition; + /** * Saves the parrot currently on the player's left shoulder; otherwise null */ @@ -114,10 +117,9 @@ public class PlayerEntity extends LivingEntity { addPlayerPacket.getAdventureSettings().setPlayerPermission(PlayerPermission.MEMBER); addPlayerPacket.setDeviceId(""); addPlayerPacket.setPlatformChatId(""); - addPlayerPacket.getMetadata().putAll(dirtyMetadata); addPlayerPacket.getMetadata().putFlags(flags); + dirtyMetadata.apply(addPlayerPacket.getMetadata()); - dirtyMetadata.clear(); setFlagsDirty(false); long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId); @@ -189,8 +191,7 @@ public class PlayerEntity extends LivingEntity { movePlayerPacket.setMode(MovePlayerPacket.Mode.NORMAL); // If the player is moved while sleeping, we have to adjust their y, so it appears // correctly on Bedrock. This fixes GSit's lay. - if (dirtyMetadata.getFlags().getFlag(EntityFlag.SLEEPING)) { - Vector3i bedPosition = dirtyMetadata.getPos(EntityData.BED_POSITION); + if (getFlag(EntityFlag.SLEEPING)) { if (bedPosition != null && (bedPosition.getY() == 0 || bedPosition.distanceSquared(position.toInt()) > 4)) { // Force the player movement by using a teleport movePlayerPacket.setPosition(Vector3f.from(position.getX(), position.getY() - definition.offset() + 0.2f, position.getZ())); @@ -253,6 +254,11 @@ public class PlayerEntity extends LivingEntity { super.setPosition(position.add(0, definition.offset(), 0)); } + @Override + public Vector3i setBedPosition(EntityMetadata entityMetadata) { + return bedPosition = super.setBedPosition(entityMetadata); + } + public void setAbsorptionHearts(EntityMetadata entityMetadata) { // Extra hearts - is not metadata but an attribute on Bedrock UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); @@ -358,11 +364,12 @@ public class PlayerEntity extends LivingEntity { // The name is not visible to the session player; clear name newDisplayName = ""; } - needsUpdate = useGivenTeam && !newDisplayName.equals(dirtyMetadata.getString(EntityData.NAMETAG, null)); + needsUpdate = useGivenTeam && !newDisplayName.equals(nametag); + nametag = newDisplayName; dirtyMetadata.put(EntityData.NAMETAG, newDisplayName); } else if (useGivenTeam) { // The name has reset, if it was previously something else - needsUpdate = !newDisplayName.equals(dirtyMetadata.getString(EntityData.NAMETAG)); + needsUpdate = !newDisplayName.equals(nametag); dirtyMetadata.put(EntityData.NAMETAG, this.username); } else { needsUpdate = false; @@ -393,10 +400,8 @@ public class PlayerEntity extends LivingEntity { return; } } - if (height != boundingBoxHeight || definition.width() != boundingBoxWidth) { - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, definition.width()); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, height); - } + setBoundingBoxWidth(definition.width()); + setBoundingBoxHeight(height); } public void setBelowNameText(Objective objective) { @@ -410,7 +415,6 @@ public class PlayerEntity extends LivingEntity { } String displayString = amount + " " + objective.getDisplayName(); - dirtyMetadata.put(EntityData.SCORE_TAG, displayString); if (valid) { // Already spawned - we still need to run the rest of this code because the spawn packet will be // providing the information @@ -419,15 +423,11 @@ public class PlayerEntity extends LivingEntity { packet.getMetadata().put(EntityData.SCORE_TAG, displayString); session.sendUpstreamPacket(packet); } - } else { - // Always remove the score tag first, then check for valid. - // That way the score tag is removed if the player was spawned, then despawned, and is being respawned - if (dirtyMetadata.remove(EntityData.SCORE_TAG) != null && valid) { - SetEntityDataPacket packet = new SetEntityDataPacket(); - packet.setRuntimeEntityId(geyserId); - packet.getMetadata().put(EntityData.SCORE_TAG, ""); - session.sendUpstreamPacket(packet); - } + } else if (valid) { + SetEntityDataPacket packet = new SetEntityDataPacket(); + packet.setRuntimeEntityId(geyserId); + packet.getMetadata().put(EntityData.SCORE_TAG, ""); + session.sendUpstreamPacket(packet); } } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java index d8a3e5492..bc6d4077a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java @@ -33,6 +33,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.AttributeData; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -59,6 +60,15 @@ public class SessionPlayerEntity extends PlayerEntity { * Whether to check for updated speed after all entity metadata has been processed */ private boolean refreshSpeed = false; + /** + * Used in PlayerInputTranslator for movement checks. + */ + @Getter + private boolean isRidingInFront; + /** + * Used for villager inventory emulation. + */ + private int fakeTradeXp; private final GeyserSession session; @@ -130,6 +140,17 @@ public class SessionPlayerEntity extends PlayerEntity { } } + @Override + public void setRiderSeatPosition(Vector3f position) { + super.setRiderSeatPosition(position); + this.isRidingInFront = position != null && position.getX() > 0; + } + + public void addFakeTradeExperience(int tradeXp) { + fakeTradeXp += tradeXp; + dirtyMetadata.put(EntityData.TRADE_XP, fakeTradeXp); + } + @Override public AttributeData createHealthAttribute() { // Max health must be divisible by two in bedrock diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java index c2c41d0dc..e6c5cdfb3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java @@ -83,10 +83,9 @@ public class SkullPlayerEntity extends PlayerEntity { addPlayerPacket.getAdventureSettings().setPlayerPermission(PlayerPermission.MEMBER); addPlayerPacket.setDeviceId(""); addPlayerPacket.setPlatformChatId(""); - addPlayerPacket.getMetadata().putAll(dirtyMetadata); addPlayerPacket.getMetadata().putFlags(flags); + dirtyMetadata.apply(addPlayerPacket.getMetadata()); - dirtyMetadata.clear(); setFlagsDirty(false); valid = true; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index ef545746b..72dcf3710 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -1072,7 +1072,7 @@ public class GeyserSession implements CommandSender { AttributeData currentPlayerSpeed = playerEntity.getAttributes().get(GeyserAttributeType.MOVEMENT_SPEED); if (currentPlayerSpeed != null) { if ((pose.equals(Pose.SNEAKING) && !sneaking && collisionManager.isUnderSlab()) || - (!swimmingInWater && playerEntity.getDirtyMetadata().getFlags().getFlag(EntityFlag.SWIMMING) && !collisionManager.isPlayerInWater())) { + (!swimmingInWater && playerEntity.getFlag(EntityFlag.SWIMMING) && !collisionManager.isPlayerInWater())) { // Either of those conditions means that Bedrock goes zoom when they shouldn't be AttributeData speedAttribute = GeyserAttributeType.MOVEMENT_SPEED.getAttribute(originalSpeedAttribute / 3.32f); playerEntity.getAttributes().put(GeyserAttributeType.MOVEMENT_SPEED, speedAttribute); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index 10138f9a3..6fafef998 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -50,7 +50,7 @@ public class BedrockAdventureSettingsTranslator extends PacketTranslator 0) { + if (session.getPlayerEntity().isRidingInFront()) { sendMovement = true; } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java index 8d1fda4e8..4ccf77370 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java @@ -30,7 +30,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCl import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -54,11 +53,7 @@ public class BedrockRespawnTranslator extends PacketTranslator { if (session.isSpawned()) { // Client might be stuck; resend spawn information PlayerEntity entity = session.getPlayerEntity(); - if (entity == null) return; - SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); - entityDataPacket.setRuntimeEntityId(entity.getGeyserId()); - entityDataPacket.getMetadata().putAll(entity.getDirtyMetadata()); - session.sendUpstreamPacket(entityDataPacket); + entity.updateBedrockMetadata(); // TODO test? MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); movePlayerPacket.setRuntimeEntityId(entity.getGeyserId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index f46f486e9..ef275ca0a 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -27,9 +27,8 @@ package org.geysermc.connector.network.translators.bedrock.entity; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSelectTradePacket; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.player.SessionPlayerEntity; import org.geysermc.connector.inventory.GeyserItemStack; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.MerchantContainer; @@ -55,14 +54,15 @@ public class BedrockEntityEventTranslator extends PacketTranslator { - Entity villager = session.getPlayerEntity(); + SessionPlayerEntity villager = session.getPlayerEntity(); Inventory openInventory = session.getOpenInventory(); if (openInventory instanceof MerchantContainer merchantInventory) { VillagerTrade[] trades = merchantInventory.getVillagerTrades(); if (trades != null && packet.getData() >= 0 && packet.getData() < trades.length) { VillagerTrade trade = merchantInventory.getVillagerTrades()[packet.getData()]; openInventory.setItem(2, GeyserItemStack.from(trade.getOutput()), session); - villager.getDirtyMetadata().put(EntityData.TRADE_XP, trade.getXp() + villager.getDirtyMetadata().getInt(EntityData.TRADE_XP)); + // TODO this logic doesn't add up + villager.addFakeTradeExperience(trade.getXp()); villager.updateBedrockMetadata(); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java index cbc01f8ee..c3c3dad84 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java @@ -116,7 +116,7 @@ public class BedrockActionTranslator extends PacketTranslator if (session.getOpenInventory() == null) { Entity ridingEntity = session.getRidingVehicleEntity(); if (ridingEntity instanceof AbstractHorseEntity) { - if (ridingEntity.getDirtyMetadata().getFlags().getFlag(EntityFlag.TAMED)) { + if (ridingEntity.getFlag(EntityFlag.TAMED)) { // We should request to open the horse inventory instead ServerboundPlayerCommandPacket openHorseWindowPacket = new ServerboundPlayerCommandPacket((int) session.getPlayerEntity().getEntityId(), PlayerState.OPEN_HORSE_INVENTORY); session.sendDownstreamPacket(openHorseWindowPacket); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java index 2f5c41ae9..3d9069232 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java @@ -28,10 +28,8 @@ package org.geysermc.connector.network.translators.collision; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.connector.entity.Entity; @@ -121,7 +119,7 @@ public class CollisionManager { // - In Bedrock Edition, the height becomes 1.65 blocks, allowing movement through spaces as small as 1.75 (2 - 1⁄4) blocks high. // - In Java Edition, the height becomes 1.5 blocks. // Other instances have the player's bounding box become as small as 0.6 or 0.2. - double playerHeight = session.getPlayerEntity().getDirtyMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); + double playerHeight = session.getPlayerEntity().getBoundingBoxHeight(); playerBoundingBox.setMiddleY(playerBoundingBox.getMiddleY() - (playerBoundingBox.getSizeY() / 2.0) + (playerHeight / 2.0)); playerBoundingBox.setSizeY(playerHeight); } @@ -188,10 +186,7 @@ public class CollisionManager { public void recalculatePosition() { PlayerEntity entity = session.getPlayerEntity(); // Gravity might need to be reset... - SetEntityDataPacket entityDataPacket = new SetEntityDataPacket(); - entityDataPacket.setRuntimeEntityId(entity.getGeyserId()); - entityDataPacket.getMetadata().putAll(entity.getDirtyMetadata()); - session.sendUpstreamPacket(entityDataPacket); + entity.updateBedrockMetadata(); // TODO may not be necessary MovePlayerPacket movePlayerPacket = new MovePlayerPacket(); movePlayerPacket.setRuntimeEntityId(entity.getGeyserId()); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java index 8eca69333..28d965902 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java @@ -220,7 +220,7 @@ public class JavaCommandsTranslator extends PacketTranslator BlockRegistries.JAVA_TO_BEDROCK_IDENTIFIERS.get().keySet().toArray(new String[0]); case ITEM_STACK -> session.getItemMappings().getItemNames(); case ITEM_ENCHANTMENT -> Enchantment.JavaEnchantment.ALL_JAVA_IDENTIFIERS; - case ENTITY_SUMMON -> Registries.JAVA_ENTITY_IDENTIFIERS.get().keySet().toArray(new String[0]); //TODO add Marker + case ENTITY_SUMMON -> Registries.JAVA_ENTITY_IDENTIFIERS.get().keySet().toArray(new String[0]); case COLOR -> VALID_COLORS; case SCOREBOARD_SLOT -> VALID_SCOREBOARD_SLOTS; case MOB_EFFECT -> ALL_EFFECT_IDENTIFIERS; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java index ca7c92302..772e65846 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java @@ -90,10 +90,7 @@ public class JavaLoginTranslator extends PacketTranslator translator = (EntityMetadataTranslator) translators.get(metadata.getId()); + EntityMetadataTranslator translator = (EntityMetadataTranslator) translators.get(metadata.getId()); if (translator == null) { // This can safely happen; it means we don't translate this entity metadata continue; } if (translator.acceptedType() != metadata.getType()) { session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " was received with type " + metadata.getType() + " but we expected " + translator.acceptedType() + " for " + entity.getDefinition().entityType()); + if (session.getConnector().getConfig().isDebugMode()) { + session.getConnector().getLogger().debug(metadata.toString()); + } continue; } - translator.translateFunction().accept(entity, metadata); + translator.translateFunction().accept(entity, (EntityMetadata) metadata); } entity.updateBedrockMetadata(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java index f16c4aadf..3190a637b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java @@ -33,7 +33,6 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; -import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.EntityDefinitions; @@ -69,10 +68,7 @@ public class JavaPlayerPositionTranslator extends PacketTranslator bedrockOnlyBlockEntities = new ArrayList<>(); - DataPalette[] javaChunks = new DataPalette[session.getChunkCache().getChunkHeightY()]; - DataPalette[] javaBiomes = new DataPalette[session.getChunkCache().getChunkHeightY()]; + DataPalette[] javaChunks = new DataPalette[chunkSize]; + DataPalette[] javaBiomes = new DataPalette[chunkSize]; BitSet waterloggedPaletteIds = new BitSet(); BitSet pistonOrFlowerPaletteIds = new BitSet(); @@ -100,21 +100,21 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator> 4))]; try { NetInput in = new StreamNetInput(new ByteArrayInputStream(packet.getChunkData())); - for (int sectionY = 0; sectionY < session.getChunkCache().getChunkHeightY(); sectionY++) { + for (int sectionY = 0; sectionY < chunkSize; sectionY++) { + ChunkSection javaSection = ChunkSection.read(in); + javaChunks[sectionY] = javaSection.getChunkData(); + javaBiomes[sectionY] = javaSection.getBiomeData(); + int bedrockSectionY = sectionY + (yOffset - ((overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4)); if (bedrockSectionY < 0 || maxBedrockSectionY < bedrockSectionY) { // Ignore this chunk section since it goes outside the bounds accepted by the Bedrock client continue; } - ChunkSection javaSection = ChunkSection.read(in); - javaChunks[sectionY] = javaSection.getChunkData(); - javaBiomes[sectionY] = javaSection.getBiomeData(); - // No need to encode an empty section... if (javaSection.isBlockCountEmpty()) { continue; @@ -316,11 +316,11 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator entry : session.getItemFrameCache().entrySet()) { + Vector3i position = entry.getKey(); + if ((position.getX() >> 4) == packet.getX() && (position.getZ() >> 4) == packet.getZ()) { + // Update this item frame so it doesn't get lost in the abyss + //TODO optimize + entry.getValue().updateBlock(true); + } + } } } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java index 3a5f6b446..c4ca16042 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java @@ -136,18 +136,18 @@ public class JavaLevelParticlesTranslator extends PacketTranslator { LevelEventPacket packet = new LevelEventPacket(); - packet.setType(particleMapping.getLevelEventType()); + packet.setType(particleMapping.levelEventType()); packet.setPosition(position); return packet; }; - } else if (particleMapping.getIdentifier() != null) { + } else if (particleMapping.identifier() != null) { int dimensionId = DimensionUtils.javaToBedrock(session.getDimension()); return (position) -> { SpawnParticleEffectPacket stringPacket = new SpawnParticleEffectPacket(); - stringPacket.setIdentifier(particleMapping.getIdentifier()); + stringPacket.setIdentifier(particleMapping.identifier()); stringPacket.setDimensionId(dimensionId); stringPacket.setPosition(position); return stringPacket; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java b/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java index 2895ad214..d7fa03943 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java @@ -27,7 +27,6 @@ package org.geysermc.connector.network.translators.sound.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.living.animal.AnimalEntity; @@ -42,10 +41,10 @@ public class FeedBabySoundInteractionHandler implements EntitySoundInteractionHa @Override public void handleInteraction(GeyserSession session, Vector3f position, Entity entity) { - if (entity instanceof AnimalEntity && !(entity instanceof CatEntity || entity instanceof OcelotEntity)) { + if (entity instanceof AnimalEntity animalEntity && !(entity instanceof CatEntity || entity instanceof OcelotEntity)) { String handIdentifier = session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier(); - boolean isBaby = entity.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); - if (isBaby && ((AnimalEntity) entity).canEat(session, handIdentifier.replace("minecraft:", ""), + boolean isBaby = animalEntity.isBaby(); + if (isBaby && animalEntity.canEat(handIdentifier.replace("minecraft:", ""), session.getPlayerInventory().getItemInHand().getMapping(session))) { // Play the "feed child" effect EntityEventPacket feedEvent = new EntityEventPacket(); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java b/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java index 11f929f17..948b69afb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java @@ -43,7 +43,7 @@ public class MilkEntitySoundInteractionHandler implements EntitySoundInteraction if (!session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier().equals("minecraft:bucket")) { return; } - if (value.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY)) { + if (value.getFlag(EntityFlag.BABY)) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java index 9de4b946f..e05668b6f 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java @@ -32,6 +32,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.connector.registry.type.ParticleMapping; import java.util.Iterator; +import java.util.Locale; import java.util.Map; /** @@ -49,12 +50,10 @@ public class ParticleTypesRegistryLoader extends EffectRegistryLoader entry = particlesIterator.next(); JsonNode bedrockId = entry.getValue().get("bedrockId"); - JsonNode bedrockIdNumeric = entry.getValue().get("bedrockNumericId"); JsonNode eventType = entry.getValue().get("eventType"); - particles.put(ParticleType.valueOf(entry.getKey().toUpperCase()), new ParticleMapping( - eventType == null ? null : LevelEventType.valueOf(eventType.asText().toUpperCase()), - bedrockId == null ? null : bedrockId.asText(), - bedrockIdNumeric == null ? -1 : bedrockIdNumeric.asInt()) + particles.put(ParticleType.valueOf(entry.getKey().toUpperCase(Locale.ROOT)), new ParticleMapping( + eventType == null ? null : LevelEventType.valueOf(eventType.asText().toUpperCase(Locale.ROOT)), + bedrockId == null ? null : bedrockId.asText()) ); } } catch (Exception e) { diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java index 8f3e87e53..a7157960a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java +++ b/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java @@ -226,6 +226,8 @@ public class ItemRegistryPopulator { if (javaIdentifier.equals("minecraft:sculk_sensor")) { // TODO fix in mappings mappingItem.setBedrockIdentifier("minecraft:sculk_sensor"); + } else if (javaIdentifier.equals("minecraft:music_disc_otherside") && palette.getValue().protocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { + mappingItem.setBedrockIdentifier("minecraft:music_disc_pigstep"); } if (usingFurnaceMinecart && javaIdentifier.equals("minecraft:furnace_minecart")) { @@ -398,7 +400,7 @@ public class ItemRegistryPopulator { .count(1) .blockRuntimeId(mapping.getBedrockBlockId()) .build()); - } else if (javaIdentifier.startsWith("minecraft:music_disc_")) { + } else if (javaIdentifier.startsWith("minecraft:music_disc_") && !javaIdentifier.equals("minecraft:music_disc_otherside")) { // TODO TEMPORARY // The Java record level event uses the item ID as the "key" to play the record Registries.RECORDS.register(itemIndex, SoundEvent.valueOf("RECORD_" + javaIdentifier.replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH))); diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java b/connector/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java index 2ed21ddb3..fa7fcb300 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java +++ b/connector/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java @@ -26,14 +26,9 @@ package org.geysermc.connector.registry.type; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import lombok.Value; import javax.annotation.ParametersAreNullableByDefault; -@Value @ParametersAreNullableByDefault -public class ParticleMapping { - LevelEventType levelEventType; - String identifier; - int id; +public record ParticleMapping(LevelEventType levelEventType, String identifier) { } \ No newline at end of file diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java index df2923bb5..8015df8b7 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java @@ -152,7 +152,7 @@ public class ChunkUtils { ItemFrameEntity itemFrameEntity = ItemFrameEntity.getItemFrameEntity(session, position); if (itemFrameEntity != null) { if (blockState == JAVA_AIR_ID) { // Item frame is still present and no block overrides that; refresh it - itemFrameEntity.updateBlock(); + itemFrameEntity.updateBlock(true); // Still update the chunk cache with the new block session.getChunkCache().updateBlock(position.getX(), position.getY(), position.getZ(), blockState); return; diff --git a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java index 692b26d85..7016cc786 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java @@ -50,7 +50,7 @@ public class EffectUtils { return -1; } - LevelEventType levelEventType = mapping.getLevelEventType(); + LevelEventType levelEventType = mapping.levelEventType(); if (levelEventType == null) { return -1; } diff --git a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java index 57c0eac73..f0de018ff 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java @@ -28,7 +28,6 @@ package org.geysermc.connector.utils; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.EntityDefinitions; @@ -70,7 +69,7 @@ public final class EntityUtils { } private static float getMountedHeightOffset(Entity mount) { - float height = mount.getDirtyMetadata().getFloat(EntityData.BOUNDING_BOX_HEIGHT); + float height = mount.getBoundingBoxHeight(); float mountedHeightOffset = height * 0.75f; switch (mount.getDefinition().entityType()) { case CHICKEN, SPIDER -> mountedHeightOffset = height * 0.5f; @@ -80,7 +79,7 @@ public final class EntityUtils { MINECART_COMMAND_BLOCK -> mountedHeightOffset = 0; case BOAT -> mountedHeightOffset = -0.1f; case HOGLIN, ZOGLIN -> { - boolean isBaby = mount.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); + boolean isBaby = mount.getFlag(EntityFlag.BABY); mountedHeightOffset = height - (isBaby ? 0.2f : 0.15f); } case PIGLIN -> mountedHeightOffset = height * 0.92f; @@ -110,10 +109,10 @@ public final class EntityUtils { case PIGLIN: case PIGLIN_BRUTE: case ZOMBIFIED_PIGLIN: - isBaby = passenger.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); + isBaby = passenger.getFlag(EntityFlag.BABY); return isBaby ? -0.05f : -0.45f; case ZOMBIE: - isBaby = passenger.getDirtyMetadata().getFlags().getFlag(EntityFlag.BABY); + isBaby = passenger.getFlag(EntityFlag.BABY); return isBaby ? 0.0f : -0.45f; case EVOKER: case ILLUSIONER: @@ -174,7 +173,7 @@ public final class EntityUtils { MINECART_COMMAND_BLOCK, BOAT -> yOffset -= mount.getDefinition().height() * 0.5f; } Vector3f offset = Vector3f.from(xOffset, yOffset, zOffset); - passenger.getDirtyMetadata().put(EntityData.RIDER_SEAT_POSITION, offset); + passenger.setRiderSeatPosition(offset); } passenger.updateBedrockMetadata(); } diff --git a/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java b/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java index 0f7e66250..c43b19b92 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java +++ b/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java @@ -86,7 +86,7 @@ public class InteractiveTagManager { // Holding a leash and the mob is leashable for sure // (Plugins can change this behavior so that's something to look into in the far far future) interactiveTag = InteractiveTag.LEASH; - } else if (interactEntity instanceof AnimalEntity && ((AnimalEntity) interactEntity).canEat(session, javaIdentifierStripped, mapping)) { + } else if (interactEntity instanceof AnimalEntity && ((AnimalEntity) interactEntity).canEat(javaIdentifierStripped, mapping)) { // This animal can be fed interactiveTag = InteractiveTag.FEED; } else { From 27ce6c4b366e16886eca0f40ee5b5c6b75e2093d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 19 Nov 2021 14:55:54 -0500 Subject: [PATCH 687/766] Annotation processors use Java 16 So build stops complaining about it. --- .../main/java/org/geysermc/processor/BlockEntityProcessor.java | 2 +- .../java/org/geysermc/processor/CollisionRemapperProcessor.java | 2 +- .../main/java/org/geysermc/processor/ItemRemapperProcessor.java | 2 +- .../java/org/geysermc/processor/PacketTranslatorProcessor.java | 2 +- .../main/java/org/geysermc/processor/SoundHandlerProcessor.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java index ecb69b604..05047ab6c 100644 --- a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java @@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_8) +@SupportedSourceVersion(SourceVersion.RELEASE_16) public class BlockEntityProcessor extends ClassProcessor { public BlockEntityProcessor() { super("org.geysermc.connector.network.translators.world.block.entity.BlockEntity"); diff --git a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java index dafed179d..e275d1d3d 100644 --- a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java @@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_8) +@SupportedSourceVersion(SourceVersion.RELEASE_16) public class CollisionRemapperProcessor extends ClassProcessor { public CollisionRemapperProcessor() { super("org.geysermc.connector.network.translators.collision.CollisionRemapper"); diff --git a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java index 6f146e720..8971687bf 100644 --- a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java @@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_8) +@SupportedSourceVersion(SourceVersion.RELEASE_16) public class ItemRemapperProcessor extends ClassProcessor { public ItemRemapperProcessor() { super("org.geysermc.connector.network.translators.ItemRemapper"); diff --git a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java index 5225c4839..03b859421 100644 --- a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java @@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_8) +@SupportedSourceVersion(SourceVersion.RELEASE_16) public class PacketTranslatorProcessor extends ClassProcessor { public PacketTranslatorProcessor() { super("org.geysermc.connector.network.translators.Translator"); diff --git a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java index cd0b4a437..74cf199bc 100644 --- a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java @@ -30,7 +30,7 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_8) +@SupportedSourceVersion(SourceVersion.RELEASE_16) public class SoundHandlerProcessor extends ClassProcessor { public SoundHandlerProcessor() { super("org.geysermc.connector.network.translators.sound.SoundHandler"); From 66d578eadc08d8727417e77713fca3ca066ff5a0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 19 Nov 2021 19:11:36 -0500 Subject: [PATCH 688/766] Implement proper biome palette reading probably With thanks to @kennytv for the magic required to get global palette bits. --- .../org/geysermc/connector/entity/EntityDefinitions.java | 5 +++++ .../geysermc/connector/network/session/GeyserSession.java | 5 +++++ .../java/level/JavaLevelChunkWithLightTranslator.java | 5 +++-- .../network/translators/world/BiomeTranslator.java | 2 ++ .../registry/loader/ParticleTypesRegistryLoader.java | 8 +++++++- .../main/java/org/geysermc/connector/utils/MathUtils.java | 7 +++++++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java index be51687c0..677ec1d3b 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java @@ -695,6 +695,7 @@ public final class EntityDefinitions { .type(EntityType.WITCH) .height(1.8f).width(0.6f) .offset(1.62f) + .addTranslator(null) // Using item .build(); } @@ -792,8 +793,12 @@ public final class EntityDefinitions { TURTLE = EntityDefinition.inherited(TurtleEntity::new, ageableEntityBase) .type(EntityType.TURTLE) .height(0.4f).width(1.2f) + .addTranslator(null) // Home position .addTranslator(MetadataType.BOOLEAN, TurtleEntity::setPregnant) .addTranslator(MetadataType.BOOLEAN, TurtleEntity::setLayingEgg) + .addTranslator(null) // Travel position + .addTranslator(null) // Going home + .addTranslator(null) // Travelling .build(); EntityDefinition abstractVillagerEntityBase = EntityDefinition.inherited(AbstractMerchantEntity::new, ageableEntityBase) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 72dcf3710..339509d6b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -204,6 +204,11 @@ public class GeyserSession implements CommandSender { private final Map skullCache = new Object2ObjectOpenHashMap<>(); private final Long2ObjectMap storedMaps = new Long2ObjectOpenHashMap<>(); + /** + * Required to decode biomes correctly. + */ + @Setter + private int biomeGlobalPalette; /** * Stores the map between Java and Bedrock biome network IDs. */ diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java index 6a4add70c..9fd862dfe 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -85,6 +85,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator bedrockOnlyBlockEntities = new ArrayList<>(); @@ -105,7 +106,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator entry = particlesIterator.next(); + String key = entry.getKey().toUpperCase(Locale.ROOT); JsonNode bedrockId = entry.getValue().get("bedrockId"); JsonNode eventType = entry.getValue().get("eventType"); - particles.put(ParticleType.valueOf(entry.getKey().toUpperCase(Locale.ROOT)), new ParticleMapping( + if (eventType == null && bedrockId == null) { + GeyserConnector.getInstance().getLogger().debug("Skipping particle mapping " + key + " because no Bedrock equivalent exists."); + continue; + } + particles.put(ParticleType.valueOf(key), new ParticleMapping( eventType == null ? null : LevelEventType.valueOf(eventType.asText().toUpperCase(Locale.ROOT)), bedrockId == null ? null : bedrockId.asText()) ); diff --git a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java b/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java index 927f72202..3ccf812d3 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java @@ -105,4 +105,11 @@ public class MathUtils { public static long chunkPositionToLong(int x, int z) { return ((x & 0xFFFFFFFFL) << 32L) | (z & 0xFFFFFFFFL); } + + /** + * @return the bits per entry used when this number is the maximum amount of entries. + */ + public static int getGlobalPaletteForSize(int size) { + return 32 - Integer.numberOfLeadingZeros(size - 1); + } } From 03ff725e4763c0d8236b3d94620a483b38435041 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 19 Nov 2021 19:15:38 -0500 Subject: [PATCH 689/766] Remove old biome translation code --- .../translators/world/BiomeTranslator.java | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java index 78c66e94b..11c114850 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java @@ -37,8 +37,6 @@ import org.geysermc.connector.network.translators.world.chunk.bitarray.Singleton import org.geysermc.connector.registry.Registries; import org.geysermc.connector.utils.MathUtils; -import java.util.Arrays; - // Based off of ProtocolSupport's LegacyBiomeData.java: // https://github.com/ProtocolSupport/ProtocolSupport/blob/b2cad35977f3fcb65bee57b9e14fc9c975f71d32/src/protocolsupport/protocol/typeremapper/legacy/LegacyBiomeData.java // Array index formula by https://wiki.vg/Chunk_Format @@ -84,26 +82,6 @@ public class BiomeTranslator { } } - public static byte[] toBedrockBiome(GeyserSession session, int[] biomeData) { - byte[] bedrockData = new byte[256]; - if (biomeData == null) { - return bedrockData; - } - Int2IntMap biomeTranslations = session.getBiomeTranslations(); - - for (int y = 0; y < 16; y += 4) { - for (int z = 0; z < 16; z += 4) { - for (int x = 0; x < 16; x += 4) { - int javaId = biomeData[((y >> 2) & 63) << 4 | ((z >> 2) & 3) << 2 | ((x >> 2) & 3)]; - byte biomeId = (byte) biomeTranslations.getOrDefault(javaId, javaId); - int offset = ((z + (y / 4)) << 4) | x; - Arrays.fill(bedrockData, offset, offset + 4, biomeId); - } - } - } - return bedrockData; - } - public static BlockStorage toNewBedrockBiome(GeyserSession session, DataPalette biomeData) { Int2IntMap biomeTranslations = session.getBiomeTranslations(); // As of 1.17.10: the client expects the same format as a chunk but filled with biomes From 96e60e043a3a0bc2ef78c15d276f8f18e042d28d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 19 Nov 2021 21:37:26 -0500 Subject: [PATCH 690/766] Add missing entity metadata ID for fireworks --- .../java/org/geysermc/connector/entity/EntityDefinitions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java index 677ec1d3b..f4324bcd3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java @@ -252,6 +252,7 @@ public final class EntityDefinitions { .identifier("minecraft:fireworks_rocket") .addTranslator(MetadataType.ITEM, FireworkEntity::setFireworkItem) .addTranslator(MetadataType.OPTIONAL_VARINT, FireworkEntity::setPlayerGliding) + .addTranslator(null) // Shot at angle .build(); FISHING_BOBBER = EntityDefinition.inherited(null, entityBase) .type(EntityType.FISHING_BOBBER) From f797f8487885ae1f5a16fa63d31b4ae317c46318 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 19 Nov 2021 21:37:38 -0500 Subject: [PATCH 691/766] Optimize biome translation to take advantage of palettes --- .../translators/world/BiomeTranslator.java | 82 ++++++++++++++----- 1 file changed, 61 insertions(+), 21 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java index 11c114850..a61bfc985 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java @@ -25,20 +25,25 @@ package org.geysermc.connector.network.translators.world; +import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; +import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette; +import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette; import com.github.steveice10.mc.protocol.data.game.chunk.palette.SingletonPalette; import com.github.steveice10.opennbt.tag.builtin.*; import it.unimi.dsi.fastutil.ints.Int2IntMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.world.chunk.BlockStorage; import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; +import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; +import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; import org.geysermc.connector.network.translators.world.chunk.bitarray.SingletonBitArray; import org.geysermc.connector.registry.Registries; import org.geysermc.connector.utils.MathUtils; -// Based off of ProtocolSupport's LegacyBiomeData.java: -// https://github.com/ProtocolSupport/ProtocolSupport/blob/b2cad35977f3fcb65bee57b9e14fc9c975f71d32/src/protocolsupport/protocol/typeremapper/legacy/LegacyBiomeData.java // Array index formula by https://wiki.vg/Chunk_Format public class BiomeTranslator { @@ -87,32 +92,67 @@ public class BiomeTranslator { // As of 1.17.10: the client expects the same format as a chunk but filled with biomes // As of 1.18 this is the same as Java Edition - if (biomeData.getPalette() instanceof SingletonPalette palette) { + Palette palette = biomeData.getPalette(); + if (palette instanceof SingletonPalette) { int biomeId = biomeTranslations.get(palette.idToState(0)); return new BlockStorage(SingletonBitArray.INSTANCE, IntLists.singleton(biomeId)); } else { - BlockStorage storage = new BlockStorage(0); + BlockStorage storage; + if (!(palette instanceof GlobalPalette)) { + // Prevent resizing by allocating what we can ahead of time + BitStorage bitStorage = biomeData.getStorage(); + int size = palette.size(); + BitArray bitArray = BitArrayVersion.forBitsCeil(bitStorage.getBitsPerEntry()) + .createArray(BlockStorage.SIZE); - // Each section of biome corresponding to a chunk section contains 4 * 4 * 4 entries - for (int i = 0; i < 64; i++) { - int javaId = biomeData.getPalette().idToState(biomeData.getStorage().get(i)); - int x = i & 3; - int y = (i >> 4) & 3; - int z = (i >> 2) & 3; - // Get the Bedrock biome ID override - int biomeId = biomeTranslations.get(javaId); - int idx = storage.idFor(biomeId); - // Convert biome coordinates into block coordinates - // Bedrock expects a full 4096 blocks - for (int blockX = x << 2; blockX < (x << 2) + 4; blockX++) { - for (int blockZ = z << 2; blockZ < (z << 2) + 4; blockZ++) { - for (int blockY = y << 2; blockY < (y << 2) + 4; blockY++) { - storage.getBitArray().set(GeyserChunkSection.blockPosition(blockX, blockY, blockZ), idx); - } - } + IntList bedrockPalette = new IntArrayList(size); + + for (int i = 0; i < size; i++) { + int javaId = palette.idToState(i); + bedrockPalette.add(biomeTranslations.get(javaId)); + } + + // Each section of biome corresponding to a chunk section contains 4 * 4 * 4 entries + for (int i = 0; i < 64; i++) { + int idx = bitStorage.get(i); + int x = i & 3; + int y = (i >> 4) & 3; + int z = (i >> 2) & 3; + // Convert biome coordinates into block coordinates + // Bedrock expects a full 4096 blocks + multiplyIdToStorage(bitArray, idx, x, y, z); + } + + storage = new BlockStorage(bitArray, bedrockPalette); + } else { + storage = new BlockStorage(0); + BitArray bitArray = storage.getBitArray(); + + // Each section of biome corresponding to a chunk section contains 4 * 4 * 4 entries + for (int i = 0; i < 64; i++) { + int javaId = biomeData.getPalette().idToState(biomeData.getStorage().get(i)); + int x = i & 3; + int y = (i >> 4) & 3; + int z = (i >> 2) & 3; + // Get the Bedrock biome ID override + int biomeId = biomeTranslations.get(javaId); + int idx = storage.idFor(biomeId); + // Convert biome coordinates into block coordinates + // Bedrock expects a full 4096 blocks + multiplyIdToStorage(bitArray, idx, x, y, z); } } return storage; } } + + private static void multiplyIdToStorage(BitArray bitArray, int idx, int x, int y, int z) { + for (int blockX = x << 2; blockX < (x << 2) + 4; blockX++) { + for (int blockZ = z << 2; blockZ < (z << 2) + 4; blockZ++) { + for (int blockY = y << 2; blockY < (y << 2) + 4; blockY++) { + bitArray.set(GeyserChunkSection.blockPosition(blockX, blockY, blockZ), idx); + } + } + } + } } From 1e0b312d9dc3971248e72bfadeccf8625b4e66a4 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 20 Nov 2021 13:25:21 -0600 Subject: [PATCH 692/766] Update to support MCProtocolLib entity metadata changes --- .../connector/entity/AbstractArrowEntity.java | 5 ++- .../entity/AreaEffectCloudEntity.java | 6 ++-- .../geysermc/connector/entity/BoatEntity.java | 13 ++++---- .../entity/DefaultBlockMinecartEntity.java | 11 +++---- .../connector/entity/EnderCrystalEntity.java | 10 +++--- .../org/geysermc/connector/entity/Entity.java | 33 ++++++++++--------- .../connector/entity/EntityDefinition.java | 30 ++++++++++++++--- .../connector/entity/EntityDefinitions.java | 33 +++++++++---------- .../entity/EntityMetadataTranslator.java | 7 ++-- .../connector/entity/FallingBlockEntity.java | 5 ++- .../connector/entity/FireworkEntity.java | 4 +-- .../connector/entity/FishingHookEntity.java | 5 ++- .../entity/FurnaceMinecartEntity.java | 5 ++- .../geysermc/connector/entity/ItemEntity.java | 2 +- .../connector/entity/ItemFrameEntity.java | 6 ++-- .../connector/entity/LivingEntity.java | 19 ++++++----- .../connector/entity/MinecartEntity.java | 13 ++++---- .../geysermc/connector/entity/TNTEntity.java | 2 +- .../connector/entity/ThrownPotionEntity.java | 2 +- .../connector/entity/TippedArrowEntity.java | 5 ++- .../connector/entity/WitherSkullEntity.java | 5 ++- .../entity/living/AgeableEntity.java | 5 ++- .../entity/living/ArmorStandEntity.java | 19 ++++++----- .../connector/entity/living/BatEntity.java | 5 ++- .../connector/entity/living/MobEntity.java | 5 ++- .../connector/entity/living/SlimeEntity.java | 5 ++- .../entity/living/SnowGolemEntity.java | 5 ++- .../entity/living/animal/AxolotlEntity.java | 9 +++-- .../entity/living/animal/BeeEntity.java | 9 +++-- .../entity/living/animal/FoxEntity.java | 10 +++--- .../entity/living/animal/GoatEntity.java | 5 ++- .../entity/living/animal/HoglinEntity.java | 5 ++- .../entity/living/animal/PandaEntity.java | 17 +++++----- .../living/animal/PufferFishEntity.java | 5 ++- .../entity/living/animal/RabbitEntity.java | 8 ++--- .../entity/living/animal/SheepEntity.java | 2 +- .../entity/living/animal/StriderEntity.java | 9 +++-- .../living/animal/TropicalFishEntity.java | 5 ++- .../entity/living/animal/TurtleEntity.java | 9 +++-- .../animal/horse/AbstractHorseEntity.java | 5 ++- .../living/animal/horse/HorseEntity.java | 5 ++- .../living/animal/horse/LlamaEntity.java | 5 ++- .../living/animal/tameable/CatEntity.java | 16 ++++----- .../animal/tameable/TameableEntity.java | 11 ++++--- .../living/animal/tameable/WolfEntity.java | 13 ++++---- .../living/merchant/VillagerEntity.java | 5 +-- .../monster/AbstractSkeletonEntity.java | 5 ++- .../living/monster/BasePiglinEntity.java | 5 ++- .../entity/living/monster/BlazeEntity.java | 5 ++- .../entity/living/monster/CreeperEntity.java | 13 ++++---- .../living/monster/EnderDragonEntity.java | 8 ++--- .../entity/living/monster/EndermanEntity.java | 13 ++++---- .../entity/living/monster/GhastEntity.java | 5 ++- .../entity/living/monster/GuardianEntity.java | 5 ++- .../entity/living/monster/PhantomEntity.java | 5 ++- .../entity/living/monster/PiglinEntity.java | 13 ++++---- .../entity/living/monster/ShulkerEntity.java | 10 +++--- .../entity/living/monster/SkeletonEntity.java | 5 ++- .../entity/living/monster/SpiderEntity.java | 5 ++- .../entity/living/monster/VexEntity.java | 5 ++- .../entity/living/monster/WitherEntity.java | 15 ++++----- .../entity/living/monster/ZoglinEntity.java | 5 ++- .../entity/living/monster/ZombieEntity.java | 9 +++-- .../living/monster/ZombieVillagerEntity.java | 6 ++-- .../raid/SpellcasterIllagerEntity.java | 5 ++- .../living/monster/raid/VindicatorEntity.java | 5 ++- .../connector/entity/player/PlayerEntity.java | 20 ++++++----- .../entity/player/SessionPlayerEntity.java | 12 +++---- .../entity/JavaSetEntityDataTranslator.java | 26 +++++---------- .../loader/EnchantmentRegistryLoader.java | 1 + .../loader/ParticleTypesRegistryLoader.java | 1 + 71 files changed, 301 insertions(+), 324 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java index be07a12ce..27ca23a2e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; @@ -45,8 +44,8 @@ public class AbstractArrowEntity extends Entity { setMotion(motion); } - public void setArrowFlags(EntityMetadata entityMetadata) { - byte data = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setArrowFlags(ByteEntityMetadata entityMetadata) { + byte data = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.CRITICAL, (data & 0x01) == 0x01); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java index 1c2830232..3e91ba0e5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java @@ -56,13 +56,13 @@ public class AreaEffectCloudEntity extends Entity { setFlag(EntityFlag.FIRE_IMMUNE, true); } - public void setRadius(EntityMetadata entityMetadata) { - float value = ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setRadius(FloatEntityMetadata entityMetadata) { + float value = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, value); dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * value); } - public void setParticle(EntityMetadata entityMetadata) { + public void setParticle(EntityMetadata entityMetadata) { Particle particle = entityMetadata.getValue(); int particleId = EffectUtils.getParticleId(session, particle.getType()); if (particleId != -1) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index 7069f5cfb..8283511cb 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -114,13 +113,13 @@ public class BoatEntity extends Entity { moveRelative(0, 0, 0, yaw + 90, 0, 0, isOnGround); } - public void setVariant(EntityMetadata entityMetadata) { - variant = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setVariant(IntEntityMetadata entityMetadata) { + variant = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.VARIANT, variant); } - public void setPaddlingLeft(EntityMetadata entityMetadata) { - isPaddlingLeft = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPaddlingLeft(BooleanEntityMetadata entityMetadata) { + isPaddlingLeft = entityMetadata.getPrimitiveValue(); if (isPaddlingLeft) { // Java sends simply "true" and "false" (is_paddling_left), Bedrock keeps sending packets as you're rowing // This is an asynchronous method that emulates Bedrock rowing until "false" is sent. @@ -138,8 +137,8 @@ public class BoatEntity extends Entity { } } - public void setPaddlingRight(EntityMetadata entityMetadata) { - isPaddlingRight = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPaddlingRight(BooleanEntityMetadata entityMetadata) { + isPaddlingRight = entityMetadata.getPrimitiveValue(); if (isPaddlingRight) { paddleTimeRight = 0f; if (!this.passengers.isEmpty()) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java index f4991b312..bcc88c33f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -56,7 +55,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { } @Override - public void setCustomBlock(EntityMetadata entityMetadata) { + public void setCustomBlock(IntEntityMetadata entityMetadata) { customBlock = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); if (showCustomBlock) { @@ -65,8 +64,8 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { } @Override - public void setCustomBlockOffset(EntityMetadata entityMetadata) { - customBlockOffset = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setCustomBlockOffset(IntEntityMetadata entityMetadata) { + customBlockOffset = entityMetadata.getPrimitiveValue(); if (showCustomBlock) { dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); @@ -74,8 +73,8 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { } @Override - public void setShowCustomBlock(EntityMetadata entityMetadata) { - if (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()) { + public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) { + if (entityMetadata.getPrimitiveValue()) { showCustomBlock = true; dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); diff --git a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java index df7c041b3..1a8a9bd5f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java @@ -33,6 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.network.session.GeyserSession; +import java.util.Optional; import java.util.UUID; public class EnderCrystalEntity extends Entity { @@ -48,12 +49,13 @@ public class EnderCrystalEntity extends Entity { setFlag(EntityFlag.FIRE_IMMUNE, true); } - public void setBlockTarget(EntityMetadata entityMetadata) { + public void setBlockTarget(EntityMetadata, ?> entityMetadata) { // Show beam // Usually performed client-side on Bedrock except for Ender Dragon respawn event - Position position = entityMetadata.getValue(); - if (position != null) { - dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.from(position.getX(), position.getY(), position.getZ())); + Optional optionalPos = entityMetadata.getValue(); + if (optionalPos.isPresent()) { + Position pos = optionalPos.get(); + dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.from(pos.getX(), pos.getY(), pos.getZ())); } else { dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.ZERO); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/connector/src/main/java/org/geysermc/connector/entity/Entity.java index 3bf5a3a16..db7f92dca 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/Entity.java @@ -47,6 +47,7 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.chat.MessageTranslator; import org.geysermc.connector.utils.MathUtils; +import java.util.Optional; import java.util.UUID; @Getter @@ -120,7 +121,7 @@ public class Entity { this.valid = false; setPosition(position); - setAir(getMaxAir()); + setAirSupply(getMaxAir()); initializeMetadata(); } @@ -304,8 +305,8 @@ public class Entity { } } - public void setFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.ON_FIRE, ((xd & 0x01) == 0x01) && !getFlag(EntityFlag.FIRE_IMMUNE)); // Otherwise immune entities sometimes flicker onfire setFlag(EntityFlag.SNEAKING, (xd & 0x02) == 0x02); setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08); @@ -327,11 +328,11 @@ public class Entity { /** * Set an int from 0 - this entity's maximum air - (air / maxAir) represents the percentage of bubbles left */ - public final void setAir(EntityMetadata entityMetadata) { - setAir(((IntEntityMetadata) entityMetadata).getPrimitiveValue()); + public final void setAir(IntEntityMetadata entityMetadata) { + setAirSupply(entityMetadata.getPrimitiveValue()); } - protected void setAir(int amount) { + protected void setAirSupply(int amount) { dirtyMetadata.put(EntityData.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); } @@ -339,10 +340,10 @@ public class Entity { return 300; } - public void setDisplayName(EntityMetadata entityMetadata) { - Component name = entityMetadata.getValue(); - if (name != null) { - nametag = MessageTranslator.convertMessage(name, session.getLocale()); + public void setDisplayName(EntityMetadata, ?> entityMetadata) { + Optional name = entityMetadata.getValue(); + if (name.isPresent()) { + nametag = MessageTranslator.convertMessage(name.get(), session.getLocale()); dirtyMetadata.put(EntityData.NAMETAG, nametag); } else if (!nametag.isEmpty()) { // Clear nametag @@ -350,18 +351,18 @@ public class Entity { } } - public void setDisplayNameVisible(EntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)); + public void setDisplayNameVisible(BooleanEntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); } - public void setGravity(EntityMetadata entityMetadata) { - setFlag(EntityFlag.HAS_GRAVITY, !((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setGravity(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.HAS_GRAVITY, !entityMetadata.getPrimitiveValue()); } /** * Usually used for bounding box and not animation. */ - public void setPose(EntityMetadata entityMetadata) { + public void setPose(EntityMetadata entityMetadata) { Pose pose = entityMetadata.getValue(); setFlag(EntityFlag.SLEEPING, pose.equals(Pose.SLEEPING)); @@ -396,7 +397,7 @@ public class Entity { /** * Set a float from 0-1 - how strong the "frozen" overlay should be on screen. */ - public float setFreezing(EntityMetadata entityMetadata) { + public float setFreezing(IntEntityMetadata entityMetadata) { // The value that Java edition gives us is in ticks, but Bedrock uses a float percentage of the strength 0.0 -> 1.0 // The Java client caps its freezing tick percentage at 140 int freezingTicks = Math.min(((IntEntityMetadata) entityMetadata).getPrimitiveValue(), 140); diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java index e4baf1ed4..d0c7c3826 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java @@ -31,6 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Setter; import lombok.experimental.Accessors; +import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.entity.factory.BaseEntityFactory; import org.geysermc.connector.entity.factory.EntityFactory; import org.geysermc.connector.registry.Registries; @@ -47,7 +48,7 @@ import java.util.function.BiConsumer; * @param the entity type this definition represents */ public record EntityDefinition(EntityFactory factory, EntityType entityType, String identifier, - float width, float height, float offset, List> translators) { + float width, float height, float offset, List> translators) { public static Builder inherited(BaseEntityFactory factory, EntityDefinition parent) { return inherited((EntityFactory) factory, parent); @@ -61,6 +62,25 @@ public record EntityDefinition(EntityFactory factory, Entit return new Builder<>(factory); } + + public void translateMetadata(T entity, EntityMetadata> metadata) { + EntityMetadataTranslator>> translator = (EntityMetadataTranslator>>) this.translators.get(metadata.getId()); + if (translator == null) { + // This can safely happen; it means we don't translate this entity metadata + return; + } + + if (translator.acceptedType() != metadata.getType()) { + GeyserConnector.getInstance().getLogger().warning("Metadata ID " + metadata.getId() + " was received with type " + metadata.getType() + " but we expected " + translator.acceptedType() + " for " + entity.getDefinition().entityType()); + if (GeyserConnector.getInstance().getConfig().isDebugMode()) { + GeyserConnector.getInstance().getLogger().debug(metadata.toString()); + } + return; + } + + translator.translateFunction().accept(entity, metadata); + } + @Setter @Accessors(fluent = true, chain = true) public static class Builder { @@ -70,14 +90,14 @@ public record EntityDefinition(EntityFactory factory, Entit private float width; private float height; private float offset; - private final List> translators; + private final List> translators; private Builder(EntityFactory factory) { this.factory = factory; translators = new ObjectArrayList<>(); } - public Builder(EntityFactory factory, EntityType type, String identifier, float width, float height, float offset, List> translators) { + public Builder(EntityFactory factory, EntityType type, String identifier, float width, float height, float offset, List> translators) { this.factory = factory; this.type = type; this.identifier = identifier; @@ -105,12 +125,12 @@ public record EntityDefinition(EntityFactory factory, Entit return this; } - public Builder addTranslator(MetadataType type, BiConsumer> translateFunction) { + public >> Builder addTranslator(MetadataType type, BiConsumer translateFunction) { translators.add(new EntityMetadataTranslator<>(type, translateFunction)); return this; } - public Builder addTranslator(EntityMetadataTranslator translator) { + public Builder addTranslator(EntityMetadataTranslator translator) { translators.add(translator); return this; } diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java index f4324bcd3..4700b81c5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java @@ -31,7 +31,6 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEnt import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import net.kyori.adventure.text.Component; import org.geysermc.connector.entity.factory.BaseEntityFactory; import org.geysermc.connector.entity.factory.ExperienceOrbEntityFactory; import org.geysermc.connector.entity.factory.PaintingEntityFactory; @@ -182,7 +181,7 @@ public final class EntityDefinitions { .addTranslator(MetadataType.INT, Entity::setAir) // Air/bubbles .addTranslator(MetadataType.OPTIONAL_CHAT, Entity::setDisplayName) .addTranslator(MetadataType.BOOLEAN, Entity::setDisplayNameVisible) - .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.SILENT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.SILENT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(MetadataType.BOOLEAN, Entity::setGravity) .addTranslator(MetadataType.POSE, Entity::setPose) .addTranslator(MetadataType.INT, Entity::setFreezing) @@ -204,7 +203,7 @@ public final class EntityDefinitions { .offset(0.35f) .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_TIME, entityMetadata.getValue())) // Time since last hit .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.HURT_DIRECTION, entityMetadata.getValue())) // Rocking direction - .addTranslator(MetadataType.FLOAT, (boatEntity, entityMetadata) -> + .addTranslator(MetadataType.FLOAT, (boatEntity, entityMetadata) -> // 'Health' in Bedrock, damage taken in Java - it makes motion in Bedrock boatEntity.getDirtyMetadata().put(EntityData.HEALTH, 40 - ((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue()))) .addTranslator(MetadataType.INT, BoatEntity::setVariant) @@ -220,7 +219,7 @@ public final class EntityDefinitions { .type(EntityType.END_CRYSTAL) .heightAndWidth(2.0f) .addTranslator(MetadataType.OPTIONAL_POSITION, EnderCrystalEntity::setBlockTarget) - .addTranslator(MetadataType.BOOLEAN, + .addTranslator(MetadataType.BOOLEAN, (enderCrystalEntity, entityMetadata) -> enderCrystalEntity.setFlag(EntityFlag.SHOW_BOTTOM, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) // There is a base located on the ender crystal .build(); EXPERIENCE_ORB = EntityDefinition.inherited((ExperienceOrbEntityFactory) ExpOrbEntity::new, entityBase) @@ -337,7 +336,7 @@ public final class EntityDefinitions { .type(EntityType.TRIDENT) .identifier("minecraft:thrown_trident") .addTranslator(null) // Loyalty - .addTranslator(MetadataType.BOOLEAN, (tridentEntity, entityMetadata) -> tridentEntity.setFlag(EntityFlag.ENCHANTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (tridentEntity, entityMetadata) -> tridentEntity.setFlag(EntityFlag.ENCHANTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); // Item frames are handled differently as they are blocks, not items, in Bedrock @@ -356,7 +355,7 @@ public final class EntityDefinitions { .offset(0.35f) .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HEALTH, entityMetadata.getValue())) .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HURT_DIRECTION, entityMetadata.getValue())) // Direction in which the minecart is shaking - .addTranslator(MetadataType.FLOAT, (minecartEntity, entityMetadata) -> + .addTranslator(MetadataType.FLOAT, (minecartEntity, entityMetadata) -> // Power in Java, time in Bedrock minecartEntity.getDirtyMetadata().put(EntityData.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15))) .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlock) @@ -371,7 +370,7 @@ public final class EntityDefinitions { .type(EntityType.MINECART_COMMAND_BLOCK) .identifier("minecraft:command_block_minecart") .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) - .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) + .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) .build(); MINECART_FURNACE = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) .type(EntityType.MINECART_FURNACE) @@ -403,9 +402,9 @@ public final class EntityDefinitions { EntityDefinition livingEntityBase = EntityDefinition.inherited(LivingEntity::new, entityBase) .addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags) .addTranslator(MetadataType.FLOAT, LivingEntity::setHealth) - .addTranslator(MetadataType.INT, + .addTranslator(MetadataType.INT, (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) - .addTranslator(MetadataType.BOOLEAN, + .addTranslator(MetadataType.BOOLEAN, (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0))) .addTranslator(null) // Arrow count .addTranslator(null) // Stinger count @@ -460,7 +459,7 @@ public final class EntityDefinitions { .height(1.7f).width(0.6f) .offset(1.62f) .addTranslator(MetadataType.INT, CreeperEntity::setSwelling) - .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.POWERED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.POWERED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(MetadataType.BOOLEAN, CreeperEntity::setIgnited) .build(); DOLPHIN = EntityDefinition.inherited(WaterEntity::new, mobEntityBase) @@ -746,12 +745,12 @@ public final class EntityDefinitions { MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase) // TODO remove class .type(EntityType.MOOSHROOM) .height(1.4f).width(0.9f) - .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue().equals("brown") ? 1 : 0)) + .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue().equals("brown") ? 1 : 0)) .build(); OCELOT = EntityDefinition.inherited(OcelotEntity::new, ageableEntityBase) .type(EntityType.OCELOT) .height(0.35f).width(0.3f) - .addTranslator(MetadataType.BOOLEAN, (ocelotEntity, entityMetadata) -> ocelotEntity.setFlag(EntityFlag.TRUSTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (ocelotEntity, entityMetadata) -> ocelotEntity.setFlag(EntityFlag.TRUSTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); PANDA = EntityDefinition.inherited(PandaEntity::new, ageableEntityBase) .type(EntityType.PANDA) @@ -766,13 +765,13 @@ public final class EntityDefinitions { PIG = EntityDefinition.inherited(PigEntity::new, ageableEntityBase) .type(EntityType.PIG) .heightAndWidth(0.9f) - .addTranslator(MetadataType.BOOLEAN, (pigEntity, entityMetadata) -> pigEntity.setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (pigEntity, entityMetadata) -> pigEntity.setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(null) // Boost time .build(); POLAR_BEAR = EntityDefinition.inherited(PolarBearEntity::new, ageableEntityBase) .type(EntityType.POLAR_BEAR) .height(1.4f).width(1.3f) - .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.STANDING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.STANDING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); RABBIT = EntityDefinition.inherited(RabbitEntity::new, ageableEntityBase) .type(EntityType.RABBIT) @@ -839,7 +838,7 @@ public final class EntityDefinitions { .height(1.6f).width(1.3965f) .build(); EntityDefinition chestedHorseEntityBase = EntityDefinition.inherited(ChestedHorseEntity::new, abstractHorseEntityBase) - .addTranslator(MetadataType.BOOLEAN, (horseEntity, entityMetadata) -> horseEntity.setFlag(EntityFlag.CHESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (horseEntity, entityMetadata) -> horseEntity.setFlag(EntityFlag.CHESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); DONKEY = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) .type(EntityType.DONKEY) @@ -852,7 +851,7 @@ public final class EntityDefinitions { LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) .type(EntityType.LLAMA) .height(1.87f).width(0.9f) - .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.STRENGTH, entityMetadata.getValue())) + .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.STRENGTH, entityMetadata.getValue())) .addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) .build(); @@ -883,7 +882,7 @@ public final class EntityDefinitions { .type(EntityType.WOLF) .height(0.85f).width(0.6f) // "Begging" on wiki.vg, "Interested" in Nukkit - the tilt of the head - .addTranslator(MetadataType.BOOLEAN, (wolfEntity, entityMetadata) -> wolfEntity.setFlag(EntityFlag.INTERESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) + .addTranslator(MetadataType.BOOLEAN, (wolfEntity, entityMetadata) -> wolfEntity.setFlag(EntityFlag.INTERESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(MetadataType.INT, WolfEntity::setCollarColor) .addTranslator(MetadataType.INT, WolfEntity::setWolfAngerTime) .build(); diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java b/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java index e0936559d..8023ce47c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java @@ -33,8 +33,7 @@ import java.util.function.BiConsumer; /** * Translates a given Java {@link EntityMetadata} into a similar/same construct for Bedrock */ - -public record EntityMetadataTranslator( - MetadataType acceptedType, - BiConsumer> translateFunction) { +public record EntityMetadataTranslator>>( + MetadataType acceptedType, + BiConsumer translateFunction) { } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java index 5c5b4dde8..c57eaa02a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -49,9 +48,9 @@ public class FallingBlockEntity extends Entity { } @Override - public void setGravity(EntityMetadata entityMetadata) { + public void setGravity(BooleanEntityMetadata entityMetadata) { super.setGravity(entityMetadata); // Set the NO_AI flag based on the no gravity flag to prevent movement - setFlag(EntityFlag.NO_AI, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + setFlag(EntityFlag.NO_AI, entityMetadata.getPrimitiveValue()); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java index fae7ca421..deac6b0dd 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java @@ -53,7 +53,7 @@ public class FireworkEntity extends Entity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setFireworkItem(EntityMetadata entityMetadata) { + public void setFireworkItem(EntityMetadata entityMetadata) { ItemStack item = entityMetadata.getValue(); if (item == null) { return; @@ -135,7 +135,7 @@ public class FireworkEntity extends Entity { dirtyMetadata.put(EntityData.DISPLAY_ITEM, builder.build()); } - public void setPlayerGliding(EntityMetadata entityMetadata) { + public void setPlayerGliding(EntityMetadata entityMetadata) { OptionalInt optional = entityMetadata.getValue(); // Checks if the firework has an entity ID (used when a player is gliding) // and checks to make sure the player that is gliding is the one getting sent the packet diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java index 8efb2db83..84d7e686a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -76,8 +75,8 @@ public class FishingHookEntity extends ThrowableEntity { super.spawnEntity(); } - public void setHookedEntity(EntityMetadata entityMetadata) { - int hookedEntityId = ((IntEntityMetadata) entityMetadata).getPrimitiveValue() - 1; + public void setHookedEntity(IntEntityMetadata entityMetadata) { + int hookedEntityId = entityMetadata.getPrimitiveValue() - 1; Entity entity; if (session.getPlayerEntity().getEntityId() == hookedEntityId) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java index d6791a15b..13116e9d7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,8 +40,8 @@ public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setHasFuel(EntityMetadata entityMetadata) { - hasFuel = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setHasFuel(BooleanEntityMetadata entityMetadata) { + hasFuel = entityMetadata.getPrimitiveValue(); updateDefaultBlockMetadata(); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java index 04ea9f299..f27aa8227 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java @@ -84,7 +84,7 @@ public class ItemEntity extends ThrowableEntity { } } - public void setItem(EntityMetadata entityMetadata) { + public void setItem(EntityMetadata entityMetadata) { ItemData item = ItemTranslator.translateToBedrock(session, entityMetadata.getValue()); if (this.item == null) { this.item = item; diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java index 2ff653a06..c4210f074 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java @@ -109,7 +109,7 @@ public class ItemFrameEntity extends Entity { valid = true; } - public void setItemInFrame(EntityMetadata entityMetadata) { + public void setItemInFrame(EntityMetadata entityMetadata) { if (entityMetadata.getValue() != null) { this.heldItem = entityMetadata.getValue(); ItemData itemData = ItemTranslator.translateToBedrock(session, heldItem); @@ -134,8 +134,8 @@ public class ItemFrameEntity extends Entity { } } - public void setItemRotation(EntityMetadata entityMetadata) { - rotation = ((IntEntityMetadata) entityMetadata).getPrimitiveValue() * 45; + public void setItemRotation(IntEntityMetadata entityMetadata) { + rotation = entityMetadata.getPrimitiveValue() * 45; if (cachedTag == null) { return; } diff --git a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java index 0a7a0da5c..40e65690e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java @@ -31,6 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.AttributeData; @@ -53,6 +54,7 @@ import org.geysermc.connector.utils.ChunkUtils; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.UUID; @Getter @@ -87,8 +89,8 @@ public class LivingEntity extends Entity { dirtyMetadata.put(EntityData.HEALTH, 1); } - public void setLivingEntityFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setLivingEntityFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); // Blocking gets triggered when using a bow, but if we set USING_ITEM for all items, it may look like // you're "mining" with ex. a shield. @@ -102,8 +104,8 @@ public class LivingEntity extends Entity { setFlag(EntityFlag.DAMAGE_NEARBY_MOBS, (xd & 0x04) == 0x04); } - public void setHealth(EntityMetadata entityMetadata) { - this.health = ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setHealth(FloatEntityMetadata entityMetadata) { + this.health = entityMetadata.getPrimitiveValue(); AttributeData healthData = createHealthAttribute(); UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); @@ -112,9 +114,10 @@ public class LivingEntity extends Entity { session.sendUpstreamPacket(attributesPacket); } - public Vector3i setBedPosition(EntityMetadata entityMetadata) { - Position bedPosition = entityMetadata.getValue(); - if (bedPosition != null) { + public Vector3i setBedPosition(EntityMetadata, ?> entityMetadata) { + Optional optionalPos = entityMetadata.getValue(); + if (optionalPos.isPresent()) { + Position bedPosition = optionalPos.get(); Vector3i vector = Vector3i.from(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ()); dirtyMetadata.put(EntityData.BED_POSITION, vector); int bed = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); @@ -148,7 +151,7 @@ public class LivingEntity extends Entity { } @Override - public float setFreezing(EntityMetadata entityMetadata) { + public float setFreezing(IntEntityMetadata entityMetadata) { float freezingPercentage = super.setFreezing(entityMetadata); this.isMaxFrozenState = freezingPercentage >= 1.0f; setFlag(EntityFlag.SHAKING, isShaking()); diff --git a/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java b/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java index 5b514310d..cbc30561c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -40,18 +39,18 @@ public class MinecartEntity extends Entity { super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw); } - public void setCustomBlock(EntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(((IntEntityMetadata) entityMetadata).getPrimitiveValue())); + public void setCustomBlock(IntEntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); } - public void setCustomBlockOffset(EntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.DISPLAY_OFFSET, entityMetadata.getValue()); + public void setCustomBlockOffset(IntEntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.DISPLAY_OFFSET, entityMetadata.getPrimitiveValue()); } - public void setShowCustomBlock(EntityMetadata entityMetadata) { + public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) { // If the custom block should be enabled // Needs a byte based off of Java's boolean - dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)); + dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java b/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java index 39482b16e..d71b1f1e7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java @@ -42,7 +42,7 @@ public class TNTEntity extends Entity implements Tickable { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setFuseLength(EntityMetadata entityMetadata) { + public void setFuseLength(IntEntityMetadata entityMetadata) { currentTick = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); setFlag(EntityFlag.IGNITED, true); dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java index 6f5b6a88e..7c108dda9 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java @@ -47,7 +47,7 @@ public class ThrownPotionEntity extends ThrowableItemEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setPotion(EntityMetadata entityMetadata) { + public void setPotion(EntityMetadata entityMetadata) { ItemStack itemStack = entityMetadata.getValue(); ItemMapping mapping = session.getItemMappings().getMapping(itemStack); if (mapping.getJavaIdentifier().endsWith("potion") && itemStack.getNbt() != null) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java b/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java index d05cb5d2a..df0f12854 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -43,8 +42,8 @@ public class TippedArrowEntity extends AbstractArrowEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setPotionEffectColor(EntityMetadata entityMetadata) { - int potionColor = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPotionEffectColor(IntEntityMetadata entityMetadata) { + int potionColor = entityMetadata.getPrimitiveValue(); // -1 means no color if (potionColor == -1) { dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); diff --git a/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java b/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java index 936a6c091..643757329 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import org.geysermc.connector.network.session.GeyserSession; @@ -41,8 +40,8 @@ public class WitherSkullEntity extends ItemedFireballEntity { this.futureTicks = 1; } - public void setDangerous(EntityMetadata entityMetadata) { - boolean newDangerous = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setDangerous(BooleanEntityMetadata entityMetadata) { + boolean newDangerous = entityMetadata.getPrimitiveValue(); if (newDangerous != isCharged) { isCharged = newDangerous; // Is an entirely new entity in Bedrock but just a metadata type in Java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java index b864b8e7b..1bb4caef0 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,8 +40,8 @@ public class AgeableEntity extends CreatureEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setBaby(EntityMetadata entityMetadata) { - boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setBaby(BooleanEntityMetadata entityMetadata) { + boolean isBaby = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize()); setFlag(EntityFlag.BABY, isBaby); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java index e2d34f2b8..685232381 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java @@ -40,6 +40,7 @@ import org.geysermc.connector.entity.EntityDefinitions; import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.network.session.GeyserSession; +import java.util.Optional; import java.util.UUID; public class ArmorStandEntity extends LivingEntity { @@ -117,13 +118,13 @@ public class ArmorStandEntity extends LivingEntity { } @Override - public void setDisplayName(EntityMetadata entityMetadata) { + public void setDisplayName(EntityMetadata, ?> entityMetadata) { super.setDisplayName(entityMetadata); updateSecondEntityStatus(false); } - public void setArmorStandFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setArmorStandFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); // isSmall boolean newIsSmall = (xd & 0x01) == 0x01; @@ -161,27 +162,27 @@ public class ArmorStandEntity extends LivingEntity { setFlag(EntityFlag.ADMIRING, (xd & 0x08) == 0x08); // Has no baseplate } - public void setHeadRotation(EntityMetadata entityMetadata) { + public void setHeadRotation(EntityMetadata entityMetadata) { onRotationUpdate(EntityData.MARK_VARIANT, EntityFlag.INTERESTED, EntityFlag.CHARGED, EntityFlag.POWERED, entityMetadata.getValue()); } - public void setBodyRotation(EntityMetadata entityMetadata) { + public void setBodyRotation(EntityMetadata entityMetadata) { onRotationUpdate(EntityData.VARIANT, EntityFlag.IN_LOVE, EntityFlag.CELEBRATING, EntityFlag.CELEBRATING_SPECIAL, entityMetadata.getValue()); } - public void setLeftArmRotation(EntityMetadata entityMetadata) { + public void setLeftArmRotation(EntityMetadata entityMetadata) { onRotationUpdate(EntityData.TRADE_TIER, EntityFlag.CHARGING, EntityFlag.CRITICAL, EntityFlag.DANCING, entityMetadata.getValue()); } - public void setRightArmRotation(EntityMetadata entityMetadata) { + public void setRightArmRotation(EntityMetadata entityMetadata) { onRotationUpdate(EntityData.MAX_TRADE_TIER, EntityFlag.ELDER, EntityFlag.EMOTING, EntityFlag.IDLING, entityMetadata.getValue()); } - public void setLeftLegRotation(EntityMetadata entityMetadata) { + public void setLeftLegRotation(EntityMetadata entityMetadata) { onRotationUpdate(EntityData.SKIN_ID, EntityFlag.IS_ILLAGER_CAPTAIN, EntityFlag.IS_IN_UI, EntityFlag.LINGERING, entityMetadata.getValue()); } - public void setRightLegRotation(EntityMetadata entityMetadata) { + public void setRightLegRotation(EntityMetadata entityMetadata) { onRotationUpdate(EntityData.HURT_DIRECTION, EntityFlag.IS_PREGNANT, EntityFlag.SHEARED, EntityFlag.STALKING, entityMetadata.getValue()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java index 4f5bd1ead..ed6f39f39 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -40,8 +39,8 @@ public class BatEntity extends AmbientEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setBatFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setBatFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.RESTING, (xd & 0x01) == 0x01); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java index 3c603a61e..605f901f5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -54,8 +53,8 @@ public class MobEntity extends LivingEntity { setLeashHolderBedrockId(-1); } - public void setMobFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setMobFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.NO_AI, (xd & 0x01) == 0x01); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java index b533a6613..7ab1fad0e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -40,7 +39,7 @@ public class SlimeEntity extends MobEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setScale(EntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.SCALE, 0.10f + ((IntEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setScale(IntEntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.SCALE, 0.10f + entityMetadata.getPrimitiveValue()); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java index 7dafd4853..afd6daf5d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -40,8 +39,8 @@ public class SnowGolemEntity extends GolemEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setSnowGolemFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setSnowGolemFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); // Handle the visibility of the pumpkin setFlag(EntityFlag.SHEARED, (xd & 0x10) != 0x10); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java index e0bfc577e..38f5a10a8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -42,8 +41,8 @@ public class AxolotlEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setVariant(EntityMetadata entityMetadata) { - int variant = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setVariant(IntEntityMetadata entityMetadata) { + int variant = entityMetadata.getPrimitiveValue(); switch (variant) { case 1 -> variant = 3; // Java - "Wild" (brown) case 3 -> variant = 1; // Java - cyan @@ -51,8 +50,8 @@ public class AxolotlEntity extends AnimalEntity { dirtyMetadata.put(EntityData.VARIANT, variant); } - public void setPlayingDead(EntityMetadata entityMetadata) { - setFlag(EntityFlag.PLAYING_DEAD, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setPlayingDead(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.PLAYING_DEAD, entityMetadata.getPrimitiveValue()); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java index a2524566d..7e6e8f1a8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -45,8 +44,8 @@ public class BeeEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setBeeFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setBeeFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); // Bee is performing sting attack; trigger animation if ((xd & 0x02) == 0x02) { EntityEventPacket packet = new EntityEventPacket(); @@ -61,9 +60,9 @@ public class BeeEntity extends AnimalEntity { setFlag(EntityFlag.POWERED, (xd & 0x08) == 0x08); } - public void setAngerTime(EntityMetadata entityMetadata) { + public void setAngerTime(IntEntityMetadata entityMetadata) { // Converting "anger time" to a boolean - setFlag(EntityFlag.ANGRY, ((IntEntityMetadata) entityMetadata).getPrimitiveValue() > 0); + setFlag(EntityFlag.ANGRY, entityMetadata.getPrimitiveValue() > 0); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java index a10201155..84b2f1071 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java @@ -25,8 +25,8 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -42,12 +42,12 @@ public class FoxEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setFoxVariant(EntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.VARIANT, entityMetadata.getValue()); + public void setFoxVariant(IntEntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.VARIANT, entityMetadata.getPrimitiveValue()); } - public void setFoxFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setFoxFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); setFlag(EntityFlag.SNEAKING, (xd & 0x04) == 0x04); setFlag(EntityFlag.INTERESTED, (xd & 0x08) == 0x08); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java index 568be2d21..5b5843480 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -46,9 +45,9 @@ public class GoatEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setScreamer(EntityMetadata entityMetadata) { + public void setScreamer(BooleanEntityMetadata entityMetadata) { // Metadata not used in Bedrock Edition - isScreamer = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + isScreamer = entityMetadata.getPrimitiveValue(); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java index fb2c68fd2..81f340578 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -43,9 +42,9 @@ public class HoglinEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setImmuneToZombification(EntityMetadata entityMetadata) { + public void setImmuneToZombification(BooleanEntityMetadata entityMetadata) { // Apply shaking effect if not in the nether and zombification is possible - this.isImmuneToZombification = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + this.isImmuneToZombification = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SHAKING, isShaking()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java index 376079387..6ddc66ab9 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -47,8 +46,8 @@ public class PandaEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setEatingCounter(EntityMetadata entityMetadata) { - int count = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setEatingCounter(IntEntityMetadata entityMetadata) { + int count = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.EATING, count > 0); dirtyMetadata.put(EntityData.EATING_COUNTER, count); if (count != 0) { @@ -61,18 +60,18 @@ public class PandaEntity extends AnimalEntity { } } - public void setMainGene(EntityMetadata entityMetadata) { - mainGene = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setMainGene(ByteEntityMetadata entityMetadata) { + mainGene = entityMetadata.getPrimitiveValue(); updateAppearance(); } - public void setHiddenGene(EntityMetadata entityMetadata) { - hiddenGene = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setHiddenGene(ByteEntityMetadata entityMetadata) { + hiddenGene = entityMetadata.getPrimitiveValue(); updateAppearance(); } - public void setPandaFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPandaFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SNEEZING, (xd & 0x02) == 0x02); setFlag(EntityFlag.ROLLING, (xd & 0x04) == 0x04); setFlag(EntityFlag.SITTING, (xd & 0x08) == 0x08); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java index e2c9039de..9baddf321 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,8 +40,8 @@ public class PufferFishEntity extends AbstractFishEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setPufferfishSize(EntityMetadata entityMetadata) { - int puffsize = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPufferfishSize(IntEntityMetadata entityMetadata) { + int puffsize = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.PUFFERFISH_SIZE, (byte) puffsize); dirtyMetadata.put(EntityData.VARIANT, puffsize); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java index 02d6db67e..38129d923 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java @@ -25,7 +25,7 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -43,12 +43,12 @@ public class RabbitEntity extends AnimalEntity { } @Override - public void setBaby(EntityMetadata entityMetadata) { + public void setBaby(BooleanEntityMetadata entityMetadata) { super.setBaby(entityMetadata); } - public void setRabbitVariant(EntityMetadata entityMetadata) { - int variant = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setRabbitVariant(IntEntityMetadata entityMetadata) { + int variant = entityMetadata.getPrimitiveValue(); // Change the killer bunny to display as white since it only exists on Java Edition boolean isKillerBunny = variant == 99; diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java index c063188c5..6fa2b59df 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java @@ -41,7 +41,7 @@ public class SheepEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setSheepFlags(EntityMetadata entityMetadata) { + public void setSheepFlags(ByteEntityMetadata entityMetadata) { byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); setFlag(EntityFlag.SHEARED, (xd & 0x10) == 0x10); dirtyMetadata.put(EntityData.COLOR, xd); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java index b2934e507..8fa51d48f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -47,12 +46,12 @@ public class StriderEntity extends AnimalEntity { setFlag(EntityFlag.BREATHING, true); } - public void setCold(EntityMetadata entityMetadata) { - isCold = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setCold(BooleanEntityMetadata entityMetadata) { + isCold = entityMetadata.getPrimitiveValue(); } - public void setSaddled(EntityMetadata entityMetadata) { - setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setSaddled(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.SADDLED, entityMetadata.getPrimitiveValue()); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java index cd652f6a3..e699cfa98 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableList; import com.nukkitx.math.vector.Vector3f; @@ -53,8 +52,8 @@ public class TropicalFishEntity extends AbstractFishEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setFishVariant(EntityMetadata entityMetadata) { - int varNumber = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setFishVariant(IntEntityMetadata entityMetadata) { + int varNumber = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.VARIANT, getShape(varNumber)); // Shape 0-1 dirtyMetadata.put(EntityData.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java index 495bc64a0..1eb0da891 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -41,12 +40,12 @@ public class TurtleEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setPregnant(EntityMetadata entityMetadata) { - setFlag(EntityFlag.IS_PREGNANT, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setPregnant(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.IS_PREGNANT, entityMetadata.getPrimitiveValue()); } - public void setLayingEgg(EntityMetadata entityMetadata) { - setFlag(EntityFlag.LAYING_EGG, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setLayingEgg(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.LAYING_EGG, entityMetadata.getPrimitiveValue()); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java index 1b3ffbd71..25e5eaaf7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal.horse; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.google.common.collect.ImmutableSet; import com.nukkitx.math.vector.Vector3f; @@ -79,8 +78,8 @@ public class AbstractHorseEntity extends AnimalEntity { session.sendUpstreamPacket(attributesPacket); } - public void setHorseFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setHorseFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); boolean tamed = (xd & 0x02) == 0x02; boolean saddled = (xd & 0x04) == 0x04; setFlag(EntityFlag.TAMED, tamed); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java index 97354d047..d997171ea 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal.horse; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -40,8 +39,8 @@ public class HorseEntity extends AbstractHorseEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setHorseVariant(EntityMetadata entityMetadata) { - int value = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setHorseVariant(IntEntityMetadata entityMetadata) { + int value = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.VARIANT, value & 255); dirtyMetadata.put(EntityData.MARK_VARIANT, (value >> 8) % 5); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java index 204261620..7a4af6a2a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal.horse; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -48,12 +47,12 @@ public class LlamaEntity extends ChestedHorseEntity { /** * Color equipped on the llama */ - public void setCarpetedColor(EntityMetadata entityMetadata) { + public void setCarpetedColor(IntEntityMetadata entityMetadata) { // Bedrock treats llama decoration as armor MobArmorEquipmentPacket equipmentPacket = new MobArmorEquipmentPacket(); equipmentPacket.setRuntimeEntityId(geyserId); // -1 means no armor - int carpetIndex = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + int carpetIndex = entityMetadata.getPrimitiveValue(); if (carpetIndex > -1 && carpetIndex <= 15) { // The damage value is the dye color that Java sends us, for pre-1.16.220 // The item is always going to be a carpet diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java index 035044a93..52f20b75f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java @@ -25,8 +25,8 @@ package org.geysermc.connector.entity.living.animal.tameable; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -61,7 +61,7 @@ public class CatEntity extends TameableEntity { } @Override - public void setTameableFlags(EntityMetadata entityMetadata) { + public void setTameableFlags(ByteEntityMetadata entityMetadata) { super.setTameableFlags(entityMetadata); // Update collar color if tamed if (getFlag(EntityFlag.TAMED)) { @@ -69,9 +69,9 @@ public class CatEntity extends TameableEntity { } } - public void setCatVariant(EntityMetadata entityMetadata) { + public void setCatVariant(IntEntityMetadata entityMetadata) { // Different colors in Java and Bedrock for some reason - int metadataValue = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + int metadataValue = entityMetadata.getPrimitiveValue(); int variantColor = switch (metadataValue) { case 0 -> 8; case 8 -> 0; @@ -82,12 +82,12 @@ public class CatEntity extends TameableEntity { dirtyMetadata.put(EntityData.VARIANT, variantColor); } - public void setResting(EntityMetadata entityMetadata) { - setFlag(EntityFlag.RESTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setResting(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.RESTING, entityMetadata.getPrimitiveValue()); } - public void setCollarColor(EntityMetadata entityMetadata) { - collarColor = (byte) ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setCollarColor(IntEntityMetadata entityMetadata) { + collarColor = (byte) entityMetadata.getPrimitiveValue(); // Needed or else wild cats are a red color if (getFlag(EntityFlag.TAMED)) { dirtyMetadata.put(EntityData.COLOR, collarColor); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java index a07ce3b9b..198330ded 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java @@ -36,6 +36,7 @@ import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.animal.AnimalEntity; import org.geysermc.connector.network.session.GeyserSession; +import java.util.Optional; import java.util.UUID; public class TameableEntity extends AnimalEntity { @@ -49,18 +50,18 @@ public class TameableEntity extends AnimalEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setTameableFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setTameableFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); setFlag(EntityFlag.ANGRY, (xd & 0x02) == 0x02); setFlag(EntityFlag.TAMED, (xd & 0x04) == 0x04); } - public void setOwner(EntityMetadata entityMetadata) { + public void setOwner(EntityMetadata, ?> entityMetadata) { // Note: Must be set for wolf collar color to work - if (entityMetadata.getValue() != null) { + if (entityMetadata.getValue().isPresent()) { // Owner UUID of entity - Entity entity = session.getEntityCache().getPlayerEntity(entityMetadata.getValue()); + Entity entity = session.getEntityCache().getPlayerEntity(entityMetadata.getValue().get()); // Used as both a check since the player isn't in the entity cache and a normal fallback if (entity == null) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java index f828ce014..c38c1c8af 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.animal.tameable; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableSet; @@ -55,18 +54,18 @@ public class WolfEntity extends TameableEntity { } @Override - public void setTameableFlags(EntityMetadata entityMetadata) { + public void setTameableFlags(ByteEntityMetadata entityMetadata) { super.setTameableFlags(entityMetadata); // Reset wolf color - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + byte xd = entityMetadata.getPrimitiveValue(); boolean angry = (xd & 0x02) == 0x02; if (angry) { dirtyMetadata.put(EntityData.COLOR, (byte) 0); } } - public void setCollarColor(EntityMetadata entityMetadata) { - collarColor = (byte) ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setCollarColor(IntEntityMetadata entityMetadata) { + collarColor = (byte) entityMetadata.getPrimitiveValue(); if (getFlag(EntityFlag.ANGRY)) { return; } @@ -80,8 +79,8 @@ public class WolfEntity extends TameableEntity { } // 1.16+ - public void setWolfAngerTime(EntityMetadata entityMetadata) { - int time = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setWolfAngerTime(IntEntityMetadata entityMetadata) { + int time = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.ANGRY, time != 0); dirtyMetadata.put(EntityData.COLOR, time != 0 ? (byte) 0 : collarColor); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java index 234b065d4..c231e8e86 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java @@ -40,6 +40,7 @@ import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.registry.BlockRegistries; +import java.util.Optional; import java.util.UUID; public class VillagerEntity extends AbstractMerchantEntity { @@ -91,7 +92,7 @@ public class VillagerEntity extends AbstractMerchantEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setVillagerData(EntityMetadata entityMetadata) { + public void setVillagerData(EntityMetadata entityMetadata) { VillagerData villagerData = entityMetadata.getValue(); // Profession int profession = VILLAGER_PROFESSIONS.get(villagerData.getProfession()); @@ -105,7 +106,7 @@ public class VillagerEntity extends AbstractMerchantEntity { } @Override - public Vector3i setBedPosition(EntityMetadata entityMetadata) { + public Vector3i setBedPosition(EntityMetadata, ?> entityMetadata) { return bedPosition = super.setBedPosition(entityMetadata); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java index 9997dd968..abbe8b6d3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,9 +40,9 @@ public class AbstractSkeletonEntity extends MonsterEntity { } @Override - public void setMobFlags(EntityMetadata entityMetadata) { + public void setMobFlags(ByteEntityMetadata entityMetadata) { super.setMobFlags(entityMetadata); - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + byte xd = entityMetadata.getPrimitiveValue(); // A bit of a loophole so the hands get raised - set the target ID to its own ID dirtyMetadata.put(EntityData.TARGET_EID, ((xd & 4) == 4) ? geyserId : 0); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java index e092d3099..a9b274875 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -42,9 +41,9 @@ public class BasePiglinEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setImmuneToZombification(EntityMetadata entityMetadata) { + public void setImmuneToZombification(BooleanEntityMetadata entityMetadata) { // Apply shaking effect if not in the nether and zombification is possible - this.isImmuneToZombification = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + this.isImmuneToZombification = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SHAKING, isShaking()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java index 33afdf81d..5eed05db9 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -40,8 +39,8 @@ public class BlazeEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setBlazeFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setBlazeFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.ON_FIRE, (xd & 0x01) == 0x01); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java index 0f561f8d2..0b05d8822 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -37,8 +36,8 @@ import java.util.UUID; public class CreeperEntity extends MonsterEntity { /** - * Whether the creeper has been ignited and is using {@link #setIgnited(EntityMetadata)}. - * In this instance we ignore {@link #setSwelling(EntityMetadata)} since it's sending us -1 which confuses poor Bedrock. + * Whether the creeper has been ignited and is using {@link #setIgnited(BooleanEntityMetadata)}. + * In this instance we ignore {@link #setSwelling(IntEntityMetadata)} since it's sending us -1 which confuses poor Bedrock. */ private boolean ignitedByFlintAndSteel = false; @@ -46,14 +45,14 @@ public class CreeperEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setSwelling(EntityMetadata entityMetadata) { + public void setSwelling(IntEntityMetadata entityMetadata) { if (!ignitedByFlintAndSteel) { - setFlag(EntityFlag.IGNITED, ((IntEntityMetadata) entityMetadata).getPrimitiveValue() == 1); + setFlag(EntityFlag.IGNITED, entityMetadata.getPrimitiveValue() == 1); } } - public void setIgnited(EntityMetadata entityMetadata) { - ignitedByFlintAndSteel = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setIgnited(BooleanEntityMetadata entityMetadata) { + ignitedByFlintAndSteel = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.IGNITED, ignitedByFlintAndSteel); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java index 3d381972d..12d0c4f3a 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java @@ -25,7 +25,7 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -90,7 +90,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable { } @Override - public void setHealth(EntityMetadata entityMetadata) { + public void setHealth(FloatEntityMetadata entityMetadata) { super.setHealth(entityMetadata); if (phase == 9 && this.health <= 0) { // Dying phase EntityEventPacket entityEventPacket = new EntityEventPacket(); @@ -101,8 +101,8 @@ public class EnderDragonEntity extends MobEntity implements Tickable { } } - public void setPhase(EntityMetadata entityMetadata) { - phase = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPhase(IntEntityMetadata entityMetadata) { + phase = entityMetadata.getPrimitiveValue(); phaseTicks = 0; setFlag(EntityFlag.SITTING, isSitting()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java index 94265f7e4..744e2480c 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -44,17 +43,17 @@ public class EndermanEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setCarriedBlock(EntityMetadata entityMetadata) { - dirtyMetadata.put(EntityData.CARRIED_BLOCK, session.getBlockMappings().getBedrockBlockId(((IntEntityMetadata) entityMetadata).getPrimitiveValue())); + public void setCarriedBlock(IntEntityMetadata entityMetadata) { + dirtyMetadata.put(EntityData.CARRIED_BLOCK, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); } /** * Controls the screaming sound */ - public void setScreaming(EntityMetadata entityMetadata) { + public void setScreaming(BooleanEntityMetadata entityMetadata) { //TODO see if Bedrock controls this differently // Java Edition this controls which ambient sound is used - if (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()) { + if (entityMetadata.getPrimitiveValue()) { LevelSoundEvent2Packet packet = new LevelSoundEvent2Packet(); packet.setSound(SoundEvent.STARE); packet.setPosition(this.position); @@ -64,8 +63,8 @@ public class EndermanEntity extends MonsterEntity { } } - public void setAngry(EntityMetadata entityMetadata) { + public void setAngry(BooleanEntityMetadata entityMetadata) { // "Is staring/provoked" - controls visuals - setFlag(EntityFlag.ANGRY, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + setFlag(EntityFlag.ANGRY, entityMetadata.getPrimitiveValue()); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java index e281db30b..7c13ec577 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,8 +40,8 @@ public class GhastEntity extends FlyingEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setGhastAttacking(EntityMetadata entityMetadata) { + public void setGhastAttacking(BooleanEntityMetadata entityMetadata) { // If the ghast is attacking - dirtyMetadata.put(EntityData.CHARGE_AMOUNT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)); + dirtyMetadata.put(EntityData.CHARGE_AMOUNT, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java index caffb5d9e..0c4156e71 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,8 +40,8 @@ public class GuardianEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setGuardianTarget(EntityMetadata entityMetadata) { - int entityId = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setGuardianTarget(IntEntityMetadata entityMetadata) { + int entityId = entityMetadata.getPrimitiveValue(); Entity entity; if (session.getPlayerEntity().getEntityId() == entityId) { entity = session.getPlayerEntity(); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java index 651d1aa66..f9136f701 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -40,8 +39,8 @@ public class PhantomEntity extends FlyingEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setPhantomScale(EntityMetadata entityMetadata) { - int size = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setPhantomScale(IntEntityMetadata entityMetadata) { + int size = entityMetadata.getPrimitiveValue(); float modelScale = 1f + 0.15f * size; float boundsScale = (1f + (0.2f * size) / definition.width()) / modelScale; diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java index 61fb36bf4..ab0625e64 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,18 +40,18 @@ public class PiglinEntity extends BasePiglinEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setBaby(EntityMetadata entityMetadata) { - boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setBaby(BooleanEntityMetadata entityMetadata) { + boolean isBaby = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f); setFlag(EntityFlag.BABY, isBaby); } - public void setChargingCrossbow(EntityMetadata entityMetadata) { - setFlag(EntityFlag.CHARGING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setChargingCrossbow(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.CHARGING, entityMetadata.getPrimitiveValue()); } - public void setDancing(EntityMetadata entityMetadata) { - setFlag(EntityFlag.DANCING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue()); + public void setDancing(BooleanEntityMetadata entityMetadata) { + setFlag(EntityFlag.DANCING, entityMetadata.getPrimitiveValue()); } @Override diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java index e16df7211..e881e252f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java @@ -27,13 +27,13 @@ package org.geysermc.connector.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.living.GolemEntity; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.Direction; import java.util.UUID; @@ -45,17 +45,17 @@ public class ShulkerEntity extends GolemEntity { setFlag(EntityFlag.BRIBED, true); } - public void setAttachedFace(EntityMetadata entityMetadata) { + public void setAttachedFace(EntityMetadata entityMetadata) { Direction direction = entityMetadata.getValue(); dirtyMetadata.put(EntityData.SHULKER_ATTACH_FACE, (byte) direction.ordinal()); } - public void setShulkerHeight(EntityMetadata entityMetadata) { - int height = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setShulkerHeight(ByteEntityMetadata entityMetadata) { + int height = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.SHULKER_PEEK_ID, height); } - public void setShulkerColor(EntityMetadata entityMetadata) { + public void setShulkerColor(ByteEntityMetadata entityMetadata) { byte color = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); if (color == 16) { // 16 is default on both editions diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java index 984590db1..63b021ba3 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -41,8 +40,8 @@ public class SkeletonEntity extends AbstractSkeletonEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setConvertingToStray(EntityMetadata entityMetadata) { - this.convertingToStray = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setConvertingToStray(BooleanEntityMetadata entityMetadata) { + this.convertingToStray = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SHAKING, isShaking()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java index f2f151eae..45e963618 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -40,8 +39,8 @@ public class SpiderEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setSpiderFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setSpiderFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.WALL_CLIMBING, (xd & 0x01) == 0x01); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java index d6e05b387..2582665a7 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -40,8 +39,8 @@ public class VexEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setVexFlags(EntityMetadata entityMetadata) { - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setVexFlags(ByteEntityMetadata entityMetadata) { + byte xd = entityMetadata.getPrimitiveValue(); // Set the target to the player to force the attack animation // even if the player isn't the target as we dont get the target on Java dirtyMetadata.put(EntityData.TARGET_EID, (xd & 0x01) == 0x01 ? session.getPlayerEntity().getGeyserId() : 0); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java index befb464fe..0dd6565f2 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -47,20 +46,20 @@ public class WitherEntity extends MonsterEntity { dirtyMetadata.put(EntityData.WITHER_AERIAL_ATTACK, (short) 1); } - public void setTarget1(EntityMetadata entityMetadata) { + public void setTarget1(IntEntityMetadata entityMetadata) { setTargetId(EntityData.WITHER_TARGET_1, entityMetadata); } - public void setTarget2(EntityMetadata entityMetadata) { + public void setTarget2(IntEntityMetadata entityMetadata) { setTargetId(EntityData.WITHER_TARGET_2, entityMetadata); } - public void setTarget3(EntityMetadata entityMetadata) { + public void setTarget3(IntEntityMetadata entityMetadata) { setTargetId(EntityData.WITHER_TARGET_3, entityMetadata); } - private void setTargetId(EntityData entityData, EntityMetadata entityMetadata) { - int entityId = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + private void setTargetId(EntityData entityData, IntEntityMetadata entityMetadata) { + int entityId = entityMetadata.getPrimitiveValue(); Entity entity; if (session.getPlayerEntity().getEntityId() == entityId) { entity = session.getPlayerEntity(); @@ -73,8 +72,8 @@ public class WitherEntity extends MonsterEntity { } } - public void setInvulnerableTicks(EntityMetadata entityMetadata) { - int value = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setInvulnerableTicks(IntEntityMetadata entityMetadata) { + int value = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.WITHER_INVULNERABLE_TICKS, value); // Show the shield for the first few seconds of spawning (like Java) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java index 4773b2d80..07876673d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -41,8 +40,8 @@ public class ZoglinEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setBaby(EntityMetadata entityMetadata) { - boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setBaby(BooleanEntityMetadata entityMetadata) { + boolean isBaby = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.SCALE, isBaby? .55f : 1f); setFlag(EntityFlag.BABY, isBaby); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java index fd9218cd7..d2b25ce8f 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -42,14 +41,14 @@ public class ZombieEntity extends MonsterEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setZombieBaby(EntityMetadata entityMetadata) { - boolean isBaby = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setZombieBaby(BooleanEntityMetadata entityMetadata) { + boolean isBaby = entityMetadata.getPrimitiveValue(); dirtyMetadata.put(EntityData.SCALE, isBaby ? .55f : 1.0f); setFlag(EntityFlag.BABY, isBaby); } - public void setConvertingToDrowned(EntityMetadata entityMetadata) { - convertingToDrowned = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setConvertingToDrowned(BooleanEntityMetadata entityMetadata) { + convertingToDrowned = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.SHAKING, isShaking()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java index 744d3e559..b78aff8d8 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java @@ -44,13 +44,13 @@ public class ZombieVillagerEntity extends ZombieEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setTransforming(EntityMetadata entityMetadata) { - isTransforming = ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setTransforming(BooleanEntityMetadata entityMetadata) { + isTransforming = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.IS_TRANSFORMING, isTransforming); setFlag(EntityFlag.SHAKING, isShaking()); } - public void setZombieVillagerData(EntityMetadata entityMetadata) { + public void setZombieVillagerData(EntityMetadata entityMetadata) { VillagerData villagerData = entityMetadata.getValue(); dirtyMetadata.put(EntityData.VARIANT, VillagerEntity.VILLAGER_PROFESSIONS.get(villagerData.getProfession())); // Actually works properly with the OptionalPack dirtyMetadata.put(EntityData.MARK_VARIANT, VillagerEntity.VILLAGER_REGIONS.get(villagerData.getType())); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java index 1dca4fd0a..6c91b1720 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster.raid; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -47,8 +46,8 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); } - public void setSpellType(EntityMetadata entityMetadata) { - int spellType = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + public void setSpellType(ByteEntityMetadata entityMetadata) { + int spellType = entityMetadata.getPrimitiveValue(); // Summon vex, attack, or wololo setFlag(EntityFlag.CASTING, spellType == 1 || spellType == 2 || spellType == 3); int rgbData = switch (spellType) { diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java index 74616806c..db2225f37 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java @@ -25,7 +25,6 @@ package org.geysermc.connector.entity.living.monster.raid; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -41,10 +40,10 @@ public class VindicatorEntity extends AbstractIllagerEntity { } @Override - public void setMobFlags(EntityMetadata entityMetadata) { + public void setMobFlags(ByteEntityMetadata entityMetadata) { super.setMobFlags(entityMetadata); // Allow the axe to be shown if necessary - byte xd = ((ByteEntityMetadata) entityMetadata).getPrimitiveValue(); + byte xd = entityMetadata.getPrimitiveValue(); setFlag(EntityFlag.ANGRY, (xd & 4) == 4); } } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java index 8c2471526..946ee2549 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java @@ -29,6 +29,7 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; @@ -60,6 +61,7 @@ import org.geysermc.connector.scoreboard.UpdateType; import javax.annotation.Nullable; import java.util.Collections; +import java.util.Optional; import java.util.concurrent.TimeUnit; @Getter @Setter @@ -255,33 +257,33 @@ public class PlayerEntity extends LivingEntity { } @Override - public Vector3i setBedPosition(EntityMetadata entityMetadata) { + public Vector3i setBedPosition(EntityMetadata, ?> entityMetadata) { return bedPosition = super.setBedPosition(entityMetadata); } - public void setAbsorptionHearts(EntityMetadata entityMetadata) { + public void setAbsorptionHearts(FloatEntityMetadata entityMetadata) { // Extra hearts - is not metadata but an attribute on Bedrock UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); attributesPacket.setRuntimeEntityId(geyserId); // Setting to a higher maximum since plugins/datapacks can probably extend the Bedrock soft limit attributesPacket.setAttributes(Collections.singletonList( - new AttributeData("minecraft:absorption", 0.0f, 1024f, ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 0.0f))); + new AttributeData("minecraft:absorption", 0.0f, 1024f, entityMetadata.getPrimitiveValue(), 0.0f))); session.sendUpstreamPacket(attributesPacket); } - public void setSkinVisibility(EntityMetadata entityMetadata) { + public void setSkinVisibility(ByteEntityMetadata entityMetadata) { // OptionalPack usage for toggling skin bits // In Java Edition, a bit being set means that part should be enabled // However, to ensure that the pack still works on other servers, we invert the bit so all values by default // are true (0). - dirtyMetadata.put(EntityData.MARK_VARIANT, ~((ByteEntityMetadata) entityMetadata).getPrimitiveValue() & 0xff); + dirtyMetadata.put(EntityData.MARK_VARIANT, ~entityMetadata.getPrimitiveValue() & 0xff); } - public void setLeftParrot(EntityMetadata entityMetadata) { + public void setLeftParrot(EntityMetadata entityMetadata) { setParrot(entityMetadata.getValue(), true); } - public void setRightParrot(EntityMetadata entityMetadata) { + public void setRightParrot(EntityMetadata entityMetadata) { setParrot(entityMetadata.getValue(), false); } @@ -330,7 +332,7 @@ public class PlayerEntity extends LivingEntity { } @Override - public void setDisplayName(EntityMetadata entityMetadata) { + public void setDisplayName(EntityMetadata, ?> entityMetadata) { // Doesn't do anything for players } @@ -385,7 +387,7 @@ public class PlayerEntity extends LivingEntity { } @Override - public void setDisplayNameVisible(EntityMetadata entityMetadata) { + public void setDisplayNameVisible(BooleanEntityMetadata entityMetadata) { // Doesn't do anything for players } diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java index bc6d4077a..9a367874e 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java @@ -110,14 +110,14 @@ public class SessionPlayerEntity extends PlayerEntity { } @Override - public void setFlags(EntityMetadata entityMetadata) { + public void setFlags(ByteEntityMetadata entityMetadata) { super.setFlags(entityMetadata); - session.setSwimmingInWater((((ByteEntityMetadata) entityMetadata).getPrimitiveValue() & 0x10) == 0x10 && getFlag(EntityFlag.SPRINTING)); + session.setSwimmingInWater((entityMetadata.getPrimitiveValue() & 0x10) == 0x10 && getFlag(EntityFlag.SPRINTING)); refreshSpeed = true; } @Override - public void setPose(EntityMetadata entityMetadata) { + public void setPose(EntityMetadata entityMetadata) { super.setPose(entityMetadata); session.setPose(entityMetadata.getValue()); refreshSpeed = true; @@ -132,11 +132,11 @@ public class SessionPlayerEntity extends PlayerEntity { } @Override - protected void setAir(int amount) { + protected void setAirSupply(int amount) { if (amount == getMaxAir()) { - super.setAir(0); // Hide the bubble counter from the UI for the player + super.setAirSupply(0); // Hide the bubble counter from the UI for the player } else { - super.setAir(amount); + super.setAirSupply(amount); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java index 5b60fd3e3..25a7958df 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java @@ -26,8 +26,10 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; import org.geysermc.connector.entity.Entity; +import org.geysermc.connector.entity.EntityDefinition; import org.geysermc.connector.entity.EntityMetadataTranslator; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; @@ -39,6 +41,7 @@ import java.util.List; @Translator(packet = ClientboundSetEntityDataPacket.class) public class JavaSetEntityDataTranslator extends PacketTranslator { + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void translate(GeyserSession session, ClientboundSetEntityDataPacket packet) { Entity entity; @@ -49,30 +52,17 @@ public class JavaSetEntityDataTranslator extends PacketTranslator> translators = (List>) entity.getDefinition().translators(); - - for (EntityMetadata metadata : packet.getMetadata()) { - if (metadata.getId() >= translators.size()) { - session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + translators.size() + " for entity type " + entity.getDefinition().entityType()); + EntityDefinition definition = entity.getDefinition(); + for (EntityMetadata metadata : packet.getMetadata()) { + if (metadata.getId() >= definition.translators().size()) { + session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + definition.translators().size() + " for entity type " + entity.getDefinition().entityType()); if (session.getConnector().getConfig().isDebugMode()) { session.getConnector().getLogger().debug(metadata.toString()); } continue; } - EntityMetadataTranslator translator = (EntityMetadataTranslator) translators.get(metadata.getId()); - if (translator == null) { - // This can safely happen; it means we don't translate this entity metadata - continue; - } - if (translator.acceptedType() != metadata.getType()) { - session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " was received with type " + metadata.getType() + " but we expected " + translator.acceptedType() + " for " + entity.getDefinition().entityType()); - if (session.getConnector().getConfig().isDebugMode()) { - session.getConnector().getLogger().debug(metadata.toString()); - } - continue; - } - translator.translateFunction().accept(entity, (EntityMetadata) metadata); + ((EntityDefinition) definition).translateMetadata(entity, metadata); } entity.updateBedrockMetadata(); diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java index a1a95fe1a..05fed47eb 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java @@ -39,6 +39,7 @@ import org.geysermc.connector.utils.FileUtils; import java.io.InputStream; import java.util.EnumMap; import java.util.EnumSet; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java index 5ebd903c0..ca2940845 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java @@ -32,6 +32,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.registry.type.ParticleMapping; +import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Map; From 13777e785a82fdc325606608998b1d070221a4ac Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 20 Nov 2021 13:36:15 -0600 Subject: [PATCH 693/766] Remove stray imports --- .../connector/registry/loader/EnchantmentRegistryLoader.java | 1 - .../connector/registry/loader/ParticleTypesRegistryLoader.java | 1 - 2 files changed, 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java index 05fed47eb..a1a95fe1a 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java @@ -39,7 +39,6 @@ import org.geysermc.connector.utils.FileUtils; import java.io.InputStream; import java.util.EnumMap; import java.util.EnumSet; -import java.util.HashMap; import java.util.Iterator; import java.util.Map; diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java index ca2940845..5ebd903c0 100644 --- a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java +++ b/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java @@ -32,7 +32,6 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.registry.type.ParticleMapping; -import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Map; From a4b2e05132dc19842b496577aea97eb075e9a026 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 20 Nov 2021 14:41:29 -0500 Subject: [PATCH 694/766] Initial Bedrock 1.18 support (doesn't work yet) --- connector/pom.xml | 6 +++--- .../org/geysermc/connector/network/MinecraftProtocol.java | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index 131e6e48b..ec2efc1c9 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -114,8 +114,8 @@ com.github.CloudburstMC.Protocol - bedrock-v471 - 0bc10c8e + bedrock-v475 + c22aa595 compile @@ -131,7 +131,7 @@ com.nukkitx.network raknet - 1.6.26-20210217.205834-2 + 1.6.27-20210506.111625-1 compile diff --git a/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java b/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java index 3ef8a7bce..d513f28df 100644 --- a/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java +++ b/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java @@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.codec.PacketCodec; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; +import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import java.util.ArrayList; import java.util.List; @@ -43,7 +44,7 @@ public class MinecraftProtocol { * Default Bedrock codec that should act as a fallback. Should represent the latest available * release of the game that Geyser supports. */ - public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v471.V471_CODEC; + public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v475.V475_CODEC; /** * A list of all supported Bedrock versions that can join Geyser */ @@ -57,6 +58,7 @@ public class MinecraftProtocol { static { SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC); + SUPPORTED_BEDROCK_CODECS.add(Bedrock_v471.V471_CODEC); SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC); } From 0b5009b4151e66a25438409365c1eccc0de4138b Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 20 Nov 2021 13:56:40 -0600 Subject: [PATCH 695/766] The Great Refactor Part 1 - connector -> core --- .gitmodules | 8 +- bootstrap/bungeecord/pom.xml | 2 +- bootstrap/spigot/pom.xml | 2 +- bootstrap/sponge/pom.xml | 2 +- bootstrap/standalone/pom.xml | 2 +- bootstrap/velocity/pom.xml | 2 +- connector/src/main/resources/languages | 1 - connector/src/main/resources/mappings | 1 - {connector => core}/pom.xml | 2 +- .../connector/FloodgateKeyLoader.java | 0 .../geysermc/connector/GeyserConnector.java | 0 .../org/geysermc/connector/GeyserLogger.java | 0 .../geysermc/connector/SessionManager.java | 0 .../connector/bootstrap/GeyserBootstrap.java | 0 .../connector/command/CommandExecutor.java | 0 .../connector/command/CommandManager.java | 0 .../connector/command/CommandSender.java | 0 .../connector/command/GeyserCommand.java | 0 .../command/defaults/AdvancementsCommand.java | 0 .../command/defaults/DumpCommand.java | 0 .../command/defaults/HelpCommand.java | 0 .../command/defaults/ListCommand.java | 0 .../command/defaults/OffhandCommand.java | 0 .../command/defaults/ReloadCommand.java | 0 .../command/defaults/SettingsCommand.java | 0 .../command/defaults/StatisticsCommand.java | 0 .../command/defaults/StopCommand.java | 0 .../command/defaults/VersionCommand.java | 0 .../geysermc/connector/common/AuthType.java | 0 .../geysermc/connector/common/ChatColor.java | 0 .../common/connection/ChannelWrapper.java | 0 .../DefaultChannelPipelinePublic.java | 0 .../common/connection/GeyserInjector.java | 0 .../LocalChannelWithRemoteAddress.java | 0 .../connection/LocalChannelWrapper.java | 0 .../connection/LocalServerChannelWrapper.java | 0 .../common/connection/LocalSession.java | 0 .../connector/common/main/IGeyserMain.java | 0 .../connector/common/ping/GeyserPingInfo.java | 0 .../common/serializer/AsteriskSerializer.java | 0 .../EmoteOffhandWorkaroundOption.java | 0 .../configuration/GeyserConfiguration.java | 0 .../GeyserJacksonConfiguration.java | 0 .../connector/dump/BootstrapDumpInfo.java | 0 .../org/geysermc/connector/dump/DumpInfo.java | 0 .../connector/entity/AbstractArrowEntity.java | 0 .../entity/AreaEffectCloudEntity.java | 0 .../geysermc/connector/entity/BoatEntity.java | 0 .../entity/CommandBlockMinecartEntity.java | 0 .../entity/DefaultBlockMinecartEntity.java | 0 .../connector/entity/EnderCrystalEntity.java | 0 .../org/geysermc/connector/entity/Entity.java | 0 .../connector/entity/EntityDefinition.java | 0 .../connector/entity/EntityDefinitions.java | 0 .../entity/EntityMetadataTranslator.java | 0 .../connector/entity/ExpOrbEntity.java | 0 .../connector/entity/FallingBlockEntity.java | 112 +++++++-------- .../connector/entity/FireworkEntity.java | 0 .../connector/entity/FishingHookEntity.java | 0 .../entity/FurnaceMinecartEntity.java | 0 .../connector/entity/GeyserDirtyMetadata.java | 0 .../geysermc/connector/entity/ItemEntity.java | 0 .../connector/entity/ItemFrameEntity.java | 0 .../entity/ItemedFireballEntity.java | 0 .../connector/entity/LeashKnotEntity.java | 0 .../connector/entity/LightningEntity.java | 0 .../connector/entity/LivingEntity.java | 0 .../connector/entity/MinecartEntity.java | 0 .../connector/entity/PaintingEntity.java | 0 .../entity/SpawnerMinecartEntity.java | 0 .../geysermc/connector/entity/TNTEntity.java | 0 .../connector/entity/ThrowableEntity.java | 0 .../connector/entity/ThrowableItemEntity.java | 0 .../connector/entity/ThrownPotionEntity.java | 0 .../geysermc/connector/entity/Tickable.java | 0 .../connector/entity/TippedArrowEntity.java | 0 .../connector/entity/TridentEntity.java | 0 .../connector/entity/WitherSkullEntity.java | 0 .../entity/attribute/GeyserAttributeType.java | 0 .../entity/factory/BaseEntityFactory.java | 0 .../entity/factory/EntityFactory.java | 0 .../factory/ExperienceOrbEntityFactory.java | 0 .../entity/factory/PaintingEntityFactory.java | 0 .../entity/living/AbstractFishEntity.java | 0 .../entity/living/AgeableEntity.java | 0 .../entity/living/AmbientEntity.java | 0 .../entity/living/ArmorStandEntity.java | 0 .../connector/entity/living/BatEntity.java | 0 .../entity/living/CreatureEntity.java | 0 .../connector/entity/living/FlyingEntity.java | 0 .../entity/living/GlowSquidEntity.java | 0 .../connector/entity/living/GolemEntity.java | 0 .../entity/living/IronGolemEntity.java | 0 .../entity/living/MagmaCubeEntity.java | 0 .../connector/entity/living/MobEntity.java | 0 .../connector/entity/living/SlimeEntity.java | 0 .../entity/living/SnowGolemEntity.java | 0 .../connector/entity/living/SquidEntity.java | 0 .../connector/entity/living/WaterEntity.java | 0 .../entity/living/animal/AnimalEntity.java | 0 .../entity/living/animal/AxolotlEntity.java | 0 .../entity/living/animal/BeeEntity.java | 0 .../entity/living/animal/ChickenEntity.java | 0 .../entity/living/animal/FoxEntity.java | 0 .../entity/living/animal/GoatEntity.java | 0 .../entity/living/animal/HoglinEntity.java | 0 .../entity/living/animal/MooshroomEntity.java | 0 .../entity/living/animal/OcelotEntity.java | 0 .../entity/living/animal/PandaEntity.java | 0 .../entity/living/animal/PigEntity.java | 0 .../entity/living/animal/PolarBearEntity.java | 0 .../living/animal/PufferFishEntity.java | 0 .../entity/living/animal/RabbitEntity.java | 0 .../entity/living/animal/SheepEntity.java | 0 .../entity/living/animal/StriderEntity.java | 0 .../living/animal/TropicalFishEntity.java | 0 .../entity/living/animal/TurtleEntity.java | 0 .../animal/horse/AbstractHorseEntity.java | 0 .../animal/horse/ChestedHorseEntity.java | 0 .../living/animal/horse/HorseEntity.java | 0 .../living/animal/horse/LlamaEntity.java | 0 .../animal/horse/TraderLlamaEntity.java | 0 .../living/animal/tameable/CatEntity.java | 0 .../living/animal/tameable/ParrotEntity.java | 0 .../animal/tameable/TameableEntity.java | 0 .../living/animal/tameable/WolfEntity.java | 0 .../merchant/AbstractMerchantEntity.java | 0 .../living/merchant/VillagerEntity.java | 0 .../monster/AbstractSkeletonEntity.java | 0 .../living/monster/BasePiglinEntity.java | 0 .../entity/living/monster/BlazeEntity.java | 0 .../entity/living/monster/CreeperEntity.java | 0 .../living/monster/ElderGuardianEntity.java | 0 .../living/monster/EnderDragonEntity.java | 0 .../living/monster/EnderDragonPartEntity.java | 0 .../entity/living/monster/EndermanEntity.java | 0 .../entity/living/monster/GhastEntity.java | 0 .../entity/living/monster/GiantEntity.java | 0 .../entity/living/monster/GuardianEntity.java | 0 .../entity/living/monster/MonsterEntity.java | 0 .../entity/living/monster/PhantomEntity.java | 0 .../entity/living/monster/PiglinEntity.java | 0 .../entity/living/monster/ShulkerEntity.java | 0 .../entity/living/monster/SkeletonEntity.java | 0 .../entity/living/monster/SpiderEntity.java | 0 .../entity/living/monster/VexEntity.java | 0 .../entity/living/monster/WitherEntity.java | 0 .../entity/living/monster/ZoglinEntity.java | 0 .../entity/living/monster/ZombieEntity.java | 0 .../living/monster/ZombieVillagerEntity.java | 0 .../living/monster/ZombifiedPiglinEntity.java | 0 .../monster/raid/AbstractIllagerEntity.java | 0 .../living/monster/raid/PillagerEntity.java | 0 .../monster/raid/RaidParticipantEntity.java | 0 .../raid/SpellcasterIllagerEntity.java | 0 .../living/monster/raid/VindicatorEntity.java | 0 .../connector/entity/player/PlayerEntity.java | 0 .../entity/player/SessionPlayerEntity.java | 0 .../entity/player/SkullPlayerEntity.java | 0 .../connector/inventory/AnvilContainer.java | 0 .../connector/inventory/BeaconContainer.java | 0 .../inventory/CartographyContainer.java | 0 .../connector/inventory/Container.java | 0 .../inventory/EnchantingContainer.java | 0 .../inventory/Generic3X3Container.java | 0 .../inventory/GeyserEnchantOption.java | 0 .../connector/inventory/GeyserItemStack.java | 0 .../connector/inventory/Inventory.java | 0 .../connector/inventory/LecternContainer.java | 0 .../inventory/MerchantContainer.java | 0 .../connector/inventory/PlayerInventory.java | 0 .../inventory/StonecutterContainer.java | 0 .../geysermc/connector/metrics/Metrics.java | 0 .../connector/network/CIDRMatcher.java | 0 .../network/ConnectorServerEventHandler.java | 0 .../network/LoggingPacketHandler.java | 0 .../connector/network/MinecraftProtocol.java | 0 .../connector/network/QueryPacketHandler.java | 0 .../network/UpstreamPacketHandler.java | 0 .../network/session/GeyserSession.java | 0 .../network/session/UpstreamSession.java | 0 .../network/session/auth/AuthData.java | 0 .../session/auth/BedrockClientData.java | 0 .../session/cache/AdvancementsCache.java | 0 .../network/session/cache/BookEditCache.java | 0 .../network/session/cache/BossBar.java | 0 .../network/session/cache/ChunkCache.java | 0 .../network/session/cache/EntityCache.java | 0 .../session/cache/EntityEffectCache.java | 0 .../network/session/cache/FormCache.java | 0 .../network/session/cache/LodestoneCache.java | 0 .../network/session/cache/PistonCache.java | 0 .../session/cache/PreferencesCache.java | 0 .../network/session/cache/TagCache.java | 0 .../network/session/cache/TeleportCache.java | 0 .../network/session/cache/WorldBorder.java | 0 .../network/session/cache/WorldCache.java | 0 .../network/translators/ItemRemapper.java | 0 .../network/translators/PacketTranslator.java | 0 .../translators/PacketTranslatorRegistry.java | 0 .../network/translators/Translator.java | 0 .../BedrockAdventureSettingsTranslator.java | 0 .../bedrock/BedrockAnimateTranslator.java | 0 .../BedrockBlockEntityDataTranslator.java | 0 .../BedrockBlockPickRequestTranslator.java | 132 +++++++++--------- .../bedrock/BedrockBookEditTranslator.java | 0 .../BedrockCommandBlockUpdateTranslator.java | 0 .../BedrockCommandRequestTranslator.java | 0 .../BedrockContainerCloseTranslator.java | 0 .../bedrock/BedrockEmoteListTranslator.java | 0 .../BedrockEntityPickRequestTranslator.java | 0 .../bedrock/BedrockFilterTextTranslator.java | 0 ...BedrockInventoryTransactionTranslator.java | 0 .../BedrockItemFrameDropItemTranslator.java | 0 .../BedrockItemStackRequestTranslator.java | 0 .../BedrockLecternUpdateTranslator.java | 0 .../BedrockMapInfoRequestTranslator.java | 0 .../BedrockMobEquipmentTranslator.java | 0 .../BedrockMoveEntityAbsoluteTranslator.java | 0 .../BedrockNetworkStackLatencyTranslator.java | 0 ...drockPacketViolationWarningTranslator.java | 0 .../bedrock/BedrockPlayerInputTranslator.java | 0 ...tionTrackingDBClientRequestTranslator.java | 0 .../bedrock/BedrockRespawnTranslator.java | 0 ...edrockServerSettingsRequestTranslator.java | 0 ...SetLocalPlayerAsInitializedTranslator.java | 0 .../bedrock/BedrockShowCreditsTranslator.java | 0 .../bedrock/BedrockTextTranslator.java | 0 .../entity/BedrockEntityEventTranslator.java | 0 .../player/BedrockActionTranslator.java | 0 .../entity/player/BedrockEmoteTranslator.java | 0 .../player/BedrockInteractTranslator.java | 0 .../player/BedrockMovePlayerTranslator.java | 0 .../player/BedrockRiderJumpTranslator.java | 0 .../BedrockSetPlayerGameTypeTranslator.java | 0 .../BedrockLevelSoundEventTranslator.java | 0 .../chat/GsonComponentSerializerWrapper.java | 0 .../translators/chat/MessageTranslator.java | 0 .../chat/MinecraftTranslationRegistry.java | 0 .../translators/collision/BoundingBox.java | 0 .../collision/CollisionManager.java | 0 .../collision/CollisionRemapper.java | 0 .../collision/translators/BlockCollision.java | 0 .../translators/DirtPathCollision.java | 0 .../collision/translators/DoorCollision.java | 0 .../collision/translators/OtherCollision.java | 0 .../translators/ScaffoldingCollision.java | 0 .../collision/translators/SnowCollision.java | 0 .../collision/translators/SolidCollision.java | 0 .../translators/SpawnerCollision.java | 0 .../translators/TrapdoorCollision.java | 0 .../inventory/BedrockContainerSlot.java | 0 .../inventory/InventoryTranslator.java | 0 .../translators/inventory/SlotType.java | 0 .../translators/inventory/click/Click.java | 0 .../inventory/click/ClickPlan.java | 0 .../holder/BlockInventoryHolder.java | 0 .../inventory/holder/InventoryHolder.java | 0 .../AbstractBlockInventoryTranslator.java | 0 .../translators/AnvilInventoryTranslator.java | 0 .../translators/BaseInventoryTranslator.java | 0 .../BeaconInventoryTranslator.java | 0 .../BrewingInventoryTranslator.java | 0 .../CartographyInventoryTranslator.java | 0 .../CraftingInventoryTranslator.java | 0 .../EnchantingInventoryTranslator.java | 0 .../Generic3X3InventoryTranslator.java | 0 .../GrindstoneInventoryTranslator.java | 0 .../HopperInventoryTranslator.java | 0 .../LecternInventoryTranslator.java | 0 .../translators/LoomInventoryTranslator.java | 0 .../MerchantInventoryTranslator.java | 0 .../PlayerInventoryTranslator.java | 0 .../ShulkerInventoryTranslator.java | 0 .../SmithingInventoryTranslator.java | 0 .../StonecutterInventoryTranslator.java | 0 .../chest/ChestInventoryTranslator.java | 0 .../chest/DoubleChestInventoryTranslator.java | 0 .../chest/SingleChestInventoryTranslator.java | 0 .../AbstractFurnaceInventoryTranslator.java | 0 .../BlastFurnaceInventoryTranslator.java | 0 .../furnace/FurnaceInventoryTranslator.java | 0 .../furnace/SmokerInventoryTranslator.java | 0 .../AbstractHorseInventoryTranslator.java | 0 .../ChestedHorseInventoryTranslator.java | 0 .../horse/DonkeyInventoryTranslator.java | 0 .../horse/HorseInventoryTranslator.java | 0 .../horse/LlamaInventoryTranslator.java | 0 .../updater/AnvilInventoryUpdater.java | 0 .../updater/ChestInventoryUpdater.java | 0 .../updater/ContainerInventoryUpdater.java | 0 .../updater/HorseInventoryUpdater.java | 0 .../inventory/updater/InventoryUpdater.java | 0 .../inventory/updater/UIInventoryUpdater.java | 0 .../network/translators/item/Enchantment.java | 0 .../translators/item/ItemTranslator.java | 0 .../item/NbtItemStackTranslator.java | 0 .../network/translators/item/Potion.java | 0 .../translators/item/StoredItemMappings.java | 0 .../translators/item/TippedArrowPotion.java | 0 .../item/translators/BannerTranslator.java | 0 .../item/translators/CompassTranslator.java | 0 .../item/translators/PotionTranslator.java | 0 .../translators/TippedArrowTranslator.java | 0 .../nbt/AxolotlBucketTranslator.java | 0 .../translators/nbt/BasicItemTranslator.java | 0 .../translators/nbt/BookPagesTranslator.java | 0 .../translators/nbt/CrossbowTranslator.java | 0 .../nbt/EnchantedBookTranslator.java | 0 .../nbt/EnchantmentTranslator.java | 0 .../nbt/FireworkBaseTranslator.java | 0 .../nbt/FireworkRocketTranslator.java | 0 .../nbt/FireworkStarTranslator.java | 0 .../nbt/LeatherArmorTranslator.java | 0 .../nbt/LodestoneCompassTranslator.java | 0 .../translators/nbt/MapItemTranslator.java | 0 .../translators/nbt/PlayerHeadTranslator.java | 0 .../nbt/ShulkerBoxItemTranslator.java | 0 .../nbt/TropicalFishBucketTranslator.java | 0 .../java/JavaAwardStatsTranslator.java | 0 .../java/JavaBossEventTranslator.java | 0 .../java/JavaChangeDifficultyTranslator.java | 0 .../translators/java/JavaChatTranslator.java | 0 .../java/JavaCommandsTranslator.java | 0 .../java/JavaCustomPayloadTranslator.java | 0 .../java/JavaCustomQueryTranslator.java | 0 .../java/JavaDisconnectTranslator.java | 0 .../java/JavaGameProfileTranslator.java | 0 .../java/JavaKeepAliveTranslator.java | 0 .../java/JavaLoginDisconnectTranslator.java | 0 .../translators/java/JavaLoginTranslator.java | 0 .../translators/java/JavaPingTranslator.java | 0 .../java/JavaRecipeTranslator.java | 0 .../java/JavaRespawnTranslator.java | 0 .../JavaSelectAdvancementsTabTranslator.java | 0 .../JavaUpdateAdvancementsTranslator.java | 0 .../java/JavaUpdateRecipesTranslator.java | 0 .../java/JavaUpdateTagsTranslator.java | 0 .../java/entity/JavaAnimateTranslator.java | 0 .../entity/JavaEntityEventTranslator.java | 0 .../JavaMoveEntityPosRotTranslator.java | 0 .../entity/JavaMoveEntityPosTranslator.java | 0 .../entity/JavaMoveEntityRotTranslator.java | 0 .../entity/JavaMoveVehicleTranslator.java | 0 .../entity/JavaRemoveEntitiesTranslator.java | 0 .../entity/JavaRemoveMobEffectTranslator.java | 0 .../java/entity/JavaRotateHeadTranslator.java | 0 .../entity/JavaSetEntityDataTranslator.java | 0 .../entity/JavaSetEntityLinkTranslator.java | 0 .../entity/JavaSetEntityMotionTranslator.java | 0 .../entity/JavaSetEquipmentTranslator.java | 0 .../entity/JavaSetPassengersTranslator.java | 0 .../entity/JavaTakeItemEntityTranslator.java | 0 .../entity/JavaTeleportEntityTranslator.java | 0 .../JavaUpdateAttributesTranslator.java | 0 .../entity/JavaUpdateMobEffectTranslator.java | 0 .../player/JavaBlockBreakAckTranslator.java | 0 .../player/JavaPlayerAbilitiesTranslator.java | 0 .../player/JavaPlayerInfoTranslator.java | 0 .../player/JavaPlayerPositionTranslator.java | 0 .../player/JavaSetCarriedItemTranslator.java | 0 .../player/JavaSetExperienceTranslator.java | 0 .../player/JavaSetHealthTranslator.java | 0 .../entity/spawn/JavaAddEntityTranslator.java | 0 .../spawn/JavaAddExperienceOrbTranslator.java | 0 .../entity/spawn/JavaAddMobTranslator.java | 0 .../spawn/JavaAddPaintingTranslator.java | 0 .../entity/spawn/JavaAddPlayerTranslator.java | 0 .../JavaContainerCloseTranslator.java | 0 .../JavaContainerSetContentTranslator.java | 0 .../JavaContainerSetDataTranslator.java | 0 .../JavaContainerSetSlotTranslator.java | 0 .../JavaHorseScreenOpenTranslator.java | 0 .../JavaMerchantOffersTranslator.java | 0 .../inventory/JavaOpenScreenTranslator.java | 0 .../level/JavaBlockDestructionTranslator.java | 0 .../level/JavaBlockEntityDataTranslator.java | 0 .../java/level/JavaBlockEventTranslator.java | 0 .../java/level/JavaBlockUpdateTranslator.java | 0 .../java/level/JavaCustomSoundTranslator.java | 0 .../java/level/JavaExplodeTranslator.java | 0 .../level/JavaForgetLevelChunkTranslator.java | 0 .../java/level/JavaGameEventTranslator.java | 0 .../JavaLevelChunkWithLightTranslator.java | 0 .../java/level/JavaLevelEventTranslator.java | 0 .../level/JavaLevelParticlesTranslator.java | 0 .../java/level/JavaMapItemDataTranslator.java | 0 .../JavaSectionBlocksUpdateTranslator.java | 0 .../JavaSetChunkCacheCenterTranslator.java | 0 .../JavaSetChunkCacheRadiusTranslator.java | 0 ...JavaSetDefaultSpawnPositionTranslator.java | 0 .../java/level/JavaSetTimeTranslator.java | 0 .../java/level/JavaSoundTranslator.java | 0 .../java/level/JavaStopSoundTranslator.java | 0 .../JavaInitializeBorderTranslator.java | 0 .../border/JavaSetBorderCenterTranslator.java | 0 .../JavaSetBorderLerpSizeTranslator.java | 0 .../border/JavaSetBorderSizeTranslator.java | 0 .../JavaSetBorderWarningDelayTranslator.java | 0 ...avaSetBorderWarningDistanceTranslator.java | 0 .../JavaSetDisplayObjectiveTranslator.java | 0 .../JavaSetObjectiveTranslator.java | 0 .../JavaSetPlayerTeamTranslator.java | 0 .../scoreboard/JavaSetScoreTranslator.java | 0 .../java/title/JavaClearTitlesTranslator.java | 0 .../title/JavaSetActionBarTextTranslator.java | 0 .../title/JavaSetSubtitleTextTranslator.java | 0 .../title/JavaSetTitleTextTranslator.java | 0 .../JavaSetTitlesAnimationTranslator.java | 0 .../sound/BlockSoundInteractionHandler.java | 0 .../sound/EntitySoundInteractionHandler.java | 0 .../translators/sound/SoundHandler.java | 0 .../sound/SoundInteractionHandler.java | 0 .../block/BucketSoundInteractionHandler.java | 0 .../ComparatorSoundInteractionHandler.java | 0 .../block/DoorSoundInteractionHandler.java | 0 .../FlintAndSteelInteractionHandler.java | 0 .../block/GrassPathInteractionHandler.java | 0 .../sound/block/HoeInteractionHandler.java | 0 .../block/LeverSoundInteractionHandler.java | 0 .../FeedBabySoundInteractionHandler.java | 0 .../MilkEntitySoundInteractionHandler.java | 0 .../translators/world/BiomeTranslator.java | 0 .../translators/world/GeyserWorldManager.java | 0 .../translators/world/WorldManager.java | 0 .../world/block/BlockStateValues.java | 0 .../world/block/DoubleChestValue.java | 0 .../entity/BannerBlockEntityTranslator.java | 0 .../entity/BeaconBlockEntityTranslator.java | 0 .../entity/BedBlockEntityTranslator.java | 0 .../block/entity/BedrockOnlyBlockEntity.java | 0 .../world/block/entity/BlockEntity.java | 0 .../block/entity/BlockEntityTranslator.java | 0 .../entity/CampfireBlockEntityTranslator.java | 0 .../CommandBlockBlockEntityTranslator.java | 0 .../DoubleChestBlockEntityTranslator.java | 0 .../entity/EmptyBlockEntityTranslator.java | 0 .../EndGatewayBlockEntityTranslator.java | 0 .../FlowerPotBlockEntityTranslator.java | 0 .../JigsawBlockBlockEntityTranslator.java | 0 .../NoteblockBlockEntityTranslator.java | 0 .../world/block/entity/PistonBlockEntity.java | 0 .../entity/PistonBlockEntityTranslator.java | 0 .../block/entity/RequiresBlockState.java | 0 .../ShulkerBoxBlockEntityTranslator.java | 0 .../entity/SignBlockEntityTranslator.java | 0 .../entity/SkullBlockEntityTranslator.java | 0 .../entity/SpawnerBlockEntityTranslator.java | 0 .../translators/world/chunk/BlockStorage.java | 0 .../translators/world/chunk/GeyserChunk.java | 0 .../world/chunk/GeyserChunkSection.java | 0 .../translators/world/chunk/NibbleArray.java | 0 .../world/chunk/bitarray/BitArray.java | 0 .../world/chunk/bitarray/BitArrayVersion.java | 0 .../world/chunk/bitarray/PaddedBitArray.java | 0 .../world/chunk/bitarray/Pow2BitArray.java | 0 .../chunk/bitarray/SingletonBitArray.java | 0 .../world/event/LevelEventTransformer.java | 0 .../event/PlaySoundEventTransformer.java | 0 .../event/SoundEventEventTransformer.java | 0 .../event/SoundLevelEventTransformer.java | 0 .../ping/GeyserLegacyPingPassthrough.java | 0 .../ping/IGeyserPingPassthrough.java | 0 .../registry/AbstractMappedRegistry.java | 0 .../connector/registry/ArrayRegistry.java | 0 .../connector/registry/BlockRegistries.java | 0 .../connector/registry/MappedRegistry.java | 0 .../connector/registry/Registries.java | 0 .../geysermc/connector/registry/Registry.java | 0 .../registry/SimpleMappedRegistry.java | 0 .../connector/registry/SimpleRegistry.java | 0 .../connector/registry/VersionedRegistry.java | 0 .../loader/AnnotatedRegistryLoader.java | 0 .../loader/BiomeIdentifierRegistryLoader.java | 0 .../loader/BlockEntityRegistryLoader.java | 0 .../loader/CollisionRegistryLoader.java | 0 .../registry/loader/EffectRegistryLoader.java | 0 .../loader/EnchantmentRegistryLoader.java | 0 .../loader/MultiResourceRegistryLoader.java | 0 .../registry/loader/NbtRegistryLoader.java | 0 .../loader/ParticleTypesRegistryLoader.java | 0 .../loader/PotionMixRegistryLoader.java | 0 .../registry/loader/RegistryLoader.java | 0 .../registry/loader/RegistryLoaders.java | 0 .../loader/SoundEventsRegistryLoader.java | 0 .../loader/SoundHandlerRegistryLoader.java | 0 .../registry/loader/SoundRegistryLoader.java | 0 .../populator/BlockRegistryPopulator.java | 0 .../populator/ItemRegistryPopulator.java | 0 .../populator/RecipeRegistryPopulator.java | 0 .../connector/registry/type/BlockMapping.java | 0 .../registry/type/BlockMappings.java | 0 .../registry/type/EnchantmentData.java | 0 .../registry/type/GeyserMappingItem.java | 0 .../connector/registry/type/ItemMapping.java | 0 .../connector/registry/type/ItemMappings.java | 0 .../connector/registry/type/PaletteItem.java | 0 .../registry/type/ParticleMapping.java | 0 .../connector/registry/type/SoundMapping.java | 0 .../connector/scoreboard/Objective.java | 0 .../geysermc/connector/scoreboard/Score.java | 0 .../connector/scoreboard/Scoreboard.java | 0 .../scoreboard/ScoreboardUpdater.java | 0 .../geysermc/connector/scoreboard/Team.java | 0 .../connector/scoreboard/UpdateType.java | 0 .../connector/skin/FloodgateSkinUploader.java | 0 .../geysermc/connector/skin/ProvidedSkin.java | 0 .../geysermc/connector/skin/SkinManager.java | 0 .../geysermc/connector/skin/SkinProvider.java | 0 .../connector/skin/SkullSkinManager.java | 0 .../connector/utils/AttributeUtils.java | 0 .../org/geysermc/connector/utils/Axis.java | 0 .../connector/utils/BedrockMapIcon.java | 0 .../connector/utils/BlockEntityUtils.java | 0 .../utils/BlockPositionIterator.java | 0 .../geysermc/connector/utils/BlockUtils.java | 0 .../geysermc/connector/utils/ChunkUtils.java | 0 .../geysermc/connector/utils/Constants.java | 0 .../connector/utils/CooldownUtils.java | 0 .../connector/utils/DimensionUtils.java | 0 .../geysermc/connector/utils/Direction.java | 0 .../geysermc/connector/utils/DockerCheck.java | 0 .../geysermc/connector/utils/EffectUtils.java | 0 .../geysermc/connector/utils/EntityUtils.java | 0 .../geysermc/connector/utils/FileUtils.java | 0 .../connector/utils/FireworkColor.java | 0 .../geysermc/connector/utils/GameRule.java | 0 .../connector/utils/GeyserAdvancement.java | 0 .../utils/InteractiveTagManager.java | 0 .../connector/utils/InventoryUtils.java | 0 .../geysermc/connector/utils/ItemUtils.java | 0 .../connector/utils/LanguageUtils.java | 0 .../geysermc/connector/utils/LocaleUtils.java | 0 .../connector/utils/LoginEncryptionUtils.java | 0 .../geysermc/connector/utils/MapColor.java | 0 .../geysermc/connector/utils/MathUtils.java | 0 .../geysermc/connector/utils/NewsHandler.java | 0 .../connector/utils/PaintingType.java | 0 .../connector/utils/PistonBehavior.java | 0 .../connector/utils/PluginMessageUtils.java | 0 .../connector/utils/ResourcePack.java | 0 .../connector/utils/ResourcePackManifest.java | 0 .../connector/utils/SettingsUtils.java | 0 .../geysermc/connector/utils/SignUtils.java | 0 .../geysermc/connector/utils/SoundUtils.java | 0 .../connector/utils/StatisticsUtils.java | 0 .../geysermc/connector/utils/WebUtils.java | 0 .../collections/FixedInt2BooleanMap.java | 0 .../utils/collections/FixedInt2ByteMap.java | 0 .../utils/collections/FixedInt2IntMap.java | 0 .../utils/collections/LecternHasBookMap.java | 0 .../utils/collections/Object2IntBiMap.java | 0 .../utils/collections/package-info.java | 0 .../javax.annotation.processing.Processor | 0 .../resources/bedrock/biome_definitions.dat | Bin .../bedrock/block_palette.1_17_30.nbt | Bin .../bedrock/block_palette.1_17_40.nbt | Bin .../bedrock/creative_items.1_17_30.json | 0 .../bedrock/creative_items.1_17_40.json | 0 .../resources/bedrock/entity_identifiers.dat | Bin .../bedrock/runtime_item_states.1_17_30.json | 0 .../bedrock/runtime_item_states.1_17_40.json | 0 .../skin/geometry.humanoid.customskull.json | 0 .../bedrock/skin/geometry.humanoid.ears.json | 0 .../skin/geometry.humanoid.earsSlim.json | 0 .../main/resources/bedrock/skin/skin_alex.png | Bin .../resources/bedrock/skin/skin_steve.png | Bin .../src/main/resources/config.yml | 0 core/src/main/resources/languages | 1 + core/src/main/resources/mappings | 1 + .../chat/MessageTranslatorTest.java | 0 .../collections/GeyserCollectionsTest.java | 0 pom.xml | 2 +- 573 files changed, 135 insertions(+), 135 deletions(-) delete mode 160000 connector/src/main/resources/languages delete mode 160000 connector/src/main/resources/mappings rename {connector => core}/pom.xml (99%) rename {connector => core}/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/GeyserConnector.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/GeyserLogger.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/SessionManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/CommandExecutor.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/CommandManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/CommandSender.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/GeyserCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/AuthType.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/ChatColor.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/connection/LocalSession.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/dump/DumpInfo.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/BoatEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/Entity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/EntityDefinition.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java (97%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/FireworkEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ItemEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/LightningEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/LivingEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/MinecartEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/PaintingEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/TNTEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/Tickable.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/TridentEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/BatEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/MobEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/Container.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/Inventory.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/LecternContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/metrics/Metrics.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/CIDRMatcher.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/GeyserSession.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/Translator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java (98%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemFrameDropItemTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/Potion.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerCloseTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/BlockRegistries.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/MappedRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/Registries.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/Registry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/SoundEventsRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/scoreboard/Objective.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/scoreboard/Score.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/scoreboard/Team.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/skin/SkinManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/skin/SkinProvider.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/AttributeUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/Axis.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/BlockUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/ChunkUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/Constants.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/CooldownUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/DimensionUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/Direction.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/DockerCheck.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/EffectUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/EntityUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/FileUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/FireworkColor.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/GameRule.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/InventoryUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/ItemUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/LanguageUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/LocaleUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/MapColor.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/MathUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/NewsHandler.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/PaintingType.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/PistonBehavior.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/ResourcePack.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/SettingsUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/SignUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/SoundUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/WebUtils.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java (100%) rename {connector => core}/src/main/java/org/geysermc/connector/utils/collections/package-info.java (100%) rename {connector => core}/src/main/resources/META-INF/services/javax.annotation.processing.Processor (100%) rename {connector => core}/src/main/resources/bedrock/biome_definitions.dat (100%) rename {connector => core}/src/main/resources/bedrock/block_palette.1_17_30.nbt (100%) rename {connector => core}/src/main/resources/bedrock/block_palette.1_17_40.nbt (100%) rename {connector => core}/src/main/resources/bedrock/creative_items.1_17_30.json (100%) rename {connector => core}/src/main/resources/bedrock/creative_items.1_17_40.json (100%) rename {connector => core}/src/main/resources/bedrock/entity_identifiers.dat (100%) rename {connector => core}/src/main/resources/bedrock/runtime_item_states.1_17_30.json (100%) rename {connector => core}/src/main/resources/bedrock/runtime_item_states.1_17_40.json (100%) rename {connector => core}/src/main/resources/bedrock/skin/geometry.humanoid.customskull.json (100%) rename {connector => core}/src/main/resources/bedrock/skin/geometry.humanoid.ears.json (100%) rename {connector => core}/src/main/resources/bedrock/skin/geometry.humanoid.earsSlim.json (100%) rename {connector => core}/src/main/resources/bedrock/skin/skin_alex.png (100%) rename {connector => core}/src/main/resources/bedrock/skin/skin_steve.png (100%) rename {connector => core}/src/main/resources/config.yml (100%) create mode 160000 core/src/main/resources/languages create mode 160000 core/src/main/resources/mappings rename {connector => core}/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java (100%) rename {connector => core}/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java (100%) diff --git a/.gitmodules b/.gitmodules index 0c014712b..1fdd03343 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "connector/src/main/resources/mappings"] - path = connector/src/main/resources/mappings +[submodule "core/src/main/resources/mappings"] + path = core/src/main/resources/mappings url = https://github.com/GeyserMC/mappings.git -[submodule "connector/src/main/resources/languages"] - path = connector/src/main/resources/languages +[submodule "core/src/main/resources/languages"] + path = core/src/main/resources/languages url = https://github.com/GeyserMC/languages.git diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index 089fd5b04..8ac38f269 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -13,7 +13,7 @@ org.geysermc - connector + core 1.4.3-SNAPSHOT compile diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index 4b5b50de9..0e8d922a3 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -20,7 +20,7 @@ org.geysermc - connector + core 1.4.3-SNAPSHOT compile diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml index a5582bbe0..db26cc4f0 100644 --- a/bootstrap/sponge/pom.xml +++ b/bootstrap/sponge/pom.xml @@ -13,7 +13,7 @@ org.geysermc - connector + core 1.4.3-SNAPSHOT compile diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index 64a6f6fee..6a8a35f30 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -13,7 +13,7 @@ org.geysermc - connector + core 1.4.3-SNAPSHOT compile diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml index fe984e974..11a805b86 100644 --- a/bootstrap/velocity/pom.xml +++ b/bootstrap/velocity/pom.xml @@ -13,7 +13,7 @@ org.geysermc - connector + core 1.4.3-SNAPSHOT compile diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages deleted file mode 160000 index d12420771..000000000 --- a/connector/src/main/resources/languages +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d12420771ea5e13083b3556552298d164767aae9 diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings deleted file mode 160000 index 5b6239f0a..000000000 --- a/connector/src/main/resources/mappings +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5b6239f0a43ec9a38d65ed53b8d1bfaf564c1c3b diff --git a/connector/pom.xml b/core/pom.xml similarity index 99% rename from connector/pom.xml rename to core/pom.xml index ec2efc1c9..fd4be59a0 100644 --- a/connector/pom.xml +++ b/core/pom.xml @@ -8,7 +8,7 @@ geyser-parent 1.4.3-SNAPSHOT - connector + core 4.9.3 diff --git a/connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java b/core/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java rename to core/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/GeyserConnector.java rename to core/src/main/java/org/geysermc/connector/GeyserConnector.java diff --git a/connector/src/main/java/org/geysermc/connector/GeyserLogger.java b/core/src/main/java/org/geysermc/connector/GeyserLogger.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/GeyserLogger.java rename to core/src/main/java/org/geysermc/connector/GeyserLogger.java diff --git a/connector/src/main/java/org/geysermc/connector/SessionManager.java b/core/src/main/java/org/geysermc/connector/SessionManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/SessionManager.java rename to core/src/main/java/org/geysermc/connector/SessionManager.java diff --git a/connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java b/core/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java rename to core/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java b/core/src/main/java/org/geysermc/connector/command/CommandExecutor.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/CommandExecutor.java rename to core/src/main/java/org/geysermc/connector/command/CommandExecutor.java diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java b/core/src/main/java/org/geysermc/connector/command/CommandManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/CommandManager.java rename to core/src/main/java/org/geysermc/connector/command/CommandManager.java diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandSender.java b/core/src/main/java/org/geysermc/connector/command/CommandSender.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/CommandSender.java rename to core/src/main/java/org/geysermc/connector/command/CommandSender.java diff --git a/connector/src/main/java/org/geysermc/connector/command/GeyserCommand.java b/core/src/main/java/org/geysermc/connector/command/GeyserCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/GeyserCommand.java rename to core/src/main/java/org/geysermc/connector/command/GeyserCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java rename to core/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java diff --git a/connector/src/main/java/org/geysermc/connector/common/AuthType.java b/core/src/main/java/org/geysermc/connector/common/AuthType.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/AuthType.java rename to core/src/main/java/org/geysermc/connector/common/AuthType.java diff --git a/connector/src/main/java/org/geysermc/connector/common/ChatColor.java b/core/src/main/java/org/geysermc/connector/common/ChatColor.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/ChatColor.java rename to core/src/main/java/org/geysermc/connector/common/ChatColor.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java b/core/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java rename to core/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java b/core/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java rename to core/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java b/core/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java rename to core/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java b/core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java rename to core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java b/core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java rename to core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java b/core/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java rename to core/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java diff --git a/connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java b/core/src/main/java/org/geysermc/connector/common/connection/LocalSession.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/connection/LocalSession.java rename to core/src/main/java/org/geysermc/connector/common/connection/LocalSession.java diff --git a/connector/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java b/core/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java rename to core/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java diff --git a/connector/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java b/core/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java rename to core/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java diff --git a/connector/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java b/core/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java rename to core/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java diff --git a/connector/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java b/core/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java rename to core/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/core/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java rename to core/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/core/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java rename to core/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java diff --git a/connector/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java b/core/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java rename to core/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/core/src/main/java/org/geysermc/connector/dump/DumpInfo.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java rename to core/src/main/java/org/geysermc/connector/dump/DumpInfo.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java rename to core/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java rename to core/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/core/src/main/java/org/geysermc/connector/entity/BoatEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java rename to core/src/main/java/org/geysermc/connector/entity/BoatEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java rename to core/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java rename to core/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java rename to core/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/Entity.java b/core/src/main/java/org/geysermc/connector/entity/Entity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/Entity.java rename to core/src/main/java/org/geysermc/connector/entity/Entity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java b/core/src/main/java/org/geysermc/connector/entity/EntityDefinition.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/EntityDefinition.java rename to core/src/main/java/org/geysermc/connector/entity/EntityDefinition.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java rename to core/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java b/core/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java rename to core/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java b/core/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java b/core/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java similarity index 97% rename from connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java rename to core/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java index c57eaa02a..6339a080d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java @@ -1,56 +1,56 @@ -/* - * Copyright (c) 2019-2021 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.connector.entity; - -import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.network.session.GeyserSession; - -import java.util.UUID; - -public class FallingBlockEntity extends Entity { - private final int javaId; - - public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { - super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); - this.javaId = javaId; - } - - @Override - protected void initializeMetadata() { - super.initializeMetadata(); - this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); - } - - @Override - public void setGravity(BooleanEntityMetadata entityMetadata) { - super.setGravity(entityMetadata); - // Set the NO_AI flag based on the no gravity flag to prevent movement - setFlag(EntityFlag.NO_AI, entityMetadata.getPrimitiveValue()); - } -} +/* + * Copyright (c) 2019-2021 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.connector.entity; + +import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; +import com.nukkitx.math.vector.Vector3f; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import org.geysermc.connector.network.session.GeyserSession; + +import java.util.UUID; + +public class FallingBlockEntity extends Entity { + private final int javaId; + + public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { + super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); + this.javaId = javaId; + } + + @Override + protected void initializeMetadata() { + super.initializeMetadata(); + this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); + } + + @Override + public void setGravity(BooleanEntityMetadata entityMetadata) { + super.setGravity(entityMetadata); + // Set the NO_AI flag based on the no gravity flag to prevent movement + setFlag(EntityFlag.NO_AI, entityMetadata.getPrimitiveValue()); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/core/src/main/java/org/geysermc/connector/entity/FireworkEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/FireworkEntity.java rename to core/src/main/java/org/geysermc/connector/entity/FireworkEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/core/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java rename to core/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java rename to core/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java b/core/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java rename to core/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/core/src/main/java/org/geysermc/connector/entity/ItemEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ItemEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ItemEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/core/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java b/core/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java b/core/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java rename to core/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java b/core/src/main/java/org/geysermc/connector/entity/LightningEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/LightningEntity.java rename to core/src/main/java/org/geysermc/connector/entity/LightningEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java b/core/src/main/java/org/geysermc/connector/entity/LivingEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/LivingEntity.java rename to core/src/main/java/org/geysermc/connector/entity/LivingEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java b/core/src/main/java/org/geysermc/connector/entity/MinecartEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/MinecartEntity.java rename to core/src/main/java/org/geysermc/connector/entity/MinecartEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java b/core/src/main/java/org/geysermc/connector/entity/PaintingEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/PaintingEntity.java rename to core/src/main/java/org/geysermc/connector/entity/PaintingEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java rename to core/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java b/core/src/main/java/org/geysermc/connector/entity/TNTEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/TNTEntity.java rename to core/src/main/java/org/geysermc/connector/entity/TNTEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java b/core/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java rename to core/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/Tickable.java b/core/src/main/java/org/geysermc/connector/entity/Tickable.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/Tickable.java rename to core/src/main/java/org/geysermc/connector/entity/Tickable.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java b/core/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java rename to core/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/TridentEntity.java b/core/src/main/java/org/geysermc/connector/entity/TridentEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/TridentEntity.java rename to core/src/main/java/org/geysermc/connector/entity/TridentEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java b/core/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java rename to core/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java b/core/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java rename to core/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java b/core/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java rename to core/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java b/core/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java rename to core/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java b/core/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java rename to core/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java b/core/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java rename to core/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/BatEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/BatEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/BatEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/MobEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/MobEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/MobEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java rename to core/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/core/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java b/core/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java rename to core/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java b/core/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java b/core/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java b/core/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Container.java b/core/src/main/java/org/geysermc/connector/inventory/Container.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/Container.java rename to core/src/main/java/org/geysermc/connector/inventory/Container.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java b/core/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java b/core/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java rename to core/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java b/core/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java rename to core/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java b/core/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java rename to core/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/Inventory.java b/core/src/main/java/org/geysermc/connector/inventory/Inventory.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/Inventory.java rename to core/src/main/java/org/geysermc/connector/inventory/Inventory.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/LecternContainer.java b/core/src/main/java/org/geysermc/connector/inventory/LecternContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/LecternContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/LecternContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java b/core/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java b/core/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java rename to core/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java diff --git a/connector/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java b/core/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java rename to core/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java diff --git a/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java b/core/src/main/java/org/geysermc/connector/metrics/Metrics.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/metrics/Metrics.java rename to core/src/main/java/org/geysermc/connector/metrics/Metrics.java diff --git a/connector/src/main/java/org/geysermc/connector/network/CIDRMatcher.java b/core/src/main/java/org/geysermc/connector/network/CIDRMatcher.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/CIDRMatcher.java rename to core/src/main/java/org/geysermc/connector/network/CIDRMatcher.java diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java rename to core/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java rename to core/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java b/core/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java rename to core/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java diff --git a/connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java b/core/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java rename to core/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java rename to core/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java rename to core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java b/core/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java rename to core/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java rename to core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/core/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java rename to core/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java b/core/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java b/core/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java rename to core/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java b/core/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java rename to core/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java rename to core/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/Translator.java b/core/src/main/java/org/geysermc/connector/network/translators/Translator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/Translator.java rename to core/src/main/java/org/geysermc/connector/network/translators/Translator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java similarity index 98% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java index 24af60e6c..666c7548b 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java @@ -1,66 +1,66 @@ -/* - * Copyright (c) 2019-2021 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.connector.network.translators.bedrock; - -import com.nukkitx.math.vector.Vector3i; -import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.InventoryUtils; - -@Translator(packet = BlockPickRequestPacket.class) -public class BedrockBlockPickRequestTranslator extends PacketTranslator { - - @Override - public void translate(GeyserSession session, BlockPickRequestPacket packet) { - Vector3i vector = packet.getBlockPosition(); - int blockToPick = session.getConnector().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); - - // Block is air - chunk caching is probably off - if (blockToPick == BlockStateValues.JAVA_AIR_ID) { - // Check for an item frame since the client thinks that's a block when it's an entity in Java - ItemFrameEntity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition()); - if (entity != null) { - // Check to see if the item frame has an item in it first - if (entity.getHeldItem() != null && entity.getHeldItem().getId() != 0) { - // Grab the item in the frame - InventoryUtils.findOrCreateItem(session, entity.getHeldItem()); - } else { - // Grab the frame as the item - InventoryUtils.findOrCreateItem(session, entity.getDefinition() == EntityDefinitions.GLOW_ITEM_FRAME ? "minecraft:glow_item_frame" : "minecraft:item_frame"); - } - } - return; - } - - InventoryUtils.findOrCreateItem(session, BlockRegistries.JAVA_BLOCKS.get(blockToPick).getPickItem()); - } -} +/* + * Copyright (c) 2019-2021 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.connector.network.translators.bedrock; + +import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; +import org.geysermc.connector.entity.EntityDefinitions; +import org.geysermc.connector.entity.ItemFrameEntity; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.network.translators.PacketTranslator; +import org.geysermc.connector.network.translators.Translator; +import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.connector.utils.InventoryUtils; + +@Translator(packet = BlockPickRequestPacket.class) +public class BedrockBlockPickRequestTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, BlockPickRequestPacket packet) { + Vector3i vector = packet.getBlockPosition(); + int blockToPick = session.getConnector().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); + + // Block is air - chunk caching is probably off + if (blockToPick == BlockStateValues.JAVA_AIR_ID) { + // Check for an item frame since the client thinks that's a block when it's an entity in Java + ItemFrameEntity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition()); + if (entity != null) { + // Check to see if the item frame has an item in it first + if (entity.getHeldItem() != null && entity.getHeldItem().getId() != 0) { + // Grab the item in the frame + InventoryUtils.findOrCreateItem(session, entity.getHeldItem()); + } else { + // Grab the frame as the item + InventoryUtils.findOrCreateItem(session, entity.getDefinition() == EntityDefinitions.GLOW_ITEM_FRAME ? "minecraft:glow_item_frame" : "minecraft:item_frame"); + } + } + return; + } + + InventoryUtils.findOrCreateItem(session, BlockRegistries.JAVA_BLOCKS.get(blockToPick).getPickItem()); + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBookEditTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemFrameDropItemTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemFrameDropItemTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemFrameDropItemTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemFrameDropItemTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockItemStackRequestTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockLecternUpdateTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMapInfoRequestTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMobEquipmentTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPlayerInputTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockActionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java b/core/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java rename to core/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java b/core/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java rename to core/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java b/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java rename to core/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java b/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java rename to core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java b/core/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/Potion.java b/core/src/main/java/org/geysermc/connector/network/translators/item/Potion.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/Potion.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/Potion.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java b/core/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java b/core/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomPayloadTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaKeepAliveTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginDisconnectTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetPassengersTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTakeItemEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaTeleportEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerPositionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerCloseTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerCloseTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerCloseTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerCloseTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaCustomSoundTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaExplodeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaGameEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelEventTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaMapItemDataTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaStopSoundTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java b/core/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java b/core/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java b/core/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java b/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java b/core/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java b/core/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java b/core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java b/core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java rename to core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java diff --git a/connector/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java b/core/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java rename to core/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java diff --git a/connector/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java b/core/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java rename to core/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java b/core/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java rename to core/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java b/core/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java rename to core/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/core/src/main/java/org/geysermc/connector/registry/BlockRegistries.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/BlockRegistries.java rename to core/src/main/java/org/geysermc/connector/registry/BlockRegistries.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/MappedRegistry.java b/core/src/main/java/org/geysermc/connector/registry/MappedRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/MappedRegistry.java rename to core/src/main/java/org/geysermc/connector/registry/MappedRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registries.java b/core/src/main/java/org/geysermc/connector/registry/Registries.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/Registries.java rename to core/src/main/java/org/geysermc/connector/registry/Registries.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/Registry.java b/core/src/main/java/org/geysermc/connector/registry/Registry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/Registry.java rename to core/src/main/java/org/geysermc/connector/registry/Registry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java b/core/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java rename to core/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java b/core/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java rename to core/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java b/core/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java rename to core/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/EnchantmentRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/MultiResourceRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/NbtRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/ParticleTypesRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/PotionMixRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/RegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java b/core/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java rename to core/src/main/java/org/geysermc/connector/registry/loader/RegistryLoaders.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundEventsRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/SoundEventsRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/SoundEventsRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/SoundEventsRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/SoundHandlerRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java b/core/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java rename to core/src/main/java/org/geysermc/connector/registry/loader/SoundRegistryLoader.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java rename to core/src/main/java/org/geysermc/connector/registry/populator/BlockRegistryPopulator.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java rename to core/src/main/java/org/geysermc/connector/registry/populator/ItemRegistryPopulator.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java b/core/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java rename to core/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java b/core/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java rename to core/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/core/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java rename to core/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java b/core/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java rename to core/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java b/core/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java rename to core/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java b/core/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java rename to core/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java b/core/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java rename to core/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java b/core/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java rename to core/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java b/core/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java rename to core/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java diff --git a/connector/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java b/core/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java rename to core/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java b/core/src/main/java/org/geysermc/connector/scoreboard/Objective.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/scoreboard/Objective.java rename to core/src/main/java/org/geysermc/connector/scoreboard/Objective.java diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Score.java b/core/src/main/java/org/geysermc/connector/scoreboard/Score.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/scoreboard/Score.java rename to core/src/main/java/org/geysermc/connector/scoreboard/Score.java diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java rename to core/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java b/core/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java rename to core/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/core/src/main/java/org/geysermc/connector/scoreboard/Team.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/scoreboard/Team.java rename to core/src/main/java/org/geysermc/connector/scoreboard/Team.java diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java b/core/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java rename to core/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java diff --git a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java b/core/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java rename to core/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java diff --git a/connector/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java b/core/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java rename to core/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java b/core/src/main/java/org/geysermc/connector/skin/SkinManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/skin/SkinManager.java rename to core/src/main/java/org/geysermc/connector/skin/SkinManager.java diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/core/src/main/java/org/geysermc/connector/skin/SkinProvider.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java rename to core/src/main/java/org/geysermc/connector/skin/SkinProvider.java diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java b/core/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java rename to core/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/AttributeUtils.java b/core/src/main/java/org/geysermc/connector/utils/AttributeUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/AttributeUtils.java rename to core/src/main/java/org/geysermc/connector/utils/AttributeUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/Axis.java b/core/src/main/java/org/geysermc/connector/utils/Axis.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/Axis.java rename to core/src/main/java/org/geysermc/connector/utils/Axis.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java b/core/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java rename to core/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java b/core/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java rename to core/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java b/core/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java rename to core/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/core/src/main/java/org/geysermc/connector/utils/BlockUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/BlockUtils.java rename to core/src/main/java/org/geysermc/connector/utils/BlockUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/core/src/main/java/org/geysermc/connector/utils/ChunkUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java rename to core/src/main/java/org/geysermc/connector/utils/ChunkUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/Constants.java b/core/src/main/java/org/geysermc/connector/utils/Constants.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/Constants.java rename to core/src/main/java/org/geysermc/connector/utils/Constants.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/CooldownUtils.java b/core/src/main/java/org/geysermc/connector/utils/CooldownUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/CooldownUtils.java rename to core/src/main/java/org/geysermc/connector/utils/CooldownUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/core/src/main/java/org/geysermc/connector/utils/DimensionUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/DimensionUtils.java rename to core/src/main/java/org/geysermc/connector/utils/DimensionUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/Direction.java b/core/src/main/java/org/geysermc/connector/utils/Direction.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/Direction.java rename to core/src/main/java/org/geysermc/connector/utils/Direction.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/DockerCheck.java b/core/src/main/java/org/geysermc/connector/utils/DockerCheck.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/DockerCheck.java rename to core/src/main/java/org/geysermc/connector/utils/DockerCheck.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java b/core/src/main/java/org/geysermc/connector/utils/EffectUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/EffectUtils.java rename to core/src/main/java/org/geysermc/connector/utils/EffectUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/core/src/main/java/org/geysermc/connector/utils/EntityUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/EntityUtils.java rename to core/src/main/java/org/geysermc/connector/utils/EntityUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java b/core/src/main/java/org/geysermc/connector/utils/FileUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/FileUtils.java rename to core/src/main/java/org/geysermc/connector/utils/FileUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java b/core/src/main/java/org/geysermc/connector/utils/FireworkColor.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/FireworkColor.java rename to core/src/main/java/org/geysermc/connector/utils/FireworkColor.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/GameRule.java b/core/src/main/java/org/geysermc/connector/utils/GameRule.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/GameRule.java rename to core/src/main/java/org/geysermc/connector/utils/GameRule.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java b/core/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java rename to core/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java b/core/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java rename to core/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/core/src/main/java/org/geysermc/connector/utils/InventoryUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/InventoryUtils.java rename to core/src/main/java/org/geysermc/connector/utils/InventoryUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/ItemUtils.java b/core/src/main/java/org/geysermc/connector/utils/ItemUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/ItemUtils.java rename to core/src/main/java/org/geysermc/connector/utils/ItemUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java b/core/src/main/java/org/geysermc/connector/utils/LanguageUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/LanguageUtils.java rename to core/src/main/java/org/geysermc/connector/utils/LanguageUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/core/src/main/java/org/geysermc/connector/utils/LocaleUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/LocaleUtils.java rename to core/src/main/java/org/geysermc/connector/utils/LocaleUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java rename to core/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/MapColor.java b/core/src/main/java/org/geysermc/connector/utils/MapColor.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/MapColor.java rename to core/src/main/java/org/geysermc/connector/utils/MapColor.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/MathUtils.java b/core/src/main/java/org/geysermc/connector/utils/MathUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/MathUtils.java rename to core/src/main/java/org/geysermc/connector/utils/MathUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java b/core/src/main/java/org/geysermc/connector/utils/NewsHandler.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/NewsHandler.java rename to core/src/main/java/org/geysermc/connector/utils/NewsHandler.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/PaintingType.java b/core/src/main/java/org/geysermc/connector/utils/PaintingType.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/PaintingType.java rename to core/src/main/java/org/geysermc/connector/utils/PaintingType.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/PistonBehavior.java b/core/src/main/java/org/geysermc/connector/utils/PistonBehavior.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/PistonBehavior.java rename to core/src/main/java/org/geysermc/connector/utils/PistonBehavior.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java b/core/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java rename to core/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/ResourcePack.java b/core/src/main/java/org/geysermc/connector/utils/ResourcePack.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/ResourcePack.java rename to core/src/main/java/org/geysermc/connector/utils/ResourcePack.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java b/core/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java rename to core/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java b/core/src/main/java/org/geysermc/connector/utils/SettingsUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/SettingsUtils.java rename to core/src/main/java/org/geysermc/connector/utils/SettingsUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/SignUtils.java b/core/src/main/java/org/geysermc/connector/utils/SignUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/SignUtils.java rename to core/src/main/java/org/geysermc/connector/utils/SignUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/SoundUtils.java b/core/src/main/java/org/geysermc/connector/utils/SoundUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/SoundUtils.java rename to core/src/main/java/org/geysermc/connector/utils/SoundUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java b/core/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java rename to core/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/WebUtils.java b/core/src/main/java/org/geysermc/connector/utils/WebUtils.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/WebUtils.java rename to core/src/main/java/org/geysermc/connector/utils/WebUtils.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java b/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java rename to core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java b/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java rename to core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java b/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java rename to core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java b/core/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java rename to core/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java b/core/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java rename to core/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java diff --git a/connector/src/main/java/org/geysermc/connector/utils/collections/package-info.java b/core/src/main/java/org/geysermc/connector/utils/collections/package-info.java similarity index 100% rename from connector/src/main/java/org/geysermc/connector/utils/collections/package-info.java rename to core/src/main/java/org/geysermc/connector/utils/collections/package-info.java diff --git a/connector/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/core/src/main/resources/META-INF/services/javax.annotation.processing.Processor similarity index 100% rename from connector/src/main/resources/META-INF/services/javax.annotation.processing.Processor rename to core/src/main/resources/META-INF/services/javax.annotation.processing.Processor diff --git a/connector/src/main/resources/bedrock/biome_definitions.dat b/core/src/main/resources/bedrock/biome_definitions.dat similarity index 100% rename from connector/src/main/resources/bedrock/biome_definitions.dat rename to core/src/main/resources/bedrock/biome_definitions.dat diff --git a/connector/src/main/resources/bedrock/block_palette.1_17_30.nbt b/core/src/main/resources/bedrock/block_palette.1_17_30.nbt similarity index 100% rename from connector/src/main/resources/bedrock/block_palette.1_17_30.nbt rename to core/src/main/resources/bedrock/block_palette.1_17_30.nbt diff --git a/connector/src/main/resources/bedrock/block_palette.1_17_40.nbt b/core/src/main/resources/bedrock/block_palette.1_17_40.nbt similarity index 100% rename from connector/src/main/resources/bedrock/block_palette.1_17_40.nbt rename to core/src/main/resources/bedrock/block_palette.1_17_40.nbt diff --git a/connector/src/main/resources/bedrock/creative_items.1_17_30.json b/core/src/main/resources/bedrock/creative_items.1_17_30.json similarity index 100% rename from connector/src/main/resources/bedrock/creative_items.1_17_30.json rename to core/src/main/resources/bedrock/creative_items.1_17_30.json diff --git a/connector/src/main/resources/bedrock/creative_items.1_17_40.json b/core/src/main/resources/bedrock/creative_items.1_17_40.json similarity index 100% rename from connector/src/main/resources/bedrock/creative_items.1_17_40.json rename to core/src/main/resources/bedrock/creative_items.1_17_40.json diff --git a/connector/src/main/resources/bedrock/entity_identifiers.dat b/core/src/main/resources/bedrock/entity_identifiers.dat similarity index 100% rename from connector/src/main/resources/bedrock/entity_identifiers.dat rename to core/src/main/resources/bedrock/entity_identifiers.dat diff --git a/connector/src/main/resources/bedrock/runtime_item_states.1_17_30.json b/core/src/main/resources/bedrock/runtime_item_states.1_17_30.json similarity index 100% rename from connector/src/main/resources/bedrock/runtime_item_states.1_17_30.json rename to core/src/main/resources/bedrock/runtime_item_states.1_17_30.json diff --git a/connector/src/main/resources/bedrock/runtime_item_states.1_17_40.json b/core/src/main/resources/bedrock/runtime_item_states.1_17_40.json similarity index 100% rename from connector/src/main/resources/bedrock/runtime_item_states.1_17_40.json rename to core/src/main/resources/bedrock/runtime_item_states.1_17_40.json diff --git a/connector/src/main/resources/bedrock/skin/geometry.humanoid.customskull.json b/core/src/main/resources/bedrock/skin/geometry.humanoid.customskull.json similarity index 100% rename from connector/src/main/resources/bedrock/skin/geometry.humanoid.customskull.json rename to core/src/main/resources/bedrock/skin/geometry.humanoid.customskull.json diff --git a/connector/src/main/resources/bedrock/skin/geometry.humanoid.ears.json b/core/src/main/resources/bedrock/skin/geometry.humanoid.ears.json similarity index 100% rename from connector/src/main/resources/bedrock/skin/geometry.humanoid.ears.json rename to core/src/main/resources/bedrock/skin/geometry.humanoid.ears.json diff --git a/connector/src/main/resources/bedrock/skin/geometry.humanoid.earsSlim.json b/core/src/main/resources/bedrock/skin/geometry.humanoid.earsSlim.json similarity index 100% rename from connector/src/main/resources/bedrock/skin/geometry.humanoid.earsSlim.json rename to core/src/main/resources/bedrock/skin/geometry.humanoid.earsSlim.json diff --git a/connector/src/main/resources/bedrock/skin/skin_alex.png b/core/src/main/resources/bedrock/skin/skin_alex.png similarity index 100% rename from connector/src/main/resources/bedrock/skin/skin_alex.png rename to core/src/main/resources/bedrock/skin/skin_alex.png diff --git a/connector/src/main/resources/bedrock/skin/skin_steve.png b/core/src/main/resources/bedrock/skin/skin_steve.png similarity index 100% rename from connector/src/main/resources/bedrock/skin/skin_steve.png rename to core/src/main/resources/bedrock/skin/skin_steve.png diff --git a/connector/src/main/resources/config.yml b/core/src/main/resources/config.yml similarity index 100% rename from connector/src/main/resources/config.yml rename to core/src/main/resources/config.yml diff --git a/core/src/main/resources/languages b/core/src/main/resources/languages new file mode 160000 index 000000000..1138a6462 --- /dev/null +++ b/core/src/main/resources/languages @@ -0,0 +1 @@ +Subproject commit 1138a64627dec66fdb7f33c922ff6cd5636ec30a diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings new file mode 160000 index 000000000..7ff1b6567 --- /dev/null +++ b/core/src/main/resources/mappings @@ -0,0 +1 @@ +Subproject commit 7ff1b6567b56c7b0b8e28786b9bbc30abfaededf diff --git a/connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java b/core/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java similarity index 100% rename from connector/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java rename to core/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java diff --git a/connector/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java b/core/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java similarity index 100% rename from connector/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java rename to core/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java diff --git a/pom.xml b/pom.xml index ee2b90b56..99a4b3374 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ ap bootstrap common - connector + core From 3f5cb29ee015d6ce066c3327316632ffaaa8339e Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 20 Nov 2021 15:34:30 -0600 Subject: [PATCH 696/766] The Great Refactor Part 2 - org.geysermc.connector -> org.geysermc.geyser --- Jenkinsfile | 2 +- .../processor/BlockEntityProcessor.java | 2 +- .../processor/CollisionRemapperProcessor.java | 2 +- .../processor/ItemRemapperProcessor.java | 2 +- .../processor/PacketTranslatorProcessor.java | 2 +- .../processor/SoundHandlerProcessor.java | 2 +- api/pom.xml | 19 + .../java/org/geysermc/geyser/api/Geyser.java | 59 + .../geyser/api/logger}/GeyserLogger.java | 2 +- bootstrap/bungeecord/pom.xml | 10 +- .../bungeecord/GeyserBungeeConfiguration.java | 6 +- .../bungeecord/GeyserBungeeDumpInfo.java | 6 +- .../bungeecord/GeyserBungeeInjector.java | 14 +- .../bungeecord/GeyserBungeeLogger.java | 4 +- .../platform/bungeecord/GeyserBungeeMain.java | 4 +- .../GeyserBungeePingPassthrough.java | 6 +- .../bungeecord/GeyserBungeePlugin.java | 40 +- .../command/BungeeCommandSender.java | 6 +- .../command/GeyserBungeeCommandExecutor.java | 16 +- .../command/GeyserBungeeCommandManager.java | 10 +- .../bungeecord/src/main/resources/bungee.yml | 2 +- bootstrap/spigot/pom.xml | 10 +- .../spigot/GeyserSpigotConfiguration.java | 6 +- .../platform/spigot/GeyserSpigotDumpInfo.java | 6 +- .../platform/spigot/GeyserSpigotInjector.java | 8 +- .../platform/spigot/GeyserSpigotLogger.java | 4 +- .../platform/spigot/GeyserSpigotMain.java | 4 +- .../spigot/GeyserSpigotPingPassthrough.java | 8 +- .../platform/spigot/GeyserSpigotPlugin.java | 62 +- .../command/GeyserSpigotCommandExecutor.java | 16 +- .../command/GeyserSpigotCommandManager.java | 10 +- .../spigot/command/SpigotCommandSender.java | 10 +- .../spigot/world/GeyserPistonListener.java | 24 +- .../GeyserSpigot1_11CraftingListener.java | 20 +- .../world/GeyserSpigotBlockPlaceListener.java | 16 +- .../GeyserSpigot1_12NativeWorldManager.java | 6 +- .../manager/GeyserSpigot1_12WorldManager.java | 6 +- .../GeyserSpigotFallbackWorldManager.java | 6 +- .../GeyserSpigotLegacyNativeWorldManager.java | 8 +- .../GeyserSpigotNativeWorldManager.java | 6 +- .../manager/GeyserSpigotWorldManager.java | 20 +- .../spigot/src/main/resources/plugin.yml | 2 +- bootstrap/sponge/pom.xml | 14 +- .../sponge/GeyserSpongeConfiguration.java | 4 +- .../platform/sponge/GeyserSpongeDumpInfo.java | 4 +- .../platform/sponge/GeyserSpongeLogger.java | 4 +- .../platform/sponge/GeyserSpongeMain.java | 4 +- .../sponge/GeyserSpongePingPassthrough.java | 8 +- .../platform/sponge/GeyserSpongePlugin.java | 38 +- .../command/GeyserSpongeCommandExecutor.java | 20 +- .../command/GeyserSpongeCommandManager.java | 10 +- .../sponge/command/SpongeCommandSender.java | 4 +- bootstrap/standalone/pom.xml | 4 +- .../standalone/GeyserStandaloneBootstrap.java | 36 +- .../GeyserStandaloneConfiguration.java | 4 +- .../standalone/GeyserStandaloneDumpInfo.java | 4 +- .../standalone/GeyserStandaloneLogger.java | 16 +- .../platform/standalone/LoopbackUtil.java | 6 +- .../command/GeyserCommandManager.java | 10 +- .../platform/standalone/gui/ANSIColor.java | 2 +- .../platform/standalone/gui/ColorPane.java | 2 +- .../standalone/gui/GeyserStandaloneGUI.java | 18 +- .../platform/standalone/gui/GraphPanel.java | 2 +- bootstrap/velocity/pom.xml | 8 +- .../velocity/GeyserVelocityConfiguration.java | 6 +- .../velocity/GeyserVelocityDumpInfo.java | 6 +- .../velocity/GeyserVelocityInjector.java | 8 +- .../velocity/GeyserVelocityLogger.java | 4 +- .../platform/velocity/GeyserVelocityMain.java | 4 +- .../GeyserVelocityPingPassthrough.java | 6 +- .../velocity/GeyserVelocityPlugin.java | 44 +- .../GeyserVelocityCommandExecutor.java | 20 +- .../command/GeyserVelocityCommandManager.java | 10 +- .../command/VelocityCommandSender.java | 6 +- core/pom.xml | 10 +- .../geysermc/connector/GeyserConnector.java | 487 +----- .../network/session/GeyserSession.java | 1464 +--------------- .../network/session/auth/AuthData.java | 36 +- .../FloodgateKeyLoader.java | 9 +- .../java/org/geysermc/geyser/GeyserImpl.java | 502 ++++++ .../{connector => geyser}/SessionManager.java | 6 +- .../bootstrap/GeyserBootstrap.java | 20 +- .../command/CommandExecutor.java | 14 +- .../command/CommandManager.java | 44 +- .../command/CommandSender.java | 4 +- .../command/GeyserCommand.java | 4 +- .../command/defaults/AdvancementsCommand.java | 8 +- .../command/defaults/DumpCommand.java | 38 +- .../command/defaults/HelpCommand.java | 22 +- .../command/defaults/ListCommand.java | 22 +- .../command/defaults/OffhandCommand.java | 14 +- .../command/defaults/ReloadCommand.java | 24 +- .../command/defaults/SettingsCommand.java | 14 +- .../command/defaults/StatisticsCommand.java | 12 +- .../command/defaults/StopCommand.java | 22 +- .../command/defaults/VersionCommand.java | 32 +- .../common/AuthType.java | 2 +- .../common/ChatColor.java | 2 +- .../common/connection/ChannelWrapper.java | 2 +- .../DefaultChannelPipelinePublic.java | 2 +- .../common/connection/GeyserInjector.java | 4 +- .../LocalChannelWithRemoteAddress.java | 2 +- .../connection/LocalChannelWrapper.java | 2 +- .../connection/LocalServerChannelWrapper.java | 2 +- .../common/connection/LocalSession.java | 2 +- .../common/main/IGeyserMain.java | 2 +- .../common/ping/GeyserPingInfo.java | 2 +- .../common/serializer/AsteriskSerializer.java | 2 +- .../EmoteOffhandWorkaroundOption.java | 2 +- .../configuration/GeyserConfiguration.java | 11 +- .../GeyserJacksonConfiguration.java | 14 +- .../dump/BootstrapDumpInfo.java | 6 +- .../{connector => geyser}/dump/DumpInfo.java | 34 +- .../entity/AbstractArrowEntity.java | 4 +- .../entity/AreaEffectCloudEntity.java | 6 +- .../entity/BoatEntity.java | 4 +- .../entity/CommandBlockMinecartEntity.java | 4 +- .../entity/DefaultBlockMinecartEntity.java | 4 +- .../entity/EnderCrystalEntity.java | 4 +- .../{connector => geyser}/entity/Entity.java | 10 +- .../entity/EntityDefinition.java | 16 +- .../entity/EntityDefinitions.java | 42 +- .../entity/EntityMetadataTranslator.java | 2 +- .../entity/ExpOrbEntity.java | 4 +- .../entity/FallingBlockEntity.java | 4 +- .../entity/FireworkEntity.java | 10 +- .../entity/FishingHookEntity.java | 22 +- .../entity/FurnaceMinecartEntity.java | 6 +- .../entity/GeyserDirtyMetadata.java | 2 +- .../entity/ItemEntity.java | 12 +- .../entity/ItemFrameEntity.java | 10 +- .../entity/ItemedFireballEntity.java | 4 +- .../entity/LeashKnotEntity.java | 4 +- .../entity/LightningEntity.java | 4 +- .../entity/LivingEntity.java | 14 +- .../entity/MinecartEntity.java | 4 +- .../entity/PaintingEntity.java | 8 +- .../entity/SpawnerMinecartEntity.java | 6 +- .../entity/TNTEntity.java | 4 +- .../entity/ThrowableEntity.java | 8 +- .../entity/ThrowableItemEntity.java | 4 +- .../entity/ThrownPotionEntity.java | 12 +- .../entity/Tickable.java | 2 +- .../entity/TippedArrowEntity.java | 6 +- .../entity/TridentEntity.java | 4 +- .../entity/WitherSkullEntity.java | 4 +- .../entity/attribute/GeyserAttributeType.java | 2 +- .../entity/factory/BaseEntityFactory.java | 8 +- .../entity/factory/EntityFactory.java | 4 +- .../factory/ExperienceOrbEntityFactory.java | 6 +- .../entity/factory/PaintingEntityFactory.java | 8 +- .../entity/living/AbstractFishEntity.java | 6 +- .../entity/living/AgeableEntity.java | 6 +- .../entity/living/AmbientEntity.java | 6 +- .../entity/living/ArmorStandEntity.java | 10 +- .../entity/living/BatEntity.java | 6 +- .../entity/living/CreatureEntity.java | 6 +- .../entity/living/FlyingEntity.java | 6 +- .../entity/living/GlowSquidEntity.java | 6 +- .../entity/living/GolemEntity.java | 6 +- .../entity/living/IronGolemEntity.java | 6 +- .../entity/living/MagmaCubeEntity.java | 6 +- .../entity/living/MobEntity.java | 8 +- .../entity/living/SlimeEntity.java | 6 +- .../entity/living/SnowGolemEntity.java | 6 +- .../entity/living/SquidEntity.java | 12 +- .../entity/living/WaterEntity.java | 6 +- .../entity/living/animal/AnimalEntity.java | 10 +- .../entity/living/animal/AxolotlEntity.java | 8 +- .../entity/living/animal/BeeEntity.java | 8 +- .../entity/living/animal/ChickenEntity.java | 8 +- .../entity/living/animal/FoxEntity.java | 8 +- .../entity/living/animal/GoatEntity.java | 6 +- .../entity/living/animal/HoglinEntity.java | 10 +- .../entity/living/animal/MooshroomEntity.java | 6 +- .../entity/living/animal/OcelotEntity.java | 8 +- .../entity/living/animal/PandaEntity.java | 8 +- .../entity/living/animal/PigEntity.java | 8 +- .../entity/living/animal/PolarBearEntity.java | 8 +- .../living/animal/PufferFishEntity.java | 8 +- .../entity/living/animal/RabbitEntity.java | 8 +- .../entity/living/animal/SheepEntity.java | 6 +- .../entity/living/animal/StriderEntity.java | 10 +- .../living/animal/TropicalFishEntity.java | 8 +- .../entity/living/animal/TurtleEntity.java | 8 +- .../animal/horse/AbstractHorseEntity.java | 12 +- .../animal/horse/ChestedHorseEntity.java | 6 +- .../living/animal/horse/HorseEntity.java | 6 +- .../living/animal/horse/LlamaEntity.java | 8 +- .../animal/horse/TraderLlamaEntity.java | 6 +- .../living/animal/tameable/CatEntity.java | 8 +- .../living/animal/tameable/ParrotEntity.java | 8 +- .../animal/tameable/TameableEntity.java | 10 +- .../living/animal/tameable/WolfEntity.java | 8 +- .../merchant/AbstractMerchantEntity.java | 8 +- .../living/merchant/VillagerEntity.java | 10 +- .../monster/AbstractSkeletonEntity.java | 6 +- .../living/monster/BasePiglinEntity.java | 8 +- .../entity/living/monster/BlazeEntity.java | 6 +- .../entity/living/monster/CreeperEntity.java | 6 +- .../living/monster/ElderGuardianEntity.java | 6 +- .../living/monster/EnderDragonEntity.java | 12 +- .../living/monster/EnderDragonPartEntity.java | 8 +- .../entity/living/monster/EndermanEntity.java | 6 +- .../entity/living/monster/GhastEntity.java | 8 +- .../entity/living/monster/GiantEntity.java | 6 +- .../entity/living/monster/GuardianEntity.java | 8 +- .../entity/living/monster/MonsterEntity.java | 8 +- .../entity/living/monster/PhantomEntity.java | 8 +- .../entity/living/monster/PiglinEntity.java | 6 +- .../entity/living/monster/ShulkerEntity.java | 8 +- .../entity/living/monster/SkeletonEntity.java | 6 +- .../entity/living/monster/SpiderEntity.java | 6 +- .../entity/living/monster/VexEntity.java | 6 +- .../entity/living/monster/WitherEntity.java | 8 +- .../entity/living/monster/ZoglinEntity.java | 6 +- .../entity/living/monster/ZombieEntity.java | 6 +- .../living/monster/ZombieVillagerEntity.java | 8 +- .../living/monster/ZombifiedPiglinEntity.java | 6 +- .../monster/raid/AbstractIllagerEntity.java | 6 +- .../living/monster/raid/PillagerEntity.java | 8 +- .../monster/raid/RaidParticipantEntity.java | 8 +- .../raid/SpellcasterIllagerEntity.java | 8 +- .../living/monster/raid/VindicatorEntity.java | 6 +- .../entity/player/PlayerEntity.java | 24 +- .../entity/player/SessionPlayerEntity.java | 8 +- .../entity/player/SkullPlayerEntity.java | 4 +- .../inventory/AnvilContainer.java | 2 +- .../inventory/BeaconContainer.java | 2 +- .../inventory/CartographyContainer.java | 2 +- .../inventory/Container.java | 6 +- .../inventory/EnchantingContainer.java | 2 +- .../inventory/Generic3X3Container.java | 6 +- .../inventory/GeyserEnchantOption.java | 4 +- .../inventory/GeyserItemStack.java | 8 +- .../inventory/Inventory.java | 10 +- .../inventory/LecternContainer.java | 2 +- .../inventory/MerchantContainer.java | 4 +- .../inventory/PlayerInventory.java | 10 +- .../inventory/StonecutterContainer.java | 4 +- .../metrics/Metrics.java | 16 +- .../network/CIDRMatcher.java | 2 +- .../network/ConnectorServerEventHandler.java | 56 +- .../network/LoggingPacketHandler.java | 14 +- .../network/MinecraftProtocol.java | 2 +- .../network/QueryPacketHandler.java | 46 +- .../network/UpstreamPacketHandler.java | 42 +- .../geyser/network/session/GeyserSession.java | 1465 +++++++++++++++++ .../network/session/UpstreamSession.java | 2 +- .../geyser/network/session/auth/AuthData.java | 50 + .../session/auth/BedrockClientData.java | 2 +- .../session/cache/AdvancementsCache.java | 12 +- .../network/session/cache/BookEditCache.java | 6 +- .../network/session/cache/BossBar.java | 6 +- .../network/session/cache/ChunkCache.java | 12 +- .../network/session/cache/EntityCache.java | 10 +- .../session/cache/EntityEffectCache.java | 2 +- .../network/session/cache/FormCache.java | 8 +- .../network/session/cache/LodestoneCache.java | 4 +- .../network/session/cache/PistonCache.java | 16 +- .../session/cache/PreferencesCache.java | 14 +- .../network/session/cache/TagCache.java | 6 +- .../network/session/cache/TeleportCache.java | 2 +- .../network/session/cache/WorldBorder.java | 8 +- .../network/session/cache/WorldCache.java | 8 +- .../network/translators/ItemRemapper.java | 2 +- .../network/translators/PacketTranslator.java | 4 +- .../translators/PacketTranslatorRegistry.java | 22 +- .../network/translators/Translator.java | 2 +- .../BedrockAdventureSettingsTranslator.java | 8 +- .../bedrock/BedrockAnimateTranslator.java | 8 +- .../BedrockBlockEntityDataTranslator.java | 10 +- .../BedrockBlockPickRequestTranslator.java | 20 +- .../bedrock/BedrockBookEditTranslator.java | 14 +- .../BedrockCommandBlockUpdateTranslator.java | 8 +- .../BedrockCommandRequestTranslator.java | 18 +- .../BedrockContainerCloseTranslator.java | 14 +- .../bedrock/BedrockEmoteListTranslator.java | 12 +- .../BedrockEntityPickRequestTranslator.java | 16 +- .../bedrock/BedrockFilterTextTranslator.java | 16 +- ...BedrockInventoryTransactionTranslator.java | 38 +- .../BedrockItemFrameDropItemTranslator.java | 12 +- .../BedrockItemStackRequestTranslator.java | 12 +- .../BedrockLecternUpdateTranslator.java | 14 +- .../BedrockMapInfoRequestTranslator.java | 8 +- .../BedrockMobEquipmentTranslator.java | 12 +- .../BedrockMoveEntityAbsoluteTranslator.java | 14 +- .../BedrockNetworkStackLatencyTranslator.java | 12 +- ...drockPacketViolationWarningTranslator.java | 10 +- .../bedrock/BedrockPlayerInputTranslator.java | 18 +- ...tionTrackingDBClientRequestTranslator.java | 12 +- .../bedrock/BedrockRespawnTranslator.java | 10 +- ...edrockServerSettingsRequestTranslator.java | 10 +- ...SetLocalPlayerAsInitializedTranslator.java | 12 +- .../bedrock/BedrockShowCreditsTranslator.java | 8 +- .../bedrock/BedrockTextTranslator.java | 10 +- .../entity/BedrockEntityEventTranslator.java | 18 +- .../player/BedrockActionTranslator.java | 28 +- .../entity/player/BedrockEmoteTranslator.java | 20 +- .../player/BedrockInteractTranslator.java | 14 +- .../player/BedrockMovePlayerTranslator.java | 18 +- .../player/BedrockRiderJumpTranslator.java | 12 +- .../BedrockSetPlayerGameTypeTranslator.java | 8 +- .../BedrockLevelSoundEventTranslator.java | 10 +- .../chat/GsonComponentSerializerWrapper.java | 2 +- .../translators/chat/MessageTranslator.java | 12 +- .../chat/MinecraftTranslationRegistry.java | 4 +- .../translators/collision/BoundingBox.java | 6 +- .../collision/CollisionManager.java | 26 +- .../collision/CollisionRemapper.java | 2 +- .../collision/translators/BlockCollision.java | 10 +- .../translators/DirtPathCollision.java | 8 +- .../collision/translators/DoorCollision.java | 8 +- .../collision/translators/OtherCollision.java | 4 +- .../translators/ScaffoldingCollision.java | 8 +- .../collision/translators/SnowCollision.java | 8 +- .../collision/translators/SolidCollision.java | 6 +- .../translators/SpawnerCollision.java | 4 +- .../translators/TrapdoorCollision.java | 10 +- .../inventory/BedrockContainerSlot.java | 2 +- .../inventory/InventoryTranslator.java | 52 +- .../translators/inventory/SlotType.java | 2 +- .../translators/inventory/click/Click.java | 2 +- .../inventory/click/ClickPlan.java | 18 +- .../holder/BlockInventoryHolder.java | 18 +- .../inventory/holder/InventoryHolder.java | 8 +- .../AbstractBlockInventoryTranslator.java | 12 +- .../translators/AnvilInventoryTranslator.java | 14 +- .../translators/BaseInventoryTranslator.java | 16 +- .../BeaconInventoryTranslator.java | 20 +- .../BrewingInventoryTranslator.java | 10 +- .../CartographyInventoryTranslator.java | 16 +- .../CraftingInventoryTranslator.java | 8 +- .../EnchantingInventoryTranslator.java | 18 +- .../Generic3X3InventoryTranslator.java | 14 +- .../GrindstoneInventoryTranslator.java | 6 +- .../HopperInventoryTranslator.java | 6 +- .../LecternInventoryTranslator.java | 20 +- .../translators/LoomInventoryTranslator.java | 16 +- .../MerchantInventoryTranslator.java | 22 +- .../PlayerInventoryTranslator.java | 24 +- .../ShulkerInventoryTranslator.java | 16 +- .../SmithingInventoryTranslator.java | 6 +- .../StonecutterInventoryTranslator.java | 20 +- .../chest/ChestInventoryTranslator.java | 14 +- .../chest/DoubleChestInventoryTranslator.java | 22 +- .../chest/SingleChestInventoryTranslator.java | 10 +- .../AbstractFurnaceInventoryTranslator.java | 14 +- .../BlastFurnaceInventoryTranslator.java | 4 +- .../furnace/FurnaceInventoryTranslator.java | 4 +- .../furnace/SmokerInventoryTranslator.java | 4 +- .../AbstractHorseInventoryTranslator.java | 12 +- .../ChestedHorseInventoryTranslator.java | 8 +- .../horse/DonkeyInventoryTranslator.java | 2 +- .../horse/HorseInventoryTranslator.java | 4 +- .../horse/LlamaInventoryTranslator.java | 2 +- .../updater/AnvilInventoryUpdater.java | 28 +- .../updater/ChestInventoryUpdater.java | 12 +- .../updater/ContainerInventoryUpdater.java | 8 +- .../updater/HorseInventoryUpdater.java | 8 +- .../inventory/updater/InventoryUpdater.java | 8 +- .../inventory/updater/UIInventoryUpdater.java | 8 +- .../network/translators/item/Enchantment.java | 2 +- .../translators/item/ItemTranslator.java | 28 +- .../item/NbtItemStackTranslator.java | 6 +- .../network/translators/item/Potion.java | 2 +- .../translators/item/StoredItemMappings.java | 4 +- .../translators/item/TippedArrowPotion.java | 2 +- .../item/translators/BannerTranslator.java | 14 +- .../item/translators/CompassTranslator.java | 14 +- .../item/translators/PotionTranslator.java | 20 +- .../translators/TippedArrowTranslator.java | 20 +- .../nbt/AxolotlBucketTranslator.java | 12 +- .../translators/nbt/BasicItemTranslator.java | 14 +- .../translators/nbt/BookPagesTranslator.java | 12 +- .../translators/nbt/CrossbowTranslator.java | 12 +- .../nbt/EnchantedBookTranslator.java | 10 +- .../nbt/EnchantmentTranslator.java | 18 +- .../nbt/FireworkBaseTranslator.java | 8 +- .../nbt/FireworkRocketTranslator.java | 10 +- .../nbt/FireworkStarTranslator.java | 8 +- .../nbt/LeatherArmorTranslator.java | 10 +- .../nbt/LodestoneCompassTranslator.java | 10 +- .../translators/nbt/MapItemTranslator.java | 10 +- .../translators/nbt/PlayerHeadTranslator.java | 14 +- .../nbt/ShulkerBoxItemTranslator.java | 12 +- .../nbt/TropicalFishBucketTranslator.java | 16 +- .../java/JavaAwardStatsTranslator.java | 10 +- .../java/JavaBossEventTranslator.java | 10 +- .../java/JavaChangeDifficultyTranslator.java | 8 +- .../translators/java/JavaChatTranslator.java | 12 +- .../java/JavaCommandsTranslator.java | 28 +- .../java/JavaCustomPayloadTranslator.java | 16 +- .../java/JavaCustomQueryTranslator.java | 8 +- .../java/JavaDisconnectTranslator.java | 10 +- .../java/JavaGameProfileTranslator.java | 18 +- .../java/JavaKeepAliveTranslator.java | 10 +- .../java/JavaLoginDisconnectTranslator.java | 10 +- .../translators/java/JavaLoginTranslator.java | 20 +- .../translators/java/JavaPingTranslator.java | 8 +- .../java/JavaRecipeTranslator.java | 8 +- .../java/JavaRespawnTranslator.java | 18 +- .../JavaSelectAdvancementsTabTranslator.java | 10 +- .../JavaUpdateAdvancementsTranslator.java | 16 +- .../java/JavaUpdateRecipesTranslator.java | 18 +- .../java/JavaUpdateTagsTranslator.java | 8 +- .../java/entity/JavaAnimateTranslator.java | 12 +- .../entity/JavaEntityEventTranslator.java | 18 +- .../JavaMoveEntityPosRotTranslator.java | 10 +- .../entity/JavaMoveEntityPosTranslator.java | 10 +- .../entity/JavaMoveEntityRotTranslator.java | 10 +- .../entity/JavaMoveVehicleTranslator.java | 10 +- .../entity/JavaRemoveEntitiesTranslator.java | 10 +- .../entity/JavaRemoveMobEffectTranslator.java | 12 +- .../java/entity/JavaRotateHeadTranslator.java | 10 +- .../entity/JavaSetEntityDataTranslator.java | 22 +- .../entity/JavaSetEntityLinkTranslator.java | 12 +- .../entity/JavaSetEntityMotionTranslator.java | 14 +- .../entity/JavaSetEquipmentTranslator.java | 16 +- .../entity/JavaSetPassengersTranslator.java | 14 +- .../entity/JavaTakeItemEntityTranslator.java | 12 +- .../entity/JavaTeleportEntityTranslator.java | 10 +- .../JavaUpdateAttributesTranslator.java | 12 +- .../entity/JavaUpdateMobEffectTranslator.java | 12 +- .../player/JavaBlockBreakAckTranslator.java | 12 +- .../player/JavaPlayerAbilitiesTranslator.java | 8 +- .../player/JavaPlayerInfoTranslator.java | 18 +- .../player/JavaPlayerPositionTranslator.java | 28 +- .../player/JavaSetCarriedItemTranslator.java | 8 +- .../player/JavaSetExperienceTranslator.java | 12 +- .../player/JavaSetHealthTranslator.java | 12 +- .../entity/spawn/JavaAddEntityTranslator.java | 20 +- .../spawn/JavaAddExperienceOrbTranslator.java | 12 +- .../entity/spawn/JavaAddMobTranslator.java | 20 +- .../spawn/JavaAddPaintingTranslator.java | 12 +- .../entity/spawn/JavaAddPlayerTranslator.java | 18 +- .../JavaContainerCloseTranslator.java | 10 +- .../JavaContainerSetContentTranslator.java | 16 +- .../JavaContainerSetDataTranslator.java | 14 +- .../JavaContainerSetSlotTranslator.java | 22 +- .../JavaHorseScreenOpenTranslator.java | 26 +- .../JavaMerchantOffersTranslator.java | 18 +- .../inventory/JavaOpenScreenTranslator.java | 18 +- .../level/JavaBlockDestructionTranslator.java | 16 +- .../level/JavaBlockEntityDataTranslator.java | 20 +- .../java/level/JavaBlockEventTranslator.java | 26 +- .../java/level/JavaBlockUpdateTranslator.java | 18 +- .../java/level/JavaCustomSoundTranslator.java | 16 +- .../java/level/JavaExplodeTranslator.java | 12 +- .../level/JavaForgetLevelChunkTranslator.java | 10 +- .../java/level/JavaGameEventTranslator.java | 14 +- .../JavaLevelChunkWithLightTranslator.java | 42 +- .../java/level/JavaLevelEventTranslator.java | 20 +- .../level/JavaLevelParticlesTranslator.java | 18 +- .../java/level/JavaMapItemDataTranslator.java | 14 +- .../JavaSectionBlocksUpdateTranslator.java | 10 +- .../JavaSetChunkCacheCenterTranslator.java | 10 +- .../JavaSetChunkCacheRadiusTranslator.java | 8 +- ...JavaSetDefaultSpawnPositionTranslator.java | 10 +- .../java/level/JavaSetTimeTranslator.java | 8 +- .../java/level/JavaSoundTranslator.java | 24 +- .../java/level/JavaStopSoundTranslator.java | 20 +- .../JavaInitializeBorderTranslator.java | 10 +- .../border/JavaSetBorderCenterTranslator.java | 10 +- .../JavaSetBorderLerpSizeTranslator.java | 10 +- .../border/JavaSetBorderSizeTranslator.java | 10 +- .../JavaSetBorderWarningDelayTranslator.java | 10 +- ...avaSetBorderWarningDistanceTranslator.java | 10 +- .../JavaSetDisplayObjectiveTranslator.java | 14 +- .../JavaSetObjectiveTranslator.java | 28 +- .../JavaSetPlayerTeamTranslator.java | 24 +- .../scoreboard/JavaSetScoreTranslator.java | 26 +- .../java/title/JavaClearTitlesTranslator.java | 8 +- .../title/JavaSetActionBarTextTranslator.java | 10 +- .../title/JavaSetSubtitleTextTranslator.java | 10 +- .../title/JavaSetTitleTextTranslator.java | 10 +- .../JavaSetTitlesAnimationTranslator.java | 8 +- .../sound/BlockSoundInteractionHandler.java | 10 +- .../sound/EntitySoundInteractionHandler.java | 10 +- .../translators/sound/SoundHandler.java | 2 +- .../sound/SoundInteractionHandler.java | 4 +- .../block/BucketSoundInteractionHandler.java | 10 +- .../ComparatorSoundInteractionHandler.java | 8 +- .../block/DoorSoundInteractionHandler.java | 8 +- .../FlintAndSteelInteractionHandler.java | 8 +- .../block/GrassPathInteractionHandler.java | 10 +- .../sound/block/HoeInteractionHandler.java | 10 +- .../block/LeverSoundInteractionHandler.java | 8 +- .../FeedBabySoundInteractionHandler.java | 16 +- .../MilkEntitySoundInteractionHandler.java | 12 +- .../translators/world/BiomeTranslator.java | 18 +- .../translators/world/GeyserWorldManager.java | 12 +- .../translators/world/WorldManager.java | 6 +- .../world/block/BlockStateValues.java | 18 +- .../world/block/DoubleChestValue.java | 2 +- .../entity/BannerBlockEntityTranslator.java | 6 +- .../entity/BeaconBlockEntityTranslator.java | 2 +- .../entity/BedBlockEntityTranslator.java | 4 +- .../block/entity/BedrockOnlyBlockEntity.java | 4 +- .../world/block/entity/BlockEntity.java | 2 +- .../block/entity/BlockEntityTranslator.java | 4 +- .../entity/CampfireBlockEntityTranslator.java | 8 +- .../CommandBlockBlockEntityTranslator.java | 6 +- .../DoubleChestBlockEntityTranslator.java | 10 +- .../entity/EmptyBlockEntityTranslator.java | 2 +- .../EndGatewayBlockEntityTranslator.java | 2 +- .../FlowerPotBlockEntityTranslator.java | 8 +- .../JigsawBlockBlockEntityTranslator.java | 2 +- .../NoteblockBlockEntityTranslator.java | 8 +- .../world/block/entity/PistonBlockEntity.java | 26 +- .../entity/PistonBlockEntityTranslator.java | 4 +- .../block/entity/RequiresBlockState.java | 2 +- .../ShulkerBoxBlockEntityTranslator.java | 6 +- .../entity/SignBlockEntityTranslator.java | 6 +- .../entity/SkullBlockEntityTranslator.java | 14 +- .../entity/SpawnerBlockEntityTranslator.java | 6 +- .../translators/world/chunk/BlockStorage.java | 6 +- .../translators/world/chunk/GeyserChunk.java | 2 +- .../world/chunk/GeyserChunkSection.java | 2 +- .../translators/world/chunk/NibbleArray.java | 2 +- .../world/chunk/bitarray/BitArray.java | 2 +- .../world/chunk/bitarray/BitArrayVersion.java | 4 +- .../world/chunk/bitarray/PaddedBitArray.java | 4 +- .../world/chunk/bitarray/Pow2BitArray.java | 4 +- .../chunk/bitarray/SingletonBitArray.java | 2 +- .../world/event/LevelEventTransformer.java | 4 +- .../event/PlaySoundEventTransformer.java | 4 +- .../event/SoundEventEventTransformer.java | 4 +- .../event/SoundLevelEventTransformer.java | 4 +- .../ping/GeyserLegacyPingPassthrough.java | 38 +- .../ping/IGeyserPingPassthrough.java | 4 +- .../registry/AbstractMappedRegistry.java | 4 +- .../registry/ArrayRegistry.java | 4 +- .../registry/BlockRegistries.java | 12 +- .../registry/MappedRegistry.java | 4 +- .../registry/Registries.java | 36 +- .../registry/Registry.java | 6 +- .../registry/SimpleMappedRegistry.java | 4 +- .../registry/SimpleRegistry.java | 4 +- .../registry/VersionedRegistry.java | 4 +- .../loader/AnnotatedRegistryLoader.java | 4 +- .../loader/BiomeIdentifierRegistryLoader.java | 8 +- .../loader/BlockEntityRegistryLoader.java | 10 +- .../loader/CollisionRegistryLoader.java | 24 +- .../registry/loader/EffectRegistryLoader.java | 8 +- .../loader/EnchantmentRegistryLoader.java | 18 +- .../loader/MultiResourceRegistryLoader.java | 2 +- .../registry/loader/NbtRegistryLoader.java | 4 +- .../loader/ParticleTypesRegistryLoader.java | 8 +- .../loader/PotionMixRegistryLoader.java | 10 +- .../registry/loader/RegistryLoader.java | 2 +- .../registry/loader/RegistryLoaders.java | 2 +- .../loader/SoundEventsRegistryLoader.java | 14 +- .../loader/SoundHandlerRegistryLoader.java | 6 +- .../registry/loader/SoundRegistryLoader.java | 10 +- .../populator/BlockRegistryPopulator.java | 20 +- .../populator/ItemRegistryPopulator.java | 24 +- .../populator/RecipeRegistryPopulator.java | 20 +- .../registry/type/BlockMapping.java | 6 +- .../registry/type/BlockMappings.java | 2 +- .../registry/type/EnchantmentData.java | 4 +- .../registry/type/GeyserMappingItem.java | 2 +- .../registry/type/ItemMapping.java | 6 +- .../registry/type/ItemMappings.java | 8 +- .../registry/type/PaletteItem.java | 2 +- .../registry/type/ParticleMapping.java | 2 +- .../registry/type/SoundMapping.java | 2 +- .../scoreboard/Objective.java | 2 +- .../scoreboard/Score.java | 2 +- .../scoreboard/Scoreboard.java | 18 +- .../scoreboard/ScoreboardUpdater.java | 26 +- .../scoreboard/Team.java | 2 +- .../scoreboard/UpdateType.java | 2 +- .../skin/FloodgateSkinUploader.java | 28 +- .../skin/ProvidedSkin.java | 2 +- .../skin/SkinManager.java | 44 +- .../skin/SkinProvider.java | 48 +- .../skin/SkullSkinManager.java | 12 +- .../utils/AttributeUtils.java | 2 +- .../{connector => geyser}/utils/Axis.java | 2 +- .../utils/BedrockMapIcon.java | 2 +- .../utils/BlockEntityUtils.java | 12 +- .../utils/BlockPositionIterator.java | 2 +- .../utils/BlockUtils.java | 24 +- .../utils/ChunkUtils.java | 24 +- .../utils/Constants.java | 2 +- .../utils/CooldownUtils.java | 6 +- .../utils/DimensionUtils.java | 12 +- .../utils/Direction.java | 2 +- .../utils/DockerCheck.java | 2 +- .../utils/EffectUtils.java | 8 +- .../utils/EntityUtils.java | 10 +- .../utils/FileUtils.java | 10 +- .../utils/FireworkColor.java | 2 +- .../{connector => geyser}/utils/GameRule.java | 2 +- .../utils/GeyserAdvancement.java | 4 +- .../utils/InteractiveTagManager.java | 20 +- .../utils/InventoryUtils.java | 26 +- .../utils/ItemUtils.java | 4 +- .../utils/LanguageUtils.java | 28 +- .../utils/LocaleUtils.java | 58 +- .../utils/LoginEncryptionUtils.java | 32 +- .../{connector => geyser}/utils/MapColor.java | 2 +- .../utils/MathUtils.java | 2 +- .../utils/NewsHandler.java | 14 +- .../utils/PaintingType.java | 2 +- .../utils/PistonBehavior.java | 2 +- .../utils/PluginMessageUtils.java | 8 +- .../utils/ResourcePack.java | 8 +- .../utils/ResourcePackManifest.java | 2 +- .../utils/SettingsUtils.java | 28 +- .../utils/SignUtils.java | 2 +- .../utils/SoundUtils.java | 2 +- .../utils/StatisticsUtils.java | 8 +- .../{connector => geyser}/utils/WebUtils.java | 16 +- .../collections/FixedInt2BooleanMap.java | 2 +- .../utils/collections/FixedInt2ByteMap.java | 2 +- .../utils/collections/FixedInt2IntMap.java | 2 +- .../utils/collections/LecternHasBookMap.java | 12 +- .../utils/collections/Object2IntBiMap.java | 2 +- .../utils/collections/package-info.java | 2 +- .../chat/MessageTranslatorTest.java | 4 +- .../collections/GeyserCollectionsTest.java | 2 +- pom.xml | 1 + 624 files changed, 5437 insertions(+), 5056 deletions(-) create mode 100644 api/pom.xml create mode 100644 api/src/main/java/org/geysermc/geyser/api/Geyser.java rename {core/src/main/java/org/geysermc/connector => api/src/main/java/org/geysermc/geyser/api/logger}/GeyserLogger.java (98%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeeConfiguration.java (92%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeeDumpInfo.java (94%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeeInjector.java (95%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeeLogger.java (95%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeeMain.java (93%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeePingPassthrough.java (97%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/GeyserBungeePlugin.java (86%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/command/BungeeCommandSender.java (93%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/command/GeyserBungeeCommandExecutor.java (87%) rename bootstrap/bungeecord/src/main/java/org/geysermc/{ => geyser}/platform/bungeecord/command/GeyserBungeeCommandManager.java (85%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotConfiguration.java (92%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotDumpInfo.java (94%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotInjector.java (97%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotLogger.java (95%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotMain.java (94%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotPingPassthrough.java (94%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/GeyserSpigotPlugin.java (89%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/command/GeyserSpigotCommandExecutor.java (88%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/command/GeyserSpigotCommandManager.java (89%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/command/SpigotCommandSender.java (91%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/GeyserPistonListener.java (87%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/GeyserSpigot1_11CraftingListener.java (94%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/GeyserSpigotBlockPlaceListener.java (85%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java (92%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java (96%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java (91%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java (93%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java (91%) rename bootstrap/spigot/src/main/java/org/geysermc/{ => geyser}/platform/spigot/world/manager/GeyserSpigotWorldManager.java (91%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/GeyserSpongeConfiguration.java (92%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/GeyserSpongeDumpInfo.java (96%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/GeyserSpongeLogger.java (95%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/GeyserSpongeMain.java (93%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/GeyserSpongePingPassthrough.java (95%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/GeyserSpongePlugin.java (82%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/command/GeyserSpongeCommandExecutor.java (88%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/command/GeyserSpongeCommandManager.java (89%) rename bootstrap/sponge/src/main/java/org/geysermc/{ => geyser}/platform/sponge/command/SpongeCommandSender.java (94%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/GeyserStandaloneBootstrap.java (94%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/GeyserStandaloneConfiguration.java (93%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/GeyserStandaloneDumpInfo.java (93%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/GeyserStandaloneLogger.java (87%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/LoopbackUtil.java (95%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/command/GeyserCommandManager.java (85%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/gui/ANSIColor.java (98%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/gui/ColorPane.java (98%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/gui/GeyserStandaloneGUI.java (96%) rename bootstrap/standalone/src/main/java/org/geysermc/{ => geyser}/platform/standalone/gui/GraphPanel.java (99%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityConfiguration.java (93%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityDumpInfo.java (94%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityInjector.java (94%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityLogger.java (95%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityMain.java (93%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityPingPassthrough.java (96%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/GeyserVelocityPlugin.java (85%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/command/GeyserVelocityCommandExecutor.java (85%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/command/GeyserVelocityCommandManager.java (85%) rename bootstrap/velocity/src/main/java/org/geysermc/{ => geyser}/platform/velocity/command/VelocityCommandSender.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/FloodgateKeyLoader.java (92%) create mode 100644 core/src/main/java/org/geysermc/geyser/GeyserImpl.java rename core/src/main/java/org/geysermc/{connector => geyser}/SessionManager.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/bootstrap/GeyserBootstrap.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/CommandExecutor.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/CommandManager.java (61%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/CommandSender.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/GeyserCommand.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/AdvancementsCommand.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/DumpCommand.java (79%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/HelpCommand.java (80%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/ListCommand.java (70%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/OffhandCommand.java (83%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/ReloadCommand.java (70%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/SettingsCommand.java (80%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/StatisticsCommand.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/StopCommand.java (72%) rename core/src/main/java/org/geysermc/{connector => geyser}/command/defaults/VersionCommand.java (78%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/AuthType.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/ChatColor.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/ChannelWrapper.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/DefaultChannelPipelinePublic.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/GeyserInjector.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/LocalChannelWithRemoteAddress.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/LocalChannelWrapper.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/LocalServerChannelWrapper.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/connection/LocalSession.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/main/IGeyserMain.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/ping/GeyserPingInfo.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/common/serializer/AsteriskSerializer.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/configuration/EmoteOffhandWorkaroundOption.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/configuration/GeyserConfiguration.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/configuration/GeyserJacksonConfiguration.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/dump/BootstrapDumpInfo.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/dump/DumpInfo.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/AbstractArrowEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/AreaEffectCloudEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/BoatEntity.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/CommandBlockMinecartEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/DefaultBlockMinecartEntity.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/EnderCrystalEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/Entity.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/EntityDefinition.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/EntityDefinitions.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/EntityMetadataTranslator.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ExpOrbEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/FallingBlockEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/FireworkEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/FishingHookEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/FurnaceMinecartEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/GeyserDirtyMetadata.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ItemEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ItemFrameEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ItemedFireballEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/LeashKnotEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/LightningEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/LivingEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/MinecartEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/PaintingEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/SpawnerMinecartEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/TNTEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ThrowableEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ThrowableItemEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/ThrownPotionEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/Tickable.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/TippedArrowEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/TridentEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/WitherSkullEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/attribute/GeyserAttributeType.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/factory/BaseEntityFactory.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/factory/EntityFactory.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/factory/ExperienceOrbEntityFactory.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/factory/PaintingEntityFactory.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/AbstractFishEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/AgeableEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/AmbientEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/ArmorStandEntity.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/BatEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/CreatureEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/FlyingEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/GlowSquidEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/GolemEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/IronGolemEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/MagmaCubeEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/MobEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/SlimeEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/SnowGolemEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/SquidEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/WaterEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/AnimalEntity.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/AxolotlEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/BeeEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/ChickenEntity.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/FoxEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/GoatEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/HoglinEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/MooshroomEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/OcelotEntity.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/PandaEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/PigEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/PolarBearEntity.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/PufferFishEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/RabbitEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/SheepEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/StriderEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/TropicalFishEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/TurtleEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/horse/AbstractHorseEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/horse/ChestedHorseEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/horse/HorseEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/horse/LlamaEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/horse/TraderLlamaEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/tameable/CatEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/tameable/ParrotEntity.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/tameable/TameableEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/animal/tameable/WolfEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/merchant/AbstractMerchantEntity.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/merchant/VillagerEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/AbstractSkeletonEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/BasePiglinEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/BlazeEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/CreeperEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/ElderGuardianEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/EnderDragonEntity.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/EnderDragonPartEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/EndermanEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/GhastEntity.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/GiantEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/GuardianEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/MonsterEntity.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/PhantomEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/PiglinEntity.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/ShulkerEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/SkeletonEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/SpiderEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/VexEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/WitherEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/ZoglinEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/ZombieEntity.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/ZombieVillagerEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/ZombifiedPiglinEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/raid/AbstractIllagerEntity.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/raid/PillagerEntity.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/raid/RaidParticipantEntity.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/raid/SpellcasterIllagerEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/living/monster/raid/VindicatorEntity.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/player/PlayerEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/player/SessionPlayerEntity.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/entity/player/SkullPlayerEntity.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/AnvilContainer.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/BeaconContainer.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/CartographyContainer.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/Container.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/EnchantingContainer.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/Generic3X3Container.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/GeyserEnchantOption.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/GeyserItemStack.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/Inventory.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/LecternContainer.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/MerchantContainer.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/PlayerInventory.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/inventory/StonecutterContainer.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/metrics/Metrics.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/CIDRMatcher.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/ConnectorServerEventHandler.java (77%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/LoggingPacketHandler.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/MinecraftProtocol.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/QueryPacketHandler.java (83%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/UpstreamPacketHandler.java (85%) create mode 100644 core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/UpstreamSession.java (98%) create mode 100644 core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/auth/BedrockClientData.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/AdvancementsCache.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/BookEditCache.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/BossBar.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/ChunkCache.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/EntityCache.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/EntityEffectCache.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/FormCache.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/LodestoneCache.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/PistonCache.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/PreferencesCache.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/TagCache.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/TeleportCache.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/WorldBorder.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/session/cache/WorldCache.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/ItemRemapper.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/PacketTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/PacketTranslatorRegistry.java (79%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/Translator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockAdventureSettingsTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockAnimateTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockBlockEntityDataTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockBlockPickRequestTranslator.java (79%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockBookEditTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockCommandRequestTranslator.java (74%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockContainerCloseTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockEmoteListTranslator.java (78%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockEntityPickRequestTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockFilterTextTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockInventoryTransactionTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockItemFrameDropItemTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockItemStackRequestTranslator.java (83%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockLecternUpdateTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockMapInfoRequestTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockMobEquipmentTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockNetworkStackLatencyTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java (81%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockPlayerInputTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockRespawnTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockShowCreditsTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/BedrockTextTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/BedrockEntityEventTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/player/BedrockActionTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java (79%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/player/BedrockInteractTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/chat/GsonComponentSerializerWrapper.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/chat/MessageTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/chat/MinecraftTranslationRegistry.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/BoundingBox.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/CollisionManager.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/CollisionRemapper.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/BlockCollision.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/DirtPathCollision.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/DoorCollision.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/OtherCollision.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/ScaffoldingCollision.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/SnowCollision.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/SolidCollision.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/SpawnerCollision.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/collision/translators/TrapdoorCollision.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/BedrockContainerSlot.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/InventoryTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/SlotType.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/click/Click.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/click/ClickPlan.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/holder/BlockInventoryHolder.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/holder/InventoryHolder.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/AnvilInventoryTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/BaseInventoryTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/BeaconInventoryTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/BrewingInventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/CartographyInventoryTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/CraftingInventoryTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/EnchantingInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/Generic3X3InventoryTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/GrindstoneInventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/HopperInventoryTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/LecternInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/LoomInventoryTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/MerchantInventoryTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/PlayerInventoryTranslator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/ShulkerInventoryTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/SmithingInventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/StonecutterInventoryTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/chest/ChestInventoryTranslator.java (83%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java (81%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/horse/HorseInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/updater/AnvilInventoryUpdater.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/updater/ChestInventoryUpdater.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/updater/ContainerInventoryUpdater.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/updater/HorseInventoryUpdater.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/updater/InventoryUpdater.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/inventory/updater/UIInventoryUpdater.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/Enchantment.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/ItemTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/NbtItemStackTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/Potion.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/StoredItemMappings.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/TippedArrowPotion.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/BannerTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/CompassTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/PotionTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/TippedArrowTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/AxolotlBucketTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/BasicItemTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/BookPagesTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/CrossbowTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/EnchantedBookTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/EnchantmentTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/FireworkBaseTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/FireworkRocketTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/FireworkStarTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/LeatherArmorTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/LodestoneCompassTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/MapItemTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/PlayerHeadTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaAwardStatsTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaBossEventTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaChangeDifficultyTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaChatTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaCommandsTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaCustomPayloadTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaCustomQueryTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaDisconnectTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaGameProfileTranslator.java (81%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaKeepAliveTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaLoginDisconnectTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaLoginTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaPingTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaRecipeTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaRespawnTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaSelectAdvancementsTabTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaUpdateAdvancementsTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaUpdateRecipesTranslator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/JavaUpdateTagsTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaAnimateTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaEntityEventTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaMoveEntityPosTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaMoveEntityRotTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaMoveVehicleTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaRemoveEntitiesTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaRemoveMobEffectTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaRotateHeadTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaSetEntityDataTranslator.java (76%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaSetEntityLinkTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaSetEntityMotionTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaSetEquipmentTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaSetPassengersTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaTakeItemEntityTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaTeleportEntityTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaUpdateAttributesTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/JavaUpdateMobEffectTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaPlayerInfoTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaPlayerPositionTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaSetCarriedItemTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaSetExperienceTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/player/JavaSetHealthTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/spawn/JavaAddEntityTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/spawn/JavaAddMobTranslator.java (77%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java (81%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaContainerCloseTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaContainerSetContentTranslator.java (82%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaContainerSetDataTranslator.java (81%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaContainerSetSlotTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaMerchantOffersTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/inventory/JavaOpenScreenTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaBlockDestructionTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaBlockEntityDataTranslator.java (83%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaBlockEventTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaBlockUpdateTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaCustomSoundTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaExplodeTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaForgetLevelChunkTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaGameEventTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaLevelChunkWithLightTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaLevelEventTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaLevelParticlesTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaMapItemDataTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaSetTimeTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaSoundTranslator.java (82%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/JavaStopSoundTranslator.java (82%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/border/JavaInitializeBorderTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/border/JavaSetBorderCenterTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java (85%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/border/JavaSetBorderSizeTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java (83%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java (82%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/scoreboard/JavaSetScoreTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/title/JavaClearTitlesTranslator.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/title/JavaSetActionBarTextTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/title/JavaSetSubtitleTextTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/title/JavaSetTitleTextTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/java/title/JavaSetTitlesAnimationTranslator.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/BlockSoundInteractionHandler.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/EntitySoundInteractionHandler.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/SoundHandler.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/SoundInteractionHandler.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/BucketSoundInteractionHandler.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/ComparatorSoundInteractionHandler.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/DoorSoundInteractionHandler.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/FlintAndSteelInteractionHandler.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/GrassPathInteractionHandler.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/HoeInteractionHandler.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/block/LeverSoundInteractionHandler.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/entity/FeedBabySoundInteractionHandler.java (81%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/BiomeTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/GeyserWorldManager.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/WorldManager.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/BlockStateValues.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/DoubleChestValue.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/BannerBlockEntityTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/BeaconBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/BedBlockEntityTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/BedrockOnlyBlockEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/BlockEntity.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/BlockEntityTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/CampfireBlockEntityTranslator.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/EmptyBlockEntityTranslator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/PistonBlockEntity.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/PistonBlockEntityTranslator.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/RequiresBlockState.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/SignBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/SkullBlockEntityTranslator.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/BlockStorage.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/GeyserChunk.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/GeyserChunkSection.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/NibbleArray.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/bitarray/BitArray.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/bitarray/BitArrayVersion.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/bitarray/PaddedBitArray.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/bitarray/Pow2BitArray.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/chunk/bitarray/SingletonBitArray.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/event/LevelEventTransformer.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/event/PlaySoundEventTransformer.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/event/SoundEventEventTransformer.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/network/translators/world/event/SoundLevelEventTransformer.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/ping/GeyserLegacyPingPassthrough.java (75%) rename core/src/main/java/org/geysermc/{connector => geyser}/ping/IGeyserPingPassthrough.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/AbstractMappedRegistry.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/ArrayRegistry.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/BlockRegistries.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/MappedRegistry.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/Registries.java (84%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/Registry.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/SimpleMappedRegistry.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/SimpleRegistry.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/VersionedRegistry.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/AnnotatedRegistryLoader.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/BiomeIdentifierRegistryLoader.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/BlockEntityRegistryLoader.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/CollisionRegistryLoader.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/EffectRegistryLoader.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/EnchantmentRegistryLoader.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/MultiResourceRegistryLoader.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/NbtRegistryLoader.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/ParticleTypesRegistryLoader.java (90%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/PotionMixRegistryLoader.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/RegistryLoader.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/RegistryLoaders.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/SoundEventsRegistryLoader.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/SoundHandlerRegistryLoader.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/loader/SoundRegistryLoader.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/populator/BlockRegistryPopulator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/populator/ItemRegistryPopulator.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/populator/RecipeRegistryPopulator.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/BlockMapping.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/BlockMappings.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/EnchantmentData.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/GeyserMappingItem.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/ItemMapping.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/ItemMappings.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/PaletteItem.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/ParticleMapping.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/registry/type/SoundMapping.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/scoreboard/Objective.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/scoreboard/Score.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/scoreboard/Scoreboard.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/scoreboard/ScoreboardUpdater.java (89%) rename core/src/main/java/org/geysermc/{connector => geyser}/scoreboard/Team.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/scoreboard/UpdateType.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/skin/FloodgateSkinUploader.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/skin/ProvidedSkin.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/skin/SkinManager.java (86%) rename core/src/main/java/org/geysermc/{connector => geyser}/skin/SkinProvider.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/skin/SkullSkinManager.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/AttributeUtils.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/Axis.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/BedrockMapIcon.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/BlockEntityUtils.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/BlockPositionIterator.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/BlockUtils.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/ChunkUtils.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/Constants.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/CooldownUtils.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/DimensionUtils.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/Direction.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/DockerCheck.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/EffectUtils.java (91%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/EntityUtils.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/FileUtils.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/FireworkColor.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/GameRule.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/GeyserAdvancement.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/InteractiveTagManager.java (95%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/InventoryUtils.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/ItemUtils.java (96%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/LanguageUtils.java (82%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/LocaleUtils.java (79%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/LoginEncryptionUtils.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/MapColor.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/MathUtils.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/NewsHandler.java (93%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/PaintingType.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/PistonBehavior.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/PluginMessageUtils.java (94%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/ResourcePack.java (92%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/ResourcePackManifest.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/SettingsUtils.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/SignUtils.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/SoundUtils.java (97%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/StatisticsUtils.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/WebUtils.java (87%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/collections/FixedInt2BooleanMap.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/collections/FixedInt2ByteMap.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/collections/FixedInt2IntMap.java (98%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/collections/LecternHasBookMap.java (88%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/collections/Object2IntBiMap.java (99%) rename core/src/main/java/org/geysermc/{connector => geyser}/utils/collections/package-info.java (97%) rename core/src/test/java/org/geysermc/{connector => geyser}/network/translators/chat/MessageTranslatorTest.java (98%) rename core/src/test/java/org/geysermc/{connector => geyser}/utils/collections/GeyserCollectionsTest.java (99%) diff --git a/Jenkinsfile b/Jenkinsfile index b88a78abb..3e43447a7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { ) rtMavenRun( pom: 'pom.xml', - goals: 'javadoc:jar source:jar install -pl :connector -am -DskipTests', + goals: 'javadoc:jar source:jar install -pl :core -am -DskipTests', deployerId: "maven-deployer", resolverId: "maven-resolver" ) diff --git a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java index 05047ab6c..e1d7e91f1 100644 --- a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class BlockEntityProcessor extends ClassProcessor { public BlockEntityProcessor() { - super("org.geysermc.connector.network.translators.world.block.entity.BlockEntity"); + super("org.geysermc.geyser.network.translators.world.block.entity.BlockEntity"); } } diff --git a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java index e275d1d3d..1fcebb01d 100644 --- a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class CollisionRemapperProcessor extends ClassProcessor { public CollisionRemapperProcessor() { - super("org.geysermc.connector.network.translators.collision.CollisionRemapper"); + super("org.geysermc.geyser.network.translators.collision.CollisionRemapper"); } } diff --git a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java index 8971687bf..e7f764055 100644 --- a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class ItemRemapperProcessor extends ClassProcessor { public ItemRemapperProcessor() { - super("org.geysermc.connector.network.translators.ItemRemapper"); + super("org.geysermc.geyser.network.translators.ItemRemapper"); } } diff --git a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java index 03b859421..53307384a 100644 --- a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class PacketTranslatorProcessor extends ClassProcessor { public PacketTranslatorProcessor() { - super("org.geysermc.connector.network.translators.Translator"); + super("org.geysermc.geyser.network.translators.Translator"); } } diff --git a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java index 74cf199bc..3d7f4fa18 100644 --- a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class SoundHandlerProcessor extends ClassProcessor { public SoundHandlerProcessor() { - super("org.geysermc.connector.network.translators.sound.SoundHandler"); + super("org.geysermc.geyser.network.translators.sound.SoundHandler"); } } diff --git a/api/pom.xml b/api/pom.xml new file mode 100644 index 000000000..ecaa217b6 --- /dev/null +++ b/api/pom.xml @@ -0,0 +1,19 @@ + + + + geyser-parent + org.geysermc + 1.4.3-SNAPSHOT + + 4.0.0 + + api + + + 16 + 16 + + + \ No newline at end of file diff --git a/api/src/main/java/org/geysermc/geyser/api/Geyser.java b/api/src/main/java/org/geysermc/geyser/api/Geyser.java new file mode 100644 index 000000000..a8a8b68a7 --- /dev/null +++ b/api/src/main/java/org/geysermc/geyser/api/Geyser.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019-2021 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.api; + +import org.geysermc.geyser.api.logger.GeyserLogger; + +/** + * General API class for Geyser. + */ +public abstract class Geyser { + private static Geyser instance; + + /** + * Gets the logger used by Geyser. + * + * @return the logger used by Geyser + */ + public abstract GeyserLogger getLogger(); + + /** + * Returns the current {@link Geyser} instance. + * + * @return the current Geyser instance + */ + public static Geyser getInstance() { + return instance; + } + + protected static void setInstance(Geyser instance) { + if (Geyser.instance != null) { + throw new RuntimeException("Cannot redefine singleton Geyser!"); + } + + Geyser.instance = instance; + } +} diff --git a/core/src/main/java/org/geysermc/connector/GeyserLogger.java b/api/src/main/java/org/geysermc/geyser/api/logger/GeyserLogger.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/GeyserLogger.java rename to api/src/main/java/org/geysermc/geyser/api/logger/GeyserLogger.java index 6d36958da..564a8f30c 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserLogger.java +++ b/api/src/main/java/org/geysermc/geyser/api/logger/GeyserLogger.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector; +package org.geysermc.geyser.api.logger; public interface GeyserLogger { diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index 8ac38f269..0be4c54d5 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -41,7 +41,7 @@ - org.geysermc.platform.bungeecord.GeyserBungeeMain + org.geysermc.geyser.platform.bungeecord.GeyserBungeeMain @@ -60,21 +60,21 @@ net.md_5.bungee.jni - org.geysermc.platform.bungeecord.shaded.jni + org.geysermc.geyser.platform.bungeecord.shaded.jni com.fasterxml.jackson - org.geysermc.platform.bungeecord.shaded.jackson + org.geysermc.geyser.platform.bungeecord.shaded.jackson io.netty.channel.kqueue - org.geysermc.platform.bungeecord.shaded.io.netty.channel.kqueue + org.geysermc.geyser.platform.bungeecord.shaded.io.netty.channel.kqueue net.kyori - org.geysermc.platform.bungeecord.shaded.kyori + org.geysermc.geyser.platform.bungeecord.shaded.kyori diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeConfiguration.java similarity index 92% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeConfiguration.java index 9ad3f13da..866a0657f 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeConfiguration.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeConfiguration.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import net.md_5.bungee.api.plugin.Plugin; -import org.geysermc.connector.FloodgateKeyLoader; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.FloodgateKeyLoader; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import java.nio.file.Path; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeDumpInfo.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java similarity index 94% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeDumpInfo.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java index 4e87f3a63..d4714ab7c 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeDumpInfo.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; import lombok.Getter; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.plugin.Plugin; -import org.geysermc.connector.common.serializer.AsteriskSerializer; -import org.geysermc.connector.dump.BootstrapDumpInfo; +import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.dump.BootstrapDumpInfo; import java.util.ArrayList; import java.util.Collections; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java similarity index 95% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java index 310ae0c54..497384ab1 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeInjector.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; @@ -39,11 +39,11 @@ import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.netty.PipelineUtils; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.connection.GeyserInjector; -import org.geysermc.connector.common.connection.LocalServerChannelWrapper; -import org.geysermc.connector.common.connection.LocalSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.common.connection.GeyserInjector; +import org.geysermc.geyser.common.connection.LocalServerChannelWrapper; +import org.geysermc.geyser.common.connection.LocalSession; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -185,7 +185,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener { this.bungeeChannels = null; if (this.localChannel != null) { shutdown(); - initializeLocalChannel(GeyserConnector.getInstance().getBootstrap()); + initializeLocalChannel(GeyserImpl.getInstance().getBootstrap()); } } } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java similarity index 95% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java index 1903bb86e..a53cb7f1d 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeLogger.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.GeyserLogger; +import org.geysermc.geyser.api.logger.GeyserLogger; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeMain.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java similarity index 93% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeMain.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java index b69c35730..587a26ca2 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeeMain.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; -import org.geysermc.connector.common.main.IGeyserMain; +import org.geysermc.geyser.common.main.IGeyserMain; public class GeyserBungeeMain extends IGeyserMain { diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePingPassthrough.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java similarity index 97% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePingPassthrough.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java index 0b8b3901b..86cb21a42 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePingPassthrough.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; import lombok.AllArgsConstructor; import net.md_5.bungee.api.ProxyServer; @@ -34,8 +34,8 @@ import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.event.ProxyPingEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.protocol.ProtocolConstants; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; import java.net.InetSocketAddress; import java.net.SocketAddress; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java similarity index 86% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java index 64b10c650..9a7a8bc4d 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java @@ -23,23 +23,23 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord; +package org.geysermc.geyser.platform.bungeecord; import net.md_5.bungee.api.config.ListenerInfo; import net.md_5.bungee.api.plugin.Plugin; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandExecutor; -import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.dump.BootstrapDumpInfo; +import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandExecutor; +import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandManager; import org.jetbrains.annotations.Nullable; import java.io.File; @@ -59,7 +59,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { private GeyserBungeeLogger geyserLogger; private IGeyserPingPassthrough geyserBungeePingPassthrough; - private GeyserConnector connector; + private GeyserImpl geyser; @Override public void onEnable() { @@ -116,26 +116,26 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { geyserConfig.loadFloodgate(this); - this.connector = GeyserConnector.start(PlatformType.BUNGEECORD, this); + this.geyser = GeyserImpl.start(PlatformType.BUNGEECORD, this); this.geyserInjector = new GeyserBungeeInjector(this); this.geyserInjector.initializeLocalChannel(this); - this.geyserCommandManager = new GeyserBungeeCommandManager(connector); + this.geyserCommandManager = new GeyserBungeeCommandManager(geyser); if (geyserConfig.isLegacyPingPassthrough()) { - this.geyserBungeePingPassthrough = GeyserLegacyPingPassthrough.init(connector); + this.geyserBungeePingPassthrough = GeyserLegacyPingPassthrough.init(geyser); } else { this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy()); } - this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor(connector)); + this.getProxy().getPluginManager().registerCommand(this, new GeyserBungeeCommandExecutor(geyser)); } @Override public void onDisable() { - if (connector != null) { - connector.shutdown(); + if (geyser != null) { + geyser.shutdown(); } if (geyserInjector != null) { geyserInjector.shutdown(); diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java similarity index 93% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java index 4cda47af7..6e99c01e1 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/BungeeCommandSender.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord.command; +package org.geysermc.geyser.platform.bungeecord.command; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.utils.LanguageUtils; public class BungeeCommandSender implements CommandSender { diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java similarity index 87% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index ad15ead91..7b1fe0fc2 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord.command; +package org.geysermc.geyser.platform.bungeecord.command; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.plugin.Command; import net.md_5.bungee.api.plugin.TabExecutor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandExecutor; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandExecutor; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Arrays; import java.util.Collections; @@ -41,10 +41,10 @@ import java.util.Collections; public class GeyserBungeeCommandExecutor extends Command implements TabExecutor { private final CommandExecutor commandExecutor; - public GeyserBungeeCommandExecutor(GeyserConnector connector) { + public GeyserBungeeCommandExecutor(GeyserImpl geyser) { super("geyser"); - this.commandExecutor = new CommandExecutor(connector); + this.commandExecutor = new CommandExecutor(geyser); } @Override diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandManager.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandManager.java similarity index 85% rename from bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandManager.java rename to bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandManager.java index bc5c6a596..06e5da71e 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/command/GeyserBungeeCommandManager.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.bungeecord.command; +package org.geysermc.geyser.platform.bungeecord.command; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; public class GeyserBungeeCommandManager extends CommandManager { - public GeyserBungeeCommandManager(GeyserConnector connector) { - super(connector); + public GeyserBungeeCommandManager(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/bungeecord/src/main/resources/bungee.yml b/bootstrap/bungeecord/src/main/resources/bungee.yml index 8781ea31b..7390a4623 100644 --- a/bootstrap/bungeecord/src/main/resources/bungee.yml +++ b/bootstrap/bungeecord/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ -main: org.geysermc.platform.bungeecord.GeyserBungeePlugin +main: org.geysermc.geyser.platform.bungeecord.GeyserBungeePlugin name: ${outputName}-BungeeCord author: ${project.organization.name} website: ${project.organization.url} diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index 0e8d922a3..045c44c71 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -58,7 +58,7 @@ - org.geysermc.platform.spigot.GeyserSpigotMain + org.geysermc.geyser.platform.spigot.GeyserSpigotMain @@ -77,19 +77,19 @@ it.unimi.dsi.fastutil - org.geysermc.platform.spigot.shaded.fastutil + org.geysermc.geyser.platform.spigot.shaded.fastutil com.fasterxml.jackson - org.geysermc.platform.spigot.shaded.jackson + org.geysermc.geyser.platform.spigot.shaded.jackson net.kyori - org.geysermc.platform.spigot.shaded.kyori + org.geysermc.geyser.platform.spigot.shaded.kyori org.objectweb.asm - org.geysermc.platform.spigot.shaded.asm + org.geysermc.geyser.platform.spigot.shaded.asm diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotConfiguration.java similarity index 92% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotConfiguration.java index 91cba5c15..60bc05f13 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotConfiguration.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotConfiguration.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.FloodgateKeyLoader; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.FloodgateKeyLoader; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import java.nio.file.Path; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotDumpInfo.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java similarity index 94% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotDumpInfo.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java index a929e3237..0acf3a422 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotDumpInfo.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.common.serializer.AsteriskSerializer; -import org.geysermc.connector.dump.BootstrapDumpInfo; +import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.dump.BootstrapDumpInfo; import java.util.ArrayList; import java.util.List; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java similarity index 97% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java index 10062a260..40ed05a15 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer; import io.netty.bootstrap.ServerBootstrap; @@ -31,9 +31,9 @@ import io.netty.channel.*; import io.netty.channel.local.LocalAddress; import io.netty.util.concurrent.DefaultThreadFactory; import org.bukkit.Bukkit; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.connection.GeyserInjector; -import org.geysermc.connector.common.connection.LocalServerChannelWrapper; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.common.connection.GeyserInjector; +import org.geysermc.geyser.common.connection.LocalServerChannelWrapper; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotLogger.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java similarity index 95% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotLogger.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java index f760079fc..9a1f45bcd 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotLogger.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.GeyserLogger; +import org.geysermc.geyser.api.logger.GeyserLogger; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotMain.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java similarity index 94% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotMain.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java index 3e410f60a..777bd7169 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotMain.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; -import org.geysermc.connector.common.main.IGeyserMain; +import org.geysermc.geyser.common.main.IGeyserMain; public class GeyserSpigotMain extends IGeyserMain { diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java similarity index 94% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java index 23e9554dc..ff2855fe1 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPingPassthrough.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; import lombok.AllArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.util.CachedServerIcon; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; import javax.annotation.Nonnull; import java.net.InetAddress; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java similarity index 89% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java index c7b732fe9..490268893 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot; +package org.geysermc.geyser.platform.spigot; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.MappingData; @@ -32,27 +32,27 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.translators.world.WorldManager; -import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.utils.Constants; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.dump.BootstrapDumpInfo; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.utils.Constants; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; -import org.geysermc.platform.spigot.command.GeyserSpigotCommandExecutor; -import org.geysermc.platform.spigot.command.GeyserSpigotCommandManager; -import org.geysermc.platform.spigot.command.SpigotCommandSender; -import org.geysermc.platform.spigot.world.GeyserPistonListener; -import org.geysermc.platform.spigot.world.GeyserSpigot1_11CraftingListener; -import org.geysermc.platform.spigot.world.GeyserSpigotBlockPlaceListener; -import org.geysermc.platform.spigot.world.manager.*; +import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandExecutor; +import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandManager; +import org.geysermc.geyser.platform.spigot.command.SpigotCommandSender; +import org.geysermc.geyser.platform.spigot.world.GeyserPistonListener; +import org.geysermc.geyser.platform.spigot.world.GeyserSpigot1_11CraftingListener; +import org.geysermc.geyser.platform.spigot.world.GeyserSpigotBlockPlaceListener; +import org.geysermc.geyser.platform.spigot.world.manager.*; import java.io.File; import java.io.IOException; @@ -70,7 +70,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { private IGeyserPingPassthrough geyserSpigotPingPassthrough; private GeyserSpigotWorldManager geyserWorldManager; - private GeyserConnector connector; + private GeyserImpl geyser; /** * The Minecraft server version, formatted as 1.#.# @@ -147,15 +147,15 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // Turn "(MC: 1.16.4)" into 1.16.4. this.minecraftVersion = Bukkit.getServer().getVersion().split("\\(MC: ")[1].split("\\)")[0]; - this.connector = GeyserConnector.start(PlatformType.SPIGOT, this); + this.geyser = GeyserImpl.start(PlatformType.SPIGOT, this); if (geyserConfig.isLegacyPingPassthrough()) { - this.geyserSpigotPingPassthrough = GeyserLegacyPingPassthrough.init(connector); + this.geyserSpigotPingPassthrough = GeyserLegacyPingPassthrough.init(geyser); } else { this.geyserSpigotPingPassthrough = new GeyserSpigotPingPassthrough(geyserLogger); } - this.geyserCommandManager = new GeyserSpigotCommandManager(connector); + this.geyserCommandManager = new GeyserSpigotCommandManager(geyser); boolean isViaVersion = Bukkit.getPluginManager().getPlugin("ViaVersion") != null; if (isViaVersion) { @@ -226,23 +226,23 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { } geyserLogger.debug("Using default world manager: " + this.geyserWorldManager.getClass()); } - GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(connector, this.geyserWorldManager); + GeyserSpigotBlockPlaceListener blockPlaceListener = new GeyserSpigotBlockPlaceListener(geyser, this.geyserWorldManager); Bukkit.getServer().getPluginManager().registerEvents(blockPlaceListener, this); - Bukkit.getServer().getPluginManager().registerEvents(new GeyserPistonListener(connector, this.geyserWorldManager), this); + Bukkit.getServer().getPluginManager().registerEvents(new GeyserPistonListener(geyser, this.geyserWorldManager), this); if (isPre1_12) { // Register events needed to send all recipes to the client - Bukkit.getServer().getPluginManager().registerEvents(new GeyserSpigot1_11CraftingListener(connector), this); + Bukkit.getServer().getPluginManager().registerEvents(new GeyserSpigot1_11CraftingListener(geyser), this); } - this.getCommand("geyser").setExecutor(new GeyserSpigotCommandExecutor(connector)); + this.getCommand("geyser").setExecutor(new GeyserSpigotCommandExecutor(geyser)); } @Override public void onDisable() { - if (connector != null) { - connector.shutdown(); + if (geyser != null) { + geyser.shutdown(); } if (geyserInjector != null) { geyserInjector.shutdown(); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java similarity index 88% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java index 14459a35a..35867ad15 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandExecutor.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.command; +package org.geysermc.geyser.platform.spigot.command; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandExecutor; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandExecutor; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Arrays; import java.util.Collections; @@ -41,8 +41,8 @@ import java.util.List; public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabExecutor { - public GeyserSpigotCommandExecutor(GeyserConnector connector) { - super(connector); + public GeyserSpigotCommandExecutor(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandManager.java similarity index 89% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandManager.java index a0e958503..13ba3691c 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/GeyserSpigotCommandManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandManager.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.command; +package org.geysermc.geyser.platform.spigot.command; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; import java.lang.reflect.Field; @@ -47,8 +47,8 @@ public class GeyserSpigotCommandManager extends CommandManager { } } - public GeyserSpigotCommandManager(GeyserConnector connector) { - super(connector); + public GeyserSpigotCommandManager(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java similarity index 91% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java index 9cd6d672f..a871d1c18 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/command/SpigotCommandSender.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.command; +package org.geysermc.geyser.platform.spigot.command; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.utils.LanguageUtils; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -91,7 +91,7 @@ public class SpigotCommandSender implements CommandSender { //noinspection JavaReflectionMemberAccess - of course it doesn't exist; that's why we're doing it LOCALE_METHOD = Player.Spigot.class.getMethod("getLocale"); } catch (NoSuchMethodException e) { - GeyserConnector.getInstance().getLogger().debug("Player.Spigot.getLocale() doesn't exist? Not a big deal but if you're seeing this please report it to the developers!"); + GeyserImpl.getInstance().getLogger().debug("Player.Spigot.getLocale() doesn't exist? Not a big deal but if you're seeing this please report it to the developers!"); } } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java similarity index 87% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java index 31f7585bb..751e21ad8 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world; +package org.geysermc.geyser.platform.spigot.world; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3i; @@ -40,24 +40,24 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPistonEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.PistonCache; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntity; -import org.geysermc.connector.utils.Direction; -import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.PistonCache; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntity; +import org.geysermc.geyser.utils.Direction; +import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager; import java.util.List; import java.util.Map; import java.util.UUID; public class GeyserPistonListener implements Listener { - private final GeyserConnector connector; + private final GeyserImpl geyser; private final GeyserSpigotWorldManager worldManager; - public GeyserPistonListener(GeyserConnector connector, GeyserSpigotWorldManager worldManager) { - this.connector = connector; + public GeyserPistonListener(GeyserImpl geyser, GeyserSpigotWorldManager worldManager) { + this.geyser = geyser; this.worldManager = worldManager; } @@ -88,7 +88,7 @@ public class GeyserPistonListener implements Listener { Object2IntMap attachedBlocks = new Object2IntOpenHashMap<>(); boolean blocksFilled = false; - for (Map.Entry entry : connector.getSessionManager().getSessions().entrySet()) { + for (Map.Entry entry : geyser.getSessionManager().getSessions().entrySet()) { Player player = Bukkit.getPlayer(entry.getKey()); if (player == null || !player.getWorld().equals(world)) { continue; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java similarity index 94% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index 726ffa66a..9fd0c5f73 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world; +package org.geysermc.geyser.platform.spigot.world; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; @@ -46,11 +46,11 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.inventory.Recipe; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.*; @@ -60,7 +60,7 @@ import java.util.*; */ public class GeyserSpigot1_11CraftingListener implements Listener { - private final GeyserConnector connector; + private final GeyserImpl geyser; /** * Specific mapping data for 1.12 to 1.13. Used to convert the 1.12 item into 1.13. */ @@ -70,8 +70,8 @@ public class GeyserSpigot1_11CraftingListener implements Listener { */ private final List protocolList; - public GeyserSpigot1_11CraftingListener(GeyserConnector connector) { - this.connector = connector; + public GeyserSpigot1_11CraftingListener(GeyserImpl geyser) { + this.geyser = geyser; this.mappingData1_12to1_13 = Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getMappingData(); this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(), ProtocolVersion.v1_13.getVersion()); @@ -80,7 +80,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { GeyserSession session = null; - for (GeyserSession otherSession : connector.getSessionManager().getSessions().values()) { + for (GeyserSession otherSession : geyser.getSessionManager().getSessions().values()) { if (otherSession.getName().equals(event.getPlayer().getName())) { session = otherSession; break; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java similarity index 85% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index 8e3dfe075..3b79666dc 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world; +package org.geysermc.geyser.platform.spigot.world; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; @@ -32,20 +32,20 @@ import lombok.AllArgsConstructor; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.platform.spigot.world.manager.GeyserSpigotWorldManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager; @AllArgsConstructor public class GeyserSpigotBlockPlaceListener implements Listener { - private final GeyserConnector connector; + private final GeyserImpl geyser; private final GeyserSpigotWorldManager worldManager; @EventHandler public void place(final BlockPlaceEvent event) { - GeyserSession session = connector.getPlayerByUuid(event.getPlayer().getUniqueId()); + GeyserSession session = geyser.getPlayerByUuid(event.getPlayer().getUniqueId()); if (session == null) { return; } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java similarity index 92% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java index 1875d3451..5a603d3c7 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world.manager; +package org.geysermc.geyser.platform.spigot.world.manager; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockStorage; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java similarity index 96% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java index 6d856edff..f80d06c55 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world.manager; +package org.geysermc.geyser.platform.spigot.world.manager; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.MappingData; @@ -36,8 +36,8 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import java.util.List; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java similarity index 91% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java index 88721b8b1..733a0291d 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world.manager; +package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; /** * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java similarity index 93% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java index b187ab358..21988fa25 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world.manager; +package org.geysermc.geyser.platform.spigot.world.manager; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.MappingData; @@ -32,9 +32,9 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntList; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.platform.spigot.GeyserSpigotPlugin; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin; import java.util.List; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java similarity index 91% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java index 91a589da1..fa356b561 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world.manager; +package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java similarity index 91% rename from bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java rename to bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 70ee86530..804cdb7d3 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.spigot.world.manager; +package org.geysermc.geyser.platform.spigot.world.manager; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; @@ -38,14 +38,14 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.Plugin; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.connector.network.translators.world.GeyserWorldManager; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.BlockEntityUtils; -import org.geysermc.connector.utils.GameRule; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; +import org.geysermc.geyser.network.translators.world.GeyserWorldManager; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.utils.GameRule; import java.util.ArrayList; import java.util.List; @@ -100,7 +100,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z); if (!(block.getState() instanceof Lectern lectern)) { - session.getConnector().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString()); + session.getGeyser().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString()); return; } diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index 7edd14520..dbdfa9c24 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -1,4 +1,4 @@ -main: org.geysermc.platform.spigot.GeyserSpigotPlugin +main: org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin name: ${outputName}-Spigot author: ${project.organization.name} website: ${project.organization.url} diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml index db26cc4f0..959f75248 100644 --- a/bootstrap/sponge/pom.xml +++ b/bootstrap/sponge/pom.xml @@ -40,7 +40,7 @@ - org.geysermc.platform.sponge.GeyserSpongeMain + org.geysermc.geyser.platform.sponge.GeyserSpongeMain @@ -59,27 +59,27 @@ com.fasterxml.jackson - org.geysermc.platform.sponge.shaded.jackson + org.geysermc.geyser.platform.sponge.shaded.jackson io.netty - org.geysermc.platform.sponge.shaded.netty + org.geysermc.geyser.platform.sponge.shaded.netty it.unimi.dsi.fastutil - org.geysermc.platform.sponge.shaded.fastutil + org.geysermc.geyser.platform.sponge.shaded.fastutil com.google.common - org.geysermc.platform.sponge.shaded.google.common + org.geysermc.geyser.platform.sponge.shaded.google.common com.google.guava - org.geysermc.platform.sponge.shaded.google.guava + org.geysermc.geyser.platform.sponge.shaded.google.guava net.kyori - org.geysermc.platform.sponge.shaded.kyori + org.geysermc.geyser.platform.sponge.shaded.kyori diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeConfiguration.java similarity index 92% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeConfiguration.java index 5a0496ca9..b53160c29 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeConfiguration.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeConfiguration.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge; +package org.geysermc.geyser.platform.sponge; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import java.nio.file.Path; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeDumpInfo.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeDumpInfo.java similarity index 96% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeDumpInfo.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeDumpInfo.java index 2872e5abc..c947c34fd 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeDumpInfo.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeDumpInfo.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge; +package org.geysermc.geyser.platform.sponge; import lombok.Getter; -import org.geysermc.connector.dump.BootstrapDumpInfo; +import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.spongepowered.api.Platform; import org.spongepowered.api.Sponge; import org.spongepowered.api.plugin.PluginContainer; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java similarity index 95% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java index b560c4dd4..333ab9038 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeLogger.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge; +package org.geysermc.geyser.platform.sponge; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.GeyserLogger; +import org.geysermc.geyser.api.logger.GeyserLogger; import org.slf4j.Logger; @AllArgsConstructor diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeMain.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java similarity index 93% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeMain.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java index f6643a5ca..999d1a635 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongeMain.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge; +package org.geysermc.geyser.platform.sponge; -import org.geysermc.connector.common.main.IGeyserMain; +import org.geysermc.geyser.common.main.IGeyserMain; public class GeyserSpongeMain extends IGeyserMain { diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java similarity index 95% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java index a516bff8c..c22972441 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePingPassthrough.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge; +package org.geysermc.geyser.platform.sponge; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; import org.spongepowered.api.MinecraftVersion; import org.spongepowered.api.Sponge; import org.spongepowered.api.event.SpongeEventFactory; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java similarity index 82% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java index 1986bbd22..b3e416823 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java @@ -23,21 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge; +package org.geysermc.geyser.platform.sponge; import com.google.inject.Inject; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.platform.sponge.command.GeyserSpongeCommandExecutor; -import org.geysermc.platform.sponge.command.GeyserSpongeCommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.dump.BootstrapDumpInfo; +import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.platform.sponge.command.GeyserSpongeCommandExecutor; +import org.geysermc.geyser.platform.sponge.command.GeyserSpongeCommandManager; import org.slf4j.Logger; import org.spongepowered.api.Sponge; import org.spongepowered.api.config.ConfigDir; @@ -52,7 +52,7 @@ import java.net.InetSocketAddress; import java.nio.file.Path; import java.util.UUID; -@Plugin(id = "geyser", name = GeyserConnector.NAME + "-Sponge", version = GeyserConnector.VERSION, url = "https://geysermc.org", authors = "GeyserMC") +@Plugin(id = "geyser", name = GeyserImpl.NAME + "-Sponge", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC") public class GeyserSpongePlugin implements GeyserBootstrap { @Inject @@ -67,7 +67,7 @@ public class GeyserSpongePlugin implements GeyserBootstrap { private GeyserSpongeLogger geyserLogger; private IGeyserPingPassthrough geyserSpongePingPassthrough; - private GeyserConnector connector; + private GeyserImpl geyser; @Override public void onEnable() { @@ -107,21 +107,21 @@ public class GeyserSpongePlugin implements GeyserBootstrap { this.geyserLogger = new GeyserSpongeLogger(logger, geyserConfig.isDebugMode()); GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger); - this.connector = GeyserConnector.start(PlatformType.SPONGE, this); + this.geyser = GeyserImpl.start(PlatformType.SPONGE, this); if (geyserConfig.isLegacyPingPassthrough()) { - this.geyserSpongePingPassthrough = GeyserLegacyPingPassthrough.init(connector); + this.geyserSpongePingPassthrough = GeyserLegacyPingPassthrough.init(geyser); } else { this.geyserSpongePingPassthrough = new GeyserSpongePingPassthrough(); } - this.geyserCommandManager = new GeyserSpongeCommandManager(Sponge.getCommandManager(), connector); - Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(connector), "geyser"); + this.geyserCommandManager = new GeyserSpongeCommandManager(Sponge.getCommandManager(), geyser); + Sponge.getCommandManager().register(this, new GeyserSpongeCommandExecutor(geyser), "geyser"); } @Override public void onDisable() { - connector.shutdown(); + geyser.shutdown(); } @Override diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java similarity index 88% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java index 10c361335..faab87c6b 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandExecutor.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge.command; +package org.geysermc.geyser.platform.sponge.command; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandExecutor; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandExecutor; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; @@ -47,8 +47,8 @@ import java.util.Optional; public class GeyserSpongeCommandExecutor extends CommandExecutor implements CommandCallable { - public GeyserSpongeCommandExecutor(GeyserConnector connector) { - super(connector); + public GeyserSpongeCommandExecutor(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandManager.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandManager.java similarity index 89% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandManager.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandManager.java index 38d8ba606..d6cc967a4 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/GeyserSpongeCommandManager.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandManager.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge.command; +package org.geysermc.geyser.platform.sponge.command; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandMapping; import org.spongepowered.api.text.Text; @@ -34,8 +34,8 @@ import org.spongepowered.api.text.Text; public class GeyserSpongeCommandManager extends CommandManager { private final org.spongepowered.api.command.CommandManager handle; - public GeyserSpongeCommandManager(org.spongepowered.api.command.CommandManager handle, GeyserConnector connector) { - super(connector); + public GeyserSpongeCommandManager(org.spongepowered.api.command.CommandManager handle, GeyserImpl geyser) { + super(geyser); this.handle = handle; } diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java similarity index 94% rename from bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java rename to bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java index d2167d80b..20d1ec08b 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/command/SpongeCommandSender.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.sponge.command; +package org.geysermc.geyser.platform.sponge.command; import lombok.AllArgsConstructor; -import org.geysermc.connector.command.CommandSender; +import org.geysermc.geyser.command.CommandSender; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.source.ConsoleSource; import org.spongepowered.api.text.Text; diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index 6a8a35f30..ac02d503b 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -81,7 +81,7 @@ - org.geysermc.platform.standalone.GeyserStandaloneBootstrap + org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap @@ -119,7 +119,7 @@ - org.geysermc.platform.standalone.GeyserStandaloneBootstrap + org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap true diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java similarity index 94% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java index 6a612f17d..c4e3fcbc7 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone; +package org.geysermc.geyser.platform.standalone; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.JavaType; @@ -39,18 +39,18 @@ import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.appender.ConsoleAppender; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.platform.standalone.command.GeyserCommandManager; -import org.geysermc.platform.standalone.gui.GeyserStandaloneGUI; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.dump.BootstrapDumpInfo; +import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager; +import org.geysermc.geyser.platform.standalone.gui.GeyserStandaloneGUI; import java.io.File; import java.io.IOException; @@ -74,7 +74,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { private boolean useGui = System.console() == null && !isHeadless(); private String configFilename = "config.yml"; - private GeyserConnector connector; + private GeyserImpl geyser; private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -211,14 +211,14 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { // Allow libraries like Protocol to have their debug information passthrough logger.get().setLevel(geyserConfig.isDebugMode() ? Level.DEBUG : Level.INFO); - connector = GeyserConnector.start(PlatformType.STANDALONE, this); - geyserCommandManager = new GeyserCommandManager(connector); + geyser = GeyserImpl.start(PlatformType.STANDALONE, this); + geyserCommandManager = new GeyserCommandManager(geyser); if (gui != null) { gui.setupInterface(geyserLogger, geyserCommandManager); } - geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector); + geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser); if (!useGui) { geyserLogger.start(); // Throws an error otherwise @@ -242,7 +242,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { @Override public void onDisable() { - connector.shutdown(); + geyser.shutdown(); System.exit(0); } diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneConfiguration.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneConfiguration.java similarity index 93% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneConfiguration.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneConfiguration.java index fad05d9d0..9eb3eebd2 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneConfiguration.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneConfiguration.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone; +package org.geysermc.geyser.platform.standalone; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneDumpInfo.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneDumpInfo.java similarity index 93% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneDumpInfo.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneDumpInfo.java index f7716b5a2..7524578ec 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneDumpInfo.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneDumpInfo.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone; +package org.geysermc.geyser.platform.standalone; import lombok.Getter; -import org.geysermc.connector.dump.BootstrapDumpInfo; +import org.geysermc.geyser.dump.BootstrapDumpInfo; @Getter public class GeyserStandaloneDumpInfo extends BootstrapDumpInfo { diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java similarity index 87% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java index 94d5857db..3ba144b06 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java @@ -23,33 +23,33 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone; +package org.geysermc.geyser.platform.standalone; import lombok.extern.log4j.Log4j2; import net.minecrell.terminalconsole.SimpleTerminalConsole; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.config.Configurator; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.common.ChatColor; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.common.ChatColor; @Log4j2 public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender { @Override protected boolean isRunning() { - return !GeyserConnector.getInstance().isShuttingDown(); + return !GeyserImpl.getInstance().isShuttingDown(); } @Override protected void runCommand(String line) { - GeyserConnector.getInstance().getCommandManager().runCommand(this, line); + GeyserImpl.getInstance().getCommandManager().runCommand(this, line); } @Override protected void shutdown() { - GeyserConnector.getInstance().getBootstrap().onDisable(); + GeyserImpl.getInstance().getBootstrap().onDisable(); } @Override diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/LoopbackUtil.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java similarity index 95% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/LoopbackUtil.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java index 5db34dbab..0b6a96304 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/LoopbackUtil.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone; +package org.geysermc.geyser.platform.standalone; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.utils.LanguageUtils; import java.io.InputStream; import java.nio.file.Files; diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/command/GeyserCommandManager.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/command/GeyserCommandManager.java similarity index 85% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/command/GeyserCommandManager.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/command/GeyserCommandManager.java index 85b2798f9..83da038a1 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/command/GeyserCommandManager.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/command/GeyserCommandManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone.command; +package org.geysermc.geyser.platform.standalone.command; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; public class GeyserCommandManager extends CommandManager { - public GeyserCommandManager(GeyserConnector connector) { - super(connector); + public GeyserCommandManager(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/ANSIColor.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/ANSIColor.java similarity index 98% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/ANSIColor.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/ANSIColor.java index eb64a9694..1d6057b8c 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/ANSIColor.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/ANSIColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone.gui; +package org.geysermc.geyser.platform.standalone.gui; import lombok.Getter; diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/ColorPane.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/ColorPane.java similarity index 98% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/ColorPane.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/ColorPane.java index db5c4a3e1..0c8790ddd 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/ColorPane.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/ColorPane.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone.gui; +package org.geysermc.geyser.platform.standalone.gui; import javax.swing.*; import javax.swing.text.*; diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java similarity index 96% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java index e44d08b9e..7f998619f 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GeyserStandaloneGUI.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone.gui; +package org.geysermc.geyser.platform.standalone.gui; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.platform.standalone.GeyserStandaloneLogger; -import org.geysermc.platform.standalone.command.GeyserCommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.platform.standalone.GeyserStandaloneLogger; +import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager; import javax.swing.*; import javax.swing.table.DefaultTableModel; @@ -302,11 +302,11 @@ public class GeyserStandaloneGUI { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); Runnable periodicTask = () -> { - if (GeyserConnector.getInstance() != null) { + if (GeyserImpl.getInstance() != null) { // Update player table playerTableModel.getDataVector().removeAllElements(); - for (GeyserSession player : GeyserConnector.getInstance().getSessionManager().getSessions().values()) { + for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { Vector row = new Vector<>(); row.add(player.getSocketAddress().getHostName()); row.add(player.getPlayerEntity().getUsername()); diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GraphPanel.java similarity index 99% rename from bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java rename to bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GraphPanel.java index 9cfa9399d..83100ddac 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/gui/GraphPanel.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GraphPanel.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.standalone.gui; +package org.geysermc.geyser.platform.standalone.gui; import lombok.Setter; diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml index 11a805b86..0805d7eef 100644 --- a/bootstrap/velocity/pom.xml +++ b/bootstrap/velocity/pom.xml @@ -40,7 +40,7 @@ - org.geysermc.platform.velocity.GeyserVelocityMain + org.geysermc.geyser.platform.velocity.GeyserVelocityMain @@ -59,15 +59,15 @@ com.fasterxml.jackson - org.geysermc.platform.velocity.shaded.jackson + org.geysermc.geyser.platform.velocity.shaded.jackson it.unimi.dsi.fastutil - org.geysermc.platform.velocity.shaded.fastutil + org.geysermc.geyser.platform.velocity.shaded.fastutil net.kyori.adventure.text.serializer.gson.legacyimpl - org.geysermc.platform.velocity.shaded.kyori.legacyimpl + org.geysermc.geyser.platform.velocity.shaded.kyori.legacyimpl diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityConfiguration.java similarity index 93% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityConfiguration.java index a1b1c861e..62e600290 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityConfiguration.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityConfiguration.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; -import org.geysermc.connector.FloodgateKeyLoader; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.FloodgateKeyLoader; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import java.io.File; import java.nio.file.Path; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityDumpInfo.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java similarity index 94% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityDumpInfo.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java index 93af72d84..f587c3aa8 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityDumpInfo.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; -import org.geysermc.connector.common.serializer.AsteriskSerializer; -import org.geysermc.connector.dump.BootstrapDumpInfo; +import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.dump.BootstrapDumpInfo; import java.util.ArrayList; import java.util.List; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java similarity index 94% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java index ea22586ba..368c64e67 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityInjector.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; import com.velocitypowered.api.proxy.ProxyServer; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.local.LocalAddress; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.connection.GeyserInjector; -import org.geysermc.connector.common.connection.LocalServerChannelWrapper; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.common.connection.GeyserInjector; +import org.geysermc.geyser.common.connection.LocalServerChannelWrapper; import java.lang.reflect.Field; import java.util.function.Supplier; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityLogger.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java similarity index 95% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityLogger.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java index 729af50ab..57d988dc6 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityLogger.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.GeyserLogger; +import org.geysermc.geyser.api.logger.GeyserLogger; import org.slf4j.Logger; @AllArgsConstructor diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityMain.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java similarity index 93% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityMain.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java index 6b337ebbe..e5f56226a 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityMain.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; -import org.geysermc.connector.common.main.IGeyserMain; +import org.geysermc.geyser.common.main.IGeyserMain; public class GeyserVelocityMain extends IGeyserMain { diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPingPassthrough.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java similarity index 96% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPingPassthrough.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java index bc10bc723..37d6e8ba2 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPingPassthrough.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; import com.velocitypowered.api.event.proxy.ProxyPingEvent; import com.velocitypowered.api.network.ProtocolVersion; @@ -32,8 +32,8 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.server.ServerPing; import lombok.AllArgsConstructor; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; import java.net.InetSocketAddress; import java.util.Optional; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java similarity index 85% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java index f53eee8d1..aa4261ad2 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity; +package org.geysermc.geyser.platform.velocity; import com.google.inject.Inject; import com.velocitypowered.api.command.CommandManager; @@ -36,17 +36,17 @@ import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.platform.velocity.command.GeyserVelocityCommandExecutor; -import org.geysermc.platform.velocity.command.GeyserVelocityCommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.dump.BootstrapDumpInfo; +import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor; +import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandManager; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -58,7 +58,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.UUID; -@Plugin(id = "geyser", name = GeyserConnector.NAME + "-Velocity", version = GeyserConnector.VERSION, url = "https://geysermc.org", authors = "GeyserMC") +@Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC") public class GeyserVelocityPlugin implements GeyserBootstrap { @Inject @@ -76,10 +76,10 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { private GeyserVelocityLogger geyserLogger; private IGeyserPingPassthrough geyserPingPassthrough; - private GeyserConnector connector; + private GeyserImpl geyser; @Getter - private final Path configFolder = Paths.get("plugins/" + GeyserConnector.NAME + "-Velocity/"); + private final Path configFolder = Paths.get("plugins/" + GeyserImpl.NAME + "-Velocity/"); @Override public void onEnable() { @@ -136,15 +136,15 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile()); - this.connector = GeyserConnector.start(PlatformType.VELOCITY, this); + this.geyser = GeyserImpl.start(PlatformType.VELOCITY, this); this.geyserInjector = new GeyserVelocityInjector(proxyServer); // Will be initialized after the proxy has been bound - this.geyserCommandManager = new GeyserVelocityCommandManager(connector); - this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(connector)); + this.geyserCommandManager = new GeyserVelocityCommandManager(geyser); + this.commandManager.register("geyser", new GeyserVelocityCommandExecutor(geyser)); if (geyserConfig.isLegacyPingPassthrough()) { - this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector); + this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser); } else { this.geyserPingPassthrough = new GeyserVelocityPingPassthrough(proxyServer); } @@ -152,8 +152,8 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { @Override public void onDisable() { - if (connector != null) { - connector.shutdown(); + if (geyser != null) { + geyser.shutdown(); } if (geyserInjector != null) { geyserInjector.shutdown(); @@ -171,7 +171,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { } @Override - public org.geysermc.connector.command.CommandManager getGeyserCommandManager() { + public org.geysermc.geyser.command.CommandManager getGeyserCommandManager() { return this.geyserCommandManager; } diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java similarity index 85% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java index ab9edd1e0..b4a1e5963 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandExecutor.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity.command; +package org.geysermc.geyser.platform.velocity.command; import com.velocitypowered.api.command.SimpleCommand; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandExecutor; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandExecutor; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Arrays; import java.util.Collections; @@ -40,8 +40,8 @@ import java.util.List; public class GeyserVelocityCommandExecutor extends CommandExecutor implements SimpleCommand { - public GeyserVelocityCommandExecutor(GeyserConnector connector) { - super(connector); + public GeyserVelocityCommandExecutor(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandManager.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandManager.java similarity index 85% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandManager.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandManager.java index cbf8e3df4..33f0d77c2 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/GeyserVelocityCommandManager.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity.command; +package org.geysermc.geyser.platform.velocity.command; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; public class GeyserVelocityCommandManager extends CommandManager { - public GeyserVelocityCommandManager(GeyserConnector connector) { - super(connector); + public GeyserVelocityCommandManager(GeyserImpl geyser) { + super(geyser); } @Override diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java similarity index 94% rename from bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java rename to bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java index 140711a7c..d45af5306 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/command/VelocityCommandSender.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.platform.velocity.command; +package org.geysermc.geyser.platform.velocity.command; import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.proxy.ConsoleCommandSource; import com.velocitypowered.api.proxy.Player; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Locale; diff --git a/core/pom.xml b/core/pom.xml index fd4be59a0..fd54b99d7 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -24,6 +24,12 @@ 1.4.3-SNAPSHOT provided + + org.geysermc + api + 1.4.3-SNAPSHOT + compile + org.geysermc common @@ -308,7 +314,7 @@ - ${project.basedir}/src/main/java/org/geysermc/connector/GeyserConnector.java + ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserConnector.java @@ -332,7 +338,7 @@ - ${project.basedir}/src/main/java/org/geysermc/connector/GeyserConnector.java + ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserConnector.java diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index a33c51952..af05a4aca 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -25,487 +25,62 @@ package org.geysermc.connector; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.steveice10.packetlib.tcp.TcpSession; -import com.nukkitx.network.raknet.RakNetConstants; -import com.nukkitx.network.util.EventLoops; import com.nukkitx.protocol.bedrock.BedrockServer; -import io.netty.channel.epoll.Epoll; -import io.netty.channel.kqueue.KQueue; -import io.netty.util.NettyRuntime; -import io.netty.util.concurrent.DefaultThreadFactory; -import io.netty.util.internal.SystemPropertyUtil; -import lombok.Getter; -import lombok.Setter; import org.geysermc.common.PlatformType; -import org.geysermc.connector.bootstrap.GeyserBootstrap; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.metrics.Metrics; -import org.geysermc.connector.network.ConnectorServerEventHandler; import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslatorRegistry; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.network.translators.world.WorldManager; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.scoreboard.ScoreboardUpdater; -import org.geysermc.connector.skin.FloodgateSkinUploader; -import org.geysermc.connector.utils.*; -import org.geysermc.floodgate.crypto.AesCipher; -import org.geysermc.floodgate.crypto.AesKeyProducer; -import org.geysermc.floodgate.crypto.Base64Topping; -import org.geysermc.floodgate.crypto.FloodgateCipher; -import org.geysermc.floodgate.news.NewsItemAction; -import org.geysermc.floodgate.time.TimeSyncer; -import org.jetbrains.annotations.Contract; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.Geyser; -import javax.naming.directory.Attribute; -import javax.naming.directory.InitialDirContext; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.security.Key; -import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; import java.util.UUID; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -@Getter +/** + * Deprecated, please use {@link Geyser} or {@link GeyserImpl}. + * + * @deprecated legacy code + */ +@Deprecated public class GeyserConnector { - public static final ObjectMapper JSON_MAPPER = new ObjectMapper() - .enable(JsonParser.Feature.IGNORE_UNDEFINED) - .enable(JsonParser.Feature.ALLOW_COMMENTS) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES) - .enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); + public static final String NAME = GeyserImpl.NAME; + public static final String GIT_VERSION = GeyserImpl.GIT_VERSION; // A fallback for running in IDEs + public static final String VERSION = GeyserImpl.VERSION; // A fallback for running in IDEs - public static final String NAME = "Geyser"; - public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs - public static final String VERSION = "DEV"; // A fallback for running in IDEs + public static final String OAUTH_CLIENT_ID = GeyserImpl.OAUTH_CLIENT_ID; - /** - * Oauth client ID for Microsoft authentication - */ - public static final String OAUTH_CLIENT_ID = "204cefd1-4818-4de1-b98d-513fae875d88"; + private static final GeyserConnector INSTANCE = new GeyserConnector(); - private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"; + public static GeyserConnector getInstance() { + return INSTANCE; + } - private final SessionManager sessionManager = new SessionManager(); + public BedrockServer getBedrockServer() { + return GeyserImpl.getInstance().getBedrockServer(); + } - private static GeyserConnector instance; + public boolean isShuttingDown() { + return GeyserImpl.getInstance().isShuttingDown(); + } - /** - * This is used in GeyserConnect to stop the bedrock server binding to a port - */ - @Setter - private static boolean shouldStartListener = true; - - private final TimeSyncer timeSyncer; - private FloodgateCipher cipher; - private FloodgateSkinUploader skinUploader; - private final NewsHandler newsHandler; - - private volatile boolean shuttingDown = false; - - private final ScheduledExecutorService scheduledThread; - - private final BedrockServer bedrockServer; - private final PlatformType platformType; - private final GeyserBootstrap bootstrap; - - private final Metrics metrics; - - private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) { - long startupTime = System.currentTimeMillis(); - - instance = this; - - this.bootstrap = bootstrap; - - GeyserLogger logger = bootstrap.getGeyserLogger(); - GeyserConfiguration config = bootstrap.getGeyserConfig(); - - this.platformType = platformType; - - logger.info("******************************************"); - logger.info(""); - logger.info(LanguageUtils.getLocaleStringLog("geyser.core.load", NAME, VERSION)); - logger.info(""); - logger.info("******************************************"); - - this.scheduledThread = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("Geyser Scheduled Thread")); - - logger.setDebug(config.isDebugMode()); - - PacketTranslatorRegistry.init(); - - /* Initialize translators and registries */ - BlockRegistries.init(); - Registries.init(); - - EntityDefinitions.init(); - ItemTranslator.init(); - MessageTranslator.init(); - LocaleUtils.init(); - ScoreboardUpdater.init(); - - ResourcePack.loadPacks(); - - if (platformType != PlatformType.STANDALONE && config.getRemote().getAddress().equals("auto")) { - // Set the remote address to localhost since that is where we are always connecting - try { - config.getRemote().setAddress(InetAddress.getLocalHost().getHostAddress()); - } catch (UnknownHostException ex) { - logger.debug("Unknown host when trying to find localhost."); - if (config.isDebugMode()) { - ex.printStackTrace(); - } - config.getRemote().setAddress(InetAddress.getLoopbackAddress().getHostAddress()); - } - } - String remoteAddress = config.getRemote().getAddress(); - // Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry. - if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) { - int remotePort; - try { - // Searches for a server address and a port from a SRV record of the specified host name - InitialDirContext ctx = new InitialDirContext(); - Attribute attr = ctx.getAttributes("dns:///_minecraft._tcp." + remoteAddress, new String[]{"SRV"}).get("SRV"); - // size > 0 = SRV entry found - if (attr != null && attr.size() > 0) { - String[] record = ((String) attr.get(0)).split(" "); - // Overwrites the existing address and port with that from the SRV record. - config.getRemote().setAddress(remoteAddress = record[3]); - config.getRemote().setPort(remotePort = Integer.parseInt(record[2])); - logger.debug("Found SRV record \"" + remoteAddress + ":" + remotePort + "\""); - } - } catch (Exception | NoClassDefFoundError ex) { // Check for a NoClassDefFoundError to prevent Android crashes - logger.debug("Exception while trying to find an SRV record for the remote host."); - if (config.isDebugMode()) - ex.printStackTrace(); // Otherwise we can get a stack trace for any domain that doesn't have an SRV record - } - } - - // Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves - TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false; - - TimeSyncer timeSyncer = null; - if (config.getRemote().getAuthType() == AuthType.FLOODGATE) { - timeSyncer = new TimeSyncer(Constants.NTP_SERVER); - try { - Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath()); - cipher = new AesCipher(new Base64Topping()); - cipher.init(key); - logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); - skinUploader = new FloodgateSkinUploader(this).start(); - } catch (Exception exception) { - logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception); - } - } - this.timeSyncer = timeSyncer; - - String branch = "unknown"; - int buildNumber = -1; - if (this.isProductionEnvironment()) { - try { - Properties gitProperties = new Properties(); - gitProperties.load(FileUtils.getResource("git.properties")); - branch = gitProperties.getProperty("git.branch"); - String build = gitProperties.getProperty("git.build.number"); - if (build != null) { - buildNumber = Integer.parseInt(build); - } - } catch (Throwable e) { - logger.error("Failed to read git.properties", e); - } - } else { - logger.debug("Not getting git properties for the news handler as we are in a development environment."); - } - newsHandler = new NewsHandler(branch, buildNumber); - - CooldownUtils.setDefaultShowCooldown(config.getShowCooldown()); - DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether - - // https://github.com/GeyserMC/Geyser/issues/957 - RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu(); - logger.debug("Setting MTU to " + config.getMtu()); - - Integer bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads"); - if (bedrockThreadCount == null) { - // Copy the code from Netty's default thread count fallback - bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2)); - } - - boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol(); - bedrockServer = new BedrockServer( - new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()), - bedrockThreadCount, - EventLoops.commonGroup(), - enableProxyProtocol - ); - - if (config.isDebugMode()) { - logger.debug("EventLoop type: " + EventLoops.getChannelType()); - if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) { - if (System.getProperties().contains("disableNativeEventLoop")) { - logger.debug("EventLoop type is NIO because native event loops are disabled."); - } else { - logger.debug("Reason for no Epoll: " + Epoll.unavailabilityCause().toString()); - logger.debug("Reason for no KQueue: " + KQueue.unavailabilityCause().toString()); - } - } - } - - bedrockServer.setHandler(new ConnectorServerEventHandler(this)); - - if (shouldStartListener) { - bedrockServer.bind().whenComplete((avoid, throwable) -> { - if (throwable == null) { - logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); - } else { - logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); - throwable.printStackTrace(); - } - }).join(); - } - - if (config.getMetrics().isEnabled()) { - metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger("")); - metrics.addCustomChart(new Metrics.SingleLineChart("players", sessionManager::size)); - // Prevent unwanted words best we can - metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase())); - metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName)); - metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", LanguageUtils::getDefaultLocale)); - metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserConnector.VERSION)); - metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> { - Map valueMap = new HashMap<>(); - for (GeyserSession session : sessionManager.getAllSessions()) { - if (session == null) continue; - if (session.getClientData() == null) continue; - String os = session.getClientData().getDeviceOs().toString(); - if (!valueMap.containsKey(os)) { - valueMap.put(os, 1); - } else { - valueMap.put(os, valueMap.get(os) + 1); - } - } - return valueMap; - })); - metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> { - Map valueMap = new HashMap<>(); - for (GeyserSession session : sessionManager.getAllSessions()) { - if (session == null) continue; - if (session.getClientData() == null) continue; - String version = session.getClientData().getGameVersion(); - if (!valueMap.containsKey(version)) { - valueMap.put(version, 1); - } else { - valueMap.put(version, valueMap.get(version) + 1); - } - } - return valueMap; - })); - - String minecraftVersion = bootstrap.getMinecraftServerVersion(); - if (minecraftVersion != null) { - Map> versionMap = new HashMap<>(); - Map platformMap = new HashMap<>(); - platformMap.put(platformType.getPlatformName(), 1); - versionMap.put(minecraftVersion, platformMap); - - metrics.addCustomChart(new Metrics.DrilldownPie("minecraftServerVersion", () -> { - // By the end, we should return, for example: - // 1.16.5 => (Spigot, 1) - return versionMap; - })); - } - - // The following code can be attributed to the PaperMC project - // https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0005-Paper-Metrics.patch#L614 - metrics.addCustomChart(new Metrics.DrilldownPie("javaVersion", () -> { - Map> map = new HashMap<>(); - String javaVersion = System.getProperty("java.version"); - Map entry = new HashMap<>(); - entry.put(javaVersion, 1); - - // http://openjdk.java.net/jeps/223 - // Java decided to change their versioning scheme and in doing so modified the - // java.version system property to return $major[.$minor][.$security][-ea], as opposed to - // 1.$major.0_$identifier we can handle pre-9 by checking if the "major" is equal to "1", - // otherwise, 9+ - String majorVersion = javaVersion.split("\\.")[0]; - String release; - - int indexOf = javaVersion.lastIndexOf('.'); - - if (majorVersion.equals("1")) { - release = "Java " + javaVersion.substring(0, indexOf); - } else { - // of course, it really wouldn't be all that simple if they didn't add a quirk, now - // would it valid strings for the major may potentially include values such as -ea to - // denote a pre release - Matcher versionMatcher = Pattern.compile("\\d+").matcher(majorVersion); - if (versionMatcher.find()) { - majorVersion = versionMatcher.group(0); - } - release = "Java " + majorVersion; - } - map.put(release, entry); - return map; - })); - } else { - metrics = null; - } - - boolean isGui = false; - // This will check if we are in standalone and get the 'useGui' variable from there - if (platformType == PlatformType.STANDALONE) { - try { - Class cls = Class.forName("org.geysermc.platform.standalone.GeyserStandaloneBootstrap"); - isGui = (boolean) cls.getMethod("isUseGui").invoke(cls.cast(bootstrap)); - } catch (Exception e) { - logger.debug("Failed detecting if standalone is using a GUI; if this is a GeyserConnect instance this can be safely ignored."); - } - } - - double completeTime = (System.currentTimeMillis() - startupTime) / 1000D; - String message = LanguageUtils.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " "; - if (isGui) { - message += LanguageUtils.getLocaleStringLog("geyser.core.finish.gui"); - } else { - message += LanguageUtils.getLocaleStringLog("geyser.core.finish.console"); - } - logger.info(message); - - if (platformType == PlatformType.STANDALONE) { - logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn")); - } - - newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); + public PlatformType getPlatformType() { + return GeyserImpl.getInstance().getPlatformType(); } public void shutdown() { - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); - shuttingDown = true; - - if (sessionManager.size() >= 1) { - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size())); - sessionManager.disconnectAll("geyser.core.shutdown.kick.message"); - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done")); - } - - scheduledThread.shutdown(); - bedrockServer.close(); - if (timeSyncer != null) { - timeSyncer.shutdown(); - } - if (skinUploader != null) { - skinUploader.close(); - } - newsHandler.shutdown(); - this.getCommandManager().getCommands().clear(); - - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done")); - } - - /** - * Gets a player by their current UUID - * - * @param uuid the uuid - * @return the player or null if there is no player online with this UUID - */ - @Contract("null -> null") - public GeyserSession getPlayerByUuid(UUID uuid) { - if (uuid == null) { - return null; - } - - return sessionManager.getSessions().get(uuid); - } - - /** - * Gets a player by their Xbox user identifier - * - * @param xuid the Xbox user identifier - * @return the player or null if there is no player online with this xuid - */ - @SuppressWarnings("unused") // API usage - public GeyserSession getPlayerByXuid(String xuid) { - for (GeyserSession session : sessionManager.getPendingSessions()) { - if (session.getAuthData().getXboxUUID().equals(xuid)) { - return session; - } - } - for (GeyserSession session : sessionManager.getSessions().values()) { - if (session.getAuthData().getXboxUUID().equals(xuid)) { - return session; - } - } - - return null; - } - - public static GeyserConnector start(PlatformType platformType, GeyserBootstrap bootstrap) { - return new GeyserConnector(platformType, bootstrap); + GeyserImpl.getInstance().shutdown(); } public void reload() { - shutdown(); - bootstrap.onEnable(); + GeyserImpl.getInstance().reload(); } - public GeyserLogger getLogger() { - return bootstrap.getGeyserLogger(); + public GeyserSession getPlayerByXuid(String xuid) { + return new GeyserSession(GeyserImpl.getInstance().getPlayerByXuid(xuid)); } - public GeyserConfiguration getConfig() { - return bootstrap.getGeyserConfig(); + public GeyserSession getPlayerByUuid(UUID uuid) { + return new GeyserSession(GeyserImpl.getInstance().getPlayerByUuid(uuid)); } - public CommandManager getCommandManager() { - return bootstrap.getGeyserCommandManager(); - } - - public WorldManager getWorldManager() { - return bootstrap.getWorldManager(); - } - - public TimeSyncer getTimeSyncer() { - return timeSyncer; - } - - /** - * Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files - * expected to be in a jarfile are not present. - * - * @return true if the version number is not 'DEV'. - */ public boolean isProductionEnvironment() { - //noinspection ConstantConditions - changes in production - return !"DEV".equals(GeyserConnector.VERSION); - } - - /** - * Deprecated. Get the AuthType from the GeyserConfiguration through {@link GeyserConnector#getConfig()} - * @return The - */ - @Deprecated - public AuthType getDefaultAuthType() { - return getConfig().getRemote().getAuthType(); - } - - public static GeyserConnector getInstance() { - return instance; + return GeyserImpl.getInstance().isProductionEnvironment(); } } diff --git a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 339509d6b..aca167482 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -25,1441 +25,137 @@ package org.geysermc.connector.network.session; -import com.github.steveice10.mc.auth.data.GameProfile; -import com.github.steveice10.mc.auth.exception.request.AuthPendingException; -import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException; -import com.github.steveice10.mc.auth.exception.request.RequestException; -import com.github.steveice10.mc.auth.service.AuthenticationService; -import com.github.steveice10.mc.auth.service.MojangAuthenticationService; -import com.github.steveice10.mc.auth.service.MsaAuthenticationService; -import com.github.steveice10.mc.protocol.MinecraftConstants; -import com.github.steveice10.mc.protocol.MinecraftProtocol; -import com.github.steveice10.mc.protocol.data.ProtocolState; -import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; -import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; -import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; -import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; -import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; -import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; -import com.github.steveice10.packetlib.BuiltinFlags; -import com.github.steveice10.packetlib.event.session.*; import com.github.steveice10.packetlib.packet.Packet; -import com.github.steveice10.packetlib.tcp.TcpClientSession; -import com.github.steveice10.packetlib.tcp.TcpSession; -import com.nukkitx.math.GenericMath; -import com.nukkitx.math.vector.*; import com.nukkitx.protocol.bedrock.BedrockPacket; -import com.nukkitx.protocol.bedrock.BedrockServerSession; -import com.nukkitx.protocol.bedrock.data.*; -import com.nukkitx.protocol.bedrock.data.command.CommandPermission; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import com.nukkitx.protocol.bedrock.packet.*; -import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; -import io.netty.channel.Channel; -import io.netty.channel.EventLoop; -import it.unimi.dsi.fastutil.ints.*; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectIterator; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; -import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.common.connection.LocalSession; -import org.geysermc.connector.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.entity.Tickable; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.entity.player.SkullPlayerEntity; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.session.auth.AuthData; -import org.geysermc.connector.network.session.auth.BedrockClientData; -import org.geysermc.connector.network.session.cache.*; -import org.geysermc.connector.network.translators.PacketTranslatorRegistry; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.translators.collision.CollisionManager; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.BlockMappings; -import org.geysermc.connector.registry.type.ItemMappings; -import org.geysermc.connector.skin.FloodgateSkinUploader; -import org.geysermc.connector.utils.*; -import org.geysermc.cumulus.Form; -import org.geysermc.cumulus.util.FormBuilder; -import org.geysermc.floodgate.crypto.FloodgateCipher; -import org.geysermc.floodgate.util.BedrockData; -import java.net.ConnectException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -@Getter -public class GeyserSession implements CommandSender { - - private final GeyserConnector connector; - private final UpstreamSession upstream; - /** - * The loop where all packets and ticking is processed to prevent concurrency issues. - * If this is manually called, ensure that any exceptions are properly handled. - */ - private final EventLoop eventLoop; - private TcpSession downstream; - @Setter - private AuthData authData; - @Setter - private BedrockClientData clientData; - - /* Setter for GeyserConnect */ - @Setter - private String remoteAddress; - @Setter - private int remotePort; - @Setter - private AuthType remoteAuthType; - /* Setter for GeyserConnect */ - - @Deprecated - @Setter - private boolean microsoftAccount; - - private final SessionPlayerEntity playerEntity; - - private final AdvancementsCache advancementsCache; - private final BookEditCache bookEditCache; - private final ChunkCache chunkCache; - private final EntityCache entityCache; - private final EntityEffectCache effectCache; - private final FormCache formCache; - private final LodestoneCache lodestoneCache; - private final PistonCache pistonCache; - private final PreferencesCache preferencesCache; - private final TagCache tagCache; - private final WorldCache worldCache; - - private final Int2ObjectMap teleportMap = new Int2ObjectOpenHashMap<>(); - - private final WorldBorder worldBorder; - /** - * Whether simulated fog has been sent to the client or not. - */ - private boolean isInWorldBorderWarningArea = false; - - private final PlayerInventory playerInventory; - @Setter - private Inventory openInventory; - @Setter - private boolean closingInventory; - - @Setter - private InventoryTranslator inventoryTranslator = InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR; - - /** - * Use {@link #getNextItemNetId()} instead for consistency - */ - @Getter(AccessLevel.NONE) - private final AtomicInteger itemNetId = new AtomicInteger(2); - - @Setter - private ScheduledFuture craftingGridFuture; - - /** - * Stores session collision - */ - private final CollisionManager collisionManager; - - /** - * Stores the block mappings for this specific version. - */ - @Setter - private BlockMappings blockMappings; - - /** - * Stores the item translations for this specific version. - */ - @Setter - private ItemMappings itemMappings; - - private final Map skullCache = new Object2ObjectOpenHashMap<>(); - private final Long2ObjectMap storedMaps = new Long2ObjectOpenHashMap<>(); - - /** - * Required to decode biomes correctly. - */ - @Setter - private int biomeGlobalPalette; - /** - * Stores the map between Java and Bedrock biome network IDs. - */ - private final Int2IntMap biomeTranslations = new Int2IntOpenHashMap(); - - /** - * A map of Vector3i positions to Java entities. - * Used for translating Bedrock block actions to Java entity actions. - */ - private final Map itemFrameCache = new Object2ObjectOpenHashMap<>(); - - /** - * Stores a list of all lectern locations and their block entity tags. - * See {@link org.geysermc.connector.network.translators.world.WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} - * for more information. - */ - private final Set lecternCache; - - @Setter - private boolean droppingLecternBook; - - @Setter - private Vector2i lastChunkPosition = null; - private int renderDistance; - - private boolean sentSpawnPacket; - - private boolean loggedIn; - private boolean loggingIn; - - @Setter - private boolean spawned; - /** - * Accessed on the initial Java and Bedrock packet processing threads - */ - private volatile boolean closed; - - @Setter - private GameMode gameMode = GameMode.SURVIVAL; - - /** - * Keeps track of the world name for respawning. - */ - @Setter - private String worldName = null; - - private boolean sneaking; - - /** - * Stores the Java pose that the server and/or Geyser believes the player currently has. - */ - @Setter - private Pose pose = Pose.STANDING; - - @Setter - private boolean sprinting; - - /** - * Whether the player is swimming in water. - * Used to update speed when crawling. - */ - @Setter - private boolean swimmingInWater; - - /** - * Tracks the original speed attribute. - * - * We need to do this in order to emulate speeds when sneaking under 1.5-blocks-tall areas if the player isn't sneaking, - * and when crawling. - */ - @Setter - private float originalSpeedAttribute; - - /** - * The dimension of the player. - * As all entities are in the same world, this can be safely applied to all other entities. - */ - @Setter - private String dimension = DimensionUtils.OVERWORLD; - - @Setter - private int breakingBlock; - - @Setter - private Vector3i lastBlockPlacePosition; - - @Setter - private String lastBlockPlacedId; - - @Setter - private boolean interacting; - - /** - * Stores the last position of the block the player interacted with. This can either be a block that the client - * placed or an existing block the player interacted with (for example, a chest).
- * Initialized as (0, 0, 0) so it is always not-null. - */ - @Setter - private Vector3i lastInteractionBlockPosition = Vector3i.ZERO; - - /** - * Stores the position of the player the last time they interacted. - * Used to verify that the player did not move since their last interaction.
- * Initialized as (0, 0, 0) so it is always not-null. - */ - @Setter - private Vector3f lastInteractionPlayerPosition = Vector3f.ZERO; - - @Setter - private Entity ridingVehicleEntity; - - /** - * The entity that the client is currently looking at. - */ - @Setter - private Entity mouseoverEntity; - - @Setter - private Int2ObjectMap craftingRecipes; - private final Set unlockedRecipes; - private final AtomicInteger lastRecipeNetId; - - /** - * Saves a list of all stonecutter recipes, for use in a stonecutter inventory. - * The key is the Java ID of the item; the values are all the possible outputs' Java IDs sorted by their string identifier - */ - @Setter - private Int2ObjectMap stonecutterRecipes; - - /** - * The current attack speed of the player. Used for sending proper cooldown timings. - * Setting a default fixes cooldowns not showing up on a fresh world. - */ - @Setter - private double attackSpeed = 4.0d; - /** - * The time of the last hit. Used to gauge how long the cooldown is taking. - * This is a session variable in order to prevent more scheduled threads than necessary. - */ - @Setter - private long lastHitTime; - - /** - * Saves if the client is steering left on a boat. - */ - @Setter - private boolean steeringLeft; - /** - * Saves if the client is steering right on a boat. - */ - @Setter - private boolean steeringRight; - - /** - * Store the last time the player interacted. Used to fix a right-click spam bug. - * See https://github.com/GeyserMC/Geyser/issues/503 for context. - */ - @Setter - private long lastInteractionTime; - - /** - * Stores a future interaction to place a bucket. Will be cancelled if the client instead intended to - * interact with a block. - */ - @Setter - private ScheduledFuture bucketScheduledFuture; - - /** - * Used to send a movement packet every three seconds if the player hasn't moved. Prevents timeouts when AFK in certain instances. - */ - @Setter - private long lastMovementTimestamp = System.currentTimeMillis(); - - /** - * Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms - */ - @Setter - private long lastVehicleMoveTimestamp = System.currentTimeMillis(); - - /** - * Controls whether the daylight cycle gamerule has been sent to the client, so the sun/moon remain motionless. - */ - private boolean daylightCycle = true; - - private boolean reducedDebugInfo = false; - - /** - * The op permission level set by the server - */ - @Setter - private int opPermissionLevel = 0; - - /** - * If the current player can fly - */ - @Setter - private boolean canFly = false; - - /** - * If the current player is flying - */ - private boolean flying = false; - - /** - * Caches current rain status. - */ - @Setter - private boolean raining = false; - - /** - * Caches current thunder status. - */ - @Setter - private boolean thunder = false; - - /** - * Stores the last text inputted into a sign. - *

- * Bedrock sends packets every time you update the sign, Java only wants the final packet. - * Until we determine that the user has finished editing, we save the sign's current status. - */ - @Setter - private String lastSignMessage; - - /** - * Stores a map of all statistics sent from the server. - * The server only sends new statistics back to us, so in order to show all statistics we need to cache existing ones. - */ - private final Map statistics = new HashMap<>(); - - /** - * Whether we're expecting statistics to be sent back to us. - */ - @Setter - private boolean waitingForStatistics = false; - - private final Set emotes; - - /** - * The thread that will run every 50 milliseconds - one Minecraft tick. - */ - private ScheduledFuture tickThread = null; - - private MinecraftProtocol protocol; - - public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { - this.connector = connector; - this.upstream = new UpstreamSession(bedrockServerSession); - this.eventLoop = eventLoop; - - this.advancementsCache = new AdvancementsCache(this); - this.bookEditCache = new BookEditCache(this); - this.chunkCache = new ChunkCache(this); - this.entityCache = new EntityCache(this); - this.effectCache = new EntityEffectCache(); - this.formCache = new FormCache(this); - this.lodestoneCache = new LodestoneCache(); - this.pistonCache = new PistonCache(this); - this.preferencesCache = new PreferencesCache(this); - this.tagCache = new TagCache(); - this.worldCache = new WorldCache(this); - - this.worldBorder = new WorldBorder(this); - - this.collisionManager = new CollisionManager(this); - - this.playerEntity = new SessionPlayerEntity(this); - collisionManager.updatePlayerBoundingBox(this.playerEntity.getPosition()); - - this.playerInventory = new PlayerInventory(); - this.openInventory = null; - this.craftingRecipes = new Int2ObjectOpenHashMap<>(); - this.unlockedRecipes = new ObjectOpenHashSet<>(); - this.lastRecipeNetId = new AtomicInteger(1); - - this.spawned = false; - this.loggedIn = false; - - if (connector.getWorldManager().shouldExpectLecternHandled()) { - // Unneeded on these platforms - this.lecternCache = null; - } else { - this.lecternCache = new ObjectOpenHashSet<>(); - } - - if (connector.getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.NO_EMOTES) { - this.emotes = new HashSet<>(); - connector.getSessionManager().getSessions().values().forEach(player -> this.emotes.addAll(player.getEmotes())); - } else { - this.emotes = null; - } - - bedrockServerSession.addDisconnectHandler(disconnectReason -> { - InetAddress address = bedrockServerSession.getRealAddress().getAddress(); - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.disconnect", address, disconnectReason)); - - disconnect(disconnectReason.name()); - connector.getSessionManager().removeSession(this); - }); - - this.remoteAddress = connector.getConfig().getRemote().getAddress(); - this.remotePort = connector.getConfig().getRemote().getPort(); - this.remoteAuthType = connector.getConfig().getRemote().getAuthType(); +/** + * Deprecated, legacy code. Serves as a wrapper around + * the class used now. + * + * @deprecated legacy code + */ +@Deprecated +public class GeyserSession { + private final org.geysermc.geyser.network.session.GeyserSession handle; + + public GeyserSession(org.geysermc.geyser.network.session.GeyserSession handle) { + this.handle = handle; + } + + public AuthData getAuthData() { + return new AuthData(this.handle.getAuthData()); + } + + public boolean isMicrosoftAccount() { + return this.handle.isMicrosoftAccount(); + } + + public boolean isClosed() { + return this.handle.isClosed(); + } + + public String getRemoteAddress() { + return this.handle.getRemoteAddress(); + } + + public int getRemotePort() { + return this.handle.getRemotePort(); + } + + public int getRenderDistance() { + return this.handle.getRenderDistance(); + } + + public boolean isSentSpawnPacket() { + return this.handle.isSentSpawnPacket(); + } + + public boolean isLoggedIn() { + return this.handle.isLoggedIn(); + } + + public boolean isLoggingIn() { + return this.handle.isLoggingIn(); + } + + public boolean isSpawned() { + return this.handle.isSpawned(); + } + + public boolean isInteracting() { + return this.handle.isInteracting(); + } + + public boolean isCanFly() { + return this.handle.isCanFly(); + } + + public boolean isFlying() { + return this.handle.isFlying(); } - /** - * Send all necessary packets to load Bedrock into the server - */ public void connect() { - startGame(); - sentSpawnPacket = true; - - // Set the hardcoded shield ID to the ID we just defined in StartGamePacket - upstream.getSession().getHardcodedBlockingId().set(this.itemMappings.getStoredItems().shield().getBedrockId()); - - if (this.itemMappings.getFurnaceMinecartData() != null) { - ItemComponentPacket componentPacket = new ItemComponentPacket(); - componentPacket.getItems().add(this.itemMappings.getFurnaceMinecartData()); - upstream.sendPacket(componentPacket); - } - - ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false); - - BiomeDefinitionListPacket biomeDefinitionListPacket = new BiomeDefinitionListPacket(); - biomeDefinitionListPacket.setDefinitions(Registries.BIOMES_NBT.get()); - upstream.sendPacket(biomeDefinitionListPacket); - - AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); - entityPacket.setIdentifiers(Registries.BEDROCK_ENTITY_IDENTIFIERS.get()); - upstream.sendPacket(entityPacket); - - CreativeContentPacket creativePacket = new CreativeContentPacket(); - creativePacket.setContents(this.itemMappings.getCreativeItems()); - upstream.sendPacket(creativePacket); - - PlayStatusPacket playStatusPacket = new PlayStatusPacket(); - playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN); - upstream.sendPacket(playStatusPacket); - - UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); - attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId()); - // Default move speed - // Bedrock clients move very fast by default until they get an attribute packet correcting the speed - attributesPacket.setAttributes(Collections.singletonList( - new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f))); - upstream.sendPacket(attributesPacket); - - GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket(); - // Only allow the server to send health information - // Setting this to false allows natural regeneration to work false but doesn't break it being true - gamerulePacket.getGameRules().add(new GameRuleData<>("naturalregeneration", false)); - // Don't let the client modify the inventory on death - // Setting this to true allows keep inventory to work if enabled but doesn't break functionality being false - gamerulePacket.getGameRules().add(new GameRuleData<>("keepinventory", true)); - // Ensure client doesn't try and do anything funky; the server handles this for us - gamerulePacket.getGameRules().add(new GameRuleData<>("spawnradius", 0)); - upstream.sendPacket(gamerulePacket); + this.handle.connect(); } public void login() { - if (this.remoteAuthType != AuthType.ONLINE) { - if (this.remoteAuthType == AuthType.OFFLINE) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.offline")); - } else { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.floodgate")); - } - authenticate(authData.getName()); - } + this.handle.login(); } public void authenticate(String username) { - authenticate(username, ""); + this.handle.authenticate(username); } public void authenticate(String username, String password) { - if (loggedIn) { - connector.getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.auth.already_loggedin", username)); - return; - } - - loggingIn = true; - - // Use a future to prevent timeouts as all the authentication is handled sync - // This will be changed with the new protocol library. - CompletableFuture.supplyAsync(() -> { - try { - if (password != null && !password.isEmpty()) { - AuthenticationService authenticationService; - if (microsoftAccount) { - authenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); - } else { - authenticationService = new MojangAuthenticationService(); - } - authenticationService.setUsername(username); - authenticationService.setPassword(password); - authenticationService.login(); - - GameProfile profile = authenticationService.getSelectedProfile(); - if (profile == null) { - // Java account is offline - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); - return null; - } - - protocol = new MinecraftProtocol(profile, authenticationService.getAccessToken()); - } else { - // always replace spaces when using Floodgate, - // as usernames with spaces cause issues with Bungeecord's login cycle. - // However, this doesn't affect the final username as Floodgate is still in charge of that. - // So if you have (for example) replace spaces enabled on Floodgate the spaces will re-appear. - String validUsername = username; - if (remoteAuthType == AuthType.FLOODGATE) { - validUsername = username.replace(' ', '_'); - } - - protocol = new MinecraftProtocol(validUsername); - } - } catch (InvalidCredentialsException | IllegalArgumentException e) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", username)); - disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); - } catch (RequestException ex) { - disconnect(ex.getMessage()); - } - return null; - }).whenComplete((aVoid, ex) -> { - if (ex != null) { - disconnect(ex.toString()); - } - if (this.closed) { - if (ex != null) { - connector.getLogger().error("", ex); - } - // Client disconnected during the authentication attempt - return; - } - - connectDownstream(); - }); + this.handle.authenticate(username, password); } - /** - * Present a form window to the user asking to log in with another web browser - */ public void authenticateWithMicrosoftCode() { - if (loggedIn) { - connector.getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().getName())); - return; - } - - loggingIn = true; - - // This just looks cool - SetTimePacket packet = new SetTimePacket(); - packet.setTime(16000); - sendUpstreamPacket(packet); - - // new thread so clients don't timeout - MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); - - // Use a future to prevent timeouts as all the authentication is handled sync - // This will be changed with the new protocol library. - CompletableFuture.supplyAsync(() -> { - try { - return msaAuthenticationService.getAuthCode(); - } catch (RequestException e) { - throw new CompletionException(e); - } - }).whenComplete((response, ex) -> { - if (ex != null) { - ex.printStackTrace(); - disconnect(ex.toString()); - return; - } - LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response); - attemptCodeAuthentication(msaAuthenticationService); - }); - } - - /** - * Poll every second to see if the user has successfully signed in - */ - private void attemptCodeAuthentication(MsaAuthenticationService msaAuthenticationService) { - if (loggedIn || closed) { - return; - } - CompletableFuture.supplyAsync(() -> { - try { - msaAuthenticationService.login(); - GameProfile profile = msaAuthenticationService.getSelectedProfile(); - if (profile == null) { - // Java account is offline - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); - return null; - } - - return new MinecraftProtocol(profile, msaAuthenticationService.getAccessToken()); - } catch (RequestException e) { - throw new CompletionException(e); - } - }).whenComplete((response, ex) -> { - if (ex != null) { - if (!(ex instanceof CompletionException completionException) || !(completionException.getCause() instanceof AuthPendingException)) { - connector.getLogger().error("Failed to log in with Microsoft code!", ex); - disconnect(ex.toString()); - } else { - // Wait one second before trying again - connector.getScheduledThread().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); - } - return; - } - if (!closed) { - this.protocol = response; - connectDownstream(); - } - }); - } - - /** - * After getting whatever credentials needed, we attempt to join the Java server. - */ - private void connectDownstream() { - boolean floodgate = this.remoteAuthType == AuthType.FLOODGATE; - - // Start ticking - tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); - - if (connector.getBootstrap().getSocketAddress() != null) { - // We're going to connect through the JVM and not through TCP - downstream = new LocalSession(this.remoteAddress, this.remotePort, - connector.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), this.protocol); - } else { - downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol); - disableSrvResolving(); - } - - if (connector.getConfig().getRemote().isUseProxyProtocol()) { - downstream.setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true); - downstream.setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress()); - } - if (connector.getConfig().isForwardPlayerPing()) { - // Let Geyser handle sending the keep alive - downstream.setFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, false); - } - downstream.addListener(new SessionAdapter() { - @Override - public void packetSending(PacketSendingEvent event) { - //todo move this somewhere else - if (event.getPacket() instanceof ClientIntentionPacket) { - String addressSuffix; - if (floodgate) { - byte[] encryptedData; - - try { - FloodgateSkinUploader skinUploader = connector.getSkinUploader(); - FloodgateCipher cipher = connector.getCipher(); - - encryptedData = cipher.encryptFromString(BedrockData.of( - clientData.getGameVersion(), - authData.getName(), - authData.getXboxUUID(), - clientData.getDeviceOs().ordinal(), - clientData.getLanguageCode(), - clientData.getUiProfile().ordinal(), - clientData.getCurrentInputMode().ordinal(), - upstream.getAddress().getAddress().getHostAddress(), - skinUploader.getId(), - skinUploader.getVerifyCode(), - connector.getTimeSyncer() - ).toString()); - - if (!connector.getTimeSyncer().hasUsefulOffset()) { - connector.getLogger().warning( - "We couldn't make sure that your system clock is accurate. " + - "This can cause issues with logging in." - ); - } - - } catch (Exception e) { - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); - disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.floodgate.encryption_fail", getClientData().getLanguageCode())); - return; - } - - addressSuffix = '\0' + new String(encryptedData, StandardCharsets.UTF_8); - } else { - addressSuffix = ""; - } - - ClientIntentionPacket intentionPacket = event.getPacket(); - - String address; - if (connector.getConfig().getRemote().isForwardHost()) { - address = clientData.getServerAddress().split(":")[0]; - } else { - address = intentionPacket.getHostname(); - } - - event.setPacket(intentionPacket.withHostname(address + addressSuffix)); - } - } - - @Override - public void connected(ConnectedEvent event) { - loggingIn = false; - loggedIn = true; - - if (downstream instanceof LocalSession) { - // Connected directly to the server - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect_internal", - authData.getName(), protocol.getProfile().getName())); - } else { - // Connected to an IP address - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", - authData.getName(), protocol.getProfile().getName(), remoteAddress)); - } - - UUID uuid = protocol.getProfile().getId(); - if (uuid == null) { - // Set what our UUID *probably* is going to be - if (remoteAuthType == AuthType.FLOODGATE) { - uuid = new UUID(0, Long.parseLong(authData.getXboxUUID())); - } else { - uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + protocol.getProfile().getName()).getBytes(StandardCharsets.UTF_8)); - } - } - playerEntity.setUuid(uuid); - playerEntity.setUsername(protocol.getProfile().getName()); - - String locale = clientData.getLanguageCode(); - - // Let the user know there locale may take some time to download - // as it has to be extracted from a JAR - if (locale.equalsIgnoreCase("en_us") && !LocaleUtils.LOCALE_MAPPINGS.containsKey("en_us")) { - // This should probably be left hardcoded as it will only show for en_us clients - sendMessage("Loading your locale (en_us); if this isn't already downloaded, this may take some time"); - } - - // Download and load the language for the player - LocaleUtils.downloadAndLoadLocale(locale); - } - - @Override - public void disconnected(DisconnectedEvent event) { - loggingIn = false; - loggedIn = false; - - String disconnectMessage; - Throwable cause = event.getCause(); - if (cause instanceof UnexpectedEncryptionException) { - if (remoteAuthType != AuthType.FLOODGATE) { - // Server expects online mode - disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", getLocale()); - // Explain that they may be looking for Floodgate. - connector.getLogger().warning(LanguageUtils.getLocaleStringLog( - connector.getPlatformType() == PlatformType.STANDALONE ? - "geyser.network.remote.floodgate_explanation_standalone" - : "geyser.network.remote.floodgate_explanation_plugin", - Constants.FLOODGATE_DOWNLOAD_LOCATION - )); - } else { - // Likely that Floodgate is not configured correctly. - disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", getLocale()); - if (connector.getPlatformType() == PlatformType.STANDALONE) { - connector.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone")); - } - } - } else if (cause instanceof ConnectException) { - // Server is offline, probably - disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale()); - } else { - disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason()); - } - - if (downstream instanceof LocalSession) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); - } else { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); - } - if (cause != null) { - cause.printStackTrace(); - } - - upstream.disconnect(disconnectMessage); - } - - @Override - public void packetReceived(PacketReceivedEvent event) { - Packet packet = event.getPacket(); - PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(packet.getClass(), packet, GeyserSession.this); - } - - @Override - public void packetError(PacketErrorEvent event) { - connector.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.downstream_error", event.getCause().getMessage())); - if (connector.getConfig().isDebugMode()) - event.getCause().printStackTrace(); - event.setSuppress(true); - } - }); - - if (!daylightCycle) { - setDaylightCycle(true); - } - - downstream.connect(); + this.handle.authenticateWithMicrosoftCode(); } public void disconnect(String reason) { - if (!closed) { - loggedIn = false; - if (downstream != null) { - downstream.disconnect(reason); - } - if (upstream != null && !upstream.isClosed()) { - connector.getSessionManager().removeSession(this); - upstream.disconnect(reason); - } - } - - if (tickThread != null) { - tickThread.cancel(false); - } - - closed = true; + this.handle.disconnect(reason); } public void close() { - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.close", getClientData().getLanguageCode())); + this.handle.close(); } - /** - * Executes a task and prints a stack trace if an error occurs. - */ public void executeInEventLoop(Runnable runnable) { - eventLoop.execute(() -> { - try { - runnable.run(); - } catch (Throwable e) { - connector.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); - } - }); + this.handle.executeInEventLoop(runnable); } - /** - * Schedules a task and prints a stack trace if an error occurs. - */ - public ScheduledFuture scheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit) { - return eventLoop.schedule(() -> { - try { - runnable.run(); - } catch (Throwable e) { - connector.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); - } - }, duration, timeUnit); - } - - /** - * Called every 50 milliseconds - one Minecraft tick. - */ - protected void tick() { - try { - pistonCache.tick(); - // Check to see if the player's position needs updating - a position update should be sent once every 3 seconds - if (spawned && (System.currentTimeMillis() - lastMovementTimestamp) > 3000) { - // Recalculate in case something else changed position - Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround(), false); - // A null return value cancels the packet - if (position != null) { - ServerboundMovePlayerPosPacket packet = new ServerboundMovePlayerPosPacket(playerEntity.isOnGround(), - position.getX(), position.getY(), position.getZ()); - sendDownstreamPacket(packet); - } - lastMovementTimestamp = System.currentTimeMillis(); - } - - if (worldBorder.isResizing()) { - worldBorder.resize(); - } - - if (!worldBorder.isWithinWarningBoundaries()) { - // Show particles representing where the world border is - worldBorder.drawWall(); - // Set the mood - if (!isInWorldBorderWarningArea) { - isInWorldBorderWarningArea = true; - WorldBorder.sendFog(this, "minecraft:fog_crimson_forest"); - } - } else if (isInWorldBorderWarningArea) { - // Clear fog as we are outside the world border now - WorldBorder.removeFog(this); - isInWorldBorderWarningArea = false; - } - - - for (Tickable entity : entityCache.getTickableEntities()) { - entity.tick(); - } - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - } - - public void setAuthenticationData(AuthData authData) { - this.authData = authData; - } - - public void setSneaking(boolean sneaking) { - this.sneaking = sneaking; - - // Update pose and bounding box on our end - AttributeData speedAttribute; - if (!sneaking && (speedAttribute = adjustSpeed()) != null) { - // Update attributes since we're still "sneaking" under a 1.5-block-tall area - UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); - attributesPacket.setRuntimeEntityId(playerEntity.getGeyserId()); - attributesPacket.setAttributes(Collections.singletonList(speedAttribute)); - sendUpstreamPacket(attributesPacket); - // the server *should* update our pose once it has returned to normal - } else { - if (!flying) { - // The pose and bounding box should not be updated if the player is flying - setSneakingPose(sneaking); - } - collisionManager.updateScaffoldingFlags(false); - } - - playerEntity.updateBedrockMetadata(); - - if (mouseoverEntity != null) { - // Horses, etc can change their property depending on if you're sneaking - InteractiveTagManager.updateTag(this, mouseoverEntity); - } - } - - private void setSneakingPose(boolean sneaking) { - this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING; - playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, sneaking ? 1.5f : playerEntity.getDefinition().height()); - playerEntity.setFlag(EntityFlag.SNEAKING, sneaking); - - collisionManager.updatePlayerBoundingBox(); - } - - public void setSwimming(boolean swimming) { - this.pose = swimming ? Pose.SWIMMING : Pose.STANDING; - playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, swimming ? 0.6f : playerEntity.getDefinition().height()); - playerEntity.setFlag(EntityFlag.SWIMMING, swimming); - playerEntity.updateBedrockMetadata(); - } - - public void setFlying(boolean flying) { - this.flying = flying; - - if (sneaking) { - // update bounding box as it is not reduced when flying - setSneakingPose(!flying); - playerEntity.updateBedrockMetadata(); - } - } - - /** - * Adjusts speed if the player is crawling. - * - * @return not null if attributes should be updated. - */ - public AttributeData adjustSpeed() { - AttributeData currentPlayerSpeed = playerEntity.getAttributes().get(GeyserAttributeType.MOVEMENT_SPEED); - if (currentPlayerSpeed != null) { - if ((pose.equals(Pose.SNEAKING) && !sneaking && collisionManager.isUnderSlab()) || - (!swimmingInWater && playerEntity.getFlag(EntityFlag.SWIMMING) && !collisionManager.isPlayerInWater())) { - // Either of those conditions means that Bedrock goes zoom when they shouldn't be - AttributeData speedAttribute = GeyserAttributeType.MOVEMENT_SPEED.getAttribute(originalSpeedAttribute / 3.32f); - playerEntity.getAttributes().put(GeyserAttributeType.MOVEMENT_SPEED, speedAttribute); - return speedAttribute; - } else if (originalSpeedAttribute != currentPlayerSpeed.getValue()) { - // Speed has reset to normal - AttributeData speedAttribute = GeyserAttributeType.MOVEMENT_SPEED.getAttribute(originalSpeedAttribute); - playerEntity.getAttributes().put(GeyserAttributeType.MOVEMENT_SPEED, speedAttribute); - return speedAttribute; - } - } - return null; - } - - /** - * Will be overwritten for GeyserConnect. - */ - protected void disableSrvResolving() { - this.downstream.setFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, false); - } - - @Override public String getName() { - return authData.getName(); + return this.handle.getName(); } - @Override - public void sendMessage(String message) { - TextPacket textPacket = new TextPacket(); - textPacket.setPlatformChatId(""); - textPacket.setSourceName(""); - textPacket.setXuid(""); - textPacket.setType(TextPacket.Type.CHAT); - textPacket.setNeedsTranslation(false); - textPacket.setMessage(message); - - upstream.sendPacket(textPacket); - } - - @Override public boolean isConsole() { - return false; + return this.handle.isConsole(); } - @Override public String getLocale() { - return clientData.getLanguageCode(); - } - - public void setRenderDistance(int renderDistance) { - renderDistance = GenericMath.ceil(++renderDistance * MathUtils.SQRT_OF_TWO); //square to circle - this.renderDistance = renderDistance; - - ChunkRadiusUpdatedPacket chunkRadiusUpdatedPacket = new ChunkRadiusUpdatedPacket(); - chunkRadiusUpdatedPacket.setRadius(renderDistance); - upstream.sendPacket(chunkRadiusUpdatedPacket); + return this.handle.getLocale(); } - public InetSocketAddress getSocketAddress() { - return this.upstream.getAddress(); - } - - public void sendForm(Form form) { - formCache.showForm(form); - } - - public void sendForm(FormBuilder formBuilder) { - formCache.showForm(formBuilder.build()); - } - - private void startGame() { - StartGamePacket startGamePacket = new StartGamePacket(); - startGamePacket.setUniqueEntityId(playerEntity.getGeyserId()); - startGamePacket.setRuntimeEntityId(playerEntity.getGeyserId()); - startGamePacket.setPlayerGameType(switch (gameMode) { - case CREATIVE -> GameType.CREATIVE; - case ADVENTURE -> GameType.ADVENTURE; - default -> GameType.SURVIVAL; - }); - startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0)); - startGamePacket.setRotation(Vector2f.from(1, 1)); - - startGamePacket.setSeed(-1); - startGamePacket.setDimensionId(DimensionUtils.javaToBedrock(dimension)); - startGamePacket.setGeneratorId(1); - startGamePacket.setLevelGameType(GameType.SURVIVAL); - startGamePacket.setDifficulty(1); - startGamePacket.setDefaultSpawn(Vector3i.ZERO); - startGamePacket.setAchievementsDisabled(!connector.getConfig().isXboxAchievementsEnabled()); - startGamePacket.setCurrentTick(-1); - startGamePacket.setEduEditionOffers(0); - startGamePacket.setEduFeaturesEnabled(false); - startGamePacket.setRainLevel(0); - startGamePacket.setLightningLevel(0); - startGamePacket.setMultiplayerGame(true); - startGamePacket.setBroadcastingToLan(true); - startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC); - startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC); - startGamePacket.setCommandsEnabled(!connector.getConfig().isXboxAchievementsEnabled()); - startGamePacket.setTexturePacksRequired(false); - startGamePacket.setBonusChestEnabled(false); - startGamePacket.setStartingWithMap(false); - startGamePacket.setTrustingPlayers(true); - startGamePacket.setDefaultPlayerPermission(PlayerPermission.MEMBER); - startGamePacket.setServerChunkTickRange(4); - startGamePacket.setBehaviorPackLocked(false); - startGamePacket.setResourcePackLocked(false); - startGamePacket.setFromLockedWorldTemplate(false); - startGamePacket.setUsingMsaGamertagsOnly(false); - startGamePacket.setFromWorldTemplate(false); - startGamePacket.setWorldTemplateOptionLocked(false); - - String serverName = connector.getConfig().getBedrock().getServerName(); - startGamePacket.setLevelId(serverName); - startGamePacket.setLevelName(serverName); - - startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000"); - // startGamePacket.setCurrentTick(0); - startGamePacket.setEnchantmentSeed(0); - startGamePacket.setMultiplayerCorrelationId(""); - startGamePacket.setItemEntries(this.itemMappings.getItemEntries()); - startGamePacket.setVanillaVersion("*"); - startGamePacket.setInventoriesServerAuthoritative(true); - startGamePacket.setServerEngine(""); // Do we want to fill this in? - - SyncedPlayerMovementSettings settings = new SyncedPlayerMovementSettings(); - settings.setMovementMode(AuthoritativeMovementMode.CLIENT); - settings.setRewindHistorySize(0); - settings.setServerAuthoritativeBlockBreaking(false); - startGamePacket.setPlayerMovementSettings(settings); - - if (upstream.getProtocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { - startGamePacket.getExperiments().add(new ExperimentData("caves_and_cliffs", true)); - } - - upstream.sendPacket(startGamePacket); - } - - /** - * @return the next Bedrock item network ID to use for a new item - */ - public int getNextItemNetId() { - return itemNetId.getAndIncrement(); - } - - public void addTeleport(TeleportCache teleportCache) { - teleportMap.put(teleportCache.getTeleportConfirmId(), teleportCache); - - ObjectIterator> it = teleportMap.int2ObjectEntrySet().iterator(); - - // Remove any teleports with a higher number - maybe this is a world change that reset the ID to 0? - while (it.hasNext()) { - Int2ObjectMap.Entry entry = it.next(); - int nextID = entry.getValue().getTeleportConfirmId(); - if (nextID > teleportCache.getTeleportConfirmId()) { - it.remove(); - } - } - } - - public void confirmTeleport(Vector3d position) { - if (teleportMap.size() == 0) { - return; - } - int teleportID = -1; - - for (Int2ObjectMap.Entry entry : teleportMap.int2ObjectEntrySet()) { - if (entry.getValue().canConfirm(position)) { - if (entry.getValue().getTeleportConfirmId() > teleportID) { - teleportID = entry.getValue().getTeleportConfirmId(); - } - } - } - - if (teleportID != -1) { - ObjectIterator> it = teleportMap.int2ObjectEntrySet().iterator(); - - // Confirm the current teleport and any earlier ones - while (it.hasNext()) { - TeleportCache entry = it.next().getValue(); - int nextID = entry.getTeleportConfirmId(); - if (nextID <= teleportID) { - ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(nextID); - sendDownstreamPacket(teleportConfirmPacket); - // Servers (especially ones like Hypixel) expect exact coordinates given back to them. - ServerboundMovePlayerPosRotPacket positionPacket = new ServerboundMovePlayerPosRotPacket(playerEntity.isOnGround(), - entry.getX(), entry.getY(), entry.getZ(), entry.getYaw(), entry.getPitch()); - sendDownstreamPacket(positionPacket); - it.remove(); - connector.getLogger().debug("Confirmed teleport " + nextID); - } - } - } - - if (teleportMap.size() > 0) { - int resendID = -1; - for (Int2ObjectMap.Entry entry : teleportMap.int2ObjectEntrySet()) { - TeleportCache teleport = entry.getValue(); - teleport.incrementUnconfirmedFor(); - if (teleport.shouldResend()) { - if (teleport.getTeleportConfirmId() >= resendID) { - resendID = teleport.getTeleportConfirmId(); - } - } - } - - if (resendID != -1) { - connector.getLogger().debug("Resending teleport " + resendID); - TeleportCache teleport = teleportMap.get(resendID); - getPlayerEntity().moveAbsolute(Vector3f.from(teleport.getX(), teleport.getY(), teleport.getZ()), - teleport.getYaw(), teleport.getPitch(), playerEntity.isOnGround(), true); - } - } - } - - /** - * Queue a packet to be sent to player. - * - * @param packet the bedrock packet from the NukkitX protocol lib - */ public void sendUpstreamPacket(BedrockPacket packet) { - upstream.sendPacket(packet); + this.handle.sendUpstreamPacket(packet); } - /** - * Send a packet immediately to the player. - * - * @param packet the bedrock packet from the NukkitX protocol lib - */ public void sendUpstreamPacketImmediately(BedrockPacket packet) { - upstream.sendPacketImmediately(packet); + this.handle.sendUpstreamPacketImmediately(packet); } - /** - * Send a packet to the remote server. - * - * @param packet the java edition packet from MCProtocolLib - */ public void sendDownstreamPacket(Packet packet) { - if (!closed && this.downstream != null) { - Channel channel = this.downstream.getChannel(); - if (channel == null) { - // Channel is only null before the connection has initialized - connector.getLogger().warning("Tried to send a packet to the Java server too early!"); - if (connector.getConfig().isDebugMode()) { - Thread.dumpStack(); - } - return; - } - - EventLoop eventLoop = channel.eventLoop(); - if (eventLoop.inEventLoop()) { - sendDownstreamPacket0(packet); - } else { - eventLoop.execute(() -> sendDownstreamPacket0(packet)); - } - } + this.handle.sendDownstreamPacket(packet); } - private void sendDownstreamPacket0(Packet packet) { - if (protocol.getState().equals(ProtocolState.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { - downstream.send(packet); - } else { - connector.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); - } - } - - /** - * Update the cached value for the reduced debug info gamerule. - * If enabled, also hides the player's coordinates. - * - * @param value The new value for reducedDebugInfo - */ - public void setReducedDebugInfo(boolean value) { - reducedDebugInfo = value; - // Set the showCoordinates data. This is done because updateShowCoordinates() uses this gamerule as a variable. - preferencesCache.updateShowCoordinates(); - } - - /** - * Changes the daylight cycle gamerule on the client - * This is used in the login screen along-side normal usage - * - * @param doCycle If the cycle should continue - */ - public void setDaylightCycle(boolean doCycle) { - sendGameRule("dodaylightcycle", doCycle); - // Save the value so we don't have to constantly send a daylight cycle gamerule update - this.daylightCycle = doCycle; - } - - /** - * Send a gamerule value to the client - * - * @param gameRule The gamerule to send - * @param value The value of the gamerule - */ - public void sendGameRule(String gameRule, Object value) { - GameRulesChangedPacket gameRulesChangedPacket = new GameRulesChangedPacket(); - gameRulesChangedPacket.getGameRules().add(new GameRuleData<>(gameRule, value)); - upstream.sendPacket(gameRulesChangedPacket); - } - - /** - * Checks if the given session's player has a permission - * - * @param permission The permission node to check - * @return true if the player has the requested permission, false if not - */ - @Override public boolean hasPermission(String permission) { - return connector.getWorldManager().hasPermission(this, permission); + return this.handle.hasPermission(permission); } - /** - * Send an AdventureSettingsPacket to the client with the latest flags - */ public void sendAdventureSettings() { - AdventureSettingsPacket adventureSettingsPacket = new AdventureSettingsPacket(); - adventureSettingsPacket.setUniqueEntityId(playerEntity.getGeyserId()); - // Set command permission if OP permission level is high enough - // This allows mobile players access to a GUI for doing commands. The commands there do not change above OPERATOR - // and all commands there are accessible with OP permission level 2 - adventureSettingsPacket.setCommandPermission(opPermissionLevel >= 2 ? CommandPermission.OPERATOR : CommandPermission.NORMAL); - // Required to make command blocks destroyable - adventureSettingsPacket.setPlayerPermission(opPermissionLevel >= 2 ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER); - - // Update the noClip and worldImmutable values based on the current gamemode - boolean spectator = gameMode == GameMode.SPECTATOR; - boolean worldImmutable = gameMode == GameMode.ADVENTURE || spectator; - - Set flags = adventureSettingsPacket.getSettings(); - if (canFly || spectator) { - flags.add(AdventureSetting.MAY_FLY); - } - - if (flying || spectator) { - if (spectator && !flying) { - // We're "flying locked" in this gamemode - flying = true; - ServerboundPlayerAbilitiesPacket abilitiesPacket = new ServerboundPlayerAbilitiesPacket(true); - sendDownstreamPacket(abilitiesPacket); - } - flags.add(AdventureSetting.FLYING); - } - - if (worldImmutable) { - flags.add(AdventureSetting.WORLD_IMMUTABLE); - } - - if (spectator) { - flags.add(AdventureSetting.NO_CLIP); - } - - flags.add(AdventureSetting.AUTO_JUMP); - - sendUpstreamPacket(adventureSettingsPacket); - } - - /** - * Used for updating statistic values since we only get changes from the server - * - * @param statistics Updated statistics values - */ - public void updateStatistics(@NonNull Map statistics) { - this.statistics.putAll(statistics); - } - - public void refreshEmotes(List emotes) { - this.emotes.addAll(emotes); - for (GeyserSession player : connector.getSessionManager().getSessions().values()) { - List pieces = new ArrayList<>(); - for (UUID piece : emotes) { - if (!player.getEmotes().contains(piece)) { - pieces.add(piece); - } - player.getEmotes().add(piece); - } - EmoteListPacket emoteList = new EmoteListPacket(); - emoteList.setRuntimeEntityId(player.getPlayerEntity().getGeyserId()); - emoteList.getPieceIds().addAll(pieces); - player.sendUpstreamPacket(emoteList); - } + this.handle.sendAdventureSettings(); } } diff --git a/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java index 463276891..d1871d4c3 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java +++ b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java @@ -25,26 +25,30 @@ package org.geysermc.connector.network.session.auth; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import org.geysermc.connector.GeyserConnector; - import java.util.UUID; -@RequiredArgsConstructor +/** + * Deprecated, legacy code. Serves as a wrapper around + * the class used now. + * + * @deprecated legacy code + */ public class AuthData { - @Getter private final String name; - @Getter private final UUID UUID; - @Getter private final String xboxUUID; + private final org.geysermc.geyser.network.session.auth.AuthData handle; - private final JsonNode certChainData; - private final String clientData; + public AuthData(org.geysermc.geyser.network.session.auth.AuthData handle) { + this.handle = handle; + } - public void upload(GeyserConnector connector) { - // we can't upload the skin in LoginEncryptionUtil since the global server would return - // the skin too fast, that's why we upload it after we know for sure that the target server - // is ready to handle the result of the global server - connector.getSkinUploader().uploadSkin(certChainData, clientData); + public String getName() { + return this.handle.getName(); + } + + public UUID getUUID() { + return this.handle.getUuid(); + } + + public String getXboxUUID() { + return this.handle.getXuid(); } } diff --git a/core/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java rename to core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java index 74335dc7d..de0797fc1 100644 --- a/core/src/main/java/org/geysermc/connector/FloodgateKeyLoader.java +++ b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java @@ -23,11 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector; +package org.geysermc.geyser; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.configuration.GeyserJacksonConfiguration; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.utils.LanguageUtils; import java.nio.file.Files; import java.nio.file.Path; diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java new file mode 100644 index 000000000..3efa35f1f --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -0,0 +1,502 @@ +/* + * Copyright (c) 2019-2021 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; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.steveice10.packetlib.tcp.TcpSession; +import com.nukkitx.network.raknet.RakNetConstants; +import com.nukkitx.network.util.EventLoops; +import com.nukkitx.protocol.bedrock.BedrockServer; +import io.netty.channel.epoll.Epoll; +import io.netty.channel.kqueue.KQueue; +import io.netty.util.NettyRuntime; +import io.netty.util.concurrent.DefaultThreadFactory; +import io.netty.util.internal.SystemPropertyUtil; +import lombok.Getter; +import lombok.Setter; +import org.geysermc.common.PlatformType; +import org.geysermc.geyser.api.Geyser; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.metrics.Metrics; +import org.geysermc.geyser.network.ConnectorServerEventHandler; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslatorRegistry; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater; +import org.geysermc.geyser.skin.FloodgateSkinUploader; +import org.geysermc.geyser.utils.*; +import org.geysermc.floodgate.crypto.AesCipher; +import org.geysermc.floodgate.crypto.AesKeyProducer; +import org.geysermc.floodgate.crypto.Base64Topping; +import org.geysermc.floodgate.crypto.FloodgateCipher; +import org.geysermc.floodgate.news.NewsItemAction; +import org.geysermc.floodgate.time.TimeSyncer; +import org.jetbrains.annotations.Contract; + +import javax.naming.directory.Attribute; +import javax.naming.directory.InitialDirContext; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.UnknownHostException; +import java.security.Key; +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.UUID; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Getter +public class GeyserImpl extends Geyser { + public static final ObjectMapper JSON_MAPPER = new ObjectMapper() + .enable(JsonParser.Feature.IGNORE_UNDEFINED) + .enable(JsonParser.Feature.ALLOW_COMMENTS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES) + .enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES); + + public static final String NAME = "Geyser"; + public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs + public static final String VERSION = "DEV"; // A fallback for running in IDEs + + /** + * Oauth client ID for Microsoft authentication + */ + public static final String OAUTH_CLIENT_ID = "204cefd1-4818-4de1-b98d-513fae875d88"; + + private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"; + + private final SessionManager sessionManager = new SessionManager(); + + /** + * This is used in GeyserConnect to stop the bedrock server binding to a port + */ + @Setter + private static boolean shouldStartListener = true; + + private final TimeSyncer timeSyncer; + private FloodgateCipher cipher; + private FloodgateSkinUploader skinUploader; + private final NewsHandler newsHandler; + + private volatile boolean shuttingDown = false; + + private final ScheduledExecutorService scheduledThread; + + private final BedrockServer bedrockServer; + private final PlatformType platformType; + private final GeyserBootstrap bootstrap; + + private final Metrics metrics; + + private GeyserImpl(PlatformType platformType, GeyserBootstrap bootstrap) { + long startupTime = System.currentTimeMillis(); + + Geyser.setInstance(this); + + this.bootstrap = bootstrap; + + GeyserLogger logger = bootstrap.getGeyserLogger(); + GeyserConfiguration config = bootstrap.getGeyserConfig(); + + this.platformType = platformType; + + logger.info("******************************************"); + logger.info(""); + logger.info(LanguageUtils.getLocaleStringLog("geyser.core.load", NAME, VERSION)); + logger.info(""); + logger.info("******************************************"); + + this.scheduledThread = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("Geyser Scheduled Thread")); + + logger.setDebug(config.isDebugMode()); + + PacketTranslatorRegistry.init(); + + /* Initialize translators and registries */ + BlockRegistries.init(); + Registries.init(); + + EntityDefinitions.init(); + ItemTranslator.init(); + MessageTranslator.init(); + LocaleUtils.init(); + ScoreboardUpdater.init(); + + ResourcePack.loadPacks(); + + if (platformType != PlatformType.STANDALONE && config.getRemote().getAddress().equals("auto")) { + // Set the remote address to localhost since that is where we are always connecting + try { + config.getRemote().setAddress(InetAddress.getLocalHost().getHostAddress()); + } catch (UnknownHostException ex) { + logger.debug("Unknown host when trying to find localhost."); + if (config.isDebugMode()) { + ex.printStackTrace(); + } + config.getRemote().setAddress(InetAddress.getLoopbackAddress().getHostAddress()); + } + } + String remoteAddress = config.getRemote().getAddress(); + // Filters whether it is not an IP address or localhost, because otherwise it is not possible to find out an SRV entry. + if (!remoteAddress.matches(IP_REGEX) && !remoteAddress.equalsIgnoreCase("localhost")) { + int remotePort; + try { + // Searches for a server address and a port from a SRV record of the specified host name + InitialDirContext ctx = new InitialDirContext(); + Attribute attr = ctx.getAttributes("dns:///_minecraft._tcp." + remoteAddress, new String[]{"SRV"}).get("SRV"); + // size > 0 = SRV entry found + if (attr != null && attr.size() > 0) { + String[] record = ((String) attr.get(0)).split(" "); + // Overwrites the existing address and port with that from the SRV record. + config.getRemote().setAddress(remoteAddress = record[3]); + config.getRemote().setPort(remotePort = Integer.parseInt(record[2])); + logger.debug("Found SRV record \"" + remoteAddress + ":" + remotePort + "\""); + } + } catch (Exception | NoClassDefFoundError ex) { // Check for a NoClassDefFoundError to prevent Android crashes + logger.debug("Exception while trying to find an SRV record for the remote host."); + if (config.isDebugMode()) + ex.printStackTrace(); // Otherwise we can get a stack trace for any domain that doesn't have an SRV record + } + } + + // Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves + TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false; + + TimeSyncer timeSyncer = null; + if (config.getRemote().getAuthType() == AuthType.FLOODGATE) { + timeSyncer = new TimeSyncer(Constants.NTP_SERVER); + try { + Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath()); + cipher = new AesCipher(new Base64Topping()); + cipher.init(key); + logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); + skinUploader = new FloodgateSkinUploader(this).start(); + } catch (Exception exception) { + logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception); + } + } + this.timeSyncer = timeSyncer; + + String branch = "unknown"; + int buildNumber = -1; + if (this.isProductionEnvironment()) { + try { + Properties gitProperties = new Properties(); + gitProperties.load(FileUtils.getResource("git.properties")); + branch = gitProperties.getProperty("git.branch"); + String build = gitProperties.getProperty("git.build.number"); + if (build != null) { + buildNumber = Integer.parseInt(build); + } + } catch (Throwable e) { + logger.error("Failed to read git.properties", e); + } + } else { + logger.debug("Not getting git properties for the news handler as we are in a development environment."); + } + newsHandler = new NewsHandler(branch, buildNumber); + + CooldownUtils.setDefaultShowCooldown(config.getShowCooldown()); + DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether + + // https://github.com/GeyserMC/Geyser/issues/957 + RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu(); + logger.debug("Setting MTU to " + config.getMtu()); + + Integer bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads"); + if (bedrockThreadCount == null) { + // Copy the code from Netty's default thread count fallback + bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2)); + } + + boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol(); + bedrockServer = new BedrockServer( + new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()), + bedrockThreadCount, + EventLoops.commonGroup(), + enableProxyProtocol + ); + + if (config.isDebugMode()) { + logger.debug("EventLoop type: " + EventLoops.getChannelType()); + if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) { + if (System.getProperties().contains("disableNativeEventLoop")) { + logger.debug("EventLoop type is NIO because native event loops are disabled."); + } else { + logger.debug("Reason for no Epoll: " + Epoll.unavailabilityCause().toString()); + logger.debug("Reason for no KQueue: " + KQueue.unavailabilityCause().toString()); + } + } + } + + bedrockServer.setHandler(new ConnectorServerEventHandler(this)); + + if (shouldStartListener) { + bedrockServer.bind().whenComplete((avoid, throwable) -> { + if (throwable == null) { + logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); + } else { + logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); + throwable.printStackTrace(); + } + }).join(); + } + + if (config.getMetrics().isEnabled()) { + metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger("")); + metrics.addCustomChart(new Metrics.SingleLineChart("players", sessionManager::size)); + // Prevent unwanted words best we can + metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase())); + metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName)); + metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", LanguageUtils::getDefaultLocale)); + metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION)); + metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> { + Map valueMap = new HashMap<>(); + for (GeyserSession session : sessionManager.getAllSessions()) { + if (session == null) continue; + if (session.getClientData() == null) continue; + String os = session.getClientData().getDeviceOs().toString(); + if (!valueMap.containsKey(os)) { + valueMap.put(os, 1); + } else { + valueMap.put(os, valueMap.get(os) + 1); + } + } + return valueMap; + })); + metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> { + Map valueMap = new HashMap<>(); + for (GeyserSession session : sessionManager.getAllSessions()) { + if (session == null) continue; + if (session.getClientData() == null) continue; + String version = session.getClientData().getGameVersion(); + if (!valueMap.containsKey(version)) { + valueMap.put(version, 1); + } else { + valueMap.put(version, valueMap.get(version) + 1); + } + } + return valueMap; + })); + + String minecraftVersion = bootstrap.getMinecraftServerVersion(); + if (minecraftVersion != null) { + Map> versionMap = new HashMap<>(); + Map platformMap = new HashMap<>(); + platformMap.put(platformType.getPlatformName(), 1); + versionMap.put(minecraftVersion, platformMap); + + metrics.addCustomChart(new Metrics.DrilldownPie("minecraftServerVersion", () -> { + // By the end, we should return, for example: + // 1.16.5 => (Spigot, 1) + return versionMap; + })); + } + + // The following code can be attributed to the PaperMC project + // https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0005-Paper-Metrics.patch#L614 + metrics.addCustomChart(new Metrics.DrilldownPie("javaVersion", () -> { + Map> map = new HashMap<>(); + String javaVersion = System.getProperty("java.version"); + Map entry = new HashMap<>(); + entry.put(javaVersion, 1); + + // http://openjdk.java.net/jeps/223 + // Java decided to change their versioning scheme and in doing so modified the + // java.version system property to return $major[.$minor][.$security][-ea], as opposed to + // 1.$major.0_$identifier we can handle pre-9 by checking if the "major" is equal to "1", + // otherwise, 9+ + String majorVersion = javaVersion.split("\\.")[0]; + String release; + + int indexOf = javaVersion.lastIndexOf('.'); + + if (majorVersion.equals("1")) { + release = "Java " + javaVersion.substring(0, indexOf); + } else { + // of course, it really wouldn't be all that simple if they didn't add a quirk, now + // would it valid strings for the major may potentially include values such as -ea to + // denote a pre release + Matcher versionMatcher = Pattern.compile("\\d+").matcher(majorVersion); + if (versionMatcher.find()) { + majorVersion = versionMatcher.group(0); + } + release = "Java " + majorVersion; + } + map.put(release, entry); + return map; + })); + } else { + metrics = null; + } + + boolean isGui = false; + // This will check if we are in standalone and get the 'useGui' variable from there + if (platformType == PlatformType.STANDALONE) { + try { + Class cls = Class.forName("org.geysermc.geyser.platform.standalone.GeyserStandaloneBootstrap"); + isGui = (boolean) cls.getMethod("isUseGui").invoke(cls.cast(bootstrap)); + } catch (Exception e) { + logger.debug("Failed detecting if standalone is using a GUI; if this is a GeyserConnect instance this can be safely ignored."); + } + } + + double completeTime = (System.currentTimeMillis() - startupTime) / 1000D; + String message = LanguageUtils.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " "; + if (isGui) { + message += LanguageUtils.getLocaleStringLog("geyser.core.finish.gui"); + } else { + message += LanguageUtils.getLocaleStringLog("geyser.core.finish.console"); + } + logger.info(message); + + if (platformType == PlatformType.STANDALONE) { + logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn")); + } + + newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); + } + + public void shutdown() { + bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); + shuttingDown = true; + + if (sessionManager.size() >= 1) { + bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size())); + sessionManager.disconnectAll("geyser.core.shutdown.kick.message"); + bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done")); + } + + scheduledThread.shutdown(); + bedrockServer.close(); + if (timeSyncer != null) { + timeSyncer.shutdown(); + } + if (skinUploader != null) { + skinUploader.close(); + } + newsHandler.shutdown(); + this.getCommandManager().getCommands().clear(); + + bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done")); + } + + /** + * Gets a player by their current UUID + * + * @param uuid the uuid + * @return the player or null if there is no player online with this UUID + */ + @Contract("null -> null") + public GeyserSession getPlayerByUuid(UUID uuid) { + if (uuid == null) { + return null; + } + + return sessionManager.getSessions().get(uuid); + } + + /** + * Gets a player by their Xbox user identifier + * + * @param xuid the Xbox user identifier + * @return the player or null if there is no player online with this xuid + */ + @SuppressWarnings("unused") // API usage + public GeyserSession getPlayerByXuid(String xuid) { + for (GeyserSession session : sessionManager.getPendingSessions()) { + if (session.getAuthData().getXuid().equals(xuid)) { + return session; + } + } + for (GeyserSession session : sessionManager.getSessions().values()) { + if (session.getAuthData().getXuid().equals(xuid)) { + return session; + } + } + + return null; + } + + public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) { + return new GeyserImpl(platformType, bootstrap); + } + + public void reload() { + shutdown(); + bootstrap.onEnable(); + } + + public GeyserLogger getLogger() { + return bootstrap.getGeyserLogger(); + } + + public GeyserConfiguration getConfig() { + return bootstrap.getGeyserConfig(); + } + + public CommandManager getCommandManager() { + return bootstrap.getGeyserCommandManager(); + } + + public WorldManager getWorldManager() { + return bootstrap.getWorldManager(); + } + + public TimeSyncer getTimeSyncer() { + return timeSyncer; + } + + /** + * Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files + * expected to be in a jarfile are not present. + * + * @return true if the version number is not 'DEV'. + */ + public boolean isProductionEnvironment() { + //noinspection ConstantConditions - changes in production + return !"DEV".equals(GeyserImpl.VERSION); + } + + public static GeyserImpl getInstance() { + return (GeyserImpl) Geyser.getInstance(); + } +} diff --git a/core/src/main/java/org/geysermc/connector/SessionManager.java b/core/src/main/java/org/geysermc/geyser/SessionManager.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/SessionManager.java rename to core/src/main/java/org/geysermc/geyser/SessionManager.java index a2eb6d873..b6ff28a1c 100644 --- a/core/src/main/java/org/geysermc/connector/SessionManager.java +++ b/core/src/main/java/org/geysermc/geyser/SessionManager.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector; +package org.geysermc.geyser; import com.google.common.collect.ImmutableList; import lombok.AccessLevel; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.*; import java.util.concurrent.ConcurrentHashMap; diff --git a/core/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java b/core/src/main/java/org/geysermc/geyser/bootstrap/GeyserBootstrap.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java rename to core/src/main/java/org/geysermc/geyser/bootstrap/GeyserBootstrap.java index 51b64dd7f..65c171453 100644 --- a/core/src/main/java/org/geysermc/connector/bootstrap/GeyserBootstrap.java +++ b/core/src/main/java/org/geysermc/geyser/bootstrap/GeyserBootstrap.java @@ -23,15 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.bootstrap; +package org.geysermc.geyser.bootstrap; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.network.translators.world.GeyserWorldManager; -import org.geysermc.connector.network.translators.world.WorldManager; -import org.geysermc.connector.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.dump.BootstrapDumpInfo; +import org.geysermc.geyser.network.translators.world.GeyserWorldManager; +import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; import javax.annotation.Nullable; import java.net.SocketAddress; @@ -108,7 +110,7 @@ public interface GeyserBootstrap { * that have direct server access - platforms such as proxies always have to be on their latest version to support * the newest Minecraft version, but older servers can use ViaVersion to enable newer versions to join. *
- * If used, this should not be null before {@link org.geysermc.connector.GeyserConnector} initialization. + * If used, this should not be null before {@link GeyserImpl} initialization. * * @return the Minecraft version being used on the server, or null if not applicable */ diff --git a/core/src/main/java/org/geysermc/connector/command/CommandExecutor.java b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/command/CommandExecutor.java rename to core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java index d8b023529..43bf22478 100644 --- a/core/src/main/java/org/geysermc/connector/command/CommandExecutor.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command; +package org.geysermc.geyser.command; import lombok.AllArgsConstructor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; import javax.annotation.Nullable; import java.util.ArrayList; @@ -41,10 +41,10 @@ import java.util.Map; @AllArgsConstructor public class CommandExecutor { - protected final GeyserConnector connector; + protected final GeyserImpl geyser; public GeyserCommand getCommand(String label) { - return connector.getCommandManager().getCommands().get(label); + return geyser.getCommandManager().getCommands().get(label); } @Nullable @@ -53,7 +53,7 @@ public class CommandExecutor { return null; } - for (GeyserSession session : connector.getSessionManager().getSessions().values()) { + for (GeyserSession session : geyser.getSessionManager().getSessions().values()) { if (sender.getName().equals(session.getPlayerEntity().getUsername())) { return session; } @@ -77,7 +77,7 @@ public class CommandExecutor { } List availableCommands = new ArrayList<>(); - Map commands = connector.getCommandManager().getCommands(); + Map commands = geyser.getCommandManager().getCommands(); // Only show commands they have permission to use for (String name : commands.keySet()) { diff --git a/core/src/main/java/org/geysermc/connector/command/CommandManager.java b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java similarity index 61% rename from core/src/main/java/org/geysermc/connector/command/CommandManager.java rename to core/src/main/java/org/geysermc/geyser/command/CommandManager.java index 53cdfb269..7af5f93fd 100644 --- a/core/src/main/java/org/geysermc/connector/command/CommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command; +package org.geysermc.geyser.command; import lombok.Getter; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.defaults.*; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.defaults.*; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.*; @@ -40,28 +40,28 @@ public abstract class CommandManager { @Getter private final Map commands = Collections.synchronizedMap(new HashMap<>()); - private final GeyserConnector connector; + private final GeyserImpl geyser; - public CommandManager(GeyserConnector connector) { - this.connector = connector; + public CommandManager(GeyserImpl geyser) { + this.geyser = geyser; - registerCommand(new HelpCommand(connector, "help", "geyser.commands.help.desc", "geyser.command.help")); - registerCommand(new ListCommand(connector, "list", "geyser.commands.list.desc", "geyser.command.list")); - registerCommand(new ReloadCommand(connector, "reload", "geyser.commands.reload.desc", "geyser.command.reload")); - registerCommand(new OffhandCommand(connector, "offhand", "geyser.commands.offhand.desc", "geyser.command.offhand")); - registerCommand(new DumpCommand(connector, "dump", "geyser.commands.dump.desc", "geyser.command.dump")); - registerCommand(new VersionCommand(connector, "version", "geyser.commands.version.desc", "geyser.command.version")); - registerCommand(new SettingsCommand(connector, "settings", "geyser.commands.settings.desc", "geyser.command.settings")); - registerCommand(new StatisticsCommand(connector, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics")); + registerCommand(new HelpCommand(geyser, "help", "geyser.commands.help.desc", "geyser.command.help")); + registerCommand(new ListCommand(geyser, "list", "geyser.commands.list.desc", "geyser.command.list")); + registerCommand(new ReloadCommand(geyser, "reload", "geyser.commands.reload.desc", "geyser.command.reload")); + registerCommand(new OffhandCommand(geyser, "offhand", "geyser.commands.offhand.desc", "geyser.command.offhand")); + registerCommand(new DumpCommand(geyser, "dump", "geyser.commands.dump.desc", "geyser.command.dump")); + registerCommand(new VersionCommand(geyser, "version", "geyser.commands.version.desc", "geyser.command.version")); + registerCommand(new SettingsCommand(geyser, "settings", "geyser.commands.settings.desc", "geyser.command.settings")); + registerCommand(new StatisticsCommand(geyser, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics")); registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements")); - if (GeyserConnector.getInstance().getPlatformType() == PlatformType.STANDALONE) { - registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); + if (GeyserImpl.getInstance().getPlatformType() == PlatformType.STANDALONE) { + registerCommand(new StopCommand(geyser, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); } } public void registerCommand(GeyserCommand command) { commands.put(command.getName(), command); - connector.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.commands.registered", command.getName())); + geyser.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.commands.registered", command.getName())); if (command.getAliases().isEmpty()) return; @@ -89,7 +89,7 @@ public abstract class CommandManager { GeyserCommand cmd = commands.get(label); if (cmd == null) { - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.invalid")); + geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.invalid")); return; } @@ -99,7 +99,7 @@ public abstract class CommandManager { if (!cmd.isBedrockOnly()) { cmd.execute(null, sender, args); } else { - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only")); + geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only")); } } } @@ -108,7 +108,7 @@ public abstract class CommandManager { * @return a list of all subcommands under {@code /geyser}. */ public List getCommandNames() { - return Arrays.asList(connector.getCommandManager().getCommands().keySet().toArray(new String[0])); + return Arrays.asList(geyser.getCommandManager().getCommands().keySet().toArray(new String[0])); } /** diff --git a/core/src/main/java/org/geysermc/connector/command/CommandSender.java b/core/src/main/java/org/geysermc/geyser/command/CommandSender.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/command/CommandSender.java rename to core/src/main/java/org/geysermc/geyser/command/CommandSender.java index 9fa8673f4..fc9a0be24 100644 --- a/core/src/main/java/org/geysermc/connector/command/CommandSender.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandSender.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command; +package org.geysermc.geyser.command; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.utils.LanguageUtils; /** * Implemented on top of any class that can send a command. diff --git a/core/src/main/java/org/geysermc/connector/command/GeyserCommand.java b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/command/GeyserCommand.java rename to core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java index 48fe2eb9a..af462192f 100644 --- a/core/src/main/java/org/geysermc/connector/command/GeyserCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command; +package org.geysermc.geyser.command; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import javax.annotation.Nullable; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java index 8ace83840..11dd28199 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/AdvancementsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; public class AdvancementsCommand extends GeyserCommand { public AdvancementsCommand(String name, String description, String permission) { diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java similarity index 79% rename from core/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java index 075bfbbcd..0926b97c3 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/DumpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java @@ -23,22 +23,22 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; import com.fasterxml.jackson.core.util.DefaultIndenter; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.common.serializer.AsteriskSerializer; -import org.geysermc.connector.dump.DumpInfo; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.connector.utils.WebUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.dump.DumpInfo; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.utils.WebUtils; import java.io.FileOutputStream; import java.io.IOException; @@ -47,20 +47,20 @@ import java.util.List; public class DumpCommand extends GeyserCommand { - private final GeyserConnector connector; + private final GeyserImpl geyser; private static final ObjectMapper MAPPER = new ObjectMapper(); private static final String DUMP_URL = "https://dump.geysermc.org/"; - public DumpCommand(GeyserConnector connector, String name, String description, String permission) { + public DumpCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); - this.connector = connector; + this.geyser = geyser; } @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { // Only allow the console to create dumps on Geyser Standalone - if (!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE) { + if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; } @@ -93,7 +93,7 @@ public class DumpCommand extends GeyserCommand { } } catch (IOException e) { sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collect_error", sender.getLocale())); - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.collect_error_short"), e); + geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.collect_error_short"), e); return; } @@ -103,12 +103,12 @@ public class DumpCommand extends GeyserCommand { sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.writing", sender.getLocale())); try { - FileOutputStream outputStream = new FileOutputStream(GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("dump.json").toFile()); + FileOutputStream outputStream = new FileOutputStream(GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("dump.json").toFile()); outputStream.write(dumpData.getBytes()); outputStream.close(); } catch (IOException e) { sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.write_error", sender.getLocale())); - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.write_error_short"), e); + geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.write_error_short"), e); return; } @@ -123,7 +123,7 @@ public class DumpCommand extends GeyserCommand { responseNode = MAPPER.readTree(response); } catch (IOException e) { sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.upload_error", sender.getLocale())); - connector.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.upload_error_short"), e); + geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.upload_error_short"), e); return; } @@ -137,7 +137,7 @@ public class DumpCommand extends GeyserCommand { sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl); if (!sender.isConsole()) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl)); + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl)); } } diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java similarity index 80% rename from core/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index c180a473d..00e18cf0a 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -23,24 +23,24 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Collections; import java.util.Map; public class HelpCommand extends GeyserCommand { - private final GeyserConnector connector; + private final GeyserImpl geyser; - public HelpCommand(GeyserConnector connector, String name, String description, String permission) { + public HelpCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); - this.connector = connector; + this.geyser = geyser; this.setAliases(Collections.singletonList("?")); } @@ -59,7 +59,7 @@ public class HelpCommand extends GeyserCommand { String header = LanguageUtils.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); sender.sendMessage(header); - Map cmds = connector.getCommandManager().getCommands(); + Map cmds = geyser.getCommandManager().getCommands(); for (String cmdName : cmds.keySet()) { GeyserCommand cmd = cmds.get(cmdName); diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java similarity index 70% rename from core/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java index 3058f2982..4f4b610d1 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/ListCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java @@ -23,31 +23,31 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.stream.Collectors; public class ListCommand extends GeyserCommand { - private final GeyserConnector connector; + private final GeyserImpl geyser; - public ListCommand(GeyserConnector connector, String name, String description, String permission) { + public ListCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); - this.connector = connector; + this.geyser = geyser; } @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { String message = LanguageUtils.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), - connector.getSessionManager().size(), - connector.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); + geyser.getSessionManager().size(), + geyser.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); sender.sendMessage(message); } diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java similarity index 83% rename from core/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java index 06d554ece..c9a5b818e 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/OffhandCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.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 org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.BlockUtils; public class OffhandCommand extends GeyserCommand { - public OffhandCommand(GeyserConnector connector, String name, String description, String permission) { + public OffhandCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); } diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java similarity index 70% rename from core/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java index 3fa5adc31..d8ceda637 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java @@ -23,27 +23,27 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; public class ReloadCommand extends GeyserCommand { - private final GeyserConnector connector; + private final GeyserImpl geyser; - public ReloadCommand(GeyserConnector connector, String name, String description, String permission) { + public ReloadCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); - this.connector = connector; + this.geyser = geyser; } @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { - if (!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE) { + if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { return; } @@ -51,7 +51,7 @@ public class ReloadCommand extends GeyserCommand { sender.sendMessage(message); - connector.getSessionManager().disconnectAll("geyser.commands.reload.kick"); - connector.reload(); + geyser.getSessionManager().disconnectAll("geyser.commands.reload.kick"); + geyser.reload(); } } diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java similarity index 80% rename from core/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java index 0f85e3c8f..ec561b6ff 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/SettingsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.SettingsUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.SettingsUtils; public class SettingsCommand extends GeyserCommand { - public SettingsCommand(GeyserConnector connector, String name, String description, String permission) { + public SettingsCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); } diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java index f458e3003..c925c73b0 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/StatisticsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; public class StatisticsCommand extends GeyserCommand { - public StatisticsCommand(GeyserConnector connector, String name, String description, String permission) { + public StatisticsCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); } diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java similarity index 72% rename from core/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java index ad5049432..23d9a88d7 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java @@ -23,35 +23,35 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Collections; public class StopCommand extends GeyserCommand { - private final GeyserConnector connector; + private final GeyserImpl geyser; - public StopCommand(GeyserConnector connector, String name, String description, String permission) { + public StopCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); - this.connector = connector; + this.geyser = geyser; this.setAliases(Collections.singletonList("shutdown")); } @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { - if (!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE) { + if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; } - connector.getBootstrap().onDisable(); + geyser.getBootstrap().onDisable(); } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java similarity index 78% rename from core/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java rename to core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index ab979ccff..e3530071d 100644 --- a/core/src/main/java/org/geysermc/connector/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.command.defaults; +package org.geysermc.geyser.command.defaults; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandSender; -import org.geysermc.connector.command.GeyserCommand; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.connector.utils.WebUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.command.GeyserCommand; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.utils.WebUtils; import java.io.IOException; import java.net.URLEncoder; @@ -45,12 +45,12 @@ import java.util.Properties; public class VersionCommand extends GeyserCommand { - private final GeyserConnector connector; + private final GeyserImpl geyser; - public VersionCommand(GeyserConnector connector, String name, String description, String permission) { + public VersionCommand(GeyserImpl geyser, String name, String description, String permission) { super(name, description, permission); - this.connector = connector; + this.geyser = geyser; } @Override @@ -64,10 +64,10 @@ public class VersionCommand extends GeyserCommand { } sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), - GeyserConnector.NAME, GeyserConnector.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); + GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone - if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) { + if (GeyserImpl.getInstance().isProductionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale())); try { Properties gitProp = new Properties(); @@ -88,7 +88,7 @@ public class VersionCommand extends GeyserCommand { throw new AssertionError("buildNumber missing"); } } catch (IOException | AssertionError | NumberFormatException e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.version.failed"), e); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.version.failed"), e); sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.version.failed", sender.getLocale())); } } diff --git a/core/src/main/java/org/geysermc/connector/common/AuthType.java b/core/src/main/java/org/geysermc/geyser/common/AuthType.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/common/AuthType.java rename to core/src/main/java/org/geysermc/geyser/common/AuthType.java index 41810a1ce..ea5812663 100644 --- a/core/src/main/java/org/geysermc/connector/common/AuthType.java +++ b/core/src/main/java/org/geysermc/geyser/common/AuthType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common; +package org.geysermc.geyser.common; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/core/src/main/java/org/geysermc/connector/common/ChatColor.java b/core/src/main/java/org/geysermc/geyser/common/ChatColor.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/common/ChatColor.java rename to core/src/main/java/org/geysermc/geyser/common/ChatColor.java index 946be39c4..6c57cd5c1 100644 --- a/core/src/main/java/org/geysermc/connector/common/ChatColor.java +++ b/core/src/main/java/org/geysermc/geyser/common/ChatColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common; +package org.geysermc.geyser.common; public class ChatColor { diff --git a/core/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java b/core/src/main/java/org/geysermc/geyser/common/connection/ChannelWrapper.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java rename to core/src/main/java/org/geysermc/geyser/common/connection/ChannelWrapper.java index 71ab16651..985e690b1 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/ChannelWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/ChannelWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import io.netty.buffer.ByteBufAllocator; import io.netty.channel.*; diff --git a/core/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java b/core/src/main/java/org/geysermc/geyser/common/connection/DefaultChannelPipelinePublic.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java rename to core/src/main/java/org/geysermc/geyser/common/connection/DefaultChannelPipelinePublic.java index 4749eeb4c..a55d583d1 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/DefaultChannelPipelinePublic.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/DefaultChannelPipelinePublic.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import io.netty.channel.Channel; import io.netty.channel.DefaultChannelPipeline; diff --git a/core/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java b/core/src/main/java/org/geysermc/geyser/common/connection/GeyserInjector.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java rename to core/src/main/java/org/geysermc/geyser/common/connection/GeyserInjector.java index 443e805eb..5e9f4f28f 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/GeyserInjector.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/GeyserInjector.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import io.netty.channel.ChannelFuture; import lombok.Getter; -import org.geysermc.connector.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.bootstrap.GeyserBootstrap; import java.net.SocketAddress; diff --git a/core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java b/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWithRemoteAddress.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java rename to core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWithRemoteAddress.java index 6cd01d591..d6528f11b 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWithRemoteAddress.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWithRemoteAddress.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import io.netty.channel.local.LocalChannel; diff --git a/core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java b/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWrapper.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java rename to core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWrapper.java index ad9b3e8f7..edd3d4414 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/LocalChannelWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import io.netty.channel.DefaultChannelPipeline; import io.netty.channel.local.LocalChannel; diff --git a/core/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java b/core/src/main/java/org/geysermc/geyser/common/connection/LocalServerChannelWrapper.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java rename to core/src/main/java/org/geysermc/geyser/common/connection/LocalServerChannelWrapper.java index 3c37709ec..5a06c9727 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/LocalServerChannelWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/LocalServerChannelWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import io.netty.channel.local.LocalChannel; import io.netty.channel.local.LocalServerChannel; diff --git a/core/src/main/java/org/geysermc/connector/common/connection/LocalSession.java b/core/src/main/java/org/geysermc/geyser/common/connection/LocalSession.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/common/connection/LocalSession.java rename to core/src/main/java/org/geysermc/geyser/common/connection/LocalSession.java index 7bd08a732..d29675835 100644 --- a/core/src/main/java/org/geysermc/connector/common/connection/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/common/connection/LocalSession.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.connection; +package org.geysermc.geyser.common.connection; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.packet.PacketProtocol; diff --git a/core/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java b/core/src/main/java/org/geysermc/geyser/common/main/IGeyserMain.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java rename to core/src/main/java/org/geysermc/geyser/common/main/IGeyserMain.java index 8490dc7f2..bb70012cc 100644 --- a/core/src/main/java/org/geysermc/connector/common/main/IGeyserMain.java +++ b/core/src/main/java/org/geysermc/geyser/common/main/IGeyserMain.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.main; +package org.geysermc.geyser.common.main; import javax.swing.*; import java.io.InputStream; diff --git a/core/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java b/core/src/main/java/org/geysermc/geyser/common/ping/GeyserPingInfo.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java rename to core/src/main/java/org/geysermc/geyser/common/ping/GeyserPingInfo.java index 4f86ddfb2..6a7f1f13c 100644 --- a/core/src/main/java/org/geysermc/connector/common/ping/GeyserPingInfo.java +++ b/core/src/main/java/org/geysermc/geyser/common/ping/GeyserPingInfo.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.ping; +package org.geysermc.geyser.common.ping; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/core/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java b/core/src/main/java/org/geysermc/geyser/common/serializer/AsteriskSerializer.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java rename to core/src/main/java/org/geysermc/geyser/common/serializer/AsteriskSerializer.java index 8ea6ef220..929ac8d9a 100644 --- a/core/src/main/java/org/geysermc/connector/common/serializer/AsteriskSerializer.java +++ b/core/src/main/java/org/geysermc/geyser/common/serializer/AsteriskSerializer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.common.serializer; +package org.geysermc.geyser.common.serializer; import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/core/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java b/core/src/main/java/org/geysermc/geyser/configuration/EmoteOffhandWorkaroundOption.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java rename to core/src/main/java/org/geysermc/geyser/configuration/EmoteOffhandWorkaroundOption.java index c28048046..87421ad92 100644 --- a/core/src/main/java/org/geysermc/connector/configuration/EmoteOffhandWorkaroundOption.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/EmoteOffhandWorkaroundOption.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.configuration; +package org.geysermc.geyser.configuration; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/core/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java rename to core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java index 2e05b0c18..b9e735c94 100644 --- a/core/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.configuration; +package org.geysermc.geyser.configuration; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.network.CIDRMatcher; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; +import org.geysermc.geyser.network.CIDRMatcher; +import org.geysermc.geyser.utils.LanguageUtils; import java.nio.file.Path; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java rename to core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java index c6967adf1..9c5fc229f 100644 --- a/core/src/main/java/org/geysermc/connector/configuration/GeyserJacksonConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.configuration; +package org.geysermc.geyser.configuration; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -34,11 +34,11 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.common.serializer.AsteriskSerializer; -import org.geysermc.connector.network.CIDRMatcher; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.network.CIDRMatcher; +import org.geysermc.geyser.utils.LanguageUtils; import java.io.IOException; import java.nio.file.Path; @@ -151,7 +151,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration private String motd2 = "Geyser"; @JsonProperty("server-name") - private String serverName = GeyserConnector.NAME; + private String serverName = GeyserImpl.NAME; @JsonProperty("compression-level") private int compressionLevel = 6; diff --git a/core/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/BootstrapDumpInfo.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java rename to core/src/main/java/org/geysermc/geyser/dump/BootstrapDumpInfo.java index afcbda6a4..6b421f912 100644 --- a/core/src/main/java/org/geysermc/connector/dump/BootstrapDumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/BootstrapDumpInfo.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.dump; +package org.geysermc.geyser.dump; import lombok.AllArgsConstructor; import lombok.Getter; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; +import org.geysermc.geyser.GeyserImpl; import java.util.List; @@ -37,7 +37,7 @@ public class BootstrapDumpInfo { private final PlatformType platform; public BootstrapDumpInfo() { - this.platform = GeyserConnector.getInstance().getPlatformType(); + this.platform = GeyserImpl.getInstance().getPlatformType(); } @Getter diff --git a/core/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/dump/DumpInfo.java rename to core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index c65bbbc51..a6cc971ea 100644 --- a/core/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.dump; +package org.geysermc.geyser.dump; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.JsonNode; @@ -35,14 +35,14 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import lombok.AllArgsConstructor; import lombok.Getter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.common.serializer.AsteriskSerializer; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.DockerCheck; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.WebUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.DockerCheck; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.WebUtils; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.FloodgateInfoHolder; @@ -84,7 +84,7 @@ public class DumpInfo { } catch (IOException ignored) { } - this.config = GeyserConnector.getInstance().getConfig(); + this.config = GeyserImpl.getInstance().getConfig(); this.floodgate = new Floodgate(); String md5Hash = "unknown"; @@ -100,7 +100,7 @@ public class DumpInfo { //noinspection UnstableApiUsage sha256Hash = byteSource.hash(Hashing.sha256()).toString(); } catch (Exception e) { - if (GeyserConnector.getInstance().getConfig().isDebugMode()) { + if (GeyserImpl.getInstance().getConfig().isDebugMode()) { e.printStackTrace(); } } @@ -113,12 +113,12 @@ public class DumpInfo { } this.userPlatforms = new Object2IntOpenHashMap<>(); - for (GeyserSession session : GeyserConnector.getInstance().getSessionManager().getAllSessions()) { + for (GeyserSession session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) { DeviceOs device = session.getClientData().getDeviceOs(); userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1); } - this.bootstrapInfo = GeyserConnector.getInstance().getBootstrap().getDumpInfo(); + this.bootstrapInfo = GeyserImpl.getInstance().getBootstrap().getDumpInfo(); this.flagsInfo = new FlagsInfo(); } @@ -138,8 +138,8 @@ public class DumpInfo { private final MCInfo mcInfo; VersionInfo() { - this.name = GeyserConnector.NAME; - this.version = GeyserConnector.VERSION; + this.name = GeyserImpl.NAME; + this.version = GeyserImpl.VERSION; this.javaName = System.getProperty("java.vm.name"); this.javaVendor = System.getProperty("java.vendor"); this.javaVersion = ManagementFactory.getRuntimeMXBean().getVmVersion(); // Gives a little more to the version we can use over the system property @@ -216,9 +216,9 @@ public class DumpInfo { public LogsInfo() { try { Map fields = new HashMap<>(); - fields.put("content", FileUtils.readAllLines(GeyserConnector.getInstance().getBootstrap().getLogsPath()).collect(Collectors.joining("\n"))); + fields.put("content", FileUtils.readAllLines(GeyserImpl.getInstance().getBootstrap().getLogsPath()).collect(Collectors.joining("\n"))); - JsonNode logData = GeyserConnector.JSON_MAPPER.readTree(WebUtils.postForm("https://api.mclo.gs/1/log", fields)); + JsonNode logData = GeyserImpl.JSON_MAPPER.readTree(WebUtils.postForm("https://api.mclo.gs/1/log", fields)); this.link = logData.get("url").textValue(); } catch (IOException ignored) { } diff --git a/core/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/AbstractArrowEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/AbstractArrowEntity.java index 27ca23a2e..912d4b8a1 100644 --- a/core/src/main/java/org/geysermc/connector/entity/AbstractArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/AbstractArrowEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/geyser/entity/AreaEffectCloudEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/AreaEffectCloudEntity.java index 3e91ba0e5..b200d8f48 100644 --- a/core/src/main/java/org/geysermc/connector/entity/AreaEffectCloudEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/AreaEffectCloudEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; @@ -31,8 +31,8 @@ import com.github.steveice10.mc.protocol.data.game.level.particle.Particle; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.EffectUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.EffectUtils; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/BoatEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/entity/BoatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/BoatEntity.java index 8283511cb..24d3b5bb2 100644 --- a/core/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/BoatEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/CommandBlockMinecartEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/CommandBlockMinecartEntity.java index fcd4e05a3..e65952c02 100644 --- a/core/src/main/java/org/geysermc/connector/entity/CommandBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/CommandBlockMinecartEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/DefaultBlockMinecartEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/DefaultBlockMinecartEntity.java index bcc88c33f..50851eac6 100644 --- a/core/src/main/java/org/geysermc/connector/entity/DefaultBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/DefaultBlockMinecartEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/EnderCrystalEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/EnderCrystalEntity.java index 1a8a9bd5f..203f42033 100644 --- a/core/src/main/java/org/geysermc/connector/entity/EnderCrystalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EnderCrystalEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/Entity.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/Entity.java rename to core/src/main/java/org/geysermc/geyser/entity/Entity.java index db7f92dca..703ca212f 100644 --- a/core/src/main/java/org/geysermc/connector/entity/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/Entity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; @@ -43,9 +43,9 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.utils.MathUtils; import java.util.Optional; import java.util.UUID; @@ -157,7 +157,7 @@ public class Entity { flagsDirty = false; - session.getConnector().getLogger().debug("Spawned entity " + getClass().getName() + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); + session.getGeyser().getLogger().debug("Spawned entity " + getClass().getName() + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); } /** diff --git a/core/src/main/java/org/geysermc/connector/entity/EntityDefinition.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/EntityDefinition.java rename to core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java index d0c7c3826..31190d892 100644 --- a/core/src/main/java/org/geysermc/connector/entity/EntityDefinition.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; @@ -31,10 +31,10 @@ import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Setter; import lombok.experimental.Accessors; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.factory.BaseEntityFactory; -import org.geysermc.connector.entity.factory.EntityFactory; -import org.geysermc.connector.registry.Registries; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.entity.factory.BaseEntityFactory; +import org.geysermc.geyser.entity.factory.EntityFactory; +import org.geysermc.geyser.registry.Registries; import java.util.List; import java.util.Locale; @@ -71,9 +71,9 @@ public record EntityDefinition(EntityFactory factory, Entit } if (translator.acceptedType() != metadata.getType()) { - GeyserConnector.getInstance().getLogger().warning("Metadata ID " + metadata.getId() + " was received with type " + metadata.getType() + " but we expected " + translator.acceptedType() + " for " + entity.getDefinition().entityType()); - if (GeyserConnector.getInstance().getConfig().isDebugMode()) { - GeyserConnector.getInstance().getLogger().debug(metadata.toString()); + GeyserImpl.getInstance().getLogger().warning("Metadata ID " + metadata.getId() + " was received with type " + metadata.getType() + " but we expected " + translator.acceptedType() + " for " + entity.getDefinition().entityType()); + if (GeyserImpl.getInstance().getConfig().isDebugMode()) { + GeyserImpl.getInstance().getLogger().debug(metadata.toString()); } return; } diff --git a/core/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java rename to core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index 4700b81c5..fb21e68ff 100644 --- a/core/src/main/java/org/geysermc/connector/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; @@ -31,26 +31,26 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEnt import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.factory.BaseEntityFactory; -import org.geysermc.connector.entity.factory.ExperienceOrbEntityFactory; -import org.geysermc.connector.entity.factory.PaintingEntityFactory; -import org.geysermc.connector.entity.living.*; -import org.geysermc.connector.entity.living.animal.*; -import org.geysermc.connector.entity.living.animal.horse.*; -import org.geysermc.connector.entity.living.animal.tameable.CatEntity; -import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; -import org.geysermc.connector.entity.living.animal.tameable.TameableEntity; -import org.geysermc.connector.entity.living.animal.tameable.WolfEntity; -import org.geysermc.connector.entity.living.merchant.AbstractMerchantEntity; -import org.geysermc.connector.entity.living.merchant.VillagerEntity; -import org.geysermc.connector.entity.living.monster.*; -import org.geysermc.connector.entity.living.monster.raid.PillagerEntity; -import org.geysermc.connector.entity.living.monster.raid.RaidParticipantEntity; -import org.geysermc.connector.entity.living.monster.raid.SpellcasterIllagerEntity; -import org.geysermc.connector.entity.living.monster.raid.VindicatorEntity; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.registry.Registries; +import org.geysermc.geyser.entity.factory.BaseEntityFactory; +import org.geysermc.geyser.entity.factory.ExperienceOrbEntityFactory; +import org.geysermc.geyser.entity.factory.PaintingEntityFactory; +import org.geysermc.geyser.entity.living.*; +import org.geysermc.geyser.entity.living.animal.*; +import org.geysermc.geyser.entity.living.animal.horse.*; +import org.geysermc.geyser.entity.living.animal.tameable.CatEntity; +import org.geysermc.geyser.entity.living.animal.tameable.ParrotEntity; +import org.geysermc.geyser.entity.living.animal.tameable.TameableEntity; +import org.geysermc.geyser.entity.living.animal.tameable.WolfEntity; +import org.geysermc.geyser.entity.living.merchant.AbstractMerchantEntity; +import org.geysermc.geyser.entity.living.merchant.VillagerEntity; +import org.geysermc.geyser.entity.living.monster.*; +import org.geysermc.geyser.entity.living.monster.raid.PillagerEntity; +import org.geysermc.geyser.entity.living.monster.raid.RaidParticipantEntity; +import org.geysermc.geyser.entity.living.monster.raid.SpellcasterIllagerEntity; +import org.geysermc.geyser.entity.living.monster.raid.VindicatorEntity; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.registry.Registries; public final class EntityDefinitions { public static final EntityDefinition AREA_EFFECT_CLOUD; diff --git a/core/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java b/core/src/main/java/org/geysermc/geyser/entity/EntityMetadataTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java rename to core/src/main/java/org/geysermc/geyser/entity/EntityMetadataTranslator.java index 8023ce47c..fa6758210 100644 --- a/core/src/main/java/org/geysermc/connector/entity/EntityMetadataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityMetadataTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; diff --git a/core/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ExpOrbEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ExpOrbEntity.java index 14dacc4cd..830d5e368 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ExpOrbEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ExpOrbEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public class ExpOrbEntity extends Entity { diff --git a/core/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java b/core/src/main/java/org/geysermc/geyser/entity/FallingBlockEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/FallingBlockEntity.java index 6339a080d..25d19c876 100644 --- a/core/src/main/java/org/geysermc/connector/entity/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/FallingBlockEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/FireworkEntity.java b/core/src/main/java/org/geysermc/geyser/entity/FireworkEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/FireworkEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/FireworkEntity.java index deac6b0dd..f1bcb9a40 100644 --- a/core/src/main/java/org/geysermc/connector/entity/FireworkEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/FireworkEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -36,10 +36,10 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.FireworkColor; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.FireworkColor; +import org.geysermc.geyser.utils.MathUtils; import org.geysermc.floodgate.util.DeviceOs; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java b/core/src/main/java/org/geysermc/geyser/entity/FishingHookEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/FishingHookEntity.java index 84d7e686a..b5dde3c6e 100644 --- a/core/src/main/java/org/geysermc/connector/entity/FishingHookEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/FishingHookEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import lombok.Getter; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.BlockPositionIterator; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.BlockPositionIterator; +import org.geysermc.geyser.utils.BlockUtils; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; @@ -102,7 +102,7 @@ public class FishingHookEntity extends ThrowableEntity { boolean touchingWater = false; boolean collided = false; for (BlockPositionIterator iter = session.getCollisionManager().collidableBlocksIterator(boundingBox); iter.hasNext(); iter.next()) { - int blockID = session.getConnector().getWorldManager().getBlockAt(session, iter.getX(), iter.getY(), iter.getZ()); + int blockID = session.getGeyser().getWorldManager().getBlockAt(session, iter.getX(), iter.getY(), iter.getZ()); BlockCollision blockCollision = BlockUtils.getCollision(blockID); if (blockCollision != null) { if (blockCollision.checkIntersection(iter.getX(), iter.getY(), iter.getZ(), boundingBox)) { @@ -181,7 +181,7 @@ public class FishingHookEntity extends ThrowableEntity { * @return true if this entity is currently in air. */ protected boolean isInAir() { - int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); + int block = session.getGeyser().getWorldManager().getBlockAt(session, position.toInt()); return block == BlockStateValues.JAVA_AIR_ID; } diff --git a/core/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/FurnaceMinecartEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/FurnaceMinecartEntity.java index 13116e9d7..f4eac3457 100644 --- a/core/src/main/java/org/geysermc/connector/entity/FurnaceMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/FurnaceMinecartEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java b/core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java rename to core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java index 09cd79562..f50548f15 100644 --- a/core/src/main/java/org/geysermc/connector/entity/GeyserDirtyMetadata.java +++ b/core/src/main/java/org/geysermc/geyser/entity/GeyserDirtyMetadata.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap; diff --git a/core/src/main/java/org/geysermc/connector/entity/ItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ItemEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/ItemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ItemEntity.java index f27aa8227..bacbce098 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ItemEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -34,9 +34,9 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import java.util.UUID; @@ -117,7 +117,7 @@ public class ItemEntity extends ThrowableEntity { super.moveAbsoluteImmediate(position.add(0, offset, 0), 0, 0, 0, isOnGround, teleported); this.position = position; - int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); + int block = session.getGeyser().getWorldManager().getBlockAt(session, position.toInt()); waterLevel = BlockStateValues.getWaterLevel(block); } @@ -135,7 +135,7 @@ public class ItemEntity extends ThrowableEntity { protected float getDrag() { if (onGround) { Vector3i groundBlockPos = position.toInt().down(1); - int blockState = session.getConnector().getWorldManager().getBlockAt(session, groundBlockPos); + int blockState = session.getGeyser().getWorldManager().getBlockAt(session, groundBlockPos); return BlockStateValues.getSlipperiness(blockState) * 0.98f; } return 0.98f; diff --git a/core/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ItemFrameEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ItemFrameEntity.java index c4210f074..e4026570e 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ItemFrameEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -39,9 +39,9 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -105,7 +105,7 @@ public class ItemFrameEntity extends Entity { @Override public void spawnEntity() { updateBlock(true); - session.getConnector().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId); + session.getGeyser().getLogger().debug("Spawned item frame at location " + bedrockPosition + " with java id " + entityId); valid = true; } diff --git a/core/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ItemedFireballEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ItemedFireballEntity.java index 16f361683..8775c3282 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ItemedFireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ItemedFireballEntity.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/LeashKnotEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/LeashKnotEntity.java index c5697346e..1634552b8 100644 --- a/core/src/main/java/org/geysermc/connector/entity/LeashKnotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/LeashKnotEntity.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/LightningEntity.java b/core/src/main/java/org/geysermc/geyser/entity/LightningEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/LightningEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/LightningEntity.java index d9c5655b3..6de3c3eb3 100644 --- a/core/src/main/java/org/geysermc/connector/entity/LightningEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/LightningEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; diff --git a/core/src/main/java/org/geysermc/connector/entity/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/LivingEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/LivingEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/LivingEntity.java index 40e65690e..16d5c316c 100644 --- a/core/src/main/java/org/geysermc/connector/entity/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/LivingEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; @@ -45,11 +45,11 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.AttributeUtils; -import org.geysermc.connector.utils.ChunkUtils; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.AttributeUtils; +import org.geysermc.geyser.utils.ChunkUtils; import java.util.ArrayList; import java.util.Collections; @@ -120,7 +120,7 @@ public class LivingEntity extends Entity { Position bedPosition = optionalPos.get(); Vector3i vector = Vector3i.from(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ()); dirtyMetadata.put(EntityData.BED_POSITION, vector); - int bed = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); + int bed = session.getGeyser().getWorldManager().getBlockAt(session, bedPosition); // Bed has to be updated, or else player is floating in the air ChunkUtils.updateBlock(session, bed, bedPosition); // Indicate that the player should enter the sleep cycle diff --git a/core/src/main/java/org/geysermc/connector/entity/MinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/MinecartEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/MinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/MinecartEntity.java index cbc30561c..66f2f3d67 100644 --- a/core/src/main/java/org/geysermc/connector/entity/MinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/MinecartEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/PaintingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/PaintingEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/PaintingEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/PaintingEntity.java index e164883c5..d5886f445 100644 --- a/core/src/main/java/org/geysermc/connector/entity/PaintingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/PaintingEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.PaintingType; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.PaintingType; import java.util.UUID; @@ -55,7 +55,7 @@ public class PaintingEntity extends Entity { valid = true; - session.getConnector().getLogger().debug("Spawned painting on " + position); + session.getGeyser().getLogger().debug("Spawned painting on " + position); } @Override diff --git a/core/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/SpawnerMinecartEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/SpawnerMinecartEntity.java index 0cf159f0e..4ee6c8bbc 100644 --- a/core/src/main/java/org/geysermc/connector/entity/SpawnerMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/SpawnerMinecartEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/TNTEntity.java b/core/src/main/java/org/geysermc/geyser/entity/TNTEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/TNTEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/TNTEntity.java index d71b1f1e7..e4e67ff83 100644 --- a/core/src/main/java/org/geysermc/connector/entity/TNTEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/TNTEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ThrowableEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ThrowableEntity.java index 5c181fe0f..f68f4c760 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ThrowableEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; @@ -31,8 +31,8 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import java.util.UUID; @@ -165,7 +165,7 @@ public class ThrowableEntity extends Entity implements Tickable { * @return true if this entity is currently in water. */ protected boolean isInWater() { - int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); + int block = session.getGeyser().getWorldManager().getBlockAt(session, position.toInt()); return BlockStateValues.getWaterLevel(block) != -1; } diff --git a/core/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ThrowableItemEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ThrowableItemEntity.java index d1800f716..e54d337b6 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ThrowableItemEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/ThrownPotionEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/ThrownPotionEntity.java index 7c108dda9..497e85914 100644 --- a/core/src/main/java/org/geysermc/connector/entity/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/ThrownPotionEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -32,10 +32,10 @@ import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.item.Potion; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.item.Potion; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.EnumSet; import java.util.UUID; @@ -59,7 +59,7 @@ public class ThrownPotionEntity extends ThrowableItemEntity { setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); } else { dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); - GeyserConnector.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); + GeyserImpl.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); } } diff --git a/core/src/main/java/org/geysermc/connector/entity/Tickable.java b/core/src/main/java/org/geysermc/geyser/entity/Tickable.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/Tickable.java rename to core/src/main/java/org/geysermc/geyser/entity/Tickable.java index f5f0188fc..1634ea87d 100644 --- a/core/src/main/java/org/geysermc/connector/entity/Tickable.java +++ b/core/src/main/java/org/geysermc/geyser/entity/Tickable.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; /** * Implemented onto anything that should have code ran every Minecraft tick - 50 milliseconds. diff --git a/core/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/TippedArrowEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/TippedArrowEntity.java index df0f12854..330de942b 100644 --- a/core/src/main/java/org/geysermc/connector/entity/TippedArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/TippedArrowEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.item.TippedArrowPotion; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.item.TippedArrowPotion; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/TridentEntity.java b/core/src/main/java/org/geysermc/geyser/entity/TridentEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/TridentEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/TridentEntity.java index 5c53ce357..e6dc2f252 100644 --- a/core/src/main/java/org/geysermc/connector/entity/TridentEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/TridentEntity.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/WitherSkullEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/WitherSkullEntity.java index 643757329..c314159b7 100644 --- a/core/src/main/java/org/geysermc/connector/entity/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/WitherSkullEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java b/core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java rename to core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java index 54719d89e..86f2a1923 100644 --- a/core/src/main/java/org/geysermc/connector/entity/attribute/GeyserAttributeType.java +++ b/core/src/main/java/org/geysermc/geyser/entity/attribute/GeyserAttributeType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.attribute; +package org.geysermc.geyser.entity.attribute; import com.nukkitx.protocol.bedrock.data.AttributeData; import lombok.AllArgsConstructor; diff --git a/core/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java rename to core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java index 67b0e5609..651064c42 100644 --- a/core/src/main/java/org/geysermc/connector/entity/factory/BaseEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.factory; +package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java rename to core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java index 542b9a018..38d27607e 100644 --- a/core/src/main/java/org/geysermc/connector/entity/factory/EntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.factory; +package org.geysermc.geyser.entity.factory; -import org.geysermc.connector.entity.Entity; +import org.geysermc.geyser.entity.Entity; public interface EntityFactory { } diff --git a/core/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java rename to core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java index 41d8db1c8..74a4c530b 100644 --- a/core/src/main/java/org/geysermc/connector/entity/factory/ExperienceOrbEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.factory; +package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.ExpOrbEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.ExpOrbEntity; +import org.geysermc.geyser.network.session.GeyserSession; @FunctionalInterface public interface ExperienceOrbEntityFactory extends EntityFactory { diff --git a/core/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java rename to core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java index 95bac4c44..425defe61 100644 --- a/core/src/main/java/org/geysermc/connector/entity/factory/PaintingEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.factory; +package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.PaintingEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.PaintingType; +import org.geysermc.geyser.entity.PaintingEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.PaintingType; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/AbstractFishEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/AbstractFishEntity.java index 43bbf4544..c92ccbb9f 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/AbstractFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/AbstractFishEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/AgeableEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/AgeableEntity.java index 1bb4caef0..9ce8a080c 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/AgeableEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/AmbientEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/AmbientEntity.java index 38e3483a6..89f2e7e16 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/AmbientEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/AmbientEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/ArmorStandEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/ArmorStandEntity.java index 685232381..99e570aa8 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/ArmorStandEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Rotation; @@ -35,10 +35,10 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; import net.kyori.adventure.text.Component; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.LivingEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/BatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/BatEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/BatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/BatEntity.java index ed6f39f39..1fe7e758e 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/BatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/BatEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/CreatureEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/CreatureEntity.java index e0407e0fc..e42795371 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/CreatureEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/CreatureEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/FlyingEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/FlyingEntity.java index 1cf362985..508ab98bc 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/FlyingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/FlyingEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/GlowSquidEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/GlowSquidEntity.java index f99c9ee4d..ca6a1c7b2 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/GlowSquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/GlowSquidEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/GolemEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/GolemEntity.java index da88f5acc..5b0a99efc 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/GolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/GolemEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/IronGolemEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/IronGolemEntity.java index 21e495239..69bfafa9a 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/IronGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/IronGolemEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/MagmaCubeEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/MagmaCubeEntity.java index bdbac85a7..c926eff70 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/MagmaCubeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/MagmaCubeEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/MobEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/MobEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/MobEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/MobEntity.java index 605f901f5..bf7aae272 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/MobEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/MobEntity.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.LivingEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/SlimeEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/SlimeEntity.java index 7ab1fad0e..17c1471d4 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/SlimeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/SlimeEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/SnowGolemEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/SnowGolemEntity.java index afd6daf5d..6bc74de65 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/SnowGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/SnowGolemEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/SquidEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/SquidEntity.java index 18c1ec9a8..0802b30ed 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/SquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/SquidEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.Tickable; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.Tickable; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import java.util.UUID; @@ -124,7 +124,7 @@ public class SquidEntity extends WaterEntity implements Tickable { if (getFlag(EntityFlag.RIDING)) { inWater = false; } else { - int block = session.getConnector().getWorldManager().getBlockAt(session, position.toInt()); + int block = session.getGeyser().getWorldManager().getBlockAt(session, position.toInt()); inWater = BlockStateValues.getWaterLevel(block) != -1; } } diff --git a/core/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/WaterEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/WaterEntity.java index 4766841ac..1ace4fe22 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/WaterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/WaterEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living; +package org.geysermc.geyser.entity.living; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/AnimalEntity.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/AnimalEntity.java index 60d2ba96a..b61dbf0d4 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/AnimalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/AnimalEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.AgeableEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.AgeableEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/AxolotlEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/AxolotlEntity.java index 38f5a10a8..568d7a03a 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/AxolotlEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/AxolotlEntity.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/BeeEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/BeeEntity.java index 7e6e8f1a8..406213a7c 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/BeeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/BeeEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -32,9 +32,9 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/ChickenEntity.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/ChickenEntity.java index a32262199..a28be7611 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/ChickenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/ChickenEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/FoxEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/FoxEntity.java index 84b2f1071..e550a955d 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/FoxEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/FoxEntity.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/GoatEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/GoatEntity.java index 5b5843480..11a46315a 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/GoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/GoatEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import lombok.Getter; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/HoglinEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/HoglinEntity.java index 81f340578..06c408486 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/HoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/HoglinEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.DimensionUtils; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/MooshroomEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/MooshroomEntity.java index 2047b8afe..cbad36252 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/MooshroomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/MooshroomEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/OcelotEntity.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/OcelotEntity.java index 945787417..f473f1d15 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/OcelotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/OcelotEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PandaEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/PandaEntity.java index 6ddc66ab9..c41ffb3cf 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/PandaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PandaEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -32,9 +32,9 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PigEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/PigEntity.java index b31470e1b..03553b08c 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/PigEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PigEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PolarBearEntity.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/PolarBearEntity.java index c83e6bad4..9ff1b1918 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/PolarBearEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PolarBearEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PufferFishEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/PufferFishEntity.java index 9baddf321..5916c8b62 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/PufferFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/PufferFishEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.AbstractFishEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.AbstractFishEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/RabbitEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/RabbitEntity.java index 38129d923..9228542f4 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/RabbitEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/RabbitEntity.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/SheepEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/SheepEntity.java index 6fa2b59df..9a8f8db9b 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/SheepEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/SheepEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/StriderEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/StriderEntity.java index 8fa51d48f..d18d7acc1 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/StriderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/StriderEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/TropicalFishEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/TropicalFishEntity.java index e699cfa98..98555425f 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/TropicalFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/TropicalFishEntity.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableList; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import it.unimi.dsi.fastutil.ints.IntList; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.AbstractFishEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.AbstractFishEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.List; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/TurtleEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/TurtleEntity.java index 1eb0da891..06ef8a0ab 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/TurtleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/TurtleEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal; +package org.geysermc.geyser.entity.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/AbstractHorseEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/AbstractHorseEntity.java index 25e5eaaf7..92f6f9687 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/AbstractHorseEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.horse; +package org.geysermc.geyser.entity.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.google.common.collect.ImmutableSet; @@ -34,11 +34,11 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.entity.living.animal.AnimalEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/ChestedHorseEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/ChestedHorseEntity.java index 5ccbb4ea7..cf524cb38 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/ChestedHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/ChestedHorseEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.horse; +package org.geysermc.geyser.entity.living.animal.horse; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/HorseEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/HorseEntity.java index d997171ea..25c323163 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/HorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/HorseEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.horse; +package org.geysermc.geyser.entity.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/LlamaEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/LlamaEntity.java index 7a4af6a2a..5934215b6 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/LlamaEntity.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.horse; +package org.geysermc.geyser.entity.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/TraderLlamaEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/TraderLlamaEntity.java index b8bfcdca6..1faed9e49 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/horse/TraderLlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/TraderLlamaEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.horse; +package org.geysermc.geyser.entity.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/CatEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/CatEntity.java index 52f20b75f..a2604e931 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/CatEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.tameable; +package org.geysermc.geyser.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; @@ -31,9 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/ParrotEntity.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/ParrotEntity.java index 603303a65..b902ee1af 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/ParrotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/ParrotEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.tameable; +package org.geysermc.geyser.entity.living.animal.tameable; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/TameableEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/TameableEntity.java index 198330ded..e08bdef9e 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/TameableEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.tameable; +package org.geysermc.geyser.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; @@ -31,10 +31,10 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.animal.AnimalEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/WolfEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/WolfEntity.java index c38c1c8af..7a89b1153 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/WolfEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.animal.tameable; +package org.geysermc.geyser.entity.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -31,9 +31,9 @@ import com.google.common.collect.ImmutableSet; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/merchant/AbstractMerchantEntity.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/merchant/AbstractMerchantEntity.java index da7e0b357..70bed1ec2 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/merchant/AbstractMerchantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/merchant/AbstractMerchantEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.merchant; +package org.geysermc.geyser.entity.living.merchant; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.AgeableEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.AgeableEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/merchant/VillagerEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/merchant/VillagerEntity.java index c231e8e86..95a796e04 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/merchant/VillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/merchant/VillagerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.merchant; +package org.geysermc.geyser.entity.living.merchant; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; @@ -36,9 +36,9 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import lombok.Getter; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.BlockRegistries; import java.util.Optional; import java.util.UUID; @@ -120,7 +120,7 @@ public class VillagerEntity extends AbstractMerchantEntity { } // The bed block - int blockId = session.getConnector().getWorldManager().getBlockAt(session, bedPosition); + int blockId = session.getGeyser().getWorldManager().getBlockAt(session, bedPosition); String fullIdentifier = BlockRegistries.JAVA_IDENTIFIERS.get().get(blockId); // Set the correct position offset and rotation when sleeping diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/AbstractSkeletonEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/AbstractSkeletonEntity.java index abbe8b6d3..993867ca9 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/AbstractSkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/AbstractSkeletonEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/BasePiglinEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/BasePiglinEntity.java index a9b274875..664948bcd 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/BasePiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/BasePiglinEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.DimensionUtils; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/BlazeEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/BlazeEntity.java index 5eed05db9..963cfb508 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/BlazeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/BlazeEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/CreeperEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/CreeperEntity.java index 0b05d8822..760cfb58e 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/CreeperEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ElderGuardianEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/ElderGuardianEntity.java index ce98218cd..f2cb030ed 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/ElderGuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ElderGuardianEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonEntity.java index 12d0c4f3a..379a166e9 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -33,11 +33,11 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; import lombok.Data; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.Tickable; -import org.geysermc.connector.entity.living.MobEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.Tickable; +import org.geysermc.geyser.entity.living.MobEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.DimensionUtils; import java.util.Random; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonPartEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonPartEntity.java index ed1985057..088b7d721 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/EnderDragonPartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonPartEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.network.session.GeyserSession; public class EnderDragonPartEntity extends Entity { diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/EndermanEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/EndermanEntity.java index 744e2480c..b007c1ced 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/EndermanEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/EndermanEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -32,8 +32,8 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/GhastEntity.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/GhastEntity.java index 7c13ec577..ccb320311 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/GhastEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/GhastEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.FlyingEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.FlyingEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/GiantEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/GiantEntity.java index 0b1f894f1..7f99d4de0 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/GiantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/GiantEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/GuardianEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/GuardianEntity.java index 0c4156e71..cbfeab8f2 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/GuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/GuardianEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/MonsterEntity.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/MonsterEntity.java index d83b72cd0..e4b811b20 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/MonsterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/MonsterEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.CreatureEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.CreatureEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/PhantomEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/PhantomEntity.java index f9136f701..ba1975aed 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/PhantomEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.FlyingEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.FlyingEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/PiglinEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/PiglinEntity.java index ab0625e64..1d1aa5652 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/PiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/PiglinEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ShulkerEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/ShulkerEntity.java index e881e252f..047b272c2 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/ShulkerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ShulkerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; @@ -31,9 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.GolemEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.GolemEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/SkeletonEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/SkeletonEntity.java index 63b021ba3..ce1ecb8be 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/SkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/SkeletonEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/SpiderEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/SpiderEntity.java index 45e963618..9a51057d4 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/SpiderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/SpiderEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/VexEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/VexEntity.java index 2582665a7..ddd31c655 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/VexEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/VexEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/WitherEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/WitherEntity.java index 0dd6565f2..ea889d573 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/WitherEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/WitherEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZoglinEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/ZoglinEntity.java index 07876673d..cc5e21898 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZoglinEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieEntity.java index d2b25ce8f..b52c888da 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieVillagerEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieVillagerEntity.java index b78aff8d8..38472e03c 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombieVillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieVillagerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; @@ -31,9 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.merchant.VillagerEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.merchant.VillagerEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombifiedPiglinEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombifiedPiglinEntity.java index ddfd3184b..8b25467f7 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/ZombifiedPiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombifiedPiglinEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster; +package org.geysermc.geyser.entity.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/AbstractIllagerEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/AbstractIllagerEntity.java index 8350ae775..514ee276a 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/AbstractIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/AbstractIllagerEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster.raid; +package org.geysermc.geyser.entity.living.monster.raid; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/PillagerEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/PillagerEntity.java index d2cb661c6..6b4f97151 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/PillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/PillagerEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster.raid; +package org.geysermc.geyser.entity.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/RaidParticipantEntity.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/RaidParticipantEntity.java index fcfd50425..4e2fb2597 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/RaidParticipantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/RaidParticipantEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster.raid; +package org.geysermc.geyser.entity.living.monster.raid; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.living.monster.MonsterEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.living.monster.MonsterEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/SpellcasterIllagerEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/SpellcasterIllagerEntity.java index 6c91b1720..56099085f 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/SpellcasterIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/SpellcasterIllagerEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster.raid; +package org.geysermc.geyser.entity.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/VindicatorEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/VindicatorEntity.java index db2225f37..49028dc23 100644 --- a/core/src/main/java/org/geysermc/connector/entity/living/monster/raid/VindicatorEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/VindicatorEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.living.monster.raid; +package org.geysermc.geyser.entity.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/player/PlayerEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/player/PlayerEntity.java index 946ee2549..93b033118 100644 --- a/core/src/main/java/org/geysermc/connector/entity/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/player/PlayerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.player; +package org.geysermc.geyser.entity.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; @@ -47,17 +47,17 @@ import com.nukkitx.protocol.bedrock.packet.*; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.entity.living.animal.tameable.ParrotEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.scoreboard.Objective; -import org.geysermc.connector.scoreboard.Score; -import org.geysermc.connector.scoreboard.Team; -import org.geysermc.connector.scoreboard.UpdateType; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.LivingEntity; +import org.geysermc.geyser.entity.living.animal.tameable.ParrotEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.scoreboard.Objective; +import org.geysermc.geyser.scoreboard.Score; +import org.geysermc.geyser.scoreboard.Team; +import org.geysermc.geyser.scoreboard.UpdateType; import javax.annotation.Nullable; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/player/SessionPlayerEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/player/SessionPlayerEntity.java index 9a367874e..ea0ec9cd3 100644 --- a/core/src/main/java/org/geysermc/connector/entity/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/player/SessionPlayerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.player; +package org.geysermc.geyser.entity.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; @@ -38,9 +38,9 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Getter; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.AttributeUtils; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.AttributeUtils; import java.util.Collections; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/player/SkullPlayerEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/player/SkullPlayerEntity.java index e6c5cdfb3..d6054d528 100644 --- a/core/src/main/java/org/geysermc/connector/entity/player/SkullPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/player/SkullPlayerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.entity.player; +package org.geysermc.geyser.entity.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.nukkitx.math.vector.Vector3f; @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; /** * A wrapper to handle skulls more effectively - skulls have to be treated as entities since there are no diff --git a/core/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/AnvilContainer.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/AnvilContainer.java index b4f5a6d36..343cff4ef 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/AnvilContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/AnvilContainer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/BeaconContainer.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/BeaconContainer.java index 7f6463714..5e9282d7f 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/BeaconContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/BeaconContainer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/CartographyContainer.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/CartographyContainer.java index 6743cd0c9..de7a861d5 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/CartographyContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/CartographyContainer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; diff --git a/core/src/main/java/org/geysermc/connector/inventory/Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Container.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/inventory/Container.java rename to core/src/main/java/org/geysermc/geyser/inventory/Container.java index d992ba224..48241a0e5 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Container.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; /** * Combination of {@link Inventory} and {@link PlayerInventory} diff --git a/core/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java index 985f293ac..6be1f79c3 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/EnchantingContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; diff --git a/core/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java rename to core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java index f709ad998..06cb88935 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/Generic3X3Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public class Generic3X3Container extends Container { /** * Whether we need to set the container type as {@link com.nukkitx.protocol.bedrock.data.inventory.ContainerType#DROPPER}. * - * Used at {@link org.geysermc.connector.network.translators.inventory.translators.Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} + * Used at {@link org.geysermc.geyser.network.translators.inventory.translators.Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} */ @Getter private boolean isDropper = false; diff --git a/core/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java rename to core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java index 68f65f9af..5af40eb21 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/GeyserEnchantOption.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.nukkitx.protocol.bedrock.data.inventory.EnchantData; import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Arrays; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java rename to core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java index c2c17016c..82c6d89cc 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import lombok.Data; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; import javax.annotation.Nonnull; diff --git a/core/src/main/java/org/geysermc/connector/inventory/Inventory.java b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/inventory/Inventory.java rename to core/src/main/java/org/geysermc/geyser/inventory/Inventory.java index 545585335..98e101ea7 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/Inventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.opennbt.tag.builtin.ByteTag; @@ -33,8 +33,8 @@ import com.nukkitx.math.vector.Vector3i; import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Arrays; @@ -96,7 +96,7 @@ public class Inventory { public GeyserItemStack getItem(int slot) { if (slot > this.size) { - GeyserConnector.getInstance().getLogger().debug("Tried to get an item out of bounds! " + this); + GeyserImpl.getInstance().getLogger().debug("Tried to get an item out of bounds! " + this); return GeyserItemStack.EMPTY; } return items[slot]; @@ -104,7 +104,7 @@ public class Inventory { public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { if (slot > this.size) { - session.getConnector().getLogger().debug("Tried to set an item out of bounds! " + this); + session.getGeyser().getLogger().debug("Tried to set an item out of bounds! " + this); return; } GeyserItemStack oldItem = items[slot]; diff --git a/core/src/main/java/org/geysermc/connector/inventory/LecternContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/inventory/LecternContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java index 1a5ac635e..74d853ab6 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/LecternContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/LecternContainer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.math.vector.Vector3i; diff --git a/core/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java index fd3be0bd2..769a74028 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/MerchantContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.entity.Entity; +import org.geysermc.geyser.entity.Entity; @Getter @Setter diff --git a/core/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java rename to core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java index 76b2e5fbe..8bc3d9c2d 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/PlayerInventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; public class PlayerInventory extends Inventory { @@ -57,7 +57,7 @@ public class PlayerInventory extends Inventory { public GeyserItemStack getItemInHand() { if (36 + heldItemSlot > this.size) { - GeyserConnector.getInstance().getLogger().debug("Held item slot was larger than expected!"); + GeyserImpl.getInstance().getLogger().debug("Held item slot was larger than expected!"); return GeyserItemStack.EMPTY; } return items[36 + heldItemSlot]; @@ -65,7 +65,7 @@ public class PlayerInventory extends Inventory { public void setItemInHand(@NonNull GeyserItemStack item) { if (36 + heldItemSlot > this.size) { - GeyserConnector.getInstance().getLogger().debug("Held item slot was larger than expected!"); + GeyserImpl.getInstance().getLogger().debug("Held item slot was larger than expected!"); return; } items[36 + heldItemSlot] = item; diff --git a/core/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java rename to core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java index b818fe77d..576823118 100644 --- a/core/src/main/java/org/geysermc/connector/inventory/StonecutterContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.inventory; +package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public class StonecutterContainer extends Container { /** diff --git a/core/src/main/java/org/geysermc/connector/metrics/Metrics.java b/core/src/main/java/org/geysermc/geyser/metrics/Metrics.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/metrics/Metrics.java rename to core/src/main/java/org/geysermc/geyser/metrics/Metrics.java index b33afaec0..bc69cd65d 100644 --- a/core/src/main/java/org/geysermc/connector/metrics/Metrics.java +++ b/core/src/main/java/org/geysermc/geyser/metrics/Metrics.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.metrics; +package org.geysermc.geyser.metrics; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.geysermc.connector.GeyserConnector; +import org.geysermc.geyser.GeyserImpl; import javax.net.ssl.HttpsURLConnection; import java.io.ByteArrayOutputStream; @@ -76,19 +76,19 @@ public class Metrics { private final static ObjectMapper mapper = new ObjectMapper(); - private final GeyserConnector connector; + private final GeyserImpl geyser; /** * Class constructor. * - * @param connector The GeyserConnector instance + * @param geyser The Geyser instance * @param name The name of the server software. * @param serverUUID The uuid of the server. * @param logFailedRequests Whether failed requests should be logged or not. * @param logger The logger for the failed requests. */ - public Metrics(GeyserConnector connector, String name, String serverUUID, boolean logFailedRequests, Logger logger) { - this.connector = connector; + public Metrics(GeyserImpl geyser, String name, String serverUUID, boolean logFailedRequests, Logger logger) { + this.geyser = geyser; this.name = name; this.serverUUID = serverUUID; Metrics.logFailedRequests = logFailedRequests; @@ -114,7 +114,7 @@ public class Metrics { * Starts the Scheduler which submits our data every 30 minutes. */ private void startSubmitting() { - connector.getScheduledThread().scheduleAtFixedRate(this::submitData, 1, 30, TimeUnit.MINUTES); + geyser.getScheduledThread().scheduleAtFixedRate(this::submitData, 1, 30, TimeUnit.MINUTES); // Submit the data every 30 minutes, first time after 1 minutes to give other plugins enough time to start // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! // WARNING: Just don't do it! @@ -129,7 +129,7 @@ public class Metrics { ObjectNode data = mapper.createObjectNode(); data.put("pluginName", name); // Append the name of the server software - data.put("pluginVersion", GeyserConnector.VERSION); // Append the name of the server software + data.put("pluginVersion", GeyserImpl.VERSION); // Append the name of the server software ArrayNode customCharts = mapper.createArrayNode(); for (CustomChart customChart : charts) { diff --git a/core/src/main/java/org/geysermc/connector/network/CIDRMatcher.java b/core/src/main/java/org/geysermc/geyser/network/CIDRMatcher.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/CIDRMatcher.java rename to core/src/main/java/org/geysermc/geyser/network/CIDRMatcher.java index 57e58ecc2..b29b12873 100644 --- a/core/src/main/java/org/geysermc/connector/network/CIDRMatcher.java +++ b/core/src/main/java/org/geysermc/geyser/network/CIDRMatcher.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network; +package org.geysermc.geyser.network; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/core/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java similarity index 77% rename from core/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java rename to core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java index bf7153319..fff852ad2 100644 --- a/core/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network; +package org.geysermc.geyser.network; import com.nukkitx.protocol.bedrock.BedrockPong; import com.nukkitx.protocol.bedrock.BedrockServerEventHandler; @@ -33,13 +33,13 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.socket.DatagramPacket; import io.netty.util.concurrent.DefaultThreadFactory; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.ping.IGeyserPingPassthrough; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import org.geysermc.geyser.utils.LanguageUtils; import javax.annotation.Nonnull; import java.net.InetSocketAddress; @@ -51,26 +51,26 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { The following constants are all used to ensure the ping does not reach a length where it is unparsable by the Bedrock client */ private static final int MINECRAFT_VERSION_BYTES_LENGTH = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length; - private static final int BRAND_BYTES_LENGTH = GeyserConnector.NAME.getBytes(StandardCharsets.UTF_8).length; + private static final int BRAND_BYTES_LENGTH = GeyserImpl.NAME.getBytes(StandardCharsets.UTF_8).length; /** * The MOTD, sub-MOTD and Minecraft version ({@link #MINECRAFT_VERSION_BYTES_LENGTH}) combined cannot reach this length. */ private static final int MAGIC_RAKNET_LENGTH = 338; - private final GeyserConnector connector; + private final GeyserImpl geyser; // There is a constructor that doesn't require inputting threads, but older Netty versions don't have it private final DefaultEventLoopGroup eventLoopGroup = new DefaultEventLoopGroup(0, new DefaultThreadFactory("Geyser player thread")); - public ConnectorServerEventHandler(GeyserConnector connector) { - this.connector = connector; + public ConnectorServerEventHandler(GeyserImpl geyser) { + this.geyser = geyser; } @Override public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) { - List allowedProxyIPs = connector.getConfig().getBedrock().getProxyProtocolWhitelistedIPs(); - if (connector.getConfig().getBedrock().isEnableProxyProtocol() && !allowedProxyIPs.isEmpty()) { + List allowedProxyIPs = geyser.getConfig().getBedrock().getProxyProtocolWhitelistedIPs(); + if (geyser.getConfig().getBedrock().isEnableProxyProtocol() && !allowedProxyIPs.isEmpty()) { boolean isWhitelistedIP = false; - for (CIDRMatcher matcher : connector.getConfig().getBedrock().getWhitelistedIPsMatchers()) { + for (CIDRMatcher matcher : geyser.getConfig().getBedrock().getWhitelistedIPsMatchers()) { if (matcher.matches(inetSocketAddress.getAddress())) { isWhitelistedIP = true; break; @@ -82,21 +82,21 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } } - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.attempt_connect", inetSocketAddress)); + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.attempt_connect", inetSocketAddress)); return true; } @Override public BedrockPong onQuery(InetSocketAddress inetSocketAddress) { - if (connector.getConfig().isDebugMode()) { - connector.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.network.pinged", inetSocketAddress)); + if (geyser.getConfig().isDebugMode()) { + geyser.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.network.pinged", inetSocketAddress)); } - GeyserConfiguration config = connector.getConfig(); + GeyserConfiguration config = geyser.getConfig(); GeyserPingInfo pingInfo = null; if (config.isPassthroughMotd() || config.isPassthroughPlayerCounts()) { - IGeyserPingPassthrough pingPassthrough = connector.getBootstrap().getGeyserPingPassthrough(); + IGeyserPingPassthrough pingPassthrough = geyser.getBootstrap().getGeyserPingPassthrough(); pingInfo = pingPassthrough.getPingInformation(inetSocketAddress); } @@ -111,7 +111,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { if (config.isPassthroughMotd() && pingInfo != null && pingInfo.getDescription() != null) { String[] motd = MessageTranslator.convertMessageLenient(pingInfo.getDescription()).split("\n"); String mainMotd = motd[0]; // First line of the motd. - String subMotd = (motd.length != 1) ? motd[1] : GeyserConnector.NAME; // Second line of the motd if present, otherwise default. + String subMotd = (motd.length != 1) ? motd[1] : GeyserImpl.NAME; // Second line of the motd if present, otherwise default. pong.setMotd(mainMotd.trim()); pong.setSubMotd(subMotd.trim()); // Trimmed to shift it to the left, prevents the universe from collapsing on us just because we went 2 characters over the text box's limit. @@ -124,17 +124,17 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { pong.setPlayerCount(pingInfo.getPlayers().getOnline()); pong.setMaximumPlayerCount(pingInfo.getPlayers().getMax()); } else { - pong.setPlayerCount(connector.getSessionManager().getSessions().size()); + pong.setPlayerCount(geyser.getSessionManager().getSessions().size()); pong.setMaximumPlayerCount(config.getMaxPlayers()); } // Fallbacks to prevent errors and allow Bedrock to see the server if (pong.getMotd() == null || pong.getMotd().isBlank()) { - pong.setMotd(GeyserConnector.NAME); + pong.setMotd(GeyserImpl.NAME); } if (pong.getSubMotd() == null || pong.getSubMotd().isBlank()) { // Sub-MOTD cannot be empty as of 1.16.210.59 - pong.setSubMotd(GeyserConnector.NAME); + pong.setSubMotd(GeyserImpl.NAME); } // The ping will not appear if the MOTD + sub-MOTD is of a certain length. @@ -144,7 +144,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { if (motdArray.length + subMotdLength > (MAGIC_RAKNET_LENGTH - MINECRAFT_VERSION_BYTES_LENGTH)) { // Shorten the sub-MOTD first since that only appears locally if (subMotdLength > BRAND_BYTES_LENGTH) { - pong.setSubMotd(GeyserConnector.NAME); + pong.setSubMotd(GeyserImpl.NAME); subMotdLength = BRAND_BYTES_LENGTH; } if (motdArray.length > (MAGIC_RAKNET_LENGTH - MINECRAFT_VERSION_BYTES_LENGTH - subMotdLength)) { @@ -167,8 +167,8 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { @Override public void onSessionCreation(BedrockServerSession bedrockServerSession) { bedrockServerSession.setLogging(true); - bedrockServerSession.setCompressionLevel(connector.getConfig().getBedrock().getCompressionLevel()); - bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession, eventLoopGroup.next()))); + bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel()); + bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next()))); // Set the packet codec to default just in case we need to send disconnect packets. bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC); } @@ -177,7 +177,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { public void onUnhandledDatagram(@Nonnull ChannelHandlerContext ctx, DatagramPacket packet) { ByteBuf content = packet.content(); if (QueryPacketHandler.isQueryPacket(content)) { - new QueryPacketHandler(connector, packet.sender(), content); + new QueryPacketHandler(geyser, packet.sender(), content); } } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java rename to core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index 9be9dc9c8..83994f11c 100644 --- a/core/src/main/java/org/geysermc/connector/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network; +package org.geysermc.geyser.network; import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; /** * Bare bones implementation of BedrockPacketHandler suitable for extension. @@ -38,16 +38,16 @@ import org.geysermc.connector.network.session.GeyserSession; * packets of interest and limit boilerplate code. */ public class LoggingPacketHandler implements BedrockPacketHandler { - protected final GeyserConnector connector; + protected final GeyserImpl geyser; protected final GeyserSession session; - LoggingPacketHandler(GeyserConnector connector, GeyserSession session) { - this.connector = connector; + LoggingPacketHandler(GeyserImpl geyser, GeyserSession session) { + this.geyser = geyser; this.session = session; } boolean defaultHandler(BedrockPacket packet) { - connector.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName()); + geyser.getLogger().debug("Handled packet: " + packet.getClass().getSimpleName()); return false; } diff --git a/core/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java rename to core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java index d513f28df..a9df533d5 100644 --- a/core/src/main/java/org/geysermc/connector/network/MinecraftProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network; +package org.geysermc.geyser.network; import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.PacketCodec; diff --git a/core/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java similarity index 83% rename from core/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java rename to core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java index 7c696c36d..e29cf5627 100644 --- a/core/src/main/java/org/geysermc/connector/network/QueryPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network; +package org.geysermc.geyser.network; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -49,7 +49,7 @@ public class QueryPacketHandler { public static final byte HANDSHAKE = 0x09; public static final byte STATISTICS = 0x00; - private final GeyserConnector connector; + private final GeyserImpl geyser; private final InetSocketAddress sender; private final byte type; private final int sessionId; @@ -59,12 +59,12 @@ public class QueryPacketHandler { * The Query packet handler instance. The unsigned short magic handshake should already be read at this point, * and the packet should be verified to have enough buffer space to be a qualified query packet. * - * @param connector Geyser Connector + * @param geyser Geyser * @param sender The Sender IP/Port for the Query * @param buffer The Query data */ - public QueryPacketHandler(GeyserConnector connector, InetSocketAddress sender, ByteBuf buffer) { - this.connector = connector; + public QueryPacketHandler(GeyserImpl geyser, InetSocketAddress sender, ByteBuf buffer) { + this.geyser = geyser; this.sender = sender; this.type = buffer.readByte(); this.sessionId = buffer.readInt(); @@ -143,31 +143,31 @@ public class QueryPacketHandler { String maxPlayerCount; String map; - if (connector.getConfig().isPassthroughMotd() || connector.getConfig().isPassthroughPlayerCounts()) { - pingInfo = connector.getBootstrap().getGeyserPingPassthrough().getPingInformation(); + if (geyser.getConfig().isPassthroughMotd() || geyser.getConfig().isPassthroughPlayerCounts()) { + pingInfo = geyser.getBootstrap().getGeyserPingPassthrough().getPingInformation(); } - if (connector.getConfig().isPassthroughMotd() && pingInfo != null) { + if (geyser.getConfig().isPassthroughMotd() && pingInfo != null) { String[] javaMotd = MessageTranslator.convertMessageLenient(pingInfo.getDescription()).split("\n"); motd = javaMotd[0].trim(); // First line of the motd. } else { - motd = connector.getConfig().getBedrock().getMotd1(); + motd = geyser.getConfig().getBedrock().getMotd1(); } // If passthrough player counts is enabled lets get players from the server - if (connector.getConfig().isPassthroughPlayerCounts() && pingInfo != null) { + if (geyser.getConfig().isPassthroughPlayerCounts() && pingInfo != null) { currentPlayerCount = String.valueOf(pingInfo.getPlayers().getOnline()); maxPlayerCount = String.valueOf(pingInfo.getPlayers().getMax()); } else { - currentPlayerCount = String.valueOf(connector.getSessionManager().getSessions().size()); - maxPlayerCount = String.valueOf(connector.getConfig().getMaxPlayers()); + currentPlayerCount = String.valueOf(geyser.getSessionManager().getSessions().size()); + maxPlayerCount = String.valueOf(geyser.getConfig().getMaxPlayers()); } // If passthrough protocol name is enabled let's get the protocol name from the ping response. - if (connector.getConfig().isPassthroughProtocolName() && pingInfo != null) { + if (geyser.getConfig().isPassthroughProtocolName() && pingInfo != null) { map = pingInfo.getVersion().getName(); } else { - map = GeyserConnector.NAME; + map = GeyserImpl.NAME; } // Create a hashmap of all game data needed in the query @@ -175,13 +175,13 @@ public class QueryPacketHandler { gameData.put("hostname", motd); gameData.put("gametype", "SMP"); gameData.put("game_id", "MINECRAFT"); - gameData.put("version", GeyserConnector.NAME + " (" + GeyserConnector.GIT_VERSION + ") " + MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); + gameData.put("version", GeyserImpl.NAME + " (" + GeyserImpl.GIT_VERSION + ") " + MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); gameData.put("plugins", ""); gameData.put("map", map); gameData.put("numplayers", currentPlayerCount); gameData.put("maxplayers", maxPlayerCount); - gameData.put("hostport", String.valueOf(connector.getConfig().getBedrock().getPort())); - gameData.put("hostip", connector.getConfig().getBedrock().getAddress()); + gameData.put("hostport", String.valueOf(geyser.getConfig().getBedrock().getPort())); + gameData.put("hostip", geyser.getConfig().getBedrock().getAddress()); try { writeString(query, "GeyserMC"); @@ -212,8 +212,8 @@ public class QueryPacketHandler { ByteArrayOutputStream query = new ByteArrayOutputStream(); GeyserPingInfo pingInfo = null; - if (connector.getConfig().isPassthroughMotd() || connector.getConfig().isPassthroughPlayerCounts()) { - pingInfo = connector.getBootstrap().getGeyserPingPassthrough().getPingInformation(); + if (geyser.getConfig().isPassthroughMotd() || geyser.getConfig().isPassthroughPlayerCounts()) { + pingInfo = geyser.getBootstrap().getGeyserPingPassthrough().getPingInformation(); } try { @@ -255,7 +255,7 @@ public class QueryPacketHandler { * @param data packet data */ private void sendPacket(ByteBuf data) { - connector.getBedrockServer().getRakNet().send(sender, data); + geyser.getBedrockServer().getRakNet().send(sender, data); } /** diff --git a/core/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java rename to core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index 773f2cc5c..701f42219 100644 --- a/core/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network; +package org.geysermc.geyser.network; import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; @@ -31,22 +31,22 @@ import com.nukkitx.protocol.bedrock.data.ExperimentData; import com.nukkitx.protocol.bedrock.data.ResourcePackType; import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslatorRegistry; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.*; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslatorRegistry; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.*; import java.io.FileInputStream; import java.io.InputStream; public class UpstreamPacketHandler extends LoggingPacketHandler { - public UpstreamPacketHandler(GeyserConnector connector, GeyserSession session) { - super(connector, session); + public UpstreamPacketHandler(GeyserImpl geyser, GeyserSession session) { + super(geyser, session); } private boolean translateAndDefault(BedrockPacket packet) { @@ -60,7 +60,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { @Override public boolean handle(LoginPacket loginPacket) { - if (connector.isShuttingDown()) { + if (geyser.isShuttingDown()) { // Don't allow new players in if we're no longer operating session.disconnect(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.message")); return true; @@ -71,11 +71,11 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { String supportedVersions = MinecraftProtocol.getAllSupportedVersions(); if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { // Too early to determine session locale - session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); + session.getGeyser().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); return true; } else if (loginPacket.getProtocolVersion() < MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { - session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); + session.getGeyser().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); return true; } @@ -93,7 +93,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS); session.sendUpstreamPacket(playStatus); - connector.getSessionManager().addPendingSession(session); + geyser.getSessionManager().addPendingSession(session); ResourcePacksInfoPacket resourcePacksInfo = new ResourcePacksInfoPacket(); for(ResourcePack resourcePack : ResourcePack.PACKS.values()) { @@ -102,7 +102,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { header.getUuid().toString(), header.getVersionString(), resourcePack.getFile().length(), "", "", "", false, false)); } - resourcePacksInfo.setForcedToAccept(GeyserConnector.getInstance().getConfig().isForceResourcePacks()); + resourcePacksInfo.setForcedToAccept(GeyserImpl.getInstance().getConfig().isForceResourcePacks()); session.sendUpstreamPacket(resourcePacksInfo); LanguageUtils.loadGeyserLocale(session.getLocale()); @@ -113,13 +113,13 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { public boolean handle(ResourcePackClientResponsePacket packet) { switch (packet.getStatus()) { case COMPLETED: - if (connector.getConfig().getRemote().getAuthType() != AuthType.ONLINE) { + if (geyser.getConfig().getRemote().getAuthType() != AuthType.ONLINE) { session.authenticate(session.getAuthData().getName()); } else if (!couldLoginUserByName(session.getAuthData().getName())) { // We must spawn the white world session.connect(); } - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.connect", session.getAuthData().getName())); + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.connect", session.getAuthData().getName())); break; case SEND_PACKS: @@ -182,11 +182,11 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { } private boolean couldLoginUserByName(String bedrockUsername) { - if (connector.getConfig().getUserAuths() != null) { - GeyserConfiguration.IUserAuthenticationInfo info = connector.getConfig().getUserAuths().get(bedrockUsername); + if (geyser.getConfig().getUserAuths() != null) { + GeyserConfiguration.IUserAuthenticationInfo info = geyser.getConfig().getUserAuths().get(bedrockUsername); if (info != null) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().getName())); + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().getName())); session.setMicrosoftAccount(info.isMicrosoftAccount()); session.authenticate(info.getEmail(), info.getPassword()); return true; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java new file mode 100644 index 000000000..161ddb52e --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java @@ -0,0 +1,1465 @@ +/* + * Copyright (c) 2019-2021 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.network.session; + +import com.github.steveice10.mc.auth.data.GameProfile; +import com.github.steveice10.mc.auth.exception.request.AuthPendingException; +import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException; +import com.github.steveice10.mc.auth.exception.request.RequestException; +import com.github.steveice10.mc.auth.service.AuthenticationService; +import com.github.steveice10.mc.auth.service.MojangAuthenticationService; +import com.github.steveice10.mc.auth.service.MsaAuthenticationService; +import com.github.steveice10.mc.protocol.MinecraftConstants; +import com.github.steveice10.mc.protocol.MinecraftProtocol; +import com.github.steveice10.mc.protocol.data.ProtocolState; +import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; +import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; +import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; +import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; +import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; +import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; +import com.github.steveice10.packetlib.BuiltinFlags; +import com.github.steveice10.packetlib.event.session.*; +import com.github.steveice10.packetlib.packet.Packet; +import com.github.steveice10.packetlib.tcp.TcpClientSession; +import com.github.steveice10.packetlib.tcp.TcpSession; +import com.nukkitx.math.GenericMath; +import com.nukkitx.math.vector.*; +import com.nukkitx.protocol.bedrock.BedrockPacket; +import com.nukkitx.protocol.bedrock.BedrockServerSession; +import com.nukkitx.protocol.bedrock.data.*; +import com.nukkitx.protocol.bedrock.data.command.CommandPermission; +import com.nukkitx.protocol.bedrock.data.entity.EntityData; +import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; +import com.nukkitx.protocol.bedrock.packet.*; +import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; +import io.netty.channel.Channel; +import io.netty.channel.EventLoop; +import it.unimi.dsi.fastutil.ints.*; +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectIterator; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import org.geysermc.common.PlatformType; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandSender; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.common.connection.LocalSession; +import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.ItemFrameEntity; +import org.geysermc.geyser.entity.Tickable; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.entity.player.SkullPlayerEntity; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.auth.AuthData; +import org.geysermc.geyser.network.session.auth.BedrockClientData; +import org.geysermc.geyser.network.session.cache.*; +import org.geysermc.geyser.network.translators.PacketTranslatorRegistry; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.collision.CollisionManager; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.BlockMappings; +import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.skin.FloodgateSkinUploader; +import org.geysermc.geyser.utils.*; +import org.geysermc.cumulus.Form; +import org.geysermc.cumulus.util.FormBuilder; +import org.geysermc.floodgate.crypto.FloodgateCipher; +import org.geysermc.floodgate.util.BedrockData; + +import java.net.ConnectException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +@Getter +public class GeyserSession implements CommandSender { + + private final GeyserImpl geyser; + private final UpstreamSession upstream; + /** + * The loop where all packets and ticking is processed to prevent concurrency issues. + * If this is manually called, ensure that any exceptions are properly handled. + */ + private final EventLoop eventLoop; + private TcpSession downstream; + @Setter + private AuthData authData; + @Setter + private BedrockClientData clientData; + + /* Setter for GeyserConnect */ + @Setter + private String remoteAddress; + @Setter + private int remotePort; + @Setter + private AuthType remoteAuthType; + /* Setter for GeyserConnect */ + + @Deprecated + @Setter + private boolean microsoftAccount; + + private final SessionPlayerEntity playerEntity; + + private final AdvancementsCache advancementsCache; + private final BookEditCache bookEditCache; + private final ChunkCache chunkCache; + private final EntityCache entityCache; + private final EntityEffectCache effectCache; + private final FormCache formCache; + private final LodestoneCache lodestoneCache; + private final PistonCache pistonCache; + private final PreferencesCache preferencesCache; + private final TagCache tagCache; + private final WorldCache worldCache; + + private final Int2ObjectMap teleportMap = new Int2ObjectOpenHashMap<>(); + + private final WorldBorder worldBorder; + /** + * Whether simulated fog has been sent to the client or not. + */ + private boolean isInWorldBorderWarningArea = false; + + private final PlayerInventory playerInventory; + @Setter + private Inventory openInventory; + @Setter + private boolean closingInventory; + + @Setter + private InventoryTranslator inventoryTranslator = InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR; + + /** + * Use {@link #getNextItemNetId()} instead for consistency + */ + @Getter(AccessLevel.NONE) + private final AtomicInteger itemNetId = new AtomicInteger(2); + + @Setter + private ScheduledFuture craftingGridFuture; + + /** + * Stores session collision + */ + private final CollisionManager collisionManager; + + /** + * Stores the block mappings for this specific version. + */ + @Setter + private BlockMappings blockMappings; + + /** + * Stores the item translations for this specific version. + */ + @Setter + private ItemMappings itemMappings; + + private final Map skullCache = new Object2ObjectOpenHashMap<>(); + private final Long2ObjectMap storedMaps = new Long2ObjectOpenHashMap<>(); + + /** + * Required to decode biomes correctly. + */ + @Setter + private int biomeGlobalPalette; + /** + * Stores the map between Java and Bedrock biome network IDs. + */ + private final Int2IntMap biomeTranslations = new Int2IntOpenHashMap(); + + /** + * A map of Vector3i positions to Java entities. + * Used for translating Bedrock block actions to Java entity actions. + */ + private final Map itemFrameCache = new Object2ObjectOpenHashMap<>(); + + /** + * Stores a list of all lectern locations and their block entity tags. + * See {@link org.geysermc.geyser.network.translators.world.WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} + * for more information. + */ + private final Set lecternCache; + + @Setter + private boolean droppingLecternBook; + + @Setter + private Vector2i lastChunkPosition = null; + private int renderDistance; + + private boolean sentSpawnPacket; + + private boolean loggedIn; + private boolean loggingIn; + + @Setter + private boolean spawned; + /** + * Accessed on the initial Java and Bedrock packet processing threads + */ + private volatile boolean closed; + + @Setter + private GameMode gameMode = GameMode.SURVIVAL; + + /** + * Keeps track of the world name for respawning. + */ + @Setter + private String worldName = null; + + private boolean sneaking; + + /** + * Stores the Java pose that the server and/or Geyser believes the player currently has. + */ + @Setter + private Pose pose = Pose.STANDING; + + @Setter + private boolean sprinting; + + /** + * Whether the player is swimming in water. + * Used to update speed when crawling. + */ + @Setter + private boolean swimmingInWater; + + /** + * Tracks the original speed attribute. + * + * We need to do this in order to emulate speeds when sneaking under 1.5-blocks-tall areas if the player isn't sneaking, + * and when crawling. + */ + @Setter + private float originalSpeedAttribute; + + /** + * The dimension of the player. + * As all entities are in the same world, this can be safely applied to all other entities. + */ + @Setter + private String dimension = DimensionUtils.OVERWORLD; + + @Setter + private int breakingBlock; + + @Setter + private Vector3i lastBlockPlacePosition; + + @Setter + private String lastBlockPlacedId; + + @Setter + private boolean interacting; + + /** + * Stores the last position of the block the player interacted with. This can either be a block that the client + * placed or an existing block the player interacted with (for example, a chest).
+ * Initialized as (0, 0, 0) so it is always not-null. + */ + @Setter + private Vector3i lastInteractionBlockPosition = Vector3i.ZERO; + + /** + * Stores the position of the player the last time they interacted. + * Used to verify that the player did not move since their last interaction.
+ * Initialized as (0, 0, 0) so it is always not-null. + */ + @Setter + private Vector3f lastInteractionPlayerPosition = Vector3f.ZERO; + + @Setter + private Entity ridingVehicleEntity; + + /** + * The entity that the client is currently looking at. + */ + @Setter + private Entity mouseoverEntity; + + @Setter + private Int2ObjectMap craftingRecipes; + private final Set unlockedRecipes; + private final AtomicInteger lastRecipeNetId; + + /** + * Saves a list of all stonecutter recipes, for use in a stonecutter inventory. + * The key is the Java ID of the item; the values are all the possible outputs' Java IDs sorted by their string identifier + */ + @Setter + private Int2ObjectMap stonecutterRecipes; + + /** + * The current attack speed of the player. Used for sending proper cooldown timings. + * Setting a default fixes cooldowns not showing up on a fresh world. + */ + @Setter + private double attackSpeed = 4.0d; + /** + * The time of the last hit. Used to gauge how long the cooldown is taking. + * This is a session variable in order to prevent more scheduled threads than necessary. + */ + @Setter + private long lastHitTime; + + /** + * Saves if the client is steering left on a boat. + */ + @Setter + private boolean steeringLeft; + /** + * Saves if the client is steering right on a boat. + */ + @Setter + private boolean steeringRight; + + /** + * Store the last time the player interacted. Used to fix a right-click spam bug. + * See https://github.com/GeyserMC/Geyser/issues/503 for context. + */ + @Setter + private long lastInteractionTime; + + /** + * Stores a future interaction to place a bucket. Will be cancelled if the client instead intended to + * interact with a block. + */ + @Setter + private ScheduledFuture bucketScheduledFuture; + + /** + * Used to send a movement packet every three seconds if the player hasn't moved. Prevents timeouts when AFK in certain instances. + */ + @Setter + private long lastMovementTimestamp = System.currentTimeMillis(); + + /** + * Used to send a ServerboundMoveVehiclePacket for every PlayerInputPacket after idling on a boat/horse for more than 100ms + */ + @Setter + private long lastVehicleMoveTimestamp = System.currentTimeMillis(); + + /** + * Controls whether the daylight cycle gamerule has been sent to the client, so the sun/moon remain motionless. + */ + private boolean daylightCycle = true; + + private boolean reducedDebugInfo = false; + + /** + * The op permission level set by the server + */ + @Setter + private int opPermissionLevel = 0; + + /** + * If the current player can fly + */ + @Setter + private boolean canFly = false; + + /** + * If the current player is flying + */ + private boolean flying = false; + + /** + * Caches current rain status. + */ + @Setter + private boolean raining = false; + + /** + * Caches current thunder status. + */ + @Setter + private boolean thunder = false; + + /** + * Stores the last text inputted into a sign. + *

+ * Bedrock sends packets every time you update the sign, Java only wants the final packet. + * Until we determine that the user has finished editing, we save the sign's current status. + */ + @Setter + private String lastSignMessage; + + /** + * Stores a map of all statistics sent from the server. + * The server only sends new statistics back to us, so in order to show all statistics we need to cache existing ones. + */ + private final Map statistics = new HashMap<>(); + + /** + * Whether we're expecting statistics to be sent back to us. + */ + @Setter + private boolean waitingForStatistics = false; + + private final Set emotes; + + /** + * The thread that will run every 50 milliseconds - one Minecraft tick. + */ + private ScheduledFuture tickThread = null; + + private MinecraftProtocol protocol; + + public GeyserSession(GeyserImpl geyser, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { + this.geyser = geyser; + this.upstream = new UpstreamSession(bedrockServerSession); + this.eventLoop = eventLoop; + + this.advancementsCache = new AdvancementsCache(this); + this.bookEditCache = new BookEditCache(this); + this.chunkCache = new ChunkCache(this); + this.entityCache = new EntityCache(this); + this.effectCache = new EntityEffectCache(); + this.formCache = new FormCache(this); + this.lodestoneCache = new LodestoneCache(); + this.pistonCache = new PistonCache(this); + this.preferencesCache = new PreferencesCache(this); + this.tagCache = new TagCache(); + this.worldCache = new WorldCache(this); + + this.worldBorder = new WorldBorder(this); + + this.collisionManager = new CollisionManager(this); + + this.playerEntity = new SessionPlayerEntity(this); + collisionManager.updatePlayerBoundingBox(this.playerEntity.getPosition()); + + this.playerInventory = new PlayerInventory(); + this.openInventory = null; + this.craftingRecipes = new Int2ObjectOpenHashMap<>(); + this.unlockedRecipes = new ObjectOpenHashSet<>(); + this.lastRecipeNetId = new AtomicInteger(1); + + this.spawned = false; + this.loggedIn = false; + + if (geyser.getWorldManager().shouldExpectLecternHandled()) { + // Unneeded on these platforms + this.lecternCache = null; + } else { + this.lecternCache = new ObjectOpenHashSet<>(); + } + + if (geyser.getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.NO_EMOTES) { + this.emotes = new HashSet<>(); + geyser.getSessionManager().getSessions().values().forEach(player -> this.emotes.addAll(player.getEmotes())); + } else { + this.emotes = null; + } + + bedrockServerSession.addDisconnectHandler(disconnectReason -> { + InetAddress address = bedrockServerSession.getRealAddress().getAddress(); + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.disconnect", address, disconnectReason)); + + disconnect(disconnectReason.name()); + geyser.getSessionManager().removeSession(this); + }); + + this.remoteAddress = geyser.getConfig().getRemote().getAddress(); + this.remotePort = geyser.getConfig().getRemote().getPort(); + this.remoteAuthType = geyser.getConfig().getRemote().getAuthType(); + } + + /** + * Send all necessary packets to load Bedrock into the server + */ + public void connect() { + startGame(); + sentSpawnPacket = true; + + // Set the hardcoded shield ID to the ID we just defined in StartGamePacket + upstream.getSession().getHardcodedBlockingId().set(this.itemMappings.getStoredItems().shield().getBedrockId()); + + if (this.itemMappings.getFurnaceMinecartData() != null) { + ItemComponentPacket componentPacket = new ItemComponentPacket(); + componentPacket.getItems().add(this.itemMappings.getFurnaceMinecartData()); + upstream.sendPacket(componentPacket); + } + + ChunkUtils.sendEmptyChunks(this, playerEntity.getPosition().toInt(), 0, false); + + BiomeDefinitionListPacket biomeDefinitionListPacket = new BiomeDefinitionListPacket(); + biomeDefinitionListPacket.setDefinitions(Registries.BIOMES_NBT.get()); + upstream.sendPacket(biomeDefinitionListPacket); + + AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); + entityPacket.setIdentifiers(Registries.BEDROCK_ENTITY_IDENTIFIERS.get()); + upstream.sendPacket(entityPacket); + + CreativeContentPacket creativePacket = new CreativeContentPacket(); + creativePacket.setContents(this.itemMappings.getCreativeItems()); + upstream.sendPacket(creativePacket); + + PlayStatusPacket playStatusPacket = new PlayStatusPacket(); + playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN); + upstream.sendPacket(playStatusPacket); + + UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); + attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId()); + // Default move speed + // Bedrock clients move very fast by default until they get an attribute packet correcting the speed + attributesPacket.setAttributes(Collections.singletonList( + new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f))); + upstream.sendPacket(attributesPacket); + + GameRulesChangedPacket gamerulePacket = new GameRulesChangedPacket(); + // Only allow the server to send health information + // Setting this to false allows natural regeneration to work false but doesn't break it being true + gamerulePacket.getGameRules().add(new GameRuleData<>("naturalregeneration", false)); + // Don't let the client modify the inventory on death + // Setting this to true allows keep inventory to work if enabled but doesn't break functionality being false + gamerulePacket.getGameRules().add(new GameRuleData<>("keepinventory", true)); + // Ensure client doesn't try and do anything funky; the server handles this for us + gamerulePacket.getGameRules().add(new GameRuleData<>("spawnradius", 0)); + upstream.sendPacket(gamerulePacket); + } + + public void login() { + if (this.remoteAuthType != AuthType.ONLINE) { + if (this.remoteAuthType == AuthType.OFFLINE) { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.offline")); + } else { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.floodgate")); + } + authenticate(authData.getName()); + } + } + + public void authenticate(String username) { + authenticate(username, ""); + } + + public void authenticate(String username, String password) { + if (loggedIn) { + geyser.getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.auth.already_loggedin", username)); + return; + } + + loggingIn = true; + + // Use a future to prevent timeouts as all the authentication is handled sync + // This will be changed with the new protocol library. + CompletableFuture.supplyAsync(() -> { + try { + if (password != null && !password.isEmpty()) { + AuthenticationService authenticationService; + if (microsoftAccount) { + authenticationService = new MsaAuthenticationService(GeyserImpl.OAUTH_CLIENT_ID); + } else { + authenticationService = new MojangAuthenticationService(); + } + authenticationService.setUsername(username); + authenticationService.setPassword(password); + authenticationService.login(); + + GameProfile profile = authenticationService.getSelectedProfile(); + if (profile == null) { + // Java account is offline + disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + return null; + } + + protocol = new MinecraftProtocol(profile, authenticationService.getAccessToken()); + } else { + // always replace spaces when using Floodgate, + // as usernames with spaces cause issues with Bungeecord's login cycle. + // However, this doesn't affect the final username as Floodgate is still in charge of that. + // So if you have (for example) replace spaces enabled on Floodgate the spaces will re-appear. + String validUsername = username; + if (remoteAuthType == AuthType.FLOODGATE) { + validUsername = username.replace(' ', '_'); + } + + protocol = new MinecraftProtocol(validUsername); + } + } catch (InvalidCredentialsException | IllegalArgumentException e) { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", username)); + disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); + } catch (RequestException ex) { + disconnect(ex.getMessage()); + } + return null; + }).whenComplete((aVoid, ex) -> { + if (ex != null) { + disconnect(ex.toString()); + } + if (this.closed) { + if (ex != null) { + geyser.getLogger().error("", ex); + } + // Client disconnected during the authentication attempt + return; + } + + connectDownstream(); + }); + } + + /** + * Present a form window to the user asking to log in with another web browser + */ + public void authenticateWithMicrosoftCode() { + if (loggedIn) { + geyser.getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().getName())); + return; + } + + loggingIn = true; + + // This just looks cool + SetTimePacket packet = new SetTimePacket(); + packet.setTime(16000); + sendUpstreamPacket(packet); + + // new thread so clients don't timeout + MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserImpl.OAUTH_CLIENT_ID); + + // Use a future to prevent timeouts as all the authentication is handled sync + // This will be changed with the new protocol library. + CompletableFuture.supplyAsync(() -> { + try { + return msaAuthenticationService.getAuthCode(); + } catch (RequestException e) { + throw new CompletionException(e); + } + }).whenComplete((response, ex) -> { + if (ex != null) { + ex.printStackTrace(); + disconnect(ex.toString()); + return; + } + LoginEncryptionUtils.buildAndShowMicrosoftCodeWindow(this, response); + attemptCodeAuthentication(msaAuthenticationService); + }); + } + + /** + * Poll every second to see if the user has successfully signed in + */ + private void attemptCodeAuthentication(MsaAuthenticationService msaAuthenticationService) { + if (loggedIn || closed) { + return; + } + CompletableFuture.supplyAsync(() -> { + try { + msaAuthenticationService.login(); + GameProfile profile = msaAuthenticationService.getSelectedProfile(); + if (profile == null) { + // Java account is offline + disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + return null; + } + + return new MinecraftProtocol(profile, msaAuthenticationService.getAccessToken()); + } catch (RequestException e) { + throw new CompletionException(e); + } + }).whenComplete((response, ex) -> { + if (ex != null) { + if (!(ex instanceof CompletionException completionException) || !(completionException.getCause() instanceof AuthPendingException)) { + geyser.getLogger().error("Failed to log in with Microsoft code!", ex); + disconnect(ex.toString()); + } else { + // Wait one second before trying again + geyser.getScheduledThread().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); + } + return; + } + if (!closed) { + this.protocol = response; + connectDownstream(); + } + }); + } + + /** + * After getting whatever credentials needed, we attempt to join the Java server. + */ + private void connectDownstream() { + boolean floodgate = this.remoteAuthType == AuthType.FLOODGATE; + + // Start ticking + tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); + + if (geyser.getBootstrap().getSocketAddress() != null) { + // We're going to connect through the JVM and not through TCP + downstream = new LocalSession(this.remoteAddress, this.remotePort, + geyser.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), this.protocol); + } else { + downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol); + disableSrvResolving(); + } + + if (geyser.getConfig().getRemote().isUseProxyProtocol()) { + downstream.setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true); + downstream.setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress()); + } + if (geyser.getConfig().isForwardPlayerPing()) { + // Let Geyser handle sending the keep alive + downstream.setFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, false); + } + downstream.addListener(new SessionAdapter() { + @Override + public void packetSending(PacketSendingEvent event) { + //todo move this somewhere else + if (event.getPacket() instanceof ClientIntentionPacket) { + String addressSuffix; + if (floodgate) { + byte[] encryptedData; + + try { + FloodgateSkinUploader skinUploader = geyser.getSkinUploader(); + FloodgateCipher cipher = geyser.getCipher(); + + encryptedData = cipher.encryptFromString(BedrockData.of( + clientData.getGameVersion(), + authData.getName(), + authData.getXuid(), + clientData.getDeviceOs().ordinal(), + clientData.getLanguageCode(), + clientData.getUiProfile().ordinal(), + clientData.getCurrentInputMode().ordinal(), + upstream.getAddress().getAddress().getHostAddress(), + skinUploader.getId(), + skinUploader.getVerifyCode(), + geyser.getTimeSyncer() + ).toString()); + + if (!geyser.getTimeSyncer().hasUsefulOffset()) { + geyser.getLogger().warning( + "We couldn't make sure that your system clock is accurate. " + + "This can cause issues with logging in." + ); + } + + } catch (Exception e) { + geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); + disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.floodgate.encryption_fail", getClientData().getLanguageCode())); + return; + } + + addressSuffix = '\0' + new String(encryptedData, StandardCharsets.UTF_8); + } else { + addressSuffix = ""; + } + + ClientIntentionPacket intentionPacket = event.getPacket(); + + String address; + if (geyser.getConfig().getRemote().isForwardHost()) { + address = clientData.getServerAddress().split(":")[0]; + } else { + address = intentionPacket.getHostname(); + } + + event.setPacket(intentionPacket.withHostname(address + addressSuffix)); + } + } + + @Override + public void connected(ConnectedEvent event) { + loggingIn = false; + loggedIn = true; + + if (downstream instanceof LocalSession) { + // Connected directly to the server + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect_internal", + authData.getName(), protocol.getProfile().getName())); + } else { + // Connected to an IP address + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", + authData.getName(), protocol.getProfile().getName(), remoteAddress)); + } + + UUID uuid = protocol.getProfile().getId(); + if (uuid == null) { + // Set what our UUID *probably* is going to be + if (remoteAuthType == AuthType.FLOODGATE) { + uuid = new UUID(0, Long.parseLong(authData.getXuid())); + } else { + uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + protocol.getProfile().getName()).getBytes(StandardCharsets.UTF_8)); + } + } + playerEntity.setUuid(uuid); + playerEntity.setUsername(protocol.getProfile().getName()); + + String locale = clientData.getLanguageCode(); + + // Let the user know there locale may take some time to download + // as it has to be extracted from a JAR + if (locale.equalsIgnoreCase("en_us") && !LocaleUtils.LOCALE_MAPPINGS.containsKey("en_us")) { + // This should probably be left hardcoded as it will only show for en_us clients + sendMessage("Loading your locale (en_us); if this isn't already downloaded, this may take some time"); + } + + // Download and load the language for the player + LocaleUtils.downloadAndLoadLocale(locale); + } + + @Override + public void disconnected(DisconnectedEvent event) { + loggingIn = false; + loggedIn = false; + + String disconnectMessage; + Throwable cause = event.getCause(); + if (cause instanceof UnexpectedEncryptionException) { + if (remoteAuthType != AuthType.FLOODGATE) { + // Server expects online mode + disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", getLocale()); + // Explain that they may be looking for Floodgate. + geyser.getLogger().warning(LanguageUtils.getLocaleStringLog( + geyser.getPlatformType() == PlatformType.STANDALONE ? + "geyser.network.remote.floodgate_explanation_standalone" + : "geyser.network.remote.floodgate_explanation_plugin", + Constants.FLOODGATE_DOWNLOAD_LOCATION + )); + } else { + // Likely that Floodgate is not configured correctly. + disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", getLocale()); + if (geyser.getPlatformType() == PlatformType.STANDALONE) { + geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone")); + } + } + } else if (cause instanceof ConnectException) { + // Server is offline, probably + disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale()); + } else { + disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason()); + } + + if (downstream instanceof LocalSession) { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); + } else { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); + } + if (cause != null) { + cause.printStackTrace(); + } + + upstream.disconnect(disconnectMessage); + } + + @Override + public void packetReceived(PacketReceivedEvent event) { + Packet packet = event.getPacket(); + PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(packet.getClass(), packet, GeyserSession.this); + } + + @Override + public void packetError(PacketErrorEvent event) { + geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.downstream_error", event.getCause().getMessage())); + if (geyser.getConfig().isDebugMode()) + event.getCause().printStackTrace(); + event.setSuppress(true); + } + }); + + if (!daylightCycle) { + setDaylightCycle(true); + } + + downstream.connect(); + } + + public void disconnect(String reason) { + if (!closed) { + loggedIn = false; + if (downstream != null) { + downstream.disconnect(reason); + } + if (upstream != null && !upstream.isClosed()) { + geyser.getSessionManager().removeSession(this); + upstream.disconnect(reason); + } + } + + if (tickThread != null) { + tickThread.cancel(false); + } + + closed = true; + } + + public void close() { + disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.close", getClientData().getLanguageCode())); + } + + /** + * Executes a task and prints a stack trace if an error occurs. + */ + public void executeInEventLoop(Runnable runnable) { + eventLoop.execute(() -> { + try { + runnable.run(); + } catch (Throwable e) { + geyser.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); + } + }); + } + + /** + * Schedules a task and prints a stack trace if an error occurs. + */ + public ScheduledFuture scheduleInEventLoop(Runnable runnable, long duration, TimeUnit timeUnit) { + return eventLoop.schedule(() -> { + try { + runnable.run(); + } catch (Throwable e) { + geyser.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); + } + }, duration, timeUnit); + } + + /** + * Called every 50 milliseconds - one Minecraft tick. + */ + protected void tick() { + try { + pistonCache.tick(); + // Check to see if the player's position needs updating - a position update should be sent once every 3 seconds + if (spawned && (System.currentTimeMillis() - lastMovementTimestamp) > 3000) { + // Recalculate in case something else changed position + Vector3d position = collisionManager.adjustBedrockPosition(playerEntity.getPosition(), playerEntity.isOnGround(), false); + // A null return value cancels the packet + if (position != null) { + ServerboundMovePlayerPosPacket packet = new ServerboundMovePlayerPosPacket(playerEntity.isOnGround(), + position.getX(), position.getY(), position.getZ()); + sendDownstreamPacket(packet); + } + lastMovementTimestamp = System.currentTimeMillis(); + } + + if (worldBorder.isResizing()) { + worldBorder.resize(); + } + + if (!worldBorder.isWithinWarningBoundaries()) { + // Show particles representing where the world border is + worldBorder.drawWall(); + // Set the mood + if (!isInWorldBorderWarningArea) { + isInWorldBorderWarningArea = true; + WorldBorder.sendFog(this, "minecraft:fog_crimson_forest"); + } + } else if (isInWorldBorderWarningArea) { + // Clear fog as we are outside the world border now + WorldBorder.removeFog(this); + isInWorldBorderWarningArea = false; + } + + + for (Tickable entity : entityCache.getTickableEntities()) { + entity.tick(); + } + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + } + + public void setAuthenticationData(AuthData authData) { + this.authData = authData; + } + + public void setSneaking(boolean sneaking) { + this.sneaking = sneaking; + + // Update pose and bounding box on our end + AttributeData speedAttribute; + if (!sneaking && (speedAttribute = adjustSpeed()) != null) { + // Update attributes since we're still "sneaking" under a 1.5-block-tall area + UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); + attributesPacket.setRuntimeEntityId(playerEntity.getGeyserId()); + attributesPacket.setAttributes(Collections.singletonList(speedAttribute)); + sendUpstreamPacket(attributesPacket); + // the server *should* update our pose once it has returned to normal + } else { + if (!flying) { + // The pose and bounding box should not be updated if the player is flying + setSneakingPose(sneaking); + } + collisionManager.updateScaffoldingFlags(false); + } + + playerEntity.updateBedrockMetadata(); + + if (mouseoverEntity != null) { + // Horses, etc can change their property depending on if you're sneaking + InteractiveTagManager.updateTag(this, mouseoverEntity); + } + } + + private void setSneakingPose(boolean sneaking) { + this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING; + playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, sneaking ? 1.5f : playerEntity.getDefinition().height()); + playerEntity.setFlag(EntityFlag.SNEAKING, sneaking); + + collisionManager.updatePlayerBoundingBox(); + } + + public void setSwimming(boolean swimming) { + this.pose = swimming ? Pose.SWIMMING : Pose.STANDING; + playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, swimming ? 0.6f : playerEntity.getDefinition().height()); + playerEntity.setFlag(EntityFlag.SWIMMING, swimming); + playerEntity.updateBedrockMetadata(); + } + + public void setFlying(boolean flying) { + this.flying = flying; + + if (sneaking) { + // update bounding box as it is not reduced when flying + setSneakingPose(!flying); + playerEntity.updateBedrockMetadata(); + } + } + + /** + * Adjusts speed if the player is crawling. + * + * @return not null if attributes should be updated. + */ + public AttributeData adjustSpeed() { + AttributeData currentPlayerSpeed = playerEntity.getAttributes().get(GeyserAttributeType.MOVEMENT_SPEED); + if (currentPlayerSpeed != null) { + if ((pose.equals(Pose.SNEAKING) && !sneaking && collisionManager.isUnderSlab()) || + (!swimmingInWater && playerEntity.getFlag(EntityFlag.SWIMMING) && !collisionManager.isPlayerInWater())) { + // Either of those conditions means that Bedrock goes zoom when they shouldn't be + AttributeData speedAttribute = GeyserAttributeType.MOVEMENT_SPEED.getAttribute(originalSpeedAttribute / 3.32f); + playerEntity.getAttributes().put(GeyserAttributeType.MOVEMENT_SPEED, speedAttribute); + return speedAttribute; + } else if (originalSpeedAttribute != currentPlayerSpeed.getValue()) { + // Speed has reset to normal + AttributeData speedAttribute = GeyserAttributeType.MOVEMENT_SPEED.getAttribute(originalSpeedAttribute); + playerEntity.getAttributes().put(GeyserAttributeType.MOVEMENT_SPEED, speedAttribute); + return speedAttribute; + } + } + return null; + } + + /** + * Will be overwritten for GeyserConnect. + */ + protected void disableSrvResolving() { + this.downstream.setFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, false); + } + + @Override + public String getName() { + return authData.getName(); + } + + @Override + public void sendMessage(String message) { + TextPacket textPacket = new TextPacket(); + textPacket.setPlatformChatId(""); + textPacket.setSourceName(""); + textPacket.setXuid(""); + textPacket.setType(TextPacket.Type.CHAT); + textPacket.setNeedsTranslation(false); + textPacket.setMessage(message); + + upstream.sendPacket(textPacket); + } + + @Override + public boolean isConsole() { + return false; + } + + @Override + public String getLocale() { + return clientData.getLanguageCode(); + } + + public void setRenderDistance(int renderDistance) { + renderDistance = GenericMath.ceil(++renderDistance * MathUtils.SQRT_OF_TWO); //square to circle + this.renderDistance = renderDistance; + + ChunkRadiusUpdatedPacket chunkRadiusUpdatedPacket = new ChunkRadiusUpdatedPacket(); + chunkRadiusUpdatedPacket.setRadius(renderDistance); + upstream.sendPacket(chunkRadiusUpdatedPacket); + } + + public InetSocketAddress getSocketAddress() { + return this.upstream.getAddress(); + } + + public void sendForm(Form form) { + formCache.showForm(form); + } + + public void sendForm(FormBuilder formBuilder) { + formCache.showForm(formBuilder.build()); + } + + private void startGame() { + StartGamePacket startGamePacket = new StartGamePacket(); + startGamePacket.setUniqueEntityId(playerEntity.getGeyserId()); + startGamePacket.setRuntimeEntityId(playerEntity.getGeyserId()); + startGamePacket.setPlayerGameType(switch (gameMode) { + case CREATIVE -> GameType.CREATIVE; + case ADVENTURE -> GameType.ADVENTURE; + default -> GameType.SURVIVAL; + }); + startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0)); + startGamePacket.setRotation(Vector2f.from(1, 1)); + + startGamePacket.setSeed(-1); + startGamePacket.setDimensionId(DimensionUtils.javaToBedrock(dimension)); + startGamePacket.setGeneratorId(1); + startGamePacket.setLevelGameType(GameType.SURVIVAL); + startGamePacket.setDifficulty(1); + startGamePacket.setDefaultSpawn(Vector3i.ZERO); + startGamePacket.setAchievementsDisabled(!geyser.getConfig().isXboxAchievementsEnabled()); + startGamePacket.setCurrentTick(-1); + startGamePacket.setEduEditionOffers(0); + startGamePacket.setEduFeaturesEnabled(false); + startGamePacket.setRainLevel(0); + startGamePacket.setLightningLevel(0); + startGamePacket.setMultiplayerGame(true); + startGamePacket.setBroadcastingToLan(true); + startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC); + startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC); + startGamePacket.setCommandsEnabled(!geyser.getConfig().isXboxAchievementsEnabled()); + startGamePacket.setTexturePacksRequired(false); + startGamePacket.setBonusChestEnabled(false); + startGamePacket.setStartingWithMap(false); + startGamePacket.setTrustingPlayers(true); + startGamePacket.setDefaultPlayerPermission(PlayerPermission.MEMBER); + startGamePacket.setServerChunkTickRange(4); + startGamePacket.setBehaviorPackLocked(false); + startGamePacket.setResourcePackLocked(false); + startGamePacket.setFromLockedWorldTemplate(false); + startGamePacket.setUsingMsaGamertagsOnly(false); + startGamePacket.setFromWorldTemplate(false); + startGamePacket.setWorldTemplateOptionLocked(false); + + String serverName = geyser.getConfig().getBedrock().getServerName(); + startGamePacket.setLevelId(serverName); + startGamePacket.setLevelName(serverName); + + startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000"); + // startGamePacket.setCurrentTick(0); + startGamePacket.setEnchantmentSeed(0); + startGamePacket.setMultiplayerCorrelationId(""); + startGamePacket.setItemEntries(this.itemMappings.getItemEntries()); + startGamePacket.setVanillaVersion("*"); + startGamePacket.setInventoriesServerAuthoritative(true); + startGamePacket.setServerEngine(""); // Do we want to fill this in? + + SyncedPlayerMovementSettings settings = new SyncedPlayerMovementSettings(); + settings.setMovementMode(AuthoritativeMovementMode.CLIENT); + settings.setRewindHistorySize(0); + settings.setServerAuthoritativeBlockBreaking(false); + startGamePacket.setPlayerMovementSettings(settings); + + if (upstream.getProtocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { + startGamePacket.getExperiments().add(new ExperimentData("caves_and_cliffs", true)); + } + + upstream.sendPacket(startGamePacket); + } + + /** + * @return the next Bedrock item network ID to use for a new item + */ + public int getNextItemNetId() { + return itemNetId.getAndIncrement(); + } + + public void addTeleport(TeleportCache teleportCache) { + teleportMap.put(teleportCache.getTeleportConfirmId(), teleportCache); + + ObjectIterator> it = teleportMap.int2ObjectEntrySet().iterator(); + + // Remove any teleports with a higher number - maybe this is a world change that reset the ID to 0? + while (it.hasNext()) { + Int2ObjectMap.Entry entry = it.next(); + int nextID = entry.getValue().getTeleportConfirmId(); + if (nextID > teleportCache.getTeleportConfirmId()) { + it.remove(); + } + } + } + + public void confirmTeleport(Vector3d position) { + if (teleportMap.size() == 0) { + return; + } + int teleportID = -1; + + for (Int2ObjectMap.Entry entry : teleportMap.int2ObjectEntrySet()) { + if (entry.getValue().canConfirm(position)) { + if (entry.getValue().getTeleportConfirmId() > teleportID) { + teleportID = entry.getValue().getTeleportConfirmId(); + } + } + } + + if (teleportID != -1) { + ObjectIterator> it = teleportMap.int2ObjectEntrySet().iterator(); + + // Confirm the current teleport and any earlier ones + while (it.hasNext()) { + TeleportCache entry = it.next().getValue(); + int nextID = entry.getTeleportConfirmId(); + if (nextID <= teleportID) { + ServerboundAcceptTeleportationPacket teleportConfirmPacket = new ServerboundAcceptTeleportationPacket(nextID); + sendDownstreamPacket(teleportConfirmPacket); + // Servers (especially ones like Hypixel) expect exact coordinates given back to them. + ServerboundMovePlayerPosRotPacket positionPacket = new ServerboundMovePlayerPosRotPacket(playerEntity.isOnGround(), + entry.getX(), entry.getY(), entry.getZ(), entry.getYaw(), entry.getPitch()); + sendDownstreamPacket(positionPacket); + it.remove(); + geyser.getLogger().debug("Confirmed teleport " + nextID); + } + } + } + + if (teleportMap.size() > 0) { + int resendID = -1; + for (Int2ObjectMap.Entry entry : teleportMap.int2ObjectEntrySet()) { + TeleportCache teleport = entry.getValue(); + teleport.incrementUnconfirmedFor(); + if (teleport.shouldResend()) { + if (teleport.getTeleportConfirmId() >= resendID) { + resendID = teleport.getTeleportConfirmId(); + } + } + } + + if (resendID != -1) { + geyser.getLogger().debug("Resending teleport " + resendID); + TeleportCache teleport = teleportMap.get(resendID); + getPlayerEntity().moveAbsolute(Vector3f.from(teleport.getX(), teleport.getY(), teleport.getZ()), + teleport.getYaw(), teleport.getPitch(), playerEntity.isOnGround(), true); + } + } + } + + /** + * Queue a packet to be sent to player. + * + * @param packet the bedrock packet from the NukkitX protocol lib + */ + public void sendUpstreamPacket(BedrockPacket packet) { + upstream.sendPacket(packet); + } + + /** + * Send a packet immediately to the player. + * + * @param packet the bedrock packet from the NukkitX protocol lib + */ + public void sendUpstreamPacketImmediately(BedrockPacket packet) { + upstream.sendPacketImmediately(packet); + } + + /** + * Send a packet to the remote server. + * + * @param packet the java edition packet from MCProtocolLib + */ + public void sendDownstreamPacket(Packet packet) { + if (!closed && this.downstream != null) { + Channel channel = this.downstream.getChannel(); + if (channel == null) { + // Channel is only null before the connection has initialized + geyser.getLogger().warning("Tried to send a packet to the Java server too early!"); + if (geyser.getConfig().isDebugMode()) { + Thread.dumpStack(); + } + return; + } + + EventLoop eventLoop = channel.eventLoop(); + if (eventLoop.inEventLoop()) { + sendDownstreamPacket0(packet); + } else { + eventLoop.execute(() -> sendDownstreamPacket0(packet)); + } + } + } + + private void sendDownstreamPacket0(Packet packet) { + if (protocol.getState().equals(ProtocolState.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) { + downstream.send(packet); + } else { + geyser.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server"); + } + } + + /** + * Update the cached value for the reduced debug info gamerule. + * If enabled, also hides the player's coordinates. + * + * @param value The new value for reducedDebugInfo + */ + public void setReducedDebugInfo(boolean value) { + reducedDebugInfo = value; + // Set the showCoordinates data. This is done because updateShowCoordinates() uses this gamerule as a variable. + preferencesCache.updateShowCoordinates(); + } + + /** + * Changes the daylight cycle gamerule on the client + * This is used in the login screen along-side normal usage + * + * @param doCycle If the cycle should continue + */ + public void setDaylightCycle(boolean doCycle) { + sendGameRule("dodaylightcycle", doCycle); + // Save the value so we don't have to constantly send a daylight cycle gamerule update + this.daylightCycle = doCycle; + } + + /** + * Send a gamerule value to the client + * + * @param gameRule The gamerule to send + * @param value The value of the gamerule + */ + public void sendGameRule(String gameRule, Object value) { + GameRulesChangedPacket gameRulesChangedPacket = new GameRulesChangedPacket(); + gameRulesChangedPacket.getGameRules().add(new GameRuleData<>(gameRule, value)); + upstream.sendPacket(gameRulesChangedPacket); + } + + /** + * Checks if the given session's player has a permission + * + * @param permission The permission node to check + * @return true if the player has the requested permission, false if not + */ + @Override + public boolean hasPermission(String permission) { + return geyser.getWorldManager().hasPermission(this, permission); + } + + /** + * Send an AdventureSettingsPacket to the client with the latest flags + */ + public void sendAdventureSettings() { + AdventureSettingsPacket adventureSettingsPacket = new AdventureSettingsPacket(); + adventureSettingsPacket.setUniqueEntityId(playerEntity.getGeyserId()); + // Set command permission if OP permission level is high enough + // This allows mobile players access to a GUI for doing commands. The commands there do not change above OPERATOR + // and all commands there are accessible with OP permission level 2 + adventureSettingsPacket.setCommandPermission(opPermissionLevel >= 2 ? CommandPermission.OPERATOR : CommandPermission.NORMAL); + // Required to make command blocks destroyable + adventureSettingsPacket.setPlayerPermission(opPermissionLevel >= 2 ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER); + + // Update the noClip and worldImmutable values based on the current gamemode + boolean spectator = gameMode == GameMode.SPECTATOR; + boolean worldImmutable = gameMode == GameMode.ADVENTURE || spectator; + + Set flags = adventureSettingsPacket.getSettings(); + if (canFly || spectator) { + flags.add(AdventureSetting.MAY_FLY); + } + + if (flying || spectator) { + if (spectator && !flying) { + // We're "flying locked" in this gamemode + flying = true; + ServerboundPlayerAbilitiesPacket abilitiesPacket = new ServerboundPlayerAbilitiesPacket(true); + sendDownstreamPacket(abilitiesPacket); + } + flags.add(AdventureSetting.FLYING); + } + + if (worldImmutable) { + flags.add(AdventureSetting.WORLD_IMMUTABLE); + } + + if (spectator) { + flags.add(AdventureSetting.NO_CLIP); + } + + flags.add(AdventureSetting.AUTO_JUMP); + + sendUpstreamPacket(adventureSettingsPacket); + } + + /** + * Used for updating statistic values since we only get changes from the server + * + * @param statistics Updated statistics values + */ + public void updateStatistics(@NonNull Map statistics) { + this.statistics.putAll(statistics); + } + + public void refreshEmotes(List emotes) { + this.emotes.addAll(emotes); + for (GeyserSession player : geyser.getSessionManager().getSessions().values()) { + List pieces = new ArrayList<>(); + for (UUID piece : emotes) { + if (!player.getEmotes().contains(piece)) { + pieces.add(piece); + } + player.getEmotes().add(piece); + } + EmoteListPacket emoteList = new EmoteListPacket(); + emoteList.setRuntimeEntityId(player.getPlayerEntity().getGeyserId()); + emoteList.getPieceIds().addAll(pieces); + player.sendUpstreamPacket(emoteList); + } + } +} diff --git a/core/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java b/core/src/main/java/org/geysermc/geyser/network/session/UpstreamSession.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java rename to core/src/main/java/org/geysermc/geyser/network/session/UpstreamSession.java index 11df3139c..a96b0448f 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/UpstreamSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/UpstreamSession.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session; +package org.geysermc.geyser.network.session; import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.BedrockServerSession; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java b/core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java new file mode 100644 index 000000000..76ea66f55 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019-2021 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.network.session.auth; + +import com.fasterxml.jackson.databind.JsonNode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.geysermc.geyser.GeyserImpl; + +import java.util.UUID; + +@RequiredArgsConstructor +public class AuthData { + @Getter private final String name; + @Getter private final UUID uuid; + @Getter private final String xuid; + + private final JsonNode certChainData; + private final String clientData; + + public void upload(GeyserImpl geyser) { + // we can't upload the skin in LoginEncryptionUtil since the global server would return + // the skin too fast, that's why we upload it after we know for sure that the target server + // is ready to handle the result of the global server + geyser.getSkinUploader().uploadSkin(certChainData, clientData); + } +} diff --git a/core/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java b/core/src/main/java/org/geysermc/geyser/network/session/auth/BedrockClientData.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java rename to core/src/main/java/org/geysermc/geyser/network/session/auth/BedrockClientData.java index fc4d1164a..f463e247c 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/auth/BedrockClientData.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/auth/BedrockClientData.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.auth; +package org.geysermc.geyser.network.session.auth; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/AdvancementsCache.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/AdvancementsCache.java index e53c2cd04..f8b9ca808 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/AdvancementsCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/AdvancementsCache.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.utils.GeyserAdvancement; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.utils.GeyserAdvancement; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.utils.LocaleUtils; import org.geysermc.cumulus.SimpleForm; import org.geysermc.cumulus.response.SimpleFormResponse; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/BookEditCache.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/BookEditCache.java index 69b56104c..74708b442 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/BookEditCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/BookEditCache.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; import lombok.Setter; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.network.session.GeyserSession; /** * Manages updating the current writable book. diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/BossBar.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/BossBar.java index 28ac9459e..4443275e9 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/BossBar.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -32,8 +32,8 @@ import com.nukkitx.protocol.bedrock.packet.BossEventPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import lombok.AllArgsConstructor; import net.kyori.adventure.text.Component; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @AllArgsConstructor public class BossBar { diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/ChunkCache.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/ChunkCache.java index 4de049d1d..197139eba 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/ChunkCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/ChunkCache.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.chunk.GeyserChunk; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.chunk.GeyserChunk; +import org.geysermc.geyser.utils.MathUtils; public class ChunkCache { private final boolean cache; @@ -52,7 +52,7 @@ public class ChunkCache { private boolean isExtendedHeight = false; public ChunkCache(GeyserSession session) { - this.cache = !session.getConnector().getWorldManager().hasOwnChunkCache(); // To prevent Spigot from initializing + this.cache = !session.getGeyser().getWorldManager().hasOwnChunkCache(); // To prevent Spigot from initializing chunks = cache ? new Long2ObjectOpenHashMap<>() : null; } diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityCache.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/EntityCache.java index 10b7159aa..cd34bb50d 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import it.unimi.dsi.fastutil.longs.Long2LongMap; import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; @@ -32,10 +32,10 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Getter; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.Tickable; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.Tickable; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.*; import java.util.concurrent.atomic.AtomicLong; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityEffectCache.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/EntityEffectCache.java index 910367889..12f99a384 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/EntityEffectCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityEffectCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/FormCache.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/FormCache.java index 73475673c..020da79e9 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/FormCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/FormCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.nukkitx.protocol.bedrock.packet.ModalFormRequestPacket; import com.nukkitx.protocol.bedrock.packet.ModalFormResponsePacket; @@ -31,8 +31,8 @@ import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.RequiredArgsConstructor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.SimpleForm; @@ -83,7 +83,7 @@ public class FormCache { try { responseConsumer.accept(response.getFormData()); } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error("Error while processing form response!", e); + GeyserImpl.getInstance().getLogger().error("Error while processing form response!", e); } } } diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/LodestoneCache.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/LodestoneCache.java index 5ad07bcd2..adcfdbaa2 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/LodestoneCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/LodestoneCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; @@ -33,7 +33,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.geysermc.connector.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.GeyserItemStack; import javax.annotation.Nullable; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/PistonCache.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/PistonCache.java index 14efca357..67f4c490d 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/PistonCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/PistonCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; @@ -33,11 +33,11 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntity; -import org.geysermc.connector.utils.Axis; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntity; +import org.geysermc.geyser.utils.Axis; import java.util.Map; @@ -100,9 +100,9 @@ public class PistonCache { pistons.entrySet().removeIf((entry) -> entry.getValue().canBeRemoved()); if (pistons.isEmpty() && !movingBlocksMap.isEmpty()) { - session.getConnector().getLogger().error("The moving block map has de-synced!"); + session.getGeyser().getLogger().error("The moving block map has de-synced!"); for (Map.Entry entry : movingBlocksMap.entrySet()) { - session.getConnector().getLogger().error("Moving Block at " + entry.getKey() + " was previously owned by the piston at " + entry.getValue().getPosition()); + session.getGeyser().getLogger().error("Moving Block at " + entry.getKey() + " was previously owned by the piston at " + entry.getValue().getPosition()); } } } diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/PreferencesCache.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/PreferencesCache.java index 310ef7911..b71ca17ff 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/PreferencesCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/PreferencesCache.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.CooldownUtils; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.CooldownUtils; @Getter public class PreferencesCache { @@ -62,7 +62,7 @@ public class PreferencesCache { public PreferencesCache(GeyserSession session) { this.session = session; - prefersCustomSkulls = session.getConnector().getConfig().isAllowCustomSkulls(); + prefersCustomSkulls = session.getGeyser().getConfig().isAllowCustomSkulls(); } /** @@ -74,7 +74,7 @@ public class PreferencesCache { * {@link GeyserConfiguration#isShowCoordinates()} is disabled */ public void updateShowCoordinates() { - allowShowCoordinates = !session.isReducedDebugInfo() && session.getConnector().getConfig().isShowCoordinates(); + allowShowCoordinates = !session.isReducedDebugInfo() && session.getGeyser().getConfig().isShowCoordinates(); session.sendGameRule("showcoordinates", allowShowCoordinates && prefersShowCoordinates); } @@ -82,6 +82,6 @@ public class PreferencesCache { * @return true if the session prefers custom skulls, and the config allows them. */ public boolean showCustomSkulls() { - return prefersCustomSkulls && session.getConnector().getConfig().isAllowCustomSkulls(); + return prefersCustomSkulls && session.getGeyser().getConfig().isAllowCustomSkulls(); } } diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/TagCache.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/TagCache.java index 221ab36c3..985f1ba2c 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/TagCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/TagCache.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; -import org.geysermc.connector.registry.type.BlockMapping; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.BlockMapping; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/TeleportCache.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/TeleportCache.java index 6f40481db..7ca5b9ed5 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/TeleportCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.nukkitx.math.vector.Vector3d; import lombok.Data; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldBorder.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/WorldBorder.java index 9d51f82d2..65dbf3e29 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/WorldBorder.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldBorder.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.nukkitx.math.GenericMath; import com.nukkitx.math.vector.Vector2d; @@ -33,9 +33,9 @@ import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.PlayerFogPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; import javax.annotation.Nonnull; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java b/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldCache.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java rename to core/src/main/java/org/geysermc/geyser/network/session/cache/WorldCache.java index bec206ba1..a0c4ba9c6 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/cache/WorldCache.java +++ b/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldCache.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.session.cache; +package org.geysermc.geyser.network.session.cache; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.scoreboard.Scoreboard; -import org.geysermc.connector.scoreboard.ScoreboardUpdater.ScoreboardSession; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.scoreboard.Scoreboard; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater.ScoreboardSession; @Getter public class WorldCache { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java b/core/src/main/java/org/geysermc/geyser/network/translators/ItemRemapper.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java rename to core/src/main/java/org/geysermc/geyser/network/translators/ItemRemapper.java index ca0530870..57947d497 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/ItemRemapper.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/ItemRemapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators; +package org.geysermc.geyser.network.translators; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslator.java index b0b1aab5e..b10d62b33 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/PacketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators; +package org.geysermc.geyser.network.translators; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public abstract class PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java similarity index 79% rename from core/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java rename to core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java index d86830d20..011360efd 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators; +package org.geysermc.geyser.network.translators; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; @@ -32,10 +32,10 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.IdentityHashMap; import java.util.Map; @@ -52,7 +52,7 @@ public class PacketTranslatorRegistry { for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(Translator.class)) { Class packet = clazz.getAnnotation(Translator.class).packet(); - GeyserConnector.getInstance().getLogger().debug("Found annotated translator: " + clazz.getCanonicalName() + " : " + packet.getSimpleName()); + GeyserImpl.getInstance().getLogger().debug("Found annotated translator: " + clazz.getCanonicalName() + " : " + packet.getSimpleName()); try { if (Packet.class.isAssignableFrom(packet)) { @@ -66,10 +66,10 @@ public class PacketTranslatorRegistry { BEDROCK_TRANSLATOR.translators.put(targetPacket, translator); } else { - GeyserConnector.getInstance().getLogger().error("Class " + clazz.getCanonicalName() + " is annotated as a translator but has an invalid target packet."); + GeyserImpl.getInstance().getLogger().error("Class " + clazz.getCanonicalName() + " is annotated as a translator but has an invalid target packet."); } } catch (InstantiationException | IllegalAccessException e) { - GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated translator " + clazz.getCanonicalName()); + GeyserImpl.getInstance().getLogger().error("Could not instantiate annotated translator " + clazz.getCanonicalName()); } } @@ -97,9 +97,9 @@ public class PacketTranslatorRegistry { } return true; } else { - if ((GeyserConnector.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { + if ((GeyserImpl.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { // Other debug logs already take care of Bedrock packets for us if on standalone - GeyserConnector.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet)); + GeyserImpl.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet)); } } } @@ -114,7 +114,7 @@ public class PacketTranslatorRegistry { try { translator.translate(session, packet); } catch (Throwable ex) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); ex.printStackTrace(); } } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/Translator.java b/core/src/main/java/org/geysermc/geyser/network/translators/Translator.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/Translator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/Translator.java index a79543012..ceb254fa2 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/Translator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/Translator.java @@ -22,7 +22,7 @@ * @author GeyserMC * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators; +package org.geysermc.geyser.network.translators; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAdventureSettingsTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAdventureSettingsTranslator.java index 6fafef998..1a3cb4c05 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAdventureSettingsTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = AdventureSettingsPacket.class) public class BedrockAdventureSettingsTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAnimateTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAnimateTranslator.java index 271268ef4..52c4d8a38 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAnimateTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockEntityDataTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockEntityDataTranslator.java index df8ab45f8..65eadc610 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockEntityDataTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetJigsawBlockPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.SignUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.SignUtils; @Translator(packet = BlockEntityDataPacket.class) public class BedrockBlockEntityDataTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockPickRequestTranslator.java similarity index 79% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockPickRequestTranslator.java index 666c7548b..1d34ec07b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockPickRequestTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.ItemFrameEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.InventoryUtils; @Translator(packet = BlockPickRequestPacket.class) public class BedrockBlockPickRequestTranslator extends PacketTranslator { @@ -42,7 +42,7 @@ public class BedrockBlockPickRequestTranslator extends PacketTranslator @Override public void translate(GeyserSession session, BookEditPacket packet) { if (packet.getText() != null && !packet.getText().isEmpty() && packet.getText().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PAGE_LENGTH) { - session.getConnector().getLogger().warning("Page length greater than server allowed!"); + session.getGeyser().getLogger().warning("Page length greater than server allowed!"); return; } @@ -128,7 +128,7 @@ public class BedrockBookEditTranslator extends PacketTranslator if (packet.getAction() == BookEditPacket.Action.SIGN_BOOK) { // Add title to packet so the server knows we're signing if (packet.getTitle().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_TITLE_LENGTH) { - session.getConnector().getLogger().warning("Book title larger than server allows!"); + session.getGeyser().getLogger().warning("Book title larger than server allows!"); return; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java index 509a7c865..138b69b6e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = CommandBlockUpdatePacket.class) public class BedrockCommandBlockUpdateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandRequestTranslator.java similarity index 74% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandRequestTranslator.java index 7988436d2..636caf703 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockCommandRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandRequestTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import org.geysermc.common.PlatformType; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.command.CommandManager; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.protocol.bedrock.packet.CommandRequestPacket; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = CommandRequestPacket.class) public class BedrockCommandRequestTranslator extends PacketTranslator { @@ -42,8 +42,8 @@ public class BedrockCommandRequestTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEmoteListTranslator.java similarity index 78% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEmoteListTranslator.java index 4a005082a..54adbab8a 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEmoteListTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEmoteListTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.nukkitx.protocol.bedrock.packet.EmoteListPacket; -import org.geysermc.connector.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = EmoteListPacket.class) public class BedrockEmoteListTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, EmoteListPacket packet) { - if (session.getConnector().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { + if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { return; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEntityPickRequestTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEntityPickRequestTranslator.java index 669f2751d..ed236d7e7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEntityPickRequestTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.nukkitx.protocol.bedrock.packet.EntityPickRequestPacket; -import org.geysermc.connector.entity.BoatEntity; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.entity.BoatEntity; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockFilterTextTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockFilterTextTranslator.java index 23f2ba293..99ebdfa6d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockFilterTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockFilterTextTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket; import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; -import org.geysermc.connector.inventory.AnvilContainer; -import org.geysermc.connector.inventory.CartographyContainer; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.utils.ItemUtils; +import org.geysermc.geyser.inventory.AnvilContainer; +import org.geysermc.geyser.inventory.CartographyContainer; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.utils.ItemUtils; /** * Used to send strings to the server and filter out unwanted words. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockInventoryTransactionTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index baa679abc..33c475cb1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; @@ -40,20 +40,20 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.connector.entity.CommandBlockMinecartEntity; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.sound.EntitySoundInteractionHandler; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.entity.CommandBlockMinecartEntity; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.ItemFrameEntity; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.sound.EntitySoundInteractionHandler; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.utils.BlockUtils; import java.util.concurrent.TimeUnit; @@ -186,7 +186,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { int blockState = session.getGameMode() == GameMode.CREATIVE ? - session.getConnector().getWorldManager().getBlockAt(session, packet.getBlockPosition()) : session.getBreakingBlock(); + session.getGeyser().getWorldManager().getBlockAt(session, packet.getBlockPosition()) : session.getBreakingBlock(); session.setLastBlockPlacedId(null); session.setLastBlockPlacePosition(null); @@ -393,7 +393,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator 0) { - if (session.getConnector().getConfig().isForwardPlayerPing()) { + if (session.getGeyser().getConfig().isForwardPlayerPing()) { ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(pingId); session.sendDownstreamPacket(keepAlivePacket); } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java similarity index 81% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java index 110a3f547..1bed7c99f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPacketViolationWarningTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.nukkitx.protocol.bedrock.packet.PacketViolationWarningPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = PacketViolationWarningPacket.class) public class BedrockPacketViolationWarningTranslator extends PacketTranslator { @@ -36,6 +36,6 @@ public class BedrockPacketViolationWarningTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockRespawnTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockRespawnTranslator.java index 4ccf77370..8cefa57d3 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockRespawnTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = RespawnPacket.class) public class BedrockRespawnTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java index 5fe778513..b19626a6b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.nukkitx.protocol.bedrock.packet.ServerSettingsRequestPacket; import com.nukkitx.protocol.bedrock.packet.ServerSettingsResponsePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.SettingsUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.SettingsUtils; import org.geysermc.cumulus.CustomForm; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index 5288a62fa..8f3d734d7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.LoginEncryptionUtils; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.LoginEncryptionUtils; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockShowCreditsTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockShowCreditsTranslator.java index ffdfe4f35..95de61b54 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockShowCreditsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockShowCreditsTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockTextTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockTextTranslator.java index b2fb1fbb5..8b4fc9dde 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock; +package org.geysermc.geyser.network.translators.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = TextPacket.class) public class BedrockTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/BedrockEntityEventTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/BedrockEntityEventTranslator.java index ef275ca0a..21d7f087c 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/BedrockEntityEventTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock.entity; +package org.geysermc.geyser.network.translators.bedrock.entity; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSelectTradePacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.MerchantContainer; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.MerchantContainer; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.concurrent.TimeUnit; @@ -70,6 +70,6 @@ public class BedrockEntityEventTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, EmotePacket packet) { - if (session.getConnector().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { + if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, Direction.DOWN); session.sendDownstreamPacket(swapHandsPacket); - if (session.getConnector().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { + if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { return; } } long javaId = session.getPlayerEntity().getEntityId(); - for (GeyserSession otherSession : session.getConnector().getSessionManager().getSessions().values()) { + for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) { if (otherSession != session) { if (otherSession.isClosed()) continue; if (otherSession.getEventLoop().inEventLoop()) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockInteractTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockInteractTranslator.java index 2ee2fbb7c..5273c1c97 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockInteractTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock.entity.player; +package org.geysermc.geyser.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; @@ -35,12 +35,12 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.InteractPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.InteractiveTagManager; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.InteractiveTagManager; @Translator(packet = InteractPacket.class) public class BedrockInteractTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java index 609ee6f2d..190b9a2ef 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock.entity.player; +package org.geysermc.geyser.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; @@ -33,12 +33,12 @@ import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = MovePlayerPacket.class) public class BedrockMovePlayerTranslator extends PacketTranslator { @@ -145,7 +145,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator 300) { - session.getConnector().getLogger().debug(ChatColor.RED + session.getName() + " moved too quickly." + + session.getGeyser().getLogger().debug(ChatColor.RED + session.getName() + " moved too quickly." + " current position: " + currentPosition + ", new position: " + newPosition); return false; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java index 3c562dbc9..d52c2fc81 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock.entity.player; +package org.geysermc.geyser.network.translators.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; import com.nukkitx.protocol.bedrock.packet.RiderJumpPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = RiderJumpPacket.class) public class BedrockRiderJumpTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java index 1022d838d..80d5f9840 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock.entity.player; +package org.geysermc.geyser.network.translators.bedrock.entity.player; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; /** * In vanilla Bedrock, if you have operator status, this sets the player's gamemode without confirmation from the server. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java index 8b19a00eb..1b1532ffa 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.bedrock.world; +package org.geysermc.geyser.network.translators.bedrock.world; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.CooldownUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.CooldownUtils; @Translator(packet = LevelSoundEventPacket.class) public class BedrockLevelSoundEventTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java b/core/src/main/java/org/geysermc/geyser/network/translators/chat/GsonComponentSerializerWrapper.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java rename to core/src/main/java/org/geysermc/geyser/network/translators/chat/GsonComponentSerializerWrapper.java index c5888c06a..102780856 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/chat/GsonComponentSerializerWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/chat/GsonComponentSerializerWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.chat; +package org.geysermc.geyser.network.translators.chat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/chat/MessageTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/chat/MessageTranslator.java index 55087de0f..4b03d4b20 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/chat/MessageTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/chat/MessageTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.chat; +package org.geysermc.geyser.network.translators.chat; import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; @@ -32,9 +32,9 @@ import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.EnumMap; import java.util.Map; @@ -119,8 +119,8 @@ public class MessageTranslator { return legacy; } catch (Exception e) { - GeyserConnector.getInstance().getLogger().debug(GSON_SERIALIZER.serialize(message)); - GeyserConnector.getInstance().getLogger().error("Failed to parse message", e); + GeyserImpl.getInstance().getLogger().debug(GSON_SERIALIZER.serialize(message)); + GeyserImpl.getInstance().getLogger().error("Failed to parse message", e); return ""; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java b/core/src/main/java/org/geysermc/geyser/network/translators/chat/MinecraftTranslationRegistry.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java rename to core/src/main/java/org/geysermc/geyser/network/translators/chat/MinecraftTranslationRegistry.java index 3bae14abf..a8a90c1a5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/chat/MinecraftTranslationRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/chat/MinecraftTranslationRegistry.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.chat; +package org.geysermc.geyser.network.translators.chat; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.utils.LocaleUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/BoundingBox.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/BoundingBox.java index e74953b7a..c79c2799f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/BoundingBox.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/BoundingBox.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision; +package org.geysermc.geyser.network.translators.collision; import com.nukkitx.math.vector.Vector3d; import lombok.*; -import org.geysermc.connector.utils.Axis; -import org.geysermc.connector.utils.Direction; +import org.geysermc.geyser.utils.Axis; +import org.geysermc.geyser.utils.Direction; @Data @AllArgsConstructor diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionManager.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionManager.java index 3d9069232..74678ae1d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision; +package org.geysermc.geyser.network.translators.collision; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; @@ -32,17 +32,17 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.PistonCache; -import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.collision.translators.ScaffoldingCollision; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.utils.Axis; -import org.geysermc.connector.utils.BlockPositionIterator; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.PistonCache; +import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; +import org.geysermc.geyser.network.translators.collision.translators.ScaffoldingCollision; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.utils.Axis; +import org.geysermc.geyser.utils.BlockPositionIterator; +import org.geysermc.geyser.utils.BlockUtils; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -388,7 +388,7 @@ public class CollisionManager { * @return if the player is currently in a water block */ public boolean isPlayerInWater() { - return session.getConnector().getWorldManager().getBlockAt(session, session.getPlayerEntity().getPosition().toInt()) == BlockStateValues.JAVA_WATER_ID; + return session.getGeyser().getWorldManager().getBlockAt(session, session.getPlayerEntity().getPosition().toInt()) == BlockStateValues.JAVA_WATER_ID; } /** diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionRemapper.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionRemapper.java index e582d0959..c932b1f68 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/CollisionRemapper.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionRemapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision; +package org.geysermc.geyser.network.translators.collision; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/BlockCollision.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/BlockCollision.java index 869ff97d3..cc84824cd 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/BlockCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/BlockCollision.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionManager; -import org.geysermc.connector.utils.Axis; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionManager; +import org.geysermc.geyser.utils.Axis; @EqualsAndHashCode public class BlockCollision { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DirtPathCollision.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DirtPathCollision.java index e4d1b8f5a..06df05054 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DirtPathCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DirtPathCollision.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionManager; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionManager; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^dirt_path$", passDefaultBoxes = true) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DoorCollision.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DoorCollision.java index d1b8e45aa..6c165bd1f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/DoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DoorCollision.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "_door$", usesParams = true, passDefaultBoxes = true) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/OtherCollision.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/OtherCollision.java index 8a49a28af..eeb89b65f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/OtherCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/OtherCollision.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.BoundingBox; @EqualsAndHashCode(callSuper = true) public class OtherCollision extends BlockCollision { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/ScaffoldingCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/ScaffoldingCollision.java index 9aed59636..be5e3c028 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/ScaffoldingCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/ScaffoldingCollision.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; /** * In order for scaffolding to work on Bedrock, entity flags need to be sent to the player diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SnowCollision.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SnowCollision.java index 35ac13056..dc8b095b0 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SnowCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SnowCollision.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^snow$", passDefaultBoxes = true, usesParams = true) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SolidCollision.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SolidCollision.java index d96e7d588..c772ff75f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SolidCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SolidCollision.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "shulker_box$") // These have no collision in the mappings as it depends on the NBT data diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SpawnerCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SpawnerCollision.java index 867d4b412..cef39dba1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/SpawnerCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SpawnerCollision.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^spawner$") diff --git a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/TrapdoorCollision.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java rename to core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/TrapdoorCollision.java index aef966edf..948622640 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/collision/translators/TrapdoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/TrapdoorCollision.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.collision.translators; +package org.geysermc.geyser.network.translators.collision.translators; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionManager; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionManager; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "_trapdoor$", usesParams = true, passDefaultBoxes = true) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/BedrockContainerSlot.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/BedrockContainerSlot.java index 47d1f0709..07ca32d61 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/BedrockContainerSlot.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/BedrockContainerSlot.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory; +package org.geysermc.geyser.network.translators.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import lombok.Value; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/InventoryTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/InventoryTranslator.java index 2ebf823ac..1c11da986 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/InventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory; +package org.geysermc.geyser.network.translators.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -41,22 +41,22 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.*; import lombok.AllArgsConstructor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.inventory.CartographyContainer; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.click.Click; -import org.geysermc.connector.network.translators.inventory.click.ClickPlan; -import org.geysermc.connector.network.translators.inventory.translators.*; -import org.geysermc.connector.network.translators.inventory.translators.chest.DoubleChestInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.chest.SingleChestInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.furnace.BlastFurnaceInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.furnace.FurnaceInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.furnace.SmokerInventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; -import org.geysermc.connector.utils.ItemUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.inventory.CartographyContainer; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.click.Click; +import org.geysermc.geyser.network.translators.inventory.click.ClickPlan; +import org.geysermc.geyser.network.translators.inventory.translators.*; +import org.geysermc.geyser.network.translators.inventory.translators.chest.DoubleChestInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.chest.SingleChestInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.furnace.BlastFurnaceInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.furnace.FurnaceInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.furnace.SmokerInventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.utils.ItemUtils; import java.util.*; @@ -201,8 +201,8 @@ public abstract class InventoryTranslator { transferAction.getSource().getSlot() >= 28 && transferAction.getSource().getSlot() <= 31) { return rejectRequest(request, false); } - if (session.getConnector().getConfig().isDebugMode()) { - session.getConnector().getLogger().error("DEBUG: About to reject TAKE/PLACE request made by " + session.getName()); + if (session.getGeyser().getConfig().isDebugMode()) { + session.getGeyser().getLogger().error("DEBUG: About to reject TAKE/PLACE request made by " + session.getName()); dumpStackRequestDetails(session, inventory, transferAction.getSource(), transferAction.getDestination()); } return rejectRequest(request); @@ -287,8 +287,8 @@ public abstract class InventoryTranslator { case SWAP: { SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action; if (!(checkNetId(session, inventory, swapAction.getSource()) && checkNetId(session, inventory, swapAction.getDestination()))) { - if (session.getConnector().getConfig().isDebugMode()) { - session.getConnector().getLogger().error("DEBUG: About to reject SWAP request made by " + session.getName()); + if (session.getGeyser().getConfig().isDebugMode()) { + session.getGeyser().getLogger().error("DEBUG: About to reject SWAP request made by " + session.getName()); dumpStackRequestDetails(session, inventory, swapAction.getSource(), swapAction.getDestination()); } return rejectRequest(request); @@ -760,7 +760,7 @@ public abstract class InventoryTranslator { * as bad (false). */ public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequest request, boolean throwError) { - if (throwError && GeyserConnector.getInstance().getConfig().isDebugMode()) { + if (throwError && GeyserImpl.getInstance().getConfig().isDebugMode()) { new Throwable("DEBUGGING: ItemStackRequest rejected " + request.toString()).printStackTrace(); } return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList()); @@ -770,10 +770,10 @@ public abstract class InventoryTranslator { * Print out the contents of an ItemStackRequest, should the net ID check fail. */ protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) { - session.getConnector().getLogger().error("Source: " + source.toString() + " Result: " + checkNetId(session, inventory, source)); - session.getConnector().getLogger().error("Destination: " + destination.toString() + " Result: " + checkNetId(session, inventory, destination)); - session.getConnector().getLogger().error("Geyser's record of source slot: " + inventory.getItem(bedrockSlotToJava(source))); - session.getConnector().getLogger().error("Geyser's record of destination slot: " + inventory.getItem(bedrockSlotToJava(destination))); + session.getGeyser().getLogger().error("Source: " + source.toString() + " Result: " + checkNetId(session, inventory, source)); + session.getGeyser().getLogger().error("Destination: " + destination.toString() + " Result: " + checkNetId(session, inventory, destination)); + session.getGeyser().getLogger().error("Geyser's record of source slot: " + inventory.getItem(bedrockSlotToJava(source))); + session.getGeyser().getLogger().error("Geyser's record of destination slot: " + inventory.getItem(bedrockSlotToJava(destination))); } public boolean checkNetId(GeyserSession session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/SlotType.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/SlotType.java index d4df48a59..38cca8397 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/SlotType.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/SlotType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory; +package org.geysermc.geyser.network.translators.inventory; public enum SlotType { NORMAL, diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/Click.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/Click.java index 4c0ea7709..b194c9acf 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/click/Click.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/Click.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.click; +package org.geysermc.geyser.network.translators.inventory.click; import com.github.steveice10.mc.protocol.data.game.inventory.ClickItemAction; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/ClickPlan.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/ClickPlan.java index d6063b98d..23a3a314d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/click/ClickPlan.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/ClickPlan.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.click; +package org.geysermc.geyser.network.translators.inventory.click; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType; @@ -33,14 +33,14 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import lombok.Value; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.inventory.translators.CraftingInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.PlayerInventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.inventory.translators.CraftingInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.PlayerInventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/BlockInventoryHolder.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/BlockInventoryHolder.java index 8a1467b0e..63b1747cf 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/BlockInventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/BlockInventoryHolder.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.holder; +package org.geysermc.geyser.network.translators.inventory.holder; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.google.common.collect.ImmutableSet; @@ -34,12 +34,12 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import org.geysermc.connector.inventory.Container; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.inventory.Container; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.BlockUtils; import java.util.Collections; import java.util.HashSet; @@ -77,7 +77,7 @@ public class BlockInventoryHolder extends InventoryHolder { // (This could be a virtual inventory that the player is opening) if (checkInteractionPosition(session)) { // Then, check to see if the interacted block is valid for this inventory by ensuring the block state identifier is valid - int javaBlockId = session.getConnector().getWorldManager().getBlockAt(session, session.getLastInteractionBlockPosition()); + int javaBlockId = session.getGeyser().getWorldManager().getBlockAt(session, session.getLastInteractionBlockPosition()); String[] javaBlockString = BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(javaBlockId, "minecraft:air").split("\\["); if (isValidBlock(javaBlockString)) { // We can safely use this block @@ -155,7 +155,7 @@ public class BlockInventoryHolder extends InventoryHolder { Vector3i holderPos = inventory.getHolderPosition(); Position pos = new Position(holderPos.getX(), holderPos.getY(), holderPos.getZ()); - int realBlock = session.getConnector().getWorldManager().getBlockAt(session, pos.getX(), pos.getY(), pos.getZ()); + int realBlock = session.getGeyser().getWorldManager().getBlockAt(session, pos.getX(), pos.getY(), pos.getZ()); UpdateBlockPacket blockPacket = new UpdateBlockPacket(); blockPacket.setDataLayer(0); blockPacket.setBlockPosition(holderPos); diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/InventoryHolder.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/InventoryHolder.java index 8b5c5473f..810bab350 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/holder/InventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/InventoryHolder.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.holder; +package org.geysermc.geyser.network.translators.inventory.holder; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; public abstract class InventoryHolder { public abstract void prepareInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java index 49caef13b..a0b5298a7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.connector.network.translators.inventory.holder.InventoryHolder; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.network.translators.inventory.holder.InventoryHolder; +import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; /** * Provided as a base for any inventory that requires a block for opening it diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AnvilInventoryTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AnvilInventoryTranslator.java index 3fa9ebdd7..ce40f0a44 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/AnvilInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AnvilInventoryTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.inventory.AnvilContainer; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.AnvilInventoryUpdater; +import org.geysermc.geyser.inventory.AnvilContainer; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.AnvilInventoryUpdater; public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { public AnvilInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BaseInventoryTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BaseInventoryTranslator.java index 4211e9902..fb3f2cac4 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BaseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BaseInventoryTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.inventory.Container; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.SlotType; +import org.geysermc.geyser.inventory.Container; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.SlotType; public abstract class BaseInventoryTranslator extends InventoryTranslator { public BaseInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BeaconInventoryTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BeaconInventoryTranslator.java index 2fb26847a..6a5ae2cc5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BeaconInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BeaconInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetBeaconPacket; @@ -38,15 +38,15 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; -import org.geysermc.connector.inventory.BeaconContainer; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.inventory.BeaconContainer; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BrewingInventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BrewingInventoryTranslator.java index 17baff323..a38fbe126 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/BrewingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BrewingInventoryTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator { public BrewingInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CartographyInventoryTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CartographyInventoryTranslator.java index 3d9520a0a..3e16635ed 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CartographyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CartographyInventoryTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.inventory.CartographyContainer; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.inventory.CartographyContainer; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; public class CartographyInventoryTranslator extends AbstractBlockInventoryTranslator { public CartographyInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CraftingInventoryTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CraftingInventoryTranslator.java index 363c9b702..6baf2b9ca 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/CraftingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CraftingInventoryTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; public class CraftingInventoryTranslator extends AbstractBlockInventoryTranslator { public CraftingInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/EnchantingInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/EnchantingInventoryTranslator.java index 18254dee5..f0bf1a993 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/EnchantingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/EnchantingInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; @@ -33,14 +33,14 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import com.nukkitx.protocol.bedrock.packet.PlayerEnchantOptionsPacket; -import org.geysermc.connector.inventory.EnchantingContainer; -import org.geysermc.connector.inventory.GeyserEnchantOption; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.connector.network.translators.item.Enchantment; +import org.geysermc.geyser.inventory.EnchantingContainer; +import org.geysermc.geyser.inventory.GeyserEnchantOption; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.network.translators.item.Enchantment; import java.util.Arrays; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/Generic3X3InventoryTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/Generic3X3InventoryTranslator.java index a77716c91..eaef37335 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/Generic3X3InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/Generic3X3InventoryTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import org.geysermc.connector.inventory.Generic3X3Container; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.inventory.Generic3X3Container; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; /** * Droppers and dispensers diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/GrindstoneInventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/GrindstoneInventoryTranslator.java index a71594153..501c4be58 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/GrindstoneInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/GrindstoneInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; public class GrindstoneInventoryTranslator extends AbstractBlockInventoryTranslator { public GrindstoneInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/HopperInventoryTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/HopperInventoryTranslator.java index 7f067d1c0..44fff7406 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/HopperInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/HopperInventoryTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; /** * Implemented on top of any block that does not have special properties implemented diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LecternInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LecternInventoryTranslator.java index cc94ffff3..7b0f4a5f0 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LecternInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LecternInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; @@ -35,14 +35,14 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.LecternContainer; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; -import org.geysermc.connector.utils.BlockEntityUtils; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.LecternContainer; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.Collections; @@ -109,7 +109,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { Vector3i position = session.getLastInteractionBlockPosition(); // If shouldExpectLecternHandled returns true, this is already handled for us // shouldRefresh means that we should boot out the client on our side because their lectern GUI isn't updated yet - boolean shouldRefresh = !session.getConnector().getWorldManager().shouldExpectLecternHandled() && !session.getLecternCache().contains(position); + boolean shouldRefresh = !session.getGeyser().getWorldManager().shouldExpectLecternHandled() && !session.getLecternCache().contains(position); NbtMap blockEntityTag; if (tag != null) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LoomInventoryTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LoomInventoryTranslator.java index bc2991f7f..bdf5de762 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/LoomInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LoomInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -41,13 +41,13 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequ import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.connector.network.translators.item.translators.BannerTranslator; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.network.translators.item.translators.BannerTranslator; import java.util.Collections; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/MerchantInventoryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/MerchantInventoryTranslator.java index be3b09b50..130e7cca9 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/MerchantInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/MerchantInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.math.vector.Vector3f; @@ -34,16 +34,16 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.MerchantContainer; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.MerchantContainer; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; public class MerchantInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/PlayerInventoryTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/PlayerInventoryTranslator.java index fa54b1223..ace0ae665 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/PlayerInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -36,16 +36,16 @@ import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.utils.InventoryUtils; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Arrays; import java.util.Collections; @@ -354,7 +354,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } } default -> { - session.getConnector().getLogger().error("Unknown crafting state induced by " + session.getName()); + session.getGeyser().getLogger().error("Unknown crafting state induced by " + session.getName()); return rejectRequest(request); } } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/ShulkerInventoryTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/ShulkerInventoryTranslator.java index 7dafb862a..a924c05b7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/ShulkerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/ShulkerInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.nukkitx.math.vector.Vector3i; @@ -32,13 +32,13 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.registry.Registries; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.registry.Registries; public class ShulkerInventoryTranslator extends AbstractBlockInventoryTranslator { public ShulkerInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/SmithingInventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/SmithingInventoryTranslator.java index 8b30be406..3b8d05c69 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/SmithingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/SmithingInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslator { public SmithingInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/StonecutterInventoryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/StonecutterInventoryTranslator.java index 3c508b851..f2b8ac354 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/StonecutterInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators; +package org.geysermc.geyser.network.translators.inventory.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; @@ -36,15 +36,15 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.IntList; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.inventory.StonecutterContainer; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.connector.network.translators.item.ItemTranslator; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.inventory.StonecutterContainer; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.network.translators.item.ItemTranslator; public class StonecutterInventoryTranslator extends AbstractBlockInventoryTranslator { public StonecutterInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/ChestInventoryTranslator.java similarity index 83% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/ChestInventoryTranslator.java index d54419b82..6a88d26d4 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/ChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/ChestInventoryTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.chest; +package org.geysermc.geyser.network.translators.inventory.translators.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.translators.BaseInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.updater.ChestInventoryUpdater; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.translators.BaseInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.updater.ChestInventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java index 029509157..838b11978 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.chest; +package org.geysermc.geyser.network.translators.inventory.translators.chest; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; @@ -33,13 +33,13 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import org.geysermc.connector.inventory.Container; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.block.DoubleChestValue; -import org.geysermc.connector.network.translators.world.block.entity.DoubleChestBlockEntityTranslator; -import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.geyser.inventory.Container; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.DoubleChestValue; +import org.geysermc.geyser.network.translators.world.block.entity.DoubleChestBlockEntityTranslator; +import org.geysermc.geyser.registry.BlockRegistries; public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { private final int defaultJavaBlockState; @@ -53,7 +53,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { public void prepareInventory(GeyserSession session, Inventory inventory) { // See BlockInventoryHolder - same concept there except we're also dealing with a specific block state if (session.getLastInteractionPlayerPosition().equals(session.getPlayerEntity().getPosition())) { - int javaBlockId = session.getConnector().getWorldManager().getBlockAt(session, session.getLastInteractionBlockPosition()); + int javaBlockId = session.getGeyser().getWorldManager().getBlockAt(session, session.getLastInteractionBlockPosition()); String[] javaBlockString = BlockRegistries.JAVA_IDENTIFIERS.get().getOrDefault(javaBlockId, "minecraft:air").split("\\["); if (javaBlockString.length > 1 && (javaBlockString[0].equals("minecraft:chest") || javaBlockString[0].equals("minecraft:trapped_chest")) && !javaBlockString[1].contains("type=single")) { @@ -150,7 +150,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } Vector3i holderPos = inventory.getHolderPosition(); - int realBlock = session.getConnector().getWorldManager().getBlockAt(session, holderPos); + int realBlock = session.getGeyser().getWorldManager().getBlockAt(session, holderPos); UpdateBlockPacket blockPacket = new UpdateBlockPacket(); blockPacket.setDataLayer(0); blockPacket.setBlockPosition(holderPos); @@ -158,7 +158,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { session.sendUpstreamPacket(blockPacket); holderPos = holderPos.add(Vector3i.UNIT_X); - realBlock = session.getConnector().getWorldManager().getBlockAt(session, holderPos); + realBlock = session.getGeyser().getWorldManager().getBlockAt(session, holderPos); blockPacket = new UpdateBlockPacket(); blockPacket.setDataLayer(0); blockPacket.setBlockPosition(holderPos); diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java index 42b23d5b4..d6348bc7e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.chest; +package org.geysermc.geyser.network.translators.inventory.translators.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.connector.network.translators.inventory.holder.InventoryHolder; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.network.translators.inventory.holder.InventoryHolder; public class SingleChestInventoryTranslator extends ChestInventoryTranslator { private final InventoryHolder holder; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java index dc9b00fd7..d2fa100a6 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.network.translators.inventory.translators.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.connector.network.translators.inventory.SlotType; -import org.geysermc.connector.network.translators.inventory.translators.AbstractBlockInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.network.translators.inventory.translators.AbstractBlockInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; public abstract class AbstractFurnaceInventoryTranslator extends AbstractBlockInventoryTranslator { AbstractFurnaceInventoryTranslator(String javaBlockIdentifier, ContainerType containerType) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java index ed9a8a79c..7d1b14683 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.network.translators.inventory.translators.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; public class BlastFurnaceInventoryTranslator extends AbstractFurnaceInventoryTranslator { public BlastFurnaceInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java index b41c9b03b..e6c563bd5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.network.translators.inventory.translators.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; public class FurnaceInventoryTranslator extends AbstractFurnaceInventoryTranslator { public FurnaceInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java index 2b9a78c7d..68583c8b0 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.network.translators.inventory.translators.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; public class SmokerInventoryTranslator extends AbstractFurnaceInventoryTranslator { public SmokerInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java similarity index 81% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java index 0e365aca1..d9549e5a8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.horse; +package org.geysermc.geyser.network.translators.inventory.translators.horse; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.translators.BaseInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.updater.HorseInventoryUpdater; -import org.geysermc.connector.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.translators.BaseInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.updater.HorseInventoryUpdater; +import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; public abstract class AbstractHorseInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java index 77a1976be..bd7cfb9f9 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.horse; +package org.geysermc.geyser.network.translators.inventory.translators.horse; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java index bf13bd6da..f73c43973 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.horse; +package org.geysermc.geyser.network.translators.inventory.translators.horse; public class DonkeyInventoryTranslator extends ChestedHorseInventoryTranslator { public DonkeyInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/HorseInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/HorseInventoryTranslator.java index 09a8f5de3..da06a5c18 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/HorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/HorseInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.horse; +package org.geysermc.geyser.network.translators.inventory.translators.horse; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator { public HorseInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java index cea605f83..c7e98d7c1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.translators.horse; +package org.geysermc.geyser.network.translators.inventory.translators.horse; public class LlamaInventoryTranslator extends ChestedHorseInventoryTranslator { public LlamaInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/AnvilInventoryUpdater.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/AnvilInventoryUpdater.java index 6dfd60b8b..acb5f0941 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/AnvilInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/AnvilInventoryUpdater.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.updater; +package org.geysermc.geyser.network.translators.inventory.updater; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket; @@ -36,17 +36,17 @@ import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.inventory.AnvilContainer; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.EnchantmentData; -import org.geysermc.connector.utils.ItemUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.inventory.AnvilContainer; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.EnchantmentData; +import org.geysermc.geyser.utils.ItemUtils; import java.util.Objects; import java.util.Set; @@ -312,7 +312,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { JavaEnchantment enchantment = entry.getKey(); EnchantmentData data = Registries.ENCHANTMENTS.get(enchantment); if (data == null) { - GeyserConnector.getInstance().getLogger().debug("Java enchantment not in registry: " + enchantment); + GeyserImpl.getInstance().getLogger().debug("Java enchantment not in registry: " + enchantment); continue; } @@ -384,7 +384,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { if (enchantTag.get("id") instanceof StringTag javaEnchId) { JavaEnchantment enchantment = JavaEnchantment.getByJavaIdentifier(javaEnchId.getValue()); if (enchantment == null) { - GeyserConnector.getInstance().getLogger().debug("Unknown java enchantment: " + javaEnchId.getValue()); + GeyserImpl.getInstance().getLogger().debug("Unknown java enchantment: " + javaEnchId.getValue()); continue; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ChestInventoryUpdater.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ChestInventoryUpdater.java index b421044bf..a3e5bb201 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ChestInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ChestInventoryUpdater.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.updater; +package org.geysermc.geyser.network.translators.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import lombok.AllArgsConstructor; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ContainerInventoryUpdater.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ContainerInventoryUpdater.java index f77e687a0..eb0b8afaa 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/ContainerInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ContainerInventoryUpdater.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.updater; +package org.geysermc.geyser.network.translators.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/HorseInventoryUpdater.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/HorseInventoryUpdater.java index db067a74c..115970b9b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/HorseInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/HorseInventoryUpdater.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.updater; +package org.geysermc.geyser.network.translators.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/InventoryUpdater.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/InventoryUpdater.java index e94c0944b..67ee607b9 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/InventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/InventoryUpdater.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.updater; +package org.geysermc.geyser.network.translators.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/UIInventoryUpdater.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/UIInventoryUpdater.java index 5bb8ad5d2..aa24aae1e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/inventory/updater/UIInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/UIInventoryUpdater.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.inventory.updater; +package org.geysermc.geyser.network.translators.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; public class UIInventoryUpdater extends InventoryUpdater { public static final UIInventoryUpdater INSTANCE = new UIInventoryUpdater(); diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/Enchantment.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/Enchantment.java index 947f9e6ed..5d05632c3 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/Enchantment.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/Enchantment.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item; +package org.geysermc.geyser.network.translators.item; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/ItemTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/ItemTranslator.java index 9fcf984cd..3429dcdd7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/ItemTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item; +package org.geysermc.geyser.network.translators.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; @@ -34,15 +34,15 @@ import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LocaleUtils; import javax.annotation.Nonnull; import java.util.*; @@ -65,7 +65,7 @@ public abstract class ItemTranslator { for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(ItemRemapper.class)) { int priority = clazz.getAnnotation(ItemRemapper.class).priority(); - GeyserConnector.getInstance().getLogger().debug("Found annotated item translator: " + clazz.getCanonicalName()); + GeyserImpl.getInstance().getLogger().debug("Found annotated item translator: " + clazz.getCanonicalName()); try { if (NbtItemStackTranslator.class.isAssignableFrom(clazz)) { @@ -78,7 +78,7 @@ public abstract class ItemTranslator { for (ItemMapping item : appliedItems) { ItemTranslator registered = ITEM_STACK_TRANSLATORS.get(item.getJavaId()); if (registered != null) { - GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated item translator " + + GeyserImpl.getInstance().getLogger().error("Could not instantiate annotated item translator " + clazz.getCanonicalName() + ". Item translator " + registered.getClass().getCanonicalName() + " is already registered for the item " + item.getJavaIdentifier()); continue; @@ -86,7 +86,7 @@ public abstract class ItemTranslator { ITEM_STACK_TRANSLATORS.put(item.getJavaId(), itemStackTranslator); } } catch (InstantiationException | IllegalAccessException e) { - GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated item translator " + clazz.getCanonicalName()); + GeyserImpl.getInstance().getLogger().error("Could not instantiate annotated item translator " + clazz.getCanonicalName()); } } @@ -134,7 +134,7 @@ public abstract class ItemTranslator { ItemMapping bedrockItem = session.getItemMappings().getMapping(stack); if (bedrockItem == null) { - session.getConnector().getLogger().debug("No matching ItemMapping for " + stack); + session.getGeyser().getLogger().debug("No matching ItemMapping for " + stack); return ItemData.AIR; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/NbtItemStackTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/NbtItemStackTranslator.java index a7044c3b2..bac48bdd0 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/NbtItemStackTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/NbtItemStackTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item; +package org.geysermc.geyser.network.translators.item; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; public class NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/Potion.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/Potion.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/translators/item/Potion.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/Potion.java index 57f8c756c..dea1e9d21 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/Potion.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/Potion.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item; +package org.geysermc.geyser.network.translators.item; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/StoredItemMappings.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/StoredItemMappings.java index 6bbdb7421..14ca7758f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/StoredItemMappings.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item; +package org.geysermc.geyser.network.translators.item; import lombok.Getter; import lombok.experimental.Accessors; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMapping; import javax.annotation.Nonnull; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/TippedArrowPotion.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/TippedArrowPotion.java index 312de593c..ad6850717 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/TippedArrowPotion.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item; +package org.geysermc.geyser.network.translators.item; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/BannerTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/BannerTranslator.java index d00bf9d40..f905d015e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/BannerTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators; +package org.geysermc.geyser.network.translators.item.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; @@ -32,12 +32,12 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; import java.util.ArrayList; import java.util.HashMap; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/CompassTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/CompassTranslator.java index cf2e90fdf..7eb3f7a3e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/CompassTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators; +package org.geysermc.geyser.network.translators.item.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; import java.util.List; import java.util.stream.Collectors; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/PotionTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/PotionTranslator.java index 82e8fb6b8..6c7cde0b0 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/PotionTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators; +package org.geysermc.geyser.network.translators.item.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.Potion; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.Potion; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; import java.util.List; import java.util.stream.Collectors; @@ -68,7 +68,7 @@ public class PotionTranslator extends ItemTranslator { .count(itemStack.getAmount()) .tag(translateNbtToBedrock(itemStack.getNbt())); } - GeyserConnector.getInstance().getLogger().debug("Unknown Java potion: " + potionTag.getValue()); + GeyserImpl.getInstance().getLogger().debug("Unknown Java potion: " + potionTag.getValue()); } return super.translateToBedrock(itemStack, mapping, mappings); } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/TippedArrowTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/TippedArrowTranslator.java index 575f3ba74..7c2f929ee 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/TippedArrowTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators; +package org.geysermc.geyser.network.translators.item.translators; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.network.translators.item.TippedArrowPotion; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.network.translators.item.TippedArrowPotion; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; import java.util.List; import java.util.stream.Collectors; @@ -76,7 +76,7 @@ public class TippedArrowTranslator extends ItemTranslator { .count(itemStack.getAmount()) .tag(translateNbtToBedrock(itemStack.getNbt())); } - GeyserConnector.getInstance().getLogger().debug("Unknown Java potion (tipped arrow): " + potionTag.getValue()); + GeyserImpl.getInstance().getLogger().debug("Unknown Java potion (tipped arrow): " + potionTag.getValue()); } return super.translateToBedrock(itemStack, mapping, mappings); } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/AxolotlBucketTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/AxolotlBucketTranslator.java index f62ac05ae..0cf9c5041 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/AxolotlBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/AxolotlBucketTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.LocaleUtils; @ItemRemapper public class AxolotlBucketTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BasicItemTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BasicItemTranslator.java index b6b1dfac6..d0a7d93a3 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BasicItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BasicItemTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.ItemUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.ItemUtils; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BookPagesTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BookPagesTranslator.java index f1bf69f64..0ee644359 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/BookPagesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BookPagesTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/CrossbowTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/CrossbowTranslator.java index b0e55737f..21deac983 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/CrossbowTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper public class CrossbowTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantedBookTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantedBookTranslator.java index 0bca7a8ba..5dfdb192a 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantedBookTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantedBookTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper(priority = 1) public class EnchantedBookTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantmentTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantmentTranslator.java index b5807a7f4..f4352f3c3 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/EnchantmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantmentTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.network.translators.item.Enchantment; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.network.translators.item.Enchantment; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.ArrayList; import java.util.List; @@ -107,7 +107,7 @@ public class EnchantmentTranslator extends NbtItemStackTranslator { enchantments.add(javaTag); } } else { - GeyserConnector.getInstance().getLogger().debug("Unknown bedrock enchantment: " + bedrockId); + GeyserImpl.getInstance().getLogger().debug("Unknown bedrock enchantment: " + bedrockId); } } if (!enchantments.isEmpty()) { @@ -131,7 +131,7 @@ public class EnchantmentTranslator extends NbtItemStackTranslator { Enchantment enchantment = Enchantment.getByJavaIdentifier(((StringTag) javaEnchId).getValue()); if (enchantment == null) { - GeyserConnector.getInstance().getLogger().debug("Unknown java enchantment: " + javaEnchId.getValue()); + GeyserImpl.getInstance().getLogger().debug("Unknown java enchantment: " + javaEnchId.getValue()); return null; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkBaseTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkBaseTranslator.java index b61448d81..31e58f984 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkBaseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkBaseTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteArrayTag; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.utils.FireworkColor; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.utils.FireworkColor; +import org.geysermc.geyser.utils.MathUtils; /** * Stores common code for firework rockets and firework stars. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkRocketTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkRocketTranslator.java index 1ce94c5b0..624c7b5ff 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkRocketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkRocketTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.MathUtils; @ItemRemapper public class FireworkRocketTranslator extends FireworkBaseTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkStarTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkStarTranslator.java index 38eca4856..68c87f2cb 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/FireworkStarTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkStarTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper public class FireworkStarTranslator extends FireworkBaseTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LeatherArmorTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LeatherArmorTranslator.java index 0fd6f1e7b..abd6e24ed 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LeatherArmorTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LeatherArmorTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Arrays; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LodestoneCompassTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LodestoneCompassTranslator.java index 2696a39cf..25c00ec0a 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/LodestoneCompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LodestoneCompassTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper public class LodestoneCompassTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/MapItemTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/MapItemTranslator.java index 14342a8b3..9eb1693c8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/MapItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/MapItemTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper public class MapItemTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/PlayerHeadTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/PlayerHeadTranslator.java index 152c28daa..a3f3f10a0 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/PlayerHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/PlayerHeadTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.LocaleUtils; @ItemRemapper public class PlayerHeadTranslator extends NbtItemStackTranslator { @@ -50,7 +50,7 @@ public class PlayerHeadTranslator extends NbtItemStackTranslator { if (skullOwner instanceof CompoundTag && (skullName = ((CompoundTag) skullOwner).get("Name")) != null) { name = skullName; } else { - session.getConnector().getLogger().debug("Not sure how to handle skull head item display. " + itemTag); + session.getGeyser().getLogger().debug("Not sure how to handle skull head item display. " + itemTag); return; } } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java index 7c737ba13..f7fbbab54 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.mc.protocol.data.game.Identifier; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.item.*; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.item.*; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.MathUtils; @ItemRemapper public class ShulkerBoxItemTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java index 2cbaea910..6b6d17933 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.item.translators.nbt; +package org.geysermc.geyser.network.translators.item.translators.nbt; import com.github.steveice10.opennbt.tag.builtin.*; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.Style; import net.kyori.adventure.text.format.TextDecoration; -import org.geysermc.connector.entity.living.animal.TropicalFishEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.ItemRemapper; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.translators.item.NbtItemStackTranslator; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.entity.living.animal.TropicalFishEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.LocaleUtils; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaAwardStatsTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaAwardStatsTranslator.java index 141079755..2258f6f16 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaAwardStatsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaAwardStatsTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.StatisticsUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.StatisticsUtils; @Translator(packet = ClientboundAwardStatsPacket.class) public class JavaAwardStatsTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaBossEventTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaBossEventTranslator.java index eae326538..994783f86 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaBossEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaBossEventTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.BossBar; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.BossBar; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBossEventPacket; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChangeDifficultyTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChangeDifficultyTranslator.java index 37660ef99..71f914a75 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaChangeDifficultyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChangeDifficultyTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; @Translator(packet = ClientboundChangeDifficultyPacket.class) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChatTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChatTranslator.java index 0b6683f8b..8e9984124 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChatTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = ClientboundChatPacket.class) public class JavaChatTranslator extends PacketTranslator { @@ -40,7 +40,7 @@ public class JavaChatTranslator extends PacketTranslator TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); - textPacket.setXuid(session.getAuthData().getXboxUUID()); + textPacket.setXuid(session.getAuthData().getXuid()); textPacket.setType(switch (packet.getType()) { case CHAT -> TextPacket.Type.CHAT; case SYSTEM -> TextPacket.Type.SYSTEM; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCommandsTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCommandsTranslator.java index 28d965902..68ac54302 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCommandsTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; @@ -42,14 +42,14 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; import lombok.Getter; import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.item.Enchantment; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.EntityUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.item.Enchantment; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.EntityUtils; import java.util.*; @@ -100,8 +100,8 @@ public class JavaCommandsTranslator extends PacketTranslator { - private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); + private final GeyserLogger logger = GeyserImpl.getInstance().getLogger(); @Override public void translate(GeyserSession session, ClientboundCustomPayloadPacket packet) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomQueryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomQueryTranslator.java index 69567957c..e8a1bb6a7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaCustomQueryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomQueryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundCustomQueryPacket; import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; /** * For the login cycle. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaDisconnectTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaDisconnectTranslator.java index 58493b14d..2d1b83413 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaDisconnectTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = ClientboundDisconnectPacket.class) public class JavaDisconnectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaGameProfileTranslator.java similarity index 81% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaGameProfileTranslator.java index 326ad97ac..0458b9dbc 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaGameProfileTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaGameProfileTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.skin.SkinManager; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundGameProfilePacket.class) public class JavaGameProfileTranslator extends PacketTranslator { @@ -47,7 +47,7 @@ public class JavaGameProfileTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginTranslator.java index 772e65846..8fb5c29e7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaLoginTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference; import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility; @@ -34,15 +34,15 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCu import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.BiomeTranslator; -import org.geysermc.connector.utils.ChunkUtils; -import org.geysermc.connector.utils.DimensionUtils; -import org.geysermc.connector.utils.PluginMessageUtils; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.world.BiomeTranslator; +import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.utils.PluginMessageUtils; import java.util.Arrays; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaPingTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaPingTranslator.java index 060ddef93..d71d733cb 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaPingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaPingTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; // Why does this packet exist? Whatever, we better implement it @Translator(packet = ClientboundPingPacket.class) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRecipeTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRecipeTranslator.java index d70b1e929..64c82b3fe 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaRecipeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRecipeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.data.game.UnlockRecipesAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRespawnTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRespawnTranslator.java index 0ae81482c..80484a50f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRespawnTranslator.java @@ -23,21 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.utils.ChunkUtils; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.utils.DimensionUtils; @Translator(packet = ClientboundRespawnPacket.class) public class JavaRespawnTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaSelectAdvancementsTabTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaSelectAdvancementsTabTranslator.java index 16e5f9de9..a3606f598 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaSelectAdvancementsTabTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaSelectAdvancementsTabTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.AdvancementsCache; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.AdvancementsCache; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; /** * Indicates that the client should open a particular advancement tab diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateAdvancementsTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateAdvancementsTranslator.java index cd1a5dbec..3dd9306b8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateAdvancementsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateAdvancementsTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.session.cache.AdvancementsCache; -import org.geysermc.connector.utils.GeyserAdvancement; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.cache.AdvancementsCache; +import org.geysermc.geyser.utils.GeyserAdvancement; +import org.geysermc.geyser.utils.LocaleUtils; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateRecipesTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateRecipesTranslator.java index 9306453bc..f5ec74056 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateRecipesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateRecipesTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; @@ -40,18 +40,18 @@ import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; import it.unimi.dsi.fastutil.ints.*; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.*; import java.util.stream.Collectors; -import static org.geysermc.connector.utils.InventoryUtils.LAST_RECIPE_NET_ID; +import static org.geysermc.geyser.utils.InventoryUtils.LAST_RECIPE_NET_ID; /** * Used to send all valid recipes from Java to Bedrock. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateTagsTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateTagsTranslator.java index 4330b2e91..2ff0d346c 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/JavaUpdateTagsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateTagsTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java; +package org.geysermc.geyser.network.translators.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundUpdateTagsPacket.class) public class JavaUpdateTagsTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaAnimateTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaAnimateTranslator.java index 11fec73b3..1e6aad75e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaAnimateTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AnimateEntityPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.DimensionUtils; @Translator(packet = ClientboundAnimatePacket.class) public class JavaAnimateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaEntityEventTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaEntityEventTranslator.java index cdf21234c..e41232865 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaEntityEventTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -32,13 +32,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.FishingHookEntity; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.FishingHookEntity; +import org.geysermc.geyser.entity.LivingEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.concurrent.ThreadLocalRandom; @@ -220,7 +220,7 @@ public class JavaEntityEventTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosTranslator.java index 158c8c8d0..710f9b8dd 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityPosTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundMoveEntityPosPacket.class) public class JavaMoveEntityPosTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityRotTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityRotTranslator.java index 519b30909..fa7c7cd47 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveEntityRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityRotTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundMoveEntityRotPacket.class) public class JavaMoveEntityRotTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveVehicleTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveVehicleTranslator.java index cb15572a1..522fdc548 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaMoveVehicleTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveVehicleTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundMoveVehiclePacket.class) public class JavaMoveVehicleTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveEntitiesTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveEntitiesTranslator.java index e0592f34d..ea21ecd9b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveEntitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveEntitiesTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundRemoveEntitiesPacket.class) public class JavaRemoveEntitiesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveMobEffectTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveMobEffectTranslator.java index 057af9667..1cab3fac1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRemoveMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveMobEffectTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.EntityUtils; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.EntityUtils; @Translator(packet = ClientboundRemoveMobEffectPacket.class) public class JavaRemoveMobEffectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRotateHeadTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRotateHeadTranslator.java index 57c34db4f..d9595034b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaRotateHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRotateHeadTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundRotateHeadPacket.class) public class JavaRotateHeadTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityDataTranslator.java similarity index 76% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityDataTranslator.java index 25a7958df..37803bffc 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityDataTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.EntityMetadataTranslator; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.InteractiveTagManager; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.EntityMetadataTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.InteractiveTagManager; import java.util.List; @@ -55,9 +55,9 @@ public class JavaSetEntityDataTranslator extends PacketTranslator definition = entity.getDefinition(); for (EntityMetadata metadata : packet.getMetadata()) { if (metadata.getId() >= definition.translators().size()) { - session.getConnector().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + definition.translators().size() + " for entity type " + entity.getDefinition().entityType()); - if (session.getConnector().getConfig().isDebugMode()) { - session.getConnector().getLogger().debug(metadata.toString()); + session.getGeyser().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + definition.translators().size() + " for entity type " + entity.getDefinition().entityType()); + if (session.getGeyser().getConfig().isDebugMode()) { + session.getGeyser().getLogger().debug(metadata.toString()); } continue; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityLinkTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityLinkTranslator.java index 27e0481ee..aeae1a7e5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityLinkTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityLinkTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityLinkPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.MobEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.MobEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; /** * Called when a leash is attached, removed or updated from an entity diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityMotionTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityMotionTranslator.java index 3ec366825..886ba0c04 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEntityMotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityMotionTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.ItemEntity; -import org.geysermc.connector.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.ItemEntity; +import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityMotionPacket; import com.nukkitx.math.vector.Vector3f; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEquipmentTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEquipmentTranslator.java index 9e84b85a1..3e3ec0e8b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaSetEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEquipmentTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEquipmentPacket; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.item.ItemTranslator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.LivingEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.item.ItemTranslator; @Translator(packet = ClientboundSetEquipmentPacket.class) public class JavaSetEquipmentTranslator extends PacketTranslator { @@ -51,7 +51,7 @@ public class JavaSetEquipmentTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateAttributesTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateAttributesTranslator.java index 84946c208..005150693 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateAttributesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateAttributesTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateAttributesPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.LivingEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.LivingEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundUpdateAttributesPacket.class) public class JavaUpdateAttributesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateMobEffectTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateMobEffectTranslator.java index f8c276896..89d1068cb 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaUpdateMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateMobEffectTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity; +package org.geysermc.geyser.network.translators.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.EntityUtils; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.EntityUtils; @Translator(packet = ClientboundUpdateMobEffectPacket.class) public class JavaUpdateMobEffectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java index c2941a5ae..732db378b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.player; +package org.geysermc.geyser.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundBlockBreakAckPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.utils.ChunkUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.utils.ChunkUtils; @Translator(packet = ClientboundBlockBreakAckPacket.class) public class JavaBlockBreakAckTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java index a03bfceb1..dea92355d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.player; +package org.geysermc.geyser.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundPlayerAbilitiesPacket.class) public class JavaPlayerAbilitiesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerInfoTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerInfoTranslator.java index d7bfd5d72..d9365fffb 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerInfoTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerInfoTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.player; +package org.geysermc.geyser.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.data.game.PlayerListEntry; import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.skin.SkinManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundPlayerInfoPacket.class) public class JavaPlayerInfoTranslator extends PacketTranslator { @@ -84,7 +84,7 @@ public class JavaPlayerInfoTranslator extends PacketTranslator - GeyserConnector.getInstance().getLogger().debug("Loaded Local Bedrock Java Skin Data for " + session.getClientData().getUsername())); + GeyserImpl.getInstance().getLogger().debug("Loaded Local Bedrock Java Skin Data for " + session.getClientData().getUsername())); } else { playerEntity.setValid(true); PlayerListPacket.Entry playerListEntry = SkinManager.buildCachedEntry(session, playerEntity); @@ -102,7 +102,7 @@ public class JavaPlayerInfoTranslator extends PacketTranslator { @@ -84,7 +84,7 @@ public class JavaPlayerPositionTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetExperienceTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetExperienceTranslator.java index 61427b3b2..db0d92e02 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetExperienceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetExperienceTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.player; +package org.geysermc.geyser.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetExperiencePacket; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetHealthTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetHealthTranslator.java index 11e8ab21b..4e30983c3 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaSetHealthTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetHealthTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.player; +package org.geysermc.geyser.network.translators.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.SetHealthPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; -import org.geysermc.connector.entity.attribute.GeyserAttributeType; -import org.geysermc.connector.entity.player.SessionPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; +import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddEntityTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddEntityTranslator.java index cf75dbd0f..9ab1d390c 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.spawn; +package org.geysermc.geyser.network.translators.java.entity.spawn; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockData; @@ -31,14 +31,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddEntityPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.*; -import org.geysermc.connector.entity.factory.BaseEntityFactory; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.entity.*; +import org.geysermc.geyser.entity.factory.BaseEntityFactory; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.LanguageUtils; @Translator(packet = ClientboundAddEntityPacket.class) public class JavaAddEntityTranslator extends PacketTranslator { @@ -52,7 +52,7 @@ public class JavaAddEntityTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); if (definition == null) { - session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); + session.getGeyser().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); return; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java index ec2ab1221..ff7eeeb79 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.spawn; +package org.geysermc.geyser.network.translators.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddExperienceOrbPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.ExpOrbEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.ExpOrbEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundAddExperienceOrbPacket.class) public class JavaAddExperienceOrbTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddMobTranslator.java similarity index 77% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddMobTranslator.java index a3d7ebb0d..424be58e8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddMobTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddMobTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.spawn; +package org.geysermc.geyser.network.translators.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddMobPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.entity.factory.BaseEntityFactory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.factory.BaseEntityFactory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.LanguageUtils; @Translator(packet = ClientboundAddMobPacket.class) public class JavaAddMobTranslator extends PacketTranslator { @@ -46,7 +46,7 @@ public class JavaAddMobTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); if (definition == null) { - session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); + session.getGeyser().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); return; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java index 4879166a2..fe523a032 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.spawn; +package org.geysermc.geyser.network.translators.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.PaintingEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.PaintingType; +import org.geysermc.geyser.entity.PaintingEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.PaintingType; @Translator(packet = ClientboundAddPaintingPacket.class) public class JavaAddPaintingTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java similarity index 81% rename from core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java index 9daec1007..24d7cb705 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.entity.spawn; +package org.geysermc.geyser.network.translators.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.LanguageUtils; -import org.geysermc.connector.skin.SkinManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundAddPlayerPacket.class) public class JavaAddPlayerTranslator extends PacketTranslator { @@ -52,7 +52,7 @@ public class JavaAddPlayerTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetContentTranslator.java similarity index 82% rename from core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetContentTranslator.java index 85b055a5a..dcc6968c5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetContentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetContentTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.inventory; +package org.geysermc.geyser.network.translators.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; @Translator(packet = ClientboundContainerSetContentPacket.class) public class JavaContainerSetContentTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetDataTranslator.java similarity index 81% rename from core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetDataTranslator.java index e458d202b..d0e767bd1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetDataTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.inventory; +package org.geysermc.geyser.network.translators.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; @Translator(packet = ClientboundContainerSetDataPacket.class) public class JavaContainerSetDataTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetSlotTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetSlotTranslator.java index 5079084dc..9957439af 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaContainerSetSlotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetSlotTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.inventory; +package org.geysermc.geyser.network.translators.java.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; @@ -37,16 +37,16 @@ import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.CraftingInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.PlayerInventoryTranslator; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.CraftingInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.PlayerInventoryTranslator; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.Arrays; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java index bb3edfd5b..26d836532 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.inventory; +package org.geysermc.geyser.network.translators.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket; import com.nukkitx.nbt.NbtMap; @@ -31,18 +31,18 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.UpdateEquipPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.animal.horse.ChestedHorseEntity; -import org.geysermc.connector.entity.living.animal.horse.LlamaEntity; -import org.geysermc.connector.inventory.Container; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.horse.DonkeyInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.horse.HorseInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.horse.LlamaInventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.animal.horse.ChestedHorseEntity; +import org.geysermc.geyser.entity.living.animal.horse.LlamaEntity; +import org.geysermc.geyser.inventory.Container; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.horse.DonkeyInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.horse.HorseInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.horse.LlamaInventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; import java.util.ArrayList; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaMerchantOffersTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaMerchantOffersTranslator.java index 61b8471c6..799f7051a 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaMerchantOffersTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaMerchantOffersTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.inventory; +package org.geysermc.geyser.network.translators.java.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; @@ -35,14 +35,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.UpdateTradePacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.MerchantContainer; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.MerchantContainer; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaOpenScreenTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaOpenScreenTranslator.java index 5ce06c08a..bd2f9d3a2 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/inventory/JavaOpenScreenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaOpenScreenTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.inventory; +package org.geysermc.geyser.network.translators.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundOpenScreenPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.utils.InventoryUtils; -import org.geysermc.connector.utils.LocaleUtils; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.utils.LocaleUtils; @Translator(packet = ClientboundOpenScreenPacket.class) public class JavaOpenScreenTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockDestructionTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockDestructionTranslator.java index 3b0e4d891..56b78f74b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockDestructionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockDestructionTranslator.java @@ -23,26 +23,26 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockDestructionPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.utils.BlockUtils; @Translator(packet = ClientboundBlockDestructionPacket.class) public class JavaBlockDestructionTranslator extends PacketTranslator { @Override public void translate(GeyserSession session, ClientboundBlockDestructionPacket packet) { - int state = session.getConnector().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); + int state = session.getGeyser().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); int breakTime = (int) (65535 / Math.ceil(BlockUtils.getBreakTime(session, BlockRegistries.JAVA_BLOCKS.get(state), ItemMapping.AIR, new CompoundTag(""), false) * 20)); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(Vector3f.from( diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEntityDataTranslator.java similarity index 83% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEntityDataTranslator.java index d68823d1a..aa756d094 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEntityDataTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -32,14 +32,14 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.network.translators.world.block.entity.RequiresBlockState; -import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; -import org.geysermc.connector.utils.BlockEntityUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.network.translators.world.block.entity.RequiresBlockState; +import org.geysermc.geyser.network.translators.world.block.entity.SkullBlockEntityTranslator; +import org.geysermc.geyser.utils.BlockEntityUtils; @Translator(packet = ClientboundBlockEntityDataPacket.class) public class JavaBlockEntityDataTranslator extends PacketTranslator { @@ -51,7 +51,7 @@ public class JavaBlockEntityDataTranslator extends PacketTranslator { @@ -67,18 +67,18 @@ public class JavaBlockEventTranslator extends PacketTranslator { - int blockId = session.getConnector().getWorldManager().getBlockAt(session, position); + int blockId = session.getGeyser().getWorldManager().getBlockAt(session, position); boolean sticky = BlockStateValues.isStickyPiston(blockId); boolean extended = action != PistonValueType.PUSHING; return new PistonBlockEntity(session, pos, direction, sticky, extended); diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockUpdateTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockUpdateTranslator.java index f0042ae00..aa5a3ac56 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockUpdateTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket; @@ -31,12 +31,12 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.common.PlatformType; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.ChunkUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.ChunkUtils; @Translator(packet = ClientboundBlockUpdatePacket.class) public class JavaBlockUpdateTranslator extends PacketTranslator { @@ -44,8 +44,8 @@ public class JavaBlockUpdateTranslator extends PacketTranslator { @@ -47,7 +47,7 @@ public class JavaCustomSoundTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaForgetLevelChunkTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaForgetLevelChunkTranslator.java index aba3c746a..f800d77a8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaForgetLevelChunkTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaForgetLevelChunkTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; import com.nukkitx.math.vector.Vector3i; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; import java.util.Iterator; @@ -50,7 +50,7 @@ public class JavaForgetLevelChunkTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelChunkWithLightTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelChunkWithLightTranslator.java index 9fd862dfe..1bd0959c5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelChunkWithLightTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection; @@ -49,29 +49,29 @@ import io.netty.buffer.ByteBufOutputStream; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; -import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.BiomeTranslator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator; -import org.geysermc.connector.network.translators.world.chunk.BlockStorage; -import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; -import org.geysermc.connector.network.translators.world.chunk.bitarray.SingletonBitArray; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.BlockEntityUtils; -import org.geysermc.connector.utils.ChunkUtils; +import org.geysermc.geyser.entity.ItemFrameEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.world.BiomeTranslator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.entity.BedrockOnlyBlockEntity; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.network.translators.world.block.entity.SkullBlockEntityTranslator; +import org.geysermc.geyser.network.translators.world.chunk.BlockStorage; +import org.geysermc.geyser.network.translators.world.chunk.GeyserChunkSection; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArray; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArrayVersion; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.SingletonBitArray; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.utils.ChunkUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.*; -import static org.geysermc.connector.utils.ChunkUtils.*; +import static org.geysermc.geyser.utils.ChunkUtils.*; @Translator(packet = ClientboundLevelChunkWithLightPacket.class) public class JavaLevelChunkWithLightTranslator extends PacketTranslator { @@ -258,7 +258,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF); case SCRAPE -> effectPacket.setType(LevelEventType.PARTICLE_SCRAPE); default -> { - GeyserConnector.getInstance().getLogger().debug("Unhandled particle event: " + particleEvent.name()); + GeyserImpl.getInstance().getLogger().debug("Unhandled particle event: " + particleEvent.name()); return; } } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelParticlesTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelParticlesTranslator.java index c4ca16042..f0d14c392 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaLevelParticlesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelParticlesTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.level.particle.*; @@ -34,13 +34,13 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ParticleMapping; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ParticleMapping; +import org.geysermc.geyser.utils.DimensionUtils; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; @@ -70,7 +70,7 @@ public class JavaLevelParticlesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java index 11958b832..49c852bcf 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.ChunkUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.ChunkUtils; @Translator(packet = ClientboundSectionBlocksUpdatePacket.class) public class JavaSectionBlocksUpdateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java index 6ddbf8eea..a9c0526a8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.ChunkUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.ChunkUtils; import com.nukkitx.math.vector.Vector3i; @Translator(packet = ClientboundSetChunkCacheCenterPacket.class) diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java index 29c2ed094..f170d430c 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetChunkCacheRadiusPacket.class) public class JavaSetChunkCacheRadiusTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java index 025b09882..fbae567fc 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.utils.DimensionUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.utils.DimensionUtils; @Translator(packet = ClientboundSetDefaultSpawnPositionPacket.class) public class JavaSetDefaultSpawnPositionTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetTimeTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetTimeTranslator.java index 1c2081bc3..62ee60d2d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSetTimeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetTimeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; import com.nukkitx.protocol.bedrock.packet.SetTimePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetTimePacket.class) public class JavaSetTimeTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSoundTranslator.java similarity index 82% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSoundTranslator.java index dbf331aa2..7e6d1f979 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/JavaSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSoundTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level; +package org.geysermc.geyser.network.translators.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket; import com.nukkitx.math.vector.Vector3f; @@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.utils.SoundUtils; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.SoundMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.utils.SoundUtils; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.SoundMapping; @Translator(packet = ClientboundSoundPacket.class) public class JavaSoundTranslator extends PacketTranslator { @@ -49,7 +49,7 @@ public class JavaSoundTranslator extends PacketTranslator { @@ -55,18 +55,18 @@ public class JavaStopSoundTranslator extends PacketTranslator " + soundMapping + (soundMapping == null ? "[not found]" : "") + " - " + packet.toString()); String playsound; if (soundMapping == null || soundMapping.getPlaysound() == null) { // no mapping - session.getConnector().getLogger() + session.getGeyser().getLogger() .debug("[StopSound] Defaulting to sound server gave us."); playsound = packetSound; } else { @@ -79,6 +79,6 @@ public class JavaStopSoundTranslator extends PacketTranslator " + stopSoundPacket); + session.getGeyser().getLogger().debug("[StopSound] Packet sent - " + packet.toString() + " --> " + stopSoundPacket); } } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaInitializeBorderTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaInitializeBorderTranslator.java index 1a3ed5b30..5f1bc1585 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaInitializeBorderTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaInitializeBorderTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level.border; +package org.geysermc.geyser.network.translators.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldBorder; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldBorder; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundInitializeBorderPacket.class) public class JavaInitializeBorderTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderCenterTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderCenterTranslator.java index 85ad2512e..4051382f4 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderCenterTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level.border; +package org.geysermc.geyser.network.translators.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldBorder; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldBorder; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetBorderCenterPacket.class) public class JavaSetBorderCenterTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java index bfead0466..7d068b031 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level.border; +package org.geysermc.geyser.network.translators.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldBorder; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldBorder; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetBorderLerpSizePacket.class) public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderSizeTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderSizeTranslator.java index 0de9f339c..12f93d5cc 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderSizeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level.border; +package org.geysermc.geyser.network.translators.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderSizePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldBorder; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldBorder; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetBorderSizePacket.class) public class JavaSetBorderSizeTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java index 850a7186e..9e5b75df1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level.border; +package org.geysermc.geyser.network.translators.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDelayPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldBorder; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldBorder; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetBorderWarningDelayPacket.class) public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java index 33a984357..b3dbc083b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.level.border; +package org.geysermc.geyser.network.translators.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDistancePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldBorder; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldBorder; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetBorderWarningDistancePacket.class) public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java similarity index 83% rename from core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java index be4f4ce8a..ac150d3a1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.scoreboard; +package org.geysermc.geyser.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldCache; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.scoreboard.Scoreboard; -import org.geysermc.connector.scoreboard.ScoreboardUpdater; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldCache; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.scoreboard.Scoreboard; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater; @Translator(packet = ClientboundSetDisplayObjectivePacket.class) public class JavaSetDisplayObjectiveTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java similarity index 82% rename from core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java index 8c1ab9124..77969cf84 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java @@ -23,27 +23,27 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.scoreboard; +package org.geysermc.geyser.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetObjectivePacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldCache; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.scoreboard.Objective; -import org.geysermc.connector.scoreboard.Scoreboard; -import org.geysermc.connector.scoreboard.ScoreboardUpdater; -import org.geysermc.connector.scoreboard.UpdateType; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldCache; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.scoreboard.Objective; +import org.geysermc.geyser.scoreboard.Scoreboard; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater; +import org.geysermc.geyser.scoreboard.UpdateType; @Translator(packet = ClientboundSetObjectivePacket.class) public class JavaSetObjectiveTranslator extends PacketTranslator { - private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); + private final GeyserLogger logger = GeyserImpl.getInstance().getLogger(); @Override public void translate(GeyserSession session, ClientboundSetObjectivePacket packet) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java index 8d288917a..00b8c76cb 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java @@ -23,29 +23,29 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.scoreboard; +package org.geysermc.geyser.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetPlayerTeamPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.scoreboard.Scoreboard; -import org.geysermc.connector.scoreboard.ScoreboardUpdater; -import org.geysermc.connector.scoreboard.Team; -import org.geysermc.connector.scoreboard.UpdateType; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.scoreboard.Scoreboard; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater; +import org.geysermc.geyser.scoreboard.Team; +import org.geysermc.geyser.scoreboard.UpdateType; import java.util.Arrays; import java.util.Set; @Translator(packet = ClientboundSetPlayerTeamPacket.class) public class JavaSetPlayerTeamTranslator extends PacketTranslator { - private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); + private final GeyserLogger logger = GeyserImpl.getInstance().getLogger(); @Override public void translate(GeyserSession session, ClientboundSetPlayerTeamPacket packet) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetScoreTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetScoreTranslator.java index 76e64490b..4216a34dd 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaSetScoreTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetScoreTranslator.java @@ -23,31 +23,31 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.scoreboard; +package org.geysermc.geyser.network.translators.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetScorePacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldCache; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.scoreboard.Objective; -import org.geysermc.connector.scoreboard.Scoreboard; -import org.geysermc.connector.scoreboard.ScoreboardUpdater; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldCache; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.scoreboard.Objective; +import org.geysermc.geyser.scoreboard.Scoreboard; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater; +import org.geysermc.geyser.utils.LanguageUtils; @Translator(packet = ClientboundSetScorePacket.class) public class JavaSetScoreTranslator extends PacketTranslator { private final GeyserLogger logger; public JavaSetScoreTranslator() { - logger = GeyserConnector.getInstance().getLogger(); + logger = GeyserImpl.getInstance().getLogger(); } @Override diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaClearTitlesTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaClearTitlesTranslator.java index b1d1d38ce..b1c42e968 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaClearTitlesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaClearTitlesTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.title; +package org.geysermc.geyser.network.translators.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundClearTitlesPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundClearTitlesPacket.class) public class JavaClearTitlesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetActionBarTextTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetActionBarTextTranslator.java index 207599770..b5e5806f7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetActionBarTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetActionBarTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.title; +package org.geysermc.geyser.network.translators.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = ClientboundSetActionBarTextPacket.class) public class JavaSetActionBarTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetSubtitleTextTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetSubtitleTextTranslator.java index e17debf6b..4865a4e00 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetSubtitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetSubtitleTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.title; +package org.geysermc.geyser.network.translators.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetSubtitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = ClientboundSetSubtitleTextPacket.class) public class JavaSetSubtitleTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitleTextTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitleTextTranslator.java index fb335fc76..8d54ac704 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitleTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.title; +package org.geysermc.geyser.network.translators.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @Translator(packet = ClientboundSetTitleTextPacket.class) public class JavaSetTitleTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitlesAnimationTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitlesAnimationTranslator.java index 20dcc9b3c..e00a61db9 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/java/title/JavaSetTitlesAnimationTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitlesAnimationTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.java.title; +package org.geysermc.geyser.network.translators.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitlesAnimationPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.PacketTranslator; -import org.geysermc.connector.network.translators.Translator; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.PacketTranslator; +import org.geysermc.geyser.network.translators.Translator; @Translator(packet = ClientboundSetTitlesAnimationPacket.class) public class JavaSetTitlesAnimationTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/BlockSoundInteractionHandler.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/BlockSoundInteractionHandler.java index 22ccd158c..7fbc5d6f4 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/BlockSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/BlockSoundInteractionHandler.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound; +package org.geysermc.geyser.network.translators.sound; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -31,10 +31,10 @@ import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.BlockUtils; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.BlockUtils; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/EntitySoundInteractionHandler.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/EntitySoundInteractionHandler.java index 193b90e1c..8adbf0dad 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/EntitySoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/EntitySoundInteractionHandler.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound; +package org.geysermc.geyser.network.translators.sound; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.Registries; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.Registries; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundHandler.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundHandler.java index f12e91db2..def77300d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundHandler.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound; +package org.geysermc.geyser.network.translators.sound; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundInteractionHandler.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundInteractionHandler.java index 8f25b8e8e..d3370be5f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/SoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundInteractionHandler.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound; +package org.geysermc.geyser.network.translators.sound; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; /** * Handler for playing sounds when right-clicking diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/BucketSoundInteractionHandler.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/BucketSoundInteractionHandler.java index 74f7b7878..7e3148e38 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/BucketSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/BucketSoundInteractionHandler.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler(items = "bucket", ignoreSneakingWhileHolding = true) public class BucketSoundInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/ComparatorSoundInteractionHandler.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/ComparatorSoundInteractionHandler.java index 86a68ad30..31c18d2b3 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/ComparatorSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/ComparatorSoundInteractionHandler.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler(blocks = "comparator") public class ComparatorSoundInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/DoorSoundInteractionHandler.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/DoorSoundInteractionHandler.java index 8c6c62f06..952bf18ae 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/DoorSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/DoorSoundInteractionHandler.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler(blocks = {"door", "fence_gate"}) public class DoorSoundInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/FlintAndSteelInteractionHandler.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/FlintAndSteelInteractionHandler.java index 794b87086..59d12d202 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/FlintAndSteelInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/FlintAndSteelInteractionHandler.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler(items = "flint_and_steel", ignoreSneakingWhileHolding = true) public class FlintAndSteelInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/GrassPathInteractionHandler.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/GrassPathInteractionHandler.java index 32943107f..b9f838e14 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/GrassPathInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/GrassPathInteractionHandler.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; -import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.registry.BlockRegistries; @SoundHandler(blocks = "grass_path", items = "shovel", ignoreSneakingWhileHolding = true) public class GrassPathInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/HoeInteractionHandler.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/HoeInteractionHandler.java index 5402aa16c..7cfbc7813 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/HoeInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/HoeInteractionHandler.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; -import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.registry.BlockRegistries; @SoundHandler(blocks = "farmland", items = "hoe", ignoreSneakingWhileHolding = true) public class HoeInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/LeverSoundInteractionHandler.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/block/LeverSoundInteractionHandler.java index 83fe79f27..5cfaac2ec 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/block/LeverSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/LeverSoundInteractionHandler.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.block; +package org.geysermc.geyser.network.translators.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler(blocks = "lever") public class LeverSoundInteractionHandler implements BlockSoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/FeedBabySoundInteractionHandler.java similarity index 81% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/FeedBabySoundInteractionHandler.java index d7fa03943..fa4c1a48f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/entity/FeedBabySoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/FeedBabySoundInteractionHandler.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.entity; +package org.geysermc.geyser.network.translators.sound.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.entity.living.animal.OcelotEntity; -import org.geysermc.connector.entity.living.animal.tameable.CatEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.EntitySoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.animal.AnimalEntity; +import org.geysermc.geyser.entity.living.animal.OcelotEntity; +import org.geysermc.geyser.entity.living.animal.tameable.CatEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.EntitySoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler public class FeedBabySoundInteractionHandler implements EntitySoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java index 948b69afb..eb6060378 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.sound.entity; +package org.geysermc.geyser.network.translators.sound.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.animal.GoatEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.sound.EntitySoundInteractionHandler; -import org.geysermc.connector.network.translators.sound.SoundHandler; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.animal.GoatEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.sound.EntitySoundInteractionHandler; +import org.geysermc.geyser.network.translators.sound.SoundHandler; @SoundHandler(entities = {"cow", "goat"}, items = "bucket") public class MilkEntitySoundInteractionHandler implements EntitySoundInteractionHandler { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/BiomeTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/BiomeTranslator.java index a61bfc985..7f24dfe94 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/BiomeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/BiomeTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world; +package org.geysermc.geyser.network.translators.world; import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; @@ -35,14 +35,14 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.chunk.BlockStorage; -import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; -import org.geysermc.connector.network.translators.world.chunk.bitarray.SingletonBitArray; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.chunk.BlockStorage; +import org.geysermc.geyser.network.translators.world.chunk.GeyserChunkSection; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArray; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArrayVersion; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.SingletonBitArray; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.MathUtils; // Array index formula by https://wiki.vg/Chunk_Format public class BiomeTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/GeyserWorldManager.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/GeyserWorldManager.java index 52d9c9b4a..41c3e0a55 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/GeyserWorldManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world; +package org.geysermc.geyser.network.translators.world; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; @@ -32,11 +32,11 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.ChunkCache; -import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.utils.GameRule; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.ChunkCache; +import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.utils.GameRule; public class GeyserWorldManager extends WorldManager { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/WorldManager.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/WorldManager.java index ca945bfb4..a6fbe94d1 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/WorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/WorldManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world; +package org.geysermc.geyser.network.translators.world; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.GameRule; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.GameRule; /** * Class that manages or retrieves various information diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/BlockStateValues.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/BlockStateValues.java index a1c47c2b6..486ae745e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/BlockStateValues.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/BlockStateValues.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block; +package org.geysermc.geyser.network.translators.world.block; import com.fasterxml.jackson.databind.JsonNode; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import org.geysermc.connector.network.translators.world.block.entity.PistonBlockEntityTranslator; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.type.BlockMapping; -import org.geysermc.connector.utils.Direction; -import org.geysermc.connector.utils.PistonBehavior; -import org.geysermc.connector.utils.collections.FixedInt2ByteMap; -import org.geysermc.connector.utils.collections.FixedInt2IntMap; -import org.geysermc.connector.utils.collections.LecternHasBookMap; +import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntityTranslator; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.type.BlockMapping; +import org.geysermc.geyser.utils.Direction; +import org.geysermc.geyser.utils.PistonBehavior; +import org.geysermc.geyser.utils.collections.FixedInt2ByteMap; +import org.geysermc.geyser.utils.collections.FixedInt2IntMap; +import org.geysermc.geyser.utils.collections.LecternHasBookMap; /** * Used for block entities if the Java block state contains Bedrock block information. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/DoubleChestValue.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/DoubleChestValue.java index fc998f257..b1e81b92c 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/DoubleChestValue.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/DoubleChestValue.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block; +package org.geysermc.geyser.network.translators.world.block; /** * This stores all values of double chests that are part of the Java block state. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BannerBlockEntityTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BannerBlockEntityTranslator.java index 107f04fc9..e0911738d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BannerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BannerBlockEntityTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.translators.item.translators.BannerTranslator; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.item.translators.BannerTranslator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; @BlockEntity(type = BlockEntityType.BANNER) public class BannerBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BeaconBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BeaconBlockEntityTranslator.java index b2e23c13d..1c0007cc4 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BeaconBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BeaconBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedBlockEntityTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedBlockEntityTranslator.java index c55f2ceb4..76a2e1726 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedBlockEntityTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; @BlockEntity(type = BlockEntityType.BED) public class BedBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedrockOnlyBlockEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedrockOnlyBlockEntity.java index 5b96dc70d..e1a3ffb45 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BedrockOnlyBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedrockOnlyBlockEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; /** * Implemented only if a block is a block entity in Bedrock and not Java Edition. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntity.java index 2fb50ad10..987f62151 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntityTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntityTranslator.java index fbc97093d..84d86e36e 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/BlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -32,7 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.utils.BlockEntityUtils; +import org.geysermc.geyser.utils.BlockEntityUtils; /** * The class that all block entities (on both Java and Bedrock) should translate with diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CampfireBlockEntityTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CampfireBlockEntityTranslator.java index a2ecd5d64..255d8a52c 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CampfireBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CampfireBlockEntityTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; @BlockEntity(type = BlockEntityType.CAMPFIRE) public class CampfireBlockEntityTranslator extends BlockEntityTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java index 16029dc8d..68d0e76fa 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; @BlockEntity(type = BlockEntityType.COMMAND_BLOCK) public class CommandBlockBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java index ea1dffa4c..43c872a75 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.block.DoubleChestValue; -import org.geysermc.connector.utils.BlockEntityUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.DoubleChestValue; +import org.geysermc.geyser.utils.BlockEntityUtils; /** * Chests have more block entity properties in Bedrock, which is solved by implementing the BedrockOnlyBlockEntity diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EmptyBlockEntityTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EmptyBlockEntityTranslator.java index 88edcf7b4..259beb742 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EmptyBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EmptyBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMapBuilder; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java index 6803ead23..310d272a6 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java index 833542543..b497e6eab 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.utils.BlockEntityUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.utils.BlockEntityUtils; public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity { /** diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java index 374e73a4f..b38a370a5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java index a0c1033c5..8adea545d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; /** * Does not implement BlockEntityTranslator because it's only a block entity in Bedrock @@ -37,7 +37,7 @@ import org.geysermc.connector.network.translators.world.block.BlockStateValues; public class NoteblockBlockEntityTranslator { public static void translate(GeyserSession session, Position position) { - int blockState = session.getConnector().getWorldManager().getBlockAt(session, position); + int blockState = session.getGeyser().getWorldManager().getBlockAt(session, position); BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(position.getX(), position.getY(), position.getZ())); blockEventPacket.setEventType(0); diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntity.java index 3cd4b94c0..dca5a6ed9 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3d; @@ -37,14 +37,14 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Getter; import org.geysermc.common.PlatformType; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.PistonCache; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionManager; -import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.utils.*; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.PistonCache; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionManager; +import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.utils.*; import java.util.LinkedList; import java.util.Map; @@ -216,10 +216,10 @@ public class PistonBlockEntity { private void removePistonHead() { Vector3i blockInFront = position.add(orientation.getUnitVector()); - int blockId = session.getConnector().getWorldManager().getBlockAt(session, blockInFront); + int blockId = session.getGeyser().getWorldManager().getBlockAt(session, blockInFront); if (BlockStateValues.isPistonHead(blockId)) { ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, blockInFront); - } else if (session.getConnector().getPlatformType() == PlatformType.SPIGOT && blockId == BlockStateValues.JAVA_AIR_ID) { + } else if (session.getGeyser().getPlatformType() == PlatformType.SPIGOT && blockId == BlockStateValues.JAVA_AIR_ID) { // Spigot removes the piston head from the cache, but we need to send the block update ourselves ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, blockInFront); } @@ -250,7 +250,7 @@ public class PistonBlockEntity { if (!blocksChecked.add(blockPos)) { continue; } - int blockId = session.getConnector().getWorldManager().getBlockAt(session, blockPos); + int blockId = session.getGeyser().getWorldManager().getBlockAt(session, blockPos); if (blockId == BlockStateValues.JAVA_AIR_ID) { continue; } @@ -273,7 +273,7 @@ public class PistonBlockEntity { if (action == PistonValueType.PULLING && position.add(directionOffset).equals(adjacentPos)) { continue; } - int adjacentBlockId = session.getConnector().getWorldManager().getBlockAt(session, adjacentPos); + int adjacentBlockId = session.getGeyser().getWorldManager().getBlockAt(session, adjacentPos); if (adjacentBlockId != BlockStateValues.JAVA_AIR_ID && BlockStateValues.isBlockAttached(blockId, adjacentBlockId) && BlockStateValues.canPistonMoveBlock(adjacentBlockId, false)) { // If it is another slime/honey block we need to check its adjacent blocks if (BlockStateValues.isBlockSticky(adjacentBlockId)) { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntityTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntityTranslator.java index e06a60121..c39112fb2 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/PistonBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntityTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; /** * Pistons are a special case where they are only a block entity on Bedrock. diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/RequiresBlockState.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/RequiresBlockState.java index 76fb732b7..b6df97ec2 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/RequiresBlockState.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/RequiresBlockState.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; /** * Implemented in block entities if their Java block state is required for additional values in Bedrock diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java index 4fb804ec5..ad2855f0a 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; import javax.annotation.Nullable; @BlockEntity(type = BlockEntityType.SHULKER_BOX) public class ShulkerBoxBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { /** - * Also used in {@link org.geysermc.connector.network.translators.inventory.translators.ShulkerInventoryTranslator} + * Also used in {@link org.geysermc.geyser.network.translators.inventory.translators.ShulkerInventoryTranslator} * where {@code tag} is passed as null. */ @Override diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SignBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SignBlockEntityTranslator.java index 5057345da..386e16fb8 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SignBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SignBlockEntityTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.network.translators.chat.MessageTranslator; -import org.geysermc.connector.utils.SignUtils; +import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.utils.SignUtils; @BlockEntity(type = BlockEntityType.SIGN) public class SignBlockEntityTranslator extends BlockEntityTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SkullBlockEntityTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SkullBlockEntityTranslator.java index 979cb75df..f32fef041 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; @@ -34,11 +34,11 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.player.SkullPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.skin.SkinProvider; -import org.geysermc.connector.skin.SkullSkinManager; +import org.geysermc.geyser.entity.player.SkullPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.skin.SkinProvider; +import org.geysermc.geyser.skin.SkullSkinManager; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -111,7 +111,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements getProfile(tag).whenComplete((gameProfile, throwable) -> { if (gameProfile == null) { - session.getConnector().getLogger().debug("Custom skull with invalid SkullOwner tag: " + blockPosition + " " + tag); + session.getGeyser().getLogger().debug("Custom skull with invalid SkullOwner tag: " + blockPosition + " " + tag); return; } diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java index 88cee13b0..017cd03b7 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.block.entity; +package org.geysermc.geyser.network.translators.world.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.registry.Registries; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.registry.Registries; @BlockEntity(type = BlockEntityType.MOB_SPAWNER) public class SpawnerBlockEntityTranslator extends BlockEntityTranslator { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/BlockStorage.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/BlockStorage.java index ae7c25f1d..07f4dbcef 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/BlockStorage.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/BlockStorage.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk; +package org.geysermc.geyser.network.translators.world.chunk; import com.nukkitx.network.VarInts; import io.netty.buffer.ByteBuf; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import lombok.Getter; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray; -import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArray; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArrayVersion; import java.util.function.IntConsumer; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunk.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunk.java index 995c1e600..67257471d 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunk.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunk.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk; +package org.geysermc.geyser.network.translators.world.chunk; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunkSection.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunkSection.java index d4fab5967..7c0c18804 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/GeyserChunkSection.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunkSection.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk; +package org.geysermc.geyser.network.translators.world.chunk; import com.nukkitx.network.util.Preconditions; import io.netty.buffer.ByteBuf; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/NibbleArray.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/NibbleArray.java index f028af801..970ae5f79 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/NibbleArray.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/NibbleArray.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk; +package org.geysermc.geyser.network.translators.world.chunk; import com.nukkitx.network.util.Preconditions; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArray.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArray.java index c9621b144..e44d92b20 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArray.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArray.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.network.translators.world.chunk.bitarray; import com.nukkitx.network.VarInts; import io.netty.buffer.ByteBuf; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArrayVersion.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArrayVersion.java index d39a1216f..c3cf94aaf 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/BitArrayVersion.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArrayVersion.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.network.translators.world.chunk.bitarray; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.utils.MathUtils; public enum BitArrayVersion { V16(16, 2, null), diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/PaddedBitArray.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/PaddedBitArray.java index b770d0dc7..9b2c43ee5 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/PaddedBitArray.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/PaddedBitArray.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.network.translators.world.chunk.bitarray; import com.nukkitx.network.util.Preconditions; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.utils.MathUtils; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/Pow2BitArray.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/Pow2BitArray.java index 1a784b7f9..5ad65b5aa 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/Pow2BitArray.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/Pow2BitArray.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.network.translators.world.chunk.bitarray; import com.nukkitx.network.util.Preconditions; -import org.geysermc.connector.utils.MathUtils; +import org.geysermc.geyser.utils.MathUtils; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/SingletonBitArray.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/SingletonBitArray.java index db4e05301..13482307f 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/chunk/bitarray/SingletonBitArray.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/SingletonBitArray.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.network.translators.world.chunk.bitarray; import io.netty.buffer.ByteBuf; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/LevelEventTransformer.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/event/LevelEventTransformer.java index 31d62e825..2949bfad4 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/event/LevelEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/LevelEventTransformer.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.event; +package org.geysermc.geyser.network.translators.world.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; /** * Represents an event capable of translating itself into bedrock diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/PlaySoundEventTransformer.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/event/PlaySoundEventTransformer.java index e3a0e6a68..194b62948 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/event/PlaySoundEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/PlaySoundEventTransformer.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.event; +package org.geysermc.geyser.network.translators.world.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundEventEventTransformer.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundEventEventTransformer.java index a9998d518..425e28c9b 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundEventEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundEventEventTransformer.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.event; +package org.geysermc.geyser.network.translators.world.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public record SoundEventEventTransformer(SoundEvent soundEvent, String identifier, int extraData) implements LevelEventTransformer { diff --git a/core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundLevelEventTransformer.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundLevelEventTransformer.java index 26bcfbeae..f15d2a7ad 100644 --- a/core/src/main/java/org/geysermc/connector/network/translators/world/event/SoundLevelEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundLevelEventTransformer.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.world.event; +package org.geysermc.geyser.network.translators.world.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public record SoundLevelEventTransformer(LevelEventType levelEventType, int data) implements LevelEventTransformer { diff --git a/core/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java b/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java similarity index 75% rename from core/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java rename to core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java index 9cbbf5c4f..88671b66f 100644 --- a/core/src/main/java/org/geysermc/connector/ping/GeyserLegacyPingPassthrough.java +++ b/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.ping; +package org.geysermc.geyser.ping; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.nukkitx.nbt.util.VarInts; -import org.geysermc.connector.common.ping.GeyserPingInfo; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.MinecraftProtocol; +import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.MinecraftProtocol; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; @@ -43,26 +43,26 @@ import java.net.SocketTimeoutException; import java.util.concurrent.TimeUnit; public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runnable { - private final GeyserConnector connector; + private final GeyserImpl geyser; - public GeyserLegacyPingPassthrough(GeyserConnector connector) { - this.connector = connector; + public GeyserLegacyPingPassthrough(GeyserImpl geyser) { + this.geyser = geyser; } private GeyserPingInfo pingInfo; /** * Start legacy ping passthrough thread - * @param connector GeyserConnector + * @param geyser Geyser * @return GeyserPingPassthrough, or null if not initialized */ - public static IGeyserPingPassthrough init(GeyserConnector connector) { - if (connector.getConfig().isPassthroughMotd() || connector.getConfig().isPassthroughPlayerCounts()) { - GeyserLegacyPingPassthrough pingPassthrough = new GeyserLegacyPingPassthrough(connector); + public static IGeyserPingPassthrough init(GeyserImpl geyser) { + if (geyser.getConfig().isPassthroughMotd() || geyser.getConfig().isPassthroughPlayerCounts()) { + GeyserLegacyPingPassthrough pingPassthrough = new GeyserLegacyPingPassthrough(geyser); // Ensure delay is not zero - int interval = (connector.getConfig().getPingPassthroughInterval() == 0) ? 1 : connector.getConfig().getPingPassthroughInterval(); - connector.getLogger().debug("Scheduling ping passthrough at an interval of " + interval + " second(s)."); - connector.getScheduledThread().scheduleAtFixedRate(pingPassthrough, 1, interval, TimeUnit.SECONDS); + int interval = (geyser.getConfig().getPingPassthroughInterval() == 0) ? 1 : geyser.getConfig().getPingPassthroughInterval(); + geyser.getLogger().debug("Scheduling ping passthrough at an interval of " + interval + " second(s)."); + geyser.getScheduledThread().scheduleAtFixedRate(pingPassthrough, 1, interval, TimeUnit.SECONDS); return pingPassthrough; } return null; @@ -77,8 +77,8 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn public void run() { try { Socket socket = new Socket(); - String address = connector.getConfig().getRemote().getAddress(); - int port = connector.getConfig().getRemote().getPort(); + String address = geyser.getConfig().getRemote().getAddress(); + int port = geyser.getConfig().getRemote().getPort(); socket.connect(new InetSocketAddress(address, port), 5000); ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); @@ -109,7 +109,7 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn VarInts.readUnsignedInt(dataInputStream); String json = new String(buffer); - this.pingInfo = GeyserConnector.JSON_MAPPER.readValue(json, GeyserPingInfo.class); + this.pingInfo = GeyserImpl.JSON_MAPPER.readValue(json, GeyserPingInfo.class); byteArrayStream.close(); handshake.close(); @@ -118,9 +118,9 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn socket.close(); } catch (SocketTimeoutException | ConnectException ex) { this.pingInfo = null; - this.connector.getLogger().debug("Connection timeout for ping passthrough."); + this.geyser.getLogger().debug("Connection timeout for ping passthrough."); } catch (JsonParseException | JsonMappingException ex) { - this.connector.getLogger().error("Failed to parse json when pinging server!", ex); + this.geyser.getLogger().error("Failed to parse json when pinging server!", ex); } catch (IOException e) { e.printStackTrace(); } diff --git a/core/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java b/core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java rename to core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java index 2ca0ea9c5..5a2eb04ae 100644 --- a/core/src/main/java/org/geysermc/connector/ping/IGeyserPingPassthrough.java +++ b/core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.ping; +package org.geysermc.geyser.ping; -import org.geysermc.connector.common.ping.GeyserPingInfo; +import org.geysermc.geyser.common.ping.GeyserPingInfo; import java.net.Inet4Address; import java.net.InetSocketAddress; diff --git a/core/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java rename to core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java index c5c7cf87f..390d3b2aa 100644 --- a/core/src/main/java/org/geysermc/connector/registry/AbstractMappedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import javax.annotation.Nullable; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/ArrayRegistry.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java rename to core/src/main/java/org/geysermc/geyser/registry/ArrayRegistry.java index bb97ddb12..5ef0aeba0 100644 --- a/core/src/main/java/org/geysermc/connector/registry/ArrayRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/ArrayRegistry.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import javax.annotation.Nullable; import java.util.function.Supplier; diff --git a/core/src/main/java/org/geysermc/connector/registry/BlockRegistries.java b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/registry/BlockRegistries.java rename to core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java index 191b45952..c80eb739b 100644 --- a/core/src/main/java/org/geysermc/connector/registry/BlockRegistries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.connector.registry.loader.RegistryLoaders; -import org.geysermc.connector.registry.populator.BlockRegistryPopulator; -import org.geysermc.connector.registry.type.BlockMapping; -import org.geysermc.connector.registry.type.BlockMappings; -import org.geysermc.connector.utils.collections.Object2IntBiMap; +import org.geysermc.geyser.registry.loader.RegistryLoaders; +import org.geysermc.geyser.registry.populator.BlockRegistryPopulator; +import org.geysermc.geyser.registry.type.BlockMapping; +import org.geysermc.geyser.registry.type.BlockMappings; +import org.geysermc.geyser.utils.collections.Object2IntBiMap; /** * Holds all the block registries in Geyser. diff --git a/core/src/main/java/org/geysermc/connector/registry/MappedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/MappedRegistry.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/MappedRegistry.java rename to core/src/main/java/org/geysermc/geyser/registry/MappedRegistry.java index 523024ab3..9860eda78 100644 --- a/core/src/main/java/org/geysermc/connector/registry/MappedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/MappedRegistry.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import java.util.Map; import java.util.function.Supplier; diff --git a/core/src/main/java/org/geysermc/connector/registry/Registries.java b/core/src/main/java/org/geysermc/geyser/registry/Registries.java similarity index 84% rename from core/src/main/java/org/geysermc/connector/registry/Registries.java rename to core/src/main/java/org/geysermc/geyser/registry/Registries.java index 15fbeb03f..ef73e28e9 100644 --- a/core/src/main/java/org/geysermc/connector/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; @@ -39,20 +39,20 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.connector.entity.EntityDefinition; -import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; -import org.geysermc.connector.network.translators.sound.SoundHandler; -import org.geysermc.connector.network.translators.sound.SoundInteractionHandler; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.network.translators.world.event.LevelEventTransformer; -import org.geysermc.connector.registry.loader.*; -import org.geysermc.connector.registry.populator.ItemRegistryPopulator; -import org.geysermc.connector.registry.populator.RecipeRegistryPopulator; -import org.geysermc.connector.registry.type.EnchantmentData; -import org.geysermc.connector.registry.type.ItemMappings; -import org.geysermc.connector.registry.type.ParticleMapping; -import org.geysermc.connector.registry.type.SoundMapping; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; +import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.network.translators.sound.SoundInteractionHandler; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.network.translators.world.event.LevelEventTransformer; +import org.geysermc.geyser.registry.loader.*; +import org.geysermc.geyser.registry.populator.ItemRegistryPopulator; +import org.geysermc.geyser.registry.populator.RecipeRegistryPopulator; +import org.geysermc.geyser.registry.type.EnchantmentData; +import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.registry.type.ParticleMapping; +import org.geysermc.geyser.registry.type.SoundMapping; import java.util.EnumMap; import java.util.List; @@ -81,12 +81,12 @@ public class Registries { /** * A mapped registry which stores a block entity identifier to its {@link BlockEntityTranslator}. */ - public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); + public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.geyser.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); /** * A mapped registry containing which holds block IDs to its {@link BlockCollision}. */ - public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.connector.network.translators.collision.translators.Translator", "mappings/collision.json"), CollisionRegistryLoader::new); + public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.geyser.network.translators.collision.translators.Translator", "mappings/collision.json"), CollisionRegistryLoader::new); /** * A versioned registry which holds a {@link RecipeType} to a corresponding list of {@link CraftingData}. @@ -149,7 +149,7 @@ public class Registries { /** * A mapped registry holding {@link SoundHandler}s to their corresponding {@link SoundInteractionHandler}. */ - public static final SimpleMappedRegistry> SOUND_HANDLERS = SimpleMappedRegistry.create("org.geysermc.connector.network.translators.sound.SoundHandler", SoundHandlerRegistryLoader::new); + public static final SimpleMappedRegistry> SOUND_HANDLERS = SimpleMappedRegistry.create("org.geysermc.geyser.network.translators.sound.SoundHandler", SoundHandlerRegistryLoader::new); public static void init() { // no-op diff --git a/core/src/main/java/org/geysermc/connector/registry/Registry.java b/core/src/main/java/org/geysermc/geyser/registry/Registry.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/registry/Registry.java rename to core/src/main/java/org/geysermc/geyser/registry/Registry.java index dfa0e3397..15a18e3b1 100644 --- a/core/src/main/java/org/geysermc/connector/registry/Registry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registry.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import java.util.function.Consumer; @@ -59,7 +59,7 @@ import java.util.function.Consumer; * though, the first parameter would be a location of some sort, such as a file path * where the loader will load the mappings from. The NBT registry is a good reference * point for something both simple and practical. See {@link Registries#BIOMES_NBT} and - * {@link org.geysermc.connector.registry.loader.NbtRegistryLoader}. + * {@link org.geysermc.geyser.registry.loader.NbtRegistryLoader}. * * @param the value being held by the registry */ diff --git a/core/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/SimpleMappedRegistry.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java rename to core/src/main/java/org/geysermc/geyser/registry/SimpleMappedRegistry.java index 938450014..9eddab92f 100644 --- a/core/src/main/java/org/geysermc/connector/registry/SimpleMappedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/SimpleMappedRegistry.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import java.util.Map; import java.util.function.Supplier; diff --git a/core/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/SimpleRegistry.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java rename to core/src/main/java/org/geysermc/geyser/registry/SimpleRegistry.java index 16bf24f79..b39aae450 100644 --- a/core/src/main/java/org/geysermc/connector/registry/SimpleRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/SimpleRegistry.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import java.util.function.Supplier; diff --git a/core/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java rename to core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java index 91b969df3..797c2ea48 100644 --- a/core/src/main/java/org/geysermc/connector/registry/VersionedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry; +package org.geysermc.geyser.registry; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import org.geysermc.connector.registry.loader.RegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoader; import java.util.Map; import java.util.function.Supplier; diff --git a/core/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java rename to core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java index 98e84a5c2..1f42d7fb0 100644 --- a/core/src/main/java/org/geysermc/connector/registry/loader/AnnotatedRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.loader; +package org.geysermc.geyser.registry.loader; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.connector.utils.FileUtils; +import org.geysermc.geyser.utils.FileUtils; import java.lang.annotation.Annotation; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java rename to core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java index c38e3efa9..5af552469 100644 --- a/core/src/main/java/org/geysermc/connector/registry/loader/BiomeIdentifierRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.loader; +package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.utils.FileUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.utils.FileUtils; import java.io.IOException; import java.io.InputStream; @@ -49,7 +49,7 @@ public class BiomeIdentifierRegistryLoader implements RegistryLoader biomeEntries; try (InputStream stream = FileUtils.getResource("mappings/biomes.json")) { - biomeEntries = GeyserConnector.JSON_MAPPER.readValue(stream, biomeEntriesType); + biomeEntries = GeyserImpl.JSON_MAPPER.readValue(stream, biomeEntriesType); } catch (IOException e) { throw new AssertionError("Unable to load Bedrock runtime biomes", e); } diff --git a/core/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java rename to core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java index 5e9d156a1..fd0f72a84 100644 --- a/core/src/main/java/org/geysermc/connector/registry/loader/BlockEntityRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.loader; +package org.geysermc.geyser.registry.loader; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntity; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.network.translators.world.block.entity.EmptyBlockEntityTranslator; -import org.geysermc.connector.utils.FileUtils; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntity; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.network.translators.world.block.entity.EmptyBlockEntityTranslator; +import org.geysermc.geyser.utils.FileUtils; import java.lang.reflect.InvocationTargetException; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java rename to core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java index 49ccfd831..bf3877ff6 100644 --- a/core/src/main/java/org/geysermc/connector/registry/loader/CollisionRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.loader; +package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.databind.node.ArrayNode; import it.unimi.dsi.fastutil.Pair; @@ -32,15 +32,15 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.AllArgsConstructor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.translators.collision.BoundingBox; -import org.geysermc.connector.network.translators.collision.CollisionRemapper; -import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.collision.translators.OtherCollision; -import org.geysermc.connector.network.translators.collision.translators.SolidCollision; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.type.BlockMapping; -import org.geysermc.connector.utils.FileUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; +import org.geysermc.geyser.network.translators.collision.translators.OtherCollision; +import org.geysermc.geyser.network.translators.collision.translators.SolidCollision; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.type.BlockMapping; +import org.geysermc.geyser.utils.FileUtils; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; @@ -58,7 +58,7 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader, CollisionInfo> annotationMap = new IdentityHashMap<>(); for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(CollisionRemapper.class.getName())) { - GeyserConnector.getInstance().getLogger().debug("Found annotated collision translator: " + clazz.getCanonicalName()); + GeyserImpl.getInstance().getLogger().debug("Found annotated collision translator: " + clazz.getCanonicalName()); CollisionRemapper collisionRemapper = clazz.getAnnotation(CollisionRemapper.class); annotationMap.put(clazz, new CollisionInfo(collisionRemapper, Pattern.compile(collisionRemapper.regex()), Pattern.compile(collisionRemapper.paramRegex()))); @@ -69,7 +69,7 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader collisionList; try { - ArrayNode collisionNode = (ArrayNode) GeyserConnector.JSON_MAPPER.readTree(stream); + ArrayNode collisionNode = (ArrayNode) GeyserImpl.JSON_MAPPER.readTree(stream); collisionList = loadBoundingBoxes(collisionNode); } catch (Exception e) { throw new AssertionError("Unable to load collision data", e); diff --git a/core/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java similarity index 90% rename from core/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java rename to core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java index 0dc5345d1..1da42a68d 100644 --- a/core/src/main/java/org/geysermc/connector/registry/loader/EffectRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.loader; +package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.databind.JsonNode; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.utils.FileUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.utils.FileUtils; import java.io.InputStream; import java.util.Map; @@ -46,7 +46,7 @@ public abstract class EffectRegistryLoader implements RegistryLoader items; try { - items = GeyserConnector.JSON_MAPPER.readValue(stream, mappingItemsType); + items = GeyserImpl.JSON_MAPPER.readValue(stream, mappingItemsType); } catch (Exception e) { throw new AssertionError("Unable to load Java runtime item IDs", e); } @@ -93,7 +93,7 @@ public class ItemRegistryPopulator { List itemEntries; try { - itemEntries = GeyserConnector.JSON_MAPPER.readValue(stream, paletteEntriesType); + itemEntries = GeyserImpl.JSON_MAPPER.readValue(stream, paletteEntriesType); } catch (Exception e) { throw new AssertionError("Unable to load Bedrock runtime item IDs", e); } @@ -114,7 +114,7 @@ public class ItemRegistryPopulator { JsonNode creativeItemEntries; try { - creativeItemEntries = GeyserConnector.JSON_MAPPER.readTree(stream).get("items"); + creativeItemEntries = GeyserImpl.JSON_MAPPER.readTree(stream).get("items"); } catch (Exception e) { throw new AssertionError("Unable to load creative items", e); } @@ -201,7 +201,7 @@ public class ItemRegistryPopulator { int itemIndex = 0; int javaFurnaceMinecartId = 0; - boolean usingFurnaceMinecart = GeyserConnector.getInstance().getConfig().isAddNonBedrockItems(); + boolean usingFurnaceMinecart = GeyserImpl.getInstance().getConfig().isAddNonBedrockItems(); Set javaOnlyItems = new ObjectOpenHashSet<>(); Collections.addAll(javaOnlyItems, "minecraft:spectral_arrow", "minecraft:debug_stick", @@ -383,7 +383,7 @@ public class ItemRegistryPopulator { if (javaOnlyItems.contains(javaIdentifier)) { // These items don't exist on Bedrock, so set up a variable that indicates they should have custom names mappingBuilder = mappingBuilder.translationString((bedrockBlockId != -1 ? "block." : "item.") + entry.getKey().replace(":", ".")); - GeyserConnector.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated."); + GeyserImpl.getInstance().getLogger().debug("Adding " + entry.getKey() + " as an item that needs to be translated."); } ItemMapping mapping = mappingBuilder.build(); diff --git a/core/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java rename to core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java index dca743824..bd124e28f 100644 --- a/core/src/main/java/org/geysermc/connector/registry/populator/RecipeRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.populator; +package org.geysermc.geyser.registry.populator; import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -39,20 +39,20 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.translators.item.ItemTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; -import org.geysermc.connector.registry.type.ItemMappings; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.LanguageUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.*; -import static org.geysermc.connector.utils.InventoryUtils.LAST_RECIPE_NET_ID; +import static org.geysermc.geyser.utils.InventoryUtils.LAST_RECIPE_NET_ID; /** * Populates the recipe registry. @@ -64,7 +64,7 @@ public class RecipeRegistryPopulator { JsonNode items; try { - items = GeyserConnector.JSON_MAPPER.readTree(stream); + items = GeyserImpl.JSON_MAPPER.readTree(stream); } catch (Exception e) { throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.toolbox.fail.runtime_java"), e); } diff --git a/core/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java rename to core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java index f9a074e91..cad2d12f5 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/BlockMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import lombok.Builder; import lombok.Value; -import org.geysermc.connector.utils.BlockUtils; -import org.geysermc.connector.utils.PistonBehavior; +import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.utils.PistonBehavior; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java rename to core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java index 8e1cd6a1a..0d85b80e0 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/BlockMappings.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMappings.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import com.nukkitx.nbt.NbtList; import com.nukkitx.nbt.NbtMap; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java b/core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java rename to core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java index cd16a093a..0c0e7df1d 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/EnchantmentData.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import it.unimi.dsi.fastutil.ints.IntSet; -import org.geysermc.connector.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java b/core/src/main/java/org/geysermc/geyser/registry/type/GeyserMappingItem.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java rename to core/src/main/java/org/geysermc/geyser/registry/type/GeyserMappingItem.java index 12e5544b7..56d7825cc 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/GeyserMappingItem.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/GeyserMappingItem.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java rename to core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java index 1a7714968..178ebd607 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/ItemMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMapping.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Value; -import org.geysermc.connector.network.MinecraftProtocol; -import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.registry.BlockRegistries; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java rename to core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java index bffe415a1..f0eb1747b 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/ItemMappings.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData; @@ -33,8 +33,8 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.IntList; import lombok.Builder; import lombok.Value; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.translators.item.StoredItemMappings; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.translators.item.StoredItemMappings; import javax.annotation.Nullable; import java.util.List; @@ -136,7 +136,7 @@ public class ItemMappings { // This will hide the message when the player clicks with an empty hand if (data.getId() != 0 && data.getDamage() != 0) { - GeyserConnector.getInstance().getLogger().debug("Missing mapping for bedrock item " + data.getId() + ":" + data.getDamage()); + GeyserImpl.getInstance().getLogger().debug("Missing mapping for bedrock item " + data.getId() + ":" + data.getDamage()); } return ItemMapping.AIR; } diff --git a/core/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java b/core/src/main/java/org/geysermc/geyser/registry/type/PaletteItem.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java rename to core/src/main/java/org/geysermc/geyser/registry/type/PaletteItem.java index 4582d1e80..c7815c055 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/PaletteItem.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/PaletteItem.java @@ -24,7 +24,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import lombok.Data; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java rename to core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java index fa7fcb300..17590d7fc 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/ParticleMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import com.nukkitx.protocol.bedrock.data.LevelEventType; diff --git a/core/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/SoundMapping.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java rename to core/src/main/java/org/geysermc/geyser/registry/type/SoundMapping.java index ba0bcd862..d6aaf9bd0 100644 --- a/core/src/main/java/org/geysermc/connector/registry/type/SoundMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/SoundMapping.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.registry.type; +package org.geysermc.geyser.registry.type; import lombok.Value; diff --git a/core/src/main/java/org/geysermc/connector/scoreboard/Objective.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Objective.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/scoreboard/Objective.java rename to core/src/main/java/org/geysermc/geyser/scoreboard/Objective.java index 5a7748f79..31407b77d 100644 --- a/core/src/main/java/org/geysermc/connector/scoreboard/Objective.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Objective.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.scoreboard; +package org.geysermc.geyser.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; diff --git a/core/src/main/java/org/geysermc/connector/scoreboard/Score.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Score.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/scoreboard/Score.java rename to core/src/main/java/org/geysermc/geyser/scoreboard/Score.java index 10abfa29a..fe8674d1a 100644 --- a/core/src/main/java/org/geysermc/connector/scoreboard/Score.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Score.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.scoreboard; +package org.geysermc.geyser.scoreboard; import com.nukkitx.protocol.bedrock.data.ScoreInfo; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java rename to core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index 7d0cdea7d..41b46aedf 100644 --- a/core/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.scoreboard; +package org.geysermc.geyser.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.nukkitx.protocol.bedrock.data.ScoreInfo; @@ -31,19 +31,19 @@ import com.nukkitx.protocol.bedrock.packet.RemoveObjectivePacket; import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket; import com.nukkitx.protocol.bedrock.packet.SetScorePacket; import lombok.Getter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import javax.annotation.Nullable; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; -import static org.geysermc.connector.scoreboard.UpdateType.*; +import static org.geysermc.geyser.scoreboard.UpdateType.*; public final class Scoreboard { private final GeyserSession session; @@ -61,7 +61,7 @@ public final class Scoreboard { public Scoreboard(GeyserSession session) { this.session = session; - this.logger = GeyserConnector.getInstance().getLogger(); + this.logger = GeyserImpl.getInstance().getLogger(); } public void removeScoreboard() { diff --git a/core/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java similarity index 89% rename from core/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java rename to core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java index 2204fd976..9c732046c 100644 --- a/core/src/main/java/org/geysermc/connector/scoreboard/ScoreboardUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.scoreboard; +package org.geysermc.geyser.scoreboard; import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.WorldCache; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.WorldCache; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Collection; import java.util.concurrent.atomic.AtomicInteger; @@ -46,12 +46,12 @@ public final class ScoreboardUpdater extends Thread { private static final boolean DEBUG_ENABLED; static { - GeyserConfiguration config = GeyserConnector.getInstance().getConfig(); + GeyserConfiguration config = GeyserImpl.getInstance().getConfig(); FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD = Math.min(config.getScoreboardPacketThreshold(), SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD); DEBUG_ENABLED = config.isDebugMode(); } - private final GeyserConnector connector = GeyserConnector.getInstance(); + private final GeyserImpl geyser = GeyserImpl.getInstance(); private long lastUpdate = System.currentTimeMillis(); private long lastPacketsPerSecondUpdate = System.currentTimeMillis(); @@ -62,7 +62,7 @@ public final class ScoreboardUpdater extends Thread { @Override public void run() { - while (!connector.isShuttingDown()) { + while (!geyser.isShuttingDown()) { try { long timeTillAction = getTimeTillNextAction(); if (timeTillAction > 0) { @@ -73,7 +73,7 @@ public final class ScoreboardUpdater extends Thread { long currentTime = System.currentTimeMillis(); // reset score-packets per second every second - Collection sessions = connector.getSessionManager().getSessions().values(); + Collection sessions = geyser.getSessionManager().getSessions().values(); if (currentTime - lastPacketsPerSecondUpdate >= 1000) { lastPacketsPerSecondUpdate = currentTime; for (GeyserSession session : sessions) { @@ -117,7 +117,7 @@ public final class ScoreboardUpdater extends Thread { SECOND_SCORE_PACKETS_PER_SECOND_THRESHOLD : FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; - connector.getLogger().info( + geyser.getLogger().info( LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) ); @@ -132,7 +132,7 @@ public final class ScoreboardUpdater extends Thread { if (DEBUG_ENABLED) { long timeSpent = System.currentTimeMillis() - currentTime; if (timeSpent > 0) { - connector.getLogger().info(String.format( + geyser.getLogger().info(String.format( "Scoreboard updater: took %s ms. Updated %s players", timeSpent, sessions.size() )); @@ -142,7 +142,7 @@ public final class ScoreboardUpdater extends Thread { long timeTillNextAction = getTimeTillNextAction(); sleepFor(timeTillNextAction); } catch (Throwable e) { - connector.getLogger().error("Error while translating scoreboard information!", e); + geyser.getLogger().error("Error while translating scoreboard information!", e); // Wait so we don't try to run the scoreboard immediately after this sleepFor(FIRST_MILLIS_BETWEEN_UPDATES); } diff --git a/core/src/main/java/org/geysermc/connector/scoreboard/Team.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Team.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/scoreboard/Team.java rename to core/src/main/java/org/geysermc/geyser/scoreboard/Team.java index 78457fba1..b2fb44d34 100644 --- a/core/src/main/java/org/geysermc/connector/scoreboard/Team.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Team.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.scoreboard; +package org.geysermc.geyser.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; diff --git a/core/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java b/core/src/main/java/org/geysermc/geyser/scoreboard/UpdateType.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java rename to core/src/main/java/org/geysermc/geyser/scoreboard/UpdateType.java index 5e645cd1b..3366b08f8 100644 --- a/core/src/main/java/org/geysermc/connector/scoreboard/UpdateType.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/UpdateType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.scoreboard; +package org.geysermc.geyser.scoreboard; public enum UpdateType { REMOVE, diff --git a/core/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java rename to core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java index 9dce59acc..f9106319f 100644 --- a/core/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.skin; +package org.geysermc.geyser.skin; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.Constants; -import org.geysermc.connector.utils.PluginMessageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.Constants; +import org.geysermc.geyser.utils.PluginMessageUtils; import org.geysermc.floodgate.util.WebsocketEventType; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; @@ -48,7 +48,7 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -import static org.geysermc.connector.utils.PluginMessageUtils.getSkinChannel; +import static org.geysermc.geyser.utils.PluginMessageUtils.getSkinChannel; public final class FloodgateSkinUploader { private final ObjectMapper JACKSON = new ObjectMapper(); @@ -62,8 +62,8 @@ public final class FloodgateSkinUploader { @Getter private String verifyCode; @Getter private int subscribersCount; - public FloodgateSkinUploader(GeyserConnector connector) { - this.logger = connector.getLogger(); + public FloodgateSkinUploader(GeyserImpl geyser) { + this.logger = geyser.getLogger(); this.client = new WebSocketClient(Constants.GLOBAL_API_WS_URI) { @Override public void onOpen(ServerHandshake handshake) { @@ -111,7 +111,7 @@ public final class FloodgateSkinUploader { } String xuid = node.get("xuid").asText(); - GeyserSession session = connector.getPlayerByXuid(xuid); + GeyserSession session = geyser.getPlayerByXuid(xuid); if (session != null) { if (!node.get("success").asBoolean()) { @@ -169,7 +169,7 @@ public final class FloodgateSkinUploader { } } // try to reconnect (which will make a new id and verify token) after a few seconds - reconnectLater(connector); + reconnectLater(geyser); } @Override @@ -210,16 +210,16 @@ public final class FloodgateSkinUploader { skinQueue.add(jsonString); } - private void reconnectLater(GeyserConnector connector) { + private void reconnectLater(GeyserImpl geyser) { // we ca only reconnect when the thread pool is open - if (connector.getScheduledThread().isShutdown() || closed) { + if (geyser.getScheduledThread().isShutdown() || closed) { logger.info("The skin uploader has been closed"); return; } long additionalTime = ThreadLocalRandom.current().nextInt(7); // we don't have to check the result. onClose will handle that for us - connector.getScheduledThread() + geyser.getScheduledThread() .schedule(client::reconnect, 8 + additionalTime, TimeUnit.SECONDS); } diff --git a/core/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java b/core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java rename to core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java index 36b7d2d39..e7b08ad3f 100644 --- a/core/src/main/java/org/geysermc/connector/skin/ProvidedSkin.java +++ b/core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.skin; +package org.geysermc.geyser.skin; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java similarity index 86% rename from core/src/main/java/org/geysermc/connector/skin/SkinManager.java rename to core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index 6815d7550..eeb4a5138 100644 --- a/core/src/main/java/org/geysermc/connector/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.skin; +package org.geysermc.geyser.skin; import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.auth.data.GameProfile; import com.nukkitx.protocol.bedrock.data.skin.ImageData; import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.common.AuthType; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.auth.BedrockClientData; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.auth.BedrockClientData; +import org.geysermc.geyser.utils.LanguageUtils; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -86,10 +86,10 @@ public class SkinManager { // This attempts to find the XUID of the player so profile images show up for Xbox accounts String xuid = ""; - GeyserSession playerSession = GeyserConnector.getInstance().getPlayerByUuid(uuid); + GeyserSession playerSession = GeyserImpl.getInstance().getPlayerByUuid(uuid); if (playerSession != null) { - xuid = playerSession.getAuthData().getXboxUUID(); + xuid = playerSession.getAuthData().getXuid(); } PlayerListPacket.Entry entry; @@ -97,7 +97,7 @@ public class SkinManager { // If we are building a PlayerListEntry for our own session we use our AuthData UUID instead of the Java UUID // as Bedrock expects to get back its own provided UUID if (session.getPlayerEntity().getUuid().equals(uuid)) { - entry = new PlayerListPacket.Entry(session.getAuthData().getUUID()); + entry = new PlayerListPacket.Entry(session.getAuthData().getUuid()); } else { entry = new PlayerListPacket.Entry(uuid); } @@ -192,7 +192,7 @@ public class SkinManager { session.sendUpstreamPacket(playerRemovePacket); } } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); } if (skinAndCapeConsumer != null) { @@ -202,9 +202,9 @@ public class SkinManager { } public static void handleBedrockSkin(PlayerEntity playerEntity, BedrockClientData clientData) { - GeyserConnector connector = GeyserConnector.getInstance(); - if (connector.getConfig().isDebugMode()) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); + GeyserImpl geyser = GeyserImpl.getInstance(); + if (geyser.getConfig().isDebugMode()) { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); } try { @@ -217,9 +217,9 @@ public class SkinManager { if (skinBytes.length <= (128 * 128 * 4) && !clientData.isPersonaSkin()) { SkinProvider.storeBedrockSkin(playerEntity.getUuid(), clientData.getSkinId(), skinBytes); SkinProvider.storeBedrockGeometry(playerEntity.getUuid(), geometryNameBytes, geometryBytes); - } else if (connector.getConfig().isDebugMode()) { - connector.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.fail", playerEntity.getUsername())); - connector.getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight()); + } else if (geyser.getConfig().isDebugMode()) { + geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.fail", playerEntity.getUsername())); + geyser.getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight()); } if (!clientData.getCapeId().equals("")) { @@ -245,7 +245,7 @@ public class SkinManager { // Likely offline mode return loadBedrockOrOfflineSkin(profile); } - JsonNode skinObject = GeyserConnector.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(skinProperty.getValue()), StandardCharsets.UTF_8)); + JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(skinProperty.getValue()), StandardCharsets.UTF_8)); JsonNode textures = skinObject.get("textures"); JsonNode skinTexture = textures.get("SKIN"); @@ -261,8 +261,8 @@ public class SkinManager { return new GameProfileData(skinUrl, capeUrl, isAlex); } catch (Exception exception) { - GeyserConnector.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName()); - if (GeyserConnector.getInstance().getConfig().isDebugMode()) { + GeyserImpl.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName()); + if (GeyserImpl.getInstance().getConfig().isDebugMode()) { exception.printStackTrace(); } return loadBedrockOrOfflineSkin(profile); @@ -279,8 +279,8 @@ public class SkinManager { String skinUrl = isAlex ? SkinProvider.EMPTY_SKIN_ALEX.getTextureUrl() : SkinProvider.EMPTY_SKIN.getTextureUrl(); String capeUrl = SkinProvider.EMPTY_CAPE.getTextureUrl(); - if (("steve".equals(skinUrl) || "alex".equals(skinUrl)) && GeyserConnector.getInstance().getConfig().getRemote().getAuthType() != AuthType.ONLINE) { - GeyserSession session = GeyserConnector.getInstance().getPlayerByUuid(profile.getId()); + if (("steve".equals(skinUrl) || "alex".equals(skinUrl)) && GeyserImpl.getInstance().getConfig().getRemote().getAuthType() != AuthType.ONLINE) { + GeyserSession session = GeyserImpl.getInstance().getPlayerByUuid(profile.getId()); if (session != null) { skinUrl = session.getClientData().getSkinId(); diff --git a/core/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/skin/SkinProvider.java rename to core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java index 7e25fed6f..edb3ad36e 100644 --- a/core/src/main/java/org/geysermc/connector/skin/SkinProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.skin; +package org.geysermc.geyser.skin; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -36,10 +36,10 @@ import com.google.common.cache.CacheBuilder; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.FileUtils; -import org.geysermc.connector.utils.WebUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.utils.WebUtils; import javax.imageio.ImageIO; import java.awt.*; @@ -56,7 +56,7 @@ import java.util.*; import java.util.concurrent.*; public class SkinProvider { - public static final boolean ALLOW_THIRD_PARTY_CAPES = GeyserConnector.getInstance().getConfig().isAllowThirdPartyCapes(); + public static final boolean ALLOW_THIRD_PARTY_CAPES = GeyserImpl.getInstance().getConfig().isAllowThirdPartyCapes(); private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(ALLOW_THIRD_PARTY_CAPES ? 21 : 14); public static final byte[] STEVE_SKIN = new ProvidedSkin("bedrock/skin/skin_steve.png").getSkin(); @@ -81,7 +81,7 @@ public class SkinProvider { private static final Map cachedGeometry = new ConcurrentHashMap<>(); - public static final boolean ALLOW_THIRD_PARTY_EARS = GeyserConnector.getInstance().getConfig().isAllowThirdPartyEars(); + public static final boolean ALLOW_THIRD_PARTY_EARS = GeyserImpl.getInstance().getConfig().isAllowThirdPartyEars(); public static final String EARS_GEOMETRY; public static final String EARS_GEOMETRY_SLIM; public static final SkinGeometry SKULL_GEOMETRY; @@ -100,15 +100,15 @@ public class SkinProvider { SKULL_GEOMETRY = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.customskull\"}}", skullData, false); // Schedule Daily Image Expiry if we are caching them - if (GeyserConnector.getInstance().getConfig().getCacheImages() > 0) { - GeyserConnector.getInstance().getScheduledThread().scheduleAtFixedRate(() -> { - File cacheFolder = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").toFile(); + if (GeyserImpl.getInstance().getConfig().getCacheImages() > 0) { + GeyserImpl.getInstance().getScheduledThread().scheduleAtFixedRate(() -> { + File cacheFolder = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").toFile(); if (!cacheFolder.exists()) { return; } int count = 0; - final long expireTime = ((long)GeyserConnector.getInstance().getConfig().getCacheImages()) * ((long)1000 * 60 * 60 * 24); + final long expireTime = ((long) GeyserImpl.getInstance().getConfig().getCacheImages()) * ((long)1000 * 60 * 60 * 24); for (File imageFile : Objects.requireNonNull(cacheFolder.listFiles())) { if (imageFile.lastModified() < System.currentTimeMillis() - expireTime) { //noinspection ResultOfMethodCallIgnored @@ -118,7 +118,7 @@ public class SkinProvider { } if (count > 0) { - GeyserConnector.getInstance().getLogger().debug(String.format("Removed %d cached image files as they have expired", count)); + GeyserImpl.getInstance().getLogger().debug(String.format("Removed %d cached image files as they have expired", count)); } }, 10, 1440, TimeUnit.MINUTES); } @@ -143,7 +143,7 @@ public class SkinProvider { String newSkinUrl = skinUrl; if ("steve".equals(skinUrl) || "alex".equals(skinUrl)) { - GeyserSession session = GeyserConnector.getInstance().getPlayerByUuid(playerId); + GeyserSession session = GeyserImpl.getInstance().getPlayerByUuid(playerId); if (session != null) { newSkinUrl = session.getClientData().getSkinId(); @@ -156,7 +156,7 @@ public class SkinProvider { getOrDefault(requestCape(capeUrl, provider, false), EMPTY_CAPE, 5) ); - GeyserConnector.getInstance().getLogger().debug("Took " + (System.currentTimeMillis() - time) + "ms for " + playerId); + GeyserImpl.getInstance().getLogger().debug("Took " + (System.currentTimeMillis() - time) + "ms for " + playerId); return skinAndCape; }, EXECUTOR_SERVICE); } @@ -388,10 +388,10 @@ public class SkinProvider { BufferedImage image = null; // First see if we have a cached file. We also update the modification stamp so we know when the file was last used - File imageFile = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").resolve(UUID.nameUUIDFromBytes(imageUrl.getBytes()).toString() + ".png").toFile(); + File imageFile = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("images").resolve(UUID.nameUUIDFromBytes(imageUrl.getBytes()).toString() + ".png").toFile(); if (imageFile.exists()) { try { - GeyserConnector.getInstance().getLogger().debug("Reading cached image from file " + imageFile.getPath() + " for " + imageUrl); + GeyserImpl.getInstance().getLogger().debug("Reading cached image from file " + imageFile.getPath() + " for " + imageUrl); imageFile.setLastModified(System.currentTimeMillis()); image = ImageIO.read(imageFile); } catch (IOException ignored) {} @@ -400,16 +400,16 @@ public class SkinProvider { // If no image we download it if (image == null) { image = downloadImage(imageUrl, provider); - GeyserConnector.getInstance().getLogger().debug("Downloaded " + imageUrl); + GeyserImpl.getInstance().getLogger().debug("Downloaded " + imageUrl); // Write to cache if we are allowed - if (GeyserConnector.getInstance().getConfig().getCacheImages() > 0) { + if (GeyserImpl.getInstance().getConfig().getCacheImages() > 0) { imageFile.getParentFile().mkdirs(); try { ImageIO.write(image, "png", imageFile); - GeyserConnector.getInstance().getLogger().debug("Writing cached skin to file " + imageFile.getPath() + " for " + imageUrl); + GeyserImpl.getInstance().getLogger().debug("Writing cached skin to file " + imageFile.getPath() + " for " + imageUrl); } catch (IOException e) { - GeyserConnector.getInstance().getLogger().error("Failed to write cached skin to file " + imageFile.getPath() + " for " + imageUrl); + GeyserImpl.getInstance().getLogger().error("Failed to write cached skin to file " + imageFile.getPath() + " for " + imageUrl); } } } @@ -477,7 +477,7 @@ public class SkinProvider { node = WebUtils.getJson("https://api.mojang.com/users/profiles/minecraft/" + skullOwner.get("Name").getValue()); JsonNode id = node.get("id"); if (id == null) { - GeyserConnector.getInstance().getLogger().debug("No UUID found in Mojang response for " + skullOwner.get("Name").getValue()); + GeyserImpl.getInstance().getLogger().debug("No UUID found in Mojang response for " + skullOwner.get("Name").getValue()); return null; } uuidToString = id.asText(); @@ -488,14 +488,14 @@ public class SkinProvider { List profileProperties = new ArrayList<>(); JsonNode properties = node.get("properties"); if (properties == null) { - GeyserConnector.getInstance().getLogger().debug("No properties found in Mojang response for " + uuidToString); + GeyserImpl.getInstance().getLogger().debug("No properties found in Mojang response for " + uuidToString); return null; } profileProperties.add(new GameProfile.Property("textures", node.get("properties").get(0).get("value").asText())); gameProfile.setProperties(profileProperties); return gameProfile; } catch (Exception e) { - if (GeyserConnector.getInstance().getConfig().isDebugMode()) { + if (GeyserImpl.getInstance().getConfig().isDebugMode()) { e.printStackTrace(); } return null; @@ -508,7 +508,7 @@ public class SkinProvider { return readFiveZigCape(imageUrl); HttpURLConnection con = (HttpURLConnection) new URL(imageUrl).openConnection(); - con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); + con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); BufferedImage image = ImageIO.read(con.getInputStream()); if (image == null) throw new NullPointerException(); diff --git a/core/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java rename to core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java index ca02afdbe..ae16aee05 100644 --- a/core/src/main/java/org/geysermc/connector/skin/SkullSkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.skin; +package org.geysermc.geyser.skin; import com.nukkitx.protocol.bedrock.data.skin.ImageData; import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.player.PlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.utils.LanguageUtils; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.entity.player.PlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.utils.LanguageUtils; import java.util.Collections; import java.util.function.Consumer; @@ -63,7 +63,7 @@ public class SkullSkinManager extends SkinManager { packet.setTrustedSkin(true); session.sendUpstreamPacket(packet); } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); } if (skinConsumer != null) { diff --git a/core/src/main/java/org/geysermc/connector/utils/AttributeUtils.java b/core/src/main/java/org/geysermc/geyser/utils/AttributeUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/AttributeUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/AttributeUtils.java index 5e26950c5..f83d87c52 100644 --- a/core/src/main/java/org/geysermc/connector/utils/AttributeUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/AttributeUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeModifier; diff --git a/core/src/main/java/org/geysermc/connector/utils/Axis.java b/core/src/main/java/org/geysermc/geyser/utils/Axis.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/utils/Axis.java rename to core/src/main/java/org/geysermc/geyser/utils/Axis.java index 1075f8d2c..7465d6a4d 100644 --- a/core/src/main/java/org/geysermc/connector/utils/Axis.java +++ b/core/src/main/java/org/geysermc/geyser/utils/Axis.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.nukkitx.math.vector.Vector3d; diff --git a/core/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java b/core/src/main/java/org/geysermc/geyser/utils/BedrockMapIcon.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java rename to core/src/main/java/org/geysermc/geyser/utils/BedrockMapIcon.java index 8b9a5dca3..cac901c0d 100644 --- a/core/src/main/java/org/geysermc/connector/utils/BedrockMapIcon.java +++ b/core/src/main/java/org/geysermc/geyser/utils/BedrockMapIcon.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.level.map.MapIconType; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java b/core/src/main/java/org/geysermc/geyser/utils/BlockEntityUtils.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/BlockEntityUtils.java index 38ffa80f5..78c9860f5 100644 --- a/core/src/main/java/org/geysermc/connector/utils/BlockEntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/BlockEntityUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; @@ -31,11 +31,11 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; -import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.connector.network.translators.world.block.entity.FlowerPotBlockEntityTranslator; -import org.geysermc.connector.registry.Registries; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.entity.BedrockOnlyBlockEntity; +import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.network.translators.world.block.entity.FlowerPotBlockEntityTranslator; +import org.geysermc.geyser.registry.Registries; import javax.annotation.Nonnull; import java.util.HashMap; diff --git a/core/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java b/core/src/main/java/org/geysermc/geyser/utils/BlockPositionIterator.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java rename to core/src/main/java/org/geysermc/geyser/utils/BlockPositionIterator.java index c7ef28c82..81ad49b66 100644 --- a/core/src/main/java/org/geysermc/connector/utils/BlockPositionIterator.java +++ b/core/src/main/java/org/geysermc/geyser/utils/BlockPositionIterator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.nukkitx.network.util.Preconditions; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/utils/BlockUtils.java b/core/src/main/java/org/geysermc/geyser/utils/BlockUtils.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/utils/BlockUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/BlockUtils.java index 140577104..fc66abd05 100644 --- a/core/src/main/java/org/geysermc/connector/utils/BlockUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/BlockUtils.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.collision.translators.BlockCollision; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.BlockMapping; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.BlockMapping; +import org.geysermc.geyser.registry.type.ItemMapping; public class BlockUtils { /** @@ -58,7 +58,7 @@ public class BlockUtils { case "sword": return blockMapping.getJavaBlockId() == BlockStateValues.JAVA_COBWEB_ID; default: - session.getConnector().getLogger().warning("Unknown tool type: " + itemToolType); + session.getGeyser().getLogger().warning("Unknown tool type: " + itemToolType); return false; } } @@ -235,10 +235,10 @@ public class BlockUtils { } public static BlockCollision getCollisionAt(GeyserSession session, Vector3i blockPos) { - return getCollision(session.getConnector().getWorldManager().getBlockAt(session, blockPos)); + return getCollision(session.getGeyser().getWorldManager().getBlockAt(session, blockPos)); } public static BlockCollision getCollisionAt(GeyserSession session, int x, int y, int z) { - return getCollision(session.getConnector().getWorldManager().getBlockAt(session, x, y, z)); + return getCollision(session.getGeyser().getWorldManager().getBlockAt(session, x, y, z)); } } diff --git a/core/src/main/java/org/geysermc/connector/utils/ChunkUtils.java b/core/src/main/java/org/geysermc/geyser/utils/ChunkUtils.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/utils/ChunkUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/ChunkUtils.java index 8015df8b7..650faccc1 100644 --- a/core/src/main/java/org/geysermc/connector/utils/ChunkUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/ChunkUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -38,17 +38,17 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.IntLists; import lombok.experimental.UtilityClass; -import org.geysermc.connector.entity.ItemFrameEntity; -import org.geysermc.connector.entity.player.SkullPlayerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.block.BlockStateValues; -import org.geysermc.connector.network.translators.world.block.entity.BedrockOnlyBlockEntity; -import org.geysermc.connector.network.translators.world.chunk.BlockStorage; -import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection; -import org.geysermc.connector.network.translators.world.chunk.bitarray.SingletonBitArray; -import org.geysermc.connector.registry.BlockRegistries; +import org.geysermc.geyser.entity.ItemFrameEntity; +import org.geysermc.geyser.entity.player.SkullPlayerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.network.translators.world.block.entity.BedrockOnlyBlockEntity; +import org.geysermc.geyser.network.translators.world.chunk.BlockStorage; +import org.geysermc.geyser.network.translators.world.chunk.GeyserChunkSection; +import org.geysermc.geyser.network.translators.world.chunk.bitarray.SingletonBitArray; +import org.geysermc.geyser.registry.BlockRegistries; -import static org.geysermc.connector.network.translators.world.block.BlockStateValues.JAVA_AIR_ID; +import static org.geysermc.geyser.network.translators.world.block.BlockStateValues.JAVA_AIR_ID; @UtilityClass public class ChunkUtils { @@ -253,7 +253,7 @@ public class ChunkUtils { // The constraints change depending on if the player is in the overworld or not, and if experimental height is enabled if (minY < (extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) || maxY > (extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT)) { - session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds", + session.getGeyser().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds", extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT, extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT, session.getDimension())); diff --git a/core/src/main/java/org/geysermc/connector/utils/Constants.java b/core/src/main/java/org/geysermc/geyser/utils/Constants.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/Constants.java rename to core/src/main/java/org/geysermc/geyser/utils/Constants.java index 58125d909..fb918590d 100644 --- a/core/src/main/java/org/geysermc/connector/utils/Constants.java +++ b/core/src/main/java/org/geysermc/geyser/utils/Constants.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import java.net.URI; import java.net.URISyntaxException; diff --git a/core/src/main/java/org/geysermc/connector/utils/CooldownUtils.java b/core/src/main/java/org/geysermc/geyser/utils/CooldownUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/utils/CooldownUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/CooldownUtils.java index 4b2704803..8f72fafd8 100644 --- a/core/src/main/java/org/geysermc/connector/utils/CooldownUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/CooldownUtils.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import lombok.Getter; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.cache.PreferencesCache; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.cache.PreferencesCache; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/connector/utils/DimensionUtils.java b/core/src/main/java/org/geysermc/geyser/utils/DimensionUtils.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/utils/DimensionUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/DimensionUtils.java index b56e26246..974fdb2c7 100644 --- a/core/src/main/java/org/geysermc/connector/utils/DimensionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/DimensionUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -32,9 +32,9 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.ChangeDimensionPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.network.session.GeyserSession; import java.util.Set; @@ -127,13 +127,13 @@ public class DimensionUtils { */ public static String getNewDimension(CompoundTag dimensionTag) { if (dimensionTag == null || dimensionTag.isEmpty()) { - GeyserConnector.getInstance().getLogger().debug("Dimension tag was null or empty."); + GeyserImpl.getInstance().getLogger().debug("Dimension tag was null or empty."); return OVERWORLD; } if (dimensionTag.getValue().get("effects") != null) { return ((StringTag) dimensionTag.getValue().get("effects")).getValue(); } - GeyserConnector.getInstance().getLogger().debug("Effects portion of the tag was null or empty."); + GeyserImpl.getInstance().getLogger().debug("Effects portion of the tag was null or empty."); return OVERWORLD; } diff --git a/core/src/main/java/org/geysermc/connector/utils/Direction.java b/core/src/main/java/org/geysermc/geyser/utils/Direction.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/Direction.java rename to core/src/main/java/org/geysermc/geyser/utils/Direction.java index 5a6bea349..c02d19196 100644 --- a/core/src/main/java/org/geysermc/connector/utils/Direction.java +++ b/core/src/main/java/org/geysermc/geyser/utils/Direction.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue; import com.nukkitx.math.vector.Vector3i; diff --git a/core/src/main/java/org/geysermc/connector/utils/DockerCheck.java b/core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/DockerCheck.java rename to core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java index 31c37edf2..accf5bf6d 100644 --- a/core/src/main/java/org/geysermc/connector/utils/DockerCheck.java +++ b/core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import java.nio.file.Files; import java.nio.file.Paths; diff --git a/core/src/main/java/org/geysermc/connector/utils/EffectUtils.java b/core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java similarity index 91% rename from core/src/main/java/org/geysermc/connector/utils/EffectUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java index 7016cc786..c738a2654 100644 --- a/core/src/main/java/org/geysermc/connector/utils/EffectUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ParticleMapping; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ParticleMapping; import javax.annotation.Nonnull; diff --git a/core/src/main/java/org/geysermc/connector/utils/EntityUtils.java b/core/src/main/java/org/geysermc/geyser/utils/EntityUtils.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/utils/EntityUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/EntityUtils.java index f0de018ff..96a94a966 100644 --- a/core/src/main/java/org/geysermc/connector/utils/EntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/EntityUtils.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.EntityDefinitions; -import org.geysermc.connector.entity.living.ArmorStandEntity; -import org.geysermc.connector.entity.living.animal.AnimalEntity; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.living.ArmorStandEntity; +import org.geysermc.geyser.entity.living.animal.AnimalEntity; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/connector/utils/FileUtils.java b/core/src/main/java/org/geysermc/geyser/utils/FileUtils.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/utils/FileUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/FileUtils.java index 00f24472b..7d8029848 100644 --- a/core/src/main/java/org/geysermc/connector/utils/FileUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/FileUtils.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import org.geysermc.connector.GeyserConnector; +import org.geysermc.geyser.GeyserImpl; import java.io.*; import java.lang.annotation.Annotation; @@ -65,7 +65,7 @@ public class FileUtils { public static T loadJson(InputStream src, Class valueType) throws IOException { // Read specifically with UTF-8 to allow any non-UTF-encoded JSON to read - return GeyserConnector.JSON_MAPPER.readValue(new InputStreamReader(src, StandardCharsets.UTF_8), valueType); + return GeyserImpl.JSON_MAPPER.readValue(new InputStreamReader(src, StandardCharsets.UTF_8), valueType); } /** @@ -94,7 +94,7 @@ public class FileUtils { //noinspection ResultOfMethodCallIgnored file.createNewFile(); try (FileOutputStream fos = new FileOutputStream(file)) { - try (InputStream input = GeyserConnector.class.getResourceAsStream("/" + name)) { // resources need leading "/" prefix + try (InputStream input = GeyserImpl.class.getResourceAsStream("/" + name)) { // resources need leading "/" prefix byte[] bytes = new byte[input.available()]; //noinspection ResultOfMethodCallIgnored @@ -271,7 +271,7 @@ public class FileUtils { try { return Class.forName(className); } catch (ClassNotFoundException ex) { - GeyserConnector.getInstance().getLogger().error("Failed to find class " + className, ex); + GeyserImpl.getInstance().getLogger().error("Failed to find class " + className, ex); throw new RuntimeException(ex); } }).collect(Collectors.toSet()); diff --git a/core/src/main/java/org/geysermc/connector/utils/FireworkColor.java b/core/src/main/java/org/geysermc/geyser/utils/FireworkColor.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/utils/FireworkColor.java rename to core/src/main/java/org/geysermc/geyser/utils/FireworkColor.java index 5a4f0ae0b..a95b727b6 100644 --- a/core/src/main/java/org/geysermc/connector/utils/FireworkColor.java +++ b/core/src/main/java/org/geysermc/geyser/utils/FireworkColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.util.HSVLike; diff --git a/core/src/main/java/org/geysermc/connector/utils/GameRule.java b/core/src/main/java/org/geysermc/geyser/utils/GameRule.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/utils/GameRule.java rename to core/src/main/java/org/geysermc/geyser/utils/GameRule.java index 0b3908694..7b95f192c 100644 --- a/core/src/main/java/org/geysermc/connector/utils/GameRule.java +++ b/core/src/main/java/org/geysermc/geyser/utils/GameRule.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java b/core/src/main/java/org/geysermc/geyser/utils/GeyserAdvancement.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java rename to core/src/main/java/org/geysermc/geyser/utils/GeyserAdvancement.java index 31560498a..78b17af34 100644 --- a/core/src/main/java/org/geysermc/connector/utils/GeyserAdvancement.java +++ b/core/src/main/java/org/geysermc/geyser/utils/GeyserAdvancement.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import lombok.NonNull; -import org.geysermc.connector.network.session.cache.AdvancementsCache; +import org.geysermc.geyser.network.session.cache.AdvancementsCache; import java.util.List; diff --git a/core/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java b/core/src/main/java/org/geysermc/geyser/utils/InteractiveTagManager.java similarity index 95% rename from core/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java rename to core/src/main/java/org/geysermc/geyser/utils/InteractiveTagManager.java index c43b19b92..026564939 100644 --- a/core/src/main/java/org/geysermc/connector/utils/InteractiveTagManager.java +++ b/core/src/main/java/org/geysermc/geyser/utils/InteractiveTagManager.java @@ -23,21 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; -import org.geysermc.connector.entity.Entity; -import org.geysermc.connector.entity.living.MobEntity; -import org.geysermc.connector.entity.living.animal.AnimalEntity; -import org.geysermc.connector.entity.living.animal.horse.HorseEntity; -import org.geysermc.connector.entity.living.animal.tameable.CatEntity; -import org.geysermc.connector.entity.living.animal.tameable.WolfEntity; -import org.geysermc.connector.entity.living.merchant.VillagerEntity; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.living.MobEntity; +import org.geysermc.geyser.entity.living.animal.AnimalEntity; +import org.geysermc.geyser.entity.living.animal.horse.HorseEntity; +import org.geysermc.geyser.entity.living.animal.tameable.CatEntity; +import org.geysermc.geyser.entity.living.animal.tameable.WolfEntity; +import org.geysermc.geyser.entity.living.merchant.VillagerEntity; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.EnumSet; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/connector/utils/InventoryUtils.java b/core/src/main/java/org/geysermc/geyser/utils/InventoryUtils.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/utils/InventoryUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/InventoryUtils.java index c046865f8..89b5657f6 100644 --- a/core/src/main/java/org/geysermc/connector/utils/InventoryUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/InventoryUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -37,17 +37,17 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.inventory.Container; -import org.geysermc.connector.inventory.GeyserItemStack; -import org.geysermc.connector.inventory.Inventory; -import org.geysermc.connector.inventory.PlayerInventory; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.InventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.connector.network.translators.inventory.translators.chest.DoubleChestInventoryTranslator; -import org.geysermc.connector.registry.Registries; -import org.geysermc.connector.registry.type.ItemMapping; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.inventory.Container; +import org.geysermc.geyser.inventory.GeyserItemStack; +import org.geysermc.geyser.inventory.Inventory; +import org.geysermc.geyser.inventory.PlayerInventory; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; +import org.geysermc.geyser.network.translators.inventory.translators.chest.DoubleChestInventoryTranslator; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Collections; import java.util.Objects; @@ -293,7 +293,7 @@ public class InventoryUtils { } session.sendDownstreamPacket(actionPacket); } else { - session.getConnector().getLogger().debug("Cannot find item for block " + itemName); + session.getGeyser().getLogger().debug("Cannot find item for block " + itemName); } } } diff --git a/core/src/main/java/org/geysermc/connector/utils/ItemUtils.java b/core/src/main/java/org/geysermc/geyser/utils/ItemUtils.java similarity index 96% rename from core/src/main/java/org/geysermc/connector/utils/ItemUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/ItemUtils.java index 8bd2edfd1..c24c40ecf 100644 --- a/core/src/main/java/org/geysermc/connector/utils/ItemUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/ItemUtils.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.network.session.GeyserSession; public class ItemUtils { diff --git a/core/src/main/java/org/geysermc/connector/utils/LanguageUtils.java b/core/src/main/java/org/geysermc/geyser/utils/LanguageUtils.java similarity index 82% rename from core/src/main/java/org/geysermc/connector/utils/LanguageUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/LanguageUtils.java index 340a5e58c..7d1719d18 100644 --- a/core/src/main/java/org/geysermc/connector/utils/LanguageUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/LanguageUtils.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; -import org.geysermc.connector.GeyserConnector; +import org.geysermc.geyser.GeyserImpl; import java.io.InputStream; import java.io.InputStreamReader; @@ -64,7 +64,7 @@ public class LanguageUtils { return; } - InputStream localeStream = GeyserConnector.class.getClassLoader().getResourceAsStream("languages/texts/" + locale + ".properties"); + InputStream localeStream = GeyserImpl.class.getClassLoader().getResourceAsStream("languages/texts/" + locale + ".properties"); // Load the locale if (localeStream != null) { @@ -78,8 +78,8 @@ public class LanguageUtils { // Insert the locale into the mappings LOCALE_MAPPINGS.put(locale, localeProp); } else { - if (GeyserConnector.getInstance() != null && GeyserConnector.getInstance().getLogger() != null) { - GeyserConnector.getInstance().getLogger().warning("Missing locale: " + locale); + if (GeyserImpl.getInstance() != null && GeyserImpl.getInstance().getLogger() != null) { + GeyserImpl.getInstance().getLogger().warning("Missing locale: " + locale); } } } @@ -168,10 +168,10 @@ public class LanguageUtils { String locale; boolean isValid = true; - if (GeyserConnector.getInstance() != null && - GeyserConnector.getInstance().getConfig() != null && - GeyserConnector.getInstance().getConfig().getDefaultLocale() != null) { // If the config option for getDefaultLocale does not equal null, use that - locale = formatLocale(GeyserConnector.getInstance().getConfig().getDefaultLocale()); + if (GeyserImpl.getInstance() != null && + GeyserImpl.getInstance().getConfig() != null && + GeyserImpl.getInstance().getConfig().getDefaultLocale() != null) { // If the config option for getDefaultLocale does not equal null, use that + locale = formatLocale(GeyserImpl.getInstance().getConfig().getDefaultLocale()); if (isValidLanguage(locale)) { CACHED_LOCALE = locale; return locale; @@ -184,8 +184,8 @@ public class LanguageUtils { locale = "en_US"; loadGeyserLocale(locale); } - if (GeyserConnector.getInstance() != null && - GeyserConnector.getInstance().getConfig() != null && (GeyserConnector.getInstance().getConfig().getDefaultLocale() == null || !isValid)) { // Means we should use the system locale for sure + if (GeyserImpl.getInstance() != null && + GeyserImpl.getInstance().getConfig() != null && (GeyserImpl.getInstance().getConfig().getDefaultLocale() == null || !isValid)) { // Means we should use the system locale for sure CACHED_LOCALE = locale; } return locale; @@ -200,11 +200,11 @@ public class LanguageUtils { boolean result = true; if (FileUtils.class.getResource("/languages/texts/" + locale + ".properties") == null) { result = false; - if (GeyserConnector.getInstance() != null && GeyserConnector.getInstance().getLogger() != null) { // Could be too early for these to be initialized + if (GeyserImpl.getInstance() != null && GeyserImpl.getInstance().getLogger() != null) { // Could be too early for these to be initialized if (locale.equals("en_US")) { - GeyserConnector.getInstance().getLogger().error("English locale not found in Geyser. Did you clone the submodules? (git submodule update --init)"); + GeyserImpl.getInstance().getLogger().error("English locale not found in Geyser. Did you clone the submodules? (git submodule update --init)"); } else { - GeyserConnector.getInstance().getLogger().warning(locale + " is not a valid Bedrock language."); // We can't translate this since we just loaded an invalid language + GeyserImpl.getInstance().getLogger().warning(locale + " is not a valid Bedrock language."); // We can't translate this since we just loaded an invalid language } } } else { diff --git a/core/src/main/java/org/geysermc/connector/utils/LocaleUtils.java b/core/src/main/java/org/geysermc/geyser/utils/LocaleUtils.java similarity index 79% rename from core/src/main/java/org/geysermc/connector/utils/LocaleUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/LocaleUtils.java index 623c4ba84..b22315f9f 100644 --- a/core/src/main/java/org/geysermc/connector/utils/LocaleUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/LocaleUtils.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import lombok.Getter; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.MinecraftProtocol; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.MinecraftProtocol; import java.io.*; import java.nio.file.Files; @@ -49,7 +49,7 @@ public class LocaleUtils { static { // Create the locales folder - File localesFolder = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("locales").toFile(); + File localesFolder = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("locales").toFile(); //noinspection ResultOfMethodCallIgnored localesFolder.mkdir(); @@ -64,7 +64,7 @@ public class LocaleUtils { return CompletableFuture.supplyAsync(() -> { try { // Get the version manifest from Mojang - VersionManifest versionManifest = GeyserConnector.JSON_MAPPER.readValue(WebUtils.getBody("https://launchermeta.mojang.com/mc/game/version_manifest.json"), VersionManifest.class); + VersionManifest versionManifest = GeyserImpl.JSON_MAPPER.readValue(WebUtils.getBody("https://launchermeta.mojang.com/mc/game/version_manifest.json"), VersionManifest.class); // Get the url for the latest version of the games manifest String latestInfoURL = ""; @@ -81,15 +81,15 @@ public class LocaleUtils { } // Get the individual version manifest - VersionInfo versionInfo = GeyserConnector.JSON_MAPPER.readValue(WebUtils.getBody(latestInfoURL), VersionInfo.class); + VersionInfo versionInfo = GeyserImpl.JSON_MAPPER.readValue(WebUtils.getBody(latestInfoURL), VersionInfo.class); // Get the client jar for use when downloading the en_us locale - GeyserConnector.getInstance().getLogger().debug(GeyserConnector.JSON_MAPPER.writeValueAsString(versionInfo.getDownloads())); + GeyserImpl.getInstance().getLogger().debug(GeyserImpl.JSON_MAPPER.writeValueAsString(versionInfo.getDownloads())); clientJarInfo = versionInfo.getDownloads().get("client"); - GeyserConnector.getInstance().getLogger().debug(GeyserConnector.JSON_MAPPER.writeValueAsString(clientJarInfo)); + GeyserImpl.getInstance().getLogger().debug(GeyserImpl.JSON_MAPPER.writeValueAsString(clientJarInfo)); // Get the assets list - JsonNode assets = GeyserConnector.JSON_MAPPER.readTree(WebUtils.getBody(versionInfo.getAssetIndex().getUrl())).get("objects"); + JsonNode assets = GeyserImpl.JSON_MAPPER.readTree(WebUtils.getBody(versionInfo.getAssetIndex().getUrl())).get("objects"); // Put each asset into an array for use later Iterator> assetIterator = assets.fields(); @@ -100,11 +100,11 @@ public class LocaleUtils { continue; } - Asset asset = GeyserConnector.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class); + Asset asset = GeyserImpl.JSON_MAPPER.treeToValue(entry.getValue(), Asset.class); ASSET_MAP.put(entry.getKey(), asset); } } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace()))); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace()))); } return null; }); @@ -124,11 +124,11 @@ public class LocaleUtils { // Check the locale isn't already loaded if (!ASSET_MAP.containsKey("minecraft/lang/" + locale + ".json") && !locale.equals("en_us")) { - GeyserConnector.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.invalid", locale)); + GeyserImpl.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.invalid", locale)); return; } - GeyserConnector.getInstance().getLogger().debug("Downloading and loading locale: " + locale); + GeyserImpl.getInstance().getLogger().debug("Downloading and loading locale: " + locale); downloadLocale(locale); loadLocale(locale); @@ -140,7 +140,7 @@ public class LocaleUtils { * @param locale Locale to download */ private static void downloadLocale(String locale) { - File localeFile = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("locales/" + locale + ".json").toFile(); + File localeFile = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("locales/" + locale + ".json").toFile(); // Check if we have already downloaded the locale file if (localeFile.exists()) { @@ -149,7 +149,7 @@ public class LocaleUtils { if (locale.equals("en_us")) { try { - File hashFile = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("locales/en_us.hash").toFile(); + File hashFile = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("locales/en_us.hash").toFile(); if (hashFile.exists()) { try (BufferedReader br = new BufferedReader(new FileReader(hashFile))) { curHash = br.readLine().trim(); @@ -159,7 +159,7 @@ public class LocaleUtils { if (clientJarInfo == null) { // Likely failed to download - GeyserConnector.getInstance().getLogger().debug("Skipping en_US hash check as client jar is null."); + GeyserImpl.getInstance().getLogger().debug("Skipping en_US hash check as client jar is null."); return; } targetHash = clientJarInfo.getSha1(); @@ -169,9 +169,9 @@ public class LocaleUtils { } if (!curHash.equals(targetHash)) { - GeyserConnector.getInstance().getLogger().debug("Locale out of date; re-downloading: " + locale); + GeyserImpl.getInstance().getLogger().debug("Locale out of date; re-downloading: " + locale); } else { - GeyserConnector.getInstance().getLogger().debug("Locale already downloaded and up-to date: " + locale); + GeyserImpl.getInstance().getLogger().debug("Locale already downloaded and up-to date: " + locale); return; } } @@ -188,7 +188,7 @@ public class LocaleUtils { String hash = ASSET_MAP.get("minecraft/lang/" + locale + ".json").getHash(); WebUtils.downloadFile("https://resources.download.minecraft.net/" + hash.substring(0, 2) + "/" + hash, localeFile.toString()); } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error("Unable to download locale file hash", e); + GeyserImpl.getInstance().getLogger().error("Unable to download locale file hash", e); } } @@ -198,7 +198,7 @@ public class LocaleUtils { * @param locale Locale to load */ private static void loadLocale(String locale) { - File localeFile = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("locales/" + locale + ".json").toFile(); + File localeFile = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("locales/" + locale + ".json").toFile(); // Load the locale if (localeFile.exists()) { @@ -213,7 +213,7 @@ public class LocaleUtils { // Parse the file as json JsonNode localeObj; try { - localeObj = GeyserConnector.JSON_MAPPER.readTree(localeStream); + localeObj = GeyserImpl.JSON_MAPPER.readTree(localeStream); } catch (Exception e) { throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.json", locale), e); } @@ -241,7 +241,7 @@ public class LocaleUtils { throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage())); } } else { - GeyserConnector.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.missing", locale)); + GeyserImpl.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.missing", locale)); } } @@ -253,11 +253,11 @@ public class LocaleUtils { private static void downloadEN_US(File localeFile) { try { // Let the user know we are downloading the JAR - GeyserConnector.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us")); - GeyserConnector.getInstance().getLogger().debug("Download URL: " + clientJarInfo.getUrl()); + GeyserImpl.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us")); + GeyserImpl.getInstance().getLogger().debug("Download URL: " + clientJarInfo.getUrl()); // Download the smallest JAR (client or server) - Path tmpFilePath = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("tmp_locale.jar"); + Path tmpFilePath = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("tmp_locale.jar"); WebUtils.downloadFile(clientJarInfo.getUrl(), tmpFilePath.toString()); // Load in the JAR as a zip and extract the file @@ -279,14 +279,14 @@ public class LocaleUtils { } // Store the latest jar hash - FileUtils.writeFile(GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("locales/en_us.hash").toString(), clientJarInfo.getSha1().toCharArray()); + FileUtils.writeFile(GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("locales/en_us.hash").toString(), clientJarInfo.getSha1().toCharArray()); // Delete the nolonger needed client/server jar Files.delete(tmpFilePath); - GeyserConnector.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us.done")); + GeyserImpl.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us.done")); } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.en_us"), e); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.en_us"), e); } } @@ -303,7 +303,7 @@ public class LocaleUtils { localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(LanguageUtils.getDefaultLocale()); if (localeStrings == null) { // Don't cause a NPE if the locale is STILL missing - GeyserConnector.getInstance().getLogger().debug("MISSING DEFAULT LOCALE: " + LanguageUtils.getDefaultLocale()); + GeyserImpl.getInstance().getLogger().debug("MISSING DEFAULT LOCALE: " + LanguageUtils.getDefaultLocale()); return messageText; } } diff --git a/core/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/geyser/utils/LoginEncryptionUtils.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/LoginEncryptionUtils.java index a189544b7..1b23f0cba 100644 --- a/core/src/main/java/org/geysermc/connector/utils/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/LoginEncryptionUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; @@ -37,11 +37,11 @@ import com.nukkitx.network.util.Preconditions; import com.nukkitx.protocol.bedrock.packet.LoginPacket; import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; import com.nukkitx.protocol.bedrock.util.EncryptionUtils; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.session.auth.AuthData; -import org.geysermc.connector.network.session.auth.BedrockClientData; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.session.auth.AuthData; +import org.geysermc.geyser.network.session.auth.BedrockClientData; import org.geysermc.cumulus.CustomForm; import org.geysermc.cumulus.ModalForm; import org.geysermc.cumulus.SimpleForm; @@ -132,13 +132,13 @@ public class LoginEncryptionUtils { private static void encryptConnectionWithCert(GeyserSession session, String clientData, JsonNode certChainData) { try { - GeyserConnector connector = session.getConnector(); + GeyserImpl geyser = session.getGeyser(); boolean validChain = validateChainData(certChainData); - connector.getLogger().debug(String.format("Is player data valid? %s", validChain)); + geyser.getLogger().debug(String.format("Is player data valid? %s", validChain)); - if (!validChain && !session.getConnector().getConfig().isEnableProxyConnections()) { + if (!validChain && !session.getGeyser().getConfig().isEnableProxyConnections()) { session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.remote.invalid_xbox_account")); return; } @@ -174,14 +174,14 @@ public class LoginEncryptionUtils { LoginEncryptionUtils.startEncryptionHandshake(session, identityPublicKey); } catch (Throwable e) { // An error can be thrown on older Java 8 versions about an invalid key - if (connector.getConfig().isDebugMode()) { + if (geyser.getConfig().isDebugMode()) { e.printStackTrace(); } - sendEncryptionFailedMessage(connector); + sendEncryptionFailedMessage(geyser); } } else { - sendEncryptionFailedMessage(connector); + sendEncryptionFailedMessage(geyser); } } catch (Exception ex) { session.disconnect("disconnectionScreen.internalError.cantConnect"); @@ -203,10 +203,10 @@ public class LoginEncryptionUtils { session.sendUpstreamPacketImmediately(packet); } - private static void sendEncryptionFailedMessage(GeyserConnector connector) { + private static void sendEncryptionFailedMessage(GeyserImpl geyser) { if (!HAS_SENT_ENCRYPTION_MESSAGE) { - connector.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.encryption.line_1")); - connector.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.encryption.line_2", "https://geysermc.org/supported_java")); + geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.encryption.line_1")); + geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.encryption.line_2", "https://geysermc.org/supported_java")); HAS_SENT_ENCRYPTION_MESSAGE = true; } } @@ -215,7 +215,7 @@ public class LoginEncryptionUtils { // Set DoDaylightCycle to false so the time doesn't accelerate while we're here session.setDaylightCycle(false); - GeyserConfiguration config = session.getConnector().getConfig(); + GeyserConfiguration config = session.getGeyser().getConfig(); boolean isPasswordAuthEnabled = config.getRemote().isPasswordAuthentication(); session.sendForm( diff --git a/core/src/main/java/org/geysermc/connector/utils/MapColor.java b/core/src/main/java/org/geysermc/geyser/utils/MapColor.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/utils/MapColor.java rename to core/src/main/java/org/geysermc/geyser/utils/MapColor.java index 2a7c34888..9b0a75e56 100644 --- a/core/src/main/java/org/geysermc/connector/utils/MapColor.java +++ b/core/src/main/java/org/geysermc/geyser/utils/MapColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; public enum MapColor { COLOR_0(-1, -1, -1), diff --git a/core/src/main/java/org/geysermc/connector/utils/MathUtils.java b/core/src/main/java/org/geysermc/geyser/utils/MathUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/MathUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/MathUtils.java index 3ccf812d3..ef638a5cd 100644 --- a/core/src/main/java/org/geysermc/connector/utils/MathUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/MathUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; public class MathUtils { diff --git a/core/src/main/java/org/geysermc/connector/utils/NewsHandler.java b/core/src/main/java/org/geysermc/geyser/utils/NewsHandler.java similarity index 93% rename from core/src/main/java/org/geysermc/connector/utils/NewsHandler.java rename to core/src/main/java/org/geysermc/geyser/utils/NewsHandler.java index 24df69817..5ff743630 100644 --- a/core/src/main/java/org/geysermc/connector/utils/NewsHandler.java +++ b/core/src/main/java/org/geysermc/geyser/utils/NewsHandler.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonSyntaxException; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.GeyserLogger; -import org.geysermc.connector.common.ChatColor; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.network.session.GeyserSession; import org.geysermc.floodgate.news.NewsItem; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.news.data.AnnouncementData; @@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit; public class NewsHandler { private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - private final GeyserLogger logger = GeyserConnector.getInstance().getLogger(); + private final GeyserLogger logger = GeyserImpl.getInstance().getLogger(); private final Gson gson = new Gson(); private final Map activeNewsItems = new HashMap<>(); @@ -109,7 +109,7 @@ public class NewsHandler { // } break; case BROADCAST_TO_OPERATORS: - for (GeyserSession player : GeyserConnector.getInstance().getSessionManager().getSessions().values()) { + for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { if (player.getOpPermissionLevel() >= 2) { session.sendMessage(ChatColor.GREEN + news.getMessage()); } diff --git a/core/src/main/java/org/geysermc/connector/utils/PaintingType.java b/core/src/main/java/org/geysermc/geyser/utils/PaintingType.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/PaintingType.java rename to core/src/main/java/org/geysermc/geyser/utils/PaintingType.java index 02482be34..aec9cb7c1 100644 --- a/core/src/main/java/org/geysermc/connector/utils/PaintingType.java +++ b/core/src/main/java/org/geysermc/geyser/utils/PaintingType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/core/src/main/java/org/geysermc/connector/utils/PistonBehavior.java b/core/src/main/java/org/geysermc/geyser/utils/PistonBehavior.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/utils/PistonBehavior.java rename to core/src/main/java/org/geysermc/geyser/utils/PistonBehavior.java index 67579e2ad..74678479c 100644 --- a/core/src/main/java/org/geysermc/connector/utils/PistonBehavior.java +++ b/core/src/main/java/org/geysermc/geyser/utils/PistonBehavior.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java b/core/src/main/java/org/geysermc/geyser/utils/PluginMessageUtils.java similarity index 94% rename from core/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/PluginMessageUtils.java index 686dadd17..a2d5b98f7 100644 --- a/core/src/main/java/org/geysermc/connector/utils/PluginMessageUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/PluginMessageUtils.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; import java.nio.ByteBuffer; @@ -38,7 +38,7 @@ public class PluginMessageUtils { private static final byte[] FLOODGATE_REGISTER_DATA; static { - byte[] data = GeyserConnector.NAME.getBytes(Charsets.UTF_8); + byte[] data = GeyserImpl.NAME.getBytes(Charsets.UTF_8); GEYSER_BRAND_DATA = ByteBuffer.allocate(data.length + getVarIntLength(data.length)) .put(writeVarInt(data.length)) diff --git a/core/src/main/java/org/geysermc/connector/utils/ResourcePack.java b/core/src/main/java/org/geysermc/geyser/utils/ResourcePack.java similarity index 92% rename from core/src/main/java/org/geysermc/connector/utils/ResourcePack.java rename to core/src/main/java/org/geysermc/geyser/utils/ResourcePack.java index 91d1b782e..cfa7c4051 100644 --- a/core/src/main/java/org/geysermc/connector/utils/ResourcePack.java +++ b/core/src/main/java/org/geysermc/geyser/utils/ResourcePack.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; -import org.geysermc.connector.GeyserConnector; +import org.geysermc.geyser.GeyserImpl; import java.io.File; import java.util.HashMap; @@ -57,7 +57,7 @@ public class ResourcePack { * Loop through the packs directory and locate valid resource pack files */ public static void loadPacks() { - File directory = GeyserConnector.getInstance().getBootstrap().getConfigFolder().resolve("packs").toFile(); + File directory = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("packs").toFile(); if (!directory.exists()) { directory.mkdir(); @@ -96,7 +96,7 @@ public class ResourcePack { } }); } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.resource_pack.broken", file.getName())); + GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.resource_pack.broken", file.getName())); e.printStackTrace(); } finally { if (stream != null) { diff --git a/core/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java b/core/src/main/java/org/geysermc/geyser/utils/ResourcePackManifest.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java rename to core/src/main/java/org/geysermc/geyser/utils/ResourcePackManifest.java index 972c732fc..c9563b5fc 100644 --- a/core/src/main/java/org/geysermc/connector/utils/ResourcePackManifest.java +++ b/core/src/main/java/org/geysermc/geyser/utils/ResourcePackManifest.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.EqualsAndHashCode; diff --git a/core/src/main/java/org/geysermc/connector/utils/SettingsUtils.java b/core/src/main/java/org/geysermc/geyser/utils/SettingsUtils.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/utils/SettingsUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/SettingsUtils.java index f859aba48..c79c84735 100644 --- a/core/src/main/java/org/geysermc/connector/utils/SettingsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/SettingsUtils.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; -import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.world.WorldManager; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.world.WorldManager; import org.geysermc.cumulus.CustomForm; import org.geysermc.cumulus.component.DropdownComponent; import org.geysermc.cumulus.response.CustomFormResponse; @@ -52,7 +52,7 @@ public class SettingsUtils { // Only show the client title if any of the client settings are available boolean showClientSettings = session.getPreferencesCache().isAllowShowCoordinates() || CooldownUtils.getDefaultShowCooldown() != CooldownUtils.CooldownType.DISABLED - || session.getConnector().getConfig().isAllowCustomSkulls(); + || session.getGeyser().getConfig().isAllowCustomSkulls(); if (showClientSettings) { builder.label("geyser.settings.title.client"); @@ -70,7 +70,7 @@ public class SettingsUtils { builder.dropdown(cooldownDropdown); } - if (session.getConnector().getConfig().isAllowCustomSkulls()) { + if (session.getGeyser().getConfig().isAllowCustomSkulls()) { builder.toggle("geyser.settings.option.customSkulls", session.getPreferencesCache().isPrefersCustomSkulls()); } } @@ -97,7 +97,7 @@ public class SettingsUtils { builder.label("geyser.settings.title.game_rules") .translator(LocaleUtils::getLocaleString); // we need translate gamerules next - WorldManager worldManager = GeyserConnector.getInstance().getWorldManager(); + WorldManager worldManager = GeyserImpl.getInstance().getWorldManager(); for (GameRule gamerule : GameRule.values()) { if (gamerule.equals(GameRule.UNKNOWN)) { continue; @@ -130,7 +130,7 @@ public class SettingsUtils { session.getPreferencesCache().setCooldownPreference(cooldownType); } - if (session.getConnector().getConfig().isAllowCustomSkulls()) { + if (session.getGeyser().getConfig().isAllowCustomSkulls()) { session.getPreferencesCache().setPrefersCustomSkulls(response.next()); } } @@ -138,12 +138,12 @@ public class SettingsUtils { if (canModifyServer) { GameMode gameMode = GameMode.values()[(int) response.next()]; if (gameMode != null && gameMode != session.getGameMode()) { - session.getConnector().getWorldManager().setPlayerGameMode(session, gameMode); + session.getGeyser().getWorldManager().setPlayerGameMode(session, gameMode); } Difficulty difficulty = Difficulty.values()[(int) response.next()]; if (difficulty != null && difficulty != session.getWorldCache().getDifficulty()) { - session.getConnector().getWorldManager().setDifficulty(session, difficulty); + session.getGeyser().getWorldManager().setDifficulty(session, difficulty); } } @@ -155,13 +155,13 @@ public class SettingsUtils { if (Boolean.class.equals(gamerule.getType())) { boolean value = response.next(); - if (value != session.getConnector().getWorldManager().getGameRuleBool(session, gamerule)) { - session.getConnector().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); + if (value != session.getGeyser().getWorldManager().getGameRuleBool(session, gamerule)) { + session.getGeyser().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); } } else if (Integer.class.equals(gamerule.getType())) { int value = Integer.parseInt(response.next()); - if (value != session.getConnector().getWorldManager().getGameRuleInt(session, gamerule)) { - session.getConnector().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); + if (value != session.getGeyser().getWorldManager().getGameRuleInt(session, gamerule)) { + session.getGeyser().getWorldManager().setGameRule(session, gamerule.getJavaID(), value); } } } diff --git a/core/src/main/java/org/geysermc/connector/utils/SignUtils.java b/core/src/main/java/org/geysermc/geyser/utils/SignUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/SignUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/SignUtils.java index b324c745d..5cb9182c9 100644 --- a/core/src/main/java/org/geysermc/connector/utils/SignUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/SignUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; /** * Provides utilities for interacting with signs. Mainly, it deals with the widths of each character. diff --git a/core/src/main/java/org/geysermc/connector/utils/SoundUtils.java b/core/src/main/java/org/geysermc/geyser/utils/SoundUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/utils/SoundUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/SoundUtils.java index 5abd9ff57..79aaf94e4 100644 --- a/core/src/main/java/org/geysermc/connector/utils/SoundUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/SoundUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.nukkitx.protocol.bedrock.data.SoundEvent; diff --git a/core/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java b/core/src/main/java/org/geysermc/geyser/utils/StatisticsUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/StatisticsUtils.java index eca4f7453..da7bf4705 100644 --- a/core/src/main/java/org/geysermc/connector/utils/StatisticsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/StatisticsUtils.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.statistic.*; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.registry.BlockRegistries; -import org.geysermc.connector.registry.type.ItemMappings; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.cumulus.SimpleForm; import org.geysermc.cumulus.response.SimpleFormResponse; import org.geysermc.cumulus.util.FormImage; diff --git a/core/src/main/java/org/geysermc/connector/utils/WebUtils.java b/core/src/main/java/org/geysermc/geyser/utils/WebUtils.java similarity index 87% rename from core/src/main/java/org/geysermc/connector/utils/WebUtils.java rename to core/src/main/java/org/geysermc/geyser/utils/WebUtils.java index b736a282c..52e1783d5 100644 --- a/core/src/main/java/org/geysermc/connector/utils/WebUtils.java +++ b/core/src/main/java/org/geysermc/geyser/utils/WebUtils.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils; +package org.geysermc.geyser.utils; import com.fasterxml.jackson.databind.JsonNode; -import org.geysermc.connector.GeyserConnector; +import org.geysermc.geyser.GeyserImpl; import java.io.*; import java.net.HttpURLConnection; @@ -51,7 +51,7 @@ public class WebUtils { URL url = new URL(reqURL); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); - con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); // Otherwise Java 8 fails on checking updates + con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); // Otherwise Java 8 fails on checking updates return connectionToString(con); } catch (Exception e) { @@ -67,8 +67,8 @@ public class WebUtils { */ public static JsonNode getJson(String reqURL) throws IOException { HttpURLConnection con = (HttpURLConnection) new URL(reqURL).openConnection(); - con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); - return GeyserConnector.JSON_MAPPER.readTree(con.getInputStream()); + con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); + return GeyserImpl.JSON_MAPPER.readTree(con.getInputStream()); } /** @@ -80,7 +80,7 @@ public class WebUtils { public static void downloadFile(String reqURL, String fileLocation) { try { HttpURLConnection con = (HttpURLConnection) new URL(reqURL).openConnection(); - con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); + con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); InputStream in = con.getInputStream(); Files.copy(in, Paths.get(fileLocation), StandardCopyOption.REPLACE_EXISTING); } catch (Exception e) { @@ -101,7 +101,7 @@ public class WebUtils { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "text/plain"); - con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); + con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); con.setDoOutput(true); OutputStream out = con.getOutputStream(); @@ -156,7 +156,7 @@ public class WebUtils { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); - con.setRequestProperty("User-Agent", "Geyser-" + GeyserConnector.getInstance().getPlatformType().toString() + "/" + GeyserConnector.VERSION); + con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); con.setDoOutput(true); try (OutputStream out = con.getOutputStream()) { diff --git a/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java b/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2BooleanMap.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java rename to core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2BooleanMap.java index 0e31e4be6..f28614597 100644 --- a/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2BooleanMap.java +++ b/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2BooleanMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils.collections; +package org.geysermc.geyser.utils.collections; import it.unimi.dsi.fastutil.ints.AbstractInt2BooleanMap; import it.unimi.dsi.fastutil.objects.ObjectSet; diff --git a/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java b/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2ByteMap.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java rename to core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2ByteMap.java index 5aa4bc528..6917ccf51 100644 --- a/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2ByteMap.java +++ b/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2ByteMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils.collections; +package org.geysermc.geyser.utils.collections; import it.unimi.dsi.fastutil.ints.AbstractInt2ByteMap; import it.unimi.dsi.fastutil.ints.Int2ByteMap; diff --git a/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java b/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2IntMap.java similarity index 98% rename from core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java rename to core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2IntMap.java index 77e6740bc..bab3dbc04 100644 --- a/core/src/main/java/org/geysermc/connector/utils/collections/FixedInt2IntMap.java +++ b/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2IntMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils.collections; +package org.geysermc.geyser.utils.collections; import it.unimi.dsi.fastutil.ints.AbstractInt2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntMap; diff --git a/core/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java b/core/src/main/java/org/geysermc/geyser/utils/collections/LecternHasBookMap.java similarity index 88% rename from core/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java rename to core/src/main/java/org/geysermc/geyser/utils/collections/LecternHasBookMap.java index f6371af8d..50d392a10 100644 --- a/core/src/main/java/org/geysermc/connector/utils/collections/LecternHasBookMap.java +++ b/core/src/main/java/org/geysermc/geyser/utils/collections/LecternHasBookMap.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils.collections; +package org.geysermc.geyser.utils.collections; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.connector.network.session.GeyserSession; -import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.connector.network.translators.world.WorldManager; -import org.geysermc.connector.utils.BlockEntityUtils; +import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; +import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.utils.BlockEntityUtils; /** * Map that takes advantage of its internals for fast operations on block states to determine if they are lecterns. @@ -42,7 +42,7 @@ public class LecternHasBookMap extends FixedInt2BooleanMap { * optimize lectern determining. */ public void handleBlockChange(GeyserSession session, int blockState, Vector3i position) { - WorldManager worldManager = session.getConnector().getWorldManager(); + WorldManager worldManager = session.getGeyser().getWorldManager(); int offset = blockState - this.start; if (offset < 0 || offset >= this.value.length) { diff --git a/core/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java b/core/src/main/java/org/geysermc/geyser/utils/collections/Object2IntBiMap.java similarity index 99% rename from core/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java rename to core/src/main/java/org/geysermc/geyser/utils/collections/Object2IntBiMap.java index 29364437c..6a576105c 100644 --- a/core/src/main/java/org/geysermc/connector/utils/collections/Object2IntBiMap.java +++ b/core/src/main/java/org/geysermc/geyser/utils/collections/Object2IntBiMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils.collections; +package org.geysermc.geyser.utils.collections; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/core/src/main/java/org/geysermc/connector/utils/collections/package-info.java b/core/src/main/java/org/geysermc/geyser/utils/collections/package-info.java similarity index 97% rename from core/src/main/java/org/geysermc/connector/utils/collections/package-info.java rename to core/src/main/java/org/geysermc/geyser/utils/collections/package-info.java index 3400f3f2a..3628e0385 100644 --- a/core/src/main/java/org/geysermc/connector/utils/collections/package-info.java +++ b/core/src/main/java/org/geysermc/geyser/utils/collections/package-info.java @@ -31,4 +31,4 @@ * and {@link java.util.Map#containsKey(java.lang.Object)} can be performed by simply checking the bounds of the map * size and its "start" integer. */ -package org.geysermc.connector.utils.collections; \ No newline at end of file +package org.geysermc.geyser.utils.collections; \ No newline at end of file diff --git a/core/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java b/core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java similarity index 98% rename from core/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java rename to core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java index cfb2bbc97..2f4e95f1e 100644 --- a/core/src/test/java/org/geysermc/connector/network/translators/chat/MessageTranslatorTest.java +++ b/core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.network.translators.chat; +package org.geysermc.geyser.network.translators.chat; import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer; import org.junit.Assert; @@ -55,7 +55,7 @@ public class MessageTranslatorTest { "§r§7[§r§eH§r§7]§r§f §r§7§lGUEST§r§l §r§9»§r§7 §r§frtm516§r§7: §r§fThis is an amazing bedrock test message"); // Test translation and positional arguments - // Disabled due to not having an GeyserConnector instance, hence it fails + // Disabled due to not having an Geyser instance, hence it fails //messages.put("{\"translate\":\"death.attack.player\",\"with\":[{\"text\":\"rtm516\",\"insertion\":\"rtm516\"},{\"text\":\"*invincible_rt\",\"insertion\":\"*invincible_rt\"}]}", // "rtm516 was slain by *invincible_rt"); //// Test translation with the ' character (which MessageFormat requires special handling for) diff --git a/core/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java b/core/src/test/java/org/geysermc/geyser/utils/collections/GeyserCollectionsTest.java similarity index 99% rename from core/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java rename to core/src/test/java/org/geysermc/geyser/utils/collections/GeyserCollectionsTest.java index acd8bcbd0..1cbfd57a5 100644 --- a/core/src/test/java/org/geysermc/connector/utils/collections/GeyserCollectionsTest.java +++ b/core/src/test/java/org/geysermc/geyser/utils/collections/GeyserCollectionsTest.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.connector.utils.collections; +package org.geysermc.geyser.utils.collections; import org.junit.Assert; import org.junit.Test; diff --git a/pom.xml b/pom.xml index 99a4b3374..67e068212 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ bootstrap common core + api From 2c663e0ee5824e88c571ec679e68d1eab59a72ec Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 20 Nov 2021 17:29:46 -0600 Subject: [PATCH 697/766] The Great Refactor Part 3 - Entire project restructure --- .../processor/BlockEntityProcessor.java | 2 +- .../processor/CollisionRemapperProcessor.java | 2 +- .../processor/ItemRemapperProcessor.java | 2 +- .../processor/PacketTranslatorProcessor.java | 2 +- .../processor/SoundHandlerProcessor.java | 2 +- .../bungeecord/GeyserBungeeDumpInfo.java | 2 +- .../bungeecord/GeyserBungeeInjector.java | 8 +- .../platform/bungeecord/GeyserBungeeMain.java | 4 +- .../GeyserBungeePingPassthrough.java | 2 +- .../bungeecord/GeyserBungeePlugin.java | 14 +- .../command/BungeeCommandSender.java | 8 +- .../command/GeyserBungeeCommandExecutor.java | 8 +- .../platform/spigot/GeyserSpigotDumpInfo.java | 2 +- .../platform/spigot/GeyserSpigotInjector.java | 6 +- .../platform/spigot/GeyserSpigotMain.java | 4 +- .../spigot/GeyserSpigotPingPassthrough.java | 2 +- .../platform/spigot/GeyserSpigotPlugin.java | 24 ++-- .../command/GeyserSpigotCommandExecutor.java | 8 +- .../spigot/command/SpigotCommandSender.java | 6 +- .../spigot/world/GeyserPistonListener.java | 10 +- .../GeyserSpigot1_11CraftingListener.java | 6 +- .../world/GeyserSpigotBlockPlaceListener.java | 4 +- .../GeyserSpigot1_12NativeWorldManager.java | 4 +- .../manager/GeyserSpigot1_12WorldManager.java | 4 +- .../GeyserSpigotFallbackWorldManager.java | 4 +- .../GeyserSpigotLegacyNativeWorldManager.java | 2 +- .../GeyserSpigotNativeWorldManager.java | 4 +- .../manager/GeyserSpigotWorldManager.java | 12 +- .../platform/sponge/GeyserSpongeMain.java | 4 +- .../sponge/GeyserSpongePingPassthrough.java | 2 +- .../platform/sponge/GeyserSpongePlugin.java | 10 +- .../command/GeyserSpongeCommandExecutor.java | 10 +- .../standalone/GeyserStandaloneBootstrap.java | 28 ++-- .../standalone/GeyserStandaloneLogger.java | 2 +- .../platform/standalone/LoopbackUtil.java | 8 +- .../standalone/gui/GeyserStandaloneGUI.java | 38 +++--- .../velocity/GeyserVelocityDumpInfo.java | 2 +- .../velocity/GeyserVelocityInjector.java | 6 +- .../platform/velocity/GeyserVelocityMain.java | 4 +- .../GeyserVelocityPingPassthrough.java | 2 +- .../velocity/GeyserVelocityPlugin.java | 16 +-- .../GeyserVelocityCommandExecutor.java | 10 +- .../command/VelocityCommandSender.java | 8 +- .../network/session/GeyserSession.java | 4 +- .../network/session/auth/AuthData.java | 4 +- .../geyser/{utils => }/Constants.java | 2 +- .../geysermc/geyser/FloodgateKeyLoader.java | 10 +- .../{bootstrap => }/GeyserBootstrap.java | 7 +- .../java/org/geysermc/geyser/GeyserImpl.java | 59 ++++----- .../main/IGeyserMain.java => GeyserMain.java} | 8 +- .../geyser/command/CommandExecutor.java | 2 +- .../geyser/command/CommandManager.java | 10 +- .../geyser/command/CommandSender.java | 6 +- .../geyser/command/GeyserCommand.java | 2 +- .../command/defaults/AdvancementsCommand.java | 2 +- .../geyser/command/defaults/DumpCommand.java | 36 +++--- .../geyser/command/defaults/HelpCommand.java | 10 +- .../geyser/command/defaults/ListCommand.java | 6 +- .../command/defaults/OffhandCommand.java | 4 +- .../command/defaults/ReloadCommand.java | 6 +- .../command/defaults/SettingsCommand.java | 4 +- .../command/defaults/StatisticsCommand.java | 2 +- .../geyser/command/defaults/StopCommand.java | 6 +- .../command/defaults/VersionCommand.java | 22 ++-- .../configuration/GeyserConfiguration.java | 9 +- .../GeyserJacksonConfiguration.java | 8 +- .../org/geysermc/geyser/dump/DumpInfo.java | 29 ++++- .../geyser/entity/EntityDefinition.java | 4 +- .../geyser/entity/EntityDefinitions.java | 33 ++--- .../InteractiveTagManager.java | 18 +-- .../entity/factory/BaseEntityFactory.java | 4 +- .../geyser/entity/factory/EntityFactory.java | 2 +- .../factory/ExperienceOrbEntityFactory.java | 4 +- .../entity/factory/PaintingEntityFactory.java | 6 +- .../{ => type}/AbstractArrowEntity.java | 5 +- .../{ => type}/AreaEffectCloudEntity.java | 9 +- .../geyser/entity/{ => type}/BoatEntity.java | 6 +- .../CommandBlockMinecartEntity.java | 5 +- .../DefaultBlockMinecartEntity.java | 5 +- .../entity/{ => type}/EnderCrystalEntity.java | 5 +- .../geyser/entity/{ => type}/Entity.java | 10 +- .../entity/{ => type}/ExpOrbEntity.java | 5 +- .../entity/{ => type}/FallingBlockEntity.java | 5 +- .../entity/{ => type}/FireworkEntity.java | 11 +- .../entity/{ => type}/FishingHookEntity.java | 17 +-- .../{ => type}/FurnaceMinecartEntity.java | 7 +- .../geyser/entity/{ => type}/ItemEntity.java | 9 +- .../entity/{ => type}/ItemFrameEntity.java | 7 +- .../{ => type}/ItemedFireballEntity.java | 5 +- .../entity/{ => type}/LeashKnotEntity.java | 5 +- .../entity/{ => type}/LightningEntity.java | 5 +- .../entity/{ => type}/LivingEntity.java | 9 +- .../entity/{ => type}/MinecartEntity.java | 5 +- .../entity/{ => type}/PaintingEntity.java | 7 +- .../{ => type}/SpawnerMinecartEntity.java | 7 +- .../geyser/entity/{ => type}/TNTEntity.java | 6 +- .../entity/{ => type}/ThrowableEntity.java | 7 +- .../{ => type}/ThrowableItemEntity.java | 5 +- .../entity/{ => type}/ThrownPotionEntity.java | 7 +- .../geyser/entity/{ => type}/Tickable.java | 2 +- .../entity/{ => type}/TippedArrowEntity.java | 7 +- .../entity/{ => type}/TridentEntity.java | 5 +- .../entity/{ => type}/WitherSkullEntity.java | 6 +- .../{ => type}/living/AbstractFishEntity.java | 4 +- .../{ => type}/living/AgeableEntity.java | 4 +- .../{ => type}/living/AmbientEntity.java | 4 +- .../{ => type}/living/ArmorStandEntity.java | 6 +- .../entity/{ => type}/living/BatEntity.java | 4 +- .../{ => type}/living/CreatureEntity.java | 4 +- .../{ => type}/living/FlyingEntity.java | 4 +- .../{ => type}/living/GlowSquidEntity.java | 4 +- .../entity/{ => type}/living/GolemEntity.java | 4 +- .../{ => type}/living/IronGolemEntity.java | 4 +- .../{ => type}/living/MagmaCubeEntity.java | 4 +- .../entity/{ => type}/living/MobEntity.java | 6 +- .../entity/{ => type}/living/SlimeEntity.java | 4 +- .../{ => type}/living/SnowGolemEntity.java | 4 +- .../entity/{ => type}/living/SquidEntity.java | 8 +- .../entity/{ => type}/living/WaterEntity.java | 4 +- .../living/animal/AnimalEntity.java | 6 +- .../living/animal/AxolotlEntity.java | 4 +- .../{ => type}/living/animal/BeeEntity.java | 4 +- .../living/animal/ChickenEntity.java | 4 +- .../{ => type}/living/animal/FoxEntity.java | 4 +- .../{ => type}/living/animal/GoatEntity.java | 4 +- .../living/animal/HoglinEntity.java | 6 +- .../living/animal/MooshroomEntity.java | 4 +- .../living/animal/OcelotEntity.java | 4 +- .../{ => type}/living/animal/PandaEntity.java | 4 +- .../{ => type}/living/animal/PigEntity.java | 4 +- .../living/animal/PolarBearEntity.java | 4 +- .../living/animal/PufferFishEntity.java | 6 +- .../living/animal/RabbitEntity.java | 4 +- .../{ => type}/living/animal/SheepEntity.java | 5 +- .../living/animal/StriderEntity.java | 6 +- .../living/animal/TropicalFishEntity.java | 6 +- .../living/animal/TurtleEntity.java | 4 +- .../animal/horse/AbstractHorseEntity.java | 6 +- .../animal/horse/ChestedHorseEntity.java | 4 +- .../living/animal/horse/HorseEntity.java | 4 +- .../living/animal/horse/LlamaEntity.java | 4 +- .../animal/horse/TraderLlamaEntity.java | 4 +- .../living/animal/tameable/CatEntity.java | 4 +- .../living/animal/tameable/ParrotEntity.java | 4 +- .../animal/tameable/TameableEntity.java | 8 +- .../living/animal/tameable/WolfEntity.java | 4 +- .../merchant/AbstractMerchantEntity.java | 6 +- .../living/merchant/VillagerEntity.java | 4 +- .../monster/AbstractSkeletonEntity.java | 4 +- .../living/monster/BasePiglinEntity.java | 6 +- .../living/monster/BlazeEntity.java | 4 +- .../living/monster/CreeperEntity.java | 4 +- .../living/monster/ElderGuardianEntity.java | 4 +- .../living/monster/EnderDragonEntity.java | 10 +- .../living/monster/EnderDragonPartEntity.java | 6 +- .../living/monster/EndermanEntity.java | 4 +- .../living/monster/GhastEntity.java | 6 +- .../living/monster/GiantEntity.java | 4 +- .../living/monster/GuardianEntity.java | 6 +- .../living/monster/MonsterEntity.java | 6 +- .../living/monster/PhantomEntity.java | 6 +- .../living/monster/PiglinEntity.java | 4 +- .../living/monster/ShulkerEntity.java | 6 +- .../living/monster/SkeletonEntity.java | 4 +- .../living/monster/SpiderEntity.java | 4 +- .../{ => type}/living/monster/VexEntity.java | 4 +- .../living/monster/WitherEntity.java | 6 +- .../living/monster/ZoglinEntity.java | 4 +- .../living/monster/ZombieEntity.java | 4 +- .../living/monster/ZombieVillagerEntity.java | 6 +- .../living/monster/ZombifiedPiglinEntity.java | 4 +- .../monster/raid/AbstractIllagerEntity.java | 4 +- .../living/monster/raid/PillagerEntity.java | 4 +- .../monster/raid/RaidParticipantEntity.java | 6 +- .../raid/SpellcasterIllagerEntity.java | 4 +- .../living/monster/raid/VindicatorEntity.java | 4 +- .../{ => type}/player/PlayerEntity.java | 14 +- .../player/SessionPlayerEntity.java | 6 +- .../{ => type}/player/SkullPlayerEntity.java | 4 +- .../inventory/BedrockContainerSlot.java | 2 +- .../geysermc/geyser/inventory/Container.java | 4 +- .../geyser/inventory/Generic3X3Container.java | 5 +- .../geyser/inventory/GeyserEnchantOption.java | 2 +- .../geyser/inventory/GeyserItemStack.java | 4 +- .../geysermc/geyser/inventory/Inventory.java | 2 +- .../geyser/inventory/MerchantContainer.java | 2 +- .../geyser/inventory/PlayerInventory.java | 2 +- .../translators => }/inventory/SlotType.java | 2 +- .../inventory/StonecutterContainer.java | 2 +- .../inventory/click/Click.java | 2 +- .../inventory/click/ClickPlan.java | 14 +- .../holder/BlockInventoryHolder.java | 8 +- .../inventory/holder/InventoryHolder.java | 6 +- .../item/Enchantment.java | 2 +- .../item/Potion.java | 2 +- .../item/StoredItemMappings.java | 2 +- .../item/TippedArrowPotion.java | 2 +- .../updater/AnvilInventoryUpdater.java | 12 +- .../updater/ChestInventoryUpdater.java | 12 +- .../updater/ContainerInventoryUpdater.java | 6 +- .../updater/HorseInventoryUpdater.java | 6 +- .../inventory/updater/InventoryUpdater.java | 6 +- .../inventory/updater/UIInventoryUpdater.java | 6 +- .../{utils => level}/BedrockMapIcon.java | 2 +- .../{utils => level}/FireworkColor.java | 2 +- .../geyser/{utils => level}/GameRule.java | 2 +- .../{utils => level}/GeyserAdvancement.java | 4 +- .../world => level}/GeyserWorldManager.java | 11 +- .../geyser/{utils => level}/MapColor.java | 2 +- .../geyser/{utils => level}/PaintingType.java | 2 +- .../world => level}/WorldManager.java | 5 +- .../block}/BlockPositionIterator.java | 2 +- .../block/BlockStateValues.java | 14 +- .../block/DoubleChestValue.java | 2 +- .../world => level}/chunk/BlockStorage.java | 6 +- .../world => level}/chunk/GeyserChunk.java | 2 +- .../chunk/GeyserChunkSection.java | 2 +- .../world => level}/chunk/NibbleArray.java | 2 +- .../chunk/bitarray/BitArray.java | 2 +- .../chunk/bitarray/BitArrayVersion.java | 4 +- .../chunk/bitarray/PaddedBitArray.java | 4 +- .../chunk/bitarray/Pow2BitArray.java | 4 +- .../chunk/bitarray/SingletonBitArray.java | 2 +- .../geyser/{utils => level/physics}/Axis.java | 2 +- .../physics}/BoundingBox.java | 4 +- .../physics}/CollisionManager.java | 21 ++- .../{utils => level/physics}/Direction.java | 2 +- .../physics}/PistonBehavior.java | 2 +- .../network/ConnectorServerEventHandler.java | 12 +- .../geyser/network/LoggingPacketHandler.java | 2 +- .../geyser/network/QueryPacketHandler.java | 4 +- .../geyser/network/UpstreamPacketHandler.java | 30 +++-- .../netty}/ChannelWrapper.java | 2 +- .../netty}/DefaultChannelPipelinePublic.java | 2 +- .../netty}/GeyserInjector.java | 4 +- .../netty}/LocalChannelWithRemoteAddress.java | 2 +- .../netty}/LocalChannelWrapper.java | 2 +- .../netty}/LocalServerChannelWrapper.java | 2 +- .../netty}/LocalSession.java | 2 +- .../translators/PacketTranslatorRegistry.java | 121 ------------------ .../geyser/{utils => pack}/ResourcePack.java | 6 +- .../{utils => pack}/ResourcePackManifest.java | 2 +- .../ping/GeyserLegacyPingPassthrough.java | 1 - .../{common => }/ping/GeyserPingInfo.java | 2 +- .../geyser/ping/IGeyserPingPassthrough.java | 2 - .../registry/AbstractMappedRegistry.java | 19 +++ .../geyser/registry/BlockRegistries.java | 2 +- .../registry/PacketTranslatorRegistry.java | 96 ++++++++++++++ .../geysermc/geyser/registry/Registries.java | 38 ++++-- .../loader/AnnotatedRegistryLoader.java | 4 +- .../loader/BiomeIdentifierRegistryLoader.java | 2 +- .../loader/BlockEntityRegistryLoader.java | 8 +- .../loader/CollisionRegistryLoader.java | 12 +- .../registry/loader/EffectRegistryLoader.java | 2 +- .../loader/EnchantmentRegistryLoader.java | 4 +- .../registry/loader/NbtRegistryLoader.java | 2 +- .../loader/PotionMixRegistryLoader.java | 2 +- .../loader/SoundEventsRegistryLoader.java | 22 ++-- .../registry/loader/SoundRegistryLoader.java | 2 +- ...ava => SoundTranslatorRegistryLoader.java} | 10 +- .../populator/BlockRegistryPopulator.java | 8 +- .../populator/ItemRegistryPopulator.java | 4 +- .../populator/PacketRegistryPopulator.java | 63 +++++++++ .../populator/RecipeRegistryPopulator.java | 10 +- .../geyser/registry/type/BlockMapping.java | 4 +- .../geyser/registry/type/EnchantmentData.java | 2 +- .../geyser/registry/type/ItemMappings.java | 2 +- .../geyser/registry/type/ParticleMapping.java | 9 ++ .../geyser/scoreboard/Scoreboard.java | 10 +- .../geyser/scoreboard/ScoreboardUpdater.java | 10 +- .../{network => }/session/GeyserSession.java | 88 +++++++------ .../geyser/{ => session}/SessionManager.java | 8 +- .../session/UpstreamSession.java | 2 +- .../{network => }/session/auth/AuthData.java | 2 +- .../{common => session/auth}/AuthType.java | 2 +- .../session/auth/BedrockClientData.java | 2 +- .../session/cache/AdvancementsCache.java | 22 ++-- .../session/cache/BookEditCache.java | 4 +- .../{network => }/session/cache/BossBar.java | 6 +- .../session/cache/ChunkCache.java | 10 +- .../session/cache/EntityCache.java | 10 +- .../session/cache/EntityEffectCache.java | 2 +- .../session/cache/FormCache.java | 4 +- .../session/cache/LodestoneCache.java | 2 +- .../session/cache/PistonCache.java | 12 +- .../session/cache/PreferencesCache.java | 6 +- .../{network => }/session/cache/TagCache.java | 2 +- .../session/cache/TeleportCache.java | 2 +- .../session/cache/WorldBorder.java | 6 +- .../session/cache/WorldCache.java | 4 +- .../geyser/skin/FloodgateSkinUploader.java | 8 +- .../org/geysermc/geyser/skin/SkinManager.java | 16 +-- .../geysermc/geyser/skin/SkinProvider.java | 6 +- .../geyser/skin/SkullSkinManager.java | 8 +- .../AsteriskSerializer.java | 2 +- .../geyser/{common => text}/ChatColor.java | 2 +- .../GeyserLocale.java} | 5 +- .../GsonComponentSerializerWrapper.java | 9 +- .../MinecraftLocale.java} | 34 ++--- .../MinecraftTranslationRegistry.java | 5 +- .../collision}/BlockCollision.java | 10 +- .../collision/CollisionRemapper.java | 2 +- .../collision}/DirtPathCollision.java | 7 +- .../collision}/DoorCollision.java | 8 +- .../collision}/OtherCollision.java | 4 +- .../collision}/ScaffoldingCollision.java | 7 +- .../collision}/SnowCollision.java | 7 +- .../collision}/SolidCollision.java | 5 +- .../collision}/SpawnerCollision.java | 3 +- .../collision}/TrapdoorCollision.java | 9 +- .../entity/EntityMetadataTranslator.java | 7 +- .../AbstractBlockInventoryTranslator.java | 10 +- .../inventory}/AnvilInventoryTranslator.java | 8 +- .../inventory}/BaseInventoryTranslator.java | 9 +- .../inventory}/BeaconInventoryTranslator.java | 13 +- .../BrewingInventoryTranslator.java | 8 +- .../CartographyInventoryTranslator.java | 8 +- .../CraftingInventoryTranslator.java | 8 +- .../EnchantingInventoryTranslator.java | 10 +- .../Generic3X3InventoryTranslator.java | 8 +- .../GrindstoneInventoryTranslator.java | 6 +- .../inventory}/HopperInventoryTranslator.java | 6 +- .../inventory/InventoryTranslator.java | 25 ++-- .../LecternInventoryTranslator.java | 10 +- .../inventory}/LoomInventoryTranslator.java | 12 +- .../MerchantInventoryTranslator.java | 14 +- .../inventory}/PlayerInventoryTranslator.java | 17 ++- .../ShulkerInventoryTranslator.java | 12 +- .../SmithingInventoryTranslator.java | 6 +- .../StonecutterInventoryTranslator.java | 12 +- .../chest/ChestInventoryTranslator.java | 12 +- .../chest/DoubleChestInventoryTranslator.java | 10 +- .../chest/SingleChestInventoryTranslator.java | 8 +- .../AbstractFurnaceInventoryTranslator.java | 12 +- .../BlastFurnaceInventoryTranslator.java | 4 +- .../furnace/FurnaceInventoryTranslator.java | 4 +- .../furnace/SmokerInventoryTranslator.java | 4 +- .../AbstractHorseInventoryTranslator.java | 10 +- .../ChestedHorseInventoryTranslator.java | 6 +- .../horse/DonkeyInventoryTranslator.java | 2 +- .../horse/HorseInventoryTranslator.java | 4 +- .../horse/LlamaInventoryTranslator.java | 2 +- .../inventory/item}/BannerTranslator.java | 4 +- .../inventory/item}/CompassTranslator.java | 4 +- .../inventory/item}/ItemRemapper.java | 2 +- .../inventory}/item/ItemTranslator.java | 13 +- .../item/NbtItemStackTranslator.java | 4 +- .../inventory/item}/PotionTranslator.java | 6 +- .../item}/TippedArrowTranslator.java | 6 +- .../item}/nbt/AxolotlBucketTranslator.java | 12 +- .../item}/nbt/BasicItemTranslator.java | 12 +- .../item}/nbt/BookPagesTranslator.java | 10 +- .../item}/nbt/CrossbowTranslator.java | 10 +- .../item}/nbt/EnchantedBookTranslator.java | 8 +- .../item}/nbt/EnchantmentTranslator.java | 10 +- .../item}/nbt/FireworkBaseTranslator.java | 8 +- .../item}/nbt/FireworkRocketTranslator.java | 8 +- .../item}/nbt/FireworkStarTranslator.java | 6 +- .../item}/nbt/LeatherArmorTranslator.java | 8 +- .../item}/nbt/LodestoneCompassTranslator.java | 8 +- .../item}/nbt/MapItemTranslator.java | 8 +- .../item}/nbt/PlayerHeadTranslator.java | 12 +- .../item}/nbt/ShulkerBoxItemTranslator.java | 11 +- .../nbt/TropicalFishBucketTranslator.java | 16 +-- .../level}/BiomeTranslator.java | 16 +-- .../entity/BannerBlockEntityTranslator.java | 6 +- .../entity/BeaconBlockEntityTranslator.java | 2 +- .../entity/BedBlockEntityTranslator.java | 4 +- .../block/entity/BedrockOnlyBlockEntity.java | 4 +- .../level}/block/entity/BlockEntity.java | 2 +- .../block/entity/BlockEntityTranslator.java | 4 +- .../entity/CampfireBlockEntityTranslator.java | 2 +- .../CommandBlockBlockEntityTranslator.java | 6 +- .../DoubleChestBlockEntityTranslator.java | 10 +- .../entity/EmptyBlockEntityTranslator.java | 2 +- .../EndGatewayBlockEntityTranslator.java | 2 +- .../FlowerPotBlockEntityTranslator.java | 8 +- .../JigsawBlockBlockEntityTranslator.java | 2 +- .../NoteblockBlockEntityTranslator.java | 6 +- .../block/entity/PistonBlockEntity.java | 18 +-- .../entity/PistonBlockEntityTranslator.java | 4 +- .../block/entity/RequiresBlockState.java | 2 +- .../ShulkerBoxBlockEntityTranslator.java | 7 +- .../entity/SignBlockEntityTranslator.java | 6 +- .../entity/SkullBlockEntityTranslator.java | 8 +- .../entity/SpawnerBlockEntityTranslator.java | 2 +- .../level/event/LevelEventTranslator.java} | 8 +- .../event/PlaySoundEventTranslator.java} | 10 +- .../event/SoundEventEventTranslator.java} | 10 +- .../event/SoundLevelEventTranslator.java} | 10 +- .../protocol}/PacketTranslator.java | 4 +- .../protocol}/Translator.java | 3 +- .../BedrockAdventureSettingsTranslator.java | 8 +- .../bedrock/BedrockAnimateTranslator.java | 8 +- .../BedrockBlockEntityDataTranslator.java | 10 +- .../BedrockBlockPickRequestTranslator.java | 14 +- .../bedrock/BedrockBookEditTranslator.java | 8 +- .../BedrockCommandBlockUpdateTranslator.java | 8 +- .../BedrockCommandRequestTranslator.java | 10 +- .../BedrockContainerCloseTranslator.java | 10 +- .../bedrock/BedrockEmoteListTranslator.java | 8 +- .../BedrockEntityPickRequestTranslator.java | 14 +- .../bedrock/BedrockFilterTextTranslator.java | 12 +- ...BedrockInventoryTransactionTranslator.java | 22 ++-- .../BedrockItemFrameDropItemTranslator.java | 12 +- .../BedrockItemStackRequestTranslator.java | 10 +- .../BedrockLecternUpdateTranslator.java | 10 +- .../BedrockMapInfoRequestTranslator.java | 8 +- .../BedrockMobEquipmentTranslator.java | 12 +- .../BedrockMoveEntityAbsoluteTranslator.java | 12 +- .../BedrockNetworkStackLatencyTranslator.java | 8 +- ...drockPacketViolationWarningTranslator.java | 8 +- .../bedrock/BedrockPlayerInputTranslator.java | 16 +-- ...tionTrackingDBClientRequestTranslator.java | 12 +- .../bedrock/BedrockRespawnTranslator.java | 10 +- ...edrockServerSettingsRequestTranslator.java | 10 +- ...SetLocalPlayerAsInitializedTranslator.java | 12 +- .../bedrock/BedrockShowCreditsTranslator.java | 8 +- .../bedrock/BedrockTextTranslator.java | 10 +- .../entity/BedrockEntityEventTranslator.java | 10 +- .../player/BedrockActionTranslator.java | 18 +-- .../entity/player/BedrockEmoteTranslator.java | 12 +- .../player/BedrockInteractTranslator.java | 14 +- .../player/BedrockMovePlayerTranslator.java | 12 +- .../player/BedrockRiderJumpTranslator.java | 12 +- .../BedrockSetPlayerGameTypeTranslator.java | 8 +- .../BedrockLevelSoundEventTranslator.java | 10 +- .../java/JavaAwardStatsTranslator.java | 10 +- .../java/JavaBossEventTranslator.java | 10 +- .../java/JavaChangeDifficultyTranslator.java | 8 +- .../protocol}/java/JavaChatTranslator.java | 10 +- .../java/JavaCommandsTranslator.java | 12 +- .../java/JavaCustomPayloadTranslator.java | 10 +- .../java/JavaCustomQueryTranslator.java | 8 +- .../java/JavaDisconnectTranslator.java | 10 +- .../java/JavaGameProfileTranslator.java | 12 +- .../java/JavaKeepAliveTranslator.java | 8 +- .../java/JavaLoginDisconnectTranslator.java | 10 +- .../protocol}/java/JavaLoginTranslator.java | 20 +-- .../protocol}/java/JavaPingTranslator.java | 8 +- .../protocol}/java/JavaRecipeTranslator.java | 8 +- .../protocol}/java/JavaRespawnTranslator.java | 16 +-- .../JavaSelectAdvancementsTabTranslator.java | 10 +- .../JavaUpdateAdvancementsTranslator.java | 18 +-- .../java/JavaUpdateRecipesTranslator.java | 14 +- .../java/JavaUpdateTagsTranslator.java | 8 +- .../java/entity/JavaAnimateTranslator.java | 12 +- .../entity/JavaEntityEventTranslator.java | 14 +- .../JavaMoveEntityPosRotTranslator.java | 10 +- .../entity/JavaMoveEntityPosTranslator.java | 10 +- .../entity/JavaMoveEntityRotTranslator.java | 10 +- .../entity/JavaMoveVehicleTranslator.java | 10 +- .../entity/JavaRemoveEntitiesTranslator.java | 10 +- .../entity/JavaRemoveMobEffectTranslator.java | 12 +- .../java/entity/JavaRotateHeadTranslator.java | 10 +- .../entity/JavaSetEntityDataTranslator.java | 16 +-- .../entity/JavaSetEntityLinkTranslator.java | 12 +- .../entity/JavaSetEntityMotionTranslator.java | 14 +- .../entity/JavaSetEquipmentTranslator.java | 14 +- .../entity/JavaSetPassengersTranslator.java | 12 +- .../entity/JavaTakeItemEntityTranslator.java | 12 +- .../entity/JavaTeleportEntityTranslator.java | 10 +- .../JavaUpdateAttributesTranslator.java | 12 +- .../entity/JavaUpdateMobEffectTranslator.java | 12 +- .../player/JavaBlockBreakAckTranslator.java | 12 +- .../player/JavaPlayerAbilitiesTranslator.java | 8 +- .../player/JavaPlayerInfoTranslator.java | 10 +- .../player/JavaPlayerPositionTranslator.java | 22 ++-- .../player/JavaSetCarriedItemTranslator.java | 8 +- .../player/JavaSetExperienceTranslator.java | 10 +- .../player/JavaSetHealthTranslator.java | 10 +- .../entity/spawn/JavaAddEntityTranslator.java | 18 ++- .../spawn/JavaAddExperienceOrbTranslator.java | 12 +- .../entity/spawn/JavaAddMobTranslator.java | 14 +- .../spawn/JavaAddPaintingTranslator.java | 12 +- .../entity/spawn/JavaAddPlayerTranslator.java | 14 +- .../JavaContainerCloseTranslator.java | 10 +- .../JavaContainerSetContentTranslator.java | 12 +- .../JavaContainerSetDataTranslator.java | 12 +- .../JavaContainerSetSlotTranslator.java | 18 +-- .../JavaHorseScreenOpenTranslator.java | 24 ++-- .../JavaMerchantOffersTranslator.java | 12 +- .../inventory/JavaOpenScreenTranslator.java | 18 +-- .../level/JavaBlockDestructionTranslator.java | 10 +- .../level/JavaBlockEntityDataTranslator.java | 18 +-- .../java/level/JavaBlockEventTranslator.java | 18 +-- .../java/level/JavaBlockUpdateTranslator.java | 14 +- .../java/level/JavaCustomSoundTranslator.java | 8 +- .../java/level/JavaExplodeTranslator.java | 12 +- .../level/JavaForgetLevelChunkTranslator.java | 8 +- .../java/level/JavaGameEventTranslator.java | 16 +-- .../JavaLevelChunkWithLightTranslator.java | 36 +++--- .../java/level/JavaLevelEventTranslator.java | 18 +-- .../level/JavaLevelParticlesTranslator.java | 12 +- .../java/level/JavaMapItemDataTranslator.java | 14 +- .../JavaSectionBlocksUpdateTranslator.java | 10 +- .../JavaSetChunkCacheCenterTranslator.java | 10 +- .../JavaSetChunkCacheRadiusTranslator.java | 8 +- ...JavaSetDefaultSpawnPositionTranslator.java | 10 +- .../java/level/JavaSetTimeTranslator.java | 8 +- .../java/level/JavaSoundTranslator.java | 12 +- .../java/level/JavaStopSoundTranslator.java | 8 +- .../JavaInitializeBorderTranslator.java | 10 +- .../border/JavaSetBorderCenterTranslator.java | 10 +- .../JavaSetBorderLerpSizeTranslator.java | 10 +- .../border/JavaSetBorderSizeTranslator.java | 10 +- .../JavaSetBorderWarningDelayTranslator.java | 10 +- ...avaSetBorderWarningDistanceTranslator.java | 10 +- .../JavaSetDisplayObjectiveTranslator.java | 10 +- .../JavaSetObjectiveTranslator.java | 14 +- .../JavaSetPlayerTeamTranslator.java | 10 +- .../scoreboard/JavaSetScoreTranslator.java | 16 +-- .../java/title/JavaClearTitlesTranslator.java | 8 +- .../title/JavaSetActionBarTextTranslator.java | 10 +- .../title/JavaSetSubtitleTextTranslator.java | 10 +- .../title/JavaSetTitleTextTranslator.java | 10 +- .../JavaSetTitlesAnimationTranslator.java | 8 +- .../BlockSoundInteractionTranslator.java} | 14 +- .../EntitySoundInteractionTranslator.java} | 14 +- .../sound/SoundInteractionTranslator.java} | 8 +- .../sound/SoundTranslator.java} | 10 +- .../BucketSoundInteractionTranslator.java} | 16 +-- ...ComparatorSoundInteractionTranslator.java} | 14 +- .../DoorSoundInteractionTranslator.java} | 14 +- .../FlintAndSteelInteractionTranslator.java} | 14 +- .../GrassPathInteractionTranslator.java} | 14 +- .../block/HoeInteractionTranslator.java} | 14 +- .../LeverSoundInteractionTranslator.java} | 14 +- .../FeedBabySoundInteractionTranslator.java} | 22 ++-- ...MilkEntitySoundInteractionTranslator.java} | 18 +-- .../text}/MessageTranslator.java | 16 ++- .../{utils => util}/AttributeUtils.java | 2 +- .../{utils => util}/BlockEntityUtils.java | 10 +- .../geyser/{utils => util}/BlockUtils.java | 8 +- .../geyser/{utils => util}/ChunkUtils.java | 23 ++-- .../geyser/{utils => util}/CooldownUtils.java | 6 +- .../{utils => util}/DimensionUtils.java | 6 +- .../geyser/{utils => util}/EntityUtils.java | 8 +- .../geyser/{utils => util}/FileUtils.java | 2 +- .../{utils => util}/InventoryUtils.java | 15 ++- .../geyser/{utils => util}/ItemUtils.java | 4 +- .../{utils => util}/LoginEncryptionUtils.java | 27 ++-- .../geyser/{utils => util}/MathUtils.java | 2 +- .../geyser/{metrics => util}/Metrics.java | 2 +- .../geyser/{utils => util}/NewsHandler.java | 7 +- .../{utils => util}/PluginMessageUtils.java | 4 +- .../geyser/{utils => util}/SettingsUtils.java | 15 ++- .../geyser/{utils => util}/SignUtils.java | 2 +- .../geyser/{utils => util}/SoundUtils.java | 2 +- .../{utils => util}/StatisticsUtils.java | 14 +- .../geyser/{utils => util}/WebUtils.java | 2 +- .../collection}/FixedInt2BooleanMap.java | 2 +- .../collection}/FixedInt2ByteMap.java | 2 +- .../collection}/FixedInt2IntMap.java | 2 +- .../collection}/LecternHasBookMap.java | 10 +- .../collection}/Object2IntBiMap.java | 2 +- .../collection}/package-info.java | 2 +- .../geysermc/geyser/utils/DockerCheck.java | 49 ------- .../geysermc/geyser/utils/EffectUtils.java | 61 --------- .../chat/MessageTranslatorTest.java | 1 + .../collection}/GeyserCollectionsTest.java | 2 +- 561 files changed, 2468 insertions(+), 2457 deletions(-) rename core/src/main/java/org/geysermc/geyser/{utils => }/Constants.java (98%) rename core/src/main/java/org/geysermc/geyser/{bootstrap => }/GeyserBootstrap.java (94%) rename core/src/main/java/org/geysermc/geyser/{common/main/IGeyserMain.java => GeyserMain.java} (91%) rename core/src/main/java/org/geysermc/geyser/{utils => entity}/InteractiveTagManager.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/AbstractArrowEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/AreaEffectCloudEntity.java (90%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/BoatEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/CommandBlockMinecartEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/DefaultBlockMinecartEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/EnderCrystalEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/Entity.java (98%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ExpOrbEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/FallingBlockEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/FireworkEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/FishingHookEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/FurnaceMinecartEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ItemEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ItemFrameEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ItemedFireballEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/LeashKnotEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/LightningEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/LivingEntity.java (98%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/MinecartEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/PaintingEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/SpawnerMinecartEntity.java (90%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/TNTEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ThrowableEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ThrowableItemEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/ThrownPotionEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/Tickable.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/TippedArrowEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/TridentEntity.java (91%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/WitherSkullEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/AbstractFishEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/AgeableEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/AmbientEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/ArmorStandEntity.java (99%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/BatEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/CreatureEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/FlyingEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/GlowSquidEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/GolemEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/IronGolemEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/MagmaCubeEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/MobEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/SlimeEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/SnowGolemEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/SquidEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/WaterEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/AnimalEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/AxolotlEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/BeeEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/ChickenEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/FoxEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/GoatEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/HoglinEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/MooshroomEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/OcelotEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/PandaEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/PigEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/PolarBearEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/PufferFishEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/RabbitEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/SheepEntity.java (91%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/StriderEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/TropicalFishEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/TurtleEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/horse/AbstractHorseEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/horse/ChestedHorseEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/horse/HorseEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/horse/LlamaEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/horse/TraderLlamaEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/tameable/CatEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/tameable/ParrotEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/tameable/TameableEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/animal/tameable/WolfEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/merchant/AbstractMerchantEntity.java (91%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/merchant/VillagerEntity.java (98%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/AbstractSkeletonEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/BasePiglinEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/BlazeEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/CreeperEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/ElderGuardianEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/EnderDragonEntity.java (98%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/EnderDragonPartEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/EndermanEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/GhastEntity.java (92%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/GiantEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/GuardianEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/MonsterEntity.java (90%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/PhantomEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/PiglinEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/ShulkerEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/SkeletonEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/SpiderEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/VexEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/WitherEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/ZoglinEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/ZombieEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/ZombieVillagerEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/ZombifiedPiglinEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/raid/AbstractIllagerEntity.java (93%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/raid/PillagerEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/raid/RaidParticipantEntity.java (90%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/raid/SpellcasterIllagerEntity.java (96%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/living/monster/raid/VindicatorEntity.java (94%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/player/PlayerEntity.java (98%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/player/SessionPlayerEntity.java (98%) rename core/src/main/java/org/geysermc/geyser/entity/{ => type}/player/SkullPlayerEntity.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/BedrockContainerSlot.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/SlotType.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/click/Click.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/click/ClickPlan.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/holder/BlockInventoryHolder.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/holder/InventoryHolder.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => inventory}/item/Enchantment.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators => inventory}/item/Potion.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators => inventory}/item/StoredItemMappings.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators => inventory}/item/TippedArrowPotion.java (99%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/updater/AnvilInventoryUpdater.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/updater/ChestInventoryUpdater.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/updater/ContainerInventoryUpdater.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/updater/HorseInventoryUpdater.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/updater/InventoryUpdater.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => }/inventory/updater/UIInventoryUpdater.java (93%) rename core/src/main/java/org/geysermc/geyser/{utils => level}/BedrockMapIcon.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils => level}/FireworkColor.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils => level}/GameRule.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils => level}/GeyserAdvancement.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/GeyserWorldManager.java (92%) rename core/src/main/java/org/geysermc/geyser/{utils => level}/MapColor.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils => level}/PaintingType.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/WorldManager.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => level/block}/BlockPositionIterator.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/block/BlockStateValues.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/block/DoubleChestValue.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/BlockStorage.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/GeyserChunk.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/GeyserChunkSection.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/NibbleArray.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/bitarray/BitArray.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/bitarray/BitArrayVersion.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/bitarray/PaddedBitArray.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/bitarray/Pow2BitArray.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => level}/chunk/bitarray/SingletonBitArray.java (96%) rename core/src/main/java/org/geysermc/geyser/{utils => level/physics}/Axis.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision => level/physics}/BoundingBox.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision => level/physics}/CollisionManager.java (96%) rename core/src/main/java/org/geysermc/geyser/{utils => level/physics}/Direction.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils => level/physics}/PistonBehavior.java (97%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/ChannelWrapper.java (99%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/DefaultChannelPipelinePublic.java (97%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/GeyserInjector.java (97%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/LocalChannelWithRemoteAddress.java (97%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/LocalChannelWrapper.java (98%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/LocalServerChannelWrapper.java (97%) rename core/src/main/java/org/geysermc/geyser/{common/connection => network/netty}/LocalSession.java (99%) delete mode 100644 core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java rename core/src/main/java/org/geysermc/geyser/{utils => pack}/ResourcePack.java (94%) rename core/src/main/java/org/geysermc/geyser/{utils => pack}/ResourcePackManifest.java (99%) rename core/src/main/java/org/geysermc/geyser/{common => }/ping/GeyserPingInfo.java (98%) create mode 100644 core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java rename core/src/main/java/org/geysermc/geyser/registry/loader/{SoundHandlerRegistryLoader.java => SoundTranslatorRegistryLoader.java} (78%) create mode 100644 core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java rename core/src/main/java/org/geysermc/geyser/{network => }/session/GeyserSession.java (92%) rename core/src/main/java/org/geysermc/geyser/{ => session}/SessionManager.java (93%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/UpstreamSession.java (98%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/auth/AuthData.java (97%) rename core/src/main/java/org/geysermc/geyser/{common => session/auth}/AuthType.java (98%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/auth/BedrockClientData.java (98%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/AdvancementsCache.java (91%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/BookEditCache.java (96%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/BossBar.java (96%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/ChunkCache.java (94%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/EntityCache.java (95%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/EntityEffectCache.java (97%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/FormCache.java (97%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/LodestoneCache.java (99%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/PistonCache.java (95%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/PreferencesCache.java (95%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/TagCache.java (99%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/TeleportCache.java (98%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/WorldBorder.java (98%) rename core/src/main/java/org/geysermc/geyser/{network => }/session/cache/WorldCache.java (95%) rename core/src/main/java/org/geysermc/geyser/{common/serializer => text}/AsteriskSerializer.java (98%) rename core/src/main/java/org/geysermc/geyser/{common => text}/ChatColor.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils/LanguageUtils.java => text/GeyserLocale.java} (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/chat => text}/GsonComponentSerializerWrapper.java (89%) rename core/src/main/java/org/geysermc/geyser/{utils/LocaleUtils.java => text/MinecraftLocale.java} (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators/chat => text}/MinecraftTranslationRegistry.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/BlockCollision.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator}/collision/CollisionRemapper.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/DirtPathCollision.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/DoorCollision.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/OtherCollision.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/ScaffoldingCollision.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/SnowCollision.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/SolidCollision.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/SpawnerCollision.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/collision/translators => translator/collision}/TrapdoorCollision.java (91%) rename core/src/main/java/org/geysermc/geyser/{ => translator}/entity/EntityMetadataTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/AbstractBlockInventoryTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/AnvilInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/BaseInventoryTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/BeaconInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/BrewingInventoryTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/CartographyInventoryTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/CraftingInventoryTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/EnchantingInventoryTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/Generic3X3InventoryTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/GrindstoneInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/HopperInventoryTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator}/inventory/InventoryTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/LecternInventoryTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/LoomInventoryTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/MerchantInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/PlayerInventoryTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/ShulkerInventoryTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/SmithingInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/StonecutterInventoryTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/chest/ChestInventoryTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/chest/DoubleChestInventoryTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/chest/SingleChestInventoryTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/furnace/AbstractFurnaceInventoryTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/furnace/BlastFurnaceInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/furnace/FurnaceInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/furnace/SmokerInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/horse/AbstractHorseInventoryTranslator.java (84%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/horse/ChestedHorseInventoryTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/horse/DonkeyInventoryTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/horse/HorseInventoryTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/inventory/translators => translator/inventory}/horse/LlamaInventoryTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/BannerTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/CompassTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/inventory/item}/ItemRemapper.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/inventory}/item/ItemTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/inventory}/item/NbtItemStackTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/PotionTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/TippedArrowTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/AxolotlBucketTranslator.java (83%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/BasicItemTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/BookPagesTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/CrossbowTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/EnchantedBookTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/EnchantmentTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/FireworkBaseTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/FireworkRocketTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/FireworkStarTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/LeatherArmorTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/LodestoneCompassTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/MapItemTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/PlayerHeadTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/ShulkerBoxItemTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/item/translators => translator/inventory/item}/nbt/TropicalFishBucketTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/BiomeTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/BannerBlockEntityTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/BeaconBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/BedBlockEntityTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/BedrockOnlyBlockEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/BlockEntity.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/BlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/CampfireBlockEntityTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/CommandBlockBlockEntityTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/DoubleChestBlockEntityTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/EmptyBlockEntityTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/EndGatewayBlockEntityTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/FlowerPotBlockEntityTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/JigsawBlockBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/NoteblockBlockEntityTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/PistonBlockEntity.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/PistonBlockEntityTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/RequiresBlockState.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/ShulkerBoxBlockEntityTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/SignBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/SkullBlockEntityTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world => translator/level}/block/entity/SpawnerBlockEntityTranslator.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world/event/LevelEventTransformer.java => translator/level/event/LevelEventTranslator.java} (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world/event/PlaySoundEventTransformer.java => translator/level/event/PlaySoundEventTranslator.java} (83%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world/event/SoundEventEventTransformer.java => translator/level/event/SoundEventEventTranslator.java} (84%) rename core/src/main/java/org/geysermc/geyser/{network/translators/world/event/SoundLevelEventTransformer.java => translator/level/event/SoundLevelEventTranslator.java} (83%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/PacketTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/Translator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockAdventureSettingsTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockAnimateTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockBlockEntityDataTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockBlockPickRequestTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockBookEditTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockCommandBlockUpdateTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockCommandRequestTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockContainerCloseTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockEmoteListTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockEntityPickRequestTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockFilterTextTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockInventoryTransactionTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockItemFrameDropItemTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockItemStackRequestTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockLecternUpdateTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockMapInfoRequestTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockMobEquipmentTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockMoveEntityAbsoluteTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockNetworkStackLatencyTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockPacketViolationWarningTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockPlayerInputTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockRespawnTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockServerSettingsRequestTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockShowCreditsTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/BedrockTextTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/BedrockEntityEventTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/player/BedrockActionTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/player/BedrockEmoteTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/player/BedrockInteractTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/player/BedrockMovePlayerTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/player/BedrockRiderJumpTranslator.java (84%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/bedrock/world/BedrockLevelSoundEventTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaAwardStatsTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaBossEventTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaChangeDifficultyTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaChatTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaCommandsTranslator.java (98%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaCustomPayloadTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaCustomQueryTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaDisconnectTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaGameProfileTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaKeepAliveTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaLoginDisconnectTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaLoginTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaPingTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaRecipeTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaRespawnTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaSelectAdvancementsTabTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaUpdateAdvancementsTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaUpdateRecipesTranslator.java (97%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/JavaUpdateTagsTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaAnimateTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaEntityEventTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaMoveEntityPosRotTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaMoveEntityPosTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaMoveEntityRotTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaMoveVehicleTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaRemoveEntitiesTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaRemoveMobEffectTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaRotateHeadTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaSetEntityDataTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaSetEntityLinkTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaSetEntityMotionTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaSetEquipmentTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaSetPassengersTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaTakeItemEntityTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaTeleportEntityTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaUpdateAttributesTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/JavaUpdateMobEffectTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaBlockBreakAckTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaPlayerAbilitiesTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaPlayerInfoTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaPlayerPositionTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaSetCarriedItemTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaSetExperienceTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/player/JavaSetHealthTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/spawn/JavaAddEntityTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/spawn/JavaAddExperienceOrbTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/spawn/JavaAddMobTranslator.java (84%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/spawn/JavaAddPaintingTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/entity/spawn/JavaAddPlayerTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaContainerCloseTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaContainerSetContentTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaContainerSetDataTranslator.java (84%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaContainerSetSlotTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaHorseScreenOpenTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaMerchantOffersTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/inventory/JavaOpenScreenTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaBlockDestructionTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaBlockEntityDataTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaBlockEventTranslator.java (92%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaBlockUpdateTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaCustomSoundTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaExplodeTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaForgetLevelChunkTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaGameEventTranslator.java (94%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaLevelChunkWithLightTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaLevelEventTranslator.java (96%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaLevelParticlesTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaMapItemDataTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaSectionBlocksUpdateTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaSetChunkCacheCenterTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaSetChunkCacheRadiusTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaSetDefaultSpawnPositionTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaSetTimeTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaSoundTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/JavaStopSoundTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/border/JavaInitializeBorderTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/border/JavaSetBorderCenterTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/border/JavaSetBorderLerpSizeTranslator.java (86%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/border/JavaSetBorderSizeTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/border/JavaSetBorderWarningDelayTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/level/border/JavaSetBorderWarningDistanceTranslator.java (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/scoreboard/JavaSetDisplayObjectiveTranslator.java (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/scoreboard/JavaSetObjectiveTranslator.java (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/scoreboard/JavaSetPlayerTeamTranslator.java (95%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/scoreboard/JavaSetScoreTranslator.java (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/title/JavaClearTitlesTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/title/JavaSetActionBarTextTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/title/JavaSetSubtitleTextTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/title/JavaSetTitleTextTranslator.java (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators => translator/protocol}/java/title/JavaSetTitlesAnimationTranslator.java (89%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/BlockSoundInteractionHandler.java => translator/sound/BlockSoundInteractionTranslator.java} (90%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/EntitySoundInteractionHandler.java => translator/sound/EntitySoundInteractionTranslator.java} (87%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/SoundInteractionHandler.java => translator/sound/SoundInteractionTranslator.java} (88%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/SoundHandler.java => translator/sound/SoundTranslator.java} (91%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/BucketSoundInteractionHandler.java => translator/sound/block/BucketSoundInteractionTranslator.java} (85%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/ComparatorSoundInteractionHandler.java => translator/sound/block/ComparatorSoundInteractionTranslator.java} (78%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/DoorSoundInteractionHandler.java => translator/sound/block/DoorSoundInteractionTranslator.java} (77%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/FlintAndSteelInteractionHandler.java => translator/sound/block/FlintAndSteelInteractionTranslator.java} (77%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/HoeInteractionHandler.java => translator/sound/block/GrassPathInteractionTranslator.java} (79%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/GrassPathInteractionHandler.java => translator/sound/block/HoeInteractionTranslator.java} (78%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/block/LeverSoundInteractionHandler.java => translator/sound/block/LeverSoundInteractionTranslator.java} (78%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/entity/FeedBabySoundInteractionHandler.java => translator/sound/entity/FeedBabySoundInteractionTranslator.java} (75%) rename core/src/main/java/org/geysermc/geyser/{network/translators/sound/entity/MilkEntitySoundInteractionHandler.java => translator/sound/entity/MilkEntitySoundInteractionTranslator.java} (79%) rename core/src/main/java/org/geysermc/geyser/{network/translators/chat => translator/text}/MessageTranslator.java (93%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/AttributeUtils.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/BlockEntityUtils.java (92%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/BlockUtils.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/ChunkUtils.java (93%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/CooldownUtils.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/DimensionUtils.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/EntityUtils.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/FileUtils.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/InventoryUtils.java (96%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/ItemUtils.java (96%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/LoginEncryptionUtils.java (91%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/MathUtils.java (99%) rename core/src/main/java/org/geysermc/geyser/{metrics => util}/Metrics.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/NewsHandler.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/PluginMessageUtils.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/SettingsUtils.java (94%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/SignUtils.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/SoundUtils.java (97%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/StatisticsUtils.java (96%) rename core/src/main/java/org/geysermc/geyser/{utils => util}/WebUtils.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils/collections => util/collection}/FixedInt2BooleanMap.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils/collections => util/collection}/FixedInt2ByteMap.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils/collections => util/collection}/FixedInt2IntMap.java (98%) rename core/src/main/java/org/geysermc/geyser/{utils/collections => util/collection}/LecternHasBookMap.java (91%) rename core/src/main/java/org/geysermc/geyser/{utils/collections => util/collection}/Object2IntBiMap.java (99%) rename core/src/main/java/org/geysermc/geyser/{utils/collections => util/collection}/package-info.java (97%) delete mode 100644 core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java delete mode 100644 core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java rename core/src/test/java/org/geysermc/geyser/{utils/collections => util/collection}/GeyserCollectionsTest.java (99%) diff --git a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java index e1d7e91f1..5a0b2d2f9 100644 --- a/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/BlockEntityProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class BlockEntityProcessor extends ClassProcessor { public BlockEntityProcessor() { - super("org.geysermc.geyser.network.translators.world.block.entity.BlockEntity"); + super("org.geysermc.geyser.translator.level.block.entity.BlockEntity"); } } diff --git a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java index 1fcebb01d..eae2e5d97 100644 --- a/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/CollisionRemapperProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class CollisionRemapperProcessor extends ClassProcessor { public CollisionRemapperProcessor() { - super("org.geysermc.geyser.network.translators.collision.CollisionRemapper"); + super("org.geysermc.geyser.translator.collision.CollisionRemapper"); } } diff --git a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java index e7f764055..cb49e8749 100644 --- a/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/ItemRemapperProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class ItemRemapperProcessor extends ClassProcessor { public ItemRemapperProcessor() { - super("org.geysermc.geyser.network.translators.ItemRemapper"); + super("org.geysermc.geyser.translator.inventory.item.ItemRemapper"); } } diff --git a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java index 53307384a..5c46453e3 100644 --- a/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/PacketTranslatorProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class PacketTranslatorProcessor extends ClassProcessor { public PacketTranslatorProcessor() { - super("org.geysermc.geyser.network.translators.Translator"); + super("org.geysermc.geyser.translator.protocol.Translator"); } } diff --git a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java index 3d7f4fa18..ad52533e9 100644 --- a/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java +++ b/ap/src/main/java/org/geysermc/processor/SoundHandlerProcessor.java @@ -33,6 +33,6 @@ import javax.lang.model.SourceVersion; @SupportedSourceVersion(SourceVersion.RELEASE_16) public class SoundHandlerProcessor extends ClassProcessor { public SoundHandlerProcessor() { - super("org.geysermc.geyser.network.translators.sound.SoundHandler"); + super("org.geysermc.geyser.translator.sound.SoundTranslator"); } } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java index d4714ab7c..ded11fd91 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeDumpInfo.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.bungeecord; import lombok.Getter; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.plugin.Plugin; -import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.dump.BootstrapDumpInfo; import java.util.ArrayList; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java index 497384ab1..389f0e37f 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeInjector.java @@ -40,10 +40,10 @@ import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.netty.PipelineUtils; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; -import org.geysermc.geyser.common.connection.GeyserInjector; -import org.geysermc.geyser.common.connection.LocalServerChannelWrapper; -import org.geysermc.geyser.common.connection.LocalSession; +import org.geysermc.geyser.GeyserBootstrap; +import org.geysermc.geyser.network.netty.GeyserInjector; +import org.geysermc.geyser.network.netty.LocalServerChannelWrapper; +import org.geysermc.geyser.network.netty.LocalSession; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java index 587a26ca2..224c500a1 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeMain.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.platform.bungeecord; -import org.geysermc.geyser.common.main.IGeyserMain; +import org.geysermc.geyser.GeyserMain; -public class GeyserBungeeMain extends IGeyserMain { +public class GeyserBungeeMain extends GeyserMain { public static void main(String[] args) { new GeyserBungeeMain().displayMessage(); diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java index 86cb21a42..393517aa2 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePingPassthrough.java @@ -34,7 +34,7 @@ import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.event.ProxyPingEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.protocol.ProtocolConstants; -import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import java.net.InetSocketAddress; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java index 9a7a8bc4d..26f7520f6 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java @@ -29,15 +29,15 @@ import net.md_5.bungee.api.config.ListenerInfo; import net.md_5.bungee.api.plugin.Plugin; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandExecutor; import org.geysermc.geyser.platform.bungeecord.command.GeyserBungeeCommandManager; import org.jetbrains.annotations.Nullable; @@ -72,7 +72,7 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserBungeeConfiguration.class); } catch (IOException ex) { - getLogger().log(Level.WARNING, LanguageUtils.getLocaleStringLog("geyser.config.failed"), ex); + getLogger().log(Level.WARNING, GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); ex.printStackTrace(); } @@ -101,12 +101,12 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { // Remove this in like a year if (getProxy().getPluginManager().getPlugin("floodgate-bungee") != null) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); return; } if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && getProxy().getPluginManager().getPlugin("floodgate") == null) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; } else if (geyserConfig.isAutoconfiguredRemote() && getProxy().getPluginManager().getPlugin("floodgate") != null) { // Floodgate installed means that the user wants Floodgate authentication diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java index 6e99c01e1..c7cd90489 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.bungeecord.command; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import org.geysermc.geyser.command.CommandSender; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; public class BungeeCommandSender implements CommandSender { @@ -37,7 +37,7 @@ public class BungeeCommandSender implements CommandSender { public BungeeCommandSender(net.md_5.bungee.api.CommandSender handle) { this.handle = handle; // Ensure even Java players' languages are loaded - LanguageUtils.loadGeyserLocale(getLocale()); + GeyserLocale.loadGeyserLocale(getLocale()); } @Override @@ -59,9 +59,9 @@ public class BungeeCommandSender implements CommandSender { public String getLocale() { if (handle instanceof ProxiedPlayer player) { String locale = player.getLocale().getLanguage() + "_" + player.getLocale().getCountry(); - return LanguageUtils.formatLocale(locale); + return GeyserLocale.formatLocale(locale); } - return LanguageUtils.getDefaultLocale(); + return GeyserLocale.getDefaultLocale(); } @Override diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index 7b1fe0fc2..f0a05687c 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -32,8 +32,8 @@ import net.md_5.bungee.api.plugin.TabExecutor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; import java.util.Collections; @@ -56,13 +56,13 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor GeyserCommand command = this.commandExecutor.getCommand(args[0]); if (command != null) { if (!sender.hasPermission(command.getPermission())) { - String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", commandSender.getLocale()); + String message = GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", commandSender.getLocale()); commandSender.sendMessage(ChatColor.RED + message); return; } if (command.isBedrockOnly() && session == null) { - String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale()); + String message = GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale()); commandSender.sendMessage(ChatColor.RED + message); return; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java index 0acf3a422..189ca2356 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotDumpInfo.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.spigot; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.dump.BootstrapDumpInfo; import java.util.ArrayList; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java index 40ed05a15..7f390f9d8 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java @@ -31,9 +31,9 @@ import io.netty.channel.*; import io.netty.channel.local.LocalAddress; import io.netty.util.concurrent.DefaultThreadFactory; import org.bukkit.Bukkit; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; -import org.geysermc.geyser.common.connection.GeyserInjector; -import org.geysermc.geyser.common.connection.LocalServerChannelWrapper; +import org.geysermc.geyser.GeyserBootstrap; +import org.geysermc.geyser.network.netty.GeyserInjector; +import org.geysermc.geyser.network.netty.LocalServerChannelWrapper; import java.lang.reflect.Field; import java.lang.reflect.Method; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java index 777bd7169..5d18e4f94 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotMain.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.platform.spigot; -import org.geysermc.geyser.common.main.IGeyserMain; +import org.geysermc.geyser.GeyserMain; -public class GeyserSpigotMain extends IGeyserMain { +public class GeyserSpigotMain extends GeyserMain { public static void main(String[] args) { new GeyserSpigotMain().displayMessage(); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java index ff2855fe1..a6ec9e329 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPingPassthrough.java @@ -30,7 +30,7 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.util.CachedServerIcon; -import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.network.MinecraftProtocol; import org.geysermc.geyser.ping.IGeyserPingPassthrough; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java index 490268893..0b89580bb 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java @@ -33,18 +33,18 @@ import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough; -import org.geysermc.geyser.utils.Constants; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.Constants; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandExecutor; import org.geysermc.geyser.platform.spigot.command.GeyserSpigotCommandManager; @@ -87,7 +87,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserSpigotConfiguration.class); } catch (IOException ex) { - getLogger().log(Level.WARNING, LanguageUtils.getLocaleStringLog("geyser.config.failed"), ex); + getLogger().log(Level.WARNING, GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); ex.printStackTrace(); } @@ -99,8 +99,8 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // And since there are alternative ways to get Geyser working for these aging platforms, it's not worth it. getLogger().severe("*********************************************"); getLogger().severe(""); - getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_server.header")); - getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.unsupported_server.message", "1.12.2")); + getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server.header")); + getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_server.message", "1.12.2")); getLogger().severe(""); getLogger().severe("*********************************************"); @@ -127,13 +127,13 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // Remove this in like a year if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION)); + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION)); this.getPluginLoader().disablePlugin(this); return; } if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && Bukkit.getPluginManager().getPlugin("floodgate") == null) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); this.getPluginLoader().disablePlugin(this); return; } else if (geyserConfig.isAutoconfiguredRemote() && Bukkit.getPluginManager().getPlugin("floodgate") != null) { @@ -163,7 +163,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { // Ensure that we have the latest 4.0.0 changes and not an older ViaVersion version Class.forName("com.viaversion.viaversion.api.ViaManager"); } catch (ClassNotFoundException e) { - geyserLogger.warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.viaversion.too_old", + geyserLogger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.viaversion.too_old", "https://ci.viaversion.com/job/ViaVersion/")); isViaVersion = false; if (this.geyserConfig.isDebugMode()) { diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java index 35867ad15..af92091e5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java @@ -32,8 +32,8 @@ import org.bukkit.command.TabExecutor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; import java.util.Collections; @@ -54,13 +54,13 @@ public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabE GeyserCommand geyserCommand = getCommand(args[0]); if (geyserCommand != null) { if (!sender.hasPermission(geyserCommand.getPermission())) { - String message = LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", commandSender.getLocale()); + String message = GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", commandSender.getLocale()); commandSender.sendMessage(ChatColor.RED + message); return true; } if (geyserCommand.isBedrockOnly() && session == null) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale())); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", commandSender.getLocale())); return true; } geyserCommand.execute(session, commandSender, args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java index a871d1c18..2aa301022 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java @@ -29,7 +29,7 @@ import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -50,7 +50,7 @@ public class SpigotCommandSender implements CommandSender { this.handle = handle; this.locale = getSpigotLocale(); // Ensure even Java players' languages are loaded - LanguageUtils.loadGeyserLocale(locale); + GeyserLocale.loadGeyserLocale(locale); } @Override @@ -114,6 +114,6 @@ public class SpigotCommandSender implements CommandSender { return player.getLocale(); } } - return LanguageUtils.getDefaultLocale(); + return GeyserLocale.getDefaultLocale(); } } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java index 751e21ad8..4d504bcf5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java @@ -41,11 +41,11 @@ import org.bukkit.event.block.BlockPistonEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.PistonCache; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntity; -import org.geysermc.geyser.utils.Direction; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.PistonCache; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; +import org.geysermc.geyser.level.physics.Direction; import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager; import java.util.List; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index 9fd0c5f73..2b740eead 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -48,9 +48,9 @@ import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.util.InventoryUtils; import java.util.*; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index 3b79666dc..b89e87878 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -33,8 +33,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java index 5a603d3c7..ea1fadd0e 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java @@ -30,8 +30,8 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockSto import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java index f80d06c55..f12968b1f 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java @@ -36,8 +36,8 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import java.util.List; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java index 733a0291d..1aacb73e7 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; /** * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)} diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java index 21988fa25..caeb257f7 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java @@ -33,7 +33,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin; import java.util.List; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java index fa356b561..b1032671a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 804cdb7d3..8972b0ac6 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -39,13 +39,13 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.Plugin; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.geyser.network.translators.world.GeyserWorldManager; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; +import org.geysermc.geyser.level.GeyserWorldManager; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.utils.BlockEntityUtils; -import org.geysermc.geyser.utils.GameRule; +import org.geysermc.geyser.util.BlockEntityUtils; +import org.geysermc.geyser.level.GameRule; import java.util.ArrayList; import java.util.List; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java index 999d1a635..c20b95cc1 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeMain.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.platform.sponge; -import org.geysermc.geyser.common.main.IGeyserMain; +import org.geysermc.geyser.GeyserMain; -public class GeyserSpongeMain extends IGeyserMain { +public class GeyserSpongeMain extends GeyserMain { public static void main(String[] args) { new GeyserSpongeMain().displayMessage(); diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java index c22972441..dcdeb53f5 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePingPassthrough.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.platform.sponge; -import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.network.MinecraftProtocol; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import org.spongepowered.api.MinecraftVersion; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java index b3e416823..33b71fb63 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.platform.sponge; import com.google.inject.Inject; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.sponge.command.GeyserSpongeCommandExecutor; import org.geysermc.geyser.platform.sponge.command.GeyserSpongeCommandManager; import org.slf4j.Logger; @@ -78,14 +78,14 @@ public class GeyserSpongePlugin implements GeyserBootstrap { try { configFile = FileUtils.fileOrCopiedFromResource(new File(configDir, "config.yml"), "config.yml", (file) -> file.replaceAll("generateduuid", UUID.randomUUID().toString())); } catch (IOException ex) { - logger.warn(LanguageUtils.getLocaleStringLog("geyser.config.failed")); + logger.warn(GeyserLocale.getLocaleStringLog("geyser.config.failed")); ex.printStackTrace(); } try { this.geyserConfig = FileUtils.loadConfig(configFile, GeyserSpongeConfiguration.class); } catch (IOException ex) { - logger.warn(LanguageUtils.getLocaleStringLog("geyser.config.failed")); + logger.warn(GeyserLocale.getLocaleStringLog("geyser.config.failed")); ex.printStackTrace(); return; } diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java index faab87c6b..5b8496680 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java @@ -29,9 +29,9 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; @@ -62,11 +62,11 @@ public class GeyserSpongeCommandExecutor extends CommandExecutor implements Comm if (command != null) { if (!source.hasPermission(command.getPermission())) { // Not ideal to use log here but we dont get a session - source.sendMessage(Text.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.permission_fail"))); + source.sendMessage(Text.of(ChatColor.RED + GeyserLocale.getLocaleStringLog("geyser.bootstrap.command.permission_fail"))); return CommandResult.success(); } if (command.isBedrockOnly() && session == null) { - source.sendMessage(Text.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only"))); + source.sendMessage(Text.of(ChatColor.RED + GeyserLocale.getLocaleStringLog("geyser.bootstrap.command.bedrock_only"))); return CommandResult.success(); } getCommand(args[0]).execute(session, commandSender, args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]); diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java index c4e3fcbc7..da215a399 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java @@ -40,15 +40,15 @@ import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.appender.ConsoleAppender; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager; import org.geysermc.geyser.platform.standalone.gui.GeyserStandaloneGUI; @@ -102,19 +102,19 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { case "--nogui", "nogui" -> useGuiOpts = false; case "--config", "-c" -> { if (i >= args.length - 1) { - System.err.println(MessageFormat.format(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.config_not_specified"), "-c")); + System.err.println(MessageFormat.format(GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.config_not_specified"), "-c")); return; } configFilenameOpt = args[i + 1]; i++; - System.out.println(MessageFormat.format(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.config_specified"), configFilenameOpt)); + System.out.println(MessageFormat.format(GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.config_specified"), configFilenameOpt)); } case "--help", "-h" -> { - System.out.println(MessageFormat.format(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.usage"), "[java -jar] Geyser.jar [opts]")); - System.out.println(" " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.options")); - System.out.println(" -c, --config [file] " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.config")); - System.out.println(" -h, --help " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.help")); - System.out.println(" --gui, --nogui " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.gui")); + System.out.println(MessageFormat.format(GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.usage"), "[java -jar] Geyser.jar [opts]")); + System.out.println(" " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.options")); + System.out.println(" -c, --config [file] " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.config")); + System.out.println(" -h, --help " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.help")); + System.out.println(" --gui, --nogui " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.gui")); return; } default -> { @@ -153,7 +153,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { } } } - System.err.println(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.unrecognised", arg)); + System.err.println(GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.unrecognised", arg)); return; } } @@ -198,7 +198,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { geyserConfig.getRemote().setAddress("127.0.0.1"); } } catch (IOException ex) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.config.failed"), ex); + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); if (gui == null) { System.exit(1); } else { @@ -345,7 +345,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { // Loop through the sub property if the first part matches for (BeanPropertyDefinition subProperty : getPOJOForClass(property.getRawPrimaryType())) { if (configKeyParts[1].equals(subProperty.getName())) { - geyserLogger.info(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.set_config_option", configKey.getKey(), configKey.getValue())); + geyserLogger.info(GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.set_config_option", configKey.getKey(), configKey.getValue())); // Set the sub property value on the config try { @@ -359,7 +359,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { } } } else { - geyserLogger.info(LanguageUtils.getLocaleStringLog("geyser.bootstrap.args.set_config_option", configKey.getKey(), configKey.getValue())); + geyserLogger.info(GeyserLocale.getLocaleStringLog("geyser.bootstrap.args.set_config_option", configKey.getKey(), configKey.getValue())); // Set the property value on the config try { diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java index 3ba144b06..6aec896d1 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java @@ -32,7 +32,7 @@ import org.apache.logging.log4j.core.config.Configurator; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; import org.geysermc.geyser.command.CommandSender; -import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.text.ChatColor; @Log4j2 public class GeyserStandaloneLogger extends SimpleTerminalConsole implements GeyserLogger, CommandSender { diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java index 0b6a96304..d2b4656f0 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/LoopbackUtil.java @@ -25,8 +25,8 @@ package org.geysermc.geyser.platform.standalone; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.text.GeyserLocale; import java.io.InputStream; import java.nio.file.Files; @@ -56,12 +56,12 @@ public class LoopbackUtil { Files.write(Paths.get(System.getenv("temp") + "/loopback_minecraft.bat"), loopbackCommand.getBytes()); Runtime.getRuntime().exec(startScript); - geyserLogger.info(ChatColor.AQUA + LanguageUtils.getLocaleStringLog("geyser.bootstrap.loopback.added")); + geyserLogger.info(ChatColor.AQUA + GeyserLocale.getLocaleStringLog("geyser.bootstrap.loopback.added")); } } catch (Exception e) { e.printStackTrace(); - geyserLogger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.loopback.failed")); + geyserLogger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.loopback.failed")); } } } diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java index 7f998619f..56d211986 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.platform.standalone.gui; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.standalone.GeyserStandaloneLogger; import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager; @@ -67,7 +67,7 @@ public class GeyserStandaloneGUI { public GeyserStandaloneGUI() { // Create the frame and setup basic settings - JFrame frame = new JFrame(LanguageUtils.getLocaleStringLog("geyser.gui.title")); + JFrame frame = new JFrame(GeyserLocale.getLocaleStringLog("geyser.gui.title")); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setSize(800, 400); frame.setMinimumSize(frame.getSize()); @@ -82,8 +82,8 @@ public class GeyserStandaloneGUI { @Override public void windowClosing(WindowEvent we) { - String[] buttons = {LanguageUtils.getLocaleStringLog("geyser.gui.exit.confirm"), LanguageUtils.getLocaleStringLog("geyser.gui.exit.deny")}; - int result = JOptionPane.showOptionDialog(frame, LanguageUtils.getLocaleStringLog("geyser.gui.exit.message"), frame.getTitle(), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, buttons, buttons[1]); + String[] buttons = {GeyserLocale.getLocaleStringLog("geyser.gui.exit.confirm"), GeyserLocale.getLocaleStringLog("geyser.gui.exit.deny")}; + int result = JOptionPane.showOptionDialog(frame, GeyserLocale.getLocaleStringLog("geyser.gui.exit.message"), frame.getTitle(), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, buttons, buttons[1]); if (result == JOptionPane.YES_OPTION) { System.exit(0); } @@ -124,12 +124,12 @@ public class GeyserStandaloneGUI { JMenuBar menuBar = new JMenuBar(); // Create 'File' - JMenu fileMenu = new JMenu(LanguageUtils.getLocaleStringLog("geyser.gui.menu.file")); + JMenu fileMenu = new JMenu(GeyserLocale.getLocaleStringLog("geyser.gui.menu.file")); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu); // 'Open Geyser folder' button - JMenuItem openButton = new JMenuItem(LanguageUtils.getLocaleStringLog("geyser.gui.menu.file.open_folder"), KeyEvent.VK_O); + JMenuItem openButton = new JMenuItem(GeyserLocale.getLocaleStringLog("geyser.gui.menu.file.open_folder"), KeyEvent.VK_O); openButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); openButton.addActionListener(e -> { try { @@ -141,40 +141,40 @@ public class GeyserStandaloneGUI { fileMenu.addSeparator(); // 'Exit' button - JMenuItem exitButton = new JMenuItem(LanguageUtils.getLocaleStringLog("geyser.gui.menu.file.exit"), KeyEvent.VK_X); + JMenuItem exitButton = new JMenuItem(GeyserLocale.getLocaleStringLog("geyser.gui.menu.file.exit"), KeyEvent.VK_X); exitButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK)); exitButton.addActionListener(e -> System.exit(0)); fileMenu.add(exitButton); // Create 'Commands' - commandsMenu = new JMenu(LanguageUtils.getLocaleStringLog("geyser.gui.menu.commands")); + commandsMenu = new JMenu(GeyserLocale.getLocaleStringLog("geyser.gui.menu.commands")); commandsMenu.setMnemonic(KeyEvent.VK_C); menuBar.add(commandsMenu); // Create 'View' - JMenu viewMenu = new JMenu(LanguageUtils.getLocaleStringLog("geyser.gui.menu.view")); + JMenu viewMenu = new JMenu(GeyserLocale.getLocaleStringLog("geyser.gui.menu.view")); viewMenu.setMnemonic(KeyEvent.VK_V); menuBar.add(viewMenu); // 'Zoom in' button - JMenuItem zoomInButton = new JMenuItem(LanguageUtils.getLocaleStringLog("geyser.gui.menu.view.zoom_in")); + JMenuItem zoomInButton = new JMenuItem(GeyserLocale.getLocaleStringLog("geyser.gui.menu.view.zoom_in")); zoomInButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_DOWN_MASK)); zoomInButton.addActionListener(e -> consolePane.setFont(new Font(consolePane.getFont().getName(), consolePane.getFont().getStyle(), consolePane.getFont().getSize() + 1))); viewMenu.add(zoomInButton); // 'Zoom in' button - JMenuItem zoomOutButton = new JMenuItem(LanguageUtils.getLocaleStringLog("geyser.gui.menu.view.zoom_out")); + JMenuItem zoomOutButton = new JMenuItem(GeyserLocale.getLocaleStringLog("geyser.gui.menu.view.zoom_out")); zoomOutButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK)); zoomOutButton.addActionListener(e -> consolePane.setFont(new Font(consolePane.getFont().getName(), consolePane.getFont().getStyle(), consolePane.getFont().getSize() - 1))); viewMenu.add(zoomOutButton); // 'Reset Zoom' button - JMenuItem resetZoomButton = new JMenuItem(LanguageUtils.getLocaleStringLog("geyser.gui.menu.view.reset_zoom")); + JMenuItem resetZoomButton = new JMenuItem(GeyserLocale.getLocaleStringLog("geyser.gui.menu.view.reset_zoom")); resetZoomButton.addActionListener(e -> consolePane.setFont(new Font(consolePane.getFont().getName(), consolePane.getFont().getStyle(), originalFontSize))); viewMenu.add(resetZoomButton); // create 'Options' - optionsMenu = new JMenu(LanguageUtils.getLocaleStringLog("geyser.gui.menu.options")); + optionsMenu = new JMenu(GeyserLocale.getLocaleStringLog("geyser.gui.menu.options")); viewMenu.setMnemonic(KeyEvent.VK_O); menuBar.add(optionsMenu); @@ -195,11 +195,11 @@ public class GeyserStandaloneGUI { ramValues.add(0); } ramGraph.setValues(ramValues); - ramGraph.setXLabel(LanguageUtils.getLocaleStringLog("geyser.gui.graph.loading")); + ramGraph.setXLabel(GeyserLocale.getLocaleStringLog("geyser.gui.graph.loading")); rightContentPane.add(ramGraph); - playerTableModel.addColumn(LanguageUtils.getLocaleStringLog("geyser.gui.table.ip")); - playerTableModel.addColumn(LanguageUtils.getLocaleStringLog("geyser.gui.table.username")); + playerTableModel.addColumn(GeyserLocale.getLocaleStringLog("geyser.gui.table.ip")); + playerTableModel.addColumn(GeyserLocale.getLocaleStringLog("geyser.gui.table.username")); JScrollPane playerScrollPane = new JScrollPane(playerTable); rightContentPane.add(playerScrollPane); @@ -289,7 +289,7 @@ public class GeyserStandaloneGUI { } // 'Debug Mode' toggle - JCheckBoxMenuItem debugMode = new JCheckBoxMenuItem(LanguageUtils.getLocaleStringLog("geyser.gui.menu.options.toggle_debug_mode")); + JCheckBoxMenuItem debugMode = new JCheckBoxMenuItem(GeyserLocale.getLocaleStringLog("geyser.gui.menu.options.toggle_debug_mode")); debugMode.setSelected(geyserStandaloneLogger.isDebug()); debugMode.addActionListener(e -> geyserStandaloneLogger.setDebug(!geyserStandaloneLogger.isDebug())); optionsMenu.add(debugMode); @@ -323,7 +323,7 @@ public class GeyserStandaloneGUI { final int freePercent = (int)(freeMemory * 100.0 / totalMemory + 0.5); ramValues.add(100 - freePercent); - ramGraph.setXLabel(LanguageUtils.getLocaleStringLog("geyser.gui.graph.usage", String.format("%,d", (totalMemory - freeMemory) / MEGABYTE), freePercent)); + ramGraph.setXLabel(GeyserLocale.getLocaleStringLog("geyser.gui.graph.usage", String.format("%,d", (totalMemory - freeMemory) / MEGABYTE), freePercent)); // Trim the list int k = ramValues.size(); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java index f587c3aa8..c2d6d12a0 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityDumpInfo.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.velocity; import com.velocitypowered.api.plugin.PluginContainer; import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; -import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.dump.BootstrapDumpInfo; import java.util.ArrayList; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java index 368c64e67..27cf9e815 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityInjector.java @@ -29,9 +29,9 @@ import com.velocitypowered.api.proxy.ProxyServer; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.local.LocalAddress; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; -import org.geysermc.geyser.common.connection.GeyserInjector; -import org.geysermc.geyser.common.connection.LocalServerChannelWrapper; +import org.geysermc.geyser.GeyserBootstrap; +import org.geysermc.geyser.network.netty.GeyserInjector; +import org.geysermc.geyser.network.netty.LocalServerChannelWrapper; import java.lang.reflect.Field; import java.util.function.Supplier; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java index e5f56226a..35408ce9c 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityMain.java @@ -25,9 +25,9 @@ package org.geysermc.geyser.platform.velocity; -import org.geysermc.geyser.common.main.IGeyserMain; +import org.geysermc.geyser.GeyserMain; -public class GeyserVelocityMain extends IGeyserMain { +public class GeyserVelocityMain extends GeyserMain { public static void main(String[] args) { new GeyserVelocityMain().displayMessage(); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java index 37d6e8ba2..a567233db 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPingPassthrough.java @@ -32,7 +32,7 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.server.ServerPing; import lombok.AllArgsConstructor; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; -import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import java.net.InetSocketAddress; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java index aa4261ad2..5666fff7f 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java @@ -37,16 +37,16 @@ import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; -import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.GeyserBootstrap; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor; import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandManager; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -91,7 +91,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserVelocityConfiguration.class); } catch (IOException ex) { - logger.warn(LanguageUtils.getLocaleStringLog("geyser.config.failed"), ex); + logger.warn(GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); ex.printStackTrace(); } @@ -118,15 +118,15 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { try { // Should only exist on 1.0 Class.forName("org.geysermc.floodgate.FloodgateAPI"); - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", "https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/")); return; } catch (ClassNotFoundException ignored) { } if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && proxyServer.getPluginManager().getPlugin("floodgate").isEmpty()) { - geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " - + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); + geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling")); return; } else if (geyserConfig.isAutoconfiguredRemote() && proxyServer.getPluginManager().getPlugin("floodgate").isPresent()) { // Floodgate installed means that the user wants Floodgate authentication diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java index b4a1e5963..1034d6062 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java @@ -30,9 +30,9 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; import java.util.Collections; @@ -53,11 +53,11 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si GeyserCommand command = getCommand(invocation.arguments()[0]); if (command != null) { if (!invocation.source().hasPermission(getCommand(invocation.arguments()[0]).getPermission())) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; } if (command.isBedrockOnly() && session == null) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale())); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale())); return; } command.execute(session, sender, invocation.arguments().length > 1 ? Arrays.copyOfRange(invocation.arguments(), 1, invocation.arguments().length) : new String[0]); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java index d45af5306..48edb71b1 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java @@ -30,7 +30,7 @@ import com.velocitypowered.api.proxy.ConsoleCommandSource; import com.velocitypowered.api.proxy.Player; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.geysermc.geyser.command.CommandSender; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Locale; @@ -41,7 +41,7 @@ public class VelocityCommandSender implements CommandSender { public VelocityCommandSender(CommandSource handle) { this.handle = handle; // Ensure even Java players' languages are loaded - LanguageUtils.loadGeyserLocale(getLocale()); + GeyserLocale.loadGeyserLocale(getLocale()); } @Override @@ -68,9 +68,9 @@ public class VelocityCommandSender implements CommandSender { public String getLocale() { if (handle instanceof Player) { Locale locale = ((Player) handle).getPlayerSettings().getLocale(); - return LanguageUtils.formatLocale(locale.getLanguage() + "_" + locale.getCountry()); + return GeyserLocale.formatLocale(locale.getLanguage() + "_" + locale.getCountry()); } - return LanguageUtils.getDefaultLocale(); + return GeyserLocale.getDefaultLocale(); } @Override diff --git a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index aca167482..07b7a3298 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -37,9 +37,9 @@ import org.geysermc.connector.network.session.auth.AuthData; */ @Deprecated public class GeyserSession { - private final org.geysermc.geyser.network.session.GeyserSession handle; + private final org.geysermc.geyser.session.GeyserSession handle; - public GeyserSession(org.geysermc.geyser.network.session.GeyserSession handle) { + public GeyserSession(org.geysermc.geyser.session.GeyserSession handle) { this.handle = handle; } diff --git a/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java index d1871d4c3..19e6131bc 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java +++ b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java @@ -34,9 +34,9 @@ import java.util.UUID; * @deprecated legacy code */ public class AuthData { - private final org.geysermc.geyser.network.session.auth.AuthData handle; + private final org.geysermc.geyser.session.auth.AuthData handle; - public AuthData(org.geysermc.geyser.network.session.auth.AuthData handle) { + public AuthData(org.geysermc.geyser.session.auth.AuthData handle) { this.handle = handle; } diff --git a/core/src/main/java/org/geysermc/geyser/utils/Constants.java b/core/src/main/java/org/geysermc/geyser/Constants.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/Constants.java rename to core/src/main/java/org/geysermc/geyser/Constants.java index fb918590d..23029d195 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/Constants.java +++ b/core/src/main/java/org/geysermc/geyser/Constants.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser; import java.net.URI; import java.net.URISyntaxException; diff --git a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java index de0797fc1..4bed3aaca 100644 --- a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java +++ b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java @@ -26,9 +26,9 @@ package org.geysermc.geyser; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.nio.file.Files; import java.nio.file.Path; @@ -44,10 +44,10 @@ public class FloodgateKeyLoader { if (floodgateDataFolder != null) { Path autoKey = floodgateDataFolder.resolve("key.pem"); if (Files.exists(autoKey)) { - logger.info(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded")); + logger.info(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded")); return autoKey; } else { - logger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.missing_key")); + logger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.missing_key")); } } @@ -60,7 +60,7 @@ public class FloodgateKeyLoader { } if (!Files.exists(floodgateKey)) { - logger.error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed")); + logger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed")); } return floodgateKey; diff --git a/core/src/main/java/org/geysermc/geyser/bootstrap/GeyserBootstrap.java b/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/bootstrap/GeyserBootstrap.java rename to core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java index 65c171453..1411c0175 100644 --- a/core/src/main/java/org/geysermc/geyser/bootstrap/GeyserBootstrap.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java @@ -23,16 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.bootstrap; +package org.geysermc.geyser; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.api.logger.GeyserLogger; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; -import org.geysermc.geyser.network.translators.world.GeyserWorldManager; -import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.level.GeyserWorldManager; +import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index 3efa35f1f..546602162 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -42,23 +42,25 @@ import lombok.Setter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.api.Geyser; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.metrics.Metrics; +import org.geysermc.geyser.pack.ResourcePack; +import org.geysermc.geyser.session.SessionManager; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; +import org.geysermc.geyser.util.Metrics; import org.geysermc.geyser.network.ConnectorServerEventHandler; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslatorRegistry; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.scoreboard.ScoreboardUpdater; import org.geysermc.geyser.skin.FloodgateSkinUploader; -import org.geysermc.geyser.utils.*; +import org.geysermc.geyser.util.*; import org.geysermc.floodgate.crypto.AesCipher; import org.geysermc.floodgate.crypto.AesKeyProducer; import org.geysermc.floodgate.crypto.Base64Topping; @@ -140,7 +142,7 @@ public class GeyserImpl extends Geyser { logger.info("******************************************"); logger.info(""); - logger.info(LanguageUtils.getLocaleStringLog("geyser.core.load", NAME, VERSION)); + logger.info(GeyserLocale.getLocaleStringLog("geyser.core.load", NAME, VERSION)); logger.info(""); logger.info("******************************************"); @@ -148,8 +150,6 @@ public class GeyserImpl extends Geyser { logger.setDebug(config.isDebugMode()); - PacketTranslatorRegistry.init(); - /* Initialize translators and registries */ BlockRegistries.init(); Registries.init(); @@ -157,7 +157,7 @@ public class GeyserImpl extends Geyser { EntityDefinitions.init(); ItemTranslator.init(); MessageTranslator.init(); - LocaleUtils.init(); + MinecraftLocale.init(); ScoreboardUpdater.init(); ResourcePack.loadPacks(); @@ -207,10 +207,10 @@ public class GeyserImpl extends Geyser { Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath()); cipher = new AesCipher(new Base64Topping()); cipher.init(key); - logger.info(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); + logger.info(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.loaded_key")); skinUploader = new FloodgateSkinUploader(this).start(); } catch (Exception exception) { - logger.severe(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception); + logger.severe(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception); } } this.timeSyncer = timeSyncer; @@ -272,9 +272,9 @@ public class GeyserImpl extends Geyser { if (shouldStartListener) { bedrockServer.bind().whenComplete((avoid, throwable) -> { if (throwable == null) { - logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); + logger.info(GeyserLocale.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); } else { - logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); + logger.severe(GeyserLocale.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); throwable.printStackTrace(); } }).join(); @@ -286,7 +286,7 @@ public class GeyserImpl extends Geyser { // Prevent unwanted words best we can metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().getAuthType().toString().toLowerCase())); metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName)); - metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", LanguageUtils::getDefaultLocale)); + metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", GeyserLocale::getDefaultLocale)); metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION)); metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> { Map valueMap = new HashMap<>(); @@ -380,29 +380,29 @@ public class GeyserImpl extends Geyser { } double completeTime = (System.currentTimeMillis() - startupTime) / 1000D; - String message = LanguageUtils.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " "; + String message = GeyserLocale.getLocaleStringLog("geyser.core.finish.done", new DecimalFormat("#.###").format(completeTime)) + " "; if (isGui) { - message += LanguageUtils.getLocaleStringLog("geyser.core.finish.gui"); + message += GeyserLocale.getLocaleStringLog("geyser.core.finish.gui"); } else { - message += LanguageUtils.getLocaleStringLog("geyser.core.finish.console"); + message += GeyserLocale.getLocaleStringLog("geyser.core.finish.console"); } logger.info(message); if (platformType == PlatformType.STANDALONE) { - logger.warning(LanguageUtils.getLocaleStringLog("geyser.core.movement_warn")); + logger.warning(GeyserLocale.getLocaleStringLog("geyser.core.movement_warn")); } newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); } public void shutdown() { - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown")); + bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown")); shuttingDown = true; if (sessionManager.size() >= 1) { - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size())); + bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.kick.log", sessionManager.size())); sessionManager.disconnectAll("geyser.core.shutdown.kick.message"); - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.done")); + bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.kick.done")); } scheduledThread.shutdown(); @@ -416,7 +416,7 @@ public class GeyserImpl extends Geyser { newsHandler.shutdown(); this.getCommandManager().getCommands().clear(); - bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.done")); + bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.done")); } /** @@ -442,12 +442,7 @@ public class GeyserImpl extends Geyser { */ @SuppressWarnings("unused") // API usage public GeyserSession getPlayerByXuid(String xuid) { - for (GeyserSession session : sessionManager.getPendingSessions()) { - if (session.getAuthData().getXuid().equals(xuid)) { - return session; - } - } - for (GeyserSession session : sessionManager.getSessions().values()) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session.getAuthData().getXuid().equals(xuid)) { return session; } diff --git a/core/src/main/java/org/geysermc/geyser/common/main/IGeyserMain.java b/core/src/main/java/org/geysermc/geyser/GeyserMain.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/common/main/IGeyserMain.java rename to core/src/main/java/org/geysermc/geyser/GeyserMain.java index bb70012cc..9ddbbbe86 100644 --- a/core/src/main/java/org/geysermc/geyser/common/main/IGeyserMain.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserMain.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.main; +package org.geysermc.geyser; import javax.swing.*; import java.io.InputStream; @@ -31,7 +31,7 @@ import java.lang.reflect.Method; import java.util.Locale; import java.util.Scanner; -public class IGeyserMain { +public class GeyserMain { /** * Displays the run help message in the console and a message box if running with a gui @@ -54,10 +54,10 @@ public class IGeyserMain { private String createMessage() { StringBuilder message = new StringBuilder(); - InputStream helpStream = IGeyserMain.class.getClassLoader().getResourceAsStream("languages/run-help/" + Locale.getDefault().toString() + ".txt"); + InputStream helpStream = GeyserMain.class.getClassLoader().getResourceAsStream("languages/run-help/" + Locale.getDefault().toString() + ".txt"); if (helpStream == null) { - helpStream = IGeyserMain.class.getClassLoader().getResourceAsStream("languages/run-help/en_US.txt"); + helpStream = GeyserMain.class.getClassLoader().getResourceAsStream("languages/run-help/en_US.txt"); } Scanner help = new Scanner(helpStream).useDelimiter("\\Z"); diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java index 43bf22478..8e970d6a0 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.command; import lombok.AllArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nullable; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java index 7af5f93fd..19b521ed6 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java @@ -30,8 +30,8 @@ import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.defaults.*; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.*; @@ -61,7 +61,7 @@ public abstract class CommandManager { public void registerCommand(GeyserCommand command) { commands.put(command.getName(), command); - geyser.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.commands.registered", command.getName())); + geyser.getLogger().debug(GeyserLocale.getLocaleStringLog("geyser.commands.registered", command.getName())); if (command.getAliases().isEmpty()) return; @@ -89,7 +89,7 @@ public abstract class CommandManager { GeyserCommand cmd = commands.get(label); if (cmd == null) { - geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.invalid")); + geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.commands.invalid")); return; } @@ -99,7 +99,7 @@ public abstract class CommandManager { if (!cmd.isBedrockOnly()) { cmd.execute(null, sender, args); } else { - geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.bedrock_only")); + geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.command.bedrock_only")); } } } diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandSender.java b/core/src/main/java/org/geysermc/geyser/command/CommandSender.java index fc9a0be24..47881868f 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandSender.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandSender.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.command; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; /** * Implemented on top of any class that can send a command. @@ -49,12 +49,12 @@ public interface CommandSender { boolean isConsole(); /** - * Returns the locale of the command sender. Defaults to the default locale at {@link LanguageUtils#getDefaultLocale()}. + * Returns the locale of the command sender. Defaults to the default locale at {@link GeyserLocale#getDefaultLocale()}. * * @return the locale of the command sender. */ default String getLocale() { - return LanguageUtils.getDefaultLocale(); + return GeyserLocale.getDefaultLocale(); } /** diff --git a/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java index af462192f..6971ad44d 100644 --- a/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nullable; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java index 11dd28199..41bb8e6cd 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public class AdvancementsCommand extends GeyserCommand { public AdvancementsCommand(String name, String description, String permission) { diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java index 0926b97c3..64ad6e216 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java @@ -33,12 +33,12 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.dump.DumpInfo; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; -import org.geysermc.geyser.utils.WebUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.util.WebUtils; import java.io.FileOutputStream; import java.io.IOException; @@ -61,7 +61,7 @@ public class DumpCommand extends GeyserCommand { public void execute(GeyserSession session, CommandSender sender, String[] args) { // Only allow the console to create dumps on Geyser Standalone if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; } @@ -80,7 +80,7 @@ public class DumpCommand extends GeyserCommand { AsteriskSerializer.showSensitive = showSensitive; - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collecting", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.dump.collecting", sender.getLocale())); String dumpData; try { if (offlineDump) { @@ -92,29 +92,29 @@ public class DumpCommand extends GeyserCommand { dumpData = MAPPER.writeValueAsString(new DumpInfo(addLog)); } } catch (IOException e) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collect_error", sender.getLocale())); - geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.collect_error_short"), e); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.commands.dump.collect_error", sender.getLocale())); + geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.commands.dump.collect_error_short"), e); return; } String uploadedDumpUrl = ""; if (offlineDump) { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.writing", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.dump.writing", sender.getLocale())); try { FileOutputStream outputStream = new FileOutputStream(GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("dump.json").toFile()); outputStream.write(dumpData.getBytes()); outputStream.close(); } catch (IOException e) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.write_error", sender.getLocale())); - geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.write_error_short"), e); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.commands.dump.write_error", sender.getLocale())); + geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.commands.dump.write_error_short"), e); return; } uploadedDumpUrl = "dump.json"; } else { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.uploading", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.dump.uploading", sender.getLocale())); String response; JsonNode responseNode; @@ -122,22 +122,22 @@ public class DumpCommand extends GeyserCommand { response = WebUtils.post(DUMP_URL + "documents", dumpData); responseNode = MAPPER.readTree(response); } catch (IOException e) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.upload_error", sender.getLocale())); - geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.dump.upload_error_short"), e); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.commands.dump.upload_error", sender.getLocale())); + geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.commands.dump.upload_error_short"), e); return; } if (!responseNode.has("key")) { - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.dump.upload_error_short", sender.getLocale()) + ": " + (responseNode.has("message") ? responseNode.get("message").asText() : response)); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.commands.dump.upload_error_short", sender.getLocale()) + ": " + (responseNode.has("message") ? responseNode.get("message").asText() : response)); return; } uploadedDumpUrl = DUMP_URL + responseNode.get("key").asText(); } - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl); if (!sender.isConsole()) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl)); } } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index 00e18cf0a..4d4a21319 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -28,9 +28,9 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; import java.util.Map; @@ -56,7 +56,7 @@ public class HelpCommand extends GeyserCommand { public void execute(GeyserSession session, CommandSender sender, String[] args) { int page = 1; int maxPage = 1; - String header = LanguageUtils.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); + String header = GeyserLocale.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); sender.sendMessage(header); Map cmds = geyser.getCommandManager().getCommands(); @@ -70,7 +70,7 @@ public class HelpCommand extends GeyserCommand { } sender.sendMessage(ChatColor.YELLOW + "/geyser " + cmdName + ChatColor.WHITE + ": " + - LanguageUtils.getPlayerLocaleString(cmd.getDescription(), sender.getLocale())); + GeyserLocale.getPlayerLocaleString(cmd.getDescription(), sender.getLocale())); } } } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java index 4f4b610d1..1da6b79c2 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.stream.Collectors; @@ -45,7 +45,7 @@ public class ListCommand extends GeyserCommand { @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { - String message = LanguageUtils.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), + String message = GeyserLocale.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), geyser.getSessionManager().size(), geyser.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java index c9a5b818e..934cd8c87 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java @@ -31,8 +31,8 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.BlockUtils; public class OffhandCommand extends GeyserCommand { diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java index d8ceda637..1a72e1734 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java @@ -29,8 +29,8 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; public class ReloadCommand extends GeyserCommand { @@ -47,7 +47,7 @@ public class ReloadCommand extends GeyserCommand { return; } - String message = LanguageUtils.getPlayerLocaleString("geyser.commands.reload.message", sender.getLocale()); + String message = GeyserLocale.getPlayerLocaleString("geyser.commands.reload.message", sender.getLocale()); sender.sendMessage(message); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java index ec561b6ff..349f7288b 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.SettingsUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.SettingsUtils; public class SettingsCommand extends GeyserCommand { public SettingsCommand(GeyserImpl geyser, String name, String description, String permission) { diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java index c925c73b0..c570770b7 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCl import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public class StatisticsCommand extends GeyserCommand { diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java index 23d9a88d7..6b74f9c8b 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java @@ -29,8 +29,8 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -48,7 +48,7 @@ public class StopCommand extends GeyserCommand { @Override public void execute(GeyserSession session, CommandSender sender, String[] args) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index e3530071d..ff80abba3 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -30,12 +30,12 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; -import org.geysermc.geyser.utils.WebUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.util.WebUtils; import java.io.IOException; import java.net.URLEncoder; @@ -63,12 +63,12 @@ public class VersionCommand extends GeyserCommand { bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion(); } - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone if (GeyserImpl.getInstance().isProductionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale())); try { Properties gitProp = new Properties(); gitProp.load(FileUtils.getResource("git.properties")); @@ -79,17 +79,17 @@ public class VersionCommand extends GeyserCommand { int latestBuildNum = Integer.parseInt(buildXML.replaceAll("<(\\\\)?(/)?buildNumber>", "").trim()); int buildNum = Integer.parseInt(gitProp.getProperty("git.build.number")); if (latestBuildNum == buildNum) { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.no_updates", sender.getLocale())); + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.no_updates", sender.getLocale())); } else { - sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.outdated", + sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.outdated", sender.getLocale(), (latestBuildNum - buildNum), "https://ci.geysermc.org/")); } } else { throw new AssertionError("buildNumber missing"); } } catch (IOException | AssertionError | NumberFormatException e) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.commands.version.failed"), e); - sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.commands.version.failed", sender.getLocale())); + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.commands.version.failed"), e); + sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.commands.version.failed", sender.getLocale())); } } } diff --git a/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java index b9e735c94..eb6b68f78 100644 --- a/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java @@ -27,10 +27,9 @@ package org.geysermc.geyser.configuration; import com.fasterxml.jackson.annotation.JsonIgnore; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.network.CIDRMatcher; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.nio.file.Path; import java.util.List; @@ -174,9 +173,9 @@ public interface GeyserConfiguration { static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) { if (geyserConfig.getConfigVersion() < CURRENT_CONFIG_VERSION) { - geyserLogger.warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.config.outdated")); + geyserLogger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.config.outdated")); } else if (geyserConfig.getConfigVersion() > CURRENT_CONFIG_VERSION) { - geyserLogger.warning(LanguageUtils.getLocaleStringLog("geyser.bootstrap.config.too_new")); + geyserLogger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.config.too_new")); } } } diff --git a/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java index 9c5fc229f..e3c937aae 100644 --- a/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserJacksonConfiguration.java @@ -35,10 +35,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.network.CIDRMatcher; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.io.IOException; import java.nio.file.Path; @@ -257,7 +257,7 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration try { return Integer.parseInt(value); } catch (NumberFormatException e) { - System.err.println(LanguageUtils.getLocaleStringLog("geyser.bootstrap.config.invalid_port")); + System.err.println(GeyserLocale.getLocaleStringLog("geyser.bootstrap.config.invalid_port")); return 25565; } } diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index a6cc971ea..5a77b84fb 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -36,13 +36,12 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import lombok.AllArgsConstructor; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.common.serializer.AsteriskSerializer; +import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.DockerCheck; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.WebUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.util.WebUtils; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.FloodgateInfoHolder; @@ -53,6 +52,7 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; +import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -177,7 +177,24 @@ public class DumpInfo { this.internalIP = "***"; } - this.dockerCheck = DockerCheck.checkBasic(); + this.dockerCheck = checkDockerBasic(); + } + + // By default, Geyser now sets the IP to the local IP in all cases on plugin versions so we don't notify the user of anything + // However we still have this check for the potential future bug + private boolean checkDockerBasic() { + try { + String OS = System.getProperty("os.name").toLowerCase(); + if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0) { + String output = new String(java.nio.file.Files.readAllBytes(Paths.get("/proc/1/cgroup"))); + + if (output.contains("docker")) { + return true; + } + } + } catch (Exception ignored) { } // Ignore any errors, inc ip failed to fetch, process could not run or access denied + + return false; } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java index 31190d892..1149a67fd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java @@ -34,7 +34,9 @@ import lombok.experimental.Accessors; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.factory.BaseEntityFactory; import org.geysermc.geyser.entity.factory.EntityFactory; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.translator.entity.EntityMetadataTranslator; import java.util.List; import java.util.Locale; @@ -78,7 +80,7 @@ public record EntityDefinition(EntityFactory factory, Entit return; } - translator.translateFunction().accept(entity, metadata); + translator.translate(entity, metadata); } @Setter diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index fb21e68ff..c8f413e63 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -34,22 +34,23 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.factory.BaseEntityFactory; import org.geysermc.geyser.entity.factory.ExperienceOrbEntityFactory; import org.geysermc.geyser.entity.factory.PaintingEntityFactory; -import org.geysermc.geyser.entity.living.*; -import org.geysermc.geyser.entity.living.animal.*; -import org.geysermc.geyser.entity.living.animal.horse.*; -import org.geysermc.geyser.entity.living.animal.tameable.CatEntity; -import org.geysermc.geyser.entity.living.animal.tameable.ParrotEntity; -import org.geysermc.geyser.entity.living.animal.tameable.TameableEntity; -import org.geysermc.geyser.entity.living.animal.tameable.WolfEntity; -import org.geysermc.geyser.entity.living.merchant.AbstractMerchantEntity; -import org.geysermc.geyser.entity.living.merchant.VillagerEntity; -import org.geysermc.geyser.entity.living.monster.*; -import org.geysermc.geyser.entity.living.monster.raid.PillagerEntity; -import org.geysermc.geyser.entity.living.monster.raid.RaidParticipantEntity; -import org.geysermc.geyser.entity.living.monster.raid.SpellcasterIllagerEntity; -import org.geysermc.geyser.entity.living.monster.raid.VindicatorEntity; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.entity.type.*; +import org.geysermc.geyser.entity.type.living.*; +import org.geysermc.geyser.entity.type.living.animal.*; +import org.geysermc.geyser.entity.type.living.animal.horse.*; +import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.ParrotEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.TameableEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity; +import org.geysermc.geyser.entity.type.living.merchant.AbstractMerchantEntity; +import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; +import org.geysermc.geyser.entity.type.living.monster.*; +import org.geysermc.geyser.entity.type.living.monster.raid.PillagerEntity; +import org.geysermc.geyser.entity.type.living.monster.raid.RaidParticipantEntity; +import org.geysermc.geyser.entity.type.living.monster.raid.SpellcasterIllagerEntity; +import org.geysermc.geyser.entity.type.living.monster.raid.VindicatorEntity; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.registry.Registries; public final class EntityDefinitions { diff --git a/core/src/main/java/org/geysermc/geyser/utils/InteractiveTagManager.java b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/utils/InteractiveTagManager.java rename to core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java index 026564939..b51f83f2c 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/InteractiveTagManager.java +++ b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.entity; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.MobEntity; -import org.geysermc.geyser.entity.living.animal.AnimalEntity; -import org.geysermc.geyser.entity.living.animal.horse.HorseEntity; -import org.geysermc.geyser.entity.living.animal.tameable.CatEntity; -import org.geysermc.geyser.entity.living.animal.tameable.WolfEntity; -import org.geysermc.geyser.entity.living.merchant.VillagerEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.MobEntity; +import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; +import org.geysermc.geyser.entity.type.living.animal.horse.HorseEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity; +import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.EnumSet; diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java index 651064c42..dff1617f9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java index 38d27607e..774166d44 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.entity.factory; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; public interface EntityFactory { } diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java index 74a4c530b..40a93c08b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java @@ -26,8 +26,8 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.ExpOrbEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.ExpOrbEntity; +import org.geysermc.geyser.session.GeyserSession; @FunctionalInterface public interface ExperienceOrbEntityFactory extends EntityFactory { diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java index 425defe61..2990b0ac5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java @@ -26,9 +26,9 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.PaintingEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.PaintingType; +import org.geysermc.geyser.entity.type.PaintingEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.PaintingType; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/AbstractArrowEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java index 912d4b8a1..b80db2570 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/AbstractArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/entity/AreaEffectCloudEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java index b200d8f48..6063c81f9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/AreaEffectCloudEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; @@ -31,8 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.level.particle.Particle; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.EffectUtils; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.registry.Registries; import java.util.UUID; @@ -64,7 +65,7 @@ public class AreaEffectCloudEntity extends Entity { public void setParticle(EntityMetadata entityMetadata) { Particle particle = entityMetadata.getValue(); - int particleId = EffectUtils.getParticleId(session, particle.getType()); + int particleId = Registries.PARTICLES.map(particle.getType(), mapping -> mapping.getParticleId(this.session)).orElse(-1); if (particleId != -1) { dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/BoatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java index 24d3b5bb2..ac1b3fcbd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -32,7 +32,9 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/geyser/entity/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/CommandBlockMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java index e65952c02..1764c721e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/CommandBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java @@ -23,11 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/DefaultBlockMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java index 50851eac6..ec00c30be 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/DefaultBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/EnderCrystalEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java index 203f42033..aa907b7c6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EnderCrystalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; @@ -31,7 +31,8 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/entity/Entity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index 703ca212f..3b01c428f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; @@ -43,9 +43,11 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserDirtyMetadata; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.util.MathUtils; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ExpOrbEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/ExpOrbEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java index 830d5e368..25135d0b5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ExpOrbEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java @@ -23,11 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.session.GeyserSession; public class ExpOrbEntity extends Entity { diff --git a/core/src/main/java/org/geysermc/geyser/entity/FallingBlockEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/FallingBlockEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java index 25d19c876..346861f96 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/FireworkEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/FireworkEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java index f1bcb9a40..075178b55 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/FireworkEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -36,10 +36,11 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.FireworkColor; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.FireworkColor; +import org.geysermc.geyser.util.MathUtils; import org.geysermc.floodgate.util.DeviceOs; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/entity/FishingHookEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/FishingHookEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java index b5dde3c6e..b5774bd78 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/FishingHookEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -31,14 +31,15 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import lombok.Getter; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.translator.collision.BlockCollision; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.utils.BlockPositionIterator; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.level.block.BlockPositionIterator; +import org.geysermc.geyser.util.BlockUtils; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; diff --git a/core/src/main/java/org/geysermc/geyser/entity/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/FurnaceMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java index f4eac3457..ab34cb751 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/FurnaceMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/ItemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java index bacbce098..dd98f9aba 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -34,9 +34,10 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ItemFrameEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/ItemFrameEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java index e4026570e..b8688abc4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ItemFrameEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -39,8 +39,9 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ItemedFireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/ItemedFireballEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java index 8775c3282..49548ec2a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ItemedFireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java @@ -23,10 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/LeashKnotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/LeashKnotEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java index 1634552b8..63e964a55 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/LeashKnotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java @@ -23,10 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/LightningEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/LightningEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java index 6de3c3eb3..1f5af0492 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/LightningEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java @@ -23,11 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; diff --git a/core/src/main/java/org/geysermc/geyser/entity/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/entity/LivingEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index 16d5c316c..678741424 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; @@ -45,11 +45,12 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; +import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.AttributeUtils; -import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.util.AttributeUtils; +import org.geysermc.geyser.util.ChunkUtils; import java.util.ArrayList; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/entity/MinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/MinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java index 66f2f3d67..ffb5e4018 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/MinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/PaintingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/PaintingEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java index d5886f445..e97bb7090 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/PaintingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java @@ -23,12 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.PaintingType; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.PaintingType; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/entity/SpawnerMinecartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java index 4ee6c8bbc..2cd4cf3f6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/SpawnerMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java @@ -23,12 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/TNTEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/TNTEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java index e4e67ff83..e7edd32d5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/TNTEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/ThrowableEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java index f68f4c760..67aa09794 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; @@ -31,8 +31,9 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/ThrowableItemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java index e54d337b6..7abffd0bf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java @@ -23,11 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/ThrownPotionEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java index 497e85914..c4cd5d54a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; @@ -33,8 +33,9 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.item.Potion; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.EnumSet; diff --git a/core/src/main/java/org/geysermc/geyser/entity/Tickable.java b/core/src/main/java/org/geysermc/geyser/entity/type/Tickable.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/Tickable.java rename to core/src/main/java/org/geysermc/geyser/entity/type/Tickable.java index 1634ea87d..696f9008f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/Tickable.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Tickable.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; /** * Implemented onto anything that should have code ran every Minecraft tick - 50 milliseconds. diff --git a/core/src/main/java/org/geysermc/geyser/entity/TippedArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/TippedArrowEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java index 330de942b..a60c0ab33 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/TippedArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java @@ -23,13 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.item.TippedArrowPotion; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.item.TippedArrowPotion; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/TridentEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/entity/TridentEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java index e6dc2f252..65591fb50 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/TridentEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java @@ -23,10 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/WitherSkullEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java index c314159b7..fbed041fe 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java @@ -23,11 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/AbstractFishEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java index c92ccbb9f..8fedce1e7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/AbstractFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/AgeableEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java index 9ce8a080c..b250f3e8e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/AmbientEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/AmbientEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java index 89f2e7e16..693a0cd46 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/AmbientEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/entity/living/ArmorStandEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java index 99e570aa8..fb459bf54 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Rotation; @@ -37,8 +37,8 @@ import lombok.Getter; import net.kyori.adventure.text.Component; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.LivingEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.LivingEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/BatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/BatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java index 1fe7e758e..0a72a431e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/BatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/CreatureEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/CreatureEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java index e42795371..b5e7557da 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/CreatureEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/FlyingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/FlyingEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java index 508ab98bc..91f839bc3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/FlyingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/GlowSquidEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java index ca6a1c7b2..b5950b7bc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/GlowSquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/GolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/GolemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java index 5b0a99efc..eb94e1406 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/GolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/IronGolemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java index 69bfafa9a..f86392ed3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/IronGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/MagmaCubeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java index c926eff70..03cf9f3dc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/MagmaCubeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/MobEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/MobEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java index bf7aae272..e82b813d7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/MobEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -31,8 +31,8 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.LivingEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.LivingEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/SlimeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/SlimeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java index 17c1471d4..100ed764d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/SlimeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/SnowGolemEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java index 6bc74de65..1d8375529 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/SnowGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/SquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/SquidEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java index 0802b30ed..b0e2fcb9e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/SquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.Tickable; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.type.Tickable; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/WaterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/WaterEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java index 1ace4fe22..acacd1f52 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/WaterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living; +package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/AnimalEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java index b61dbf0d4..c7c15b288 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/AnimalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.AgeableEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.AgeableEntity; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/AxolotlEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java index 568d7a03a..4dfa5fa8d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/AxolotlEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/BeeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java index 406213a7c..7f9ec4255 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/BeeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/ChickenEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java index a28be7611..506714dbc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/ChickenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/FoxEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java index e550a955d..127a70a0f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/FoxEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/GoatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java index 11a46315a..708a95134 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/GoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/HoglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java index 06c408486..ed0feed97 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/HoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.util.DimensionUtils; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/MooshroomEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java index cbad36252..15473c8ac 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/MooshroomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/OcelotEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java index f473f1d15..5244e3538 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/OcelotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/PandaEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java index c41ffb3cf..7548ccef1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PandaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/PigEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java index 03553b08c..0be4c78f1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PigEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/PolarBearEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java index 9ff1b1918..727804dbc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PolarBearEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/PufferFishEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java index 5916c8b62..66853babf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/PufferFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.AbstractFishEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.AbstractFishEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/RabbitEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java index 9228542f4..a1d80ac72 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/RabbitEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/SheepEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java index 9a8f8db9b..757c5b574 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/SheepEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java @@ -23,15 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/StriderEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java index d18d7acc1..d684fba06 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/StriderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/TropicalFishEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java index 98555425f..b883c91a9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/TropicalFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.google.common.collect.ImmutableList; @@ -31,8 +31,8 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.AbstractFishEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.AbstractFishEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.List; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/TurtleEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java index 06ef8a0ab..e892d7d5e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/TurtleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal; +package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/AbstractHorseEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java index 92f6f9687..7d0a3cf9a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/AbstractHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.horse; +package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.google.common.collect.ImmutableSet; @@ -36,8 +36,8 @@ import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.entity.living.animal.AnimalEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/ChestedHorseEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java index cf524cb38..ccf30dbc8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/ChestedHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.horse; +package org.geysermc.geyser.entity.type.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/HorseEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java index 25c323163..31b5b7890 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/HorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.horse; +package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/LlamaEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java index 5934215b6..c18778c81 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/LlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.horse; +package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/TraderLlamaEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java index 1faed9e49..770d30a05 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/horse/TraderLlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.horse; +package org.geysermc.geyser.entity.type.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/CatEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java index a2604e931..5538621d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/CatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.tameable; +package org.geysermc.geyser.entity.type.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/ParrotEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java index b902ee1af..05f0a6ad5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/ParrotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.tameable; +package org.geysermc.geyser.entity.type.living.animal.tameable; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/TameableEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java index e08bdef9e..d12839e92 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/TameableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.tameable; +package org.geysermc.geyser.entity.type.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; @@ -31,10 +31,10 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.animal.AnimalEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/WolfEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java index 7a89b1153..13bb8e17d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.animal.tameable; +package org.geysermc.geyser.entity.type.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/entity/living/merchant/AbstractMerchantEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java index 70bed1ec2..7981c9b23 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/merchant/AbstractMerchantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.merchant; +package org.geysermc.geyser.entity.type.living.merchant; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.AgeableEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.AgeableEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/entity/living/merchant/VillagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java index 95a796e04..012fb05f2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/merchant/VillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.merchant; +package org.geysermc.geyser.entity.type.living.merchant; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; @@ -37,7 +37,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.BlockRegistries; import java.util.Optional; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/AbstractSkeletonEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java index 993867ca9..ae13cfeae 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/AbstractSkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/BasePiglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java index 664948bcd..2f315368f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/BasePiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.DimensionUtils; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/BlazeEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java index 963cfb508..2303f8091 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/BlazeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/CreeperEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java index 760cfb58e..f1e0b6a65 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/ElderGuardianEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java index f2cb030ed..9c237f117 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ElderGuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java index 379a166e9..f49b51e6c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -34,10 +34,10 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; import lombok.Data; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.Tickable; -import org.geysermc.geyser.entity.living.MobEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.entity.type.Tickable; +import org.geysermc.geyser.entity.type.living.MobEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.DimensionUtils; import java.util.Random; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonPartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonPartEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java index 088b7d721..7cd4bb6cf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/EnderDragonPartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public class EnderDragonPartEntity extends Entity { diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/EndermanEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java index b007c1ced..469f48521 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/EndermanEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/GhastEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java index ccb320311..845a281d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/GhastEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.FlyingEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.FlyingEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/GiantEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java index 7f99d4de0..6dd27cc39 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/GiantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/GuardianEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java index cbfeab8f2..0190f3c60 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/GuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/MonsterEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java index e4b811b20..fad45f982 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/MonsterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.CreatureEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.CreatureEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/PhantomEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java index ba1975aed..68f3e7d23 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.FlyingEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.FlyingEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/PiglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java index 1d1aa5652..b98d6eabc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/PiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/ShulkerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java index 047b272c2..e60f81d2f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ShulkerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; @@ -32,8 +32,8 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.GolemEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.GolemEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/SkeletonEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java index ce1ecb8be..b1f6939aa 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/SkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/SpiderEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java index 9a51057d4..4f7b02d73 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/SpiderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/VexEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java index ddd31c655..938b18022 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/VexEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/WitherEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java index ea889d573..17da0a611 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/WitherEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/ZoglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java index cc5e21898..f0fe101da 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java index b52c888da..9e3301b48 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieVillagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java index 38472e03c..54a5c4506 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombieVillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; @@ -32,8 +32,8 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.merchant.VillagerEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombifiedPiglinEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java index 8b25467f7..2604ce12e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/ZombifiedPiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster; +package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/AbstractIllagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java index 514ee276a..15ac1a0d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/AbstractIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster.raid; +package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/PillagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java index 6b4f97151..477d9fef7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/PillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster.raid; +package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/RaidParticipantEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java index 4e2fb2597..bd0f3ac5d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/RaidParticipantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster.raid; +package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.living.monster.MonsterEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.living.monster.MonsterEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/SpellcasterIllagerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java index 56099085f..7c2a05de1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/SpellcasterIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster.raid; +package org.geysermc.geyser.entity.type.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/VindicatorEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java index 49028dc23..a3b85dc73 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/living/monster/raid/VindicatorEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.living.monster.raid; +package org.geysermc.geyser.entity.type.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; diff --git a/core/src/main/java/org/geysermc/geyser/entity/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/entity/player/PlayerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 93b033118..8737ef847 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.player; +package org.geysermc.geyser.entity.type.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; @@ -47,13 +47,13 @@ import com.nukkitx.protocol.bedrock.packet.*; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.LivingEntity; -import org.geysermc.geyser.entity.living.animal.tameable.ParrotEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.entity.type.LivingEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.ParrotEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Score; import org.geysermc.geyser.scoreboard.Team; diff --git a/core/src/main/java/org/geysermc/geyser/entity/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/entity/player/SessionPlayerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index ea0ec9cd3..c297bdb18 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.player; +package org.geysermc.geyser.entity.type.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; @@ -39,8 +39,8 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.AttributeUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.AttributeUtils; import java.util.Collections; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/entity/player/SkullPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/entity/player/SkullPlayerEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java index d6054d528..0afb3e8b5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/player/SkullPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity.player; +package org.geysermc.geyser.entity.type.player; import com.github.steveice10.mc.auth.data.GameProfile; import com.nukkitx.math.vector.Vector3f; @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; /** * A wrapper to handle skulls more effectively - skulls have to be treated as entities since there are no diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/BedrockContainerSlot.java b/core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/BedrockContainerSlot.java rename to core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java index 07ca32d61..0179bb277 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/BedrockContainerSlot.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/BedrockContainerSlot.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory; +package org.geysermc.geyser.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import lombok.Value; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Container.java index 48241a0e5..464d683fa 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Container.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; /** * Combination of {@link Inventory} and {@link PlayerInventory} diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java index 06cb88935..fc226f621 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java @@ -27,13 +27,14 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.Generic3X3InventoryTranslator; public class Generic3X3Container extends Container { /** * Whether we need to set the container type as {@link com.nukkitx.protocol.bedrock.data.inventory.ContainerType#DROPPER}. * - * Used at {@link org.geysermc.geyser.network.translators.inventory.translators.Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} + * Used at {@link Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} */ @Getter private boolean isDropper = false; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java index 5af40eb21..8ecb3fe8d 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.inventory; import com.nukkitx.protocol.bedrock.data.inventory.EnchantData; import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.Arrays; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java index 82c6d89cc..a75631db0 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java @@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import lombok.Data; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; import javax.annotation.Nonnull; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java index 98e101ea7..6eaaf84a2 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java @@ -34,7 +34,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java index 769a74028..916fa775a 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; @Getter @Setter diff --git a/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java index 8bc3d9c2d..36114ccba 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java @@ -29,7 +29,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public class PlayerInventory extends Inventory { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/SlotType.java b/core/src/main/java/org/geysermc/geyser/inventory/SlotType.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/SlotType.java rename to core/src/main/java/org/geysermc/geyser/inventory/SlotType.java index 38cca8397..17863ba66 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/SlotType.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/SlotType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory; +package org.geysermc.geyser.inventory; public enum SlotType { NORMAL, diff --git a/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java index 576823118..3dc35f5df 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public class StonecutterContainer extends Container { /** diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/Click.java b/core/src/main/java/org/geysermc/geyser/inventory/click/Click.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/Click.java rename to core/src/main/java/org/geysermc/geyser/inventory/click/Click.java index b194c9acf..187a98842 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/Click.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/click/Click.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.click; +package org.geysermc.geyser.inventory.click; import com.github.steveice10.mc.protocol.data.game.inventory.ClickItemAction; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/ClickPlan.java b/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/ClickPlan.java rename to core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java index 23a3a314d..c239cc778 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/click/ClickPlan.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.click; +package org.geysermc.geyser.inventory.click; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType; @@ -35,12 +35,12 @@ import it.unimi.dsi.fastutil.ints.IntSet; import lombok.Value; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.inventory.translators.CraftingInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.PlayerInventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.translator.inventory.CraftingInventoryTranslator; +import org.geysermc.geyser.translator.inventory.PlayerInventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/BlockInventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/BlockInventoryHolder.java rename to core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java index 63b1747cf..8dba5a69d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/BlockInventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.holder; +package org.geysermc.geyser.inventory.holder; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.google.common.collect.ImmutableSet; @@ -36,10 +36,10 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.util.BlockUtils; import java.util.Collections; import java.util.HashSet; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/InventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/InventoryHolder.java rename to core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java index 810bab350..845e645e3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/holder/InventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.holder; +package org.geysermc.geyser.inventory.holder; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; public abstract class InventoryHolder { public abstract void prepareInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/Enchantment.java b/core/src/main/java/org/geysermc/geyser/inventory/item/Enchantment.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/Enchantment.java rename to core/src/main/java/org/geysermc/geyser/inventory/item/Enchantment.java index 5d05632c3..4abc7525e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/Enchantment.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/item/Enchantment.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item; +package org.geysermc.geyser.inventory.item; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/Potion.java b/core/src/main/java/org/geysermc/geyser/inventory/item/Potion.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/Potion.java rename to core/src/main/java/org/geysermc/geyser/inventory/item/Potion.java index dea1e9d21..1efb77ab0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/Potion.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/item/Potion.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item; +package org.geysermc.geyser.inventory.item; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/StoredItemMappings.java b/core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/StoredItemMappings.java rename to core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java index 14ca7758f..f66c34e01 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/StoredItemMappings.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/item/StoredItemMappings.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item; +package org.geysermc.geyser.inventory.item; import lombok.Getter; import lombok.experimental.Accessors; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/TippedArrowPotion.java b/core/src/main/java/org/geysermc/geyser/inventory/item/TippedArrowPotion.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/TippedArrowPotion.java rename to core/src/main/java/org/geysermc/geyser/inventory/item/TippedArrowPotion.java index ad6850717..91d0f526f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/TippedArrowPotion.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/item/TippedArrowPotion.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item; +package org.geysermc.geyser.inventory.item; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/AnvilInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/AnvilInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java index acb5f0941..f95633768 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/AnvilInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.updater; +package org.geysermc.geyser.inventory.updater; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket; @@ -40,13 +40,13 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.EnchantmentData; -import org.geysermc.geyser.utils.ItemUtils; +import org.geysermc.geyser.util.ItemUtils; import java.util.Objects; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ChestInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ChestInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java index a3e5bb201..65147abb6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ChestInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.updater; +package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import lombok.AllArgsConstructor; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.util.ArrayList; import java.util.List; @@ -41,7 +41,7 @@ import java.util.function.IntFunction; @AllArgsConstructor public class ChestInventoryUpdater extends InventoryUpdater { - private static final IntFunction UNUSUABLE_SPACE_BLOCK = InventoryUtils.createUnusableSpaceBlock(LanguageUtils.getLocaleStringLog("geyser.inventory.unusable_item.slot")); + private static final IntFunction UNUSUABLE_SPACE_BLOCK = InventoryUtils.createUnusableSpaceBlock(GeyserLocale.getLocaleStringLog("geyser.inventory.unusable_item.slot")); private final int paddedSize; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ContainerInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ContainerInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java index eb0b8afaa..dd1e810ca 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/ContainerInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.updater; +package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/HorseInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/HorseInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java index 115970b9b..10a556c81 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/HorseInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.updater; +package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/InventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/InventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java index 67ee607b9..6910aa447 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/InventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.updater; +package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/UIInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/UIInventoryUpdater.java rename to core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java index aa24aae1e..79b6bffc0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/updater/UIInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.updater; +package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; public class UIInventoryUpdater extends InventoryUpdater { public static final UIInventoryUpdater INSTANCE = new UIInventoryUpdater(); diff --git a/core/src/main/java/org/geysermc/geyser/utils/BedrockMapIcon.java b/core/src/main/java/org/geysermc/geyser/level/BedrockMapIcon.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/BedrockMapIcon.java rename to core/src/main/java/org/geysermc/geyser/level/BedrockMapIcon.java index cac901c0d..002753407 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/BedrockMapIcon.java +++ b/core/src/main/java/org/geysermc/geyser/level/BedrockMapIcon.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level; import com.github.steveice10.mc.protocol.data.game.level.map.MapIconType; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/utils/FireworkColor.java b/core/src/main/java/org/geysermc/geyser/level/FireworkColor.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/FireworkColor.java rename to core/src/main/java/org/geysermc/geyser/level/FireworkColor.java index a95b727b6..cb8c57517 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/FireworkColor.java +++ b/core/src/main/java/org/geysermc/geyser/level/FireworkColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.util.HSVLike; diff --git a/core/src/main/java/org/geysermc/geyser/utils/GameRule.java b/core/src/main/java/org/geysermc/geyser/level/GameRule.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/GameRule.java rename to core/src/main/java/org/geysermc/geyser/level/GameRule.java index 7b95f192c..d11288c6f 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/GameRule.java +++ b/core/src/main/java/org/geysermc/geyser/level/GameRule.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/utils/GeyserAdvancement.java b/core/src/main/java/org/geysermc/geyser/level/GeyserAdvancement.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/utils/GeyserAdvancement.java rename to core/src/main/java/org/geysermc/geyser/level/GeyserAdvancement.java index 78b17af34..24bebf10a 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/GeyserAdvancement.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserAdvancement.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import lombok.NonNull; -import org.geysermc.geyser.network.session.cache.AdvancementsCache; +import org.geysermc.geyser.session.cache.AdvancementsCache; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/GeyserWorldManager.java rename to core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java index 41c3e0a55..d766c4b4c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world; +package org.geysermc.geyser.level; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; @@ -32,11 +32,10 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.ChunkCache; -import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.utils.GameRule; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.ChunkCache; +import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; +import org.geysermc.geyser.level.block.BlockStateValues; public class GeyserWorldManager extends WorldManager { diff --git a/core/src/main/java/org/geysermc/geyser/utils/MapColor.java b/core/src/main/java/org/geysermc/geyser/level/MapColor.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/MapColor.java rename to core/src/main/java/org/geysermc/geyser/level/MapColor.java index 9b0a75e56..1b2de18d1 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/MapColor.java +++ b/core/src/main/java/org/geysermc/geyser/level/MapColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level; public enum MapColor { COLOR_0(-1, -1, -1), diff --git a/core/src/main/java/org/geysermc/geyser/utils/PaintingType.java b/core/src/main/java/org/geysermc/geyser/level/PaintingType.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/PaintingType.java rename to core/src/main/java/org/geysermc/geyser/level/PaintingType.java index aec9cb7c1..952828b17 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/PaintingType.java +++ b/core/src/main/java/org/geysermc/geyser/level/PaintingType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/WorldManager.java b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/WorldManager.java rename to core/src/main/java/org/geysermc/geyser/level/WorldManager.java index a6fbe94d1..9aaf323c0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/WorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java @@ -23,15 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world; +package org.geysermc.geyser.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.GameRule; +import org.geysermc.geyser.session.GeyserSession; /** * Class that manages or retrieves various information diff --git a/core/src/main/java/org/geysermc/geyser/utils/BlockPositionIterator.java b/core/src/main/java/org/geysermc/geyser/level/block/BlockPositionIterator.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/BlockPositionIterator.java rename to core/src/main/java/org/geysermc/geyser/level/block/BlockPositionIterator.java index 81ad49b66..0c7235f6c 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/BlockPositionIterator.java +++ b/core/src/main/java/org/geysermc/geyser/level/block/BlockPositionIterator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level.block; import com.nukkitx.network.util.Preconditions; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/BlockStateValues.java b/core/src/main/java/org/geysermc/geyser/level/block/BlockStateValues.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/BlockStateValues.java rename to core/src/main/java/org/geysermc/geyser/level/block/BlockStateValues.java index 486ae745e..432ea1081 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/BlockStateValues.java +++ b/core/src/main/java/org/geysermc/geyser/level/block/BlockStateValues.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block; +package org.geysermc.geyser.level.block; import com.fasterxml.jackson.databind.JsonNode; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntityTranslator; +import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntityTranslator; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.BlockMapping; -import org.geysermc.geyser.utils.Direction; -import org.geysermc.geyser.utils.PistonBehavior; -import org.geysermc.geyser.utils.collections.FixedInt2ByteMap; -import org.geysermc.geyser.utils.collections.FixedInt2IntMap; -import org.geysermc.geyser.utils.collections.LecternHasBookMap; +import org.geysermc.geyser.level.physics.Direction; +import org.geysermc.geyser.level.physics.PistonBehavior; +import org.geysermc.geyser.util.collection.FixedInt2ByteMap; +import org.geysermc.geyser.util.collection.FixedInt2IntMap; +import org.geysermc.geyser.util.collection.LecternHasBookMap; /** * Used for block entities if the Java block state contains Bedrock block information. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/DoubleChestValue.java b/core/src/main/java/org/geysermc/geyser/level/block/DoubleChestValue.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/DoubleChestValue.java rename to core/src/main/java/org/geysermc/geyser/level/block/DoubleChestValue.java index b1e81b92c..bd4128abc 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/DoubleChestValue.java +++ b/core/src/main/java/org/geysermc/geyser/level/block/DoubleChestValue.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block; +package org.geysermc.geyser.level.block; /** * This stores all values of double chests that are part of the Java block state. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/BlockStorage.java b/core/src/main/java/org/geysermc/geyser/level/chunk/BlockStorage.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/BlockStorage.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/BlockStorage.java index 07f4dbcef..62d7df413 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/BlockStorage.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/BlockStorage.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk; +package org.geysermc.geyser.level.chunk; import com.nukkitx.network.VarInts; import io.netty.buffer.ByteBuf; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import lombok.Getter; -import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArray; -import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArrayVersion; +import org.geysermc.geyser.level.chunk.bitarray.BitArray; +import org.geysermc.geyser.level.chunk.bitarray.BitArrayVersion; import java.util.function.IntConsumer; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunk.java b/core/src/main/java/org/geysermc/geyser/level/chunk/GeyserChunk.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunk.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/GeyserChunk.java index 67257471d..365d196a3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunk.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/GeyserChunk.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk; +package org.geysermc.geyser.level.chunk; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunkSection.java b/core/src/main/java/org/geysermc/geyser/level/chunk/GeyserChunkSection.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunkSection.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/GeyserChunkSection.java index 7c0c18804..6daf13996 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/GeyserChunkSection.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/GeyserChunkSection.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk; +package org.geysermc.geyser.level.chunk; import com.nukkitx.network.util.Preconditions; import io.netty.buffer.ByteBuf; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/NibbleArray.java b/core/src/main/java/org/geysermc/geyser/level/chunk/NibbleArray.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/NibbleArray.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/NibbleArray.java index 970ae5f79..43dbd9fdc 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/NibbleArray.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/NibbleArray.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk; +package org.geysermc.geyser.level.chunk; import com.nukkitx.network.util.Preconditions; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArray.java b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/BitArray.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArray.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/BitArray.java index e44d92b20..cf69e697f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArray.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/BitArray.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.level.chunk.bitarray; import com.nukkitx.network.VarInts; import io.netty.buffer.ByteBuf; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArrayVersion.java b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/BitArrayVersion.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArrayVersion.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/BitArrayVersion.java index c3cf94aaf..cd54ed73f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/BitArrayVersion.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/BitArrayVersion.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.level.chunk.bitarray; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.util.MathUtils; public enum BitArrayVersion { V16(16, 2, null), diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/PaddedBitArray.java b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/PaddedBitArray.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/PaddedBitArray.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/PaddedBitArray.java index 9b2c43ee5..3686ed4e0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/PaddedBitArray.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/PaddedBitArray.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.level.chunk.bitarray; import com.nukkitx.network.util.Preconditions; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.util.MathUtils; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/Pow2BitArray.java b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/Pow2BitArray.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/Pow2BitArray.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/Pow2BitArray.java index 5ad65b5aa..be5567e15 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/Pow2BitArray.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/Pow2BitArray.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.level.chunk.bitarray; import com.nukkitx.network.util.Preconditions; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.util.MathUtils; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/SingletonBitArray.java b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/SingletonBitArray.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/SingletonBitArray.java rename to core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/SingletonBitArray.java index 13482307f..0c64ad76b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/chunk/bitarray/SingletonBitArray.java +++ b/core/src/main/java/org/geysermc/geyser/level/chunk/bitarray/SingletonBitArray.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.chunk.bitarray; +package org.geysermc.geyser.level.chunk.bitarray; import io.netty.buffer.ByteBuf; diff --git a/core/src/main/java/org/geysermc/geyser/utils/Axis.java b/core/src/main/java/org/geysermc/geyser/level/physics/Axis.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/Axis.java rename to core/src/main/java/org/geysermc/geyser/level/physics/Axis.java index 7465d6a4d..d9334368f 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/Axis.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/Axis.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level.physics; import com.nukkitx.math.vector.Vector3d; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/BoundingBox.java b/core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/BoundingBox.java rename to core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java index c79c2799f..6600c5abc 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/BoundingBox.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/BoundingBox.java @@ -23,12 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision; +package org.geysermc.geyser.level.physics; import com.nukkitx.math.vector.Vector3d; import lombok.*; -import org.geysermc.geyser.utils.Axis; -import org.geysermc.geyser.utils.Direction; @Data @AllArgsConstructor diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionManager.java rename to core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java index 74678ae1d..5bd72182f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision; +package org.geysermc.geyser.level.physics; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; @@ -32,17 +32,16 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.PistonCache; -import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; -import org.geysermc.geyser.network.translators.collision.translators.ScaffoldingCollision; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.utils.Axis; -import org.geysermc.geyser.utils.BlockPositionIterator; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.PistonCache; +import org.geysermc.geyser.translator.collision.BlockCollision; +import org.geysermc.geyser.translator.collision.ScaffoldingCollision; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.level.block.BlockPositionIterator; +import org.geysermc.geyser.util.BlockUtils; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; diff --git a/core/src/main/java/org/geysermc/geyser/utils/Direction.java b/core/src/main/java/org/geysermc/geyser/level/physics/Direction.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/Direction.java rename to core/src/main/java/org/geysermc/geyser/level/physics/Direction.java index c02d19196..fa3234460 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/Direction.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/Direction.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level.physics; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue; import com.nukkitx.math.vector.Vector3i; diff --git a/core/src/main/java/org/geysermc/geyser/utils/PistonBehavior.java b/core/src/main/java/org/geysermc/geyser/level/physics/PistonBehavior.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/PistonBehavior.java rename to core/src/main/java/org/geysermc/geyser/level/physics/PistonBehavior.java index 74678479c..2a818d2d8 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/PistonBehavior.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/PistonBehavior.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.level.physics; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java index fff852ad2..2cd866365 100644 --- a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java @@ -34,12 +34,12 @@ import io.netty.channel.DefaultEventLoopGroup; import io.netty.channel.socket.DatagramPacket; import io.netty.util.concurrent.DefaultThreadFactory; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.common.ping.GeyserPingInfo; +import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.ping.IGeyserPingPassthrough; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; import javax.annotation.Nonnull; import java.net.InetSocketAddress; @@ -82,14 +82,14 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } } - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.attempt_connect", inetSocketAddress)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.attempt_connect", inetSocketAddress)); return true; } @Override public BedrockPong onQuery(InetSocketAddress inetSocketAddress) { if (geyser.getConfig().isDebugMode()) { - geyser.getLogger().debug(LanguageUtils.getLocaleStringLog("geyser.network.pinged", inetSocketAddress)); + geyser.getLogger().debug(GeyserLocale.getLocaleStringLog("geyser.network.pinged", inetSocketAddress)); } GeyserConfiguration config = geyser.getConfig(); diff --git a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index 83994f11c..0dceed7e9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; /** * Bare bones implementation of BedrockPacketHandler suitable for extension. diff --git a/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java index e29cf5627..c8d1959ef 100644 --- a/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/QueryPacketHandler.java @@ -28,8 +28,8 @@ package org.geysermc.geyser.network; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.common.ping.GeyserPingInfo; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.ping.GeyserPingInfo; +import org.geysermc.geyser.translator.text.MessageTranslator; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index 701f42219..a0800fb42 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -32,13 +32,15 @@ import com.nukkitx.protocol.bedrock.data.ResourcePackType; import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.common.AuthType; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslatorRegistry; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.pack.ResourcePack; +import org.geysermc.geyser.pack.ResourcePackManifest; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.*; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.util.*; import java.io.FileInputStream; import java.io.InputStream; @@ -50,7 +52,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { } private boolean translateAndDefault(BedrockPacket packet) { - return PacketTranslatorRegistry.BEDROCK_TRANSLATOR.translate(packet.getClass(), packet, session); + return Registries.BEDROCK_PACKET_TRANSLATORS.translate(packet.getClass(), packet, session); } @Override @@ -62,7 +64,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { public boolean handle(LoginPacket loginPacket) { if (geyser.isShuttingDown()) { // Don't allow new players in if we're no longer operating - session.disconnect(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.message")); + session.disconnect(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.kick.message")); return true; } @@ -71,12 +73,12 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { String supportedVersions = MinecraftProtocol.getAllSupportedVersions(); if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { // Too early to determine session locale - session.getGeyser().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); - session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); + session.getGeyser().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); + session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); return true; } else if (loginPacket.getProtocolVersion() < MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { - session.getGeyser().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); - session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); + session.getGeyser().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); + session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.outdated.client", supportedVersions)); return true; } } @@ -105,7 +107,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { resourcePacksInfo.setForcedToAccept(GeyserImpl.getInstance().getConfig().isForceResourcePacks()); session.sendUpstreamPacket(resourcePacksInfo); - LanguageUtils.loadGeyserLocale(session.getLocale()); + GeyserLocale.loadGeyserLocale(session.getLocale()); return true; } @@ -119,7 +121,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { // We must spawn the white world session.connect(); } - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.connect", session.getAuthData().getName())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.connect", session.getAuthData().getName())); break; case SEND_PACKS: @@ -186,7 +188,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { GeyserConfiguration.IUserAuthenticationInfo info = geyser.getConfig().getUserAuths().get(bedrockUsername); if (info != null) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().getName())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().getName())); session.setMicrosoftAccount(info.isMicrosoftAccount()); session.authenticate(info.getEmail(), info.getPassword()); return true; @@ -201,7 +203,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { if (session.isLoggingIn()) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.ACTIONBAR); - titlePacket.setText(LanguageUtils.getPlayerLocaleString("geyser.auth.login.wait", session.getLocale())); + titlePacket.setText(GeyserLocale.getPlayerLocaleString("geyser.auth.login.wait", session.getLocale())); titlePacket.setFadeInTime(0); titlePacket.setFadeOutTime(1); titlePacket.setStayTime(2); diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/ChannelWrapper.java b/core/src/main/java/org/geysermc/geyser/network/netty/ChannelWrapper.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/common/connection/ChannelWrapper.java rename to core/src/main/java/org/geysermc/geyser/network/netty/ChannelWrapper.java index 985e690b1..ec23c4149 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/ChannelWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/ChannelWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import io.netty.buffer.ByteBufAllocator; import io.netty.channel.*; diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/DefaultChannelPipelinePublic.java b/core/src/main/java/org/geysermc/geyser/network/netty/DefaultChannelPipelinePublic.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/common/connection/DefaultChannelPipelinePublic.java rename to core/src/main/java/org/geysermc/geyser/network/netty/DefaultChannelPipelinePublic.java index a55d583d1..67bbf6427 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/DefaultChannelPipelinePublic.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/DefaultChannelPipelinePublic.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import io.netty.channel.Channel; import io.netty.channel.DefaultChannelPipeline; diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/GeyserInjector.java b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserInjector.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/common/connection/GeyserInjector.java rename to core/src/main/java/org/geysermc/geyser/network/netty/GeyserInjector.java index 5e9f4f28f..b87c41ba6 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/GeyserInjector.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/GeyserInjector.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import io.netty.channel.ChannelFuture; import lombok.Getter; -import org.geysermc.geyser.bootstrap.GeyserBootstrap; +import org.geysermc.geyser.GeyserBootstrap; import java.net.SocketAddress; diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWithRemoteAddress.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalChannelWithRemoteAddress.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWithRemoteAddress.java rename to core/src/main/java/org/geysermc/geyser/network/netty/LocalChannelWithRemoteAddress.java index d6528f11b..96dcca77b 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWithRemoteAddress.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalChannelWithRemoteAddress.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import io.netty.channel.local.LocalChannel; diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWrapper.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalChannelWrapper.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWrapper.java rename to core/src/main/java/org/geysermc/geyser/network/netty/LocalChannelWrapper.java index edd3d4414..f80e85d70 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/LocalChannelWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalChannelWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import io.netty.channel.DefaultChannelPipeline; import io.netty.channel.local.LocalChannel; diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/LocalServerChannelWrapper.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalServerChannelWrapper.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/common/connection/LocalServerChannelWrapper.java rename to core/src/main/java/org/geysermc/geyser/network/netty/LocalServerChannelWrapper.java index 5a06c9727..7bb11e01b 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/LocalServerChannelWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalServerChannelWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import io.netty.channel.local.LocalChannel; import io.netty.channel.local.LocalServerChannel; diff --git a/core/src/main/java/org/geysermc/geyser/common/connection/LocalSession.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/common/connection/LocalSession.java rename to core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java index d29675835..781644056 100644 --- a/core/src/main/java/org/geysermc/geyser/common/connection/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.connection; +package org.geysermc.geyser.network.netty; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.packet.PacketProtocol; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java deleted file mode 100644 index 011360efd..000000000 --- a/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslatorRegistry.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.network.translators; - -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; -import com.github.steveice10.packetlib.packet.Packet; -import com.nukkitx.protocol.bedrock.BedrockPacket; -import io.netty.channel.EventLoop; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.common.PlatformType; -import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; - -import java.util.IdentityHashMap; -import java.util.Map; - -public class PacketTranslatorRegistry { - private final Map, PacketTranslator> translators = new IdentityHashMap<>(); - - public static final PacketTranslatorRegistry JAVA_TRANSLATOR = new PacketTranslatorRegistry<>(); - public static final PacketTranslatorRegistry BEDROCK_TRANSLATOR = new PacketTranslatorRegistry<>(); - - private static final ObjectArrayList> IGNORED_PACKETS = new ObjectArrayList<>(); - - static { - for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(Translator.class)) { - Class packet = clazz.getAnnotation(Translator.class).packet(); - - GeyserImpl.getInstance().getLogger().debug("Found annotated translator: " + clazz.getCanonicalName() + " : " + packet.getSimpleName()); - - try { - if (Packet.class.isAssignableFrom(packet)) { - Class targetPacket = (Class) packet; - PacketTranslator translator = (PacketTranslator) clazz.newInstance(); - - JAVA_TRANSLATOR.translators.put(targetPacket, translator); - } else if (BedrockPacket.class.isAssignableFrom(packet)) { - Class targetPacket = (Class) packet; - PacketTranslator translator = (PacketTranslator) clazz.newInstance(); - - BEDROCK_TRANSLATOR.translators.put(targetPacket, translator); - } else { - GeyserImpl.getInstance().getLogger().error("Class " + clazz.getCanonicalName() + " is annotated as a translator but has an invalid target packet."); - } - } catch (InstantiationException | IllegalAccessException e) { - GeyserImpl.getInstance().getLogger().error("Could not instantiate annotated translator " + clazz.getCanonicalName()); - } - } - - IGNORED_PACKETS.add(ClientboundLightUpdatePacket.class); // Light is handled on Bedrock for us - IGNORED_PACKETS.add(ClientboundTabListPacket.class); // Cant be implemented in Bedrock - } - - private PacketTranslatorRegistry() { - } - - public static void init() { - // no-op - } - - @SuppressWarnings("unchecked") - public

boolean translate(Class clazz, P packet, GeyserSession session) { - if (!session.getUpstream().isClosed() && !session.isClosed()) { - PacketTranslator

translator = (PacketTranslator

) translators.get(clazz); - if (translator != null) { - EventLoop eventLoop = session.getEventLoop(); - if (!translator.shouldExecuteInEventLoop() || eventLoop.inEventLoop()) { - translate0(session, translator, packet); - } else { - eventLoop.execute(() -> translate0(session, translator, packet)); - } - return true; - } else { - if ((GeyserImpl.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { - // Other debug logs already take care of Bedrock packets for us if on standalone - GeyserImpl.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet)); - } - } - } - return false; - } - - private

void translate0(GeyserSession session, PacketTranslator

translator, P packet) { - if (session.isClosed()) { - return; - } - - try { - translator.translate(session, packet); - } catch (Throwable ex) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); - ex.printStackTrace(); - } - } -} diff --git a/core/src/main/java/org/geysermc/geyser/utils/ResourcePack.java b/core/src/main/java/org/geysermc/geyser/pack/ResourcePack.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/utils/ResourcePack.java rename to core/src/main/java/org/geysermc/geyser/pack/ResourcePack.java index cfa7c4051..1f69fbdbc 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/ResourcePack.java +++ b/core/src/main/java/org/geysermc/geyser/pack/ResourcePack.java @@ -23,9 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.pack; import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.io.File; import java.util.HashMap; @@ -96,7 +98,7 @@ public class ResourcePack { } }); } catch (Exception e) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.resource_pack.broken", file.getName())); + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.resource_pack.broken", file.getName())); e.printStackTrace(); } finally { if (stream != null) { diff --git a/core/src/main/java/org/geysermc/geyser/utils/ResourcePackManifest.java b/core/src/main/java/org/geysermc/geyser/pack/ResourcePackManifest.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/ResourcePackManifest.java rename to core/src/main/java/org/geysermc/geyser/pack/ResourcePackManifest.java index c9563b5fc..1e79b330b 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/ResourcePackManifest.java +++ b/core/src/main/java/org/geysermc/geyser/pack/ResourcePackManifest.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.pack; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.EqualsAndHashCode; diff --git a/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java b/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java index 88671b66f..9d36b0274 100644 --- a/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java +++ b/core/src/main/java/org/geysermc/geyser/ping/GeyserLegacyPingPassthrough.java @@ -28,7 +28,6 @@ package org.geysermc.geyser.ping; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.nukkitx.nbt.util.VarInts; -import org.geysermc.geyser.common.ping.GeyserPingInfo; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; diff --git a/core/src/main/java/org/geysermc/geyser/common/ping/GeyserPingInfo.java b/core/src/main/java/org/geysermc/geyser/ping/GeyserPingInfo.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/common/ping/GeyserPingInfo.java rename to core/src/main/java/org/geysermc/geyser/ping/GeyserPingInfo.java index 6a7f1f13c..ac3c61980 100644 --- a/core/src/main/java/org/geysermc/geyser/common/ping/GeyserPingInfo.java +++ b/core/src/main/java/org/geysermc/geyser/ping/GeyserPingInfo.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.ping; +package org.geysermc.geyser.ping; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java b/core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java index 5a2eb04ae..d2ebbe4ac 100644 --- a/core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java +++ b/core/src/main/java/org/geysermc/geyser/ping/IGeyserPingPassthrough.java @@ -25,8 +25,6 @@ package org.geysermc.geyser.ping; -import org.geysermc.geyser.common.ping.GeyserPingInfo; - import java.net.Inet4Address; import java.net.InetSocketAddress; diff --git a/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java index 390d3b2aa..acabef46f 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java @@ -29,6 +29,8 @@ import org.geysermc.geyser.registry.loader.RegistryLoader; import javax.annotation.Nullable; import java.util.Map; +import java.util.Optional; +import java.util.function.Function; /** * An abstract registry holding a map of various registrations as defined by {@link M}. @@ -55,6 +57,23 @@ public abstract class AbstractMappedRegistry> extends return this.mappings.get(key); } + /** + * Returns & maps the value by the given key if present. + * + * @param key the key + * @param mapper the mapper + * @param the type + * @return the mapped value from the given key if present + */ + public Optional map(K key, Function mapper) { + V value = this.get(key); + if (value == null) { + return Optional.empty(); + } else { + return Optional.ofNullable(mapper.apply(value)); + } + } + /** * Returns the value registered by the given key or the default value * specified if null. diff --git a/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java index c80eb739b..870828f44 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java @@ -33,7 +33,7 @@ import org.geysermc.geyser.registry.loader.RegistryLoaders; import org.geysermc.geyser.registry.populator.BlockRegistryPopulator; import org.geysermc.geyser.registry.type.BlockMapping; import org.geysermc.geyser.registry.type.BlockMappings; -import org.geysermc.geyser.utils.collections.Object2IntBiMap; +import org.geysermc.geyser.util.collection.Object2IntBiMap; /** * Holds all the block registries in Geyser. diff --git a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java new file mode 100644 index 000000000..e74d15001 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2019-2021 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.registry; + +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; +import com.nukkitx.protocol.bedrock.BedrockPacket; +import io.netty.channel.EventLoop; +import org.geysermc.common.PlatformType; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.registry.loader.RegistryLoaders; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.text.GeyserLocale; + +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Set; + +public class PacketTranslatorRegistry extends AbstractMappedRegistry, PacketTranslator, IdentityHashMap, PacketTranslator>> { + private static final Set> IGNORED_PACKETS = Collections.newSetFromMap(new IdentityHashMap<>()); + + static { + IGNORED_PACKETS.add(ClientboundLightUpdatePacket.class); // Light is handled on Bedrock for us + IGNORED_PACKETS.add(ClientboundTabListPacket.class); // Cant be implemented in Bedrock + } + + protected PacketTranslatorRegistry() { + super(null, RegistryLoaders.empty(IdentityHashMap::new)); + } + + @SuppressWarnings("unchecked") + public

boolean translate(Class clazz, P packet, GeyserSession session) { + if (session.getUpstream().isClosed() || session.isClosed()) { + return false; + } + + PacketTranslator

translator = (PacketTranslator

) this.mappings.get(clazz); + if (translator != null) { + EventLoop eventLoop = session.getEventLoop(); + if (!translator.shouldExecuteInEventLoop() || eventLoop.inEventLoop()) { + translate0(session, translator, packet); + } else { + eventLoop.execute(() -> translate0(session, translator, packet)); + } + return true; + } else { + if ((GeyserImpl.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) { + // Other debug logs already take care of Bedrock packets for us if on standalone + GeyserImpl.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet)); + } + + return false; + } + } + + private

void translate0(GeyserSession session, PacketTranslator

translator, P packet) { + if (session.isClosed()) { + return; + } + + try { + translator.translate(session, packet); + } catch (Throwable ex) { + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex); + ex.printStackTrace(); + } + } + + public static PacketTranslatorRegistry create() { + return new PacketTranslatorRegistry<>(); + } +} diff --git a/core/src/main/java/org/geysermc/geyser/registry/Registries.java b/core/src/main/java/org/geysermc/geyser/registry/Registries.java index ef73e28e9..7473980cd 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -31,7 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent; import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; +import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.nbt.NbtMap; +import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; import it.unimi.dsi.fastutil.Pair; @@ -40,12 +42,13 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; -import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; -import org.geysermc.geyser.network.translators.sound.SoundHandler; -import org.geysermc.geyser.network.translators.sound.SoundInteractionHandler; -import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.geyser.network.translators.world.event.LevelEventTransformer; +import org.geysermc.geyser.registry.populator.PacketRegistryPopulator; +import org.geysermc.geyser.translator.collision.BlockCollision; +import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.translator.sound.SoundTranslator; +import org.geysermc.geyser.translator.sound.SoundInteractionTranslator; +import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.translator.level.event.LevelEventTranslator; import org.geysermc.geyser.registry.loader.*; import org.geysermc.geyser.registry.populator.ItemRegistryPopulator; import org.geysermc.geyser.registry.populator.RecipeRegistryPopulator; @@ -68,6 +71,11 @@ public class Registries { */ public static final SimpleRegistry BEDROCK_ENTITY_IDENTIFIERS = SimpleRegistry.create("bedrock/entity_identifiers.dat", RegistryLoaders.NBT); + /** + * A registry containing all the Bedrock packet translators. + */ + public static final PacketTranslatorRegistry BEDROCK_PACKET_TRANSLATORS = PacketTranslatorRegistry.create(); + /** * A registry holding a CompoundTag of all the known biomes. */ @@ -81,12 +89,12 @@ public class Registries { /** * A mapped registry which stores a block entity identifier to its {@link BlockEntityTranslator}. */ - public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.geyser.network.translators.world.block.entity.BlockEntity", BlockEntityRegistryLoader::new); + public static final SimpleMappedRegistry BLOCK_ENTITIES = SimpleMappedRegistry.create("org.geysermc.geyser.translator.level.block.entity.BlockEntity", BlockEntityRegistryLoader::new); /** * A mapped registry containing which holds block IDs to its {@link BlockCollision}. */ - public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.geyser.network.translators.collision.translators.Translator", "mappings/collision.json"), CollisionRegistryLoader::new); + public static final SimpleMappedRegistry COLLISIONS = SimpleMappedRegistry.create(Pair.of("org.geysermc.geyser.translator.collision.CollisionRemapper", "mappings/collision.json"), CollisionRegistryLoader::new); /** * A versioned registry which holds a {@link RecipeType} to a corresponding list of {@link CraftingData}. @@ -108,6 +116,11 @@ public class Registries { */ public static final SimpleMappedRegistry> JAVA_ENTITY_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new)); + /** + * A registry containing all the Java packet translators. + */ + public static final PacketTranslatorRegistry JAVA_PACKET_TRANSLATORS = PacketTranslatorRegistry.create(); + /** * A versioned registry which holds {@link ItemMappings} for each version. These item mappings contain * primarily Bedrock version-specific data. @@ -142,20 +155,21 @@ public class Registries { public static final SimpleMappedRegistry SOUNDS = SimpleMappedRegistry.create("mappings/sounds.json", SoundRegistryLoader::new); /** - * A mapped registry holding {@link SoundEvent}s to their corresponding {@link LevelEventTransformer}. + * A mapped registry holding {@link SoundEvent}s to their corresponding {@link LevelEventTranslator}. */ - public static final SimpleMappedRegistry SOUND_EVENTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEventsRegistryLoader::new); + public static final SimpleMappedRegistry SOUND_EVENTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEventsRegistryLoader::new); /** - * A mapped registry holding {@link SoundHandler}s to their corresponding {@link SoundInteractionHandler}. + * A mapped registry holding {@link SoundTranslator}s to their corresponding {@link SoundInteractionTranslator}. */ - public static final SimpleMappedRegistry> SOUND_HANDLERS = SimpleMappedRegistry.create("org.geysermc.geyser.network.translators.sound.SoundHandler", SoundHandlerRegistryLoader::new); + public static final SimpleMappedRegistry> SOUND_TRANSLATORS = SimpleMappedRegistry.create("org.geysermc.geyser.translator.sound.SoundTranslator", SoundTranslatorRegistryLoader::new); public static void init() { // no-op } static { + PacketRegistryPopulator.populate(); ItemRegistryPopulator.populate(); RecipeRegistryPopulator.populate(); diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java index 1f42d7fb0..d8314965f 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/AnnotatedRegistryLoader.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.registry.loader; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.lang.annotation.Annotation; import java.util.Map; @@ -45,7 +45,7 @@ import java.util.function.Function; * replaced with a simple Function.identity() if not desired. * *

- * See {@link BlockEntityRegistryLoader} and {@link SoundHandlerRegistryLoader} as a + * See {@link BlockEntityRegistryLoader} and {@link SoundTranslatorRegistryLoader} as a * good example of these registry loaders in use. * * @param the final result as transformed by the function diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java index 5af552469..f510b3592 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java @@ -30,7 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.io.IOException; import java.io.InputStream; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java index fd0f72a84..b18d6959d 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/BlockEntityRegistryLoader.java @@ -28,10 +28,10 @@ package org.geysermc.geyser.registry.loader; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.geyser.network.translators.world.block.entity.BlockEntity; -import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.geyser.network.translators.world.block.entity.EmptyBlockEntityTranslator; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.translator.level.block.entity.BlockEntity; +import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.translator.level.block.entity.EmptyBlockEntityTranslator; +import org.geysermc.geyser.util.FileUtils; import java.lang.reflect.InvocationTargetException; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java index bf3877ff6..1587a5420 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java @@ -33,14 +33,14 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.AllArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; -import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; -import org.geysermc.geyser.network.translators.collision.translators.OtherCollision; -import org.geysermc.geyser.network.translators.collision.translators.SolidCollision; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.translator.collision.CollisionRemapper; +import org.geysermc.geyser.translator.collision.BlockCollision; +import org.geysermc.geyser.translator.collision.OtherCollision; +import org.geysermc.geyser.translator.collision.SolidCollision; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.BlockMapping; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java index 1da42a68d..7da3a3b6c 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.databind.JsonNode; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.io.InputStream; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/EnchantmentRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/EnchantmentRegistryLoader.java index 0cb2d4bbb..b3683a7dc 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/EnchantmentRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/EnchantmentRegistryLoader.java @@ -30,11 +30,11 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.EnchantmentData; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.io.InputStream; import java.util.EnumMap; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java index 6e0abaa62..6134e8d98 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.registry.loader; import com.nukkitx.nbt.NBTInputStream; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.io.InputStream; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java index 105cec9fa..1280ce297 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/PotionMixRegistryLoader.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData; import org.geysermc.geyser.network.MinecraftProtocol; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.network.translators.item.Potion; +import org.geysermc.geyser.inventory.item.Potion; import java.util.ArrayList; import java.util.HashSet; diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/SoundEventsRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/SoundEventsRegistryLoader.java index 3970a5fb5..1b0f93c6a 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/SoundEventsRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/SoundEventsRegistryLoader.java @@ -30,10 +30,10 @@ import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent; import com.nukkitx.protocol.bedrock.data.LevelEventType; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.translators.world.event.LevelEventTransformer; -import org.geysermc.geyser.network.translators.world.event.PlaySoundEventTransformer; -import org.geysermc.geyser.network.translators.world.event.SoundEventEventTransformer; -import org.geysermc.geyser.network.translators.world.event.SoundLevelEventTransformer; +import org.geysermc.geyser.translator.level.event.LevelEventTranslator; +import org.geysermc.geyser.translator.level.event.PlaySoundEventTranslator; +import org.geysermc.geyser.translator.level.event.SoundEventEventTranslator; +import org.geysermc.geyser.translator.level.event.SoundLevelEventTranslator; import java.util.Iterator; import java.util.Map; @@ -41,34 +41,34 @@ import java.util.Map; /** * Loads sound effects from the given resource path. */ -public class SoundEventsRegistryLoader extends EffectRegistryLoader> { +public class SoundEventsRegistryLoader extends EffectRegistryLoader> { @Override - public Map load(String input) { + public Map load(String input) { this.loadFile(input); Iterator> effectsIterator = this.get(input).fields(); - Map soundEffects = new Object2ObjectOpenHashMap<>(); + Map soundEffects = new Object2ObjectOpenHashMap<>(); while (effectsIterator.hasNext()) { Map.Entry entry = effectsIterator.next(); JsonNode node = entry.getValue(); try { String type = node.get("type").asText(); SoundEvent javaEffect = null; - LevelEventTransformer transformer = null; + LevelEventTranslator transformer = null; switch (type) { case "soundLevel" -> { javaEffect = SoundEvent.valueOf(entry.getKey()); LevelEventType levelEventType = LevelEventType.valueOf(node.get("name").asText()); int data = node.has("data") ? node.get("data").intValue() : 0; - transformer = new SoundLevelEventTransformer(levelEventType, data); + transformer = new SoundLevelEventTranslator(levelEventType, data); } case "soundEvent" -> { javaEffect = SoundEvent.valueOf(entry.getKey()); com.nukkitx.protocol.bedrock.data.SoundEvent soundEvent = com.nukkitx.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText()); String identifier = node.has("identifier") ? node.get("identifier").asText() : ""; int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1; - transformer = new SoundEventEventTransformer(soundEvent, identifier, extraData); + transformer = new SoundEventEventTranslator(soundEvent, identifier, extraData); } case "playSound" -> { javaEffect = SoundEvent.valueOf(entry.getKey()); @@ -78,7 +78,7 @@ public class SoundEventsRegistryLoader extends EffectRegistryLoader> { - public SoundHandlerRegistryLoader() { - super(SoundHandler.class, Function.identity()); +public class SoundTranslatorRegistryLoader extends AnnotatedRegistryLoader> { + public SoundTranslatorRegistryLoader() { + super(SoundTranslator.class, Function.identity()); } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index d5c93c3cc..504fd5b8e 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -37,13 +37,13 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIntPair; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.BlockMapping; import org.geysermc.geyser.registry.type.BlockMappings; -import org.geysermc.geyser.utils.BlockUtils; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.PistonBehavior; +import org.geysermc.geyser.util.BlockUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.level.physics.PistonBehavior; import java.io.DataInputStream; import java.io.InputStream; diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index 6e8649c37..52d55d2d3 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -40,11 +40,11 @@ import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.translators.item.StoredItemMappings; +import org.geysermc.geyser.inventory.item.StoredItemMappings; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.*; -import org.geysermc.geyser.utils.FileUtils; +import org.geysermc.geyser.util.FileUtils; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java new file mode 100644 index 000000000..5024d26e7 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/PacketRegistryPopulator.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019-2021 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.registry.populator; + +import com.github.steveice10.packetlib.packet.Packet; +import com.nukkitx.protocol.bedrock.BedrockPacket; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.FileUtils; + +public class PacketRegistryPopulator { + + public static void populate() { + for (Class clazz : FileUtils.getGeneratedClassesForAnnotation(Translator.class)) { + Class packet = clazz.getAnnotation(Translator.class).packet(); + + GeyserImpl.getInstance().getLogger().debug("Found annotated translator: " + clazz.getCanonicalName() + " : " + packet.getSimpleName()); + + try { + if (Packet.class.isAssignableFrom(packet)) { + Class targetPacket = (Class) packet; + PacketTranslator translator = (PacketTranslator) clazz.newInstance(); + + Registries.JAVA_PACKET_TRANSLATORS.register(targetPacket, translator); + } else if (BedrockPacket.class.isAssignableFrom(packet)) { + Class targetPacket = (Class) packet; + PacketTranslator translator = (PacketTranslator) clazz.newInstance(); + + Registries.BEDROCK_PACKET_TRANSLATORS.register(targetPacket, translator); + } else { + GeyserImpl.getInstance().getLogger().error("Class " + clazz.getCanonicalName() + " is annotated as a translator but has an invalid target packet."); + } + } catch (InstantiationException | IllegalAccessException e) { + GeyserImpl.getInstance().getLogger().error("Could not instantiate annotated translator " + clazz.getCanonicalName()); + } + } + } +} diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java index bd124e28f..ecc3fbb29 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java @@ -40,19 +40,19 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.*; -import static org.geysermc.geyser.utils.InventoryUtils.LAST_RECIPE_NET_ID; +import static org.geysermc.geyser.util.InventoryUtils.LAST_RECIPE_NET_ID; /** * Populates the recipe registry. @@ -66,7 +66,7 @@ public class RecipeRegistryPopulator { try { items = GeyserImpl.JSON_MAPPER.readTree(stream); } catch (Exception e) { - throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.toolbox.fail.runtime_java"), e); + throw new AssertionError(GeyserLocale.getLocaleStringLog("geyser.toolbox.fail.runtime_java"), e); } int currentRecipeId = LAST_RECIPE_NET_ID; diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java index cad2d12f5..e65ebcfff 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/BlockMapping.java @@ -27,8 +27,8 @@ package org.geysermc.geyser.registry.type; import lombok.Builder; import lombok.Value; -import org.geysermc.geyser.utils.BlockUtils; -import org.geysermc.geyser.utils.PistonBehavior; +import org.geysermc.geyser.util.BlockUtils; +import org.geysermc.geyser.level.physics.PistonBehavior; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java b/core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java index 0c0e7df1d..ce8b6abc5 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/EnchantmentData.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.registry.type; import it.unimi.dsi.fastutil.ints.IntSet; -import org.geysermc.geyser.network.translators.item.Enchantment.JavaEnchantment; +import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java index f0eb1747b..a246cdcf3 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java @@ -34,7 +34,7 @@ import it.unimi.dsi.fastutil.ints.IntList; import lombok.Builder; import lombok.Value; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.translators.item.StoredItemMappings; +import org.geysermc.geyser.inventory.item.StoredItemMappings; import javax.annotation.Nullable; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java index 17590d7fc..cd5ad17ce 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java @@ -26,9 +26,18 @@ package org.geysermc.geyser.registry.type; import com.nukkitx.protocol.bedrock.data.LevelEventType; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.ParametersAreNullableByDefault; @ParametersAreNullableByDefault public record ParticleMapping(LevelEventType levelEventType, String identifier) { + + public int getParticleId(GeyserSession session) { + if (this.levelEventType == null) { + return -1; + } + + return session.getUpstream().getSession().getPacketCodec().getHelper().getLevelEventId(this.levelEventType) & ~0x4000; + } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index 41b46aedf..3dc416c6c 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -33,10 +33,10 @@ import com.nukkitx.protocol.bedrock.packet.SetScorePacket; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import javax.annotation.Nullable; import java.util.*; @@ -125,7 +125,7 @@ public final class Scoreboard { public Team registerNewTeam(String teamName, String[] players) { Team team = teams.get(teamName); if (team != null) { - logger.info(LanguageUtils.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName)); + logger.info(GeyserLocale.getLocaleStringLog("geyser.network.translator.team.failed_overrides", teamName)); return team; } diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java index 9c732046c..2f817a918 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java @@ -29,9 +29,9 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldCache; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldCache; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Collection; import java.util.concurrent.atomic.AtomicInteger; @@ -118,8 +118,8 @@ public final class ScoreboardUpdater extends Thread { FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; geyser.getLogger().info( - LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + - LanguageUtils.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) + GeyserLocale.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + + GeyserLocale.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) ); scoreboardSession.lastLog = currentTime; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java rename to core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 161ddb52e..cf5f5c6af 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session; +package org.geysermc.geyser.session; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.exception.request.AuthPendingException; @@ -74,31 +74,35 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.common.PlatformType; +import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.common.connection.LocalSession; +import org.geysermc.geyser.entity.InteractiveTagManager; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.network.netty.LocalSession; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.ItemFrameEntity; -import org.geysermc.geyser.entity.Tickable; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.ItemFrameEntity; +import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; -import org.geysermc.geyser.entity.player.SkullPlayerEntity; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; +import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.auth.AuthData; -import org.geysermc.geyser.network.session.auth.BedrockClientData; -import org.geysermc.geyser.network.session.cache.*; -import org.geysermc.geyser.network.translators.PacketTranslatorRegistry; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.translators.collision.CollisionManager; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; +import org.geysermc.geyser.level.WorldManager; +import org.geysermc.geyser.session.auth.AuthData; +import org.geysermc.geyser.session.auth.BedrockClientData; +import org.geysermc.geyser.session.cache.*; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.level.physics.CollisionManager; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.BlockMappings; import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.geyser.skin.FloodgateSkinUploader; -import org.geysermc.geyser.utils.*; +import org.geysermc.geyser.util.*; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.util.FormBuilder; import org.geysermc.floodgate.crypto.FloodgateCipher; @@ -222,7 +226,7 @@ public class GeyserSession implements CommandSender { /** * Stores a list of all lectern locations and their block entity tags. - * See {@link org.geysermc.geyser.network.translators.world.WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} + * See {@link WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} * for more information. */ private final Set lecternCache; @@ -503,7 +507,7 @@ public class GeyserSession implements CommandSender { bedrockServerSession.addDisconnectHandler(disconnectReason -> { InetAddress address = bedrockServerSession.getRealAddress().getAddress(); - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.disconnect", address, disconnectReason)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.disconnect", address, disconnectReason)); disconnect(disconnectReason.name()); geyser.getSessionManager().removeSession(this); @@ -571,9 +575,9 @@ public class GeyserSession implements CommandSender { public void login() { if (this.remoteAuthType != AuthType.ONLINE) { if (this.remoteAuthType == AuthType.OFFLINE) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.offline")); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.login.offline")); } else { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.floodgate")); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.login.floodgate")); } authenticate(authData.getName()); } @@ -585,7 +589,7 @@ public class GeyserSession implements CommandSender { public void authenticate(String username, String password) { if (loggedIn) { - geyser.getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.auth.already_loggedin", username)); + geyser.getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.auth.already_loggedin", username)); return; } @@ -609,7 +613,7 @@ public class GeyserSession implements CommandSender { GameProfile profile = authenticationService.getSelectedProfile(); if (profile == null) { // Java account is offline - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + disconnect(GeyserLocale.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); return null; } @@ -627,8 +631,8 @@ public class GeyserSession implements CommandSender { protocol = new MinecraftProtocol(validUsername); } } catch (InvalidCredentialsException | IllegalArgumentException e) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.auth.login.invalid", username)); - disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.login.invalid", username)); + disconnect(GeyserLocale.getPlayerLocaleString("geyser.auth.login.invalid.kick", getClientData().getLanguageCode())); } catch (RequestException ex) { disconnect(ex.getMessage()); } @@ -654,7 +658,7 @@ public class GeyserSession implements CommandSender { */ public void authenticateWithMicrosoftCode() { if (loggedIn) { - geyser.getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().getName())); + geyser.getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().getName())); return; } @@ -700,7 +704,7 @@ public class GeyserSession implements CommandSender { GameProfile profile = msaAuthenticationService.getSelectedProfile(); if (profile == null) { // Java account is offline - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); + disconnect(GeyserLocale.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); return null; } @@ -787,8 +791,8 @@ public class GeyserSession implements CommandSender { } } catch (Exception e) { - geyser.getLogger().error(LanguageUtils.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); - disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.floodgate.encryption_fail", getClientData().getLanguageCode())); + geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); + disconnect(GeyserLocale.getPlayerLocaleString("geyser.auth.floodgate.encryption_fail", getClientData().getLanguageCode())); return; } @@ -817,11 +821,11 @@ public class GeyserSession implements CommandSender { if (downstream instanceof LocalSession) { // Connected directly to the server - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect_internal", + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.connect_internal", authData.getName(), protocol.getProfile().getName())); } else { // Connected to an IP address - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.connect", + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.connect", authData.getName(), protocol.getProfile().getName(), remoteAddress)); } @@ -841,13 +845,13 @@ public class GeyserSession implements CommandSender { // Let the user know there locale may take some time to download // as it has to be extracted from a JAR - if (locale.equalsIgnoreCase("en_us") && !LocaleUtils.LOCALE_MAPPINGS.containsKey("en_us")) { + if (locale.equalsIgnoreCase("en_us") && !MinecraftLocale.LOCALE_MAPPINGS.containsKey("en_us")) { // This should probably be left hardcoded as it will only show for en_us clients sendMessage("Loading your locale (en_us); if this isn't already downloaded, this may take some time"); } // Download and load the language for the player - LocaleUtils.downloadAndLoadLocale(locale); + MinecraftLocale.downloadAndLoadLocale(locale); } @Override @@ -860,9 +864,9 @@ public class GeyserSession implements CommandSender { if (cause instanceof UnexpectedEncryptionException) { if (remoteAuthType != AuthType.FLOODGATE) { // Server expects online mode - disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", getLocale()); + disconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", getLocale()); // Explain that they may be looking for Floodgate. - geyser.getLogger().warning(LanguageUtils.getLocaleStringLog( + geyser.getLogger().warning(GeyserLocale.getLocaleStringLog( geyser.getPlatformType() == PlatformType.STANDALONE ? "geyser.network.remote.floodgate_explanation_standalone" : "geyser.network.remote.floodgate_explanation_plugin", @@ -870,22 +874,22 @@ public class GeyserSession implements CommandSender { )); } else { // Likely that Floodgate is not configured correctly. - disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", getLocale()); + disconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", getLocale()); if (geyser.getPlatformType() == PlatformType.STANDALONE) { - geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone")); + geyser.getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone")); } } } else if (cause instanceof ConnectException) { // Server is offline, probably - disconnectMessage = LanguageUtils.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale()); + disconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.server_offline", getLocale()); } else { disconnectMessage = MessageTranslator.convertMessageLenient(event.getReason()); } if (downstream instanceof LocalSession) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); } else { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); } if (cause != null) { cause.printStackTrace(); @@ -897,12 +901,12 @@ public class GeyserSession implements CommandSender { @Override public void packetReceived(PacketReceivedEvent event) { Packet packet = event.getPacket(); - PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(packet.getClass(), packet, GeyserSession.this); + Registries.JAVA_PACKET_TRANSLATORS.translate(packet.getClass(), packet, GeyserSession.this); } @Override public void packetError(PacketErrorEvent event) { - geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.downstream_error", event.getCause().getMessage())); + geyser.getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.network.downstream_error", event.getCause().getMessage())); if (geyser.getConfig().isDebugMode()) event.getCause().printStackTrace(); event.setSuppress(true); @@ -936,7 +940,7 @@ public class GeyserSession implements CommandSender { } public void close() { - disconnect(LanguageUtils.getPlayerLocaleString("geyser.network.close", getClientData().getLanguageCode())); + disconnect(GeyserLocale.getPlayerLocaleString("geyser.network.close", getClientData().getLanguageCode())); } /** diff --git a/core/src/main/java/org/geysermc/geyser/SessionManager.java b/core/src/main/java/org/geysermc/geyser/session/SessionManager.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/SessionManager.java rename to core/src/main/java/org/geysermc/geyser/session/SessionManager.java index b6ff28a1c..c5f30d3b2 100644 --- a/core/src/main/java/org/geysermc/geyser/SessionManager.java +++ b/core/src/main/java/org/geysermc/geyser/session/SessionManager.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser; +package org.geysermc.geyser.session; import com.google.common.collect.ImmutableList; import lombok.AccessLevel; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -81,7 +81,7 @@ public final class SessionManager { public void disconnectAll(String message) { Collection sessions = getAllSessions(); for (GeyserSession session : sessions) { - session.disconnect(LanguageUtils.getPlayerLocaleString(message, session.getLocale())); + session.disconnect(GeyserLocale.getPlayerLocaleString(message, session.getLocale())); } } diff --git a/core/src/main/java/org/geysermc/geyser/network/session/UpstreamSession.java b/core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/session/UpstreamSession.java rename to core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java index a96b0448f..88dc360bf 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/UpstreamSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session; +package org.geysermc.geyser.session; import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.BedrockServerSession; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java b/core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java rename to core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java index 76ea66f55..eb142eec6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/auth/AuthData.java +++ b/core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.auth; +package org.geysermc.geyser.session.auth; import com.fasterxml.jackson.databind.JsonNode; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/common/AuthType.java b/core/src/main/java/org/geysermc/geyser/session/auth/AuthType.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/common/AuthType.java rename to core/src/main/java/org/geysermc/geyser/session/auth/AuthType.java index ea5812663..00427e7e4 100644 --- a/core/src/main/java/org/geysermc/geyser/common/AuthType.java +++ b/core/src/main/java/org/geysermc/geyser/session/auth/AuthType.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common; +package org.geysermc.geyser.session.auth; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/auth/BedrockClientData.java b/core/src/main/java/org/geysermc/geyser/session/auth/BedrockClientData.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/session/auth/BedrockClientData.java rename to core/src/main/java/org/geysermc/geyser/session/auth/BedrockClientData.java index f463e247c..b0c0b16b0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/auth/BedrockClientData.java +++ b/core/src/main/java/org/geysermc/geyser/session/auth/BedrockClientData.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.auth; +package org.geysermc.geyser.session.auth; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/AdvancementsCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/AdvancementsCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java index f8b9ca808..b6dde975c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/AdvancementsCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.utils.GeyserAdvancement; -import org.geysermc.geyser.utils.LanguageUtils; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.level.GeyserAdvancement; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; import org.geysermc.cumulus.SimpleForm; import org.geysermc.cumulus.response.SimpleFormResponse; @@ -72,7 +72,7 @@ public class AdvancementsCache { public void buildAndShowMenuForm() { SimpleForm.Builder builder = SimpleForm.builder() - .translator(LocaleUtils::getLocaleString, session.getLocale()) + .translator(MinecraftLocale::getLocaleString, session.getLocale()) .title("gui.advancements"); boolean hasAdvancements = false; @@ -146,7 +146,7 @@ public class AdvancementsCache { } } - builder.button(LanguageUtils.getPlayerLocaleString("gui.back", language)); + builder.button(GeyserLocale.getPlayerLocaleString("gui.back", language)); builder.responseHandler((form, responseData) -> { SimpleFormResponse response = form.parseResponse(responseData); @@ -195,7 +195,7 @@ public class AdvancementsCache { String earned = isEarned(advancement) ? "yes" : "no"; String description = getColorFromAdvancementFrameType(advancement) + MessageTranslator.convertMessage(advancement.getDisplayData().getDescription(), language); - String earnedString = LanguageUtils.getPlayerLocaleString("geyser.advancements.earned", language, LocaleUtils.getLocaleString("gui." + earned, language)); + String earnedString = GeyserLocale.getPlayerLocaleString("geyser.advancements.earned", language, MinecraftLocale.getLocaleString("gui." + earned, language)); /* Layout will look like: @@ -211,14 +211,14 @@ public class AdvancementsCache { String content = description + "\n\n§f" + earnedString + "\n"; if (!currentAdvancementCategoryId.equals(advancement.getParentId())) { // Only display the parent if it is not the category - content += LanguageUtils.getPlayerLocaleString("geyser.advancements.parentid", language, MessageTranslator.convertMessage(storedAdvancements.get(advancement.getParentId()).getDisplayData().getTitle(), language)); + content += GeyserLocale.getPlayerLocaleString("geyser.advancements.parentid", language, MessageTranslator.convertMessage(storedAdvancements.get(advancement.getParentId()).getDisplayData().getTitle(), language)); } session.sendForm( SimpleForm.builder() .title(MessageTranslator.convertMessage(advancement.getDisplayData().getTitle())) .content(content) - .button(LanguageUtils.getPlayerLocaleString("gui.back", language)) + .button(GeyserLocale.getPlayerLocaleString("gui.back", language)) .responseHandler((form, responseData) -> { SimpleFormResponse response = form.parseResponse(responseData); if (response.isCorrect()) { diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/BookEditCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/BookEditCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java index 74708b442..faaeafdb9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/BookEditCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; import lombok.Setter; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; /** * Manages updating the current writable book. diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/BossBar.java rename to core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java index 4443275e9..9595a3daf 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; @@ -32,8 +32,8 @@ import com.nukkitx.protocol.bedrock.packet.BossEventPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import lombok.AllArgsConstructor; import net.kyori.adventure.text.Component; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; @AllArgsConstructor public class BossBar { diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/ChunkCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/ChunkCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java index 197139eba..522c00d2a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/ChunkCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.chunk.GeyserChunk; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.level.chunk.GeyserChunk; +import org.geysermc.geyser.util.MathUtils; public class ChunkCache { private final boolean cache; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/EntityCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java index cd34bb50d..eb1bc6e9a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import it.unimi.dsi.fastutil.longs.Long2LongMap; import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; @@ -32,10 +32,10 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Getter; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.Tickable; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.Tickable; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; import java.util.*; import java.util.concurrent.atomic.AtomicLong; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityEffectCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/EntityEffectCache.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/EntityEffectCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/EntityEffectCache.java index 12f99a384..95c059475 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/EntityEffectCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/EntityEffectCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import lombok.Getter; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/FormCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/FormCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java index 020da79e9..6f7d180de 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/FormCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.nukkitx.protocol.bedrock.packet.ModalFormRequestPacket; import com.nukkitx.protocol.bedrock.packet.ModalFormResponsePacket; @@ -32,7 +32,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.SimpleForm; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/LodestoneCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/LodestoneCache.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/LodestoneCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/LodestoneCache.java index adcfdbaa2..bd3c73574 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/LodestoneCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/LodestoneCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/PistonCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/PistonCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java index 67f4c490d..05e59a5bb 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/PistonCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; @@ -33,11 +33,11 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntity; -import org.geysermc.geyser.utils.Axis; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; +import org.geysermc.geyser.level.physics.Axis; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/PreferencesCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/PreferencesCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java index b71ca17ff..534045f81 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/PreferencesCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.CooldownUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.CooldownUtils; @Getter public class PreferencesCache { diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/TagCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/TagCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java index 985f1ba2c..32827cfec 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/TagCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/TagCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; import it.unimi.dsi.fastutil.ints.IntList; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/TeleportCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/TeleportCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java index 7ca5b9ed5..cc9a7c09f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/TeleportCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/TeleportCache.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.nukkitx.math.vector.Vector3d; import lombok.Data; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/WorldBorder.java rename to core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java index 65dbf3e29..5c486af49 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldBorder.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.nukkitx.math.GenericMath; import com.nukkitx.math.vector.Vector2d; @@ -34,8 +34,8 @@ import com.nukkitx.protocol.bedrock.packet.PlayerFogPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nonnull; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/session/cache/WorldCache.java rename to core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java index a0c4ba9c6..a9564b157 100644 --- a/core/src/main/java/org/geysermc/geyser/network/session/cache/WorldCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.session.cache; +package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater.ScoreboardSession; diff --git a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java index f9106319f..d07e06597 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java @@ -32,9 +32,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.Constants; -import org.geysermc.geyser.utils.PluginMessageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.Constants; +import org.geysermc.geyser.util.PluginMessageUtils; import org.geysermc.floodgate.util.WebsocketEventType; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; @@ -48,7 +48,7 @@ import java.util.List; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -import static org.geysermc.geyser.utils.PluginMessageUtils.getSkinChannel; +import static org.geysermc.geyser.util.PluginMessageUtils.getSkinChannel; public final class FloodgateSkinUploader { private final ObjectMapper JACKSON = new ObjectMapper(); diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index eeb4a5138..454456800 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -31,11 +31,11 @@ import com.nukkitx.protocol.bedrock.data.skin.ImageData; import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.auth.BedrockClientData; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.auth.BedrockClientData; +import org.geysermc.geyser.text.GeyserLocale; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -192,7 +192,7 @@ public class SkinManager { session.sendUpstreamPacket(playerRemovePacket); } } catch (Exception e) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); } if (skinAndCapeConsumer != null) { @@ -204,7 +204,7 @@ public class SkinManager { public static void handleBedrockSkin(PlayerEntity playerEntity, BedrockClientData clientData) { GeyserImpl geyser = GeyserImpl.getInstance(); if (geyser.getConfig().isDebugMode()) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.skin.bedrock.register", playerEntity.getUsername(), playerEntity.getUuid())); } try { @@ -218,7 +218,7 @@ public class SkinManager { SkinProvider.storeBedrockSkin(playerEntity.getUuid(), clientData.getSkinId(), skinBytes); SkinProvider.storeBedrockGeometry(playerEntity.getUuid(), geometryNameBytes, geometryBytes); } else if (geyser.getConfig().isDebugMode()) { - geyser.getLogger().info(LanguageUtils.getLocaleStringLog("geyser.skin.bedrock.fail", playerEntity.getUsername())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.skin.bedrock.fail", playerEntity.getUsername())); geyser.getLogger().debug("The size of '" + playerEntity.getUsername() + "' skin is: " + clientData.getSkinImageWidth() + "x" + clientData.getSkinImageHeight()); } diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java index edb3ad36e..483d0d3e9 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java @@ -37,9 +37,9 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.WebUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.util.WebUtils; import javax.imageio.ImageIO; import java.awt.*; diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java index ae16aee05..100f06caf 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java @@ -29,9 +29,9 @@ import com.nukkitx.protocol.bedrock.data.skin.ImageData; import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; import java.util.function.Consumer; @@ -63,7 +63,7 @@ public class SkullSkinManager extends SkinManager { packet.setTrustedSkin(true); session.sendUpstreamPacket(packet); } catch (Exception e) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); } if (skinConsumer != null) { diff --git a/core/src/main/java/org/geysermc/geyser/common/serializer/AsteriskSerializer.java b/core/src/main/java/org/geysermc/geyser/text/AsteriskSerializer.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/common/serializer/AsteriskSerializer.java rename to core/src/main/java/org/geysermc/geyser/text/AsteriskSerializer.java index 929ac8d9a..9ff55d61b 100644 --- a/core/src/main/java/org/geysermc/geyser/common/serializer/AsteriskSerializer.java +++ b/core/src/main/java/org/geysermc/geyser/text/AsteriskSerializer.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common.serializer; +package org.geysermc.geyser.text; import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/core/src/main/java/org/geysermc/geyser/common/ChatColor.java b/core/src/main/java/org/geysermc/geyser/text/ChatColor.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/common/ChatColor.java rename to core/src/main/java/org/geysermc/geyser/text/ChatColor.java index 6c57cd5c1..29901d857 100644 --- a/core/src/main/java/org/geysermc/geyser/common/ChatColor.java +++ b/core/src/main/java/org/geysermc/geyser/text/ChatColor.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.common; +package org.geysermc.geyser.text; public class ChatColor { diff --git a/core/src/main/java/org/geysermc/geyser/utils/LanguageUtils.java b/core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/LanguageUtils.java rename to core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java index 7d1719d18..36e5aaae1 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/LanguageUtils.java +++ b/core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java @@ -23,9 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.text; import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.util.FileUtils; import java.io.InputStream; import java.io.InputStreamReader; @@ -36,7 +37,7 @@ import java.util.Locale; import java.util.Map; import java.util.Properties; -public class LanguageUtils { +public class GeyserLocale { /** * If we determine the locale that the user wishes to use, use that locale diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/chat/GsonComponentSerializerWrapper.java b/core/src/main/java/org/geysermc/geyser/text/GsonComponentSerializerWrapper.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/chat/GsonComponentSerializerWrapper.java rename to core/src/main/java/org/geysermc/geyser/text/GsonComponentSerializerWrapper.java index 102780856..930d4a62c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/chat/GsonComponentSerializerWrapper.java +++ b/core/src/main/java/org/geysermc/geyser/text/GsonComponentSerializerWrapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.chat; +package org.geysermc.geyser.text; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -38,12 +38,7 @@ import java.util.function.UnaryOperator; /** * A wrapper around a normal GsonComponentSerializer to accept null components. */ -public final class GsonComponentSerializerWrapper implements GsonComponentSerializer { - private final GsonComponentSerializer source; - - public GsonComponentSerializerWrapper(GsonComponentSerializer source) { - this.source = source; - } +public record GsonComponentSerializerWrapper(GsonComponentSerializer source) implements GsonComponentSerializer { @Override public @NotNull Gson serializer() { diff --git a/core/src/main/java/org/geysermc/geyser/utils/LocaleUtils.java b/core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/utils/LocaleUtils.java rename to core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java index b22315f9f..2b42efc86 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/LocaleUtils.java +++ b/core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.text; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -31,6 +31,8 @@ import com.fasterxml.jackson.databind.JsonNode; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.util.WebUtils; import java.io.*; import java.nio.file.Files; @@ -39,7 +41,7 @@ import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.zip.ZipFile; -public class LocaleUtils { +public class MinecraftLocale { public static final Map> LOCALE_MAPPINGS = new HashMap<>(); @@ -54,7 +56,7 @@ public class LocaleUtils { localesFolder.mkdir(); // Download the latest asset list and cache it - generateAssetCache().whenComplete((aVoid, ex) -> downloadAndLoadLocale(LanguageUtils.getDefaultLocale())); + generateAssetCache().whenComplete((aVoid, ex) -> downloadAndLoadLocale(GeyserLocale.getDefaultLocale())); } /** @@ -77,7 +79,7 @@ public class LocaleUtils { // Make sure we definitely got a version if (latestInfoURL.isEmpty()) { - throw new Exception(LanguageUtils.getLocaleStringLog("geyser.locale.fail.latest_version")); + throw new Exception(GeyserLocale.getLocaleStringLog("geyser.locale.fail.latest_version")); } // Get the individual version manifest @@ -104,7 +106,7 @@ public class LocaleUtils { ASSET_MAP.put(entry.getKey(), asset); } } catch (Exception e) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace()))); + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace()))); } return null; }); @@ -124,7 +126,7 @@ public class LocaleUtils { // Check the locale isn't already loaded if (!ASSET_MAP.containsKey("minecraft/lang/" + locale + ".json") && !locale.equals("en_us")) { - GeyserImpl.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.invalid", locale)); + GeyserImpl.getInstance().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.locale.fail.invalid", locale)); return; } @@ -207,7 +209,7 @@ public class LocaleUtils { try { localeStream = new FileInputStream(localeFile); } catch (FileNotFoundException e) { - throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage())); + throw new AssertionError(GeyserLocale.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage())); } // Parse the file as json @@ -215,7 +217,7 @@ public class LocaleUtils { try { localeObj = GeyserImpl.JSON_MAPPER.readTree(localeStream); } catch (Exception e) { - throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.json", locale), e); + throw new AssertionError(GeyserLocale.getLocaleStringLog("geyser.locale.fail.json", locale), e); } // Parse all the locale fields @@ -238,10 +240,10 @@ public class LocaleUtils { try { localeStream.close(); } catch (IOException e) { - throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage())); + throw new AssertionError(GeyserLocale.getLocaleStringLog("geyser.locale.fail.file", locale, e.getMessage())); } } else { - GeyserImpl.getInstance().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.locale.fail.missing", locale)); + GeyserImpl.getInstance().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.locale.fail.missing", locale)); } } @@ -253,7 +255,7 @@ public class LocaleUtils { private static void downloadEN_US(File localeFile) { try { // Let the user know we are downloading the JAR - GeyserImpl.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us")); + GeyserImpl.getInstance().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.locale.download.en_us")); GeyserImpl.getInstance().getLogger().debug("Download URL: " + clientJarInfo.getUrl()); // Download the smallest JAR (client or server) @@ -284,9 +286,9 @@ public class LocaleUtils { // Delete the nolonger needed client/server jar Files.delete(tmpFilePath); - GeyserImpl.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.download.en_us.done")); + GeyserImpl.getInstance().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.locale.download.en_us.done")); } catch (Exception e) { - GeyserImpl.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.en_us"), e); + GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.locale.fail.en_us"), e); } } @@ -298,12 +300,12 @@ public class LocaleUtils { * @return Translated string or the original message if it was not found in the given locale */ public static String getLocaleString(String messageText, String locale) { - Map localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(locale.toLowerCase()); + Map localeStrings = MinecraftLocale.LOCALE_MAPPINGS.get(locale.toLowerCase()); if (localeStrings == null) { - localeStrings = LocaleUtils.LOCALE_MAPPINGS.get(LanguageUtils.getDefaultLocale()); + localeStrings = MinecraftLocale.LOCALE_MAPPINGS.get(GeyserLocale.getDefaultLocale()); if (localeStrings == null) { // Don't cause a NPE if the locale is STILL missing - GeyserImpl.getInstance().getLogger().debug("MISSING DEFAULT LOCALE: " + LanguageUtils.getDefaultLocale()); + GeyserImpl.getInstance().getLogger().debug("MISSING DEFAULT LOCALE: " + GeyserLocale.getDefaultLocale()); return messageText; } } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/chat/MinecraftTranslationRegistry.java b/core/src/main/java/org/geysermc/geyser/text/MinecraftTranslationRegistry.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/chat/MinecraftTranslationRegistry.java rename to core/src/main/java/org/geysermc/geyser/text/MinecraftTranslationRegistry.java index a8a90c1a5..129fb1f40 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/chat/MinecraftTranslationRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/text/MinecraftTranslationRegistry.java @@ -23,10 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.chat; +package org.geysermc.geyser.text; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; -import org.geysermc.geyser.utils.LocaleUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -46,7 +45,7 @@ public class MinecraftTranslationRegistry extends TranslatableComponentRenderer< @Override public @Nullable MessageFormat translate(@Nonnull String key, @Nonnull String locale) { // Get the locale string - String localeString = LocaleUtils.getLocaleString(key, locale); + String localeString = MinecraftLocale.getLocaleString(key, locale); // Replace the `%s` with numbered inserts `{0}` Pattern p = stringReplacement; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/BlockCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/BlockCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java index cc84824cd..964faab0a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/BlockCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionManager; -import org.geysermc.geyser.utils.Axis; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.level.physics.CollisionManager; +import org.geysermc.geyser.level.physics.Axis; @EqualsAndHashCode public class BlockCollision { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionRemapper.java b/core/src/main/java/org/geysermc/geyser/translator/collision/CollisionRemapper.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionRemapper.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/CollisionRemapper.java index c932b1f68..2156cc670 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/CollisionRemapper.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/CollisionRemapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision; +package org.geysermc.geyser.translator.collision; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DirtPathCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/DirtPathCollision.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DirtPathCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/DirtPathCollision.java index 06df05054..a7babead3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DirtPathCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/DirtPathCollision.java @@ -23,12 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionManager; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.level.physics.CollisionManager; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^dirt_path$", passDefaultBoxes = true) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DoorCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DoorCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java index 6c165bd1f..3c858dc92 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/DoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java @@ -23,13 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; -import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "_door$", usesParams = true, passDefaultBoxes = true) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/OtherCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/OtherCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/OtherCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/OtherCollision.java index eeb89b65f..2a81077ca 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/OtherCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/OtherCollision.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.translators.collision.BoundingBox; +import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) public class OtherCollision extends BlockCollision { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/ScaffoldingCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/ScaffoldingCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java index be5e3c028..fddc2e39b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/ScaffoldingCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java @@ -23,12 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; /** * In order for scaffolding to work on Bedrock, entity flags need to be sent to the player diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SnowCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SnowCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java index dc8b095b0..912d6a9b9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SnowCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java @@ -23,12 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^snow$", passDefaultBoxes = true, usesParams = true) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SolidCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/SolidCollision.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SolidCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/SolidCollision.java index c772ff75f..1f47d8abb 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SolidCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/SolidCollision.java @@ -23,11 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "shulker_box$") // These have no collision in the mappings as it depends on the NBT data diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SpawnerCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/SpawnerCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SpawnerCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/SpawnerCollision.java index cef39dba1..698b8f82d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/SpawnerCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/SpawnerCollision.java @@ -23,10 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "^spawner$") diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/TrapdoorCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/TrapdoorCollision.java rename to core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java index 948622640..49b9f6c3f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/collision/translators/TrapdoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java @@ -23,13 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.collision.translators; +package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionManager; -import org.geysermc.geyser.network.translators.collision.CollisionRemapper; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.level.physics.CollisionManager; @EqualsAndHashCode(callSuper = true) @CollisionRemapper(regex = "_trapdoor$", usesParams = true, passDefaultBoxes = true) diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityMetadataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/entity/EntityMetadataTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/entity/EntityMetadataTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/entity/EntityMetadataTranslator.java index fa6758210..e8eba1654 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityMetadataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/entity/EntityMetadataTranslator.java @@ -23,10 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.entity; +package org.geysermc.geyser.translator.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; +import org.geysermc.geyser.entity.type.Entity; import java.util.function.BiConsumer; @@ -36,4 +37,8 @@ import java.util.function.BiConsumer; public record EntityMetadataTranslator>>( MetadataType acceptedType, BiConsumer translateFunction) { + + public void translate(E entity, EM metadata) { + this.translateFunction.accept(entity, metadata); + } } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java index a0b5298a7..d34f5195c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AbstractBlockInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.geyser.network.translators.inventory.holder.InventoryHolder; -import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.inventory.holder.InventoryHolder; +import org.geysermc.geyser.inventory.updater.InventoryUpdater; /** * Provided as a base for any inventory that requires a block for opening it diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AnvilInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AnvilInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java index ce40f0a44..b7aaad7b1 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/AnvilInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; @@ -31,9 +31,9 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.AnvilInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.AnvilInventoryUpdater; public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { public AnvilInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BaseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BaseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java index fb3f2cac4..becca359b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BaseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; @@ -31,10 +31,9 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.SlotType; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; public abstract class BaseInventoryTranslator extends InventoryTranslator { public BaseInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BeaconInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BeaconInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java index 6a5ae2cc5..f0820d9e8 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BeaconInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetBeaconPacket; @@ -41,12 +41,11 @@ import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import org.geysermc.geyser.inventory.BeaconContainer; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.util.InventoryUtils; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BrewingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BrewingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java index a38fbe126..43bea55ab 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/BrewingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator { public BrewingInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CartographyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CartographyInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java index 3e16635ed..08caa7784 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CartographyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; @@ -32,9 +32,9 @@ import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; public class CartographyInventoryTranslator extends AbstractBlockInventoryTranslator { public CartographyInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CraftingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CraftingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java index 6baf2b9ca..ea01dc43d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/CraftingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CraftingInventoryTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; public class CraftingInventoryTranslator extends AbstractBlockInventoryTranslator { public CraftingInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/EnchantingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/EnchantingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java index f0bf1a993..f18a902ff 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/EnchantingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; @@ -37,10 +37,10 @@ import org.geysermc.geyser.inventory.EnchantingContainer; import org.geysermc.geyser.inventory.GeyserEnchantOption; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.geyser.network.translators.item.Enchantment; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.inventory.item.Enchantment; import java.util.Arrays; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/Generic3X3InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/Generic3X3InventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java index eaef37335..4265b39e3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/Generic3X3InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; @@ -31,9 +31,9 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.geyser.inventory.Generic3X3Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; /** * Droppers and dispensers diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/GrindstoneInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/GrindstoneInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java index 501c4be58..fae539db8 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/GrindstoneInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/GrindstoneInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; public class GrindstoneInventoryTranslator extends AbstractBlockInventoryTranslator { public GrindstoneInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/HopperInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/HopperInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java index 44fff7406..9356dcfb6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/HopperInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/HopperInventoryTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; /** * Implemented on top of any block that does not have special properties implemented diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/InventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index 1c11da986..5ddd12702 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -46,17 +46,18 @@ import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.click.Click; -import org.geysermc.geyser.network.translators.inventory.click.ClickPlan; -import org.geysermc.geyser.network.translators.inventory.translators.*; -import org.geysermc.geyser.network.translators.inventory.translators.chest.DoubleChestInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.chest.SingleChestInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.furnace.BlastFurnaceInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.furnace.FurnaceInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.furnace.SmokerInventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; -import org.geysermc.geyser.utils.ItemUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.inventory.click.Click; +import org.geysermc.geyser.inventory.click.ClickPlan; +import org.geysermc.geyser.translator.inventory.chest.DoubleChestInventoryTranslator; +import org.geysermc.geyser.translator.inventory.chest.SingleChestInventoryTranslator; +import org.geysermc.geyser.translator.inventory.furnace.BlastFurnaceInventoryTranslator; +import org.geysermc.geyser.translator.inventory.furnace.FurnaceInventoryTranslator; +import org.geysermc.geyser.translator.inventory.furnace.SmokerInventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; +import org.geysermc.geyser.util.ItemUtils; import java.util.*; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LecternInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LecternInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java index 7b0f4a5f0..b59914a13 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LecternInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; @@ -39,10 +39,10 @@ import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.LecternContainer; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; -import org.geysermc.geyser.utils.BlockEntityUtils; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.util.BlockEntityUtils; +import org.geysermc.geyser.util.InventoryUtils; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LoomInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LoomInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java index bdf5de762..d035543bc 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/LoomInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -43,11 +43,11 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.geyser.network.translators.item.translators.BannerTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.translator.inventory.item.BannerTranslator; import java.util.Collections; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/MerchantInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/MerchantInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java index 130e7cca9..cf0c475f0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/MerchantInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import com.nukkitx.math.vector.Vector3f; @@ -34,16 +34,16 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; public class MerchantInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/PlayerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/PlayerInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java index ace0ae665..3a451891c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/PlayerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -39,20 +39,19 @@ import it.unimi.dsi.fastutil.ints.IntSet; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.utils.InventoryUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.util.InventoryUtils; +import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; import java.util.Collections; import java.util.function.IntFunction; public class PlayerInventoryTranslator extends InventoryTranslator { - private static final IntFunction UNUSUABLE_CRAFTING_SPACE_BLOCK = InventoryUtils.createUnusableSpaceBlock(LanguageUtils.getLocaleStringLog("geyser.inventory.unusable_item.creative")); + private static final IntFunction UNUSUABLE_CRAFTING_SPACE_BLOCK = InventoryUtils.createUnusableSpaceBlock(GeyserLocale.getLocaleStringLog("geyser.inventory.unusable_item.creative")); public PlayerInventoryTranslator() { super(46); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/ShulkerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/ShulkerInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java index a924c05b7..f92474fb3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/ShulkerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.nukkitx.math.vector.Vector3i; @@ -33,11 +33,11 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; -import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; import org.geysermc.geyser.registry.Registries; public class ShulkerInventoryTranslator extends AbstractBlockInventoryTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/SmithingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/SmithingInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java index 3b8d05c69..4e34bca14 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/SmithingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/SmithingInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslator { public SmithingInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/StonecutterInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java index f2b8ac354..ed1f38799 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators; +package org.geysermc.geyser.translator.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; @@ -40,11 +40,11 @@ import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; import org.geysermc.geyser.inventory.StonecutterContainer; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.inventory.updater.UIInventoryUpdater; -import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; public class StonecutterInventoryTranslator extends AbstractBlockInventoryTranslator { public StonecutterInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/ChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/ChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java index 6a88d26d4..417aa5bf3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/ChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.chest; +package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.translators.BaseInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.updater.ChestInventoryUpdater; -import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.translator.inventory.BaseInventoryTranslator; +import org.geysermc.geyser.inventory.updater.ChestInventoryUpdater; +import org.geysermc.geyser.inventory.updater.InventoryUpdater; public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java index 838b11978..a42001d34 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/DoubleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.chest; +package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; @@ -35,10 +35,10 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.block.DoubleChestValue; -import org.geysermc.geyser.network.translators.world.block.entity.DoubleChestBlockEntityTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.level.block.DoubleChestValue; +import org.geysermc.geyser.translator.level.block.entity.DoubleChestBlockEntityTranslator; import org.geysermc.geyser.registry.BlockRegistries; public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java index d6348bc7e..86696b21b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/chest/SingleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.chest; +package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.holder.BlockInventoryHolder; -import org.geysermc.geyser.network.translators.inventory.holder.InventoryHolder; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; +import org.geysermc.geyser.inventory.holder.InventoryHolder; public class SingleChestInventoryTranslator extends ChestInventoryTranslator { private final InventoryHolder holder; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java index d2fa100a6..de7ea4de7 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/AbstractFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.translator.inventory.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; -import org.geysermc.geyser.network.translators.inventory.SlotType; -import org.geysermc.geyser.network.translators.inventory.translators.AbstractBlockInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.updater.ContainerInventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.SlotType; +import org.geysermc.geyser.translator.inventory.AbstractBlockInventoryTranslator; +import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; public abstract class AbstractFurnaceInventoryTranslator extends AbstractBlockInventoryTranslator { AbstractFurnaceInventoryTranslator(String javaBlockIdentifier, ContainerType containerType) { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java index 7d1b14683..7839d5370 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/BlastFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/BlastFurnaceInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.translator.inventory.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.BedrockContainerSlot; public class BlastFurnaceInventoryTranslator extends AbstractFurnaceInventoryTranslator { public BlastFurnaceInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java index e6c563bd5..5c9030197 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/FurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/FurnaceInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.translator.inventory.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.BedrockContainerSlot; public class FurnaceInventoryTranslator extends AbstractFurnaceInventoryTranslator { public FurnaceInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java index 68583c8b0..350e00de3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/furnace/SmokerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/SmokerInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.furnace; +package org.geysermc.geyser.translator.inventory.furnace; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.BedrockContainerSlot; public class SmokerInventoryTranslator extends AbstractFurnaceInventoryTranslator { public SmokerInventoryTranslator() { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java index d9549e5a8..b4c49cb12 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/AbstractHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.horse; +package org.geysermc.geyser.translator.inventory.horse; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.translators.BaseInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.updater.HorseInventoryUpdater; -import org.geysermc.geyser.network.translators.inventory.updater.InventoryUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.BaseInventoryTranslator; +import org.geysermc.geyser.inventory.updater.HorseInventoryUpdater; +import org.geysermc.geyser.inventory.updater.InventoryUpdater; public abstract class AbstractHorseInventoryTranslator extends BaseInventoryTranslator { private final InventoryUpdater updater; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java index bd7cfb9f9..79f34da57 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/ChestedHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.horse; +package org.geysermc.geyser.translator.inventory.horse; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; @@ -31,8 +31,8 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.inventory.BedrockContainerSlot; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/DonkeyInventoryTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/horse/DonkeyInventoryTranslator.java index f73c43973..ea0a580f0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/DonkeyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/DonkeyInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.horse; +package org.geysermc.geyser.translator.inventory.horse; public class DonkeyInventoryTranslator extends ChestedHorseInventoryTranslator { public DonkeyInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/HorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/HorseInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java index da06a5c18..429125362 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/HorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/HorseInventoryTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.horse; +package org.geysermc.geyser.translator.inventory.horse; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; -import org.geysermc.geyser.network.translators.inventory.BedrockContainerSlot; +import org.geysermc.geyser.inventory.BedrockContainerSlot; public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator { public HorseInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/LlamaInventoryTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/horse/LlamaInventoryTranslator.java index c7e98d7c1..97aa7edf2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/inventory/translators/horse/LlamaInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/LlamaInventoryTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.inventory.translators.horse; +package org.geysermc.geyser.translator.inventory.horse; public class LlamaInventoryTranslator extends ChestedHorseInventoryTranslator { public LlamaInventoryTranslator(int size) { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/BannerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/BannerTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/BannerTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/BannerTranslator.java index f905d015e..d2c9e5dd6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/BannerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/BannerTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators; +package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; @@ -33,8 +33,6 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.ItemTranslator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/CompassTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/CompassTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java index 7eb3f7a3e..7367e28db 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/CompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/CompassTranslator.java @@ -23,14 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators; +package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.ItemTranslator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/ItemRemapper.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemRemapper.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/ItemRemapper.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemRemapper.java index 57947d497..651228c15 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/ItemRemapper.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemRemapper.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators; +package org.geysermc.geyser.translator.inventory.item; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/ItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/ItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java index 3429dcdd7..046db67c9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/ItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item; +package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; @@ -35,14 +35,13 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; -import org.geysermc.geyser.utils.FileUtils; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.MinecraftLocale; import javax.annotation.Nonnull; import java.util.*; @@ -445,7 +444,7 @@ public abstract class ItemTranslator { String translationKey = mapping.getTranslationString(); // Reset formatting since Bedrock defaults to italics - display.put(new StringTag("Name", "§r§" + translationColor + LocaleUtils.getLocaleString(translationKey, session.getLocale()))); + display.put(new StringTag("Name", "§r§" + translationColor + MinecraftLocale.getLocaleString(translationKey, session.getLocale()))); } return tag; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/NbtItemStackTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/NbtItemStackTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java index bac48bdd0..6c2c501fd 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/NbtItemStackTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item; +package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; public class NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/PotionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/PotionTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java index 6c7cde0b0..5455b1189 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/PotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/PotionTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators; +package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; @@ -31,9 +31,7 @@ import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.Potion; +import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/TippedArrowTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/TippedArrowTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java index 7c2f929ee..01ecbb09f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/TippedArrowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/TippedArrowTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators; +package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.StringTag; @@ -31,9 +31,7 @@ import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.network.translators.item.TippedArrowPotion; +import org.geysermc.geyser.inventory.item.TippedArrowPotion; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/AxolotlBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java similarity index 83% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/AxolotlBucketTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java index 0cf9c5041..071ead230 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/AxolotlBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.text.MinecraftLocale; @ItemRemapper public class AxolotlBucketTranslator extends NbtItemStackTranslator { @@ -42,7 +42,7 @@ public class AxolotlBucketTranslator extends NbtItemStackTranslator { // Bedrock Edition displays the properties of the axolotl. Java does not. // To work around this, set the custom name to the Axolotl translation and it's displayed correctly itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); - itemTag.put(new StringTag("CustomName", LocaleUtils.getLocaleString("entity.minecraft.axolotl", session.getLocale()))); + itemTag.put(new StringTag("CustomName", MinecraftLocale.getLocaleString("entity.minecraft.axolotl", session.getLocale()))); // Boilerplate required so the nametag does not appear as "Bucket of " itemTag.put(new StringTag("ColorID", "")); itemTag.put(new StringTag("BodyID", "")); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BasicItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BasicItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java index d0a7d93a3..10ad58544 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BasicItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.ItemUtils; +import org.geysermc.geyser.util.ItemUtils; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BookPagesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BookPagesTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java index 0ee644359..b3371aab7 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/BookPagesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/CrossbowTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/CrossbowTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java index 21deac983..e1dda45ed 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/CrossbowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantedBookTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantedBookTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java index 5dfdb192a..8a009bc2d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantedBookTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper(priority = 1) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantmentTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java index f4352f3c3..ddc5f3780 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/EnchantmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; -import org.geysermc.geyser.network.translators.item.Enchantment; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; +import org.geysermc.geyser.inventory.item.Enchantment; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkBaseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkBaseTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkBaseTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkBaseTranslator.java index 31e58f984..c68f4f4d9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkBaseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkBaseTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteArrayTag; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; -import org.geysermc.geyser.utils.FireworkColor; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; +import org.geysermc.geyser.level.FireworkColor; +import org.geysermc.geyser.util.MathUtils; /** * Stores common code for firework rockets and firework stars. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkRocketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkRocketTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java index 624c7b5ff..8c1154dea 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkRocketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.util.MathUtils; @ItemRemapper public class FireworkRocketTranslator extends FireworkBaseTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkStarTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkStarTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java index 68c87f2cb..e66589f6d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/FireworkStarTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LeatherArmorTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LeatherArmorTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java index abd6e24ed..ddf76b595 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LeatherArmorTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LodestoneCompassTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LodestoneCompassTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java index 25c00ec0a..924735626 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/LodestoneCompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/MapItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/MapItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java index 9eb1693c8..23739340e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/MapItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @ItemRemapper diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/PlayerHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/PlayerHeadTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java index a3f3f10a0..1e182568a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/PlayerHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.text.MinecraftLocale; @ItemRemapper public class PlayerHeadTranslator extends NbtItemStackTranslator { @@ -56,7 +56,7 @@ public class PlayerHeadTranslator extends NbtItemStackTranslator { } // Add correct name of player skull // TODO: It's always yellow, even with a custom name. Handle? - String displayName = "\u00a7r\u00a7e" + LocaleUtils.getLocaleString("block.minecraft.player_head.named", session.getLocale()).replace("%s", name.getValue()); + String displayName = "\u00a7r\u00a7e" + MinecraftLocale.getLocaleString("block.minecraft.player_head.named", session.getLocale()).replace("%s", name.getValue()); if (!itemTag.contains("display")) { itemTag.put(new CompoundTag("display")); } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java index f7fbbab54..f4160ec08 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/ShulkerBoxItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java @@ -23,15 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.Identifier; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.item.*; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; +import org.geysermc.geyser.util.MathUtils; @ItemRemapper public class ShulkerBoxItemTranslator extends NbtItemStackTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java index 6b6d17933..316ebc1ae 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/item/translators/nbt/TropicalFishBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.item.translators.nbt; +package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.Style; import net.kyori.adventure.text.format.TextDecoration; -import org.geysermc.geyser.entity.living.animal.TropicalFishEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.ItemRemapper; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.translators.item.NbtItemStackTranslator; +import org.geysermc.geyser.entity.type.living.animal.TropicalFishEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.item.ItemRemapper; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.text.MinecraftLocale; import java.util.ArrayList; import java.util.List; @@ -50,7 +50,7 @@ public class TropicalFishBucketTranslator extends NbtItemStackTranslator { public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { // Prevent name from appearing as "Bucket of" itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); - itemTag.put(new StringTag("CustomName", LocaleUtils.getLocaleString("entity.minecraft.tropical_fish", session.getLocale()))); + itemTag.put(new StringTag("CustomName", MinecraftLocale.getLocaleString("entity.minecraft.tropical_fish", session.getLocale()))); // Add Java's client side lore tag Tag bucketVariantTag = itemTag.get("BucketVariantTag"); if (bucketVariantTag instanceof IntTag) { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/BiomeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/BiomeTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java index 7f24dfe94..6cafb6012 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/BiomeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world; +package org.geysermc.geyser.translator.level; import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage; import com.github.steveice10.mc.protocol.data.game.chunk.DataPalette; @@ -35,14 +35,14 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.chunk.BlockStorage; -import org.geysermc.geyser.network.translators.world.chunk.GeyserChunkSection; -import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArray; -import org.geysermc.geyser.network.translators.world.chunk.bitarray.BitArrayVersion; -import org.geysermc.geyser.network.translators.world.chunk.bitarray.SingletonBitArray; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.chunk.BlockStorage; +import org.geysermc.geyser.level.chunk.GeyserChunkSection; +import org.geysermc.geyser.level.chunk.bitarray.BitArray; +import org.geysermc.geyser.level.chunk.bitarray.BitArrayVersion; +import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.MathUtils; +import org.geysermc.geyser.util.MathUtils; // Array index formula by https://wiki.vg/Chunk_Format public class BiomeTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BannerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BannerBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java index e0911738d..9cd1981c6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BannerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BannerBlockEntityTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.network.translators.item.translators.BannerTranslator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.translator.inventory.item.BannerTranslator; +import org.geysermc.geyser.level.block.BlockStateValues; @BlockEntity(type = BlockEntityType.BANNER) public class BannerBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BeaconBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BeaconBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java index 1c0007cc4..d6492bffe 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BeaconBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BeaconBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java index 76a2e1726..fe7971105 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedBlockEntityTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.level.block.BlockStateValues; @BlockEntity(type = BlockEntityType.BED) public class BedBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedrockOnlyBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedrockOnlyBlockEntity.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java index e1a3ffb45..bc96a6e0d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BedrockOnlyBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; /** * Implemented only if a block is a block entity in Bedrock and not Java Edition. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntity.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntity.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntity.java index 987f62151..32b765166 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java index 84d86e36e..03e2bb3de 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/BlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -32,7 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.util.BlockEntityUtils; /** * The class that all block entities (on both Java and Bedrock) should translate with diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CampfireBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CampfireBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java index 255d8a52c..7880f8106 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CampfireBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CampfireBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java index 68d0e76fa..bb01e4d39 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/CommandBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.translator.text.MessageTranslator; @BlockEntity(type = BlockEntityType.COMMAND_BLOCK) public class CommandBlockBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java index 43c872a75..e41f9e492 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/DoubleChestBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.block.DoubleChestValue; -import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.level.block.DoubleChestValue; +import org.geysermc.geyser.util.BlockEntityUtils; /** * Chests have more block entity properties in Bedrock, which is solved by implementing the BedrockOnlyBlockEntity diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EmptyBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EmptyBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java index 259beb742..e5abe74a7 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EmptyBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EmptyBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMapBuilder; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java index 310d272a6..530bcf241 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/EndGatewayBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/EndGatewayBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java index b497e6eab..b6c498d9f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/FlowerPotBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.util.BlockEntityUtils; public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity { /** diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java index b38a370a5..a94804164 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/JigsawBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/JigsawBlockBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java index 8adea545d..1d61d0e30 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/NoteblockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; /** * Does not implement BlockEntityTranslator because it's only a block entity in Bedrock diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntity.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java index dca5a6ed9..1363f6641 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.nukkitx.math.vector.Vector3d; @@ -37,14 +37,16 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Getter; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.PistonCache; -import org.geysermc.geyser.network.translators.collision.BoundingBox; -import org.geysermc.geyser.network.translators.collision.CollisionManager; -import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.level.physics.Axis; +import org.geysermc.geyser.level.physics.Direction; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.PistonCache; +import org.geysermc.geyser.level.physics.BoundingBox; +import org.geysermc.geyser.level.physics.CollisionManager; +import org.geysermc.geyser.translator.collision.BlockCollision; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.*; +import org.geysermc.geyser.util.*; import java.util.LinkedList; import java.util.Map; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java index c39112fb2..2f29cdef6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/PistonBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntityTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.level.block.BlockStateValues; /** * Pistons are a special case where they are only a block entity on Bedrock. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/RequiresBlockState.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/RequiresBlockState.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/RequiresBlockState.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/RequiresBlockState.java index b6df97ec2..990ae314e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/RequiresBlockState.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/RequiresBlockState.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; /** * Implemented in block entities if their Java block state is required for additional values in Bedrock diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java index ad2855f0a..8b934f29b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/ShulkerBoxBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/ShulkerBoxBlockEntityTranslator.java @@ -23,19 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.translator.inventory.ShulkerInventoryTranslator; import javax.annotation.Nullable; @BlockEntity(type = BlockEntityType.SHULKER_BOX) public class ShulkerBoxBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { /** - * Also used in {@link org.geysermc.geyser.network.translators.inventory.translators.ShulkerInventoryTranslator} + * Also used in {@link ShulkerInventoryTranslator} * where {@code tag} is passed as null. */ @Override diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SignBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SignBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java index 386e16fb8..0eaabae12 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SignBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SignBlockEntityTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.utils.SignUtils; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.util.SignUtils; @BlockEntity(type = BlockEntityType.SIGN) public class SignBlockEntityTranslator extends BlockEntityTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SkullBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java index f32fef041..b6b41db6d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; @@ -34,9 +34,9 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.player.SkullPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.skin.SkinProvider; import org.geysermc.geyser.skin.SkullSkinManager; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java index 017cd03b7..d9aebc479 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/block/entity/SpawnerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.block.entity; +package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/LevelEventTransformer.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/event/LevelEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java index 2949bfad4..63bf0a7d9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/LevelEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.event; +package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; /** * Represents an event capable of translating itself into bedrock */ -public interface LevelEventTransformer { +public interface LevelEventTranslator { /** * Translates the given {@link ClientboundLevelEventPacket} into bedrock and sends it upstream. * * @param session GeyserSession * @param packet the effect packet to handle */ - void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet); + void translate(GeyserSession session, ClientboundLevelEventPacket packet); } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/PlaySoundEventTransformer.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java similarity index 83% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/event/PlaySoundEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java index 194b62948..df882d0d0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/PlaySoundEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.event; +package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; -public record PlaySoundEventTransformer(String name, float volume, boolean pitchSub, float pitchMul, - float pitchAdd, boolean relative) implements LevelEventTransformer { +public record PlaySoundEventTranslator(String name, float volume, boolean pitchSub, float pitchMul, + float pitchAdd, boolean relative) implements LevelEventTranslator { @Override - public void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { Random rand = ThreadLocalRandom.current(); PlaySoundPacket playSoundPacket = new PlaySoundPacket(); playSoundPacket.setSound(name); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundEventEventTransformer.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundEventEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java index 425e28c9b..5c3e890a2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundEventEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.event; +package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; -public record SoundEventEventTransformer(SoundEvent soundEvent, - String identifier, int extraData) implements LevelEventTransformer { +public record SoundEventEventTranslator(SoundEvent soundEvent, + String identifier, int extraData) implements LevelEventTranslator { @Override - public void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { LevelSoundEventPacket levelSoundEvent = new LevelSoundEventPacket(); levelSoundEvent.setSound(soundEvent); levelSoundEvent.setIdentifier(identifier); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundLevelEventTransformer.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java similarity index 83% rename from core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundLevelEventTransformer.java rename to core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java index f15d2a7ad..48a4bf2fd 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/world/event/SoundLevelEventTransformer.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.world.event; +package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; -public record SoundLevelEventTransformer(LevelEventType levelEventType, - int data) implements LevelEventTransformer { +public record SoundLevelEventTranslator(LevelEventType levelEventType, + int data) implements LevelEventTranslator { @Override - public void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { LevelEventPacket eventPacket = new LevelEventPacket(); eventPacket.setType(levelEventType); eventPacket.setData(data); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java index b10d62b33..37485120d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/PacketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java @@ -23,9 +23,9 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators; +package org.geysermc.geyser.translator.protocol; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public abstract class PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/Translator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/Translator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/Translator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/Translator.java index ceb254fa2..3dc812170 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/Translator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/Translator.java @@ -22,7 +22,7 @@ * @author GeyserMC * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators; +package org.geysermc.geyser.translator.protocol; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -30,5 +30,4 @@ import java.lang.annotation.RetentionPolicy; @Retention(value = RetentionPolicy.RUNTIME) public @interface Translator { Class packet(); - } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAdventureSettingsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAdventureSettingsTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java index 1a3cb4c05..d4de9e22a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAdventureSettingsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = AdventureSettingsPacket.class) public class BedrockAdventureSettingsTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAnimateTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java index 52c4d8a38..d52a66be7 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockEntityDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java index 65eadc610..828f5a934 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetJigsawBlockPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.SignUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.SignUtils; @Translator(packet = BlockEntityDataPacket.class) public class BedrockBlockEntityDataTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockPickRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java index 1d34ec07b..a0bd43455 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.ItemFrameEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.entity.type.ItemFrameEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.util.InventoryUtils; @Translator(packet = BlockPickRequestPacket.class) public class BedrockBlockPickRequestTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBookEditTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBookEditTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java index afc2a4e77..bead427db 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockBookEditTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; @@ -33,9 +33,9 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.packet.BookEditPacket; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.nio.charset.StandardCharsets; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java index 138b69b6e..f0cf4ff8c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = CommandBlockUpdatePacket.class) public class BedrockCommandBlockUpdateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java index 636caf703..a67b81434 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockCommandRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.protocol.bedrock.packet.CommandRequestPacket; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = CommandRequestPacket.class) public class BedrockCommandRequestTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockContainerCloseTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java index 9c05d3ddd..4c1f55018 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.InventoryUtils; @Translator(packet = ContainerClosePacket.class) public class BedrockContainerCloseTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEmoteListTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEmoteListTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java index 54adbab8a..dac5fe638 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEmoteListTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.EmoteListPacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = EmoteListPacket.class) public class BedrockEmoteListTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEntityPickRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java index ed236d7e7..732142573 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.nukkitx.protocol.bedrock.packet.EntityPickRequestPacket; -import org.geysermc.geyser.entity.BoatEntity; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.BoatEntity; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.util.InventoryUtils; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockFilterTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockFilterTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java index 99ebdfa6d..b7961c8fb 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockFilterTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket; import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.CartographyContainer; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.utils.ItemUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.util.ItemUtils; /** * Used to send strings to the server and filter out unwanted words. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockInventoryTransactionTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java index 33c475cb1..d779ab339 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; @@ -40,20 +40,20 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.geyser.entity.CommandBlockMinecartEntity; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.CommandBlockMinecartEntity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.ItemFrameEntity; +import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.sound.EntitySoundInteractionHandler; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.util.BlockUtils; import java.util.concurrent.TimeUnit; @@ -366,7 +366,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPlayerInputTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPlayerInputTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java index a1b807a6a..75199ae74 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPlayerInputTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundMoveVehiclePacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPlayerInputPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerInputPacket; -import org.geysermc.geyser.entity.BoatEntity; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.BoatEntity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.entity.living.animal.horse.LlamaEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.entity.type.living.animal.horse.LlamaEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * Sent by the client for minecarts and boats. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index eaacfe65a..59082ccdc 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.LodestoneCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.LodestoneCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.DimensionUtils; @Translator(packet = PositionTrackingDBClientRequestPacket.class) public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockRespawnTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java index 8cefa57d3..59712da7f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = RespawnPacket.class) public class BedrockRespawnTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java index b19626a6b..1840c9b0d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ServerSettingsRequestPacket; import com.nukkitx.protocol.bedrock.packet.ServerSettingsResponsePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.SettingsUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.SettingsUtils; import org.geysermc.cumulus.CustomForm; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index 8f3d734d7..bc6d1f4e4 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.LoginEncryptionUtils; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.LoginEncryptionUtils; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockShowCreditsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockShowCreditsTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java index 95de61b54..19797b8a2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockShowCreditsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java @@ -23,11 +23,11 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java index 8b4fc9dde..3cf121cf9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/BedrockTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock; +package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = TextPacket.class) public class BedrockTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/BedrockEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/BedrockEntityEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java index 21d7f087c..775ec15b5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/BedrockEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.entity; +package org.geysermc.geyser.translator.protocol.bedrock.entity; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSelectTradePacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockActionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockActionTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java index 89e770f82..711285948 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockActionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.entity.player; +package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; @@ -36,17 +36,17 @@ import com.nukkitx.protocol.bedrock.data.PlayerActionType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.ItemFrameEntity; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.ItemFrameEntity; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMapping; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.util.BlockUtils; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java index 8721c96b0..a4fe12d4e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.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.protocol.bedrock.packet.EmotePacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.BlockUtils; @Translator(packet = EmotePacket.class) public class BedrockEmoteTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockInteractTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockInteractTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java index 5273c1c97..26a25725e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockInteractTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.entity.player; +package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.InteractAction; @@ -35,12 +35,12 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.InteractPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.InteractiveTagManager; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.entity.InteractiveTagManager; @Translator(packet = InteractPacket.class) public class BedrockInteractTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java index 190b9a2ef..98dd7832c 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.entity.player; +package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; @@ -33,12 +33,12 @@ import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import org.geysermc.geyser.common.ChatColor; +import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = MovePlayerPacket.class) public class BedrockMovePlayerTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java index d52c2fc81..79911b5e7 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockRiderJumpTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.entity.player; +package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerCommandPacket; import com.nukkitx.protocol.bedrock.packet.RiderJumpPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = RiderJumpPacket.class) public class BedrockRiderJumpTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java index 80d5f9840..b149f8836 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.entity.player; +package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * In vanilla Bedrock, if you have operator status, this sets the player's gamemode without confirmation from the server. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java index 1b1532ffa..2ac8587bf 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/bedrock/world/BedrockLevelSoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.bedrock.world; +package org.geysermc.geyser.translator.protocol.bedrock.world; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.CooldownUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.CooldownUtils; @Translator(packet = LevelSoundEventPacket.class) public class BedrockLevelSoundEventTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaAwardStatsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaAwardStatsTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java index 2258f6f16..8f4e93635 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaAwardStatsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.StatisticsUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.StatisticsUtils; @Translator(packet = ClientboundAwardStatsPacket.class) public class JavaAwardStatsTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaBossEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaBossEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java index 994783f86..2c49baa56 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaBossEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.BossBar; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.BossBar; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBossEventPacket; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChangeDifficultyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChangeDifficultyTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java index 71f914a75..e0c3a9b95 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChangeDifficultyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; @Translator(packet = ClientboundChangeDifficultyPacket.class) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChatTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChatTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java index 8e9984124..ca8be2374 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = ClientboundChatPacket.class) public class JavaChatTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCommandsTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index 68ac54302..d0ab68d8f 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.command.CommandNode; import com.github.steveice10.mc.protocol.data.game.command.CommandParser; @@ -43,13 +43,13 @@ import lombok.Getter; import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.item.Enchantment; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.inventory.item.Enchantment; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.EntityUtils; +import org.geysermc.geyser.util.EntityUtils; import java.util.*; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomPayloadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomPayloadTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java index 20a0f46a7..4506cee46 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomPayloadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomPayloadTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; @@ -31,10 +31,10 @@ import com.google.common.base.Charsets; import com.nukkitx.protocol.bedrock.packet.TransferPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.Forms; import org.geysermc.cumulus.util.FormType; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomQueryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomQueryTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomQueryTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomQueryTranslator.java index e8a1bb6a7..268b69f45 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaCustomQueryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCustomQueryTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundCustomQueryPacket; import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * For the login cycle. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaDisconnectTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java index 2d1b83413..e073e6f27 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = ClientboundDisconnectPacket.class) public class JavaDisconnectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaGameProfileTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaGameProfileTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java index 0458b9dbc..307c27c29 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaGameProfileTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundGameProfilePacket.class) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaKeepAliveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaKeepAliveTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java index 81fee0d3a..680debe49 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaKeepAliveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket; import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * Used to forward the keep alive packet to the client in order to get back a reliable ping. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginDisconnectTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java index f35cf0e5a..ce5fabe30 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = ClientboundLoginDisconnectPacket.class) public class JavaLoginDisconnectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java index 8fb5c29e7..855f5b144 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaLoginTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference; import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility; @@ -34,15 +34,15 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCu import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.geyser.common.AuthType; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.BiomeTranslator; -import org.geysermc.geyser.utils.ChunkUtils; -import org.geysermc.geyser.utils.DimensionUtils; -import org.geysermc.geyser.utils.PluginMessageUtils; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.level.BiomeTranslator; +import org.geysermc.geyser.util.ChunkUtils; +import org.geysermc.geyser.util.DimensionUtils; +import org.geysermc.geyser.util.PluginMessageUtils; import java.util.Arrays; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaPingTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaPingTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java index d71d733cb..a3b2e34b7 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaPingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; // Why does this packet exist? Whatever, we better implement it @Translator(packet = ClientboundPingPacket.class) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRecipeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRecipeTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java index 64c82b3fe..0a329f607 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRecipeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.UnlockRecipesAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRespawnTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java index 80484a50f..8f97b1a8d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket; import com.nukkitx.math.vector.Vector3f; @@ -31,13 +31,13 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.utils.ChunkUtils; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.util.ChunkUtils; +import org.geysermc.geyser.util.DimensionUtils; @Translator(packet = ClientboundRespawnPacket.class) public class JavaRespawnTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaSelectAdvancementsTabTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaSelectAdvancementsTabTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java index a3606f598..3f82dffb1 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaSelectAdvancementsTabTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.AdvancementsCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.AdvancementsCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * Indicates that the client should open a particular advancement tab diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateAdvancementsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateAdvancementsTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java index 3dd9306b8..c1f6f77d2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/JavaUpdateAdvancementsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java; +package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.session.cache.AdvancementsCache; -import org.geysermc.geyser.utils.GeyserAdvancement; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.session.cache.AdvancementsCache; +import org.geysermc.geyser.level.GeyserAdvancement; +import org.geysermc.geyser.text.MinecraftLocale; import java.util.Map; @@ -89,7 +89,7 @@ public class JavaUpdateAdvancementsTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaAnimateTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java index 1e6aad75e..d7fc79f1e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundAnimatePacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AnimateEntityPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.DimensionUtils; @Translator(packet = ClientboundAnimatePacket.class) public class JavaAnimateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaEntityEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java index e41232865..1c3239d69 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundEntityEventPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; @@ -32,13 +32,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.FishingHookEntity; -import org.geysermc.geyser.entity.LivingEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.FishingHookEntity; +import org.geysermc.geyser.entity.type.LivingEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.concurrent.ThreadLocalRandom; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java index b3edb9f52..4f15b0717 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosRotPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundMoveEntityPosRotPacket.class) public class JavaMoveEntityPosRotTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java index 710f9b8dd..aeb080465 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityPosTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundMoveEntityPosPacket.class) public class JavaMoveEntityPosTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityRotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityRotTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java index fa7c7cd47..b2b59480b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveEntityRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundMoveEntityRotPacket.class) public class JavaMoveEntityRotTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveVehicleTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveVehicleTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java index 522fdc548..90e121250 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaMoveVehicleTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundMoveVehiclePacket.class) public class JavaMoveVehicleTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveEntitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveEntitiesTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java index ea21ecd9b..043756db0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveEntitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundRemoveEntitiesPacket.class) public class JavaRemoveEntitiesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveMobEffectTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java index 1cab3fac1..bc78bb33e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRemoveMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.EntityUtils; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.EntityUtils; @Translator(packet = ClientboundRemoveMobEffectPacket.class) public class JavaRemoveMobEffectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRotateHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRotateHeadTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java index d9595034b..edcad7af6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaRotateHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundRotateHeadPacket.class) public class JavaRotateHeadTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java index 37803bffc..987e5fcb2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java @@ -23,20 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; -import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.entity.EntityMetadataTranslator; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.InteractiveTagManager; - -import java.util.List; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.entity.InteractiveTagManager; @Translator(packet = ClientboundSetEntityDataPacket.class) public class JavaSetEntityDataTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityLinkTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityLinkTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityLinkTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityLinkTranslator.java index aeae1a7e5..88f1c8ae1 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityLinkTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityLinkTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityLinkPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.MobEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.MobEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * Called when a leash is attached, removed or updated from an entity diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityMotionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityMotionTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java index 886ba0c04..5febe4813 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEntityMotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.ItemEntity; -import org.geysermc.geyser.entity.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.ItemEntity; +import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityMotionPacket; import com.nukkitx.math.vector.Vector3f; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEquipmentTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java index 3e3ec0e8b..0058ed61e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEquipmentPacket; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.LivingEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.LivingEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @Translator(packet = ClientboundSetEquipmentPacket.class) public class JavaSetEquipmentTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetPassengersTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetPassengersTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java index 63045f213..f4a6f94ed 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaSetPassengersTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetPassengersPacket; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.EntityUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.EntityUtils; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaTakeItemEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaTakeItemEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java index b8829e213..75d7bc976 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaTakeItemEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTakeItemEntityPacket; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.TakeItemEntityPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.ExpOrbEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.ExpOrbEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; /** * This packet is called whenever a player picks up an item. diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaTeleportEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaTeleportEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java index 8949db2f0..cbd994d79 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaTeleportEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTeleportEntityPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundTeleportEntityPacket.class) public class JavaTeleportEntityTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateAttributesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateAttributesTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java index 005150693..c3a4e4ac4 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateAttributesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateAttributesPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.LivingEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.LivingEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundUpdateAttributesPacket.class) public class JavaUpdateAttributesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateMobEffectTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java index 89d1068cb..2d4161739 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/JavaUpdateMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity; +package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.EntityUtils; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.EntityUtils; @Translator(packet = ClientboundUpdateMobEffectPacket.class) public class JavaUpdateMobEffectTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java index 732db378b..6fbdb4fc6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaBlockBreakAckTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.player; +package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundBlockBreakAckPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.util.ChunkUtils; @Translator(packet = ClientboundBlockBreakAckPacket.class) public class JavaBlockBreakAckTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java index dea92355d..98b69a0b8 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.player; +package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundPlayerAbilitiesPacket.class) public class JavaPlayerAbilitiesTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerInfoTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerInfoTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java index d9365fffb..252287edc 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerInfoTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.player; +package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.data.game.PlayerListEntry; import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction; @@ -31,10 +31,10 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPl import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundPlayerInfoPacket.class) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerPositionTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java index 682ebef00..3e94321f9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaPlayerPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.player; +package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.data.game.entity.player.PositionElement; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; @@ -34,16 +34,16 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.TeleportCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.ChunkUtils; -import org.geysermc.geyser.utils.EntityUtils; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.TeleportCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.ChunkUtils; +import org.geysermc.geyser.util.EntityUtils; +import org.geysermc.geyser.text.GeyserLocale; @Translator(packet = ClientboundPlayerPositionPacket.class) public class JavaPlayerPositionTranslator extends PacketTranslator { @@ -84,7 +84,7 @@ public class JavaPlayerPositionTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetExperienceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetExperienceTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java index db0d92e02..3ac9bf9e3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetExperienceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.player; +package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetExperiencePacket; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.Arrays; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetHealthTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetHealthTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java index 4e30983c3..8e96ed42e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/player/JavaSetHealthTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java @@ -23,17 +23,17 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.player; +package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket; import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.SetHealthPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.entity.player.SessionPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.List; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddEntityTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java index 9ab1d390c..b80b59ff4 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.spawn; +package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.object.FallingBlockData; @@ -33,12 +33,16 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn. import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.*; import org.geysermc.geyser.entity.factory.BaseEntityFactory; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.FallingBlockEntity; +import org.geysermc.geyser.entity.type.FishingHookEntity; +import org.geysermc.geyser.entity.type.ItemFrameEntity; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; @Translator(packet = ClientboundAddEntityPacket.class) public class JavaAddEntityTranslator extends PacketTranslator { @@ -52,7 +56,7 @@ public class JavaAddEntityTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); if (definition == null) { - session.getGeyser().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); + session.getGeyser().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.entity.type_null", packet.getType())); return; } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java index ff7eeeb79..33e230c14 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddExperienceOrbTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.spawn; +package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddExperienceOrbPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.ExpOrbEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.ExpOrbEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundAddExperienceOrbPacket.class) public class JavaAddExperienceOrbTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddMobTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddMobTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java index 424be58e8..e6b82f365 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddMobTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.spawn; +package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddMobPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.factory.BaseEntityFactory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; @Translator(packet = ClientboundAddMobPacket.class) public class JavaAddMobTranslator extends PacketTranslator { @@ -46,7 +46,7 @@ public class JavaAddMobTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); if (definition == null) { - session.getGeyser().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.entity.type_null", packet.getType())); + session.getGeyser().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.entity.type_null", packet.getType())); return; } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java index fe523a032..433d78477 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPaintingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.spawn; +package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.entity.PaintingEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.PaintingType; +import org.geysermc.geyser.entity.type.PaintingEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.PaintingType; @Translator(packet = ClientboundAddPaintingPacket.class) public class JavaAddPaintingTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java index 24d7cb705..74dcaf022 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/entity/spawn/JavaAddPlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.entity.spawn; +package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundAddPlayerPacket.class) @@ -52,7 +52,7 @@ public class JavaAddPlayerTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetContentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetContentTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java index dcc6968c5..0d572ca92 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetContentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.inventory; +package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; @Translator(packet = ClientboundContainerSetContentPacket.class) public class JavaContainerSetContentTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java similarity index 84% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java index d0e767bd1..2ffab0d38 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.inventory; +package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; @Translator(packet = ClientboundContainerSetDataPacket.class) public class JavaContainerSetDataTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetSlotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetSlotTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java index 9957439af..54cc91ca6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaContainerSetSlotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.inventory; +package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient; @@ -39,14 +39,14 @@ import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.CraftingInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.PlayerInventoryTranslator; -import org.geysermc.geyser.network.translators.item.ItemTranslator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.translator.inventory.CraftingInventoryTranslator; +import org.geysermc.geyser.translator.inventory.PlayerInventoryTranslator; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.util.InventoryUtils; import java.util.Arrays; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java index 26d836532..4e672bdf9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaHorseScreenOpenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaHorseScreenOpenTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.inventory; +package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket; import com.nukkitx.nbt.NbtMap; @@ -31,18 +31,18 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.UpdateEquipPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.animal.horse.ChestedHorseEntity; -import org.geysermc.geyser.entity.living.animal.horse.LlamaEntity; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.animal.horse.ChestedHorseEntity; +import org.geysermc.geyser.entity.type.living.animal.horse.LlamaEntity; import org.geysermc.geyser.inventory.Container; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.horse.DonkeyInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.horse.HorseInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.horse.LlamaInventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.translator.inventory.horse.DonkeyInventoryTranslator; +import org.geysermc.geyser.translator.inventory.horse.HorseInventoryTranslator; +import org.geysermc.geyser.translator.inventory.horse.LlamaInventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; import java.util.ArrayList; import java.util.Collections; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaMerchantOffersTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaMerchantOffersTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java index 799f7051a..8f917c1e4 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaMerchantOffersTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaMerchantOffersTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.inventory; +package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; @@ -35,13 +35,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.UpdateTradePacket; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.item.ItemTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.ArrayList; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaOpenScreenTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaOpenScreenTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java index bd2f9d3a2..69066eb39 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/inventory/JavaOpenScreenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java @@ -23,18 +23,18 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.inventory; +package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundOpenScreenPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.utils.InventoryUtils; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.util.InventoryUtils; +import org.geysermc.geyser.text.MinecraftLocale; @Translator(packet = ClientboundOpenScreenPacket.class) public class JavaOpenScreenTranslator extends PacketTranslator { @@ -58,7 +58,7 @@ public class JavaOpenScreenTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEntityDataTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java index aa756d094..1c11b298e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -32,14 +32,14 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.geyser.network.translators.world.block.entity.RequiresBlockState; -import org.geysermc.geyser.network.translators.world.block.entity.SkullBlockEntityTranslator; -import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.translator.level.block.entity.RequiresBlockState; +import org.geysermc.geyser.translator.level.block.entity.SkullBlockEntityTranslator; +import org.geysermc.geyser.util.BlockEntityUtils; @Translator(packet = ClientboundBlockEntityDataPacket.class) public class JavaBlockEntityDataTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java index d4501f7eb..3504168a5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.level.block.value.*; @@ -35,14 +35,14 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.PistonCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.block.entity.NoteblockBlockEntityTranslator; -import org.geysermc.geyser.network.translators.world.block.entity.PistonBlockEntity; -import org.geysermc.geyser.utils.Direction; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.PistonCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.translator.level.block.entity.NoteblockBlockEntityTranslator; +import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; +import org.geysermc.geyser.level.physics.Direction; @Translator(packet = ClientboundBlockEventPacket.class) public class JavaBlockEventTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockUpdateTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java index aa5a3ac56..298bd4b90 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket; @@ -31,12 +31,12 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.util.ChunkUtils; @Translator(packet = ClientboundBlockUpdatePacket.class) public class JavaBlockUpdateTranslator extends PacketTranslator { @@ -103,6 +103,6 @@ public class JavaBlockUpdateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaForgetLevelChunkTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaForgetLevelChunkTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java index f800d77a8..8204ceea5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaForgetLevelChunkTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; import com.nukkitx.math.vector.Vector3i; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import java.util.Iterator; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaGameEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaGameEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java index 82adf99cd..642f707a8 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaGameEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.ClientCommand; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -38,12 +38,12 @@ import com.nukkitx.protocol.bedrock.data.GameRuleData; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.packet.*; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.inventory.translators.PlayerInventoryTranslator; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.inventory.PlayerInventoryTranslator; +import org.geysermc.geyser.text.MinecraftLocale; @Translator(packet = ClientboundGameEventPacket.class) public class JavaGameEventTranslator extends PacketTranslator { @@ -152,7 +152,7 @@ public class JavaGameEventTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelEventTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java index a16b4207c..d861d0338 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.event.BonemealGrowEventData; import com.github.steveice10.mc.protocol.data.game.level.event.BreakBlockEventData; @@ -42,12 +42,12 @@ import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.event.LevelEventTransformer; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.level.event.LevelEventTranslator; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.LocaleUtils; +import org.geysermc.geyser.text.MinecraftLocale; import java.util.Collections; import java.util.Locale; @@ -82,16 +82,16 @@ public class JavaLevelEventTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java index 49c852bcf..c301ee462 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSectionBlocksUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.ChunkUtils; @Translator(packet = ClientboundSectionBlocksUpdatePacket.class) public class JavaSectionBlocksUpdateTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java index a9c0526a8..901a4d82e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.ChunkUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.ChunkUtils; import com.nukkitx.math.vector.Vector3i; @Translator(packet = ClientboundSetChunkCacheCenterPacket.class) diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java index f170d430c..50ed540ea 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetChunkCacheRadiusTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetChunkCacheRadiusPacket.class) public class JavaSetChunkCacheRadiusTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java index fbae567fc..8067341e1 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetDefaultSpawnPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.utils.DimensionUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.DimensionUtils; @Translator(packet = ClientboundSetDefaultSpawnPositionPacket.class) public class JavaSetDefaultSpawnPositionTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetTimeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetTimeTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java index 62ee60d2d..9ff6965ca 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSetTimeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; import com.nukkitx.protocol.bedrock.packet.SetTimePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetTimePacket.class) public class JavaSetTimeTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSoundTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java index 7e6d1f979..e9f9337aa 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket; import com.nukkitx.math.vector.Vector3f; @@ -31,12 +31,12 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.utils.SoundUtils; +import org.geysermc.geyser.util.SoundUtils; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.SoundMapping; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaStopSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaStopSoundTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java index 283309165..75a99f0af 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/JavaStopSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java @@ -23,15 +23,15 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level; +package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.SoundMapping; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaInitializeBorderTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaInitializeBorderTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java index 5f1bc1585..1f7ea7657 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaInitializeBorderTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level.border; +package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldBorder; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundInitializeBorderPacket.class) public class JavaInitializeBorderTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderCenterTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java index 4051382f4..6895cf944 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level.border; +package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldBorder; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetBorderCenterPacket.class) public class JavaSetBorderCenterTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java similarity index 86% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java index 7d068b031..3eae4b1f5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderLerpSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level.border; +package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldBorder; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetBorderLerpSizePacket.class) public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderSizeTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java index 12f93d5cc..076924735 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level.border; +package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderSizePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldBorder; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetBorderSizePacket.class) public class JavaSetBorderSizeTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java index 9e5b75df1..b3104fb9a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDelayTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level.border; +package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDelayPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldBorder; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetBorderWarningDelayPacket.class) public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java index b3dbc083b..b4483b9a6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/level/border/JavaSetBorderWarningDistanceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.level.border; +package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDistancePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldBorder; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldBorder; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetBorderWarningDistancePacket.class) public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java similarity index 88% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java index ac150d3a1..fe141486e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetDisplayObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.scoreboard; +package org.geysermc.geyser.translator.protocol.java.scoreboard; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java index 77969cf84..927fb5488 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java @@ -23,19 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.scoreboard; +package org.geysermc.geyser.translator.protocol.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetObjectivePacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java similarity index 95% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java index 00b8c76cb..fa5bd10e1 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetPlayerTeamTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.scoreboard; +package org.geysermc.geyser.translator.protocol.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.NameTagVisibility; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamAction; @@ -31,10 +31,10 @@ import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetPlayerTeamPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater; import org.geysermc.geyser.scoreboard.Team; diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetScoreTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetScoreTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetScoreTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetScoreTranslator.java index 4216a34dd..111ec4538 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/scoreboard/JavaSetScoreTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetScoreTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.scoreboard; +package org.geysermc.geyser.translator.protocol.java.scoreboard; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; @@ -32,15 +32,15 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.entity.player.PlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.WorldCache; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.entity.type.player.PlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.WorldCache; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.text.GeyserLocale; @Translator(packet = ClientboundSetScorePacket.class) public class JavaSetScoreTranslator extends PacketTranslator { @@ -58,7 +58,7 @@ public class JavaSetScoreTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetActionBarTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetActionBarTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java index b5e5806f7..914ddafb9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetActionBarTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.title; +package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = ClientboundSetActionBarTextPacket.class) public class JavaSetActionBarTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetSubtitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetSubtitleTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java index 4865a4e00..521f5eba6 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetSubtitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.title; +package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetSubtitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = ClientboundSetSubtitleTextPacket.class) public class JavaSetSubtitleTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java similarity index 87% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitleTextTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java index 8d54ac704..04eb76bb5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.title; +package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; -import org.geysermc.geyser.network.translators.chat.MessageTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.text.MessageTranslator; @Translator(packet = ClientboundSetTitleTextPacket.class) public class JavaSetTitleTextTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitlesAnimationTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java similarity index 89% rename from core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitlesAnimationTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java index e00a61db9..b8bbc780a 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/java/title/JavaSetTitlesAnimationTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java @@ -23,13 +23,13 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.java.title; +package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitlesAnimationPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.PacketTranslator; -import org.geysermc.geyser.network.translators.Translator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = ClientboundSetTitlesAnimationPacket.class) public class JavaSetTitlesAnimationTranslator extends PacketTranslator { diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/BlockSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java similarity index 90% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/BlockSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java index 7fbc5d6f4..5e6e8d9e8 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/BlockSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound; +package org.geysermc.geyser.translator.sound; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -32,16 +32,16 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.utils.BlockUtils; +import org.geysermc.geyser.util.BlockUtils; import java.util.Map; /** * Sound interaction handler for when a block is right-clicked. */ -public interface BlockSoundInteractionHandler extends SoundInteractionHandler { +public interface BlockSoundInteractionTranslator extends SoundInteractionTranslator { /** * Handles the block interaction when a player @@ -55,8 +55,8 @@ public interface BlockSoundInteractionHandler extends SoundInteractionHandler> interactionEntry : Registries.SOUND_HANDLERS.get().entrySet()) { - if (!(interactionEntry.getValue() instanceof BlockSoundInteractionHandler)) { + for (Map.Entry> interactionEntry : Registries.SOUND_TRANSLATORS.get().entrySet()) { + if (!(interactionEntry.getValue() instanceof BlockSoundInteractionTranslator)) { continue; } if (interactionEntry.getKey().blocks().length != 0) { @@ -91,7 +91,7 @@ public interface BlockSoundInteractionHandler extends SoundInteractionHandler { +public interface EntitySoundInteractionTranslator extends SoundInteractionTranslator { /** * Handles the block interaction when a player @@ -50,8 +50,8 @@ public interface EntitySoundInteractionHandler extends SoundInteractionHandler> interactionEntry : Registries.SOUND_HANDLERS.get().entrySet()) { - if (!(interactionEntry.getValue() instanceof EntitySoundInteractionHandler)) { + for (Map.Entry> interactionEntry : Registries.SOUND_TRANSLATORS.get().entrySet()) { + if (!(interactionEntry.getValue() instanceof EntitySoundInteractionTranslator)) { continue; } if (interactionEntry.getKey().entities().length != 0) { @@ -87,7 +87,7 @@ public interface EntitySoundInteractionHandler extends SoundInteractionHandler the value */ -public interface SoundInteractionHandler { +public interface SoundInteractionTranslator { /** * Handles the interaction when a player @@ -48,5 +48,5 @@ public interface SoundInteractionHandler { * @param position the position of the block * @param value the value */ - void handleInteraction(GeyserSession session, Vector3f position, T value); + void translate(GeyserSession session, Vector3f position, T value); } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/SoundTranslator.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/SoundTranslator.java index def77300d..be8257993 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/SoundHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/SoundTranslator.java @@ -23,24 +23,24 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound; +package org.geysermc.geyser.translator.sound; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Marks if a class should be handled as a - * {@link SoundInteractionHandler}. + * {@link SoundInteractionTranslator}. */ @Retention(value = RetentionPolicy.RUNTIME) -public @interface SoundHandler { +public @interface SoundTranslator { /** * The identifier(s) that the placed block must contain * one of. Leave empty to ignore. * * Only applies to interaction handlers that are an - * instance of {@link BlockSoundInteractionHandler}. + * instance of {@link BlockSoundInteractionTranslator}. * * @return the value the interacted block must contain */ @@ -59,7 +59,7 @@ public @interface SoundHandler { * Leave empty to ignore. * * Only applies to interaction handlers that are an - * instance of {@link EntitySoundInteractionHandler}. + * instance of {@link EntitySoundInteractionTranslator}. * * @return the value the item in the player's hand must contain */ diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/BucketSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java similarity index 85% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/BucketSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java index 7e3148e38..1af30e658 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/BucketSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java @@ -23,27 +23,27 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler(items = "bucket", ignoreSneakingWhileHolding = true) -public class BucketSoundInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(items = "bucket", ignoreSneakingWhileHolding = true) +public class BucketSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { if (session.getBucketScheduledFuture() == null) { return; // No bucket was really interacted with } GeyserItemStack itemStack = session.getPlayerInventory().getItemInHand(); String handItemIdentifier = itemStack.getMapping(session).getJavaIdentifier(); - if (!BlockSoundInteractionHandler.canInteract(session, itemStack, identifier)) { + if (!BlockSoundInteractionTranslator.canInteract(session, itemStack, identifier)) { return; } LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/ComparatorSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java similarity index 78% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/ComparatorSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java index 31c18d2b3..8c10076d3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/ComparatorSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler(blocks = "comparator") -public class ComparatorSoundInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(blocks = "comparator") +public class ComparatorSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { boolean powered = identifier.contains("mode=compare"); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/DoorSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java similarity index 77% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/DoorSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java index 952bf18ae..1115760eb 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/DoorSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler(blocks = {"door", "fence_gate"}) -public class DoorSoundInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(blocks = {"door", "fence_gate"}) +public class DoorSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { if (identifier.contains("iron")) return; LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setType(LevelEventType.SOUND_DOOR_OPEN); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/FlintAndSteelInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java similarity index 77% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/FlintAndSteelInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java index 59d12d202..09e86f461 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/FlintAndSteelInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler(items = "flint_and_steel", ignoreSneakingWhileHolding = true) -public class FlintAndSteelInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(items = "flint_and_steel", ignoreSneakingWhileHolding = true) +public class FlintAndSteelInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/HoeInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java similarity index 79% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/HoeInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java index 7cfbc7813..6c91b24a0 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/HoeInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java @@ -23,21 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; import org.geysermc.geyser.registry.BlockRegistries; -@SoundHandler(blocks = "farmland", items = "hoe", ignoreSneakingWhileHolding = true) -public class HoeInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(blocks = "grass_path", items = "shovel", ignoreSneakingWhileHolding = true) +public class GrassPathInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/GrassPathInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java similarity index 78% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/GrassPathInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java index b9f838e14..799364498 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/GrassPathInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java @@ -23,21 +23,21 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; import org.geysermc.geyser.registry.BlockRegistries; -@SoundHandler(blocks = "grass_path", items = "shovel", ignoreSneakingWhileHolding = true) -public class GrassPathInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(blocks = "farmland", items = "hoe", ignoreSneakingWhileHolding = true) +public class HoeInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/LeverSoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java similarity index 78% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/block/LeverSoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java index 5cfaac2ec..a57d337b1 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/block/LeverSoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java @@ -23,20 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.block; +package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.BlockSoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler(blocks = "lever") -public class LeverSoundInteractionHandler implements BlockSoundInteractionHandler { +@SoundTranslator(blocks = "lever") +public class LeverSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { boolean powered = identifier.contains("powered=true"); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/FeedBabySoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java similarity index 75% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/FeedBabySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java index fa4c1a48f..ea160538e 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/FeedBabySoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java @@ -23,24 +23,24 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.entity; +package org.geysermc.geyser.translator.sound.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.animal.AnimalEntity; -import org.geysermc.geyser.entity.living.animal.OcelotEntity; -import org.geysermc.geyser.entity.living.animal.tameable.CatEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.EntitySoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; +import org.geysermc.geyser.entity.type.living.animal.OcelotEntity; +import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler -public class FeedBabySoundInteractionHandler implements EntitySoundInteractionHandler { +@SoundTranslator +public class FeedBabySoundInteractionTranslator implements EntitySoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, Entity entity) { + public void translate(GeyserSession session, Vector3f position, Entity entity) { if (entity instanceof AnimalEntity animalEntity && !(entity instanceof CatEntity || entity instanceof OcelotEntity)) { String handIdentifier = session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier(); boolean isBaby = animalEntity.isBaby(); diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java similarity index 79% rename from core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java rename to core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java index eb6060378..e8698ff23 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/sound/entity/MilkEntitySoundInteractionHandler.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java @@ -23,23 +23,23 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.sound.entity; +package org.geysermc.geyser.translator.sound.entity; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.entity.living.animal.GoatEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.sound.EntitySoundInteractionHandler; -import org.geysermc.geyser.network.translators.sound.SoundHandler; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.entity.type.living.animal.GoatEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; +import org.geysermc.geyser.translator.sound.SoundTranslator; -@SoundHandler(entities = {"cow", "goat"}, items = "bucket") -public class MilkEntitySoundInteractionHandler implements EntitySoundInteractionHandler { +@SoundTranslator(entities = {"cow", "goat"}, items = "bucket") +public class MilkEntitySoundInteractionTranslator implements EntitySoundInteractionTranslator { @Override - public void handleInteraction(GeyserSession session, Vector3f position, Entity value) { + public void translate(GeyserSession session, Vector3f position, Entity value) { if (!session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier().equals("minecraft:bucket")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/network/translators/chat/MessageTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/network/translators/chat/MessageTranslator.java rename to core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java index 4b03d4b20..d22b47768 100644 --- a/core/src/main/java/org/geysermc/geyser/network/translators/chat/MessageTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.network.translators.chat; +package org.geysermc.geyser.translator.text; import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer; import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor; @@ -33,8 +33,10 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.utils.LanguageUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.MinecraftTranslationRegistry; +import org.geysermc.geyser.text.GsonComponentSerializerWrapper; +import org.geysermc.geyser.text.GeyserLocale; import java.util.EnumMap; import java.util.Map; @@ -131,11 +133,11 @@ public class MessageTranslator { } public static String convertMessage(String message) { - return convertMessage(message, LanguageUtils.getDefaultLocale()); + return convertMessage(message, GeyserLocale.getDefaultLocale()); } public static String convertMessage(Component message) { - return convertMessage(message, LanguageUtils.getDefaultLocale()); + return convertMessage(message, GeyserLocale.getDefaultLocale()); } /** @@ -166,7 +168,7 @@ public class MessageTranslator { } public static String convertMessageLenient(String message) { - return convertMessageLenient(message, LanguageUtils.getDefaultLocale()); + return convertMessageLenient(message, GeyserLocale.getDefaultLocale()); } /** @@ -226,7 +228,7 @@ public class MessageTranslator { */ public static boolean isTooLong(String message, GeyserSession session) { if (message.length() > 256) { - session.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.chat.too_long", session.getLocale(), message.length())); + session.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.chat.too_long", session.getLocale(), message.length())); return true; } diff --git a/core/src/main/java/org/geysermc/geyser/utils/AttributeUtils.java b/core/src/main/java/org/geysermc/geyser/util/AttributeUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/AttributeUtils.java rename to core/src/main/java/org/geysermc/geyser/util/AttributeUtils.java index f83d87c52..56ef71f91 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/AttributeUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/AttributeUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeModifier; diff --git a/core/src/main/java/org/geysermc/geyser/utils/BlockEntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java similarity index 92% rename from core/src/main/java/org/geysermc/geyser/utils/BlockEntityUtils.java rename to core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java index 78c9860f5..6d4258d7e 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/BlockEntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; @@ -31,10 +31,10 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.entity.BedrockOnlyBlockEntity; -import org.geysermc.geyser.network.translators.world.block.entity.BlockEntityTranslator; -import org.geysermc.geyser.network.translators.world.block.entity.FlowerPotBlockEntityTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity; +import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; +import org.geysermc.geyser.translator.level.block.entity.FlowerPotBlockEntityTranslator; import org.geysermc.geyser.registry.Registries; import javax.annotation.Nonnull; diff --git a/core/src/main/java/org/geysermc/geyser/utils/BlockUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/BlockUtils.java rename to core/src/main/java/org/geysermc/geyser/util/BlockUtils.java index fc66abd05..c43cc3311 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/BlockUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.collision.translators.BlockCollision; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.collision.BlockCollision; +import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.BlockMapping; import org.geysermc.geyser.registry.type.ItemMapping; diff --git a/core/src/main/java/org/geysermc/geyser/utils/ChunkUtils.java b/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java similarity index 93% rename from core/src/main/java/org/geysermc/geyser/utils/ChunkUtils.java rename to core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java index 650faccc1..cb80e209b 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/ChunkUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -38,17 +38,18 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import it.unimi.dsi.fastutil.ints.IntLists; import lombok.experimental.UtilityClass; -import org.geysermc.geyser.entity.ItemFrameEntity; -import org.geysermc.geyser.entity.player.SkullPlayerEntity; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.block.BlockStateValues; -import org.geysermc.geyser.network.translators.world.block.entity.BedrockOnlyBlockEntity; -import org.geysermc.geyser.network.translators.world.chunk.BlockStorage; -import org.geysermc.geyser.network.translators.world.chunk.GeyserChunkSection; -import org.geysermc.geyser.network.translators.world.chunk.bitarray.SingletonBitArray; +import org.geysermc.geyser.entity.type.ItemFrameEntity; +import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity; +import org.geysermc.geyser.level.chunk.BlockStorage; +import org.geysermc.geyser.level.chunk.GeyserChunkSection; +import org.geysermc.geyser.level.chunk.bitarray.SingletonBitArray; import org.geysermc.geyser.registry.BlockRegistries; -import static org.geysermc.geyser.network.translators.world.block.BlockStateValues.JAVA_AIR_ID; +import static org.geysermc.geyser.level.block.BlockStateValues.JAVA_AIR_ID; @UtilityClass public class ChunkUtils { @@ -253,7 +254,7 @@ public class ChunkUtils { // The constraints change depending on if the player is in the overworld or not, and if experimental height is enabled if (minY < (extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) || maxY > (extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT)) { - session.getGeyser().getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds", + session.getGeyser().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.network.translator.chunk.out_of_bounds", extendedHeight ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT, extendedHeight ? MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD : MAXIMUM_ACCEPTED_HEIGHT, session.getDimension())); diff --git a/core/src/main/java/org/geysermc/geyser/utils/CooldownUtils.java b/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/CooldownUtils.java rename to core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java index 8f72fafd8..c149996b8 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/CooldownUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import lombok.Getter; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.cache.PreferencesCache; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.cache.PreferencesCache; import java.util.concurrent.TimeUnit; diff --git a/core/src/main/java/org/geysermc/geyser/utils/DimensionUtils.java b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/DimensionUtils.java rename to core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java index 974fdb2c7..c729c0b1e 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/DimensionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; @@ -33,8 +33,8 @@ import com.nukkitx.protocol.bedrock.packet.ChangeDimensionPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.entity.Entity; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.entity.type.Entity; +import org.geysermc.geyser.session.GeyserSession; import java.util.Set; diff --git a/core/src/main/java/org/geysermc/geyser/utils/EntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/EntityUtils.java rename to core/src/main/java/org/geysermc/geyser/util/EntityUtils.java index 96a94a966..224a617b6 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/EntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java @@ -23,16 +23,16 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.Effect; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.Entity; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.entity.living.ArmorStandEntity; -import org.geysermc.geyser.entity.living.animal.AnimalEntity; +import org.geysermc.geyser.entity.type.living.ArmorStandEntity; +import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; import java.util.Locale; diff --git a/core/src/main/java/org/geysermc/geyser/utils/FileUtils.java b/core/src/main/java/org/geysermc/geyser/util/FileUtils.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/FileUtils.java rename to core/src/main/java/org/geysermc/geyser/util/FileUtils.java index 7d8029848..0671c5df7 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/FileUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/FileUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; diff --git a/core/src/main/java/org/geysermc/geyser/utils/InventoryUtils.java b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/utils/InventoryUtils.java rename to core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java index 89b5657f6..1b671b2fe 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/InventoryUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; @@ -37,15 +37,16 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; -import org.geysermc.geyser.common.ChatColor; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.InventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.geyser.network.translators.inventory.translators.chest.DoubleChestInventoryTranslator; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.ChatColor; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; +import org.geysermc.geyser.translator.inventory.chest.DoubleChestInventoryTranslator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; @@ -165,7 +166,7 @@ public class InventoryUtils { NbtMapBuilder display = NbtMap.builder(); // Not ideal to use log here but we dont get a session - display.putString("Name", ChatColor.RESET + LanguageUtils.getLocaleStringLog("geyser.inventory.unusable_item.name")); + display.putString("Name", ChatColor.RESET + GeyserLocale.getLocaleStringLog("geyser.inventory.unusable_item.name")); display.putList("Lore", NbtType.STRING, Collections.singletonList(ChatColor.RESET + ChatColor.DARK_PURPLE + description)); root.put("display", display.build()); diff --git a/core/src/main/java/org/geysermc/geyser/utils/ItemUtils.java b/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/utils/ItemUtils.java rename to core/src/main/java/org/geysermc/geyser/util/ItemUtils.java index c24c40ecf..0eed01613 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/ItemUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java @@ -23,10 +23,10 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; public class ItemUtils { diff --git a/core/src/main/java/org/geysermc/geyser/utils/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/utils/LoginEncryptionUtils.java rename to core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java index 1b23f0cba..213953bdd 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; @@ -39,15 +39,16 @@ import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; import com.nukkitx.protocol.bedrock.util.EncryptionUtils; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.session.auth.AuthData; -import org.geysermc.geyser.network.session.auth.BedrockClientData; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.auth.AuthData; +import org.geysermc.geyser.session.auth.BedrockClientData; import org.geysermc.cumulus.CustomForm; import org.geysermc.cumulus.ModalForm; import org.geysermc.cumulus.SimpleForm; import org.geysermc.cumulus.response.CustomFormResponse; import org.geysermc.cumulus.response.ModalFormResponse; import org.geysermc.cumulus.response.SimpleFormResponse; +import org.geysermc.geyser.text.GeyserLocale; import javax.crypto.SecretKey; import java.io.IOException; @@ -139,7 +140,7 @@ public class LoginEncryptionUtils { geyser.getLogger().debug(String.format("Is player data valid? %s", validChain)); if (!validChain && !session.getGeyser().getConfig().isEnableProxyConnections()) { - session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.remote.invalid_xbox_account")); + session.disconnect(GeyserLocale.getLocaleStringLog("geyser.network.remote.invalid_xbox_account")); return; } JWSObject jwt = JWSObject.parse(certChainData.get(certChainData.size() - 1).asText()); @@ -205,8 +206,8 @@ public class LoginEncryptionUtils { private static void sendEncryptionFailedMessage(GeyserImpl geyser) { if (!HAS_SENT_ENCRYPTION_MESSAGE) { - geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.encryption.line_1")); - geyser.getLogger().warning(LanguageUtils.getLocaleStringLog("geyser.network.encryption.line_2", "https://geysermc.org/supported_java")); + geyser.getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.network.encryption.line_1")); + geyser.getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.network.encryption.line_2", "https://geysermc.org/supported_java")); HAS_SENT_ENCRYPTION_MESSAGE = true; } } @@ -220,7 +221,7 @@ public class LoginEncryptionUtils { session.sendForm( SimpleForm.builder() - .translator(LanguageUtils::getPlayerLocaleString, session.getLocale()) + .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) .title("geyser.auth.login.form.notice.title") .content("geyser.auth.login.form.notice.desc") .optionalButton("geyser.auth.login.form.notice.btn_login.mojang", isPasswordAuthEnabled) @@ -251,14 +252,14 @@ public class LoginEncryptionUtils { return; } - session.disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getLocale())); + session.disconnect(GeyserLocale.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getLocale())); })); } public static void buildAndShowLoginDetailsWindow(GeyserSession session) { session.sendForm( CustomForm.builder() - .translator(LanguageUtils::getPlayerLocaleString, session.getLocale()) + .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) .title("geyser.auth.login.form.details.title") .label("geyser.auth.login.form.details.desc") .input("geyser.auth.login.form.details.email", "account@geysermc.org", "") @@ -280,7 +281,7 @@ public class LoginEncryptionUtils { public static void buildAndShowMicrosoftAuthenticationWindow(GeyserSession session) { session.sendForm( SimpleForm.builder() - .translator(LanguageUtils::getPlayerLocaleString, session.getLocale()) + .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) .title("geyser.auth.login.form.notice.btn_login.microsoft") .button("geyser.auth.login.method.browser") .button("geyser.auth.login.method.password") @@ -297,7 +298,7 @@ public class LoginEncryptionUtils { } else if (response.getClickedButtonId() == 1) { buildAndShowLoginDetailsWindow(session); } else { - session.disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getLocale())); + session.disconnect(GeyserLocale.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getLocale())); } })); } @@ -320,7 +321,7 @@ public class LoginEncryptionUtils { } if (response.getClickedButtonId() == 1) { - session.disconnect(LanguageUtils.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getLocale())); + session.disconnect(GeyserLocale.getPlayerLocaleString("geyser.auth.login.form.disconnect", session.getLocale())); } }) ); diff --git a/core/src/main/java/org/geysermc/geyser/utils/MathUtils.java b/core/src/main/java/org/geysermc/geyser/util/MathUtils.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/MathUtils.java rename to core/src/main/java/org/geysermc/geyser/util/MathUtils.java index ef638a5cd..7619c7906 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/MathUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/MathUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; public class MathUtils { diff --git a/core/src/main/java/org/geysermc/geyser/metrics/Metrics.java b/core/src/main/java/org/geysermc/geyser/util/Metrics.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/metrics/Metrics.java rename to core/src/main/java/org/geysermc/geyser/util/Metrics.java index bc69cd65d..37d3f81eb 100644 --- a/core/src/main/java/org/geysermc/geyser/metrics/Metrics.java +++ b/core/src/main/java/org/geysermc/geyser/util/Metrics.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.metrics; +package org.geysermc.geyser.util; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/core/src/main/java/org/geysermc/geyser/utils/NewsHandler.java b/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/NewsHandler.java rename to core/src/main/java/org/geysermc/geyser/util/NewsHandler.java index 5ff743630..ff0080f74 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/NewsHandler.java +++ b/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java @@ -23,21 +23,22 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonSyntaxException; +import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.common.ChatColor; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.floodgate.news.NewsItem; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.news.data.AnnouncementData; import org.geysermc.floodgate.news.data.BuildSpecificData; import org.geysermc.floodgate.news.data.CheckAfterData; +import org.geysermc.geyser.text.ChatColor; import java.util.*; import java.util.concurrent.Executors; diff --git a/core/src/main/java/org/geysermc/geyser/utils/PluginMessageUtils.java b/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/PluginMessageUtils.java rename to core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java index a2d5b98f7..ed706eeca 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/PluginMessageUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import java.nio.ByteBuffer; diff --git a/core/src/main/java/org/geysermc/geyser/utils/SettingsUtils.java b/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java similarity index 94% rename from core/src/main/java/org/geysermc/geyser/utils/SettingsUtils.java rename to core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java index c79c84735..28fb53ab1 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/SettingsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java @@ -23,16 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.world.WorldManager; +import org.geysermc.geyser.level.GameRule; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.level.WorldManager; import org.geysermc.cumulus.CustomForm; import org.geysermc.cumulus.component.DropdownComponent; import org.geysermc.cumulus.response.CustomFormResponse; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; public class SettingsUtils { /** @@ -95,7 +98,7 @@ public class SettingsUtils { boolean showGamerules = session.getOpPermissionLevel() >= 2 || session.hasPermission("geyser.settings.gamerules"); if (showGamerules) { builder.label("geyser.settings.title.game_rules") - .translator(LocaleUtils::getLocaleString); // we need translate gamerules next + .translator(MinecraftLocale::getLocaleString); // we need translate gamerules next WorldManager worldManager = GeyserImpl.getInstance().getWorldManager(); for (GameRule gamerule : GameRule.values()) { @@ -173,8 +176,8 @@ public class SettingsUtils { private static String translateEntry(String key, String locale) { if (key.startsWith("geyser.")) { - return LanguageUtils.getPlayerLocaleString(key, locale); + return GeyserLocale.getPlayerLocaleString(key, locale); } - return LocaleUtils.getLocaleString(key, locale); + return MinecraftLocale.getLocaleString(key, locale); } } diff --git a/core/src/main/java/org/geysermc/geyser/utils/SignUtils.java b/core/src/main/java/org/geysermc/geyser/util/SignUtils.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/SignUtils.java rename to core/src/main/java/org/geysermc/geyser/util/SignUtils.java index 5cb9182c9..3d3c23f7d 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/SignUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/SignUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; /** * Provides utilities for interacting with signs. Mainly, it deals with the widths of each character. diff --git a/core/src/main/java/org/geysermc/geyser/utils/SoundUtils.java b/core/src/main/java/org/geysermc/geyser/util/SoundUtils.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/SoundUtils.java rename to core/src/main/java/org/geysermc/geyser/util/SoundUtils.java index 79aaf94e4..6c4697a8b 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/SoundUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/SoundUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.nukkitx.protocol.bedrock.data.SoundEvent; diff --git a/core/src/main/java/org/geysermc/geyser/utils/StatisticsUtils.java b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java similarity index 96% rename from core/src/main/java/org/geysermc/geyser/utils/StatisticsUtils.java rename to core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java index da7bf4705..aa5893462 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/StatisticsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java @@ -23,17 +23,19 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.statistic.*; -import org.geysermc.geyser.network.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.cumulus.SimpleForm; import org.geysermc.cumulus.response.SimpleFormResponse; import org.geysermc.cumulus.util.FormImage; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; import java.util.Map; import java.util.regex.Matcher; @@ -199,10 +201,10 @@ public class StatisticsUtils { */ private static String getItemTranslateKey(String item, String language) { item = item.replace("minecraft:", "item.minecraft."); - String translatedItem = LocaleUtils.getLocaleString(item, language); + String translatedItem = MinecraftLocale.getLocaleString(item, language); if (translatedItem.equals(item)) { // Didn't translate; must be a block - translatedItem = LocaleUtils.getLocaleString(item.replace("item.", "block."), language); + translatedItem = MinecraftLocale.getLocaleString(item.replace("item.", "block."), language); } return translatedItem; } @@ -229,8 +231,8 @@ public class StatisticsUtils { private static String translateEntry(String key, String locale) { if (key.startsWith("geyser.")) { - return LanguageUtils.getPlayerLocaleString(key, locale); + return GeyserLocale.getPlayerLocaleString(key, locale); } - return LocaleUtils.getLocaleString(key, locale); + return MinecraftLocale.getLocaleString(key, locale); } } diff --git a/core/src/main/java/org/geysermc/geyser/utils/WebUtils.java b/core/src/main/java/org/geysermc/geyser/util/WebUtils.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/WebUtils.java rename to core/src/main/java/org/geysermc/geyser/util/WebUtils.java index 52e1783d5..a70971cb2 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/WebUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/WebUtils.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils; +package org.geysermc.geyser.util; import com.fasterxml.jackson.databind.JsonNode; import org.geysermc.geyser.GeyserImpl; diff --git a/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2BooleanMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2BooleanMap.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2BooleanMap.java rename to core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2BooleanMap.java index f28614597..ba30da927 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2BooleanMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2BooleanMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils.collections; +package org.geysermc.geyser.util.collection; import it.unimi.dsi.fastutil.ints.AbstractInt2BooleanMap; import it.unimi.dsi.fastutil.objects.ObjectSet; diff --git a/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2ByteMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2ByteMap.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2ByteMap.java rename to core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2ByteMap.java index 6917ccf51..65deeaca6 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2ByteMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2ByteMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils.collections; +package org.geysermc.geyser.util.collection; import it.unimi.dsi.fastutil.ints.AbstractInt2ByteMap; import it.unimi.dsi.fastutil.ints.Int2ByteMap; diff --git a/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2IntMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2IntMap.java similarity index 98% rename from core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2IntMap.java rename to core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2IntMap.java index bab3dbc04..9c30edd01 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/collections/FixedInt2IntMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/FixedInt2IntMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils.collections; +package org.geysermc.geyser.util.collection; import it.unimi.dsi.fastutil.ints.AbstractInt2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntMap; diff --git a/core/src/main/java/org/geysermc/geyser/utils/collections/LecternHasBookMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/utils/collections/LecternHasBookMap.java rename to core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java index 50d392a10..aaa780ed5 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/collections/LecternHasBookMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java @@ -23,14 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils.collections; +package org.geysermc.geyser.util.collection; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.network.translators.inventory.translators.LecternInventoryTranslator; -import org.geysermc.geyser.network.translators.world.WorldManager; -import org.geysermc.geyser.utils.BlockEntityUtils; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; +import org.geysermc.geyser.level.WorldManager; +import org.geysermc.geyser.util.BlockEntityUtils; /** * Map that takes advantage of its internals for fast operations on block states to determine if they are lecterns. diff --git a/core/src/main/java/org/geysermc/geyser/utils/collections/Object2IntBiMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/Object2IntBiMap.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/utils/collections/Object2IntBiMap.java rename to core/src/main/java/org/geysermc/geyser/util/collection/Object2IntBiMap.java index 6a576105c..efd292a83 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/collections/Object2IntBiMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/Object2IntBiMap.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils.collections; +package org.geysermc.geyser.util.collection; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/core/src/main/java/org/geysermc/geyser/utils/collections/package-info.java b/core/src/main/java/org/geysermc/geyser/util/collection/package-info.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/utils/collections/package-info.java rename to core/src/main/java/org/geysermc/geyser/util/collection/package-info.java index 3628e0385..a4c188001 100644 --- a/core/src/main/java/org/geysermc/geyser/utils/collections/package-info.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/package-info.java @@ -31,4 +31,4 @@ * and {@link java.util.Map#containsKey(java.lang.Object)} can be performed by simply checking the bounds of the map * size and its "start" integer. */ -package org.geysermc.geyser.utils.collections; \ No newline at end of file +package org.geysermc.geyser.util.collection; \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java b/core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java deleted file mode 100644 index accf5bf6d..000000000 --- a/core/src/main/java/org/geysermc/geyser/utils/DockerCheck.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.utils; - -import java.nio.file.Files; -import java.nio.file.Paths; - -public class DockerCheck { - - // By default, Geyser now sets the IP to the local IP in all cases on plugin versions so we don't notify the user of anything - // However we still have this check for the potential future bug - public static boolean checkBasic() { - try { - String OS = System.getProperty("os.name").toLowerCase(); - if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0) { - String output = new String(Files.readAllBytes(Paths.get("/proc/1/cgroup"))); - - if (output.contains("docker")) { - return true; - } - } - } catch (Exception ignored) { } // Ignore any errors, inc ip failed to fetch, process could not run or access denied - - return false; - } -} diff --git a/core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java b/core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java deleted file mode 100644 index c738a2654..000000000 --- a/core/src/main/java/org/geysermc/geyser/utils/EffectUtils.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.utils; - -import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; -import com.nukkitx.protocol.bedrock.data.LevelEventType; -import org.geysermc.geyser.network.session.GeyserSession; -import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.registry.type.ParticleMapping; - -import javax.annotation.Nonnull; - -/** - * Util for particles and effects. - */ -public class EffectUtils { - - /** - * Used for area effect clouds. - * - * @param type the Java particle to search for - * @return the Bedrock integer ID of the particle, or -1 if it does not exist - */ - public static int getParticleId(GeyserSession session, @Nonnull ParticleType type) { - ParticleMapping mapping = Registries.PARTICLES.get(type); - if (mapping == null) { - return -1; - } - - LevelEventType levelEventType = mapping.levelEventType(); - if (levelEventType == null) { - return -1; - } - - // Remove the legacy bit applied to particles for LevelEventType serialization - return session.getUpstream().getSession().getPacketCodec().getHelper().getLevelEventId(levelEventType) & ~0x4000; - } -} diff --git a/core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java b/core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java index 2f4e95f1e..96298f98e 100644 --- a/core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java +++ b/core/src/test/java/org/geysermc/geyser/network/translators/chat/MessageTranslatorTest.java @@ -26,6 +26,7 @@ package org.geysermc.geyser.network.translators.chat; import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer; +import org.geysermc.geyser.translator.text.MessageTranslator; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/org/geysermc/geyser/utils/collections/GeyserCollectionsTest.java b/core/src/test/java/org/geysermc/geyser/util/collection/GeyserCollectionsTest.java similarity index 99% rename from core/src/test/java/org/geysermc/geyser/utils/collections/GeyserCollectionsTest.java rename to core/src/test/java/org/geysermc/geyser/util/collection/GeyserCollectionsTest.java index 1cbfd57a5..d2841db53 100644 --- a/core/src/test/java/org/geysermc/geyser/utils/collections/GeyserCollectionsTest.java +++ b/core/src/test/java/org/geysermc/geyser/util/collection/GeyserCollectionsTest.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.utils.collections; +package org.geysermc.geyser.util.collection; import org.junit.Assert; import org.junit.Test; From 83ddbd7d1add86572a247592dedcb38ab55737bc Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sun, 21 Nov 2021 12:36:42 -0600 Subject: [PATCH 698/766] Initial api draft --- api/base/pom.xml | 27 ++++ .../src/main/java/org/geysermc/api/Api.java | 79 ++++++++++++ .../main/java/org/geysermc/api/Geyser.java | 94 ++++++++++++++ .../org/geysermc/api/session/Session.java} | 39 +++--- api/geyser/pom.xml | 27 ++++ .../org/geysermc/geyser/api/GeyserApi.java | 63 ++++++++++ .../geyser/api/session/GeyserSession.java | 34 ++++++ api/pom.xml | 7 +- .../bungeecord/GeyserBungeeLogger.java | 2 +- .../command/BungeeCommandSender.java | 2 +- .../command/GeyserBungeeCommandExecutor.java | 4 +- .../platform/spigot/GeyserSpigotLogger.java | 2 +- .../command/GeyserSpigotCommandExecutor.java | 4 +- .../spigot/command/SpigotCommandSender.java | 2 +- .../spigot/world/GeyserPistonListener.java | 6 +- .../GeyserSpigot1_11CraftingListener.java | 12 +- .../world/GeyserSpigotBlockPlaceListener.java | 4 +- .../GeyserSpigot1_12NativeWorldManager.java | 4 +- .../manager/GeyserSpigot1_12WorldManager.java | 4 +- .../GeyserSpigotFallbackWorldManager.java | 6 +- .../GeyserSpigotLegacyNativeWorldManager.java | 4 +- .../GeyserSpigotNativeWorldManager.java | 4 +- .../manager/GeyserSpigotWorldManager.java | 12 +- .../platform/sponge/GeyserSpongeLogger.java | 2 +- .../command/GeyserSpongeCommandExecutor.java | 4 +- .../sponge/command/SpongeCommandSender.java | 2 +- .../standalone/GeyserStandaloneLogger.java | 4 +- .../standalone/gui/GeyserStandaloneGUI.java | 4 +- .../velocity/GeyserVelocityLogger.java | 2 +- .../GeyserVelocityCommandExecutor.java | 4 +- .../command/VelocityCommandSender.java | 2 +- core/pom.xml | 2 +- .../geysermc/connector/GeyserConnector.java | 8 +- .../network/session/GeyserSession.java | 7 +- .../network/session/auth/AuthData.java | 6 +- .../geysermc/geyser/FloodgateKeyLoader.java | 2 +- .../org/geysermc/geyser/GeyserBootstrap.java | 2 +- .../java/org/geysermc/geyser/GeyserImpl.java | 115 ++++++++++-------- .../org/geysermc/geyser}/GeyserLogger.java | 2 +- .../geyser/command/CommandExecutor.java | 8 +- .../geyser/command/CommandManager.java | 6 +- .../geyser/command/CommandSender.java | 2 +- .../geyser/command/GeyserCommand.java | 4 +- .../command/defaults/AdvancementsCommand.java | 4 +- .../geyser/command/defaults/DumpCommand.java | 6 +- .../geyser/command/defaults/HelpCommand.java | 4 +- .../geyser/command/defaults/ListCommand.java | 6 +- .../command/defaults/OffhandCommand.java | 4 +- .../command/defaults/ReloadCommand.java | 4 +- .../command/defaults/SettingsCommand.java | 4 +- .../command/defaults/StatisticsCommand.java | 4 +- .../geyser/command/defaults/StopCommand.java | 4 +- .../command/defaults/VersionCommand.java | 6 +- .../configuration/GeyserConfiguration.java | 2 +- .../org/geysermc/geyser/dump/DumpInfo.java | 4 +- .../geyser/entity/InteractiveTagManager.java | 4 +- .../entity/factory/BaseEntityFactory.java | 4 +- .../factory/ExperienceOrbEntityFactory.java | 4 +- .../entity/factory/PaintingEntityFactory.java | 4 +- .../entity/type/AbstractArrowEntity.java | 4 +- .../entity/type/AreaEffectCloudEntity.java | 4 +- .../geyser/entity/type/BoatEntity.java | 10 +- .../type/CommandBlockMinecartEntity.java | 4 +- .../type/DefaultBlockMinecartEntity.java | 4 +- .../entity/type/EnderCrystalEntity.java | 4 +- .../geysermc/geyser/entity/type/Entity.java | 6 +- .../geyser/entity/type/ExpOrbEntity.java | 4 +- .../entity/type/FallingBlockEntity.java | 4 +- .../geyser/entity/type/FireworkEntity.java | 4 +- .../geyser/entity/type/FishingHookEntity.java | 6 +- .../entity/type/FurnaceMinecartEntity.java | 4 +- .../geyser/entity/type/ItemEntity.java | 4 +- .../geyser/entity/type/ItemFrameEntity.java | 6 +- .../entity/type/ItemedFireballEntity.java | 4 +- .../geyser/entity/type/LeashKnotEntity.java | 4 +- .../geyser/entity/type/LightningEntity.java | 4 +- .../geyser/entity/type/LivingEntity.java | 12 +- .../geyser/entity/type/MinecartEntity.java | 4 +- .../geyser/entity/type/PaintingEntity.java | 4 +- .../entity/type/SpawnerMinecartEntity.java | 4 +- .../geyser/entity/type/TNTEntity.java | 4 +- .../geyser/entity/type/ThrowableEntity.java | 4 +- .../entity/type/ThrowableItemEntity.java | 4 +- .../entity/type/ThrownPotionEntity.java | 4 +- .../geyser/entity/type/TippedArrowEntity.java | 4 +- .../geyser/entity/type/TridentEntity.java | 4 +- .../geyser/entity/type/WitherSkullEntity.java | 4 +- .../type/living/AbstractFishEntity.java | 4 +- .../entity/type/living/AgeableEntity.java | 4 +- .../entity/type/living/AmbientEntity.java | 4 +- .../entity/type/living/ArmorStandEntity.java | 4 +- .../geyser/entity/type/living/BatEntity.java | 4 +- .../entity/type/living/CreatureEntity.java | 4 +- .../entity/type/living/FlyingEntity.java | 4 +- .../entity/type/living/GlowSquidEntity.java | 4 +- .../entity/type/living/GolemEntity.java | 4 +- .../entity/type/living/IronGolemEntity.java | 4 +- .../entity/type/living/MagmaCubeEntity.java | 4 +- .../geyser/entity/type/living/MobEntity.java | 4 +- .../entity/type/living/SlimeEntity.java | 4 +- .../entity/type/living/SnowGolemEntity.java | 4 +- .../entity/type/living/SquidEntity.java | 4 +- .../entity/type/living/WaterEntity.java | 4 +- .../type/living/animal/AnimalEntity.java | 4 +- .../type/living/animal/AxolotlEntity.java | 4 +- .../entity/type/living/animal/BeeEntity.java | 4 +- .../type/living/animal/ChickenEntity.java | 4 +- .../entity/type/living/animal/FoxEntity.java | 4 +- .../entity/type/living/animal/GoatEntity.java | 4 +- .../type/living/animal/HoglinEntity.java | 4 +- .../type/living/animal/MooshroomEntity.java | 4 +- .../type/living/animal/OcelotEntity.java | 4 +- .../type/living/animal/PandaEntity.java | 4 +- .../entity/type/living/animal/PigEntity.java | 4 +- .../type/living/animal/PolarBearEntity.java | 4 +- .../type/living/animal/PufferFishEntity.java | 4 +- .../type/living/animal/RabbitEntity.java | 4 +- .../type/living/animal/SheepEntity.java | 4 +- .../type/living/animal/StriderEntity.java | 4 +- .../living/animal/TropicalFishEntity.java | 4 +- .../type/living/animal/TurtleEntity.java | 4 +- .../animal/horse/AbstractHorseEntity.java | 4 +- .../animal/horse/ChestedHorseEntity.java | 4 +- .../type/living/animal/horse/HorseEntity.java | 4 +- .../type/living/animal/horse/LlamaEntity.java | 4 +- .../animal/horse/TraderLlamaEntity.java | 4 +- .../living/animal/tameable/CatEntity.java | 4 +- .../living/animal/tameable/ParrotEntity.java | 4 +- .../animal/tameable/TameableEntity.java | 4 +- .../living/animal/tameable/WolfEntity.java | 4 +- .../merchant/AbstractMerchantEntity.java | 4 +- .../type/living/merchant/VillagerEntity.java | 4 +- .../monster/AbstractSkeletonEntity.java | 4 +- .../type/living/monster/BasePiglinEntity.java | 4 +- .../type/living/monster/BlazeEntity.java | 4 +- .../type/living/monster/CreeperEntity.java | 4 +- .../living/monster/ElderGuardianEntity.java | 4 +- .../living/monster/EnderDragonEntity.java | 4 +- .../living/monster/EnderDragonPartEntity.java | 4 +- .../type/living/monster/EndermanEntity.java | 4 +- .../type/living/monster/GhastEntity.java | 4 +- .../type/living/monster/GiantEntity.java | 4 +- .../type/living/monster/GuardianEntity.java | 4 +- .../type/living/monster/MonsterEntity.java | 4 +- .../type/living/monster/PhantomEntity.java | 4 +- .../type/living/monster/PiglinEntity.java | 6 +- .../type/living/monster/ShulkerEntity.java | 4 +- .../type/living/monster/SkeletonEntity.java | 4 +- .../type/living/monster/SpiderEntity.java | 4 +- .../entity/type/living/monster/VexEntity.java | 4 +- .../type/living/monster/WitherEntity.java | 4 +- .../type/living/monster/ZoglinEntity.java | 4 +- .../type/living/monster/ZombieEntity.java | 4 +- .../living/monster/ZombieVillagerEntity.java | 4 +- .../living/monster/ZombifiedPiglinEntity.java | 4 +- .../monster/raid/AbstractIllagerEntity.java | 4 +- .../living/monster/raid/PillagerEntity.java | 8 +- .../monster/raid/RaidParticipantEntity.java | 4 +- .../raid/SpellcasterIllagerEntity.java | 4 +- .../living/monster/raid/VindicatorEntity.java | 4 +- .../entity/type/player/PlayerEntity.java | 4 +- .../type/player/SessionPlayerEntity.java | 8 +- .../entity/type/player/SkullPlayerEntity.java | 4 +- .../geysermc/geyser/inventory/Container.java | 4 +- .../geyser/inventory/Generic3X3Container.java | 4 +- .../geyser/inventory/GeyserEnchantOption.java | 4 +- .../geyser/inventory/GeyserItemStack.java | 6 +- .../geysermc/geyser/inventory/Inventory.java | 6 +- .../geyser/inventory/PlayerInventory.java | 4 +- .../inventory/StonecutterContainer.java | 4 +- .../geyser/inventory/click/ClickPlan.java | 6 +- .../holder/BlockInventoryHolder.java | 12 +- .../inventory/holder/InventoryHolder.java | 8 +- .../updater/AnvilInventoryUpdater.java | 34 +++--- .../updater/ChestInventoryUpdater.java | 6 +- .../updater/ContainerInventoryUpdater.java | 6 +- .../updater/HorseInventoryUpdater.java | 6 +- .../inventory/updater/InventoryUpdater.java | 6 +- .../inventory/updater/UIInventoryUpdater.java | 6 +- .../geyser/level/GeyserWorldManager.java | 18 +-- .../geysermc/geyser/level/WorldManager.java | 22 ++-- .../level/physics/CollisionManager.java | 8 +- .../network/ConnectorServerEventHandler.java | 4 +- .../geyser/network/LoggingPacketHandler.java | 6 +- .../geyser/network/UpstreamPacketHandler.java | 12 +- .../registry/PacketTranslatorRegistry.java | 6 +- .../geyser/registry/type/ParticleMapping.java | 4 +- .../geyser/scoreboard/Scoreboard.java | 8 +- .../geyser/scoreboard/ScoreboardUpdater.java | 12 +- ...serSession.java => GeyserSessionImpl.java} | 47 ++++--- .../geyser/session/SessionManager.java | 19 ++- .../geyser/session/auth/AuthData.java | 12 +- .../session/cache/AdvancementsCache.java | 6 +- .../geyser/session/cache/BookEditCache.java | 6 +- .../geyser/session/cache/BossBar.java | 4 +- .../geyser/session/cache/ChunkCache.java | 4 +- .../geyser/session/cache/EntityCache.java | 4 +- .../geyser/session/cache/FormCache.java | 4 +- .../geyser/session/cache/PistonCache.java | 6 +- .../session/cache/PreferencesCache.java | 8 +- .../geyser/session/cache/WorldBorder.java | 10 +- .../geyser/session/cache/WorldCache.java | 6 +- .../geyser/skin/FloodgateSkinUploader.java | 8 +- .../org/geysermc/geyser/skin/SkinManager.java | 22 ++-- .../geysermc/geyser/skin/SkinProvider.java | 4 +- .../geyser/skin/SkullSkinManager.java | 4 +- .../translator/collision/BlockCollision.java | 4 +- .../translator/collision/DoorCollision.java | 4 +- .../collision/ScaffoldingCollision.java | 4 +- .../translator/collision/SnowCollision.java | 4 +- .../collision/TrapdoorCollision.java | 4 +- .../AbstractBlockInventoryTranslator.java | 12 +- .../inventory/AnvilInventoryTranslator.java | 4 +- .../inventory/BaseInventoryTranslator.java | 4 +- .../inventory/BeaconInventoryTranslator.java | 10 +- .../inventory/BrewingInventoryTranslator.java | 6 +- .../CartographyInventoryTranslator.java | 4 +- .../EnchantingInventoryTranslator.java | 6 +- .../Generic3X3InventoryTranslator.java | 4 +- .../inventory/InventoryTranslator.java | 40 +++--- .../inventory/LecternInventoryTranslator.java | 16 +-- .../inventory/LoomInventoryTranslator.java | 6 +- .../MerchantInventoryTranslator.java | 14 +-- .../inventory/PlayerInventoryTranslator.java | 24 ++-- .../inventory/ShulkerInventoryTranslator.java | 4 +- .../StonecutterInventoryTranslator.java | 4 +- .../chest/ChestInventoryTranslator.java | 8 +- .../chest/DoubleChestInventoryTranslator.java | 8 +- .../chest/SingleChestInventoryTranslator.java | 8 +- .../AbstractFurnaceInventoryTranslator.java | 4 +- .../AbstractHorseInventoryTranslator.java | 12 +- .../ChestedHorseInventoryTranslator.java | 4 +- .../inventory/item/ItemTranslator.java | 8 +- .../item/NbtItemStackTranslator.java | 4 +- .../item/nbt/AxolotlBucketTranslator.java | 4 +- .../item/nbt/BasicItemTranslator.java | 4 +- .../item/nbt/BookPagesTranslator.java | 4 +- .../item/nbt/CrossbowTranslator.java | 4 +- .../item/nbt/EnchantedBookTranslator.java | 4 +- .../item/nbt/EnchantmentTranslator.java | 4 +- .../item/nbt/FireworkRocketTranslator.java | 4 +- .../item/nbt/FireworkStarTranslator.java | 4 +- .../item/nbt/LeatherArmorTranslator.java | 4 +- .../item/nbt/LodestoneCompassTranslator.java | 4 +- .../inventory/item/nbt/MapItemTranslator.java | 4 +- .../item/nbt/PlayerHeadTranslator.java | 4 +- .../item/nbt/ShulkerBoxItemTranslator.java | 4 +- .../nbt/TropicalFishBucketTranslator.java | 4 +- .../translator/level/BiomeTranslator.java | 6 +- .../block/entity/BedrockOnlyBlockEntity.java | 6 +- .../DoubleChestBlockEntityTranslator.java | 4 +- .../FlowerPotBlockEntityTranslator.java | 6 +- .../NoteblockBlockEntityTranslator.java | 4 +- .../level/block/entity/PistonBlockEntity.java | 6 +- .../entity/SkullBlockEntityTranslator.java | 6 +- .../level/event/LevelEventTranslator.java | 4 +- .../level/event/PlaySoundEventTranslator.java | 4 +- .../event/SoundEventEventTranslator.java | 4 +- .../event/SoundLevelEventTranslator.java | 4 +- .../translator/protocol/PacketTranslator.java | 4 +- .../BedrockAdventureSettingsTranslator.java | 4 +- .../bedrock/BedrockAnimateTranslator.java | 4 +- .../BedrockBlockEntityDataTranslator.java | 4 +- .../BedrockBlockPickRequestTranslator.java | 4 +- .../bedrock/BedrockBookEditTranslator.java | 4 +- .../BedrockCommandBlockUpdateTranslator.java | 4 +- .../BedrockCommandRequestTranslator.java | 4 +- .../BedrockContainerCloseTranslator.java | 4 +- .../bedrock/BedrockEmoteListTranslator.java | 4 +- .../BedrockEntityPickRequestTranslator.java | 4 +- .../bedrock/BedrockFilterTextTranslator.java | 4 +- ...BedrockInventoryTransactionTranslator.java | 6 +- .../BedrockItemFrameDropItemTranslator.java | 4 +- .../BedrockItemStackRequestTranslator.java | 4 +- .../BedrockLecternUpdateTranslator.java | 4 +- .../BedrockMapInfoRequestTranslator.java | 4 +- .../BedrockMobEquipmentTranslator.java | 4 +- .../BedrockMoveEntityAbsoluteTranslator.java | 4 +- .../BedrockNetworkStackLatencyTranslator.java | 4 +- ...drockPacketViolationWarningTranslator.java | 4 +- .../bedrock/BedrockPlayerInputTranslator.java | 4 +- ...tionTrackingDBClientRequestTranslator.java | 4 +- .../bedrock/BedrockRespawnTranslator.java | 4 +- ...edrockServerSettingsRequestTranslator.java | 4 +- ...SetLocalPlayerAsInitializedTranslator.java | 4 +- .../bedrock/BedrockShowCreditsTranslator.java | 4 +- .../bedrock/BedrockTextTranslator.java | 4 +- .../entity/BedrockEntityEventTranslator.java | 4 +- .../player/BedrockActionTranslator.java | 4 +- .../entity/player/BedrockEmoteTranslator.java | 8 +- .../player/BedrockInteractTranslator.java | 4 +- .../player/BedrockMovePlayerTranslator.java | 8 +- .../player/BedrockRiderJumpTranslator.java | 4 +- .../BedrockSetPlayerGameTypeTranslator.java | 4 +- .../BedrockLevelSoundEventTranslator.java | 4 +- .../java/JavaAwardStatsTranslator.java | 4 +- .../java/JavaBossEventTranslator.java | 4 +- .../java/JavaChangeDifficultyTranslator.java | 4 +- .../protocol/java/JavaChatTranslator.java | 6 +- .../protocol/java/JavaCommandsTranslator.java | 10 +- .../java/JavaCustomPayloadTranslator.java | 6 +- .../java/JavaCustomQueryTranslator.java | 4 +- .../java/JavaDisconnectTranslator.java | 4 +- .../java/JavaGameProfileTranslator.java | 4 +- .../java/JavaKeepAliveTranslator.java | 4 +- .../java/JavaLoginDisconnectTranslator.java | 4 +- .../protocol/java/JavaLoginTranslator.java | 4 +- .../protocol/java/JavaPingTranslator.java | 4 +- .../protocol/java/JavaRecipeTranslator.java | 4 +- .../protocol/java/JavaRespawnTranslator.java | 4 +- .../JavaSelectAdvancementsTabTranslator.java | 4 +- .../JavaUpdateAdvancementsTranslator.java | 6 +- .../java/JavaUpdateRecipesTranslator.java | 6 +- .../java/JavaUpdateTagsTranslator.java | 4 +- .../java/entity/JavaAnimateTranslator.java | 4 +- .../entity/JavaEntityEventTranslator.java | 4 +- .../JavaMoveEntityPosRotTranslator.java | 4 +- .../entity/JavaMoveEntityPosTranslator.java | 4 +- .../entity/JavaMoveEntityRotTranslator.java | 4 +- .../entity/JavaMoveVehicleTranslator.java | 4 +- .../entity/JavaRemoveEntitiesTranslator.java | 4 +- .../entity/JavaRemoveMobEffectTranslator.java | 4 +- .../java/entity/JavaRotateHeadTranslator.java | 4 +- .../entity/JavaSetEntityDataTranslator.java | 4 +- .../entity/JavaSetEntityLinkTranslator.java | 4 +- .../entity/JavaSetEntityMotionTranslator.java | 4 +- .../entity/JavaSetEquipmentTranslator.java | 4 +- .../entity/JavaSetPassengersTranslator.java | 4 +- .../entity/JavaTakeItemEntityTranslator.java | 4 +- .../entity/JavaTeleportEntityTranslator.java | 4 +- .../JavaUpdateAttributesTranslator.java | 4 +- .../entity/JavaUpdateMobEffectTranslator.java | 4 +- .../player/JavaBlockBreakAckTranslator.java | 4 +- .../player/JavaPlayerAbilitiesTranslator.java | 4 +- .../player/JavaPlayerInfoTranslator.java | 6 +- .../player/JavaPlayerPositionTranslator.java | 4 +- .../player/JavaSetCarriedItemTranslator.java | 4 +- .../player/JavaSetExperienceTranslator.java | 4 +- .../player/JavaSetHealthTranslator.java | 4 +- .../entity/spawn/JavaAddEntityTranslator.java | 4 +- .../spawn/JavaAddExperienceOrbTranslator.java | 4 +- .../entity/spawn/JavaAddMobTranslator.java | 4 +- .../spawn/JavaAddPaintingTranslator.java | 4 +- .../entity/spawn/JavaAddPlayerTranslator.java | 4 +- .../JavaContainerCloseTranslator.java | 4 +- .../JavaContainerSetContentTranslator.java | 4 +- .../JavaContainerSetDataTranslator.java | 4 +- .../JavaContainerSetSlotTranslator.java | 6 +- .../JavaHorseScreenOpenTranslator.java | 4 +- .../JavaMerchantOffersTranslator.java | 6 +- .../inventory/JavaOpenScreenTranslator.java | 4 +- .../level/JavaBlockDestructionTranslator.java | 4 +- .../level/JavaBlockEntityDataTranslator.java | 4 +- .../java/level/JavaBlockEventTranslator.java | 4 +- .../java/level/JavaBlockUpdateTranslator.java | 8 +- .../java/level/JavaCustomSoundTranslator.java | 4 +- .../java/level/JavaExplodeTranslator.java | 4 +- .../level/JavaForgetLevelChunkTranslator.java | 4 +- .../java/level/JavaGameEventTranslator.java | 4 +- .../JavaLevelChunkWithLightTranslator.java | 4 +- .../java/level/JavaLevelEventTranslator.java | 4 +- .../level/JavaLevelParticlesTranslator.java | 6 +- .../java/level/JavaMapItemDataTranslator.java | 4 +- .../JavaSectionBlocksUpdateTranslator.java | 4 +- .../JavaSetChunkCacheCenterTranslator.java | 4 +- .../JavaSetChunkCacheRadiusTranslator.java | 4 +- ...JavaSetDefaultSpawnPositionTranslator.java | 4 +- .../java/level/JavaSetTimeTranslator.java | 4 +- .../java/level/JavaSoundTranslator.java | 4 +- .../java/level/JavaStopSoundTranslator.java | 4 +- .../JavaInitializeBorderTranslator.java | 4 +- .../border/JavaSetBorderCenterTranslator.java | 4 +- .../JavaSetBorderLerpSizeTranslator.java | 4 +- .../border/JavaSetBorderSizeTranslator.java | 4 +- .../JavaSetBorderWarningDelayTranslator.java | 4 +- ...avaSetBorderWarningDistanceTranslator.java | 4 +- .../JavaSetDisplayObjectiveTranslator.java | 4 +- .../JavaSetObjectiveTranslator.java | 6 +- .../JavaSetPlayerTeamTranslator.java | 6 +- .../scoreboard/JavaSetScoreTranslator.java | 10 +- .../java/title/JavaClearTitlesTranslator.java | 4 +- .../title/JavaSetActionBarTextTranslator.java | 4 +- .../title/JavaSetSubtitleTextTranslator.java | 4 +- .../title/JavaSetTitleTextTranslator.java | 4 +- .../JavaSetTitlesAnimationTranslator.java | 4 +- .../BlockSoundInteractionTranslator.java | 6 +- .../EntitySoundInteractionTranslator.java | 4 +- .../sound/SoundInteractionTranslator.java | 4 +- .../BucketSoundInteractionTranslator.java | 4 +- .../ComparatorSoundInteractionTranslator.java | 4 +- .../block/DoorSoundInteractionTranslator.java | 4 +- .../FlintAndSteelInteractionTranslator.java | 4 +- .../block/GrassPathInteractionTranslator.java | 4 +- .../sound/block/HoeInteractionTranslator.java | 4 +- .../LeverSoundInteractionTranslator.java | 4 +- .../FeedBabySoundInteractionTranslator.java | 4 +- .../MilkEntitySoundInteractionTranslator.java | 4 +- .../translator/text/MessageTranslator.java | 6 +- .../geyser/util/BlockEntityUtils.java | 6 +- .../org/geysermc/geyser/util/BlockUtils.java | 14 +-- .../org/geysermc/geyser/util/ChunkUtils.java | 12 +- .../geysermc/geyser/util/CooldownUtils.java | 10 +- .../geysermc/geyser/util/DimensionUtils.java | 4 +- .../geysermc/geyser/util/InventoryUtils.java | 20 +-- .../org/geysermc/geyser/util/ItemUtils.java | 4 +- .../geyser/util/LoginEncryptionUtils.java | 16 +-- .../org/geysermc/geyser/util/NewsHandler.java | 10 +- .../geyser/util/PluginMessageUtils.java | 4 +- .../geysermc/geyser/util/SettingsUtils.java | 4 +- .../geysermc/geyser/util/StatisticsUtils.java | 4 +- .../util/collection/LecternHasBookMap.java | 4 +- pom.xml | 2 +- 412 files changed, 1473 insertions(+), 1131 deletions(-) create mode 100644 api/base/pom.xml create mode 100644 api/base/src/main/java/org/geysermc/api/Api.java create mode 100644 api/base/src/main/java/org/geysermc/api/Geyser.java rename api/{src/main/java/org/geysermc/geyser/api/Geyser.java => base/src/main/java/org/geysermc/api/session/Session.java} (64%) create mode 100644 api/geyser/pom.xml create mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java create mode 100644 api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java rename {api/src/main/java/org/geysermc/geyser/api/logger => core/src/main/java/org/geysermc/geyser}/GeyserLogger.java (98%) rename core/src/main/java/org/geysermc/geyser/session/{GeyserSession.java => GeyserSessionImpl.java} (97%) diff --git a/api/base/pom.xml b/api/base/pom.xml new file mode 100644 index 000000000..a3a67b7ec --- /dev/null +++ b/api/base/pom.xml @@ -0,0 +1,27 @@ + + + + geyser-parent + org.geysermc + 1.4.3-SNAPSHOT + + 4.0.0 + + base-api + + + 16 + 16 + + + + + org.checkerframework + checker-qual + 3.19.0 + provided + + + \ No newline at end of file diff --git a/api/base/src/main/java/org/geysermc/api/Api.java b/api/base/src/main/java/org/geysermc/api/Api.java new file mode 100644 index 000000000..f3ee9c742 --- /dev/null +++ b/api/base/src/main/java/org/geysermc/api/Api.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2019-2021 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.api; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.geysermc.api.session.Session; + +import java.util.List; +import java.util.UUID; + +/** + * The base API class. + * + * @param the session type + */ +public interface Api { + + /** + * Gets the session from the given + * UUID, if applicable. + * + * @param uuid the UUID of the session + * @return the session from the given UUID, if applicable + */ + @Nullable + S sessionByUuid(@NonNull UUID uuid); + + /** + * Gets the session from the given + * XUID, if applicable. + * + * @param xuid the XUID of the session + * @return the session from the given UUID, if applicable + */ + @Nullable + S sessionByXuid(@NonNull String xuid); + + /** + * Gets the session from the given + * name, if applicable. + * + * @param name the uuid of the session + * @return the session from the given name, if applicable + */ + @Nullable + S sessionByName(@NonNull String name); + + /** + * Gets all the online sessions. + * + * @return all the online sessions + */ + @NonNull + List onlineSessions(); +} diff --git a/api/base/src/main/java/org/geysermc/api/Geyser.java b/api/base/src/main/java/org/geysermc/api/Geyser.java new file mode 100644 index 000000000..99d3f1402 --- /dev/null +++ b/api/base/src/main/java/org/geysermc/api/Geyser.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2019-2021 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.api; + +import org.checkerframework.checker.nullness.qual.NonNull; + +/** + * General API class for Geyser. + */ +@NonNull +public class Geyser { + private static Api api; + + /** + * Returns the base api. + * + * @return the base api + */ + public static Api api() { + if (api == null) { + throw new RuntimeException("Api has not been registered yet!"); + } + + return api; + } + + /** + * Returns the api of the given type. + * + * @param apiClass the api class + * @param the type + * @return the api of the given type + */ + @SuppressWarnings("unchecked") + public static > T api(@NonNull Class apiClass) { + if (apiClass.isInstance(api)) { + return (T) api; + } + + if (api == null) { + throw new RuntimeException("Api has not been registered yet!"); + } else { + throw new RuntimeException("Api was not an instance of " + apiClass + "! Was " + api.getClass().getCanonicalName()); + } + } + + /** + * Registers the given api type. The api cannot be + * registered if {@link #registered()} is true as + * an api has already been specified. + * + * @param api the api + */ + public static void set(@NonNull Api api) { + if (Geyser.api != null) { + throw new RuntimeException("Cannot redefine already registered api!"); + } + + Geyser.api = api; + } + + /** + * Gets if the api has been registered and + * is ready for usage. + * + * @return if the api has been registered + */ + public static boolean registered() { + return api != null; + } +} diff --git a/api/src/main/java/org/geysermc/geyser/api/Geyser.java b/api/base/src/main/java/org/geysermc/api/session/Session.java similarity index 64% rename from api/src/main/java/org/geysermc/geyser/api/Geyser.java rename to api/base/src/main/java/org/geysermc/api/session/Session.java index a8a8b68a7..7862f1e70 100644 --- a/api/src/main/java/org/geysermc/geyser/api/Geyser.java +++ b/api/base/src/main/java/org/geysermc/api/session/Session.java @@ -23,37 +23,36 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.api; +package org.geysermc.api.session; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.checkerframework.checker.nullness.qual.NonNull; + +import java.util.UUID; /** - * General API class for Geyser. + * Represents a player session. */ -public abstract class Geyser { - private static Geyser instance; +@NonNull +public interface Session { /** - * Gets the logger used by Geyser. + * Gets the name of the session. * - * @return the logger used by Geyser + * @return the name of the session */ - public abstract GeyserLogger getLogger(); + String name(); /** - * Returns the current {@link Geyser} instance. + * Gets the {@link UUID} of the session. * - * @return the current Geyser instance + * @return the UUID of the session */ - public static Geyser getInstance() { - return instance; - } + UUID uuid(); - protected static void setInstance(Geyser instance) { - if (Geyser.instance != null) { - throw new RuntimeException("Cannot redefine singleton Geyser!"); - } - - Geyser.instance = instance; - } + /** + * Gets the XUID of the session. + * + * @return the XUID of the session + */ + String xuid(); } diff --git a/api/geyser/pom.xml b/api/geyser/pom.xml new file mode 100644 index 000000000..dc28b0648 --- /dev/null +++ b/api/geyser/pom.xml @@ -0,0 +1,27 @@ + + + + geyser-parent + org.geysermc + 1.4.3-SNAPSHOT + + 4.0.0 + + geyser-api + + + 16 + 16 + + + + + org.geysermc + base-api + 1.4.3-SNAPSHOT + compile + + + \ No newline at end of file diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java new file mode 100644 index 000000000..a6b4cbf78 --- /dev/null +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019-2021 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.api; + +import org.geysermc.api.Api; +import org.geysermc.api.Geyser; +import org.geysermc.geyser.api.session.GeyserSession; + +/** + * Represents the API used in Geyser. + */ +public interface GeyserApi extends Api { + + /** + * Shuts down the current Geyser instance. + */ + void shutdown(); + + /** + * Reloads the current Geyser instance. + */ + void reload(); + + /** + * Gets if this Geyser instance is running in an IDE. This only needs to be used in cases where files + * expected to be in a jarfile are not present. + * + * @return true if the version number is not 'DEV'. + */ + boolean productionEnvironment(); + + /** + * Gets the {@link GeyserApi}. + * + * @return the Geyser API + */ + static GeyserApi api() { + return Geyser.api(GeyserApi.class); + } +} diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java b/api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java new file mode 100644 index 000000000..16f6f5366 --- /dev/null +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019-2021 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.api.session; + +import org.geysermc.api.session.Session; + +/** + * Represents a player session used in Geyser. + */ +public interface GeyserSession extends Session { +} diff --git a/api/pom.xml b/api/pom.xml index ecaa217b6..fcf12088b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -9,11 +9,16 @@ 4.0.0 - api + api-parent + pom 16 16 + + base + geyser + \ No newline at end of file diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java index a53cb7f1d..fbc09956c 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeeLogger.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.platform.bungeecord; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java index c7cd90489..7dc04f95b 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/BungeeCommandSender.java @@ -41,7 +41,7 @@ public class BungeeCommandSender implements CommandSender { } @Override - public String getName() { + public String name() { return handle.getName(); } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index f0a05687c..5b137c61c 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -32,7 +32,7 @@ import net.md_5.bungee.api.plugin.TabExecutor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; @@ -50,7 +50,7 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor @Override public void execute(CommandSender sender, String[] args) { BungeeCommandSender commandSender = new BungeeCommandSender(sender); - GeyserSession session = this.commandExecutor.getGeyserSession(commandSender); + GeyserSessionImpl session = this.commandExecutor.getGeyserSession(commandSender); if (args.length > 0) { GeyserCommand command = this.commandExecutor.getCommand(args[0]); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java index 9a1f45bcd..98c85977f 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotLogger.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.spigot; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java index af92091e5..b6386dfee 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java @@ -32,7 +32,7 @@ import org.bukkit.command.TabExecutor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; @@ -48,7 +48,7 @@ public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabE @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { SpigotCommandSender commandSender = new SpigotCommandSender(sender); - GeyserSession session = getGeyserSession(commandSender); + GeyserSessionImpl session = getGeyserSession(commandSender); if (args.length > 0) { GeyserCommand geyserCommand = getCommand(args[0]); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java index 2aa301022..7fbaac4f8 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/SpigotCommandSender.java @@ -54,7 +54,7 @@ public class SpigotCommandSender implements CommandSender { } @Override - public String getName() { + public String name() { return handle.getName(); } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java index 4d504bcf5..a77afec09 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java @@ -41,7 +41,7 @@ import org.bukkit.event.block.BlockPistonEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; @@ -88,12 +88,12 @@ public class GeyserPistonListener implements Listener { Object2IntMap attachedBlocks = new Object2IntOpenHashMap<>(); boolean blocksFilled = false; - for (Map.Entry entry : geyser.getSessionManager().getSessions().entrySet()) { + for (Map.Entry entry : geyser.getSessionManager().getSessions().entrySet()) { Player player = Bukkit.getPlayer(entry.getKey()); if (player == null || !player.getWorld().equals(world)) { continue; } - GeyserSession session = entry.getValue(); + GeyserSessionImpl session = entry.getValue(); int dX = Math.abs(location.getBlockX() - player.getLocation().getBlockX()) >> 4; int dZ = Math.abs(location.getBlockZ() - player.getLocation().getBlockZ()) >> 4; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index 2b740eead..68c6fc413 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -48,7 +48,7 @@ import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.util.InventoryUtils; @@ -79,9 +79,9 @@ public class GeyserSpigot1_11CraftingListener implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - GeyserSession session = null; - for (GeyserSession otherSession : geyser.getSessionManager().getSessions().values()) { - if (otherSession.getName().equals(event.getPlayer().getName())) { + GeyserSessionImpl session = null; + for (GeyserSessionImpl otherSession : geyser.getSessionManager().getSessions().values()) { + if (otherSession.name().equals(event.getPlayer().getName())) { session = otherSession; break; } @@ -93,7 +93,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { sendServerRecipes(session); } - public void sendServerRecipes(GeyserSession session) { + public void sendServerRecipes(GeyserSessionImpl session) { int netId = InventoryUtils.LAST_RECIPE_NET_ID; CraftingDataPacket craftingDataPacket = new CraftingDataPacket(); @@ -161,7 +161,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { } @SuppressWarnings("deprecation") - private Pair translateToBedrock(GeyserSession session, org.bukkit.inventory.ItemStack itemStack) { + private Pair translateToBedrock(GeyserSessionImpl session, org.bukkit.inventory.ItemStack itemStack) { if (itemStack != null && itemStack.getData() != null) { if (itemStack.getType().getId() == 0) { return new Pair<>(null, ItemData.AIR); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index b89e87878..8f0d6e2db 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -33,7 +33,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager; @@ -45,7 +45,7 @@ public class GeyserSpigotBlockPlaceListener implements Listener { @EventHandler public void place(final BlockPlaceEvent event) { - GeyserSession session = geyser.getPlayerByUuid(event.getPlayer().getUniqueId()); + GeyserSessionImpl session = geyser.sessionByUuid(event.getPlayer().getUniqueId()); if (session == null) { return; } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java index ea1fadd0e..12f197f24 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java @@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockSto import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; @@ -48,7 +48,7 @@ public class GeyserSpigot1_12NativeWorldManager extends GeyserSpigot1_12WorldMan } @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { return BlockStateValues.JAVA_AIR_ID; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java index f12968b1f..b1072b847 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java @@ -36,7 +36,7 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.List; @@ -66,7 +66,7 @@ public class GeyserSpigot1_12WorldManager extends GeyserSpigotWorldManager { } @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { return BlockStateValues.JAVA_AIR_ID; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java index 1aacb73e7..f3071ecdd 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java @@ -26,11 +26,11 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; /** - * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)} + * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSessionImpl, int, int, int)} * cannot be accurate. Typically, this is when ViaVersion is not installed but a client still manages to connect. * If this occurs to you somehow, please let us know!! */ @@ -40,7 +40,7 @@ public class GeyserSpigotFallbackWorldManager extends GeyserSpigotWorldManager { } @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { return BlockStateValues.JAVA_AIR_ID; } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java index caeb257f7..242d7ea23 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java @@ -33,7 +33,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin; import java.util.List; @@ -66,7 +66,7 @@ public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorl } @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { int nativeBlockId = super.getBlockAt(session, x, y, z); return oldToNewBlockId.getOrDefault(nativeBlockId, nativeBlockId); } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java index b1032671a..0c3e21c01 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; @@ -42,7 +42,7 @@ public class GeyserSpigotNativeWorldManager extends GeyserSpigotWorldManager { } @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { return BlockStateValues.JAVA_AIR_ID; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 8972b0ac6..35eb292a6 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -39,7 +39,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.Plugin; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.GeyserWorldManager; import org.geysermc.geyser.level.block.BlockStateValues; @@ -66,7 +66,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { Player bukkitPlayer; if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) { return BlockStateValues.JAVA_AIR_ID; @@ -90,7 +90,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad) { + public NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad) { // Run as a task to prevent async issues Runnable lecternInfoGet = () -> { Player bukkitPlayer; @@ -158,7 +158,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { return true; } - public Boolean getGameRuleBool(GeyserSession session, GameRule gameRule) { + public Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule) { String value = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getGameRuleValue(gameRule.getJavaID()); if (!value.isEmpty()) { return Boolean.parseBoolean(value); @@ -167,7 +167,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public int getGameRuleInt(GeyserSession session, GameRule gameRule) { + public int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule) { String value = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getGameRuleValue(gameRule.getJavaID()); if (!value.isEmpty()) { return Integer.parseInt(value); @@ -176,7 +176,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public boolean hasPermission(GeyserSession session, String permission) { + public boolean hasPermission(GeyserSessionImpl session, String permission) { return Bukkit.getPlayer(session.getPlayerEntity().getUsername()).hasPermission(permission); } diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java index 333ab9038..7e0f2a410 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongeLogger.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.sponge; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.slf4j.Logger; @AllArgsConstructor diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java index 5b8496680..6fbd3e219 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java @@ -30,7 +30,7 @@ import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandResult; @@ -54,7 +54,7 @@ public class GeyserSpongeCommandExecutor extends CommandExecutor implements Comm @Override public CommandResult process(CommandSource source, String arguments) { CommandSender commandSender = new SpongeCommandSender(source); - GeyserSession session = getGeyserSession(commandSender); + GeyserSessionImpl session = getGeyserSession(commandSender); String[] args = arguments.split(" "); if (args.length > 0) { diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java index 20d1ec08b..07c0f410a 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/SpongeCommandSender.java @@ -38,7 +38,7 @@ public class SpongeCommandSender implements CommandSender { private CommandSource handle; @Override - public String getName() { + public String name() { return handle.getName(); } diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java index 6aec896d1..b585ebe7b 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneLogger.java @@ -30,7 +30,7 @@ import net.minecrell.terminalconsole.SimpleTerminalConsole; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.config.Configurator; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.text.ChatColor; @@ -97,7 +97,7 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements Gey } @Override - public String getName() { + public String name() { return "CONSOLE"; } diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java index 56d211986..e0d957d4f 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.platform.standalone.gui; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.standalone.GeyserStandaloneLogger; import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager; @@ -306,7 +306,7 @@ public class GeyserStandaloneGUI { // Update player table playerTableModel.getDataVector().removeAllElements(); - for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { + for (GeyserSessionImpl player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { Vector row = new Vector<>(); row.add(player.getSocketAddress().getHostName()); row.add(player.getPlayerEntity().getUsername()); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java index 57d988dc6..de9ea78d5 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityLogger.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.velocity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.slf4j.Logger; @AllArgsConstructor diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java index 1034d6062..ecc9641c9 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java @@ -31,7 +31,7 @@ import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; @@ -47,7 +47,7 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si @Override public void execute(Invocation invocation) { CommandSender sender = new VelocityCommandSender(invocation.source()); - GeyserSession session = getGeyserSession(sender); + GeyserSessionImpl session = getGeyserSession(sender); if (invocation.arguments().length > 0) { GeyserCommand command = getCommand(invocation.arguments()[0]); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java index 48edb71b1..3ef08d4e9 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/VelocityCommandSender.java @@ -45,7 +45,7 @@ public class VelocityCommandSender implements CommandSender { } @Override - public String getName() { + public String name() { if (handle instanceof Player) { return ((Player) handle).getUsername(); } else if (handle instanceof ConsoleCommandSource) { diff --git a/core/pom.xml b/core/pom.xml index fd54b99d7..fc4d84e3c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -26,7 +26,7 @@ org.geysermc - api + geyser-api 1.4.3-SNAPSHOT compile diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index af05a4aca..d2d493ecf 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.BedrockServer; import org.geysermc.common.PlatformType; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.Geyser; +import org.geysermc.api.Geyser; import java.util.UUID; @@ -73,14 +73,14 @@ public class GeyserConnector { } public GeyserSession getPlayerByXuid(String xuid) { - return new GeyserSession(GeyserImpl.getInstance().getPlayerByXuid(xuid)); + return new GeyserSession(GeyserImpl.getInstance().sessionByXuid(xuid)); } public GeyserSession getPlayerByUuid(UUID uuid) { - return new GeyserSession(GeyserImpl.getInstance().getPlayerByUuid(uuid)); + return new GeyserSession(GeyserImpl.getInstance().sessionByUuid(uuid)); } public boolean isProductionEnvironment() { - return GeyserImpl.getInstance().isProductionEnvironment(); + return GeyserImpl.getInstance().productionEnvironment(); } } diff --git a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 07b7a3298..27c0ce5e0 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -28,6 +28,7 @@ package org.geysermc.connector.network.session; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.protocol.bedrock.BedrockPacket; import org.geysermc.connector.network.session.auth.AuthData; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Deprecated, legacy code. Serves as a wrapper around @@ -37,9 +38,9 @@ import org.geysermc.connector.network.session.auth.AuthData; */ @Deprecated public class GeyserSession { - private final org.geysermc.geyser.session.GeyserSession handle; + private final GeyserSessionImpl handle; - public GeyserSession(org.geysermc.geyser.session.GeyserSession handle) { + public GeyserSession(GeyserSessionImpl handle) { this.handle = handle; } @@ -128,7 +129,7 @@ public class GeyserSession { } public String getName() { - return this.handle.getName(); + return this.handle.name(); } public boolean isConsole() { diff --git a/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java index 19e6131bc..3c9a5ee72 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java +++ b/core/src/main/java/org/geysermc/connector/network/session/auth/AuthData.java @@ -41,14 +41,14 @@ public class AuthData { } public String getName() { - return this.handle.getName(); + return this.handle.name(); } public UUID getUUID() { - return this.handle.getUuid(); + return this.handle.uuid(); } public String getXboxUUID() { - return this.handle.getXuid(); + return this.handle.xuid(); } } diff --git a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java index 4bed3aaca..73b1cd0fa 100644 --- a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java +++ b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java @@ -25,7 +25,7 @@ package org.geysermc.geyser; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; import org.geysermc.geyser.text.GeyserLocale; diff --git a/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java b/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java index 1411c0175..b313af9bb 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java @@ -27,7 +27,7 @@ package org.geysermc.geyser; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.level.GeyserWorldManager; diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index 546602162..a51dd7b40 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -39,9 +39,12 @@ import io.netty.util.concurrent.DefaultThreadFactory; import io.netty.util.internal.SystemPropertyUtil; import lombok.Getter; import lombok.Setter; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.api.Geyser; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.api.Geyser; +import org.geysermc.geyser.api.GeyserApi; +import org.geysermc.geyser.api.session.GeyserSession; import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; @@ -52,7 +55,7 @@ import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.MinecraftLocale; import org.geysermc.geyser.util.Metrics; import org.geysermc.geyser.network.ConnectorServerEventHandler; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.level.WorldManager; @@ -67,7 +70,6 @@ import org.geysermc.floodgate.crypto.Base64Topping; import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.time.TimeSyncer; -import org.jetbrains.annotations.Contract; import javax.naming.directory.Attribute; import javax.naming.directory.InitialDirContext; @@ -77,6 +79,7 @@ import java.net.UnknownHostException; import java.security.Key; import java.text.DecimalFormat; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.UUID; @@ -86,7 +89,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; @Getter -public class GeyserImpl extends Geyser { +public class GeyserImpl implements GeyserApi { public static final ObjectMapper JSON_MAPPER = new ObjectMapper() .enable(JsonParser.Feature.IGNORE_UNDEFINED) .enable(JsonParser.Feature.ALLOW_COMMENTS) @@ -128,13 +131,17 @@ public class GeyserImpl extends Geyser { private final Metrics metrics; + private static GeyserImpl instance; + private GeyserImpl(PlatformType platformType, GeyserBootstrap bootstrap) { long startupTime = System.currentTimeMillis(); - Geyser.setInstance(this); - this.bootstrap = bootstrap; + instance = this; + + Geyser.set(this); + GeyserLogger logger = bootstrap.getGeyserLogger(); GeyserConfiguration config = bootstrap.getGeyserConfig(); @@ -217,7 +224,7 @@ public class GeyserImpl extends Geyser { String branch = "unknown"; int buildNumber = -1; - if (this.isProductionEnvironment()) { + if (this.productionEnvironment()) { try { Properties gitProperties = new Properties(); gitProperties.load(FileUtils.getResource("git.properties")); @@ -290,7 +297,7 @@ public class GeyserImpl extends Geyser { metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION)); metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> { Map valueMap = new HashMap<>(); - for (GeyserSession session : sessionManager.getAllSessions()) { + for (GeyserSessionImpl session : sessionManager.getAllSessions()) { if (session == null) continue; if (session.getClientData() == null) continue; String os = session.getClientData().getDeviceOs().toString(); @@ -304,7 +311,7 @@ public class GeyserImpl extends Geyser { })); metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> { Map valueMap = new HashMap<>(); - for (GeyserSession session : sessionManager.getAllSessions()) { + for (GeyserSessionImpl session : sessionManager.getAllSessions()) { if (session == null) continue; if (session.getClientData() == null) continue; String version = session.getClientData().getGameVersion(); @@ -395,6 +402,40 @@ public class GeyserImpl extends Geyser { newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); } + @Override + public @Nullable GeyserSessionImpl sessionByName(@NonNull String name) { + for (GeyserSessionImpl session : sessionManager.getAllSessions()) { + if (session.name().equals(name) || session.getProtocol().getProfile().getName().equals(name)) { + return session; + } + } + + return null; + } + + @Override + @SuppressWarnings("unchecked") + public @NonNull List onlineSessions() { + return (List) (List) this.sessionManager.getAllSessions(); + } + + @Override + public @Nullable GeyserSessionImpl sessionByUuid(@NonNull UUID uuid) { + return this.sessionManager.getSessions().get(uuid); + } + + @Override + public @Nullable GeyserSessionImpl sessionByXuid(@NonNull String xuid) { + for (GeyserSessionImpl session : sessionManager.getAllSessions()) { + if (session.xuid().equals(xuid)) { + return session; + } + } + + return null; + } + + @Override public void shutdown() { bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown")); shuttingDown = true; @@ -419,47 +460,28 @@ public class GeyserImpl extends Geyser { bootstrap.getGeyserLogger().info(GeyserLocale.getLocaleStringLog("geyser.core.shutdown.done")); } - /** - * Gets a player by their current UUID - * - * @param uuid the uuid - * @return the player or null if there is no player online with this UUID - */ - @Contract("null -> null") - public GeyserSession getPlayerByUuid(UUID uuid) { - if (uuid == null) { - return null; - } - - return sessionManager.getSessions().get(uuid); + @Override + public void reload() { + shutdown(); + bootstrap.onEnable(); } /** - * Gets a player by their Xbox user identifier + * Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files + * expected to be in a jarfile are not present. * - * @param xuid the Xbox user identifier - * @return the player or null if there is no player online with this xuid + * @return true if the version number is not 'DEV'. */ - @SuppressWarnings("unused") // API usage - public GeyserSession getPlayerByXuid(String xuid) { - for (GeyserSession session : sessionManager.getAllSessions()) { - if (session.getAuthData().getXuid().equals(xuid)) { - return session; - } - } - - return null; + @Override + public boolean productionEnvironment() { + //noinspection ConstantConditions - changes in production + return !"DEV".equals(GeyserImpl.VERSION); } public static GeyserImpl start(PlatformType platformType, GeyserBootstrap bootstrap) { return new GeyserImpl(platformType, bootstrap); } - public void reload() { - shutdown(); - bootstrap.onEnable(); - } - public GeyserLogger getLogger() { return bootstrap.getGeyserLogger(); } @@ -480,18 +502,7 @@ public class GeyserImpl extends Geyser { return timeSyncer; } - /** - * Returns false if this Geyser instance is running in an IDE. This only needs to be used in cases where files - * expected to be in a jarfile are not present. - * - * @return true if the version number is not 'DEV'. - */ - public boolean isProductionEnvironment() { - //noinspection ConstantConditions - changes in production - return !"DEV".equals(GeyserImpl.VERSION); - } - public static GeyserImpl getInstance() { - return (GeyserImpl) Geyser.getInstance(); + return instance; } } diff --git a/api/src/main/java/org/geysermc/geyser/api/logger/GeyserLogger.java b/core/src/main/java/org/geysermc/geyser/GeyserLogger.java similarity index 98% rename from api/src/main/java/org/geysermc/geyser/api/logger/GeyserLogger.java rename to core/src/main/java/org/geysermc/geyser/GeyserLogger.java index 564a8f30c..266132f63 100644 --- a/api/src/main/java/org/geysermc/geyser/api/logger/GeyserLogger.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserLogger.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.api.logger; +package org.geysermc.geyser; public interface GeyserLogger { diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java index 8e970d6a0..c30a1df56 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.command; import lombok.AllArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import javax.annotation.Nullable; import java.util.ArrayList; @@ -48,13 +48,13 @@ public class CommandExecutor { } @Nullable - public GeyserSession getGeyserSession(CommandSender sender) { + public GeyserSessionImpl getGeyserSession(CommandSender sender) { if (sender.isConsole()) { return null; } - for (GeyserSession session : geyser.getSessionManager().getSessions().values()) { - if (sender.getName().equals(session.getPlayerEntity().getUsername())) { + for (GeyserSessionImpl session : geyser.getSessionManager().getSessions().values()) { + if (sender.name().equals(session.getPlayerEntity().getUsername())) { return session; } } diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java index 19b521ed6..791ddd548 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java @@ -30,7 +30,7 @@ import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.defaults.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.*; @@ -93,8 +93,8 @@ public abstract class CommandManager { return; } - if (sender instanceof GeyserSession) { - cmd.execute((GeyserSession) sender, sender, args); + if (sender instanceof GeyserSessionImpl) { + cmd.execute((GeyserSessionImpl) sender, sender, args); } else { if (!cmd.isBedrockOnly()) { cmd.execute(null, sender, args); diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandSender.java b/core/src/main/java/org/geysermc/geyser/command/CommandSender.java index 47881868f..962883e3d 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandSender.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandSender.java @@ -33,7 +33,7 @@ import org.geysermc.geyser.text.GeyserLocale; */ public interface CommandSender { - String getName(); + String name(); default void sendMessage(String[] messages) { for (String message : messages) { diff --git a/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java index 6971ad44d..593c17fe8 100644 --- a/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import javax.annotation.Nullable; import java.util.ArrayList; @@ -49,7 +49,7 @@ public abstract class GeyserCommand { @Setter private List aliases = new ArrayList<>(); - public abstract void execute(@Nullable GeyserSession session, CommandSender sender, String[] args); + public abstract void execute(@Nullable GeyserSessionImpl session, CommandSender sender, String[] args); /** * If false, hides the command from being shown on the Geyser Standalone GUI. diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java index 41bb8e6cd..e9da5a2a0 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class AdvancementsCommand extends GeyserCommand { public AdvancementsCommand(String name, String description, String permission) { @@ -35,7 +35,7 @@ public class AdvancementsCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { if (session != null) { session.getAdvancementsCache().buildAndShowMenuForm(); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java index 64ad6e216..24ff41a60 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java @@ -36,7 +36,7 @@ import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.dump.DumpInfo; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.util.WebUtils; @@ -58,7 +58,7 @@ public class DumpCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { // Only allow the console to create dumps on Geyser Standalone if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); @@ -137,7 +137,7 @@ public class DumpCommand extends GeyserCommand { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.dump.message", sender.getLocale()) + " " + ChatColor.DARK_AQUA + uploadedDumpUrl); if (!sender.isConsole()) { - geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.commands.dump.created", sender.getName(), uploadedDumpUrl)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.commands.dump.created", sender.name(), uploadedDumpUrl)); } } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index 4d4a21319..8ca115007 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -29,7 +29,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -53,7 +53,7 @@ public class HelpCommand extends GeyserCommand { * @param args Not used. */ @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { int page = 1; int maxPage = 1; String header = GeyserLocale.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java index 1da6b79c2..a5a5df000 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.stream.Collectors; @@ -44,10 +44,10 @@ public class ListCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { String message = GeyserLocale.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), geyser.getSessionManager().size(), - geyser.getSessionManager().getAllSessions().stream().map(GeyserSession::getName).collect(Collectors.joining(" "))); + geyser.getSessionManager().getAllSessions().stream().map(GeyserSessionImpl::name).collect(Collectors.joining(" "))); sender.sendMessage(message); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java index 934cd8c87..24a8c8f22 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.BlockUtils; public class OffhandCommand extends GeyserCommand { @@ -41,7 +41,7 @@ public class OffhandCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { if (session == null) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java index 1a72e1734..9ea44577b 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java @@ -29,7 +29,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; public class ReloadCommand extends GeyserCommand { @@ -42,7 +42,7 @@ public class ReloadCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java index 349f7288b..fd9460255 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.SettingsUtils; public class SettingsCommand extends GeyserCommand { @@ -37,7 +37,7 @@ public class SettingsCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { if (session != null) { session.sendForm(SettingsUtils.buildForm(session)); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java index c570770b7..39cbfce7e 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCl import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class StatisticsCommand extends GeyserCommand { @@ -39,7 +39,7 @@ public class StatisticsCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { if (session == null) return; session.setWaitingForStatistics(true); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java index 6b74f9c8b..6ef26f121 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java @@ -29,7 +29,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -46,7 +46,7 @@ public class StopCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index ff80abba3..164ddea92 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.util.WebUtils; @@ -54,7 +54,7 @@ public class VersionCommand extends GeyserCommand { } @Override - public void execute(GeyserSession session, CommandSender sender, String[] args) { + public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { String bedrockVersions; List supportedCodecs = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS; if (supportedCodecs.size() > 1) { @@ -67,7 +67,7 @@ public class VersionCommand extends GeyserCommand { GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone - if (GeyserImpl.getInstance().isProductionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { + if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale())); try { Properties gitProp = new Properties(); diff --git a/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java index eb6b68f78..57cb5fb09 100644 --- a/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java +++ b/core/src/main/java/org/geysermc/geyser/configuration/GeyserConfiguration.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.configuration; import com.fasterxml.jackson.annotation.JsonIgnore; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.network.CIDRMatcher; import org.geysermc.geyser.text.GeyserLocale; diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index 5a77b84fb..b4c1f7f6b 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -39,7 +39,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.util.WebUtils; import org.geysermc.floodgate.util.DeviceOs; @@ -113,7 +113,7 @@ public class DumpInfo { } this.userPlatforms = new Object2IntOpenHashMap<>(); - for (GeyserSession session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) { + for (GeyserSessionImpl session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) { DeviceOs device = session.getClientData().getDeviceOs(); userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java index b51f83f2c..132194711 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java +++ b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java @@ -36,7 +36,7 @@ import org.geysermc.geyser.entity.type.living.animal.horse.HorseEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity; import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.EnumSet; @@ -62,7 +62,7 @@ public class InteractiveTagManager { * @param session the Bedrock client session * @param interactEntity the entity that the client is currently facing. */ - public static void updateTag(GeyserSession session, Entity interactEntity) { + public static void updateTag(GeyserSessionImpl session, Entity interactEntity) { ItemMapping mapping = session.getPlayerInventory().getItemInHand().getMapping(session); String javaIdentifierStripped = mapping.getJavaIdentifier().replace("minecraft:", ""); EntityType entityType = interactEntity.getDefinition().entityType(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java index dff1617f9..13a3140f2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java @@ -28,12 +28,12 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @FunctionalInterface public interface BaseEntityFactory extends EntityFactory { - T create(GeyserSession session, long javaId, long bedrockId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); + T create(GeyserSessionImpl session, long javaId, long bedrockId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java index 40a93c08b..1c8800172 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java @@ -27,10 +27,10 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.ExpOrbEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; @FunctionalInterface public interface ExperienceOrbEntityFactory extends EntityFactory { - ExpOrbEntity create(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position); + ExpOrbEntity create(GeyserSessionImpl session, int amount, long entityId, long geyserId, Vector3f position); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java index 2990b0ac5..2d5ff63b3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java @@ -27,12 +27,12 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.PaintingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.PaintingType; import java.util.UUID; public interface PaintingEntityFactory extends EntityFactory { - PaintingEntity create(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction); + PaintingEntity create(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java index b80db2570..c8fc72eb2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java @@ -30,13 +30,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AbstractArrowEntity extends Entity { - public AbstractArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractArrowEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Set the correct texture if using the resource pack diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java index 6063c81f9..a9c6bf11a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java @@ -32,14 +32,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.Registries; import java.util.UUID; public class AreaEffectCloudEntity extends Entity { - public AreaEffectCloudEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AreaEffectCloudEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java index ac1b3fcbd..85113ba2c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -65,7 +65,7 @@ public class BoatEntity extends Entity { // Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it private final float ROWING_SPEED = 0.05f; - public BoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BoatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Initial rotation is incorrect super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); @@ -154,7 +154,7 @@ public class BoatEntity extends Entity { } } - private void updateLeftPaddle(GeyserSession session, Entity rower) { + private void updateLeftPaddle(GeyserSessionImpl session, Entity rower) { if (isPaddlingLeft) { paddleTimeLeft += ROWING_SPEED; sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_LEFT, paddleTimeLeft); @@ -167,7 +167,7 @@ public class BoatEntity extends Entity { } } - private void updateRightPaddle(GeyserSession session, Entity rower) { + private void updateRightPaddle(GeyserSessionImpl session, Entity rower) { if (isPaddlingRight) { paddleTimeRight += ROWING_SPEED; sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_RIGHT, paddleTimeRight); @@ -180,7 +180,7 @@ public class BoatEntity extends Entity { } } - private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) { + private void sendAnimationPacket(GeyserSessionImpl session, Entity rower, AnimatePacket.Action action, float rowTime) { AnimatePacket packet = new AnimatePacket(); packet.setRuntimeEntityId(rower.getGeyserId()); packet.setAction(action); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java index 1764c721e..0b755f114 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { - public CommandBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CommandBlockMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java index ec00c30be..5e6a15198 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -43,7 +43,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { public int customBlockOffset = 0; public boolean showCustomBlock = false; - public DefaultBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public DefaultBlockMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java index aa907b7c6..421043ff6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java @@ -32,14 +32,14 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Optional; import java.util.UUID; public class EnderCrystalEntity extends Entity { - public EnderCrystalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EnderCrystalEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index 3b01c428f..7935566e8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -45,7 +45,7 @@ import lombok.Setter; import net.kyori.adventure.text.Component; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.GeyserDirtyMetadata; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.util.MathUtils; @@ -55,7 +55,7 @@ import java.util.UUID; @Getter @Setter public class Entity { - protected final GeyserSession session; + protected final GeyserSessionImpl session; protected long entityId; protected final long geyserId; @@ -108,7 +108,7 @@ public class Entity { @Setter(AccessLevel.PROTECTED) // For players private boolean flagsDirty = false; - public Entity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public Entity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { this.session = session; this.entityId = entityId; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java index 25135d0b5..1bd059e95 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class ExpOrbEntity extends Entity { private final int amount; - public ExpOrbEntity(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position) { + public ExpOrbEntity(GeyserSessionImpl session, int amount, long entityId, long geyserId, Vector3f position) { super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); this.amount = amount; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java index 346861f96..f6106f3b0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java @@ -30,14 +30,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class FallingBlockEntity extends Entity { private final int javaId; - public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { + public FallingBlockEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); this.javaId = javaId; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java index 075178b55..b6b383dcb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java @@ -38,7 +38,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.FireworkColor; import org.geysermc.geyser.util.MathUtils; import org.geysermc.floodgate.util.DeviceOs; @@ -50,7 +50,7 @@ import java.util.UUID; public class FireworkEntity extends Entity { - public FireworkEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FireworkEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java index b5774bd78..bac3b9bb8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.translator.collision.BlockCollision; import org.geysermc.geyser.level.block.BlockStateValues; @@ -56,7 +56,7 @@ public class FishingHookEntity extends ThrowableEntity { private final BoundingBox boundingBox; - public FishingHookEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { + public FishingHookEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f); this.boundingBox = new BoundingBox(0.125, 0.125, 0.125, 0.25, 0.25, 0.25); @@ -140,7 +140,7 @@ public class FishingHookEntity extends ThrowableEntity { } } - private void sendSplashSound(GeyserSession session) { + private void sendSplashSound(GeyserSessionImpl session) { if (!getFlag(EntityFlag.SILENT)) { float volume = (float) (0.2f * Math.sqrt(0.2 * (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) + motion.getY() * motion.getY())); if (volume > 1) { diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java index ab34cb751..b9134e7e5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; @@ -37,7 +37,7 @@ import java.util.UUID; public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { private boolean hasFuel = false; - public FurnaceMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FurnaceMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java index dd98f9aba..f3732a83d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -46,7 +46,7 @@ public class ItemEntity extends ThrowableEntity { private int waterLevel = -1; - public ItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ItemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java index b8688abc4..53094bdf3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java @@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -77,7 +77,7 @@ public class ItemFrameEntity extends Entity { */ private boolean changed = true; - public ItemFrameEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) { + public ItemFrameEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 0f); NbtMapBuilder blockBuilder = NbtMap.builder() @@ -214,7 +214,7 @@ public class ItemFrameEntity extends Entity { * @param session GeyserSession. * @return Java entity ID or -1 if not found. */ - public static ItemFrameEntity getItemFrameEntity(GeyserSession session, Vector3i position) { + public static ItemFrameEntity getItemFrameEntity(GeyserSessionImpl session, Vector3i position) { return session.getItemFrameCache().get(position); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java index 49548ec2a..8d45d84ae 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -39,7 +39,7 @@ public class ItemedFireballEntity extends ThrowableEntity { */ protected int futureTicks = 3; - public ItemedFireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ItemedFireballEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw); float magnitude = motion.length(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java index 63e964a55..3443814bf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class LeashKnotEntity extends Entity { - public LeashKnotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LeashKnotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Position is incorrect by default super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java index 1f5af0492..8830117e6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; public class LightningEntity extends Entity { - public LightningEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LightningEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index 678741424..63d481182 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -47,7 +47,7 @@ import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.util.AttributeUtils; import org.geysermc.geyser.util.ChunkUtils; @@ -79,7 +79,7 @@ public class LivingEntity extends Entity { */ private boolean isMaxFrozenState = false; - public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LivingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @@ -168,7 +168,7 @@ public class LivingEntity extends Entity { return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, (float) Math.ceil(this.health), this.maxHealth); } - public void updateArmor(GeyserSession session) { + public void updateArmor(GeyserSessionImpl session) { if (!valid) return; ItemData helmet = this.helmet; @@ -194,7 +194,7 @@ public class LivingEntity extends Entity { session.sendUpstreamPacket(armorEquipmentPacket); } - public void updateMainHand(GeyserSession session) { + public void updateMainHand(GeyserSessionImpl session) { if (!valid) return; MobEquipmentPacket handPacket = new MobEquipmentPacket(); @@ -207,7 +207,7 @@ public class LivingEntity extends Entity { session.sendUpstreamPacket(handPacket); } - public void updateOffHand(GeyserSession session) { + public void updateOffHand(GeyserSessionImpl session) { if (!valid) return; MobEquipmentPacket offHandPacket = new MobEquipmentPacket(); @@ -226,7 +226,7 @@ public class LivingEntity extends Entity { * * @param attributes the Java list of attributes sent from the server */ - public void updateBedrockAttributes(GeyserSession session, List attributes) { + public void updateBedrockAttributes(GeyserSessionImpl session, List attributes) { if (!valid) return; List newAttributes = new ArrayList<>(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java index ffb5e4018..d71895466 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java @@ -30,13 +30,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class MinecartEntity extends Entity { - public MinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java index e97bb7090..32c0da71b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.PaintingType; import java.util.UUID; @@ -38,7 +38,7 @@ public class PaintingEntity extends Entity { private final PaintingType paintingName; private final int direction; - public PaintingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) { + public PaintingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) { super(session, entityId, geyserId, uuid, EntityDefinitions.PAINTING, position, Vector3f.ZERO, 0f, 0f, 0f); this.paintingName = paintingName; this.direction = direction; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java index 2cd4cf3f6..2ca179be0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity { - public SpawnerMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpawnerMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java index e7edd32d5..31b06d4c4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class TNTEntity extends Entity implements Tickable { private int currentTick; - public TNTEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TNTEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java index 67aa09794..5b0ff57fb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; @@ -44,7 +44,7 @@ public class ThrowableEntity extends Entity implements Tickable { protected Vector3f lastJavaPosition; - public ThrowableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrowableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.lastJavaPosition = position; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java index 7abffd0bf..ae2de746c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -42,7 +42,7 @@ public class ThrowableItemEntity extends ThrowableEntity { private int age; private boolean invisible; - public ThrowableItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrowableItemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.INVISIBLE, true); invisible = false; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java index c4cd5d54a..19d2b09b4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.registry.type.ItemMapping; @@ -44,7 +44,7 @@ import java.util.UUID; public class ThrownPotionEntity extends ThrowableItemEntity { private static final EnumSet NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD); - public ThrownPotionEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrownPotionEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java index a60c0ab33..cb3e2471d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.item.TippedArrowPotion; import java.util.UUID; @@ -39,7 +39,7 @@ import java.util.UUID; */ public class TippedArrowEntity extends AbstractArrowEntity { - public TippedArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TippedArrowEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java index 65591fb50..5e1151db6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class TridentEntity extends AbstractArrowEntity { - public TridentEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TridentEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java index fbed041fe..fb40862cc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class WitherSkullEntity extends ItemedFireballEntity { private boolean isCharged; - public WitherSkullEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WitherSkullEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.futureTicks = 1; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java index 8fedce1e7..1a97bfb12 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AbstractFishEntity extends WaterEntity { - public AbstractFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.CAN_SWIM, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java index b250f3e8e..6fb687f47 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AgeableEntity extends CreatureEntity { - public AgeableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AgeableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java index 693a0cd46..0c15fa95c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AmbientEntity extends MobEntity { - public AmbientEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AmbientEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java index fb459bf54..7f5ccd306 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java @@ -38,7 +38,7 @@ import net.kyori.adventure.text.Component; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Optional; import java.util.UUID; @@ -78,7 +78,7 @@ public class ArmorStandEntity extends LivingEntity { */ private boolean positionUpdateRequired = false; - public ArmorStandEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ArmorStandEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java index 0a72a431e..07853429a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class BatEntity extends AmbientEntity { - public BatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java index b5e7557da..cef93a7a6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class CreatureEntity extends MobEntity { - public CreatureEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CreatureEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java index 91f839bc3..3a6581d2f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class FlyingEntity extends MobEntity { - public FlyingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FlyingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java index b5950b7bc..dc49ec765 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java @@ -27,12 +27,12 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class GlowSquidEntity extends SquidEntity { - public GlowSquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GlowSquidEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java index eb94e1406..a6cec0788 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class GolemEntity extends CreatureEntity { - public GolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java index f86392ed3..9a28d7032 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java @@ -29,13 +29,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class IronGolemEntity extends GolemEntity { - public IronGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public IronGolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that we should show cracks through a resource pack setFlag(EntityFlag.BRIBED, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java index 03cf9f3dc..1610ee6e5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class MagmaCubeEntity extends SlimeEntity { - public MagmaCubeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MagmaCubeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java index e82b813d7..0a06f67c6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -43,7 +43,7 @@ public class MobEntity extends LivingEntity { @Getter private long leashHolderBedrockId; - public MobEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MobEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java index 100ed764d..5d9a4604c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class SlimeEntity extends MobEntity { - public SlimeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SlimeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java index 1d8375529..c8bf1d67a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class SnowGolemEntity extends GolemEntity { - public SnowGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SnowGolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java index b0e2fcb9e..ada353196 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; @@ -41,7 +41,7 @@ public class SquidEntity extends WaterEntity implements Tickable { private boolean inWater; - public SquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SquidEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java index acacd1f52..c1940d043 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class WaterEntity extends CreatureEntity { - public WaterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WaterEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java index c7c15b288..01e3b7a80 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AgeableEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class AnimalEntity extends AgeableEntity { - public AnimalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AnimalEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java index 4dfa5fa8d..d8026d378 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java @@ -31,13 +31,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class AxolotlEntity extends AnimalEntity { - public AxolotlEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AxolotlEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java index 7f9ec4255..de761167d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java @@ -33,14 +33,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class BeeEntity extends AnimalEntity { - public BeeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BeeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java index 506714dbc..051c53eae 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class ChickenEntity extends AnimalEntity { - public ChickenEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChickenEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java index 127a70a0f..cf7e83108 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class FoxEntity extends AnimalEntity { - public FoxEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FoxEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java index 708a95134..a0701503f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -41,7 +41,7 @@ public class GoatEntity extends AnimalEntity { @Getter private boolean isScreamer; - public GoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GoatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java index ed0feed97..9456361ee 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.util.DimensionUtils; @@ -38,7 +38,7 @@ import java.util.UUID; public class HoglinEntity extends AnimalEntity { private boolean isImmuneToZombification; - public HoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public HoglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java index 15473c8ac..ffd7c138b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class MooshroomEntity extends AnimalEntity { - public MooshroomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MooshroomEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java index 5244e3538..a769324c5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class OcelotEntity extends AnimalEntity { - public OcelotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public OcelotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java index 7548ccef1..74a4b85c0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -42,7 +42,7 @@ public class PandaEntity extends AnimalEntity { private int mainGene; private int hiddenGene; - public PandaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PandaEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java index 0be4c78f1..000ace4b3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class PigEntity extends AnimalEntity { - public PigEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PigEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java index 727804dbc..bf4991119 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class PolarBearEntity extends AnimalEntity { - public PolarBearEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PolarBearEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java index 66853babf..39fecff46 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class PufferFishEntity extends AbstractFishEntity { - public PufferFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PufferFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java index a1d80ac72..0db826ecb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class RabbitEntity extends AnimalEntity { - public RabbitEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public RabbitEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java index 757c5b574..a494df017 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class SheepEntity extends AnimalEntity { - public SheepEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SheepEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java index d684fba06..db4a44ede 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java @@ -30,7 +30,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -39,7 +39,7 @@ public class StriderEntity extends AnimalEntity { private boolean isCold = false; - public StriderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public StriderEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.FIRE_IMMUNE, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java index b883c91a9..08a204804 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.List; import java.util.UUID; @@ -48,7 +48,7 @@ public class TropicalFishEntity extends AbstractFishEntity { private static final List VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish"); private static final List COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black"); - public TropicalFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TropicalFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java index e892d7d5e..8a70f9605 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class TurtleEntity extends AnimalEntity { - public TurtleEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TurtleEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java index 7d0a3cf9a..6a7391461 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; @@ -51,7 +51,7 @@ public class AbstractHorseEntity extends AnimalEntity { private static final Set DONKEY_AND_HORSE_FOODS = ImmutableSet.of("golden_apple", "enchanted_golden_apple", "golden_carrot", "sugar", "apple", "wheat", "hay_block"); - public AbstractHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractHorseEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Specifies the size of the entity's inventory. Required to place slots in the entity. diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java index ccf30dbc8..5389d0236 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ChestedHorseEntity extends AbstractHorseEntity { - public ChestedHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChestedHorseEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java index 31b5b7890..77f25bc8a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class HorseEntity extends AbstractHorseEntity { - public HorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public HorseEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java index c18778c81..7883a564d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class LlamaEntity extends ChestedHorseEntity { - public LlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LlamaEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java index 770d30a05..399ee529b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class TraderLlamaEntity extends LlamaEntity { - public TraderLlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TraderLlamaEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java index 5538621d9..050c066d8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -41,7 +41,7 @@ public class CatEntity extends TameableEntity { private byte collarColor; - public CatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java index 05f0a6ad5..c291dbbe8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal.tameable; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class ParrotEntity extends TameableEntity { - public ParrotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ParrotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java index d12839e92..1a00a4803 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java @@ -34,7 +34,7 @@ import lombok.Getter; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Optional; import java.util.UUID; @@ -46,7 +46,7 @@ public class TameableEntity extends AnimalEntity { @Getter protected long ownerBedrockId; - public TameableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TameableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java index 13bb8e17d..91d5088f2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; @@ -49,7 +49,7 @@ public class WolfEntity extends TameableEntity { private byte collarColor; - public WolfEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WolfEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java index 7981c9b23..0e40fd9a1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.merchant; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AgeableEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AbstractMerchantEntity extends AgeableEntity { - public AbstractMerchantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractMerchantEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java index 012fb05f2..b403f4362 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java @@ -37,7 +37,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.BlockRegistries; import java.util.Optional; @@ -88,7 +88,7 @@ public class VillagerEntity extends AbstractMerchantEntity { @Getter private boolean canTradeWith; - public VillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VillagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java index ae13cfeae..3a923ef7f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AbstractSkeletonEntity extends MonsterEntity { - public AbstractSkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractSkeletonEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java index 2f315368f..19ccaaef2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.DimensionUtils; import java.util.UUID; @@ -37,7 +37,7 @@ import java.util.UUID; public class BasePiglinEntity extends MonsterEntity { private boolean isImmuneToZombification; - public BasePiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BasePiglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java index 2303f8091..46e4576c9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class BlazeEntity extends MonsterEntity { - public BlazeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BlazeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java index f1e0b6a65..e601999cf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -41,7 +41,7 @@ public class CreeperEntity extends MonsterEntity { */ private boolean ignitedByFlintAndSteel = false; - public CreeperEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CreeperEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java index 9c237f117..b25bc3168 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ElderGuardianEntity extends GuardianEntity { - public ElderGuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ElderGuardianEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java index f49b51e6c..5319e4b2a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java @@ -36,7 +36,7 @@ import lombok.Data; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.type.living.MobEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.DimensionUtils; import java.util.Random; @@ -79,7 +79,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable { private float wingPosition; private float lastWingPosition; - public EnderDragonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EnderDragonEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java index 7cd4bb6cf..2ab9cc461 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java @@ -30,11 +30,11 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class EnderDragonPartEntity extends Entity { - public EnderDragonPartEntity(GeyserSession session, long entityId, long geyserId, float width, float height) { + public EnderDragonPartEntity(GeyserSessionImpl session, long entityId, long geyserId, float width, float height) { super(session, entityId, geyserId, null, EntityDefinitions.ENDER_DRAGON_PART, Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, width); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java index 469f48521..771b00e36 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java @@ -33,13 +33,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class EndermanEntity extends MonsterEntity { - public EndermanEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EndermanEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java index 845a281d9..a03f1df95 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.FlyingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class GhastEntity extends FlyingEntity { - public GhastEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GhastEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java index 6dd27cc39..2c84efd77 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class GiantEntity extends MonsterEntity { - public GiantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GiantEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityData.SCALE, 6f); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java index 0190f3c60..9c1954134 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class GuardianEntity extends MonsterEntity { - public GuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GuardianEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java index fad45f982..0372c174a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.CreatureEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class MonsterEntity extends CreatureEntity { - public MonsterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MonsterEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java index 68f3e7d23..0854c2522 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java @@ -30,12 +30,12 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.FlyingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class PhantomEntity extends FlyingEntity { - public PhantomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PhantomEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java index b98d6eabc..084f1dc36 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class PiglinEntity extends BasePiglinEntity { - public PiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PiglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @@ -55,7 +55,7 @@ public class PiglinEntity extends BasePiglinEntity { } @Override - public void updateOffHand(GeyserSession session) { + public void updateOffHand(GeyserSessionImpl session) { // Check if the Piglin is holding Gold and set the ADMIRING flag accordingly so its pose updates setFlag(EntityFlag.ADMIRING, session.getTagCache().shouldPiglinAdmire(session.getItemMappings().getMapping(this.offHand))); super.updateBedrockMetadata(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java index e60f81d2f..d5d816a46 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java @@ -33,13 +33,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.GolemEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ShulkerEntity extends GolemEntity { - public ShulkerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ShulkerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that invisibility should be fixed through the resource pack setFlag(EntityFlag.BRIBED, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java index b1f6939aa..9339b6593 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class SkeletonEntity extends AbstractSkeletonEntity { private boolean convertingToStray = false; - public SkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SkeletonEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java index 4f7b02d73..af358a800 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class SpiderEntity extends MonsterEntity { - public SpiderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpiderEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java index 938b18022..f6017d479 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class VexEntity extends MonsterEntity { - public VexEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VexEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java index 17da0a611..d79fe4e8b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class WitherEntity extends MonsterEntity { - public WitherEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WitherEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java index f0fe101da..364233d81 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ZoglinEntity extends MonsterEntity { - public ZoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZoglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java index 9e3301b48..1cd5c4c91 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java @@ -30,14 +30,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ZombieEntity extends MonsterEntity { private boolean convertingToDrowned = false; - public ZombieEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java index 54a5c4506..4fa3d88f8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java @@ -33,14 +33,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ZombieVillagerEntity extends ZombieEntity { private boolean isTransforming; - public ZombieVillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieVillagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java index 2604ce12e..aaf3d8001 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class ZombifiedPiglinEntity extends ZombieEntity { - public ZombifiedPiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombifiedPiglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.FIRE_IMMUNE, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java index 15ac1a0d9..ff24b7fb2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class AbstractIllagerEntity extends RaidParticipantEntity { - public AbstractIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractIllagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java index 477d9fef7..d13fc247a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java @@ -28,26 +28,26 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class PillagerEntity extends AbstractIllagerEntity { - public PillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PillagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateMainHand(GeyserSession session) { //TODO + public void updateMainHand(GeyserSessionImpl session) { //TODO checkForCrossbow(); super.updateMainHand(session); } @Override - public void updateOffHand(GeyserSession session) { + public void updateOffHand(GeyserSessionImpl session) { checkForCrossbow(); super.updateOffHand(session); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java index bd0f3ac5d..cecb679aa 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.monster.MonsterEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class RaidParticipantEntity extends MonsterEntity { - public RaidParticipantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public RaidParticipantEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java index 7c2a05de1..0ada45517 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; @@ -40,7 +40,7 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { private static final int ATTACK_PARTICLE_COLOR = (102 << 16) | (77 << 8) | 89; private static final int WOLOLO_PARTICLE_COLOR = (179 << 16) | (128 << 8) | 51; - public SpellcasterIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpellcasterIllagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // OptionalPack usage setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java index a3b85dc73..d6b239e10 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.UUID; public class VindicatorEntity extends AbstractIllagerEntity { - public VindicatorEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VindicatorEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 8737ef847..4a3064825 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -52,7 +52,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.ParrotEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Score; @@ -81,7 +81,7 @@ public class PlayerEntity extends LivingEntity { */ private ParrotEntity rightParrot; - public PlayerEntity(GeyserSession session, long entityId, long geyserId, GameProfile gameProfile, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PlayerEntity(GeyserSessionImpl session, long entityId, long geyserId, GameProfile gameProfile, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, gameProfile.getId(), EntityDefinitions.PLAYER, position, motion, yaw, pitch, headYaw); profile = gameProfile; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index c297bdb18..4ee309290 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.AttributeUtils; import java.util.Collections; @@ -48,7 +48,7 @@ import java.util.Map; import java.util.UUID; /** - * The entity class specifically for a {@link GeyserSession}'s player. + * The entity class specifically for a {@link GeyserSessionImpl}'s player. */ public class SessionPlayerEntity extends PlayerEntity { /** @@ -70,9 +70,9 @@ public class SessionPlayerEntity extends PlayerEntity { */ private int fakeTradeXp; - private final GeyserSession session; + private final GeyserSessionImpl session; - public SessionPlayerEntity(GeyserSession session) { + public SessionPlayerEntity(GeyserSessionImpl session) { super(session, 1, 1, new GameProfile(UUID.randomUUID(), "unknown"), Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); valid = true; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java index 0afb3e8b5..8bf3a8400 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * A wrapper to handle skulls more effectively - skulls have to be treated as entities since there are no @@ -48,7 +48,7 @@ public class SkullPlayerEntity extends PlayerEntity { @Getter private final int blockState; - public SkullPlayerEntity(GeyserSession session, long geyserId, GameProfile gameProfile, Vector3f position, float rotation, int blockState) { + public SkullPlayerEntity(GeyserSessionImpl session, long geyserId, GameProfile gameProfile, Vector3f position, float rotation, int blockState) { super(session, 0, geyserId, gameProfile, position, Vector3f.ZERO, rotation, 0, rotation); this.blockState = blockState; setPlayerList(false); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Container.java index 464d683fa..2e1ef0542 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Container.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; /** @@ -60,7 +60,7 @@ public class Container extends Inventory { } @Override - public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { + public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSessionImpl session) { if (slot < this.size) { super.setItem(slot, newItem, session); } else { diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java index fc226f621..cc2eda74e 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.Generic3X3InventoryTranslator; public class Generic3X3Container extends Container { /** * Whether we need to set the container type as {@link com.nukkitx.protocol.bedrock.data.inventory.ContainerType#DROPPER}. * - * Used at {@link Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} + * Used at {@link Generic3X3InventoryTranslator#openInventory(GeyserSessionImpl, Inventory)} */ @Getter private boolean isDropper = false; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java index 8ecb3fe8d..6b789a075 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.inventory; import com.nukkitx.protocol.bedrock.data.inventory.EnchantData; import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Arrays; import java.util.Collections; @@ -70,7 +70,7 @@ public class GeyserEnchantOption { this.javaIndex = javaIndex; } - public EnchantOptionData build(GeyserSession session) { + public EnchantOptionData build(GeyserSessionImpl session) { this.hasChanged = false; return new EnchantOptionData(xpCost, javaIndex + 16, EMPTY, enchantLevel == -1 ? EMPTY : Collections.singletonList(new EnchantData(bedrockEnchantIndex, enchantLevel)), EMPTY, diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java index a75631db0..bdc141045 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import lombok.Data; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -91,14 +91,14 @@ public class GeyserItemStack { return isEmpty() ? null : new ItemStack(javaId, newAmount, nbt); } - public ItemData getItemData(GeyserSession session) { + public ItemData getItemData(GeyserSessionImpl session) { ItemData itemData = ItemTranslator.translateToBedrock(session, getItemStack()); itemData.setNetId(getNetId()); itemData.setUsingNetId(true); // Seems silly - this should probably be on the protocol level return itemData; } - public ItemMapping getMapping(GeyserSession session) { + public ItemMapping getMapping(GeyserSessionImpl session) { return session.getItemMappings().getMapping(this.javaId); } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java index 6eaaf84a2..bf58abf4c 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java @@ -34,7 +34,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Arrays; @@ -102,7 +102,7 @@ public class Inventory { return items[slot]; } - public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { + public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSessionImpl session) { if (slot > this.size) { session.getGeyser().getLogger().debug("Tried to set an item out of bounds! " + this); return; @@ -123,7 +123,7 @@ public class Inventory { } } - protected static void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSession session) { + protected static void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSessionImpl session) { if (!newItem.isEmpty()) { if (newItem.getItemData(session).equals(oldItem.getItemData(session), false, false, false)) { newItem.setNetId(oldItem.getNetId()); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java index 36114ccba..57df2fe68 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java @@ -29,7 +29,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class PlayerInventory extends Inventory { @@ -50,7 +50,7 @@ public class PlayerInventory extends Inventory { heldItemSlot = 0; } - public void setCursor(@NonNull GeyserItemStack newCursor, GeyserSession session) { + public void setCursor(@NonNull GeyserItemStack newCursor, GeyserSessionImpl session) { updateItemNetId(cursor, newCursor, session); cursor = newCursor; } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java index 3dc35f5df..0785c4eac 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class StonecutterContainer extends Container { /** @@ -44,7 +44,7 @@ public class StonecutterContainer extends Container { } @Override - public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { + public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSessionImpl session) { if (slot == 0 && newItem.getJavaId() != items[slot].getJavaId()) { // The pressed stonecutter button output resets whenever the input item changes this.stonecutterButton = -1; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java b/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java index c239cc778..e58c0bc0d 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java @@ -35,7 +35,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import lombok.Value; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.translator.inventory.CraftingInventoryTranslator; @@ -52,12 +52,12 @@ public class ClickPlan { private GeyserItemStack simulatedCursor; private boolean simulating; - private final GeyserSession session; + private final GeyserSessionImpl session; private final InventoryTranslator translator; private final Inventory inventory; private final int gridSize; - public ClickPlan(GeyserSession session, InventoryTranslator translator, Inventory inventory) { + public ClickPlan(GeyserSessionImpl session, InventoryTranslator translator, Inventory inventory) { this.session = session; this.translator = translator; this.inventory = inventory; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java index 8dba5a69d..59e32c97e 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.util.BlockUtils; @@ -71,7 +71,7 @@ public class BlockInventoryHolder extends InventoryHolder { } @Override - public void prepareInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void prepareInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { // Check to see if there is an existing block we can use that the player just selected. // First, verify that the player's position has not changed, so we don't try to select a block wildly out of range. // (This could be a virtual inventory that the player is opening) @@ -108,7 +108,7 @@ public class BlockInventoryHolder extends InventoryHolder { * @return if the player's last interaction position and current position match. Used to ensure that we don't select * a block to hold the inventory that's wildly out of range. */ - protected boolean checkInteractionPosition(GeyserSession session) { + protected boolean checkInteractionPosition(GeyserSessionImpl session) { return session.getLastInteractionPlayerPosition().equals(session.getPlayerEntity().getPosition()); } @@ -119,7 +119,7 @@ public class BlockInventoryHolder extends InventoryHolder { return this.validBlocks.contains(javaBlockString[0]); } - protected void setCustomName(GeyserSession session, Vector3i position, Inventory inventory, int javaBlockState) { + protected void setCustomName(GeyserSessionImpl session, Vector3i position, Inventory inventory, int javaBlockState) { NbtMap tag = NbtMap.builder() .putInt("x", position.getX()) .putInt("y", position.getY()) @@ -132,7 +132,7 @@ public class BlockInventoryHolder extends InventoryHolder { } @Override - public void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void openInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); containerOpenPacket.setType(containerType); @@ -142,7 +142,7 @@ public class BlockInventoryHolder extends InventoryHolder { } @Override - public void closeInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void closeInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { if (((Container) inventory).isUsingRealBlock()) { // No need to reset a block since we didn't change any blocks // But send a container close packet because we aren't destroying the original. diff --git a/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java index 845e645e3..d90487a86 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java @@ -26,11 +26,11 @@ package org.geysermc.geyser.inventory.holder; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; public abstract class InventoryHolder { - public abstract void prepareInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); - public abstract void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); - public abstract void closeInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); + public abstract void prepareInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory); + public abstract void openInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory); + public abstract void closeInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory); } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java index f95633768..2c162ef85 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java @@ -40,7 +40,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; @@ -57,7 +57,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { private static final int MAX_LEVEL_COST = 40; @Override - public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { super.updateInventory(translator, session, inventory); AnvilContainer anvilContainer = (AnvilContainer) inventory; updateInventoryState(session, anvilContainer); @@ -79,7 +79,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; AnvilContainer anvilContainer = (AnvilContainer) inventory; @@ -107,7 +107,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return true; } - private void updateInventoryState(GeyserSession session, AnvilContainer anvilContainer) { + private void updateInventoryState(GeyserSessionImpl session, AnvilContainer anvilContainer) { GeyserItemStack input = anvilContainer.getInput(); if (!input.equals(anvilContainer.getLastInput())) { anvilContainer.setLastInput(input.copy()); @@ -133,7 +133,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param anvilContainer the anvil inventory * @return the slot to change the repair cost */ - private int getTargetSlot(GeyserSession session, AnvilContainer anvilContainer) { + private int getTargetSlot(GeyserSessionImpl session, AnvilContainer anvilContainer) { GeyserItemStack input = anvilContainer.getInput(); GeyserItemStack material = anvilContainer.getMaterial(); @@ -148,7 +148,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return 0; } - private void updateTargetSlot(InventoryTranslator translator, GeyserSession session, AnvilContainer anvilContainer, int slot) { + private void updateTargetSlot(InventoryTranslator translator, GeyserSessionImpl session, AnvilContainer anvilContainer, int slot) { ItemData itemData = anvilContainer.getItem(slot).getItemData(session); itemData = hijackRepairCost(session, anvilContainer, itemData); @@ -166,7 +166,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { session.sendUpstreamPacket(slotPacket); } - private ItemData hijackRepairCost(GeyserSession session, AnvilContainer anvilContainer, ItemData itemData) { + private ItemData hijackRepairCost(GeyserSessionImpl session, AnvilContainer anvilContainer, ItemData itemData) { if (itemData.isNull()) { return itemData; } @@ -208,7 +208,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param bedrock True to count enchantments like Bedrock * @return the number of levels needed */ - public int calcLevelCost(GeyserSession session, AnvilContainer anvilContainer, boolean bedrock) { + public int calcLevelCost(GeyserSessionImpl session, AnvilContainer anvilContainer, boolean bedrock) { GeyserItemStack input = anvilContainer.getInput(); GeyserItemStack material = anvilContainer.getMaterial(); @@ -262,7 +262,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param material the item's respective repair material * @return the number of levels needed or 0 if it is not possible to repair any further */ - private int calcRepairLevelCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + private int calcRepairLevelCost(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { int newDamage = getDamage(input); int unitRepair = Math.min(newDamage, input.getMapping(session).getMaxDamage() / 4); if (unitRepair <= 0) { @@ -287,7 +287,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param material a matching item * @return the number of levels needed or 0 if it is not possible to repair any further */ - private int calcMergeRepairCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + private int calcMergeRepairCost(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { // If the material item is damaged 112% or more, then the input item will not be repaired if (getDamage(input) > 0 && getDamage(material) < (material.getMapping(session).getMaxDamage() * 112 / 100)) { return 2; @@ -304,7 +304,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param bedrock True to count enchantments like Bedrock, False to count like Java * @return the number of levels needed or -1 if no enchantments can be applied */ - private int calcMergeEnchantmentCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material, boolean bedrock) { + private int calcMergeEnchantmentCost(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material, boolean bedrock) { boolean hasCompatible = false; Object2IntMap combinedEnchantments = getEnchantments(session, input, bedrock); int cost = 0; @@ -367,7 +367,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return cost; } - private Object2IntMap getEnchantments(GeyserSession session, GeyserItemStack itemStack, boolean bedrock) { + private Object2IntMap getEnchantments(GeyserSessionImpl session, GeyserItemStack itemStack, boolean bedrock) { if (itemStack.getNbt() == null) { return Object2IntMaps.emptyMap(); } @@ -405,20 +405,20 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return enchantments; } - private boolean isEnchantedBook(GeyserSession session, GeyserItemStack itemStack) { + private boolean isEnchantedBook(GeyserSessionImpl session, GeyserItemStack itemStack) { return itemStack.getJavaId() == session.getItemMappings().getStoredItems().enchantedBook().getJavaId(); } - private boolean isCombining(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + private boolean isCombining(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { return isEnchantedBook(session, material) || (input.getJavaId() == material.getJavaId() && hasDurability(session, input)); } - private boolean isRepairing(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { + private boolean isRepairing(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { Set repairMaterials = input.getMapping(session).getRepairMaterials(); return repairMaterials != null && repairMaterials.contains(material.getMapping(session).getJavaIdentifier()); } - private boolean isRenaming(GeyserSession session, AnvilContainer anvilContainer, boolean bedrock) { + private boolean isRenaming(GeyserSessionImpl session, AnvilContainer anvilContainer, boolean bedrock) { if (anvilContainer.getResult().isEmpty()) { return false; } @@ -447,7 +447,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return getTagIntValueOr(itemStack, "RepairCost", 0); } - private boolean hasDurability(GeyserSession session, GeyserItemStack itemStack) { + private boolean hasDurability(GeyserSessionImpl session, GeyserItemStack itemStack) { if (itemStack.getMapping(session).getMaxDamage() > 0) { return getTagIntValueOr(itemStack, "Unbreakable", 0) == 0; } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java index 65147abb6..d8951b9d6 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import lombok.AllArgsConstructor; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.util.InventoryUtils; import org.geysermc.geyser.text.GeyserLocale; @@ -46,7 +46,7 @@ public class ChestInventoryUpdater extends InventoryUpdater { private final int paddedSize; @Override - public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { super.updateInventory(translator, session, inventory); List bedrockItems = new ArrayList<>(paddedSize); @@ -65,7 +65,7 @@ public class ChestInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java index dd1e810ca..2790e1de7 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; @@ -38,7 +38,7 @@ public class ContainerInventoryUpdater extends InventoryUpdater { public static final ContainerInventoryUpdater INSTANCE = new ContainerInventoryUpdater(); @Override - public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { super.updateInventory(translator, session, inventory); ItemData[] bedrockItems = new ItemData[translator.size]; @@ -53,7 +53,7 @@ public class ContainerInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java index 10a556c81..36f98da5a 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; @@ -38,7 +38,7 @@ public class HorseInventoryUpdater extends InventoryUpdater { public static final HorseInventoryUpdater INSTANCE = new HorseInventoryUpdater(); @Override - public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { super.updateInventory(translator, session, inventory); ItemData[] bedrockItems = new ItemData[translator.size]; @@ -53,7 +53,7 @@ public class HorseInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java index 6910aa447..33dee921b 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java @@ -30,13 +30,13 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; public class InventoryUpdater { - public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { ItemData[] bedrockItems = new ItemData[36]; for (int i = 0; i < 36; i++) { final int offset = i < 9 ? 27 : -9; @@ -48,7 +48,7 @@ public class InventoryUpdater { session.sendUpstreamPacket(contentPacket); } - public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { if (javaSlot >= translator.size) { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.INVENTORY); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java index 79b6bffc0..eeaa0fd7b 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.InventoryTranslator; public class UIInventoryUpdater extends InventoryUpdater { public static final UIInventoryUpdater INSTANCE = new UIInventoryUpdater(); @Override - public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { super.updateInventory(translator, session, inventory); for (int i = 0; i < translator.size; i++) { @@ -51,7 +51,7 @@ public class UIInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java index d766c4b4c..7253809e3 100644 --- a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java @@ -32,7 +32,7 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.ChunkCache; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -42,7 +42,7 @@ public class GeyserWorldManager extends WorldManager { private static final Object2ObjectMap gameruleCache = new Object2ObjectOpenHashMap<>(); @Override - public int getBlockAt(GeyserSession session, int x, int y, int z) { + public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { ChunkCache chunkCache = session.getChunkCache(); if (chunkCache != null) { // Chunk cache can be null if the session is closed asynchronously return chunkCache.getBlockAt(x, y, z); @@ -57,7 +57,7 @@ public class GeyserWorldManager extends WorldManager { } @Override - public NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad) { + public NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad) { // Without direct server access, we can't get lectern information on-the-fly. // I should have set this up so it's only called when there is a book in the block state. - Camotoy NbtMapBuilder lecternTag = LecternInventoryTranslator.getBaseLecternTag(x, y, z, 1); @@ -80,13 +80,13 @@ public class GeyserWorldManager extends WorldManager { } @Override - public void setGameRule(GeyserSession session, String name, Object value) { + public void setGameRule(GeyserSessionImpl session, String name, Object value) { session.sendDownstreamPacket(new ServerboundChatPacket("/gamerule " + name + " " + value)); gameruleCache.put(name, String.valueOf(value)); } @Override - public Boolean getGameRuleBool(GeyserSession session, GameRule gameRule) { + public Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule) { String value = gameruleCache.get(gameRule.getJavaID()); if (value != null) { return Boolean.parseBoolean(value); @@ -96,7 +96,7 @@ public class GeyserWorldManager extends WorldManager { } @Override - public int getGameRuleInt(GeyserSession session, GameRule gameRule) { + public int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule) { String value = gameruleCache.get(gameRule.getJavaID()); if (value != null) { return Integer.parseInt(value); @@ -106,17 +106,17 @@ public class GeyserWorldManager extends WorldManager { } @Override - public void setPlayerGameMode(GeyserSession session, GameMode gameMode) { + public void setPlayerGameMode(GeyserSessionImpl session, GameMode gameMode) { session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase())); } @Override - public void setDifficulty(GeyserSession session, Difficulty difficulty) { + public void setDifficulty(GeyserSessionImpl session, Difficulty difficulty) { session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase())); } @Override - public boolean hasPermission(GeyserSession session, String permission) { + public boolean hasPermission(GeyserSessionImpl session, String permission) { return false; } } diff --git a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java index 9aaf323c0..edd95bb52 100644 --- a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Class that manages or retrieves various information @@ -48,7 +48,7 @@ public abstract class WorldManager { * @param position the position * @return the block state at the specified location */ - public int getBlockAt(GeyserSession session, Position position) { + public int getBlockAt(GeyserSessionImpl session, Position position) { return this.getBlockAt(session, position.getX(), position.getY(), position.getZ()); } @@ -59,7 +59,7 @@ public abstract class WorldManager { * @param vector the position * @return the block state at the specified location */ - public int getBlockAt(GeyserSession session, Vector3i vector) { + public int getBlockAt(GeyserSessionImpl session, Vector3i vector) { return this.getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); } @@ -72,7 +72,7 @@ public abstract class WorldManager { * @param z the z coordinate to get the block at * @return the block state at the specified location */ - public abstract int getBlockAt(GeyserSession session, int x, int y, int z); + public abstract int getBlockAt(GeyserSessionImpl session, int x, int y, int z); /** * Checks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache. @@ -103,7 +103,7 @@ public abstract class WorldManager { * @return the Bedrock lectern block entity tag. This may not be the exact block entity tag - for example, Spigot's * block handled must be done on the server thread, so we send the tag manually there. */ - public abstract NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad); + public abstract NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad); /** * @return whether we should expect lectern data to update, or if we have to fall back on a workaround. @@ -117,7 +117,7 @@ public abstract class WorldManager { * @param name The gamerule to change * @param value The new value for the gamerule */ - public abstract void setGameRule(GeyserSession session, String name, Object value); + public abstract void setGameRule(GeyserSessionImpl session, String name, Object value); /** * Gets a gamerule value as a boolean @@ -126,7 +126,7 @@ public abstract class WorldManager { * @param gameRule The gamerule to fetch the value of * @return The boolean representation of the value */ - public abstract Boolean getGameRuleBool(GeyserSession session, GameRule gameRule); + public abstract Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule); /** * Get a gamerule value as an integer @@ -135,7 +135,7 @@ public abstract class WorldManager { * @param gameRule The gamerule to fetch the value of * @return The integer representation of the value */ - public abstract int getGameRuleInt(GeyserSession session, GameRule gameRule); + public abstract int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule); /** * Change the game mode of the given session @@ -143,7 +143,7 @@ public abstract class WorldManager { * @param session The session of the player to change the game mode of * @param gameMode The game mode to change the player to */ - public abstract void setPlayerGameMode(GeyserSession session, GameMode gameMode); + public abstract void setPlayerGameMode(GeyserSessionImpl session, GameMode gameMode); /** * Change the difficulty of the Java server @@ -151,7 +151,7 @@ public abstract class WorldManager { * @param session The session of the user that requested the change * @param difficulty The difficulty to change to */ - public abstract void setDifficulty(GeyserSession session, Difficulty difficulty); + public abstract void setDifficulty(GeyserSessionImpl session, Difficulty difficulty); /** * Checks if the given session's player has a permission @@ -160,5 +160,5 @@ public abstract class WorldManager { * @param permission The permission node to check * @return True if the player has the requested permission, false if not */ - public abstract boolean hasPermission(GeyserSession session, String permission); + public abstract boolean hasPermission(GeyserSessionImpl session, String permission); } diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java index 5bd72182f..60aba03f2 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java @@ -35,7 +35,7 @@ import lombok.Setter; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.translator.collision.BlockCollision; import org.geysermc.geyser.translator.collision.ScaffoldingCollision; @@ -49,7 +49,7 @@ import java.util.Locale; public class CollisionManager { - private final GeyserSession session; + private final GeyserSessionImpl session; @Getter private final BoundingBox playerBoundingBox; @@ -85,7 +85,7 @@ public class CollisionManager { */ private static final double INCORRECT_MOVEMENT_THRESHOLD = 0.08; - public CollisionManager(GeyserSession session) { + public CollisionManager(GeyserSessionImpl session) { this.session = session; this.playerBoundingBox = new BoundingBox(0, 0, 0, 0.6, 1.8, 0.6); } @@ -224,7 +224,7 @@ public class CollisionManager { /** * Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be * cancelled - * See {@link BlockCollision#correctPosition(GeyserSession, int, int, int, BoundingBox)} for more info + * See {@link BlockCollision#correctPosition(GeyserSessionImpl, int, int, int, BoundingBox)} for more info */ public boolean correctPlayerPosition() { diff --git a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java index 2cd866365..5d580fc05 100644 --- a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java @@ -36,7 +36,7 @@ import io.netty.util.concurrent.DefaultThreadFactory; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import org.geysermc.geyser.text.GeyserLocale; @@ -168,7 +168,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { public void onSessionCreation(BedrockServerSession bedrockServerSession) { bedrockServerSession.setLogging(true); bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel()); - bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next()))); + bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSessionImpl(geyser, bedrockServerSession, eventLoopGroup.next()))); // Set the packet codec to default just in case we need to send disconnect packets. bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC); } diff --git a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index 0dceed7e9..1eeca3319 100644 --- a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Bare bones implementation of BedrockPacketHandler suitable for extension. @@ -39,9 +39,9 @@ import org.geysermc.geyser.session.GeyserSession; */ public class LoggingPacketHandler implements BedrockPacketHandler { protected final GeyserImpl geyser; - protected final GeyserSession session; + protected final GeyserSessionImpl session; - LoggingPacketHandler(GeyserImpl geyser, GeyserSession session) { + LoggingPacketHandler(GeyserImpl geyser, GeyserSessionImpl session) { this.geyser = geyser; this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index a0800fb42..76a238ad5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.pack.ResourcePack; import org.geysermc.geyser.pack.ResourcePackManifest; import org.geysermc.geyser.registry.BlockRegistries; @@ -47,7 +47,7 @@ import java.io.InputStream; public class UpstreamPacketHandler extends LoggingPacketHandler { - public UpstreamPacketHandler(GeyserImpl geyser, GeyserSession session) { + public UpstreamPacketHandler(GeyserImpl geyser, GeyserSessionImpl session) { super(geyser, session); } @@ -116,12 +116,12 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { switch (packet.getStatus()) { case COMPLETED: if (geyser.getConfig().getRemote().getAuthType() != AuthType.ONLINE) { - session.authenticate(session.getAuthData().getName()); - } else if (!couldLoginUserByName(session.getAuthData().getName())) { + session.authenticate(session.getAuthData().name()); + } else if (!couldLoginUserByName(session.getAuthData().name())) { // We must spawn the white world session.connect(); } - geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.connect", session.getAuthData().getName())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.connect", session.getAuthData().name())); break; case SEND_PACKS: @@ -188,7 +188,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { GeyserConfiguration.IUserAuthenticationInfo info = geyser.getConfig().getUserAuths().get(bedrockUsername); if (info != null) { - geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().getName())); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.stored_credentials", session.getAuthData().name())); session.setMicrosoftAccount(info.isMicrosoftAccount()); session.authenticate(info.getEmail(), info.getPassword()); return true; diff --git a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java index e74d15001..6f9e766a0 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import io.netty.channel.EventLoop; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.loader.RegistryLoaders; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.text.GeyserLocale; @@ -53,7 +53,7 @@ public class PacketTranslatorRegistry extends AbstractMappedRegistry boolean translate(Class clazz, P packet, GeyserSession session) { + public

boolean translate(Class clazz, P packet, GeyserSessionImpl session) { if (session.getUpstream().isClosed() || session.isClosed()) { return false; } @@ -77,7 +77,7 @@ public class PacketTranslatorRegistry extends AbstractMappedRegistry void translate0(GeyserSession session, PacketTranslator

translator, P packet) { + private

void translate0(GeyserSessionImpl session, PacketTranslator

translator, P packet) { if (session.isClosed()) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java index cd5ad17ce..7cdb85838 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.registry.type; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import javax.annotation.ParametersAreNullableByDefault; @ParametersAreNullableByDefault public record ParticleMapping(LevelEventType levelEventType, String identifier) { - public int getParticleId(GeyserSession session) { + public int getParticleId(GeyserSessionImpl session) { if (this.levelEventType == null) { return -1; } diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index 3dc416c6c..be7ca3c84 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -32,10 +32,10 @@ import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket; import com.nukkitx.protocol.bedrock.packet.SetScorePacket; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import javax.annotation.Nullable; @@ -46,7 +46,7 @@ import java.util.concurrent.atomic.AtomicLong; import static org.geysermc.geyser.scoreboard.UpdateType.*; public final class Scoreboard { - private final GeyserSession session; + private final GeyserSessionImpl session; private final GeyserLogger logger; @Getter private final AtomicLong nextId = new AtomicLong(0); @@ -59,7 +59,7 @@ public final class Scoreboard { private int lastAddScoreCount = 0; private int lastRemoveScoreCount = 0; - public Scoreboard(GeyserSession session) { + public Scoreboard(GeyserSessionImpl session) { this.session = session; this.logger = GeyserImpl.getInstance().getLogger(); } diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java index 2f817a918..4f4cd8601 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java @@ -29,7 +29,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.text.GeyserLocale; @@ -73,10 +73,10 @@ public final class ScoreboardUpdater extends Thread { long currentTime = System.currentTimeMillis(); // reset score-packets per second every second - Collection sessions = geyser.getSessionManager().getSessions().values(); + Collection sessions = geyser.getSessionManager().getSessions().values(); if (currentTime - lastPacketsPerSecondUpdate >= 1000) { lastPacketsPerSecondUpdate = currentTime; - for (GeyserSession session : sessions) { + for (GeyserSessionImpl session : sessions) { ScoreboardSession scoreboardSession = session.getWorldCache().getScoreboardSession(); int oldPps = scoreboardSession.getPacketsPerSecond(); @@ -96,7 +96,7 @@ public final class ScoreboardUpdater extends Thread { if (currentTime - lastUpdate >= FIRST_MILLIS_BETWEEN_UPDATES) { lastUpdate = currentTime; - for (GeyserSession session : sessions) { + for (GeyserSessionImpl session : sessions) { WorldCache worldCache = session.getWorldCache(); ScoreboardSession scoreboardSession = worldCache.getScoreboardSession(); @@ -118,7 +118,7 @@ public final class ScoreboardUpdater extends Thread { FIRST_SCORE_PACKETS_PER_SECOND_THRESHOLD; geyser.getLogger().info( - GeyserLocale.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.getName(), threshold, pps) + + GeyserLocale.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached.log", session.name(), threshold, pps) + GeyserLocale.getLocaleStringLog("geyser.scoreboard.updater.threshold_reached", (millisBetweenUpdates / 1000.0)) ); @@ -172,7 +172,7 @@ public final class ScoreboardUpdater extends Thread { @RequiredArgsConstructor @Getter public static final class ScoreboardSession { - private final GeyserSession session; + private final GeyserSessionImpl session; private final AtomicInteger pendingPacketsPerSecond = new AtomicInteger(0); private int packetsPerSecond; private long lastUpdate; diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSessionImpl.java similarity index 97% rename from core/src/main/java/org/geysermc/geyser/session/GeyserSession.java rename to core/src/main/java/org/geysermc/geyser/session/GeyserSessionImpl.java index cf5f5c6af..7a93a2653 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSessionImpl.java @@ -76,6 +76,7 @@ import lombok.Setter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.session.GeyserSession; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.entity.InteractiveTagManager; import org.geysermc.geyser.session.auth.AuthType; @@ -120,7 +121,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @Getter -public class GeyserSession implements CommandSender { +public class GeyserSessionImpl implements GeyserSession, CommandSender { private final GeyserImpl geyser; private final UpstreamSession upstream; @@ -226,7 +227,7 @@ public class GeyserSession implements CommandSender { /** * Stores a list of all lectern locations and their block entity tags. - * See {@link WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} + * See {@link WorldManager#getLecternDataAt(GeyserSessionImpl, int, int, int, boolean)} * for more information. */ private final Set lecternCache; @@ -458,7 +459,7 @@ public class GeyserSession implements CommandSender { private MinecraftProtocol protocol; - public GeyserSession(GeyserImpl geyser, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { + public GeyserSessionImpl(GeyserImpl geyser, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { this.geyser = geyser; this.upstream = new UpstreamSession(bedrockServerSession); this.eventLoop = eventLoop; @@ -579,7 +580,7 @@ public class GeyserSession implements CommandSender { } else { geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.login.floodgate")); } - authenticate(authData.getName()); + authenticate(authData.name()); } } @@ -658,7 +659,7 @@ public class GeyserSession implements CommandSender { */ public void authenticateWithMicrosoftCode() { if (loggedIn) { - geyser.getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().getName())); + geyser.getLogger().severe(GeyserLocale.getLocaleStringLog("geyser.auth.already_loggedin", getAuthData().name())); return; } @@ -771,8 +772,8 @@ public class GeyserSession implements CommandSender { encryptedData = cipher.encryptFromString(BedrockData.of( clientData.getGameVersion(), - authData.getName(), - authData.getXuid(), + authData.name(), + authData.xuid(), clientData.getDeviceOs().ordinal(), clientData.getLanguageCode(), clientData.getUiProfile().ordinal(), @@ -822,18 +823,18 @@ public class GeyserSession implements CommandSender { if (downstream instanceof LocalSession) { // Connected directly to the server geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.connect_internal", - authData.getName(), protocol.getProfile().getName())); + authData.name(), protocol.getProfile().getName())); } else { // Connected to an IP address geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.connect", - authData.getName(), protocol.getProfile().getName(), remoteAddress)); + authData.name(), protocol.getProfile().getName(), remoteAddress)); } UUID uuid = protocol.getProfile().getId(); if (uuid == null) { // Set what our UUID *probably* is going to be if (remoteAuthType == AuthType.FLOODGATE) { - uuid = new UUID(0, Long.parseLong(authData.getXuid())); + uuid = new UUID(0, Long.parseLong(authData.xuid())); } else { uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + protocol.getProfile().getName()).getBytes(StandardCharsets.UTF_8)); } @@ -887,9 +888,9 @@ public class GeyserSession implements CommandSender { } if (downstream instanceof LocalSession) { - geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.getName(), disconnectMessage)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect_internal", authData.name(), disconnectMessage)); } else { - geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.getName(), remoteAddress, disconnectMessage)); + geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteAddress, disconnectMessage)); } if (cause != null) { cause.printStackTrace(); @@ -901,7 +902,7 @@ public class GeyserSession implements CommandSender { @Override public void packetReceived(PacketReceivedEvent event) { Packet packet = event.getPacket(); - Registries.JAVA_PACKET_TRANSLATORS.translate(packet.getClass(), packet, GeyserSession.this); + Registries.JAVA_PACKET_TRANSLATORS.translate(packet.getClass(), packet, GeyserSessionImpl.this); } @Override @@ -951,7 +952,7 @@ public class GeyserSession implements CommandSender { try { runnable.run(); } catch (Throwable e) { - geyser.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); + geyser.getLogger().error("Error thrown in " + this.name() + "'s event loop!", e); } }); } @@ -964,7 +965,7 @@ public class GeyserSession implements CommandSender { try { runnable.run(); } catch (Throwable e) { - geyser.getLogger().error("Error thrown in " + getName() + "'s event loop!", e); + geyser.getLogger().error("Error thrown in " + this.name() + "'s event loop!", e); } }, duration, timeUnit); } @@ -1104,8 +1105,18 @@ public class GeyserSession implements CommandSender { } @Override - public String getName() { - return authData.getName(); + public String name() { + return authData.name(); + } + + @Override + public UUID uuid() { + return authData.uuid(); + } + + @Override + public String xuid() { + return authData.xuid(); } @Override @@ -1452,7 +1463,7 @@ public class GeyserSession implements CommandSender { public void refreshEmotes(List emotes) { this.emotes.addAll(emotes); - for (GeyserSession player : geyser.getSessionManager().getSessions().values()) { + for (GeyserSessionImpl player : geyser.getSessionManager().getSessions().values()) { List pieces = new ArrayList<>(); for (UUID piece : emotes) { if (!player.getEmotes().contains(piece)) { diff --git a/core/src/main/java/org/geysermc/geyser/session/SessionManager.java b/core/src/main/java/org/geysermc/geyser/session/SessionManager.java index c5f30d3b2..e70015b81 100644 --- a/core/src/main/java/org/geysermc/geyser/session/SessionManager.java +++ b/core/src/main/java/org/geysermc/geyser/session/SessionManager.java @@ -28,7 +28,6 @@ package org.geysermc.geyser.session; import com.google.common.collect.ImmutableList; import lombok.AccessLevel; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.*; @@ -39,29 +38,29 @@ public final class SessionManager { * A list of all players who don't currently have a permanent UUID attached yet. */ @Getter(AccessLevel.PACKAGE) - private final Set pendingSessions = ConcurrentHashMap.newKeySet(); + private final Set pendingSessions = ConcurrentHashMap.newKeySet(); /** * A list of all players who are currently in-game. */ @Getter - private final Map sessions = new ConcurrentHashMap<>(); + private final Map sessions = new ConcurrentHashMap<>(); /** * Called once the player has successfully authenticated to the Geyser server. */ - public void addPendingSession(GeyserSession session) { + public void addPendingSession(GeyserSessionImpl session) { pendingSessions.add(session); } /** * Called once a player has successfully logged into their Java server. */ - public void addSession(UUID uuid, GeyserSession session) { + public void addSession(UUID uuid, GeyserSessionImpl session) { pendingSessions.remove(session); sessions.put(uuid, session); } - public void removeSession(GeyserSession session) { + public void removeSession(GeyserSessionImpl session) { if (sessions.remove(session.getPlayerEntity().getUuid()) == null) { // Session was likely pending pendingSessions.remove(session); @@ -71,16 +70,16 @@ public final class SessionManager { /** * Creates a new, immutable list containing all pending and active sessions. */ - public Collection getAllSessions() { - return ImmutableList.builder() // builderWithExpectedSize is probably not a good idea yet as older Spigot builds probably won't have it. + public List getAllSessions() { + return ImmutableList.builder() // builderWithExpectedSize is probably not a good idea yet as older Spigot builds probably won't have it. .addAll(pendingSessions) .addAll(sessions.values()) .build(); } public void disconnectAll(String message) { - Collection sessions = getAllSessions(); - for (GeyserSession session : sessions) { + Collection sessions = getAllSessions(); + for (GeyserSessionImpl session : sessions) { session.disconnect(GeyserLocale.getPlayerLocaleString(message, session.getLocale())); } } diff --git a/core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java b/core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java index eb142eec6..d48cf3889 100644 --- a/core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java +++ b/core/src/main/java/org/geysermc/geyser/session/auth/AuthData.java @@ -26,20 +26,12 @@ package org.geysermc.geyser.session.auth; import com.fasterxml.jackson.databind.JsonNode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; import java.util.UUID; -@RequiredArgsConstructor -public class AuthData { - @Getter private final String name; - @Getter private final UUID uuid; - @Getter private final String xuid; - - private final JsonNode certChainData; - private final String clientData; +public record AuthData(String name, UUID uuid, String xuid, + JsonNode certChainData, String clientData) { public void upload(GeyserImpl geyser) { // we can't upload the skin in LoginEncryptionUtil since the global server would return diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java index b6dde975c..d99f963ad 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.level.GeyserAdvancement; import org.geysermc.geyser.text.GeyserLocale; @@ -60,9 +60,9 @@ public class AdvancementsCache { @Setter private String currentAdvancementCategoryId = null; - private final GeyserSession session; + private final GeyserSessionImpl session; - public AdvancementsCache(GeyserSession session) { + public AdvancementsCache(GeyserSessionImpl session) { this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java index faaeafdb9..55ed10df4 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; import lombok.Setter; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Manages updating the current writable book. @@ -37,7 +37,7 @@ import org.geysermc.geyser.session.GeyserSession; * book packets. Because of this, we need to ensure packets are only send every second or so at maximum. */ public class BookEditCache { - private final GeyserSession session; + private final GeyserSessionImpl session; @Setter private ServerboundEditBookPacket packet; /** @@ -45,7 +45,7 @@ public class BookEditCache { */ private long lastBookUpdate; - public BookEditCache(GeyserSession session) { + public BookEditCache(GeyserSessionImpl session) { this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java index 9595a3daf..842be51d6 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java @@ -32,12 +32,12 @@ import com.nukkitx.protocol.bedrock.packet.BossEventPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import lombok.AllArgsConstructor; import net.kyori.adventure.text.Component; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; @AllArgsConstructor public class BossBar { - private final GeyserSession session; + private final GeyserSessionImpl session; private final long entityId; private Component title; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java index 522c00d2a..eda21b9ce 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java @@ -30,7 +30,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.chunk.GeyserChunk; import org.geysermc.geyser.util.MathUtils; @@ -51,7 +51,7 @@ public class ChunkCache { @Setter private boolean isExtendedHeight = false; - public ChunkCache(GeyserSession session) { + public ChunkCache(GeyserSessionImpl session) { this.cache = !session.getGeyser().getWorldManager().hasOwnChunkCache(); // To prevent Spigot from initializing chunks = cache ? new Long2ObjectOpenHashMap<>() : null; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java index eb1bc6e9a..48b05fd70 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java @@ -35,7 +35,7 @@ import lombok.Getter; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.*; import java.util.concurrent.atomic.AtomicLong; @@ -59,7 +59,7 @@ public class EntityCache { @Getter private final AtomicLong nextEntityId = new AtomicLong(2L); - public EntityCache(GeyserSession session) { + public EntityCache(GeyserSessionImpl session) { cachedPlayerEntityLinks.defaultReturnValue(-1L); } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java index 6f7d180de..e3e5f3b7c 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java @@ -32,7 +32,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.SimpleForm; @@ -44,7 +44,7 @@ import java.util.function.Consumer; public class FormCache { private final AtomicInteger formId = new AtomicInteger(0); private final Int2ObjectMap forms = new Int2ObjectOpenHashMap<>(); - private final GeyserSession session; + private final GeyserSessionImpl session; public int addForm(Form form) { int windowId = formId.getAndIncrement(); diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java index 05e59a5bb..a0809e590 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java @@ -34,7 +34,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; import org.geysermc.geyser.level.physics.Axis; @@ -44,7 +44,7 @@ import java.util.Map; @Getter public class PistonCache { @Getter(AccessLevel.PRIVATE) - private final GeyserSession session; + private final GeyserSessionImpl session; /** * Maps the position of a piston to its block entity @@ -84,7 +84,7 @@ public class PistonCache { @Setter private boolean playerAttachedToHoney = false; - public PistonCache(GeyserSession session) { + public PistonCache(GeyserSessionImpl session) { this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java index 534045f81..a2a9a6c1c 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java @@ -28,12 +28,12 @@ package org.geysermc.geyser.session.cache; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.CooldownUtils; @Getter public class PreferencesCache { - private final GeyserSession session; + private final GeyserSessionImpl session; /** * True if the client prefers being shown their coordinates, regardless if they're being shown or not. @@ -59,7 +59,7 @@ public class PreferencesCache { @Setter private CooldownUtils.CooldownType cooldownPreference = CooldownUtils.getDefaultShowCooldown(); - public PreferencesCache(GeyserSession session) { + public PreferencesCache(GeyserSessionImpl session) { this.session = session; prefersCustomSkulls = session.getGeyser().getConfig().isAllowCustomSkulls(); @@ -70,7 +70,7 @@ public class PreferencesCache { * * If {@link #prefersShowCoordinates} is true, coordinates will be shown, unless either of the following conditions apply:
*
- * {@link GeyserSession#reducedDebugInfo} is enabled + * {@link GeyserSessionImpl#reducedDebugInfo} is enabled * {@link GeyserConfiguration#isShowCoordinates()} is disabled */ public void updateShowCoordinates() { diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java index 5c486af49..ac99623b5 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java @@ -35,7 +35,7 @@ import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import javax.annotation.Nonnull; import java.util.Collections; @@ -114,9 +114,9 @@ public class WorldBorder { */ private long lastUpdatedWorldBorderTime = 0; - private final GeyserSession session; + private final GeyserSessionImpl session; - public WorldBorder(GeyserSession session) { + public WorldBorder(GeyserSessionImpl session) { this.session = session; // Initialize all min/max/warning variables update(); @@ -300,7 +300,7 @@ public class WorldBorder { /** * Send the following fog IDs to the client */ - public static void sendFog(GeyserSession session, String... fogNameSpaces) { + public static void sendFog(GeyserSessionImpl session, String... fogNameSpaces) { PlayerFogPacket packet = new PlayerFogPacket(); Collections.addAll(packet.getFogStack(), fogNameSpaces); session.sendUpstreamPacket(packet); @@ -309,7 +309,7 @@ public class WorldBorder { /** * Clear any additional fog sent to the client */ - public static void removeFog(GeyserSession session) { + public static void removeFog(GeyserSessionImpl session) { session.sendUpstreamPacket(new PlayerFogPacket()); } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java index a9564b157..59fe70ab2 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java @@ -28,19 +28,19 @@ package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater.ScoreboardSession; @Getter public class WorldCache { - private final GeyserSession session; + private final GeyserSessionImpl session; private final ScoreboardSession scoreboardSession; private Scoreboard scoreboard; @Setter private Difficulty difficulty = Difficulty.EASY; - public WorldCache(GeyserSession session) { + public WorldCache(GeyserSessionImpl session) { this.session = session; this.scoreboard = new Scoreboard(session); scoreboardSession = new ScoreboardSession(session); diff --git a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java index d07e06597..792adb654 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java @@ -31,8 +31,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.GeyserLogger; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.Constants; import org.geysermc.geyser.util.PluginMessageUtils; import org.geysermc.floodgate.util.WebsocketEventType; @@ -111,11 +111,11 @@ public final class FloodgateSkinUploader { } String xuid = node.get("xuid").asText(); - GeyserSession session = geyser.getPlayerByXuid(xuid); + GeyserSessionImpl session = geyser.sessionByXuid(xuid); if (session != null) { if (!node.get("success").asBoolean()) { - logger.info("Failed to upload skin for " + session.getName()); + logger.info("Failed to upload skin for " + session.name()); return; } diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index 454456800..58721bb1c 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.auth.BedrockClientData; import org.geysermc.geyser.text.GeyserLocale; @@ -48,7 +48,7 @@ public class SkinManager { /** * Builds a Bedrock player list entry from our existing, cached Bedrock skin information */ - public static PlayerListPacket.Entry buildCachedEntry(GeyserSession session, PlayerEntity playerEntity) { + public static PlayerListPacket.Entry buildCachedEntry(GeyserSessionImpl session, PlayerEntity playerEntity) { GameProfileData data = GameProfileData.from(playerEntity.getProfile()); SkinProvider.Cape cape = SkinProvider.getCachedCape(data.capeUrl()); SkinProvider.SkinGeometry geometry = SkinProvider.SkinGeometry.getLegacy(data.isAlex()); @@ -74,10 +74,10 @@ public class SkinManager { /** * With all the information needed, build a Bedrock player entry with translated skin information. */ - public static PlayerListPacket.Entry buildEntryManually(GeyserSession session, UUID uuid, String username, long geyserId, - String skinId, byte[] skinData, - String capeId, byte[] capeData, - SkinProvider.SkinGeometry geometry) { + public static PlayerListPacket.Entry buildEntryManually(GeyserSessionImpl session, UUID uuid, String username, long geyserId, + String skinId, byte[] skinData, + String capeId, byte[] capeData, + SkinProvider.SkinGeometry geometry) { SerializedSkin serializedSkin = SerializedSkin.of( skinId, "", geometry.getGeometryName(), ImageData.of(skinData), Collections.emptyList(), ImageData.of(capeData), geometry.getGeometryData(), "", true, false, @@ -86,10 +86,10 @@ public class SkinManager { // This attempts to find the XUID of the player so profile images show up for Xbox accounts String xuid = ""; - GeyserSession playerSession = GeyserImpl.getInstance().getPlayerByUuid(uuid); + GeyserSessionImpl playerSession = GeyserImpl.getInstance().sessionByUuid(uuid); if (playerSession != null) { - xuid = playerSession.getAuthData().getXuid(); + xuid = playerSession.getAuthData().xuid(); } PlayerListPacket.Entry entry; @@ -97,7 +97,7 @@ public class SkinManager { // If we are building a PlayerListEntry for our own session we use our AuthData UUID instead of the Java UUID // as Bedrock expects to get back its own provided UUID if (session.getPlayerEntity().getUuid().equals(uuid)) { - entry = new PlayerListPacket.Entry(session.getAuthData().getUuid()); + entry = new PlayerListPacket.Entry(session.getAuthData().uuid()); } else { entry = new PlayerListPacket.Entry(uuid); } @@ -112,7 +112,7 @@ public class SkinManager { return entry; } - public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSession session, + public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSessionImpl session, Consumer skinAndCapeConsumer) { GameProfileData data = GameProfileData.from(entity.getProfile()); @@ -280,7 +280,7 @@ public class SkinManager { String skinUrl = isAlex ? SkinProvider.EMPTY_SKIN_ALEX.getTextureUrl() : SkinProvider.EMPTY_SKIN.getTextureUrl(); String capeUrl = SkinProvider.EMPTY_CAPE.getTextureUrl(); if (("steve".equals(skinUrl) || "alex".equals(skinUrl)) && GeyserImpl.getInstance().getConfig().getRemote().getAuthType() != AuthType.ONLINE) { - GeyserSession session = GeyserImpl.getInstance().getPlayerByUuid(profile.getId()); + GeyserSessionImpl session = GeyserImpl.getInstance().sessionByUuid(profile.getId()); if (session != null) { skinUrl = session.getClientData().getSkinId(); diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java index 483d0d3e9..5b51d203b 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java @@ -37,7 +37,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.util.WebUtils; @@ -143,7 +143,7 @@ public class SkinProvider { String newSkinUrl = skinUrl; if ("steve".equals(skinUrl) || "alex".equals(skinUrl)) { - GeyserSession session = GeyserImpl.getInstance().getPlayerByUuid(playerId); + GeyserSessionImpl session = GeyserImpl.getInstance().sessionByUuid(playerId); if (session != null) { newSkinUrl = session.getClientData().getSkinId(); diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java index 100f06caf..c42b9522d 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -48,7 +48,7 @@ public class SkullSkinManager extends SkinManager { ); } - public static void requestAndHandleSkin(PlayerEntity entity, GeyserSession session, + public static void requestAndHandleSkin(PlayerEntity entity, GeyserSessionImpl session, Consumer skinConsumer) { GameProfileData data = GameProfileData.from(entity.getProfile()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java index 964faab0a..53fc0649f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.level.physics.CollisionManager; import org.geysermc.geyser.level.physics.Axis; @@ -72,7 +72,7 @@ public class BlockCollision { * While the Java server should do this, it could result in false flags by anticheat * This functionality is currently only used in 6 or 7 layer snow */ - public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); for (BoundingBox b : this.boundingBoxes) { double boxMinY = (b.getMiddleY() + y) - (b.getSizeY() / 2); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java index 3c858dc92..4379c68b1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @@ -59,7 +59,7 @@ public class DoorCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { boolean result = super.correctPosition(session, x, y, z, playerCollision); // Hack to prevent false positives playerCollision.setSizeX(playerCollision.getSizeX() - 0.0001); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java index fddc2e39b..72f525151 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; /** @@ -40,7 +40,7 @@ public class ScaffoldingCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { // Hack to not check below the player playerCollision.setSizeY(playerCollision.getSizeY() - 0.001); playerCollision.setMiddleY(playerCollision.getMiddleY() + 0.002); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java index 912d6a9b9..39250282a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @@ -61,7 +61,7 @@ public class SnowCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { if (layers == 1) { // 1 layer of snow does not have collision return true; diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java index 49b9f6c3f..f0d312b35 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.level.physics.CollisionManager; @@ -67,7 +67,7 @@ public class TrapdoorCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { boolean result = super.correctPosition(session, x, y, z, playerCollision); // Check for door bug (doors are 0.1875 blocks thick on Java but 0.1825 blocks thick on Bedrock) if (this.checkIntersection(x, y, z, playerCollision)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java index d34f5195c..525dfaf3e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.holder.InventoryHolder; import org.geysermc.geyser.inventory.updater.InventoryUpdater; @@ -65,27 +65,27 @@ public abstract class AbstractBlockInventoryTranslator extends BaseInventoryTran } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { holder.prepareInventory(this, session, inventory); } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { holder.openInventory(this, session, inventory); } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { holder.closeInventory(this, session, inventory); } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java index b7aaad7b1..486c500de 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.AnvilInventoryUpdater; @@ -77,7 +77,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { // The only property sent by Java is key 0 which is the level cost if (key != 0) return; AnvilContainer anvilContainer = (AnvilContainer) inventory; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java index becca359b..f1db5e77c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; @@ -41,7 +41,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator { } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { // } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java index f0820d9e8..f7e6ebe37 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java @@ -41,7 +41,7 @@ import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import org.geysermc.geyser.inventory.BeaconContainer; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -53,13 +53,13 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator public BeaconInventoryTranslator() { super(1, new BlockInventoryHolder("minecraft:beacon", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.BEACON) { @Override - protected boolean checkInteractionPosition(GeyserSession session) { + protected boolean checkInteractionPosition(GeyserSessionImpl session) { // Since we can't fall back to a virtual inventory, let's make opening one easier return true; } @Override - public void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { + public void openInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { if (!((BeaconContainer) inventory).isUsingRealBlock()) { InventoryUtils.closeInventory(session, inventory.getId(), false); return; @@ -70,7 +70,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { //FIXME?: Beacon graphics look weird after inputting an item. This might be a Bedrock bug, since it resets to nothing // on BDS BeaconContainer beaconContainer = (BeaconContainer) inventory; @@ -109,7 +109,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { // Input a beacon payment BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0]; ServerboundSetBeaconPacket packet = new ServerboundSetBeaconPacket(beaconPayment.getPrimaryEffect(), beaconPayment.getSecondaryEffect()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java index 43bea55ab..03c0ef224 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; @@ -40,7 +40,7 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { super.openInventory(session, inventory); ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); dataPacket.setWindowId((byte) inventory.getId()); @@ -50,7 +50,7 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); dataPacket.setWindowId((byte) inventory.getId()); switch (key) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java index 08caa7784..b4dd3048a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -42,7 +42,7 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { if (javaDestinationSlot == 0) { // Bedrock Edition can use paper or an empty map in slot 0 diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java index f18a902ff..dd8b22fad 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.geyser.inventory.EnchantingContainer; import org.geysermc.geyser.inventory.GeyserEnchantOption; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; import org.geysermc.geyser.inventory.item.Enchantment; @@ -51,7 +51,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { int slotToUpdate; EnchantingContainer enchantingInventory = (EnchantingContainer) inventory; boolean shouldUpdate = false; @@ -109,7 +109,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { // Client has requested an item to be enchanted CraftRecipeStackRequestActionData craftRecipeData = (CraftRecipeStackRequestActionData) request.getActions()[0]; EnchantingContainer enchantingInventory = (EnchantingContainer) inventory; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java index 4265b39e3..2119a8aed 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.geyser.inventory.Generic3X3Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; @@ -50,7 +50,7 @@ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTransla } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); // Required for opening the real block - otherwise, if the container type is incorrect, it refuses to open diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index 5ddd12702..0e5fbbd90 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -46,7 +46,7 @@ import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.click.Click; @@ -109,12 +109,12 @@ public abstract class InventoryTranslator { public final int size; - public abstract void prepareInventory(GeyserSession session, Inventory inventory); - public abstract void openInventory(GeyserSession session, Inventory inventory); - public abstract void closeInventory(GeyserSession session, Inventory inventory); - public abstract void updateProperty(GeyserSession session, Inventory inventory, int key, int value); - public abstract void updateInventory(GeyserSession session, Inventory inventory); - public abstract void updateSlot(GeyserSession session, Inventory inventory, int slot); + public abstract void prepareInventory(GeyserSessionImpl session, Inventory inventory); + public abstract void openInventory(GeyserSessionImpl session, Inventory inventory); + public abstract void closeInventory(GeyserSessionImpl session, Inventory inventory); + public abstract void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value); + public abstract void updateInventory(GeyserSessionImpl session, Inventory inventory); + public abstract void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot); public abstract int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData); public abstract int javaSlotToBedrock(int javaSlot); public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot); @@ -129,7 +129,7 @@ public abstract class InventoryTranslator { * * @return true if this transfer should be rejected */ - public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { return false; } @@ -145,11 +145,11 @@ public abstract class InventoryTranslator { /** * If {@link #shouldHandleRequestFirst(StackRequestActionData, Inventory)} returns true, this will be called */ - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { return rejectRequest(request); } - public void translateRequests(GeyserSession session, Inventory inventory, List requests) { + public void translateRequests(GeyserSessionImpl session, Inventory inventory, List requests) { boolean refresh = false; ItemStackResponsePacket responsePacket = new ItemStackResponsePacket(); for (ItemStackRequest request : requests) { @@ -188,7 +188,7 @@ public abstract class InventoryTranslator { } } - public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { ClickPlan plan = new ClickPlan(session, this, inventory); IntSet affectedSlots = new IntOpenHashSet(); for (StackRequestActionData action : request.getActions()) { @@ -203,7 +203,7 @@ public abstract class InventoryTranslator { return rejectRequest(request, false); } if (session.getGeyser().getConfig().isDebugMode()) { - session.getGeyser().getLogger().error("DEBUG: About to reject TAKE/PLACE request made by " + session.getName()); + session.getGeyser().getLogger().error("DEBUG: About to reject TAKE/PLACE request made by " + session.name()); dumpStackRequestDetails(session, inventory, transferAction.getSource(), transferAction.getDestination()); } return rejectRequest(request); @@ -289,7 +289,7 @@ public abstract class InventoryTranslator { SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action; if (!(checkNetId(session, inventory, swapAction.getSource()) && checkNetId(session, inventory, swapAction.getDestination()))) { if (session.getGeyser().getConfig().isDebugMode()) { - session.getGeyser().getLogger().error("DEBUG: About to reject SWAP request made by " + session.getName()); + session.getGeyser().getLogger().error("DEBUG: About to reject SWAP request made by " + session.name()); dumpStackRequestDetails(session, inventory, swapAction.getSource(), swapAction.getDestination()); } return rejectRequest(request); @@ -410,7 +410,7 @@ public abstract class InventoryTranslator { return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots)); } - public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { int resultSize = 0; int timesCrafted; CraftState craftState = CraftState.START; @@ -511,7 +511,7 @@ public abstract class InventoryTranslator { return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots())); } - public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { int gridSize; int gridDimensions; if (this instanceof PlayerInventoryTranslator) { @@ -708,7 +708,7 @@ public abstract class InventoryTranslator { /** * Handled in {@link PlayerInventoryTranslator} */ - public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { return rejectRequest(request); } @@ -770,14 +770,14 @@ public abstract class InventoryTranslator { /** * Print out the contents of an ItemStackRequest, should the net ID check fail. */ - protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) { + protected void dumpStackRequestDetails(GeyserSessionImpl session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) { session.getGeyser().getLogger().error("Source: " + source.toString() + " Result: " + checkNetId(session, inventory, source)); session.getGeyser().getLogger().error("Destination: " + destination.toString() + " Result: " + checkNetId(session, inventory, destination)); session.getGeyser().getLogger().error("Geyser's record of source slot: " + inventory.getItem(bedrockSlotToJava(source))); session.getGeyser().getLogger().error("Geyser's record of destination slot: " + inventory.getItem(bedrockSlotToJava(destination))); } - public boolean checkNetId(GeyserSession session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { + public boolean checkNetId(GeyserSessionImpl session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { int netId = slotInfoData.getStackNetworkId(); // "In my testing, sometimes the client thinks the netId of an item in the crafting grid is 1, even though we never said it was. // I think it only happens when we manually set the grid but that was my quick fix" @@ -835,7 +835,7 @@ public abstract class InventoryTranslator { return -1; } - public List makeContainerEntries(GeyserSession session, Inventory inventory, Set affectedSlots) { + public List makeContainerEntries(GeyserSessionImpl session, Inventory inventory, Set affectedSlots) { Map> containerMap = new HashMap<>(); for (int slot : affectedSlots) { BedrockContainerSlot bedrockSlot = javaSlotToBedrockContainer(slot); @@ -854,7 +854,7 @@ public abstract class InventoryTranslator { return containerEntries; } - public static ItemStackResponsePacket.ItemEntry makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) { + public static ItemStackResponsePacket.ItemEntry makeItemEntry(GeyserSessionImpl session, int bedrockSlot, GeyserItemStack itemStack) { ItemStackResponsePacket.ItemEntry itemEntry; if (!itemStack.isEmpty()) { // As of 1.16.210: Bedrock needs confirmation on what the current item durability is. diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java index b59914a13..623b9e708 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.LecternContainer; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.updater.InventoryUpdater; import org.geysermc.geyser.util.BlockEntityUtils; import org.geysermc.geyser.util.InventoryUtils; @@ -55,19 +55,19 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { if (key == 0) { // Lectern page update LecternContainer lecternContainer = (LecternContainer) inventory; lecternContainer.setCurrentBedrockPage(value / 2); @@ -77,7 +77,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { GeyserItemStack itemStack = inventory.getItem(0); if (!itemStack.isEmpty()) { updateBook(session, inventory, itemStack); @@ -85,7 +85,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { this.updater.updateSlot(this, session, inventory, slot); if (slot == 0) { updateBook(session, inventory, inventory.getItem(0)); @@ -95,7 +95,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { /** * Translate the data of the book in the lectern into a block entity tag. */ - private void updateBook(GeyserSession session, Inventory inventory, GeyserItemStack book) { + private void updateBook(GeyserSessionImpl session, Inventory inventory, GeyserItemStack book) { LecternContainer lecternContainer = (LecternContainer) inventory; if (session.isDroppingLecternBook()) { // We have to enter the inventory GUI to eject the book diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java index d035543bc..fcdf68cd9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java @@ -43,7 +43,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -102,7 +102,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { if (javaDestinationSlot != 1) { return false; @@ -125,7 +125,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { StackRequestActionData headerData = request.getActions()[0]; StackRequestActionData data = request.getActions()[1]; if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java index cf0c475f0..9aaca1893 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.InventoryUpdater; @@ -92,7 +92,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { MerchantContainer merchantInventory = (MerchantContainer) inventory; if (merchantInventory.getVillager() == null) { long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); @@ -118,13 +118,13 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { //Handled in JavaMerchantOffersTranslator //TODO: send a blank inventory here in case the villager doesn't send a TradeList packet } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { MerchantContainer merchantInventory = (MerchantContainer) inventory; if (merchantInventory.getVillager() != null) { merchantInventory.getVillager().despawnEntity(); @@ -132,19 +132,19 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { // We're not crafting here // Called at least by consoles when pressing a trade option button return translateRequest(session, inventory, request); } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java index 3a451891c..026bf5be3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java @@ -39,7 +39,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -58,7 +58,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { updateCraftingGrid(session, inventory); InventoryContentPacket inventoryContentPacket = new InventoryContentPacket(); @@ -97,7 +97,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { * @param session Session of the player * @param inventory Inventory of the player */ - public static void updateCraftingGrid(GeyserSession session, Inventory inventory) { + public static void updateCraftingGrid(GeyserSessionImpl session, Inventory inventory) { // Crafting grid for (int i = 1; i < 5; i++) { InventorySlotPacket slotPacket = new InventorySlotPacket(); @@ -115,7 +115,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { if (slot >= 1 && slot <= 44) { InventorySlotPacket slotPacket = new InventorySlotPacket(); if (slot >= 9) { @@ -208,7 +208,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { if (session.getGameMode() != GameMode.CREATIVE) { return super.translateRequest(session, inventory, request); } @@ -353,7 +353,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } } default -> { - session.getGeyser().getLogger().error("Unknown crafting state induced by " + session.getName()); + session.getGeyser().getLogger().error("Unknown crafting state induced by " + session.name()); return rejectRequest(request); } } @@ -365,7 +365,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { ItemStack javaCreativeItem = null; IntSet affectedSlots = new IntOpenHashSet(); CraftState craftState = CraftState.START; @@ -451,7 +451,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots)); } - private static void sendCreativeAction(GeyserSession session, Inventory inventory, int slot) { + private static void sendCreativeAction(GeyserSessionImpl session, Inventory inventory, int slot) { GeyserItemStack item = inventory.getItem(slot); ItemStack itemStack = item.isEmpty() ? new ItemStack(-1, 0, null) : item.getItemStack(); @@ -469,18 +469,18 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java index f92474fb3..67d1a3989 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; @@ -51,7 +51,7 @@ public class ShulkerInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - protected void setCustomName(GeyserSession session, Vector3i position, Inventory inventory, int javaBlockState) { + protected void setCustomName(GeyserSessionImpl session, Vector3i position, Inventory inventory, int javaBlockState) { NbtMapBuilder tag = NbtMap.builder() .putInt("x", position.getX()) .putInt("y", position.getY()) diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java index ed1f38799..816a32634 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; import org.geysermc.geyser.inventory.StonecutterContainer; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -57,7 +57,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { // TODO: Also surely to change in the future StackRequestActionData data = request.getActions()[1]; if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java index 417aa5bf3..94a7c624c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.translator.inventory.BaseInventoryTranslator; import org.geysermc.geyser.inventory.updater.ChestInventoryUpdater; @@ -42,7 +42,7 @@ public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { } @Override - public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { // Reject any item placements that occur in the unusable inventory space if (bedrockSourceContainer == ContainerSlotType.CONTAINER && javaSourceSlot >= this.size) { @@ -52,12 +52,12 @@ public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java index a42001d34..448fb3df7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.DoubleChestValue; import org.geysermc.geyser.translator.level.block.entity.DoubleChestBlockEntityTranslator; @@ -50,7 +50,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { // See BlockInventoryHolder - same concept there except we're also dealing with a specific block state if (session.getLastInteractionPlayerPosition().equals(session.getPlayerEntity().getPosition())) { int javaBlockId = session.getGeyser().getWorldManager().getBlockAt(session, session.getLastInteractionBlockPosition()); @@ -128,7 +128,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); containerOpenPacket.setType(ContainerType.CONTAINER); @@ -138,7 +138,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { if (((Container) inventory).isUsingRealBlock()) { // No need to reset a block since we didn't change any blocks // But send a container close packet because we aren't destroying the original. diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java index 86696b21b..a7e3b8ec7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.holder.InventoryHolder; @@ -52,17 +52,17 @@ public class SingleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { holder.prepareInventory(this, session, inventory); } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { holder.openInventory(this, session, inventory); } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { holder.closeInventory(this, session, inventory); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java index de7ea4de7..f40586753 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.translator.inventory.AbstractBlockInventoryTranslator; @@ -41,7 +41,7 @@ public abstract class AbstractFurnaceInventoryTranslator extends AbstractBlockIn } @Override - public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); dataPacket.setWindowId((byte) inventory.getId()); switch (key) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java index b4c49cb12..689cb0a9d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.horse; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.BaseInventoryTranslator; import org.geysermc.geyser.inventory.updater.HorseInventoryUpdater; import org.geysermc.geyser.inventory.updater.InventoryUpdater; @@ -40,24 +40,24 @@ public abstract class AbstractHorseInventoryTranslator extends BaseInventoryTran } @Override - public void prepareInventory(GeyserSession session, Inventory inventory) { + public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void openInventory(GeyserSession session, Inventory inventory) { + public void openInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void closeInventory(GeyserSession session, Inventory inventory) { + public void closeInventory(GeyserSessionImpl session, Inventory inventory) { } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java index 79f34da57..8866af56e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.inventory.BedrockContainerSlot; import java.util.Arrays; @@ -85,7 +85,7 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven } @Override - public void updateInventory(GeyserSession session, Inventory inventory) { + public void updateInventory(GeyserSessionImpl session, Inventory inventory) { ItemData[] bedrockItems = new ItemData[36]; for (int i = 0; i < 36; i++) { final int offset = i < 9 ? 27 : -9; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java index 046db67c9..427b70a65 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMapping; @@ -126,7 +126,7 @@ public abstract class ItemTranslator { } @Nonnull - public static ItemData translateToBedrock(GeyserSession session, ItemStack stack) { + public static ItemData translateToBedrock(GeyserSessionImpl session, ItemStack stack) { if (stack == null) { return ItemData.AIR; } @@ -402,7 +402,7 @@ public abstract class ItemTranslator { * * @return the new tag to use, should the current one be null */ - public static CompoundTag translateDisplayProperties(GeyserSession session, CompoundTag tag, ItemMapping mapping) { + public static CompoundTag translateDisplayProperties(GeyserSessionImpl session, CompoundTag tag, ItemMapping mapping) { return translateDisplayProperties(session, tag, mapping, 'f'); } @@ -410,7 +410,7 @@ public abstract class ItemTranslator { * @param translationColor if this item is not available on Java, the color that the new name should be. * Normally, this should just be white, but for shulker boxes this should be gray. */ - public static CompoundTag translateDisplayProperties(GeyserSession session, CompoundTag tag, ItemMapping mapping, char translationColor) { + public static CompoundTag translateDisplayProperties(GeyserSessionImpl session, CompoundTag tag, ItemMapping mapping, char translationColor) { boolean hasCustomName = false; if (tag != null) { CompoundTag display = tag.get("display"); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java index 6c2c501fd..c9c4dc5d4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.type.ItemMapping; public class NbtItemStackTranslator { @@ -37,7 +37,7 @@ public class NbtItemStackTranslator { * @param itemTag the item's CompoundTag * @param mapping Geyser's item mapping */ - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java index 071ead230..418023766 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -38,7 +38,7 @@ import org.geysermc.geyser.text.MinecraftLocale; public class AxolotlBucketTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { // Bedrock Edition displays the properties of the axolotl. Java does not. // To work around this, set the custom name to the Axolotl translation and it's displayed correctly itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java index 10ad58544..83279671e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; @@ -40,7 +40,7 @@ import java.util.List; public class BasicItemTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { Tag damage = itemTag.get("Damage"); if (damage instanceof IntTag) { int originalDurability = ((IntTag) damage).getValue(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java index b3371aab7..d24018287 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -42,7 +42,7 @@ import java.util.List; public class BookPagesTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("pages")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java index e1dda45ed..f74129eab 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class CrossbowTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { if (itemTag.get("ChargedProjectiles") != null) { ListTag chargedProjectiles = itemTag.get("ChargedProjectiles"); if (!chargedProjectiles.getValue().isEmpty()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java index 8a009bc2d..aac5caa92 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class EnchantedBookTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("StoredEnchantments")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java index ddc5f3780..f011c7045 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.inventory.item.Enchantment; @@ -41,7 +41,7 @@ import java.util.Map; public class EnchantmentTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { List newTags = new ArrayList<>(); Tag enchantmentTag = itemTag.get("Enchantments"); if (enchantmentTag instanceof ListTag listTag) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java index 8c1154dea..25b498277 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.util.MathUtils; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.MathUtils; public class FireworkRocketTranslator extends FireworkBaseTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { CompoundTag fireworks = itemTag.get("Fireworks"); if (fireworks == null) { return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java index e66589f6d..c1ff272f2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class FireworkStarTranslator extends FireworkBaseTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { Tag explosion = itemTag.get("Explosion"); if (explosion instanceof CompoundTag) { CompoundTag newExplosion = translateExplosionToBedrock((CompoundTag) explosion, "FireworksItem"); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java index ddf76b595..c66968124 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -42,7 +42,7 @@ public class LeatherArmorTranslator extends NbtItemStackTranslator { "minecraft:leather_leggings", "minecraft:leather_boots", "minecraft:leather_horse_armor"); @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { CompoundTag displayTag = itemTag.get("display"); if (displayTag == null) { return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java index 924735626..ca4cd2fcb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -35,7 +35,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class LodestoneCompassTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { Tag lodestoneTag = itemTag.get("LodestoneTracked"); if (lodestoneTag instanceof ByteTag) { int trackId = session.getLodestoneCache().store(itemTag); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java index 23739340e..1d96db42a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -35,7 +35,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class MapItemTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { // Can be either an IntTag or ShortTag Tag mapId = itemTag.get("map"); if (mapId == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java index 1e182568a..18ccde054 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -38,7 +38,7 @@ import org.geysermc.geyser.text.MinecraftLocale; public class PlayerHeadTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("display") || !((CompoundTag) itemTag.get("display")).contains("Name")) { if (itemTag.contains("SkullOwner")) { StringTag name; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java index f4160ec08..4182278d6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.Identifier; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.MathUtils; public class ShulkerBoxItemTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("BlockEntityTag")) return; // Empty shulker box CompoundTag blockEntityTag = itemTag.get("BlockEntityTag"); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java index 316ebc1ae..7c396fd28 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java @@ -31,7 +31,7 @@ import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.Style; import net.kyori.adventure.text.format.TextDecoration; import org.geysermc.geyser.entity.type.living.animal.TropicalFishEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; @@ -47,7 +47,7 @@ public class TropicalFishBucketTranslator extends NbtItemStackTranslator { private static final Style LORE_STYLE = Style.style(NamedTextColor.GRAY, TextDecoration.ITALIC); @Override - public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { // Prevent name from appearing as "Bucket of" itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); itemTag.put(new StringTag("CustomName", MinecraftLocale.getLocaleString("entity.minecraft.tropical_fish", session.getLocale()))); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java index 6cafb6012..2358b197d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java @@ -35,7 +35,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.chunk.BlockStorage; import org.geysermc.geyser.level.chunk.GeyserChunkSection; import org.geysermc.geyser.level.chunk.bitarray.BitArray; @@ -47,7 +47,7 @@ import org.geysermc.geyser.util.MathUtils; // Array index formula by https://wiki.vg/Chunk_Format public class BiomeTranslator { - public static void loadServerBiomes(GeyserSession session, CompoundTag codec) { + public static void loadServerBiomes(GeyserSessionImpl session, CompoundTag codec) { Int2IntMap biomeTranslations = session.getBiomeTranslations(); biomeTranslations.clear(); @@ -87,7 +87,7 @@ public class BiomeTranslator { } } - public static BlockStorage toNewBedrockBiome(GeyserSession session, DataPalette biomeData) { + public static BlockStorage toNewBedrockBiome(GeyserSessionImpl session, DataPalette biomeData) { Int2IntMap biomeTranslations = session.getBiomeTranslations(); // As of 1.17.10: the client expects the same format as a chunk but filled with biomes // As of 1.18 this is the same as Java Edition diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java index bc96a6e0d..af1eea293 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Implemented only if a block is a block entity in Bedrock and not Java Edition. @@ -46,7 +46,7 @@ public interface BedrockOnlyBlockEntity extends RequiresBlockState { * @param blockState The Java block state. * @param position The Bedrock block position. */ - void updateBlock(GeyserSession session, int blockState, Vector3i position); + void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position); /** * Get the tag of the Bedrock-only block entity @@ -54,7 +54,7 @@ public interface BedrockOnlyBlockEntity extends RequiresBlockState { * @param blockState Java BlockState of block. * @return Bedrock tag, or null if not a Bedrock-only Block Entity */ - static NbtMap getTag(GeyserSession session, Vector3i position, int blockState) { + static NbtMap getTag(GeyserSessionImpl session, Vector3i position, int blockState) { if (FlowerPotBlockEntityTranslator.isFlowerBlock(blockState)) { return FlowerPotBlockEntityTranslator.getTag(session, blockState, position); } else if (PistonBlockEntityTranslator.isBlock(blockState)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java index e41f9e492..9fe087cb9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.DoubleChestValue; import org.geysermc.geyser.util.BlockEntityUtils; @@ -45,7 +45,7 @@ public class DoubleChestBlockEntityTranslator extends BlockEntityTranslator impl } @Override - public void updateBlock(GeyserSession session, int blockState, Vector3i position) { + public void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position) { CompoundTag javaTag = getConstantJavaTag("chest", position.getX(), position.getY(), position.getZ()); NbtMapBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(BlockEntityType.CHEST), position.getX(), position.getY(), position.getZ()); translateTag(tagBuilder, javaTag, blockState); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java index b6c498d9f..01d3952a6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.util.BlockEntityUtils; @@ -49,7 +49,7 @@ public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity { * @param position Bedrock position of flower pot. * @return Bedrock tag of flower pot. */ - public static NbtMap getTag(GeyserSession session, int blockState, Vector3i position) { + public static NbtMap getTag(GeyserSessionImpl session, int blockState, Vector3i position) { NbtMapBuilder tagBuilder = NbtMap.builder() .putInt("x", position.getX()) .putInt("y", position.getY()) @@ -75,7 +75,7 @@ public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity { } @Override - public void updateBlock(GeyserSession session, int blockState, Vector3i position) { + public void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position) { NbtMap tag = getTag(session, blockState, position); BlockEntityUtils.updateBlockEntity(session, tag, position); UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java index 1d61d0e30..db29afc6f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; /** @@ -36,7 +36,7 @@ import org.geysermc.geyser.level.block.BlockStateValues; */ public class NoteblockBlockEntityTranslator { - public static void translate(GeyserSession session, Position position) { + public static void translate(GeyserSessionImpl session, Position position) { int blockState = session.getGeyser().getWorldManager().getBlockAt(session, position); BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(position.getX(), position.getY(), position.getZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java index 1363f6641..44d87a70c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java @@ -39,7 +39,7 @@ import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.level.physics.Axis; import org.geysermc.geyser.level.physics.Direction; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.level.physics.CollisionManager; @@ -54,7 +54,7 @@ import java.util.Queue; import java.util.Set; public class PistonBlockEntity { - private final GeyserSession session; + private final GeyserSessionImpl session; @Getter private final Vector3i position; private final Direction orientation; @@ -104,7 +104,7 @@ public class PistonBlockEntity { HONEY_BOUNDING_BOX = new BoundingBox(0.5, honeyHeight + boundingBoxHeight / 2, 0.5, blockBoundingBox.getSizeX(), boundingBoxHeight, blockBoundingBox.getSizeZ()); } - public PistonBlockEntity(GeyserSession session, Vector3i position, Direction orientation, boolean sticky, boolean extended) { + public PistonBlockEntity(GeyserSessionImpl session, Vector3i position, Direction orientation, boolean sticky, boolean extended) { this.session = session; this.position = position; this.orientation = orientation; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java index b6b41db6d..6bdc8e16f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.skin.SkinProvider; import org.geysermc.geyser.skin.SkullSkinManager; @@ -85,7 +85,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements return CompletableFuture.completedFuture(null); } - public static void spawnPlayer(GeyserSession session, CompoundTag tag, int posX, int posY, int posZ, int blockState) { + public static void spawnPlayer(GeyserSessionImpl session, CompoundTag tag, int posX, int posY, int posZ, int blockState) { float x = posX + .5f; float y = posY - .01f; float z = posZ + .5f; @@ -123,7 +123,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements }); } - private static void spawnPlayer(GeyserSession session, GameProfile profile, Vector3i blockPosition, + private static void spawnPlayer(GeyserSessionImpl session, GameProfile profile, Vector3i blockPosition, Vector3f entityPosition, float rotation, int blockState) { long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java index 63bf0a7d9..34fe04a76 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Represents an event capable of translating itself into bedrock @@ -38,5 +38,5 @@ public interface LevelEventTranslator { * @param session GeyserSession * @param packet the effect packet to handle */ - void translate(GeyserSession session, ClientboundLevelEventPacket packet); + void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java index df882d0d0..6d976989f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; @@ -36,7 +36,7 @@ import java.util.concurrent.ThreadLocalRandom; public record PlaySoundEventTranslator(String name, float volume, boolean pitchSub, float pitchMul, float pitchAdd, boolean relative) implements LevelEventTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { Random rand = ThreadLocalRandom.current(); PlaySoundPacket playSoundPacket = new PlaySoundPacket(); playSoundPacket.setSound(name); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java index 5c3e890a2..b12065744 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java @@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public record SoundEventEventTranslator(SoundEvent soundEvent, String identifier, int extraData) implements LevelEventTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { LevelSoundEventPacket levelSoundEvent = new LevelSoundEventPacket(); levelSoundEvent.setSound(soundEvent); levelSoundEvent.setIdentifier(identifier); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java index 48a4bf2fd..b5414bc40 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java @@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public record SoundLevelEventTranslator(LevelEventType levelEventType, int data) implements LevelEventTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { LevelEventPacket eventPacket = new LevelEventPacket(); eventPacket.setType(levelEventType); eventPacket.setData(data); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java index 37485120d..1045e8ef8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java @@ -25,11 +25,11 @@ package org.geysermc.geyser.translator.protocol; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public abstract class PacketTranslator { - public abstract void translate(GeyserSession session, T packet); + public abstract void translate(GeyserSessionImpl session, T packet); /** * Determines if this packet should be handled in the session's event loop. This should generally be true - diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java index d4de9e22a..5a29d4a24 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockAdventureSettingsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, AdventureSettingsPacket packet) { + public void translate(GeyserSessionImpl session, AdventureSettingsPacket packet) { boolean isFlying = packet.getSettings().contains(AdventureSetting.FLYING); if (!isFlying && session.getGameMode() == GameMode.SPECTATOR) { // We should always be flying in spectator mode diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java index d52a66be7..b03272a87 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit; public class BedrockAnimateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, AnimatePacket packet) { + public void translate(GeyserSessionImpl session, AnimatePacket packet) { // Stop the player sending animations before they have fully spawned into the server if (!session.isSpawned()) { return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java index 828f5a934..8c5e449c5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.SignUtils; @@ -39,7 +39,7 @@ import org.geysermc.geyser.util.SignUtils; public class BedrockBlockEntityDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, BlockEntityDataPacket packet) { + public void translate(GeyserSessionImpl session, BlockEntityDataPacket packet) { NbtMap tag = packet.getData(); if (tag.getString("id").equals("Sign")) { // This is the reason why this all works - Bedrock sends packets every time you update the sign, Java only wants the final packet diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java index a0bd43455..87a433567 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.ItemFrameEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class BedrockBlockPickRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, BlockPickRequestPacket packet) { + public void translate(GeyserSessionImpl session, BlockPickRequestPacket packet) { Vector3i vector = packet.getBlockPosition(); int blockToPick = session.getGeyser().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java index bead427db..3d113d8d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java @@ -33,7 +33,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.packet.BookEditPacket; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -49,7 +49,7 @@ public class BedrockBookEditTranslator extends PacketTranslator private static final int MAXIMUM_TITLE_LENGTH = 128 * 4; @Override - public void translate(GeyserSession session, BookEditPacket packet) { + public void translate(GeyserSessionImpl session, BookEditPacket packet) { if (packet.getText() != null && !packet.getText().isEmpty() && packet.getText().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PAGE_LENGTH) { session.getGeyser().getLogger().warning("Page length greater than server allowed!"); return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java index f0cf4ff8c..4f6750444 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockCommandBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, CommandBlockUpdatePacket packet) { + public void translate(GeyserSessionImpl session, CommandBlockUpdatePacket packet) { String command = packet.getCommand(); boolean outputTracked = packet.isOutputTracked(); if (packet.isBlock()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java index a67b81434..bc25acc16 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class BedrockCommandRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, CommandRequestPacket packet) { + public void translate(GeyserSessionImpl session, CommandRequestPacket packet) { String command = packet.getCommand().replace("/", ""); CommandManager commandManager = GeyserImpl.getInstance().getCommandManager(); if (session.getGeyser().getPlatformType() == PlatformType.STANDALONE && command.trim().startsWith("geyser ") && commandManager.getCommands().containsKey(command.split(" ")[1])) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java index 4c1f55018..00cf6607c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.InventoryUtils; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class BedrockContainerCloseTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ContainerClosePacket packet) { + public void translate(GeyserSessionImpl session, ContainerClosePacket packet) { byte windowId = packet.getId(); //Client wants close confirmation diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java index dac5fe638..1f5ad7c15 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.EmoteListPacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockEmoteListTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, EmoteListPacket packet) { + public void translate(GeyserSessionImpl session, EmoteListPacket packet) { if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java index 732142573..9ea36061e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.nukkitx.protocol.bedrock.packet.EntityPickRequestPacket; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -44,7 +44,7 @@ import java.util.Locale; public class BedrockEntityPickRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, EntityPickRequestPacket packet) { + public void translate(GeyserSessionImpl session, EntityPickRequestPacket packet) { if (session.getGameMode() != GameMode.CREATIVE) return; // Apparently Java behavior Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId()); if (entity == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java index b7961c8fb..520aa8d93 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.CartographyContainer; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -43,7 +43,7 @@ import org.geysermc.geyser.util.ItemUtils; public class BedrockFilterTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, FilterTextPacket packet) { + public void translate(GeyserSessionImpl session, FilterTextPacket packet) { if (session.getOpenInventory() instanceof CartographyContainer) { // We don't want to be able to rename in the cartography table return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java index d779ab339..2ad827b9d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java @@ -45,7 +45,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; @@ -70,7 +70,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ItemFrameDropItemPacket packet) { + public void translate(GeyserSessionImpl session, ItemFrameDropItemPacket packet) { Entity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition()); if (entity != null) { ServerboundInteractPacket interactPacket = new ServerboundInteractPacket((int) entity.getEntityId(), diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java index efa0dabcc..afa9992f9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.inventory.InventoryTranslator; public class BedrockItemStackRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ItemStackRequestPacket packet) { + public void translate(GeyserSessionImpl session, ItemStackRequestPacket packet) { Inventory inventory = session.getOpenInventory(); if (inventory == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java index d7e97825c..b6c7a8626 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java @@ -33,7 +33,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket; import com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket; import org.geysermc.geyser.inventory.LecternContainer; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.InventoryUtils; @@ -45,7 +45,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class BedrockLecternUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LecternUpdatePacket packet) { + public void translate(GeyserSessionImpl session, LecternUpdatePacket packet) { if (packet.isDroppingBook()) { // Bedrock drops the book outside of the GUI. Java drops it in the GUI // So, we enter the GUI and then drop it! :) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java index 788f65134..4297f6d2c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.packet.MapInfoRequestPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; public class BedrockMapInfoRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, MapInfoRequestPacket packet) { + public void translate(GeyserSessionImpl session, MapInfoRequestPacket packet) { long mapId = packet.getUniqueMapId(); ClientboundMapItemDataPacket mapPacket = session.getStoredMaps().remove(mapId); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java index 7a077c8b3..fa42a3c39 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.CooldownUtils; @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; public class BedrockMobEquipmentTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, MobEquipmentPacket packet) { + public void translate(GeyserSessionImpl session, MobEquipmentPacket packet) { if (!session.isSpawned() || packet.getHotbarSlot() > 8 || packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) { // For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java index 6d971daeb..ff6795d26 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -42,7 +42,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, MoveEntityAbsolutePacket packet) { + public void translate(GeyserSessionImpl session, MoveEntityAbsolutePacket packet) { session.setLastVehicleMoveTimestamp(System.currentTimeMillis()); Entity ridingEntity = session.getRidingVehicleEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java index 9ecce9a57..238ed86aa 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.floodgate.util.DeviceOs; @@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit; public class BedrockNetworkStackLatencyTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, NetworkStackLatencyPacket packet) { + public void translate(GeyserSessionImpl session, NetworkStackLatencyPacket packet) { long pingId; // so apparently, as of 1.16.200 // PS4 divides the network stack latency timestamp FOR US!!! diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java index f3967ddf5..d0bb391d4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.PacketViolationWarningPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockPacketViolationWarningTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, PacketViolationWarningPacket packet) { + public void translate(GeyserSessionImpl session, PacketViolationWarningPacket packet) { // Not translated since this is something that the developers need to know session.getGeyser().getLogger().error("Packet violation warning sent from client! " + packet.toString()); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java index 75199ae74..ef394aa8c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; import org.geysermc.geyser.entity.type.living.animal.horse.LlamaEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -45,7 +45,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockPlayerInputTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, PlayerInputPacket packet) { + public void translate(GeyserSessionImpl session, PlayerInputPacket packet) { ServerboundPlayerInputPacket playerInputPacket = new ServerboundPlayerInputPacket( packet.getInputMotion().getX(), packet.getInputMotion().getY(), packet.isJumping(), packet.isSneaking() ); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index 59082ccdc..19c9f702f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.LodestoneCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, PositionTrackingDBClientRequestPacket packet) { + public void translate(GeyserSessionImpl session, PositionTrackingDBClientRequestPacket packet) { PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket(); broadcastPacket.setTrackingId(packet.getTrackingId()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java index 59712da7f..e3f259394 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockRespawnTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, RespawnPacket packet) { + public void translate(GeyserSessionImpl session, RespawnPacket packet) { if (packet.getState() == RespawnPacket.State.CLIENT_READY) { // Previously we only sent the respawn packet before the server finished loading // The message included was 'Otherwise when immediate respawn is on the client never loads' diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java index 1840c9b0d..281cbb085 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ServerSettingsRequestPacket; import com.nukkitx.protocol.bedrock.packet.ServerSettingsResponsePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.SettingsUtils; @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit; @Translator(packet = ServerSettingsRequestPacket.class) public class BedrockServerSettingsRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ServerSettingsRequestPacket packet) { + public void translate(GeyserSessionImpl session, ServerSettingsRequestPacket packet) { CustomForm window = SettingsUtils.buildForm(session); int windowId = session.getFormCache().addForm(window); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index bc6d1f4e4..e81b8f30f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; import org.geysermc.geyser.session.auth.AuthType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.LoginEncryptionUtils; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.LoginEncryptionUtils; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) { + public void translate(GeyserSessionImpl session, SetLocalPlayerAsInitializedPacket packet) { if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) { if (!session.getUpstream().isInitialized()) { session.getUpstream().setInitialized(true); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java index 19797b8a2..719cf190c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; public class BedrockShowCreditsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ShowCreditsPacket packet) { + public void translate(GeyserSessionImpl session, ShowCreditsPacket packet) { if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) { ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java index 3cf121cf9..a1fbe6622 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class BedrockTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, TextPacket packet) { + public void translate(GeyserSessionImpl session, TextPacket packet) { String message = packet.getMessage(); if (message.isBlank()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java index 775ec15b5..88f44a719 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; public class BedrockEntityEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, EntityEventPacket packet) { + public void translate(GeyserSessionImpl session, EntityEventPacket packet) { switch (packet.getType()) { case EATING_ITEM -> { // Resend the packet so we get the eating sounds diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java index 711285948..58c4b7822 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -54,7 +54,7 @@ import java.util.ArrayList; public class BedrockActionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, PlayerActionPacket packet) { + public void translate(GeyserSessionImpl session, PlayerActionPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); // Send book update before any player action diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java index a4fe12d4e..62f0dddcf 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.nukkitx.protocol.bedrock.packet.EmotePacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.BlockUtils; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.BlockUtils; public class BedrockEmoteTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, EmotePacket packet) { + public void translate(GeyserSessionImpl session, EmotePacket packet) { if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, @@ -53,7 +53,7 @@ public class BedrockEmoteTranslator extends PacketTranslator { } long javaId = session.getPlayerEntity().getEntityId(); - for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) { + for (GeyserSessionImpl otherSession : session.getGeyser().getSessionManager().getSessions().values()) { if (otherSession != session) { if (otherSession.isClosed()) continue; if (otherSession.getEventLoop().inEventLoop()) { @@ -65,7 +65,7 @@ public class BedrockEmoteTranslator extends PacketTranslator { } } - private void playEmote(GeyserSession otherSession, long javaId, String emoteId) { + private void playEmote(GeyserSessionImpl otherSession, long javaId, String emoteId) { Entity otherEntity = otherSession.getEntityCache().getEntityByJavaId(javaId); // Must be ran on same thread if (otherEntity == null) return; EmotePacket otherEmotePacket = new EmotePacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java index 26a25725e..a32d9808f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.InteractPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.entity.InteractiveTagManager; @@ -46,7 +46,7 @@ import org.geysermc.geyser.entity.InteractiveTagManager; public class BedrockInteractTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, InteractPacket packet) { + public void translate(GeyserSessionImpl session, InteractPacket packet) { Entity entity; if (packet.getRuntimeEntityId() == session.getPlayerEntity().getGeyserId()) { //Player is not in entity cache diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java index 98dd7832c..ecf0b2225 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -47,7 +47,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator 300) { - session.getGeyser().getLogger().debug(ChatColor.RED + session.getName() + " moved too quickly." + + session.getGeyser().getLogger().debug(ChatColor.RED + session.name() + " moved too quickly." + " current position: " + currentPosition + ", new position: " + newPosition); return false; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java index 79911b5e7..f6c580b2e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockRiderJumpTranslator.java @@ -30,14 +30,14 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.nukkitx.protocol.bedrock.packet.RiderJumpPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @Translator(packet = RiderJumpPacket.class) public class BedrockRiderJumpTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, RiderJumpPacket packet) { + public void translate(GeyserSessionImpl session, RiderJumpPacket packet) { Entity vehicle = session.getRidingVehicleEntity(); if (vehicle instanceof AbstractHorseEntity) { ServerboundPlayerCommandPacket playerCommandPacket = new ServerboundPlayerCommandPacket((int) vehicle.getEntityId(), PlayerState.START_HORSE_JUMP, packet.getJumpStrength()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java index b149f8836..f57d7957a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockSetPlayerGameTypeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, SetPlayerGameTypePacket packet) { + public void translate(GeyserSessionImpl session, SetPlayerGameTypePacket packet) { // no SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket(); playerGameTypePacket.setGamemode(session.getGameMode().ordinal()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java index 2ac8587bf..9969e55f4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.world; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.CooldownUtils; @@ -36,7 +36,7 @@ import org.geysermc.geyser.util.CooldownUtils; public class BedrockLevelSoundEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, LevelSoundEventPacket packet) { + public void translate(GeyserSessionImpl session, LevelSoundEventPacket packet) { // lol what even :thinking: session.sendUpstreamPacket(packet); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java index 8f4e93635..eb3b52040 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.StatisticsUtils; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.StatisticsUtils; public class JavaAwardStatsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAwardStatsPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAwardStatsPacket packet) { session.updateStatistics(packet.getStatistics()); if (session.isWaitingForStatistics()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java index 2c49baa56..c15ea56dd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.java; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.BossBar; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBo public class JavaBossEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundBossEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundBossEventPacket packet) { BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); switch (packet.getAction()) { case ADD: diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java index e0c3a9b95..9aa747187 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; public class JavaChangeDifficultyTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundChangeDifficultyPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundChangeDifficultyPacket packet) { SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket(); setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal()); session.sendUpstreamPacket(setDifficultyPacket); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java index ca8be2374..93daa4c45 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,11 +36,11 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaChatTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundChatPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundChatPacket packet) { TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); - textPacket.setXuid(session.getAuthData().getXuid()); + textPacket.setXuid(session.getAuthData().xuid()); textPacket.setType(switch (packet.getType()) { case CHAT -> TextPacket.Type.CHAT; case SYSTEM -> TextPacket.Type.SYSTEM; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index d0ab68d8f..feef811e4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -43,7 +43,7 @@ import lombok.Getter; import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.inventory.item.Enchantment; @@ -98,7 +98,7 @@ public class JavaCommandsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundCustomQueryPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundCustomQueryPacket packet) { // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. // Note: Fabric Networking API v1 will not let the client log in without sending this session.sendDownstreamPacket( diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java index e073e6f27..4822d8b4a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaDisconnectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundDisconnectPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundDisconnectPacket packet) { session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java index 307c27c29..833dfe732 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.skin.SkinManager; @@ -38,7 +38,7 @@ import org.geysermc.geyser.skin.SkinManager; public class JavaGameProfileTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundGameProfilePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundGameProfilePacket packet) { PlayerEntity playerEntity = session.getPlayerEntity(); AuthType remoteAuthType = session.getRemoteAuthType(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java index 680debe49..208768ff8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket; import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaKeepAliveTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundKeepAlivePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundKeepAlivePacket packet) { if (!session.getGeyser().getConfig().isForwardPlayerPing()) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java index ce5fabe30..531d4a791 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaLoginDisconnectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundLoginDisconnectPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLoginDisconnectPacket packet) { // The client doesn't manually get disconnected so we have to do it ourselves session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java index 855f5b144..90c21c8d0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.level.BiomeTranslator; @@ -52,7 +52,7 @@ public class JavaLoginTranslator extends PacketTranslator SKIN_PART_VALUES = Arrays.asList(SkinPart.values()); @Override - public void translate(GeyserSession session, ClientboundLoginPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLoginPacket packet) { PlayerEntity entity = session.getPlayerEntity(); entity.setEntityId(packet.getEntityId()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java index a3b2e34b7..9a1ef7f08 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaPingTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundPingPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundPingPacket packet) { session.sendDownstreamPacket(new ServerboundPongPacket(packet.getId())); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java index 0a329f607..908ac6e4c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.UnlockRecipesAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import java.util.Arrays; public class JavaRecipeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundRecipePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundRecipePacket packet) { if (packet.getAction() == UnlockRecipesAction.REMOVE) { session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes())); } else { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java index 8f97b1a8d..a72a054ef 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -43,7 +43,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class JavaRespawnTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundRespawnPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundRespawnPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); entity.setHealth(entity.getMaxHealth()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java index 3f82dffb1..5acb35059 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.AdvancementsCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSelectAdvancementsTabTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSelectAdvancementsTabPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSelectAdvancementsTabPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId()); advancementsCache.buildAndShowListForm(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java index c1f6f77d2..be17064f3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -42,7 +42,7 @@ import java.util.Map; public class JavaUpdateAdvancementsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundUpdateAdvancementsPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundUpdateAdvancementsPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); if (packet.isReset()) { advancementsCache.getStoredAdvancements().clear(); @@ -72,7 +72,7 @@ public class JavaUpdateAdvancementsTranslator extends PacketTranslator> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion()); // Get the last known network ID (first used for the pregenerated recipes) and increment from there. int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1; @@ -185,7 +185,7 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator, IntSet> squashedOptions = new HashMap<>(); for (int i = 0; i < ingredients.length; i++) { if (ingredients[i].getOptions().length == 0) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java index 5c9d84457..59aee47cc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaUpdateTagsTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundUpdateTagsPacket packet) { session.getTagCache().loadPacket(packet); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java index d7fc79f1e..98f7172b4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.AnimateEntityPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.DimensionUtils; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class JavaAnimateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAnimatePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAnimatePacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java index 1c3239d69..fccfaef41 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.FishingHookEntity; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -46,7 +46,7 @@ import java.util.concurrent.ThreadLocalRandom; public class JavaEntityEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundEntityEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundEntityEventPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java index 4f15b0717..ae27b54c2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosRotPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveEntityPosRotTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundMoveEntityPosRotPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundMoveEntityPosRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java index aeb080465..1a93b0ea1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveEntityPosTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundMoveEntityPosPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundMoveEntityPosPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java index b2b59480b..fa3efc5e1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveEntityRotTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundMoveEntityRotPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundMoveEntityRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java index 90e121250..29f3620a9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveVehicleTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundMoveVehiclePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundMoveVehiclePacket packet) { Entity entity = session.getRidingVehicleEntity(); if (entity == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java index 043756db0..1783316ae 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaRemoveEntitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundRemoveEntitiesPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundRemoveEntitiesPacket packet) { for (int entityId : packet.getEntityIds()) { Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java index bc78bb33e..8fe9db808 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.EntityUtils; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.EntityUtils; public class JavaRemoveMobEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundRemoveMobEffectPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundRemoveMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java index edcad7af6..3f598dd3b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaRotateHeadTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundRotateHeadPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundRotateHeadPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java index 987e5fcb2..c63905cd6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.entity.InteractiveTagManager; @@ -39,7 +39,7 @@ public class JavaSetEntityDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetEntityLinkPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetEntityLinkPacket packet) { Entity holderId; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { holderId = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java index 5febe4813..da8920c29 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemEntity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; public class JavaSetEntityMotionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetEntityMotionPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetEntityMotionPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java index 0058ed61e..7222d46dd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.Client import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.inventory.item.ItemTranslator; public class JavaSetEquipmentTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetEquipmentPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetEquipmentPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java index f4a6f94ed..4f9729c5f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.EntityUtils; @@ -43,7 +43,7 @@ import java.util.Arrays; public class JavaSetPassengersTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetPassengersPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetPassengersPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java index 75d7bc976..daf89633f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.TakeItemEntityPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ExpOrbEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -44,7 +44,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaTakeItemEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundTakeItemEntityPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundTakeItemEntityPacket packet) { // Collected entity is the other entity Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId()); if (collectedEntity == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java index cbd994d79..d6ebd6efb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTeleportEntityPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaTeleportEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundTeleportEntityPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundTeleportEntityPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java index c3a4e4ac4..7d64a880e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateAttributesPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaUpdateAttributesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundUpdateAttributesPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundUpdateAttributesPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java index 2d4161739..ee53f281b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.EntityUtils; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.EntityUtils; public class JavaUpdateMobEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundUpdateMobEffectPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundUpdateMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java index 6fbdb4fc6..08449c108 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaBlockBreakAckTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundBlockBreakAckPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundBlockBreakAckPacket packet) { ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) { LevelEventPacket stopBreak = new LevelEventPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java index 98b69a0b8..b409db27a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaPlayerAbilitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundPlayerAbilitiesPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundPlayerAbilitiesPacket packet) { session.setCanFly(packet.isCanFly()); session.setFlying(packet.isFlying()); session.sendAdventureSettings(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java index 252287edc..ce5f0b798 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.skin.SkinManager; @@ -40,7 +40,7 @@ import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundPlayerInfoPacket.class) public class JavaPlayerInfoTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundPlayerInfoPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundPlayerInfoPacket packet) { if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER) return; @@ -102,7 +102,7 @@ public class JavaPlayerInfoTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundPlayerPositionPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundPlayerPositionPacket packet) { if (!session.isLoggedIn()) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java index dc10bad34..3f7de9126 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetCarriedItemPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetCarriedItemTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetCarriedItemPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetCarriedItemPacket packet) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java index 3ac9bf9e3..794755833 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import java.util.Arrays; public class JavaSetExperienceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetExperiencePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetExperiencePacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java index 8e96ed42e..40a6d38e5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.SetHealthPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -41,7 +41,7 @@ import java.util.List; public class JavaSetHealthTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetHealthPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetHealthPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); int health = (int) Math.ceil(packet.getHealth()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java index b80b59ff4..d1ccd7b1b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.geyser.entity.type.FallingBlockEntity; import org.geysermc.geyser.entity.type.FishingHookEntity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; @@ -48,7 +48,7 @@ import org.geysermc.geyser.text.GeyserLocale; public class JavaAddEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAddEntityPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); float yaw = packet.getYaw(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java index 33e230c14..1774ec934 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn. import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ExpOrbEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaAddExperienceOrbTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAddExperienceOrbPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAddExperienceOrbPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Entity entity = new ExpOrbEntity( diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java index e6b82f365..a466969aa 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.factory.BaseEntityFactory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; @@ -40,7 +40,7 @@ import org.geysermc.geyser.text.GeyserLocale; public class JavaAddMobTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAddMobPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAddMobPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java index 433d78477..17e4a800e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.PaintingEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.PaintingType; @@ -37,7 +37,7 @@ import org.geysermc.geyser.level.PaintingType; public class JavaAddPaintingTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAddPaintingPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAddPaintingPacket packet) { Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); PaintingEntity entity = new PaintingEntity(session, packet.getEntityId(), diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java index 74dcaf022..8dbdf81e9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn. import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.text.GeyserLocale; @@ -39,7 +39,7 @@ import org.geysermc.geyser.skin.SkinManager; public class JavaAddPlayerTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundAddPlayerPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundAddPlayerPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); float yaw = packet.getYaw(); float pitch = packet.getPitch(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java index 9a4ff8f26..e12f2ee8d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerClosePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.InventoryUtils; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class JavaContainerCloseTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundContainerClosePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundContainerClosePacket packet) { // Sometimes the server can request a window close of ID 0... when the window isn't even open // Don't confirm in this instance InventoryUtils.closeInventory(session, packet.getContainerId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getContainerId())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java index 0d572ca92..3d3255768 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class JavaContainerSetContentTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundContainerSetContentPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundContainerSetContentPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId()); if (inventory == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java index 2ffab0d38..92cfe9619 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class JavaContainerSetDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundContainerSetDataPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundContainerSetDataPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId()); if (inventory == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java index 54cc91ca6..43d55c47a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit; public class JavaContainerSetSlotTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundContainerSetSlotPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundContainerSetSlotPacket packet) { if (packet.getContainerId() == 255) { //cursor GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); session.getPlayerInventory().setCursor(newItem, session); @@ -92,7 +92,7 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundMerchantOffersPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundMerchantOffersPacket packet) { Inventory openInventory = session.getOpenInventory(); if (!(openInventory instanceof MerchantContainer merchantInventory && openInventory.getId() == packet.getContainerId())) { return; @@ -132,7 +132,7 @@ public class JavaMerchantOffersTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundOpenScreenPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundOpenScreenPacket packet) { if (packet.getContainerId() == 0) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java index 65db15d83..f14d05be6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.BlockRegistries; @@ -41,7 +41,7 @@ import org.geysermc.geyser.util.BlockUtils; public class JavaBlockDestructionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundBlockDestructionPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundBlockDestructionPacket packet) { int state = session.getGeyser().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); int breakTime = (int) (65535 / Math.ceil(BlockUtils.getBreakTime(session, BlockRegistries.JAVA_BLOCKS.get(state), ItemMapping.AIR, new CompoundTag(""), false) * 20)); LevelEventPacket levelEventPacket = new LevelEventPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java index 1c11b298e..1d999542f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java @@ -32,7 +32,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -45,7 +45,7 @@ import org.geysermc.geyser.util.BlockEntityUtils; public class JavaBlockEntityDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundBlockEntityDataPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundBlockEntityDataPacket packet) { BlockEntityTranslator translator = BlockEntityUtils.getBlockEntityTranslator(packet.getType()); // The Java block state is used in BlockEntityTranslator.translateTag() to make up for some inconsistencies // between Java block states and Bedrock block entity data diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java index 3504168a5..a46524010 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -48,7 +48,7 @@ import org.geysermc.geyser.level.physics.Direction; public class JavaBlockEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundBlockEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundBlockEventPacket packet) { BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java index 298bd4b90..7bebcd11f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; @@ -42,7 +42,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundBlockUpdatePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundBlockUpdatePacket packet) { Position pos = packet.getEntry().getPosition(); boolean updatePlacement = session.getGeyser().getPlatformType() != PlatformType.SPIGOT && // Spigot simply listens for the block place event session.getGeyser().getWorldManager().getBlockAt(session, pos) != packet.getEntry().getBlock(); @@ -53,7 +53,7 @@ public class JavaBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundCustomSoundPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundCustomSoundPacket packet) { String packetSound; if (packet.getSound() instanceof BuiltinSound) { packetSound = ((BuiltinSound) packet.getSound()).getName(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java index d97035b5c..f07c19fa3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -44,7 +44,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaExplodeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundExplodePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundExplodePacket packet) { for (Position position : packet.getExploded()) { Vector3i pos = Vector3i.from(packet.getX() + position.getX(), packet.getY() + position.getY(), packet.getZ() + position.getZ()); ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, pos); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java index 8204ceea5..967edbcf4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; import com.nukkitx.math.vector.Vector3i; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import java.util.Iterator; public class JavaForgetLevelChunkTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundForgetLevelChunkPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundForgetLevelChunkPacket packet) { session.getChunkCache().removeChunk(packet.getX(), packet.getZ()); //Checks if a skull is in an unloaded chunk then removes it diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java index 642f707a8..cd1b5f37d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.PlayerInventoryTranslator; @@ -49,7 +49,7 @@ import org.geysermc.geyser.text.MinecraftLocale; public class JavaGameEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundGameEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundGameEventPacket packet) { PlayerEntity entity = session.getPlayerEntity(); switch (packet.getNotification()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java index 4a749c6d3..006620cad 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java @@ -50,7 +50,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.geysermc.geyser.entity.type.ItemFrameEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.level.BiomeTranslator; @@ -77,7 +77,7 @@ import static org.geysermc.geyser.util.ChunkUtils.*; public class JavaLevelChunkWithLightTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLevelChunkWithLightPacket packet) { if (session.isSpawned()) { ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java index d861d0338..366a4c94c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java @@ -42,7 +42,7 @@ import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.level.event.LevelEventTranslator; @@ -56,7 +56,7 @@ import java.util.Locale; public class JavaLevelEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { // Separate case since each RecordEventData in Java is an individual track in Bedrock if (packet.getEvent() == com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent.RECORD) { RecordEventData recordEventData = (RecordEventData) packet.getData(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java index 7cbdc2a4b..4f4251750 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -50,7 +50,7 @@ import java.util.function.Function; public class JavaLevelParticlesTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundLevelParticlesPacket packet) { Function particleCreateFunction = createParticle(session, packet.getParticle()); if (particleCreateFunction != null) { if (packet.getAmount() == 0) { @@ -80,7 +80,7 @@ public class JavaLevelParticlesTranslator extends PacketTranslator createParticle(GeyserSession session, Particle particle) { + private Function createParticle(GeyserSessionImpl session, Particle particle) { switch (particle.getType()) { case BLOCK -> { int blockState = session.getBlockMappings().getBedrockBlockId(((BlockParticleData) particle.getData()).getBlockState()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java index c5b296f4f..ed9aceac2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.data.MapDecoration; import com.nukkitx.protocol.bedrock.data.MapTrackedObject; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.BedrockMapIcon; @@ -41,7 +41,7 @@ import org.geysermc.geyser.level.MapColor; public class JavaMapItemDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundMapItemDataPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundMapItemDataPacket packet) { com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket mapItemDataPacket = new com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket(); boolean shouldStore = false; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java index c301ee462..d1cc3704e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.ChunkUtils; @@ -36,7 +36,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaSectionBlocksUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSectionBlocksUpdatePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSectionBlocksUpdatePacket packet) { for (BlockChangeEntry entry : packet.getEntries()) { ChunkUtils.updateBlock(session, entry.getBlock(), entry.getPosition()); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java index 901a4d82e..8f1147cb3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.ChunkUtils; @@ -36,7 +36,7 @@ import com.nukkitx.math.vector.Vector3i; public class JavaSetChunkCacheCenterTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetChunkCacheCenterPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetChunkCacheCenterPacket packet) { if (!session.isSpawned() && session.getLastChunkPosition() == null) { ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4)); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java index 50ed540ea..919f860df 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetChunkCacheRadiusTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetChunkCacheRadiusPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetChunkCacheRadiusPacket packet) { session.setRenderDistance(packet.getViewDistance()); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java index 8067341e1..e38cf00fd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.DimensionUtils; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class JavaSetDefaultSpawnPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetDefaultSpawnPositionPacket packet) { SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket(); spawnPositionPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); spawnPositionPacket.setSpawnForced(true); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java index 9ff6965ca..6170b2b32 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; import com.nukkitx.protocol.bedrock.packet.SetTimePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetTimeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetTimePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetTimePacket packet) { // Bedrock sends a GameRulesChangedPacket if there is no daylight cycle // Java just sends a negative long if there is no daylight cycle long time = packet.getTime(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java index e9f9337aa..ad0af4f10 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -44,7 +44,7 @@ import org.geysermc.geyser.registry.type.SoundMapping; public class JavaSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSoundPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSoundPacket packet) { String packetSound = packet.getSound().getName(); SoundMapping soundMapping = Registries.SOUNDS.get(packetSound); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java index 75a99f0af..e791407f2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; @@ -39,7 +39,7 @@ import org.geysermc.geyser.registry.type.SoundMapping; public class JavaStopSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundStopSoundPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundStopSoundPacket packet) { // Runs if all sounds are stopped if (packet.getSound() == null) { StopSoundPacket stopPacket = new StopSoundPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java index 1f7ea7657..f0574f99f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaInitializeBorderTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundInitializeBorderPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundInitializeBorderPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); worldBorder.setOldDiameter(packet.getOldSize()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java index 6895cf944..6a60f6f38 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderCenterTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetBorderCenterPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetBorderCenterPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java index 3eae4b1f5..2fe5eb392 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetBorderLerpSizePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetBorderLerpSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getOldSize()); worldBorder.setNewDiameter(packet.getNewSize()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java index 076924735..2adee0f41 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderSizePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetBorderSizePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetBorderSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getSize()); worldBorder.setNewDiameter(packet.getSize()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java index b3104fb9a..7e7e91f13 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDelayPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetBorderWarningDelayPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetBorderWarningDelayPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningDelay(packet.getWarningDelay()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java index b4483b9a6..8288f804e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDistancePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetBorderWarningDistancePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetBorderWarningDistancePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningBlocks(packet.getWarningBlocks()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java index fe141486e..ffe7386fb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.scoreboard; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.scoreboard.ScoreboardUpdater; public class JavaSetDisplayObjectiveTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetDisplayObjectivePacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetDisplayObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java index 927fb5488..20932f9cd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java @@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.scoreboard.ObjectiveAction; import com.github.steveice10.mc.protocol.data.game.scoreboard.ScoreboardPosition; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetObjectivePacket; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.logger.GeyserLogger; +import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -46,7 +46,7 @@ public class JavaSetObjectiveTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundClearTitlesPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundClearTitlesPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); // TODO handle packet.isResetTimes() titlePacket.setType(SetTitlePacket.Type.CLEAR); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java index 914ddafb9..e4fa7fe46 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaSetActionBarTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetActionBarTextPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetActionBarTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java index 521f5eba6..70e3716a2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetSubtitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaSetSubtitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetSubtitleTextPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetSubtitleTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java index 04eb76bb5..8a2594ffb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaSetTitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetTitleTextPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetTitleTextPacket packet) { String text; if (packet.getText() == null) { // This can happen, see https://github.com/KyoriPowered/adventure/issues/447 text = " "; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java index b8bbc780a..6d96bc8ea 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitlesAnimationPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetTitlesAnimationTranslator extends PacketTranslator { @Override - public void translate(GeyserSession session, ClientboundSetTitlesAnimationPacket packet) { + public void translate(GeyserSessionImpl session, ClientboundSetTitlesAnimationPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.TIMES); titlePacket.setText(""); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java index 5e6e8d9e8..d42aa9a50 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java @@ -32,7 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.util.BlockUtils; @@ -51,7 +51,7 @@ public interface BlockSoundInteractionTranslator extends SoundInteractionTransla * @param position the position of the block * @param identifier the identifier of the block */ - static void handleBlockInteraction(GeyserSession session, Vector3f position, String identifier) { + static void handleBlockInteraction(GeyserSessionImpl session, Vector3f position, String identifier) { // If we need to get the hand identifier, only get it once and save it to a variable String handIdentifier = null; @@ -98,7 +98,7 @@ public interface BlockSoundInteractionTranslator extends SoundInteractionTransla /** * Determines if the adventure gamemode would prevent this item from actually succeeding */ - static boolean canInteract(GeyserSession session, GeyserItemStack itemInHand, String blockIdentifier) { + static boolean canInteract(GeyserSessionImpl session, GeyserItemStack itemInHand, String blockIdentifier) { if (session.getGameMode() != GameMode.ADVENTURE) { // There are no restrictions on the item return true; diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java index 4a88696f8..27b026a46 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.Registries; import java.util.Map; @@ -46,7 +46,7 @@ public interface EntitySoundInteractionTranslator extends SoundInteractionTransl * @param position the position of the block * @param entity the entity interacted with */ - static void handleEntityInteraction(GeyserSession session, Vector3f position, Entity entity) { + static void handleEntityInteraction(GeyserSessionImpl session, Vector3f position, Entity entity) { // If we need to get the hand identifier, only get it once and save it to a variable String handIdentifier = null; diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java index 7cccbb21d..be0ccb0c8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.sound; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; /** * Handler for playing sounds when right-clicking @@ -48,5 +48,5 @@ public interface SoundInteractionTranslator { * @param position the position of the block * @param value the value */ - void translate(GeyserSession session, Vector3f position, T value); + void translate(GeyserSessionImpl session, Vector3f position, T value); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java index 1af30e658..072e0bf56 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class BucketSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { if (session.getBucketScheduledFuture() == null) { return; // No bucket was really interacted with } diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java index 8c10076d3..9fb95fbb5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class ComparatorSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { boolean powered = identifier.contains("mode=compare"); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java index 1115760eb..38f53d855 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class DoorSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { if (identifier.contains("iron")) return; LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setType(LevelEventType.SOUND_DOOR_OPEN); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java index 09e86f461..920ece899 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class FlintAndSteelInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java index 6c91b24a0..fc258978f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; import org.geysermc.geyser.registry.BlockRegistries; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.BlockRegistries; public class GrassPathInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java index 799364498..a37650849 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; import org.geysermc.geyser.registry.BlockRegistries; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.BlockRegistries; public class HoeInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java index a57d337b1..a1b6247a1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class LeverSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, String identifier) { + public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { boolean powered = identifier.contains("powered=true"); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java index ea160538e..bc8822c8c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; import org.geysermc.geyser.entity.type.living.animal.OcelotEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -40,7 +40,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class FeedBabySoundInteractionTranslator implements EntitySoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, Entity entity) { + public void translate(GeyserSessionImpl session, Vector3f position, Entity entity) { if (entity instanceof AnimalEntity animalEntity && !(entity instanceof CatEntity || entity instanceof OcelotEntity)) { String handIdentifier = session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier(); boolean isBaby = animalEntity.isBaby(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java index e8698ff23..47fad3559 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.GoatEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class MilkEntitySoundInteractionTranslator implements EntitySoundInteractionTranslator { @Override - public void translate(GeyserSession session, Vector3f position, Entity value) { + public void translate(GeyserSessionImpl session, Vector3f position, Entity value) { if (!session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier().equals("minecraft:bucket")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java index d22b47768..eab6c4ba6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java @@ -33,7 +33,7 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.MinecraftTranslationRegistry; import org.geysermc.geyser.text.GsonComponentSerializerWrapper; import org.geysermc.geyser.text.GeyserLocale; @@ -223,10 +223,10 @@ public class MessageTranslator { * Checks if the given message is over 256 characters (Java edition server chat limit) and sends a message to the user if it is * * @param message Message to check - * @param session {@link GeyserSession} for the user + * @param session {@link GeyserSessionImpl} for the user * @return True if the message is too long, false if not */ - public static boolean isTooLong(String message, GeyserSession session) { + public static boolean isTooLong(String message, GeyserSessionImpl session) { if (message.length() > 256) { session.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.chat.too_long", session.getLocale(), message.length())); return true; diff --git a/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java index 6d4258d7e..0f6cc07a3 100644 --- a/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity; import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; import org.geysermc.geyser.translator.level.block.entity.FlowerPotBlockEntityTranslator; @@ -89,11 +89,11 @@ public class BlockEntityUtils { return Registries.BLOCK_ENTITIES.get(type); } - public static void updateBlockEntity(GeyserSession session, @Nonnull NbtMap blockEntity, Position position) { + public static void updateBlockEntity(GeyserSessionImpl session, @Nonnull NbtMap blockEntity, Position position) { updateBlockEntity(session, blockEntity, Vector3i.from(position.getX(), position.getY(), position.getZ())); } - public static void updateBlockEntity(GeyserSession session, @Nonnull NbtMap blockEntity, Vector3i position) { + public static void updateBlockEntity(GeyserSessionImpl session, @Nonnull NbtMap blockEntity, Vector3i position) { BlockEntityDataPacket blockEntityPacket = new BlockEntityDataPacket(); blockEntityPacket.setBlockPosition(position); blockEntityPacket.setData(blockEntity); diff --git a/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java index c43cc3311..125d13662 100644 --- a/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.collision.BlockCollision; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.Registries; @@ -43,7 +43,7 @@ public class BlockUtils { */ public static final Position POSITION_ZERO = new Position(0, 0, 0); - private static boolean correctTool(GeyserSession session, BlockMapping blockMapping, String itemToolType) { + private static boolean correctTool(GeyserSessionImpl session, BlockMapping blockMapping, String itemToolType) { switch (itemToolType) { case "axe": return session.getTagCache().isAxeEffective(blockMapping); @@ -78,7 +78,7 @@ public class BlockUtils { }; } - private static boolean canToolTierBreakBlock(GeyserSession session, BlockMapping blockMapping, String toolTier) { + private static boolean canToolTierBreakBlock(GeyserSessionImpl session, BlockMapping blockMapping, String toolTier) { if (toolTier.equals("netherite") || toolTier.equals("diamond")) { // As of 1.17, these tiers can mine everything that is mineable return true; @@ -139,7 +139,7 @@ public class BlockUtils { return 1.0 / speed; } - public static double getBreakTime(GeyserSession session, BlockMapping blockMapping, ItemMapping item, CompoundTag nbtData, boolean isSessionPlayer) { + public static double getBreakTime(GeyserSessionImpl session, BlockMapping blockMapping, ItemMapping item, CompoundTag nbtData, boolean isSessionPlayer) { boolean isShearsEffective = session.getTagCache().isShearsEffective(blockMapping); //TODO called twice boolean canHarvestWithHand = blockMapping.isCanBreakWithHand(); String toolType = ""; @@ -178,7 +178,7 @@ public class BlockUtils { outOfWaterButNotOnGround, insideWaterNotOnGround); } - public static double getSessionBreakTime(GeyserSession session, BlockMapping blockMapping) { + public static double getSessionBreakTime(GeyserSessionImpl session, BlockMapping blockMapping) { PlayerInventory inventory = session.getPlayerInventory(); GeyserItemStack item = inventory.getItemInHand(); ItemMapping mapping; @@ -234,11 +234,11 @@ public class BlockUtils { return Registries.COLLISIONS.get(blockId); } - public static BlockCollision getCollisionAt(GeyserSession session, Vector3i blockPos) { + public static BlockCollision getCollisionAt(GeyserSessionImpl session, Vector3i blockPos) { return getCollision(session.getGeyser().getWorldManager().getBlockAt(session, blockPos)); } - public static BlockCollision getCollisionAt(GeyserSession session, int x, int y, int z) { + public static BlockCollision getCollisionAt(GeyserSessionImpl session, int x, int y, int z) { return getCollision(session.getGeyser().getWorldManager().getBlockAt(session, x, y, z)); } } diff --git a/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java b/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java index cb80e209b..2b7713235 100644 --- a/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java @@ -40,7 +40,7 @@ import it.unimi.dsi.fastutil.ints.IntLists; import lombok.experimental.UtilityClass; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity; @@ -115,7 +115,7 @@ public class ChunkUtils { return (yzx >> 8) | (yzx & 0x0F0) | ((yzx & 0x00F) << 8); } - public static void updateChunkPosition(GeyserSession session, Vector3i position) { + public static void updateChunkPosition(GeyserSessionImpl session, Vector3i position) { Vector2i chunkPos = session.getLastChunkPosition(); Vector2i newChunkPos = Vector2i.from(position.getX() >> 4, position.getZ() >> 4); @@ -136,7 +136,7 @@ public class ChunkUtils { * @param blockState the Java block state of the block * @param position the position of the block */ - public static void updateBlock(GeyserSession session, int blockState, Position position) { + public static void updateBlock(GeyserSessionImpl session, int blockState, Position position) { Vector3i pos = Vector3i.from(position.getX(), position.getY(), position.getZ()); updateBlock(session, blockState, pos); } @@ -148,7 +148,7 @@ public class ChunkUtils { * @param blockState the Java block state of the block * @param position the position of the block */ - public static void updateBlock(GeyserSession session, int blockState, Vector3i position) { + public static void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position) { // Checks for item frames so they aren't tripped up and removed ItemFrameEntity itemFrameEntity = ItemFrameEntity.getItemFrameEntity(session, position); if (itemFrameEntity != null) { @@ -205,7 +205,7 @@ public class ChunkUtils { session.getChunkCache().updateBlock(position.getX(), position.getY(), position.getZ(), blockState); } - public static void sendEmptyChunks(GeyserSession session, Vector3i position, int radius, boolean forceUpdate) { + public static void sendEmptyChunks(GeyserSessionImpl session, Vector3i position, int radius, boolean forceUpdate) { int chunkX = position.getX() >> 4; int chunkZ = position.getZ() >> 4; for (int x = -radius; x <= radius; x++) { @@ -234,7 +234,7 @@ public class ChunkUtils { * Process the minimum and maximum heights for this dimension, and processes the world coordinate scale. * This must be done after the player has switched dimensions so we know what their dimension is */ - public static void loadDimensionTag(GeyserSession session, CompoundTag dimensionTag) { + public static void loadDimensionTag(GeyserSessionImpl session, CompoundTag dimensionTag) { int minY = ((IntTag) dimensionTag.get("min_y")).getValue(); int maxY = ((IntTag) dimensionTag.get("height")).getValue(); // Logical height can be ignored probably - seems to be for artificial limits like the Nether. diff --git a/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java b/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java index c149996b8..06c2a8f3e 100644 --- a/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.util; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.cache.PreferencesCache; import java.util.concurrent.TimeUnit; @@ -51,7 +51,7 @@ public class CooldownUtils { * Starts sending the fake cooldown to the Bedrock client. If the cooldown is not disabled, the sent type is the cooldownPreference in {@link PreferencesCache} * @param session GeyserSession */ - public static void sendCooldown(GeyserSession session) { + public static void sendCooldown(GeyserSessionImpl session) { if (DEFAULT_SHOW_COOLDOWN == CooldownType.DISABLED) return; CooldownType sessionPreference = session.getPreferencesCache().getCooldownPreference(); if (sessionPreference == CooldownType.DISABLED) return; @@ -75,7 +75,7 @@ public class CooldownUtils { * @param sessionPreference The type of cooldown the client prefers * @param lastHitTime The time of the last hit. Used to gauge how long the cooldown is taking. */ - private static void computeCooldown(GeyserSession session, CooldownType sessionPreference, long lastHitTime) { + private static void computeCooldown(GeyserSessionImpl session, CooldownType sessionPreference, long lastHitTime) { if (session.isClosed()) return; // Don't run scheduled tasks if the client left if (lastHitTime != session.getLastHitTime()) return; // Means another cooldown has started so there's no need to continue this one SetTitlePacket titlePacket = new SetTitlePacket(); @@ -108,7 +108,7 @@ public class CooldownUtils { } } - private static boolean hasCooldown(GeyserSession session) { + private static boolean hasCooldown(GeyserSessionImpl session) { long time = System.currentTimeMillis() - session.getLastHitTime(); double cooldown = restrain(((double) time) * session.getAttackSpeed() / 1000d, 1.5); return cooldown < 1.1; @@ -121,7 +121,7 @@ public class CooldownUtils { return Math.min(x, max); } - private static String getTitle(GeyserSession session) { + private static String getTitle(GeyserSessionImpl session) { long time = System.currentTimeMillis() - session.getLastHitTime(); double cooldown = restrain(((double) time) * session.getAttackSpeed() / 1000d, 1); diff --git a/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java index c729c0b1e..352a8e996 100644 --- a/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.util.Set; @@ -56,7 +56,7 @@ public class DimensionUtils { */ public static final String THE_END = "minecraft:the_end"; - public static void switchDimension(GeyserSession session, String javaDimension) { + public static void switchDimension(GeyserSessionImpl session, String javaDimension) { int bedrockDimension = javaToBedrock(javaDimension); Entity player = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java index 1b671b2fe..907aef169 100644 --- a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java @@ -41,7 +41,7 @@ import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -64,7 +64,7 @@ public class InventoryUtils { public static final ItemStack REFRESH_ITEM = new ItemStack(1, 127, new CompoundTag("")); - public static void openInventory(GeyserSession session, Inventory inventory) { + public static void openInventory(GeyserSessionImpl session, Inventory inventory) { session.setOpenInventory(inventory); if (session.isClosingInventory()) { //Wait for close confirmation from client before opening the new inventory. @@ -75,7 +75,7 @@ public class InventoryUtils { displayInventory(session, inventory); } - public static void displayInventory(GeyserSession session, Inventory inventory) { + public static void displayInventory(GeyserSessionImpl session, Inventory inventory) { InventoryTranslator translator = session.getInventoryTranslator(); if (translator != null) { translator.prepareInventory(session, inventory); @@ -100,7 +100,7 @@ public class InventoryUtils { } } - public static void closeInventory(GeyserSession session, int windowId, boolean confirm) { + public static void closeInventory(GeyserSessionImpl session, int windowId, boolean confirm) { session.getPlayerInventory().setCursor(GeyserItemStack.EMPTY, session); updateCursor(session); @@ -116,7 +116,7 @@ public class InventoryUtils { session.setOpenInventory(null); } - public static Inventory getInventory(GeyserSession session, int windowId) { + public static Inventory getInventory(GeyserSessionImpl session, int windowId) { if (windowId == 0) { return session.getPlayerInventory(); } else { @@ -128,7 +128,7 @@ public class InventoryUtils { } } - public static void updateCursor(GeyserSession session) { + public static void updateCursor(GeyserSessionImpl session) { InventorySlotPacket cursorPacket = new InventorySlotPacket(); cursorPacket.setContainerId(ContainerId.UI); cursorPacket.setSlot(0); @@ -177,12 +177,12 @@ public class InventoryUtils { } /** - * See {@link #findOrCreateItem(GeyserSession, String)}. This is for finding a specified {@link ItemStack}. + * See {@link #findOrCreateItem(GeyserSessionImpl, String)}. This is for finding a specified {@link ItemStack}. * * @param session the Bedrock client's session * @param itemStack the item to try to find a match for. NBT will also be accounted for. */ - public static void findOrCreateItem(GeyserSession session, ItemStack itemStack) { + public static void findOrCreateItem(GeyserSessionImpl session, ItemStack itemStack) { PlayerInventory inventory = session.getPlayerInventory(); if (itemStack == null || itemStack.getId() == 0) { @@ -241,7 +241,7 @@ public class InventoryUtils { * @param session the Bedrock client's session * @param itemName the Java identifier of the item to search/select */ - public static void findOrCreateItem(GeyserSession session, String itemName) { + public static void findOrCreateItem(GeyserSessionImpl session, String itemName) { // Get the inventory to choose a slot to pick PlayerInventory inventory = session.getPlayerInventory(); @@ -320,7 +320,7 @@ public class InventoryUtils { * @param session GeyserSession * @param slot inventory slot to be selected */ - private static void setHotbarItem(GeyserSession session, int slot) { + private static void setHotbarItem(GeyserSessionImpl session, int slot) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); // Java inventory slot to hotbar slot ID diff --git a/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java b/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java index 0eed01613..3307e3e88 100644 --- a/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; public class ItemUtils { @@ -49,7 +49,7 @@ public class ItemUtils { /** * @return the correct Bedrock durability for this item. */ - public static int getCorrectBedrockDurability(GeyserSession session, int javaId, int original) { + public static int getCorrectBedrockDurability(GeyserSessionImpl session, int javaId, int original) { if (javaId == session.getItemMappings().getStoredItems().fishingRod().getJavaId()) { // Java durability: 64 // Bedrock durability : 384 diff --git a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java index 213953bdd..128b0bcb5 100644 --- a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; import com.nukkitx.protocol.bedrock.util.EncryptionUtils; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.session.auth.AuthData; import org.geysermc.geyser.session.auth.BedrockClientData; import org.geysermc.cumulus.CustomForm; @@ -115,7 +115,7 @@ public class LoginEncryptionUtils { return mojangSigned; } - public static void encryptPlayerConnection(GeyserSession session, LoginPacket loginPacket) { + public static void encryptPlayerConnection(GeyserSessionImpl session, LoginPacket loginPacket) { JsonNode certData; try { certData = JSON_MAPPER.readTree(loginPacket.getChainData().toByteArray()); @@ -131,7 +131,7 @@ public class LoginEncryptionUtils { encryptConnectionWithCert(session, loginPacket.getSkinData().toString(), certChainData); } - private static void encryptConnectionWithCert(GeyserSession session, String clientData, JsonNode certChainData) { + private static void encryptConnectionWithCert(GeyserSessionImpl session, String clientData, JsonNode certChainData) { try { GeyserImpl geyser = session.getGeyser(); @@ -190,7 +190,7 @@ public class LoginEncryptionUtils { } } - private static void startEncryptionHandshake(GeyserSession session, PublicKey key) throws Exception { + private static void startEncryptionHandshake(GeyserSessionImpl session, PublicKey key) throws Exception { KeyPairGenerator generator = KeyPairGenerator.getInstance("EC"); generator.initialize(new ECGenParameterSpec("secp384r1")); KeyPair serverKeyPair = generator.generateKeyPair(); @@ -212,7 +212,7 @@ public class LoginEncryptionUtils { } } - public static void buildAndShowLoginWindow(GeyserSession session) { + public static void buildAndShowLoginWindow(GeyserSessionImpl session) { // Set DoDaylightCycle to false so the time doesn't accelerate while we're here session.setDaylightCycle(false); @@ -256,7 +256,7 @@ public class LoginEncryptionUtils { })); } - public static void buildAndShowLoginDetailsWindow(GeyserSession session) { + public static void buildAndShowLoginDetailsWindow(GeyserSessionImpl session) { session.sendForm( CustomForm.builder() .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) @@ -278,7 +278,7 @@ public class LoginEncryptionUtils { /** * Prompts the user between either OAuth code login or manual password authentication */ - public static void buildAndShowMicrosoftAuthenticationWindow(GeyserSession session) { + public static void buildAndShowMicrosoftAuthenticationWindow(GeyserSessionImpl session) { session.sendForm( SimpleForm.builder() .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) @@ -306,7 +306,7 @@ public class LoginEncryptionUtils { /** * Shows the code that a user must input into their browser */ - public static void buildAndShowMicrosoftCodeWindow(GeyserSession session, MsaAuthenticationService.MsCodeResponse msCode) { + public static void buildAndShowMicrosoftCodeWindow(GeyserSessionImpl session, MsaAuthenticationService.MsCodeResponse msCode) { session.sendForm( ModalForm.builder() .title("%xbox.signin") diff --git a/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java b/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java index ff0080f74..babbc8a62 100644 --- a/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java +++ b/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java @@ -31,8 +31,8 @@ import com.google.gson.JsonElement; import com.google.gson.JsonSyntaxException; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.logger.GeyserLogger; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.GeyserLogger; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.floodgate.news.NewsItem; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.news.data.AnnouncementData; @@ -88,13 +88,13 @@ public class NewsHandler { } catch (JsonSyntaxException ignored) {} } - public void handleNews(GeyserSession session, NewsItemAction action) { + public void handleNews(GeyserSessionImpl session, NewsItemAction action) { for (NewsItem news : getActiveNews(action)) { handleNewsItem(session, news, action); } } - private void handleNewsItem(GeyserSession session, NewsItem news, NewsItemAction action) { + private void handleNewsItem(GeyserSessionImpl session, NewsItem news, NewsItemAction action) { switch (action) { case ON_SERVER_STARTED: if (!firstCheck) { @@ -110,7 +110,7 @@ public class NewsHandler { // } break; case BROADCAST_TO_OPERATORS: - for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { + for (GeyserSessionImpl player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { if (player.getOpPermissionLevel() >= 2) { session.sendMessage(ChatColor.GREEN + news.getMessage()); } diff --git a/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java b/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java index ed706eeca..ac39f6823 100644 --- a/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import java.nio.ByteBuffer; @@ -73,7 +73,7 @@ public class PluginMessageUtils { return SKIN_CHANNEL; } - public static void sendMessage(GeyserSession session, String channel, byte[] data) { + public static void sendMessage(GeyserSessionImpl session, String channel, byte[] data) { session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, data)); } diff --git a/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java b/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java index 28fb53ab1..8adbc6e4e 100644 --- a/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.level.GameRule; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.level.WorldManager; import org.geysermc.cumulus.CustomForm; import org.geysermc.cumulus.component.DropdownComponent; @@ -43,7 +43,7 @@ public class SettingsUtils { * * @param session The session to build the form for */ - public static CustomForm buildForm(GeyserSession session) { + public static CustomForm buildForm(GeyserSessionImpl session) { // Cache the language for cleaner access String language = session.getLocale(); diff --git a/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java index aa5893462..805fec807 100644 --- a/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.statistic.*; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.cumulus.SimpleForm; @@ -49,7 +49,7 @@ public class StatisticsUtils { * * @param session The session to build the form for */ - public static void buildAndSendStatisticsMenu(GeyserSession session) { + public static void buildAndSendStatisticsMenu(GeyserSessionImpl session) { // Cache the language for cleaner access String language = session.getLocale(); diff --git a/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java index aaa780ed5..6226ecbbd 100644 --- a/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.util.collection; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.GeyserSessionImpl; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.util.BlockEntityUtils; @@ -41,7 +41,7 @@ public class LecternHasBookMap extends FixedInt2BooleanMap { * Update a potential lectern within the world. This is a map method so it can use the internal fields to * optimize lectern determining. */ - public void handleBlockChange(GeyserSession session, int blockState, Vector3i position) { + public void handleBlockChange(GeyserSessionImpl session, int blockState, Vector3i position) { WorldManager worldManager = session.getGeyser().getWorldManager(); int offset = blockState - this.start; diff --git a/pom.xml b/pom.xml index 67e068212..334fa8031 100644 --- a/pom.xml +++ b/pom.xml @@ -32,10 +32,10 @@ ap + api bootstrap common core - api From 5b415cea68a4f25ff0ed932d58d73d17b3a92290 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sun, 21 Nov 2021 20:18:00 -0600 Subject: [PATCH 699/766] Remove generic usage in Api --- .../src/main/java/org/geysermc/api/Api.java | 12 +++---- .../main/java/org/geysermc/api/Geyser.java | 8 ++--- api/geyser/pom.xml | 6 ++++ .../org/geysermc/geyser/api/GeyserApi.java | 32 ++++++++++++++++++- .../java/org/geysermc/geyser/GeyserImpl.java | 5 ++- 5 files changed, 48 insertions(+), 15 deletions(-) diff --git a/api/base/src/main/java/org/geysermc/api/Api.java b/api/base/src/main/java/org/geysermc/api/Api.java index f3ee9c742..30d5dc134 100644 --- a/api/base/src/main/java/org/geysermc/api/Api.java +++ b/api/base/src/main/java/org/geysermc/api/Api.java @@ -34,10 +34,8 @@ import java.util.UUID; /** * The base API class. - * - * @param the session type */ -public interface Api { +public interface Api { /** * Gets the session from the given @@ -47,7 +45,7 @@ public interface Api { * @return the session from the given UUID, if applicable */ @Nullable - S sessionByUuid(@NonNull UUID uuid); + Session sessionByUuid(@NonNull UUID uuid); /** * Gets the session from the given @@ -57,7 +55,7 @@ public interface Api { * @return the session from the given UUID, if applicable */ @Nullable - S sessionByXuid(@NonNull String xuid); + Session sessionByXuid(@NonNull String xuid); /** * Gets the session from the given @@ -67,7 +65,7 @@ public interface Api { * @return the session from the given name, if applicable */ @Nullable - S sessionByName(@NonNull String name); + Session sessionByName(@NonNull String name); /** * Gets all the online sessions. @@ -75,5 +73,5 @@ public interface Api { * @return all the online sessions */ @NonNull - List onlineSessions(); + List onlineSessions(); } diff --git a/api/base/src/main/java/org/geysermc/api/Geyser.java b/api/base/src/main/java/org/geysermc/api/Geyser.java index 99d3f1402..99f343274 100644 --- a/api/base/src/main/java/org/geysermc/api/Geyser.java +++ b/api/base/src/main/java/org/geysermc/api/Geyser.java @@ -32,14 +32,14 @@ import org.checkerframework.checker.nullness.qual.NonNull; */ @NonNull public class Geyser { - private static Api api; + private static Api api; /** * Returns the base api. * * @return the base api */ - public static Api api() { + public static Api api() { if (api == null) { throw new RuntimeException("Api has not been registered yet!"); } @@ -55,7 +55,7 @@ public class Geyser { * @return the api of the given type */ @SuppressWarnings("unchecked") - public static > T api(@NonNull Class apiClass) { + public static T api(@NonNull Class apiClass) { if (apiClass.isInstance(api)) { return (T) api; } @@ -74,7 +74,7 @@ public class Geyser { * * @param api the api */ - public static void set(@NonNull Api api) { + public static void set(@NonNull Api api) { if (Geyser.api != null) { throw new RuntimeException("Cannot redefine already registered api!"); } diff --git a/api/geyser/pom.xml b/api/geyser/pom.xml index dc28b0648..df88b076f 100644 --- a/api/geyser/pom.xml +++ b/api/geyser/pom.xml @@ -17,6 +17,12 @@ + + org.checkerframework + checker-qual + 3.19.0 + provided + org.geysermc base-api diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java index a6b4cbf78..31981914d 100644 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java @@ -25,14 +25,20 @@ package org.geysermc.geyser.api; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.api.Api; import org.geysermc.api.Geyser; +import org.geysermc.api.session.Session; import org.geysermc.geyser.api.session.GeyserSession; +import java.util.List; +import java.util.UUID; + /** * Represents the API used in Geyser. */ -public interface GeyserApi extends Api { +public interface GeyserApi extends Api { /** * Shuts down the current Geyser instance. @@ -52,6 +58,30 @@ public interface GeyserApi extends Api { */ boolean productionEnvironment(); + /** + * {@inheritDoc} + */ + @Override + @Nullable GeyserSession sessionByUuid(@NonNull UUID uuid); + + /** + * {@inheritDoc} + */ + @Override + @Nullable GeyserSession sessionByXuid(@NonNull String xuid); + + /** + * {@inheritDoc} + */ + @Override + @Nullable GeyserSession sessionByName(@NonNull String name); + + /** + * {@inheritDoc} + */ + @NonNull + List onlineSessions(); + /** * Gets the {@link GeyserApi}. * diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index a51dd7b40..a12a1c6d0 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -414,9 +414,8 @@ public class GeyserImpl implements GeyserApi { } @Override - @SuppressWarnings("unchecked") - public @NonNull List onlineSessions() { - return (List) (List) this.sessionManager.getAllSessions(); + public @NonNull List onlineSessions() { + return this.sessionManager.getAllSessions(); } @Override From 798f8da573d7356898f217f3bd96bc27c22836c9 Mon Sep 17 00:00:00 2001 From: qlow <20094418+qlow@users.noreply.github.com> Date: Mon, 22 Nov 2021 20:49:55 +0100 Subject: [PATCH 700/766] Enabling player heads to be seen on players (#2634) Custom player heads will now show correctly on players thanks to skin editing and custom geometry. Co-authored-by: qlow Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com> --- .../network/session/GeyserSession.java | 6 + .../network/session/cache/EntityCache.java | 5 + .../PlayerInventoryTranslator.java | 20 +- .../translators/item/StoredItemMappings.java | 2 + .../entity/JavaEntityEquipmentTranslator.java | 15 ++ .../entity/SkullBlockEntityTranslator.java | 5 +- .../connector/skin/FakeHeadProvider.java | 219 +++++++++++++++++ .../geysermc/connector/skin/SkinManager.java | 195 ++++++++------- .../geysermc/connector/skin/SkinProvider.java | 84 ++++++- .../geometry.humanoid.wearingCustomSkull.json | 222 ++++++++++++++++++ ...metry.humanoid.wearingCustomSkullSlim.json | 222 ++++++++++++++++++ 11 files changed, 889 insertions(+), 106 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/skin/FakeHeadProvider.java create mode 100644 connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkull.json create mode 100644 connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index d9e95e9a9..3937fa648 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -219,6 +219,12 @@ public class GeyserSession implements CommandSender { */ private final Set lecternCache; + /** + * A list of all players that have a player head on with a custom texture. + * Our workaround for these players is to give them a custom skin and geometry to emulate wearing a custom skull. + */ + private final Set playerWithCustomHeads = new ObjectOpenHashSet<>(); + @Setter private boolean droppingLecternBook; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java index 3ff547c95..7d0c3c7bc 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java @@ -89,6 +89,10 @@ public class EntityCache { } public boolean removeEntity(Entity entity, boolean force) { + if (entity instanceof PlayerEntity player) { + session.getPlayerWithCustomHeads().remove(player.getUuid()); + } + if (entity != null && entity.isValid() && (force || entity.despawnEntity(session))) { long geyserId = entityIdTranslations.remove(entity.getEntityId()); entities.remove(geyserId); @@ -107,6 +111,7 @@ public class EntityCache { session.getEntityCache().removeEntity(entity, false); } + session.getPlayerWithCustomHeads().clear(); // As a precaution cachedPlayerEntityLinks.clear(); } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java index f52a3053d..1de69c814 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/translators/PlayerInventoryTranslator.java @@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.window.WindowType; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.protocol.bedrock.data.inventory.*; import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; @@ -44,6 +45,7 @@ import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.network.translators.inventory.SlotType; import org.geysermc.connector.network.translators.item.ItemTranslator; +import org.geysermc.connector.skin.FakeHeadProvider; import org.geysermc.connector.utils.InventoryUtils; import org.geysermc.connector.utils.LanguageUtils; @@ -117,6 +119,20 @@ public class PlayerInventoryTranslator extends InventoryTranslator { @Override public void updateSlot(GeyserSession session, Inventory inventory, int slot) { + GeyserItemStack javaItem = inventory.getItem(slot); + ItemData bedrockItem = javaItem.getItemData(session); + + if (slot == 5) { + // Check for custom skull + if (javaItem.getJavaId() == session.getItemMappings().getStoredItems().playerHead().getJavaId() + && javaItem.getNbt() != null + && javaItem.getNbt().get("SkullOwner") instanceof CompoundTag profile) { + FakeHeadProvider.setHead(session, session.getPlayerEntity(), profile); + } else { + FakeHeadProvider.restoreOriginalSkin(session, session.getPlayerEntity()); + } + } + if (slot >= 1 && slot <= 44) { InventorySlotPacket slotPacket = new InventorySlotPacket(); if (slot >= 9) { @@ -133,12 +149,12 @@ public class PlayerInventoryTranslator extends InventoryTranslator { slotPacket.setContainerId(ContainerId.UI); slotPacket.setSlot(slot + 27); } - slotPacket.setItem(inventory.getItem(slot).getItemData(session)); + slotPacket.setItem(bedrockItem); session.sendUpstreamPacket(slotPacket); } else if (slot == 45) { InventoryContentPacket offhandPacket = new InventoryContentPacket(); offhandPacket.setContainerId(ContainerId.OFFHAND); - offhandPacket.setContents(Collections.singletonList(inventory.getItem(slot).getItemData(session))); + offhandPacket.setContents(Collections.singletonList(bedrockItem)); session.sendUpstreamPacket(offhandPacket); } } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java index 6bbdb7421..fae36c2ea 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/StoredItemMappings.java @@ -48,6 +48,7 @@ public class StoredItemMappings { private final ItemMapping lodestoneCompass; private final ItemMapping milkBucket; private final ItemMapping powderSnowBucket; + private final ItemMapping playerHead; private final ItemMapping egg; private final ItemMapping shield; private final ItemMapping wheat; @@ -64,6 +65,7 @@ public class StoredItemMappings { this.lodestoneCompass = load(itemMappings, "lodestone_compass"); this.milkBucket = load(itemMappings, "milk_bucket"); this.powderSnowBucket = load(itemMappings, "powder_snow_bucket"); + this.playerHead = load(itemMappings, "player_head"); this.egg = load(itemMappings, "egg"); this.shield = load(itemMappings, "shield"); this.wheat = load(itemMappings, "wheat"); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java index f297f1a38..affcdfe87 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/JavaEntityEquipmentTranslator.java @@ -26,14 +26,18 @@ package org.geysermc.connector.network.translators.java.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Equipment; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.LivingEntity; +import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.item.ItemTranslator; +import org.geysermc.connector.skin.FakeHeadProvider; @Translator(packet = ServerEntityEquipmentPacket.class) public class JavaEntityEquipmentTranslator extends PacketTranslator { @@ -63,6 +67,17 @@ public class JavaEntityEquipmentTranslator extends PacketTranslator { + ItemStack javaItem = equipment.getItem(); + if (livingEntity instanceof PlayerEntity + && javaItem != null + && javaItem.getId() == session.getItemMappings().getStoredItems().playerHead().getJavaId() + && javaItem.getNbt() != null + && javaItem.getNbt().get("SkullOwner") instanceof CompoundTag profile) { + FakeHeadProvider.setHead(session, (PlayerEntity) livingEntity, profile); + } else { + FakeHeadProvider.restoreOriginalSkin(session, livingEntity); + } + livingEntity.setHelmet(item); armorUpdated = true; } diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java index 90458ca71..5bf75f059 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/entity/SkullBlockEntityTranslator.java @@ -48,7 +48,6 @@ import java.util.concurrent.TimeUnit; @BlockEntity(name = "Skull") public class SkullBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { - public static boolean ALLOW_CUSTOM_SKULLS; @Override public void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState) { @@ -63,8 +62,8 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements } public static CompletableFuture getProfile(CompoundTag tag) { - if (tag.contains("SkullOwner")) { - CompoundTag owner = tag.get("SkullOwner"); + CompoundTag owner = tag.get("SkullOwner"); + if (owner != null) { CompoundTag properties = owner.get("Properties"); if (properties == null) { return SkinProvider.requestTexturesFromUsername(owner); diff --git a/connector/src/main/java/org/geysermc/connector/skin/FakeHeadProvider.java b/connector/src/main/java/org/geysermc/connector/skin/FakeHeadProvider.java new file mode 100644 index 000000000..b848c0c35 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/skin/FakeHeadProvider.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2019-2021 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.connector.skin; + +import com.github.steveice10.mc.auth.data.GameProfile; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.nukkitx.protocol.bedrock.data.skin.ImageData; +import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; +import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; +import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.entity.LivingEntity; +import org.geysermc.connector.entity.player.PlayerEntity; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.utils.LanguageUtils; + +import javax.annotation.Nonnull; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.Collections; +import java.util.Objects; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +/** + * Responsible for modifying a player's skin when wearing a player head + */ +public class FakeHeadProvider { + private static final LoadingCache MERGED_SKINS_LOADING_CACHE = CacheBuilder.newBuilder() + .expireAfterAccess(1, TimeUnit.HOURS) + .maximumSize(10000) + .build(new CacheLoader<>() { + @Override + public SkinProvider.SkinData load(@Nonnull FakeHeadEntry fakeHeadEntry) throws Exception { + SkinProvider.SkinData skinData = SkinProvider.getOrDefault(SkinProvider.requestSkinData(fakeHeadEntry.getEntity()), null, 5); + + if (skinData == null) { + throw new Exception("Couldn't load player's original skin"); + } + + SkinProvider.Skin skin = skinData.skin(); + SkinProvider.Cape cape = skinData.cape(); + SkinProvider.SkinGeometry geometry = skinData.geometry().getGeometryName().equals("{\"geometry\" :{\"default\" :\"geometry.humanoid.customSlim\"}}") + ? SkinProvider.WEARING_CUSTOM_SKULL_SLIM : SkinProvider.WEARING_CUSTOM_SKULL; + + SkinProvider.Skin headSkin = SkinProvider.getOrDefault( + SkinProvider.requestSkin(fakeHeadEntry.getEntity().getUuid(), fakeHeadEntry.getFakeHeadSkinUrl(), false), SkinProvider.EMPTY_SKIN, 5); + BufferedImage originalSkinImage = SkinProvider.imageDataToBufferedImage(skin.getSkinData(), 64, skin.getSkinData().length / 4 / 64); + BufferedImage headSkinImage = SkinProvider.imageDataToBufferedImage(headSkin.getSkinData(), 64, headSkin.getSkinData().length / 4 / 64); + + Graphics2D graphics2D = originalSkinImage.createGraphics(); + graphics2D.setComposite(AlphaComposite.Clear); + graphics2D.fillRect(0, 0, 64, 16); + graphics2D.setComposite(AlphaComposite.SrcOver); + graphics2D.drawImage(headSkinImage, 0, 0, 64, 16, 0, 0, 64, 16, null); + graphics2D.dispose(); + + // Make the skin key a combination of the current skin data and the new skin data + // Don't tie it to a player - that player *can* change skins in-game + String skinKey = "customPlayerHead_" + fakeHeadEntry.getFakeHeadSkinUrl() + "_" + skin.getTextureUrl(); + byte[] targetSkinData = SkinProvider.bufferedImageToImageData(originalSkinImage); + SkinProvider.Skin mergedSkin = new SkinProvider.Skin(fakeHeadEntry.getEntity().getUuid(), skinKey, targetSkinData, System.currentTimeMillis(), false, false); + + // Avoiding memory leak + fakeHeadEntry.setEntity(null); + + return new SkinProvider.SkinData(mergedSkin, cape, geometry); + } + }); + + public static void setHead(GeyserSession session, PlayerEntity entity, CompoundTag profileTag) { + SkinManager.GameProfileData gameProfileData = SkinManager.GameProfileData.from(profileTag); + if (gameProfileData == null) { + return; + } + String fakeHeadSkinUrl = gameProfileData.skinUrl(); + + session.getPlayerWithCustomHeads().add(entity.getUuid()); + + GameProfile.Property texturesProperty = entity.getProfile().getProperty("textures"); + + SkinProvider.EXECUTOR_SERVICE.execute(() -> { + try { + SkinProvider.SkinData mergedSkinData = MERGED_SKINS_LOADING_CACHE.get(new FakeHeadEntry(texturesProperty, fakeHeadSkinUrl, entity)); + + if (session.getUpstream().isInitialized()) { + sendSkinPacket(session, entity, mergedSkinData); + } + } catch (ExecutionException e) { + GeyserConnector.getInstance().getLogger().error("Couldn't merge skin of " + entity.getUsername() + " with head skin url " + fakeHeadSkinUrl, e); + } + }); + } + + public static void restoreOriginalSkin(GeyserSession session, LivingEntity livingEntity) { + if (!(livingEntity instanceof PlayerEntity entity)) { + return; + } + + if (!session.getPlayerWithCustomHeads().remove(entity.getUuid())) { + return; + } + + SkinProvider.requestSkinData(entity).whenCompleteAsync((skinData, throwable) -> { + if (throwable != null) { + GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), throwable); + return; + } + + if (session.getUpstream().isInitialized()) { + sendSkinPacket(session, entity, skinData); + } + }); + } + + private static void sendSkinPacket(GeyserSession session, PlayerEntity entity, SkinProvider.SkinData skinData) { + SkinProvider.Skin skin = skinData.skin(); + SkinProvider.Cape cape = skinData.cape(); + SkinProvider.SkinGeometry geometry = skinData.geometry(); + + if (entity.getUuid().equals(session.getPlayerEntity().getUuid())) { + PlayerListPacket.Entry updatedEntry = SkinManager.buildEntryManually( + session, + entity.getUuid(), + entity.getUsername(), + entity.getGeyserId(), + skin.getTextureUrl(), + skin.getSkinData(), + cape.getCapeId(), + cape.getCapeData(), + geometry + ); + + PlayerListPacket playerAddPacket = new PlayerListPacket(); + playerAddPacket.setAction(PlayerListPacket.Action.ADD); + playerAddPacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerAddPacket); + } else { + PlayerSkinPacket packet = new PlayerSkinPacket(); + packet.setUuid(entity.getUuid()); + packet.setOldSkinName(""); + packet.setNewSkinName(skin.getTextureUrl()); + packet.setSkin(getSkin(skin.getTextureUrl(), skin, cape, geometry)); + packet.setTrustedSkin(true); + session.sendUpstreamPacket(packet); + } + } + + private static SerializedSkin getSkin(String skinId, SkinProvider.Skin skin, SkinProvider.Cape cape, SkinProvider.SkinGeometry geometry) { + return SerializedSkin.of(skinId, "", geometry.getGeometryName(), + ImageData.of(skin.getSkinData()), Collections.emptyList(), + ImageData.of(cape.getCapeData()), geometry.getGeometryData(), + "", true, false, false, cape.getCapeId(), skinId); + } + + @AllArgsConstructor + @Getter + @Setter + private static class FakeHeadEntry { + private final GameProfile.Property texturesProperty; + private final String fakeHeadSkinUrl; + private PlayerEntity entity; + + @Override + public boolean equals(Object o) { + // We don't care about the equality of the entity as that is not used for caching purposes + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + FakeHeadEntry that = (FakeHeadEntry) o; + return equals(texturesProperty, that.texturesProperty) && Objects.equals(fakeHeadSkinUrl, that.fakeHeadSkinUrl); + } + + private boolean equals(GameProfile.Property a, GameProfile.Property b) { + //TODO actually fix this in MCAuthLib + if (a == b) { + return true; + } + if (a == null || b == null) { + return false; + } + return Objects.equals(a.getName(), b.getName()) && Objects.equals(a.getValue(), b.getValue()) && Objects.equals(a.getSignature(), b.getSignature()); + } + + @Override + public int hashCode() { + return Objects.hash(texturesProperty, fakeHeadSkinUrl); + } + } + +} diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java b/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java index 70f9f8ff5..5aaabcffb 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinManager.java @@ -27,6 +27,9 @@ package org.geysermc.connector.skin; import com.fasterxml.jackson.databind.JsonNode; import com.github.steveice10.mc.auth.data.GameProfile; +import com.github.steveice10.opennbt.tag.builtin.CompoundTag; +import com.github.steveice10.opennbt.tag.builtin.ListTag; +import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.nukkitx.protocol.bedrock.data.skin.ImageData; import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; @@ -37,6 +40,8 @@ import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.auth.BedrockClientData; import org.geysermc.connector.utils.LanguageUtils; +import javax.annotation.Nullable; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.Collections; @@ -75,9 +80,9 @@ public class SkinManager { * With all the information needed, build a Bedrock player entry with translated skin information. */ public static PlayerListPacket.Entry buildEntryManually(GeyserSession session, UUID uuid, String username, long geyserId, - String skinId, byte[] skinData, - String capeId, byte[] capeData, - SkinProvider.SkinGeometry geometry) { + String skinId, byte[] skinData, + String capeId, byte[] capeData, + SkinProvider.SkinGeometry geometry) { SerializedSkin serializedSkin = SerializedSkin.of( skinId, "", geometry.getGeometryName(), ImageData.of(skinData), Collections.emptyList(), ImageData.of(capeData), geometry.getGeometryData(), "", true, false, @@ -114,93 +119,52 @@ public class SkinManager { public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSession session, Consumer skinAndCapeConsumer) { - GameProfileData data = GameProfileData.from(entity.getProfile()); + SkinProvider.requestSkinData(entity).whenCompleteAsync((skinData, throwable) -> { + if (skinData == null) { + if (skinAndCapeConsumer != null) { + skinAndCapeConsumer.accept(null); + } - SkinProvider.requestSkinAndCape(entity.getUuid(), data.skinUrl(), data.capeUrl()) - .whenCompleteAsync((skinAndCape, throwable) -> { - try { - SkinProvider.Skin skin = skinAndCape.getSkin(); - SkinProvider.Cape cape = skinAndCape.getCape(); - SkinProvider.SkinGeometry geometry = SkinProvider.SkinGeometry.getLegacy(data.isAlex()); + return; + } - if (cape.isFailed()) { - cape = SkinProvider.getOrDefault(SkinProvider.requestBedrockCape(entity.getUuid()), - SkinProvider.EMPTY_CAPE, 3); - } + if (skinData.geometry() != null) { + SkinProvider.Skin skin = skinData.skin(); + SkinProvider.Cape cape = skinData.cape(); + SkinProvider.SkinGeometry geometry = skinData.geometry(); - if (cape.isFailed() && SkinProvider.ALLOW_THIRD_PARTY_CAPES) { - cape = SkinProvider.getOrDefault(SkinProvider.requestUnofficialCape( - cape, entity.getUuid(), - entity.getUsername(), false - ), SkinProvider.EMPTY_CAPE, SkinProvider.CapeProvider.VALUES.length * 3); - } - - geometry = SkinProvider.getOrDefault(SkinProvider.requestBedrockGeometry( - geometry, entity.getUuid() - ), geometry, 3); - - boolean isDeadmau5 = "deadmau5".equals(entity.getUsername()); - // Not a bedrock player check for ears - if (geometry.isFailed() && (SkinProvider.ALLOW_THIRD_PARTY_EARS || isDeadmau5)) { - boolean isEars; - - // Its deadmau5, gotta support his skin :) - if (isDeadmau5) { - isEars = true; - } else { - // Get the ears texture for the player - skin = SkinProvider.getOrDefault(SkinProvider.requestUnofficialEars( - skin, entity.getUuid(), entity.getUsername(), false - ), skin, 3); - - isEars = skin.isEars(); - } - - // Does the skin have an ears texture - if (isEars) { - // Get the new geometry - geometry = SkinProvider.SkinGeometry.getEars(data.isAlex()); - - // Store the skin and geometry for the ears - SkinProvider.storeEarSkin(skin); - SkinProvider.storeEarGeometry(entity.getUuid(), data.isAlex()); - } - } - - if (session.getUpstream().isInitialized()) { - PlayerListPacket.Entry updatedEntry = buildEntryManually( - session, - entity.getUuid(), - entity.getUsername(), - entity.getGeyserId(), - skin.getTextureUrl(), - skin.getSkinData(), - cape.getCapeId(), - cape.getCapeData(), - geometry - ); + if (session.getUpstream().isInitialized()) { + PlayerListPacket.Entry updatedEntry = buildEntryManually( + session, + entity.getUuid(), + entity.getUsername(), + entity.getGeyserId(), + skin.getTextureUrl(), + skin.getSkinData(), + cape.getCapeId(), + cape.getCapeData(), + geometry + ); - PlayerListPacket playerAddPacket = new PlayerListPacket(); - playerAddPacket.setAction(PlayerListPacket.Action.ADD); - playerAddPacket.getEntries().add(updatedEntry); - session.sendUpstreamPacket(playerAddPacket); + PlayerListPacket playerAddPacket = new PlayerListPacket(); + playerAddPacket.setAction(PlayerListPacket.Action.ADD); + playerAddPacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerAddPacket); - if (!entity.isPlayerList()) { - PlayerListPacket playerRemovePacket = new PlayerListPacket(); - playerRemovePacket.setAction(PlayerListPacket.Action.REMOVE); - playerRemovePacket.getEntries().add(updatedEntry); - session.sendUpstreamPacket(playerRemovePacket); - } - } - } catch (Exception e) { - GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); + if (!entity.isPlayerList()) { + PlayerListPacket playerRemovePacket = new PlayerListPacket(); + playerRemovePacket.setAction(PlayerListPacket.Action.REMOVE); + playerRemovePacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerRemovePacket); } + } + } - if (skinAndCapeConsumer != null) { - skinAndCapeConsumer.accept(skinAndCape); - } - }); + if (skinAndCapeConsumer != null) { + skinAndCapeConsumer.accept(new SkinProvider.SkinAndCape(skinData.skin(), skinData.cape())); + } + }); } public static void handleBedrockSkin(PlayerEntity playerEntity, BedrockClientData clientData) { @@ -233,6 +197,37 @@ public class SkinManager { } public record GameProfileData(String skinUrl, String capeUrl, boolean isAlex) { + /** + * Generate the GameProfileData from the given CompoundTag representing a GameProfile + * + * @param tag tag to build the GameProfileData from + * @return The built GameProfileData, or null if this wasn't a valid tag + */ + public static @Nullable GameProfileData from(CompoundTag tag) { + if (!(tag.get("Properties") instanceof CompoundTag propertiesTag)) { + return null; + } + if (!(propertiesTag.get("textures") instanceof ListTag texturesTag) || texturesTag.size() == 0) { + return null; + } + if (!(texturesTag.get(0) instanceof CompoundTag texturesData)) { + return null; + } + if (!(texturesData.get("Value") instanceof StringTag skinDataValue)) { + return null; + } + + try { + return loadFromJson(skinDataValue.getValue()); + } catch (IOException e) { + GeyserConnector.getInstance().getLogger().debug("Something went wrong while processing skin for tag " + tag); + if (GeyserConnector.getInstance().getConfig().isDebugMode()) { + e.printStackTrace(); + } + return null; + } + } + /** * Generate the GameProfileData from the given GameProfile * @@ -247,22 +242,8 @@ public class SkinManager { // Likely offline mode return loadBedrockOrOfflineSkin(profile); } - JsonNode skinObject = GeyserConnector.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(skinProperty.getValue()), StandardCharsets.UTF_8)); - JsonNode textures = skinObject.get("textures"); - - JsonNode skinTexture = textures.get("SKIN"); - String skinUrl = skinTexture.get("url").asText().replace("http://", "https://"); - - boolean isAlex = skinTexture.has("metadata"); - - String capeUrl = null; - if (textures.has("CAPE")) { - JsonNode capeTexture = textures.get("CAPE"); - capeUrl = capeTexture.get("url").asText().replace("http://", "https://"); - } - - return new GameProfileData(skinUrl, capeUrl, isAlex); - } catch (Exception exception) { + return loadFromJson(skinProperty.getValue()); + } catch (IOException exception) { GeyserConnector.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName()); if (GeyserConnector.getInstance().getConfig().isDebugMode()) { exception.printStackTrace(); @@ -271,6 +252,24 @@ public class SkinManager { } } + private static GameProfileData loadFromJson(String encodedJson) throws IOException { + JsonNode skinObject = GeyserConnector.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8)); + JsonNode textures = skinObject.get("textures"); + + JsonNode skinTexture = textures.get("SKIN"); + String skinUrl = skinTexture.get("url").asText().replace("http://", "https://"); + + boolean isAlex = skinTexture.has("metadata"); + + String capeUrl = null; + JsonNode capeTexture = textures.get("CAPE"); + if (capeTexture != null) { + capeUrl = capeTexture.get("url").asText().replace("http://", "https://"); + } + + return new GameProfileData(skinUrl, capeUrl, isAlex); + } + /** * @return default skin with default cape when texture data is invalid, or the Bedrock player's skin if this * is a Bedrock player. diff --git a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java index 567e52ace..7b1ea9550 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/skin/SkinProvider.java @@ -37,8 +37,10 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.geysermc.connector.GeyserConnector; +import org.geysermc.connector.entity.player.PlayerEntity; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.FileUtils; +import org.geysermc.connector.utils.LanguageUtils; import org.geysermc.connector.utils.WebUtils; import javax.imageio.ImageIO; @@ -57,7 +59,7 @@ import java.util.concurrent.*; public class SkinProvider { public static final boolean ALLOW_THIRD_PARTY_CAPES = GeyserConnector.getInstance().getConfig().isAllowThirdPartyCapes(); - private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(ALLOW_THIRD_PARTY_CAPES ? 21 : 14); + static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(ALLOW_THIRD_PARTY_CAPES ? 21 : 14); public static final byte[] STEVE_SKIN = new ProvidedSkin("bedrock/skin/skin_steve.png").getSkin(); public static final Skin EMPTY_SKIN = new Skin(-1, "steve", STEVE_SKIN); @@ -85,6 +87,8 @@ public class SkinProvider { public static final String EARS_GEOMETRY; public static final String EARS_GEOMETRY_SLIM; public static final SkinGeometry SKULL_GEOMETRY; + public static final SkinGeometry WEARING_CUSTOM_SKULL; + public static final SkinGeometry WEARING_CUSTOM_SKULL_SLIM; public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -99,6 +103,12 @@ public class SkinProvider { String skullData = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.customskull.json")), StandardCharsets.UTF_8); SKULL_GEOMETRY = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.customskull\"}}", skullData, false); + /* Load in the player head skull geometry */ + String wearingCustomSkull = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.wearingCustomSkull.json")), StandardCharsets.UTF_8); + WEARING_CUSTOM_SKULL = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkull\"}}", wearingCustomSkull, false); + String wearingCustomSkullSlim = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json")), StandardCharsets.UTF_8); + WEARING_CUSTOM_SKULL_SLIM = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkullSlim\"}}", wearingCustomSkullSlim, false); + // Schedule Daily Image Expiry if we are caching them if (GeyserConnector.getInstance().getConfig().getCacheImages() > 0) { GeyserConnector.getInstance().getGeneralThreadPool().scheduleAtFixedRate(() -> { @@ -108,7 +118,7 @@ public class SkinProvider { } int count = 0; - final long expireTime = ((long)GeyserConnector.getInstance().getConfig().getCacheImages()) * ((long)1000 * 60 * 60 * 24); + final long expireTime = ((long) GeyserConnector.getInstance().getConfig().getCacheImages()) * ((long) 1000 * 60 * 60 * 24); for (File imageFile : Objects.requireNonNull(cacheFolder.listFiles())) { if (imageFile.lastModified() < System.currentTimeMillis() - expireTime) { //noinspection ResultOfMethodCallIgnored @@ -137,6 +147,69 @@ public class SkinProvider { return cape != null ? cape : EMPTY_CAPE; } + public static CompletableFuture requestSkinData(PlayerEntity entity) { + SkinManager.GameProfileData data = SkinManager.GameProfileData.from(entity.getProfile()); + + return requestSkinAndCape(entity.getUuid(), data.skinUrl(), data.capeUrl()) + .thenApplyAsync(skinAndCape -> { + try { + Skin skin = skinAndCape.getSkin(); + Cape cape = skinAndCape.getCape(); + SkinGeometry geometry = SkinGeometry.getLegacy(data.isAlex()); + + if (cape.isFailed()) { + cape = getOrDefault(requestBedrockCape(entity.getUuid()), + EMPTY_CAPE, 3); + } + + if (cape.isFailed() && ALLOW_THIRD_PARTY_CAPES) { + cape = getOrDefault(requestUnofficialCape( + cape, entity.getUuid(), + entity.getUsername(), false + ), EMPTY_CAPE, CapeProvider.VALUES.length * 3); + } + + geometry = getOrDefault(requestBedrockGeometry( + geometry, entity.getUuid() + ), geometry, 3); + + boolean isDeadmau5 = "deadmau5".equals(entity.getUsername()); + // Not a bedrock player check for ears + if (geometry.isFailed() && (ALLOW_THIRD_PARTY_EARS || isDeadmau5)) { + boolean isEars; + + // Its deadmau5, gotta support his skin :) + if (isDeadmau5) { + isEars = true; + } else { + // Get the ears texture for the player + skin = getOrDefault(requestUnofficialEars( + skin, entity.getUuid(), entity.getUsername(), false + ), skin, 3); + + isEars = skin.isEars(); + } + + // Does the skin have an ears texture + if (isEars) { + // Get the new geometry + geometry = SkinGeometry.getEars(data.isAlex()); + + // Store the skin and geometry for the ears + storeEarSkin(skin); + storeEarGeometry(entity.getUuid(), data.isAlex()); + } + } + + return new SkinData(skin, cape, geometry); + } catch (Exception e) { + GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.skin.fail", entity.getUuid()), e); + } + + return new SkinData(skinAndCape.getSkin(), skinAndCape.getCape(), null); + }); + } + public static CompletableFuture requestSkinAndCape(UUID playerId, String skinUrl, String capeUrl) { return CompletableFuture.supplyAsync(() -> { long time = System.currentTimeMillis(); @@ -329,7 +402,8 @@ public class SkinProvider { byte[] cape = EMPTY_CAPE.getCapeData(); try { cape = requestImage(capeUrl, provider); - } catch (Exception ignored) {} // just ignore I guess + } catch (Exception ignored) { + } // just ignore I guess String[] urlSection = capeUrl.split("/"); // A real url is expected at this stage @@ -451,6 +525,7 @@ public class SkinProvider { /** * If a skull has a username but no textures, request them. + * * @param skullOwner the CompoundTag of the skull with no textures * @return a completable GameProfile with textures included */ @@ -602,6 +677,9 @@ public class SkinProvider { private final Cape cape; } + public record SkinData(Skin skin, Cape cape, SkinGeometry geometry) { + } + @AllArgsConstructor @Getter public static class Skin { diff --git a/connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkull.json b/connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkull.json new file mode 100644 index 000000000..b18d1205b --- /dev/null +++ b/connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkull.json @@ -0,0 +1,222 @@ +{ + "format_version": "1.14.0", + "minecraft:geometry": [ + { + "bones": [ + { + "name" : "root", + "pivot" : [ 0.0, 0.0, 0.0 ] + }, + + { + "name" : "waist", + "parent" : "root", + "pivot" : [ 0.0, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes" : [] + }, + + + { + "name": "body", + "parent" : "waist", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 12.0, -2.0 ], + "size": [ 8, 12, 4 ], + "uv": [ 16, 16 ] + } + ] + }, + + { + "name": "jacket", + "parent" : "body", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 12.0, -2.0 ], + "size": [ 8, 12, 4 ], + "uv": [ 16, 32 ], + "inflate": 0.25 + } + ] + }, + + + { + "name": "head", + "parent" : "body", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 24.75, -4.0 ], + "size": [ 8, 8, 8 ], + "uv": [ 0, 0 ], + "inflate": 0.8 + } + ] + }, + + { + "name": "hat", + "parent" : "head", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 24.75, -4.0 ], + "size": [ 8, 8, 8 ], + "uv": [ 32, 0 ], + "inflate": 1.125 + } + ] + }, + + + { + "name": "leftArm", + "parent" : "body", + "pivot": [ 5.0, 22.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ 4.0, 12.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 32, 48 ] + } + ] + }, + { + "name": "rightArm", + "parent" : "body", + "pivot": [ -5.0, 22.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -8.0, 12.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 40, 16 ] + } + ] + }, + + { + "name": "leftSleeve", + "parent" : "leftArm", + "pivot": [ 5.0, 22.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ 4.0, 12.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 48, 48 ], + "inflate": 0.25 + } + ] + }, + + { + "name": "rightSleeve", + "parent" : "rightArm", + "pivot": [ -5.0, 22.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -8.0, 12.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 40, 32 ], + "inflate": 0.25 + } + ] + }, + + + { + "name": "leftLeg", + "parent" : "root", + "pivot": [ 1.9, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -0.1, 0.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 0, 16 ] + } + ], + "mirror": true + }, + + { + "name": "rightLeg", + "parent" : "root", + "pivot": [ -1.9, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -3.9, 0.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 0, 16 ] + } + ] + }, + + { + "name": "leftPants", + "parent" : "leftLeg", + "pivot": [1.9, 12.0, 0.0], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -0.1, 0.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 0, 48 ], + "inflate": 0.25 + } + ] + }, + + { + "name": "rightPants", + "parent" : "rightLeg", + "pivot": [ -1.9, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -3.9, 0.0, -2.0] , + "size": [ 4, 12, 4 ], + "uv": [ 0, 32], + "inflate": 0.25 + } + ] + }, + + + { + "name" : "rightItem", + "parent" : "rightArm", + "pivot" : [ -6.0, 15.0, 1.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes" : [] + }, + + { + "name" : "leftItem", + "parent" : "leftArm", + "pivot" : [ 6.0, 15.0, 1.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes" : [] + } + ], + "description": { + "identifier": "geometry.humanoid.wearingCustomSkull", + "texture_height": 64, + "texture_width": 64 + } + } + ] +} \ No newline at end of file diff --git a/connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json b/connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json new file mode 100644 index 000000000..3855c92ec --- /dev/null +++ b/connector/src/main/resources/bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json @@ -0,0 +1,222 @@ +{ + "format_version": "1.14.0", + "minecraft:geometry": [ + { + "bones": [ + { + "name" : "root", + "pivot" : [ 0.0, 0.0, 0.0 ] + }, + + { + "name" : "waist", + "parent" : "root", + "pivot" : [ 0.0, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes" : [] + }, + + + { + "name": "body", + "parent" : "waist", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 12.0, -2.0 ], + "size": [ 8, 12, 4 ], + "uv": [ 16, 16 ] + } + ] + }, + + { + "name": "jacket", + "parent" : "body", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 12.0, -2.0 ], + "size": [ 8, 12, 4 ], + "uv": [ 16, 32 ], + "inflate": 0.25 + } + ] + }, + + + { + "name": "head", + "parent" : "body", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 24.75, -4.0 ], + "size": [ 8, 8, 8 ], + "uv": [ 0, 0 ], + "inflate": 0.8 + } + ] + }, + + { + "name": "hat", + "parent" : "head", + "pivot": [ 0.0, 24.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -4.0, 24.75, -4.0 ], + "size": [ 8, 8, 8 ], + "uv": [ 32, 0 ], + "inflate": 1.125 + } + ] + }, + + + { + "name": "leftArm", + "parent" : "body", + "pivot": [ 5.0, 21.5, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [4.0, 11.5, -2.0], + "size": [ 3, 12, 4 ], + "uv": [ 32, 48 ] + } + ] + }, + { + "name": "rightArm", + "parent" : "body", + "pivot": [ -5.0, 21.5, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [-7.0, 11.5, -2.0], + "size": [ 3, 12, 4 ], + "uv": [ 40, 16 ] + } + ] + }, + + { + "name": "leftSleeve", + "parent" : "leftArm", + "pivot": [ 5.0, 21.5, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ 4.0, 11.5, -2.0 ], + "size": [ 3, 12, 4 ], + "uv": [ 48, 48 ], + "inflate": 0.25 + } + ] + }, + + { + "name": "rightSleeve", + "parent" : "rightArm", + "pivot": [ -5.0, 21.5, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -7.0, 11.5, -2.0 ], + "size": [ 3, 12, 4 ], + "uv": [ 40, 32 ], + "inflate": 0.25 + } + ] + }, + + + { + "name": "leftLeg", + "parent" : "root", + "pivot": [ 1.9, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -0.1, 0.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 0, 16 ] + } + ], + "mirror": true + }, + + { + "name": "rightLeg", + "parent" : "root", + "pivot": [ -1.9, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -3.9, 0.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 0, 16 ] + } + ] + }, + + { + "name": "leftPants", + "parent" : "leftLeg", + "pivot": [1.9, 12.0, 0.0], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -0.1, 0.0, -2.0 ], + "size": [ 4, 12, 4 ], + "uv": [ 0, 48 ], + "inflate": 0.25 + } + ] + }, + + { + "name": "rightPants", + "parent" : "rightLeg", + "pivot": [ -1.9, 12.0, 0.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes": [ + { + "origin": [ -3.9, 0.0, -2.0] , + "size": [ 4, 12, 4 ], + "uv": [ 0, 32], + "inflate": 0.25 + } + ] + }, + + + { + "name" : "rightItem", + "parent" : "rightArm", + "pivot" : [ -6.0, 14.5, 1.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes" : [] + }, + + { + "name" : "leftItem", + "parent" : "leftArm", + "pivot" : [ 6.0, 14.5, 1.0 ], + "rotation" : [ 0.0, 0.0, 0.0 ], + "cubes" : [] + } + ], + "description": { + "identifier": "geometry.humanoid.wearingCustomSkullSlim", + "texture_height": 64, + "texture_width": 64 + } + } + ] +} \ No newline at end of file From 966c2155adbb5980637c7072d17a38b7be03771d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 22 Nov 2021 14:52:26 -0500 Subject: [PATCH 701/766] API: change player class to Connection --- .../main/java/org/geysermc/api/Geyser.java | 26 +------- .../geysermc/api/{Api.java => GeyserApi.java} | 41 +++++++++--- .../api/geyser/GeyserConnection.java} | 6 +- .../api/geyser/GeyserExtensionApi.java} | 47 ++----------- .../org/geysermc/api/geyser/package-info.java | 29 ++++++++ .../session/{Session.java => Connection.java} | 19 +++--- .../command/GeyserBungeeCommandExecutor.java | 4 +- .../command/GeyserSpigotCommandExecutor.java | 4 +- .../spigot/world/GeyserPistonListener.java | 6 +- .../GeyserSpigot1_11CraftingListener.java | 10 +-- .../world/GeyserSpigotBlockPlaceListener.java | 4 +- .../GeyserSpigot1_12NativeWorldManager.java | 4 +- .../manager/GeyserSpigot1_12WorldManager.java | 4 +- .../GeyserSpigotFallbackWorldManager.java | 6 +- .../GeyserSpigotLegacyNativeWorldManager.java | 4 +- .../GeyserSpigotNativeWorldManager.java | 4 +- .../manager/GeyserSpigotWorldManager.java | 12 ++-- .../command/GeyserSpongeCommandExecutor.java | 4 +- .../standalone/gui/GeyserStandaloneGUI.java | 4 +- .../GeyserVelocityCommandExecutor.java | 4 +- .../geysermc/connector/GeyserConnector.java | 4 +- .../network/session/GeyserSession.java | 5 +- .../java/org/geysermc/geyser/GeyserImpl.java | 66 +++++++++---------- .../geyser/command/CommandExecutor.java | 6 +- .../geyser/command/CommandManager.java | 6 +- .../geyser/command/GeyserCommand.java | 4 +- .../command/defaults/AdvancementsCommand.java | 4 +- .../geyser/command/defaults/DumpCommand.java | 4 +- .../geyser/command/defaults/HelpCommand.java | 4 +- .../geyser/command/defaults/ListCommand.java | 6 +- .../command/defaults/OffhandCommand.java | 4 +- .../command/defaults/ReloadCommand.java | 4 +- .../command/defaults/SettingsCommand.java | 4 +- .../command/defaults/StatisticsCommand.java | 4 +- .../geyser/command/defaults/StopCommand.java | 4 +- .../command/defaults/VersionCommand.java | 4 +- .../org/geysermc/geyser/dump/DumpInfo.java | 4 +- .../geyser/entity/InteractiveTagManager.java | 4 +- .../entity/factory/BaseEntityFactory.java | 4 +- .../factory/ExperienceOrbEntityFactory.java | 4 +- .../entity/factory/PaintingEntityFactory.java | 4 +- .../entity/type/AbstractArrowEntity.java | 4 +- .../entity/type/AreaEffectCloudEntity.java | 4 +- .../geyser/entity/type/BoatEntity.java | 10 +-- .../type/CommandBlockMinecartEntity.java | 4 +- .../type/DefaultBlockMinecartEntity.java | 4 +- .../entity/type/EnderCrystalEntity.java | 4 +- .../geysermc/geyser/entity/type/Entity.java | 6 +- .../geyser/entity/type/ExpOrbEntity.java | 4 +- .../entity/type/FallingBlockEntity.java | 4 +- .../geyser/entity/type/FireworkEntity.java | 4 +- .../geyser/entity/type/FishingHookEntity.java | 6 +- .../entity/type/FurnaceMinecartEntity.java | 4 +- .../geyser/entity/type/ItemEntity.java | 4 +- .../geyser/entity/type/ItemFrameEntity.java | 8 +-- .../entity/type/ItemedFireballEntity.java | 4 +- .../geyser/entity/type/LeashKnotEntity.java | 4 +- .../geyser/entity/type/LightningEntity.java | 4 +- .../geyser/entity/type/LivingEntity.java | 12 ++-- .../geyser/entity/type/MinecartEntity.java | 4 +- .../geyser/entity/type/PaintingEntity.java | 4 +- .../entity/type/SpawnerMinecartEntity.java | 4 +- .../geyser/entity/type/TNTEntity.java | 4 +- .../geyser/entity/type/ThrowableEntity.java | 4 +- .../entity/type/ThrowableItemEntity.java | 4 +- .../entity/type/ThrownPotionEntity.java | 4 +- .../geyser/entity/type/TippedArrowEntity.java | 4 +- .../geyser/entity/type/TridentEntity.java | 4 +- .../geyser/entity/type/WitherSkullEntity.java | 4 +- .../type/living/AbstractFishEntity.java | 4 +- .../entity/type/living/AgeableEntity.java | 4 +- .../entity/type/living/AmbientEntity.java | 4 +- .../entity/type/living/ArmorStandEntity.java | 4 +- .../geyser/entity/type/living/BatEntity.java | 4 +- .../entity/type/living/CreatureEntity.java | 4 +- .../entity/type/living/FlyingEntity.java | 4 +- .../entity/type/living/GlowSquidEntity.java | 4 +- .../entity/type/living/GolemEntity.java | 4 +- .../entity/type/living/IronGolemEntity.java | 4 +- .../entity/type/living/MagmaCubeEntity.java | 4 +- .../geyser/entity/type/living/MobEntity.java | 4 +- .../entity/type/living/SlimeEntity.java | 4 +- .../entity/type/living/SnowGolemEntity.java | 4 +- .../entity/type/living/SquidEntity.java | 4 +- .../entity/type/living/WaterEntity.java | 4 +- .../type/living/animal/AnimalEntity.java | 4 +- .../type/living/animal/AxolotlEntity.java | 4 +- .../entity/type/living/animal/BeeEntity.java | 4 +- .../type/living/animal/ChickenEntity.java | 4 +- .../entity/type/living/animal/FoxEntity.java | 4 +- .../entity/type/living/animal/GoatEntity.java | 4 +- .../type/living/animal/HoglinEntity.java | 4 +- .../type/living/animal/MooshroomEntity.java | 4 +- .../type/living/animal/OcelotEntity.java | 4 +- .../type/living/animal/PandaEntity.java | 4 +- .../entity/type/living/animal/PigEntity.java | 4 +- .../type/living/animal/PolarBearEntity.java | 4 +- .../type/living/animal/PufferFishEntity.java | 4 +- .../type/living/animal/RabbitEntity.java | 4 +- .../type/living/animal/SheepEntity.java | 4 +- .../type/living/animal/StriderEntity.java | 4 +- .../living/animal/TropicalFishEntity.java | 4 +- .../type/living/animal/TurtleEntity.java | 4 +- .../animal/horse/AbstractHorseEntity.java | 4 +- .../animal/horse/ChestedHorseEntity.java | 4 +- .../type/living/animal/horse/HorseEntity.java | 4 +- .../type/living/animal/horse/LlamaEntity.java | 4 +- .../animal/horse/TraderLlamaEntity.java | 4 +- .../living/animal/tameable/CatEntity.java | 4 +- .../living/animal/tameable/ParrotEntity.java | 4 +- .../animal/tameable/TameableEntity.java | 4 +- .../living/animal/tameable/WolfEntity.java | 4 +- .../merchant/AbstractMerchantEntity.java | 4 +- .../type/living/merchant/VillagerEntity.java | 4 +- .../monster/AbstractSkeletonEntity.java | 4 +- .../type/living/monster/BasePiglinEntity.java | 4 +- .../type/living/monster/BlazeEntity.java | 4 +- .../type/living/monster/CreeperEntity.java | 4 +- .../living/monster/ElderGuardianEntity.java | 4 +- .../living/monster/EnderDragonEntity.java | 4 +- .../living/monster/EnderDragonPartEntity.java | 4 +- .../type/living/monster/EndermanEntity.java | 4 +- .../type/living/monster/GhastEntity.java | 4 +- .../type/living/monster/GiantEntity.java | 4 +- .../type/living/monster/GuardianEntity.java | 4 +- .../type/living/monster/MonsterEntity.java | 4 +- .../type/living/monster/PhantomEntity.java | 4 +- .../type/living/monster/PiglinEntity.java | 6 +- .../type/living/monster/ShulkerEntity.java | 4 +- .../type/living/monster/SkeletonEntity.java | 4 +- .../type/living/monster/SpiderEntity.java | 4 +- .../entity/type/living/monster/VexEntity.java | 4 +- .../type/living/monster/WitherEntity.java | 4 +- .../type/living/monster/ZoglinEntity.java | 4 +- .../type/living/monster/ZombieEntity.java | 4 +- .../living/monster/ZombieVillagerEntity.java | 4 +- .../living/monster/ZombifiedPiglinEntity.java | 4 +- .../monster/raid/AbstractIllagerEntity.java | 4 +- .../living/monster/raid/PillagerEntity.java | 8 +-- .../monster/raid/RaidParticipantEntity.java | 4 +- .../raid/SpellcasterIllagerEntity.java | 4 +- .../living/monster/raid/VindicatorEntity.java | 4 +- .../entity/type/player/PlayerEntity.java | 4 +- .../type/player/SessionPlayerEntity.java | 8 +-- .../entity/type/player/SkullPlayerEntity.java | 4 +- .../geysermc/geyser/inventory/Container.java | 4 +- .../geyser/inventory/EnchantingContainer.java | 2 +- .../geyser/inventory/Generic3X3Container.java | 4 +- .../geyser/inventory/GeyserEnchantOption.java | 4 +- .../geyser/inventory/GeyserItemStack.java | 6 +- .../geysermc/geyser/inventory/Inventory.java | 6 +- .../geyser/inventory/PlayerInventory.java | 4 +- .../inventory/StonecutterContainer.java | 4 +- .../geyser/inventory/click/ClickPlan.java | 6 +- .../holder/BlockInventoryHolder.java | 12 ++-- .../inventory/holder/InventoryHolder.java | 8 +-- .../updater/AnvilInventoryUpdater.java | 34 +++++----- .../updater/ChestInventoryUpdater.java | 6 +- .../updater/ContainerInventoryUpdater.java | 6 +- .../updater/HorseInventoryUpdater.java | 6 +- .../inventory/updater/InventoryUpdater.java | 6 +- .../inventory/updater/UIInventoryUpdater.java | 6 +- .../geyser/level/GeyserWorldManager.java | 18 ++--- .../geysermc/geyser/level/WorldManager.java | 22 +++---- .../level/physics/CollisionManager.java | 8 +-- .../network/ConnectorServerEventHandler.java | 4 +- .../geyser/network/LoggingPacketHandler.java | 6 +- .../geyser/network/UpstreamPacketHandler.java | 4 +- .../geyser/network/netty/LocalSession.java | 2 +- .../registry/PacketTranslatorRegistry.java | 6 +- .../geyser/registry/type/ParticleMapping.java | 4 +- .../geyser/scoreboard/Scoreboard.java | 6 +- .../geyser/scoreboard/ScoreboardUpdater.java | 10 +-- ...serSessionImpl.java => GeyserSession.java} | 12 ++-- .../geyser/session/SessionManager.java | 20 +++--- .../session/cache/AdvancementsCache.java | 6 +- .../geyser/session/cache/BookEditCache.java | 6 +- .../geyser/session/cache/BossBar.java | 4 +- .../geyser/session/cache/ChunkCache.java | 4 +- .../geyser/session/cache/EntityCache.java | 4 +- .../geyser/session/cache/FormCache.java | 4 +- .../geyser/session/cache/PistonCache.java | 6 +- .../session/cache/PreferencesCache.java | 8 +-- .../geyser/session/cache/WorldBorder.java | 10 +-- .../geyser/session/cache/WorldCache.java | 6 +- .../geyser/skin/FloodgateSkinUploader.java | 4 +- .../org/geysermc/geyser/skin/SkinManager.java | 12 ++-- .../geysermc/geyser/skin/SkinProvider.java | 4 +- .../geyser/skin/SkullSkinManager.java | 4 +- .../translator/collision/BlockCollision.java | 4 +- .../translator/collision/DoorCollision.java | 4 +- .../collision/ScaffoldingCollision.java | 4 +- .../translator/collision/SnowCollision.java | 4 +- .../collision/TrapdoorCollision.java | 4 +- .../AbstractBlockInventoryTranslator.java | 12 ++-- .../inventory/AnvilInventoryTranslator.java | 4 +- .../inventory/BaseInventoryTranslator.java | 4 +- .../inventory/BeaconInventoryTranslator.java | 10 +-- .../inventory/BrewingInventoryTranslator.java | 6 +- .../CartographyInventoryTranslator.java | 4 +- .../EnchantingInventoryTranslator.java | 6 +- .../Generic3X3InventoryTranslator.java | 4 +- .../inventory/InventoryTranslator.java | 36 +++++----- .../inventory/LecternInventoryTranslator.java | 16 ++--- .../inventory/LoomInventoryTranslator.java | 6 +- .../MerchantInventoryTranslator.java | 14 ++-- .../inventory/PlayerInventoryTranslator.java | 24 +++---- .../inventory/ShulkerInventoryTranslator.java | 4 +- .../StonecutterInventoryTranslator.java | 4 +- .../chest/ChestInventoryTranslator.java | 8 +-- .../chest/DoubleChestInventoryTranslator.java | 8 +-- .../chest/SingleChestInventoryTranslator.java | 8 +-- .../AbstractFurnaceInventoryTranslator.java | 4 +- .../AbstractHorseInventoryTranslator.java | 12 ++-- .../ChestedHorseInventoryTranslator.java | 4 +- .../inventory/item/ItemTranslator.java | 8 +-- .../item/NbtItemStackTranslator.java | 4 +- .../item/nbt/AxolotlBucketTranslator.java | 4 +- .../item/nbt/BasicItemTranslator.java | 4 +- .../item/nbt/BookPagesTranslator.java | 4 +- .../item/nbt/CrossbowTranslator.java | 4 +- .../item/nbt/EnchantedBookTranslator.java | 4 +- .../item/nbt/EnchantmentTranslator.java | 4 +- .../item/nbt/FireworkRocketTranslator.java | 4 +- .../item/nbt/FireworkStarTranslator.java | 4 +- .../item/nbt/LeatherArmorTranslator.java | 4 +- .../item/nbt/LodestoneCompassTranslator.java | 4 +- .../inventory/item/nbt/MapItemTranslator.java | 4 +- .../item/nbt/PlayerHeadTranslator.java | 4 +- .../item/nbt/ShulkerBoxItemTranslator.java | 4 +- .../nbt/TropicalFishBucketTranslator.java | 4 +- .../translator/level/BiomeTranslator.java | 6 +- .../block/entity/BedrockOnlyBlockEntity.java | 8 +-- .../DoubleChestBlockEntityTranslator.java | 4 +- .../FlowerPotBlockEntityTranslator.java | 6 +- .../NoteblockBlockEntityTranslator.java | 4 +- .../level/block/entity/PistonBlockEntity.java | 6 +- .../entity/SkullBlockEntityTranslator.java | 6 +- .../level/event/LevelEventTranslator.java | 6 +- .../level/event/PlaySoundEventTranslator.java | 4 +- .../event/SoundEventEventTranslator.java | 4 +- .../event/SoundLevelEventTranslator.java | 4 +- .../translator/protocol/PacketTranslator.java | 4 +- .../BedrockAdventureSettingsTranslator.java | 4 +- .../bedrock/BedrockAnimateTranslator.java | 4 +- .../BedrockBlockEntityDataTranslator.java | 4 +- .../BedrockBlockPickRequestTranslator.java | 4 +- .../bedrock/BedrockBookEditTranslator.java | 4 +- .../BedrockCommandBlockUpdateTranslator.java | 4 +- .../BedrockCommandRequestTranslator.java | 4 +- .../BedrockContainerCloseTranslator.java | 4 +- .../bedrock/BedrockEmoteListTranslator.java | 4 +- .../BedrockEntityPickRequestTranslator.java | 4 +- .../bedrock/BedrockFilterTextTranslator.java | 4 +- ...BedrockInventoryTransactionTranslator.java | 6 +- .../BedrockItemFrameDropItemTranslator.java | 4 +- .../BedrockItemStackRequestTranslator.java | 4 +- .../BedrockLecternUpdateTranslator.java | 4 +- .../BedrockMapInfoRequestTranslator.java | 4 +- .../BedrockMobEquipmentTranslator.java | 4 +- .../BedrockMoveEntityAbsoluteTranslator.java | 4 +- .../BedrockNetworkStackLatencyTranslator.java | 4 +- ...drockPacketViolationWarningTranslator.java | 4 +- .../bedrock/BedrockPlayerInputTranslator.java | 4 +- ...tionTrackingDBClientRequestTranslator.java | 4 +- .../bedrock/BedrockRespawnTranslator.java | 4 +- ...edrockServerSettingsRequestTranslator.java | 4 +- ...SetLocalPlayerAsInitializedTranslator.java | 4 +- .../bedrock/BedrockShowCreditsTranslator.java | 4 +- .../bedrock/BedrockTextTranslator.java | 4 +- .../entity/BedrockEntityEventTranslator.java | 4 +- .../player/BedrockActionTranslator.java | 4 +- .../entity/player/BedrockEmoteTranslator.java | 8 +-- .../player/BedrockInteractTranslator.java | 4 +- .../player/BedrockMovePlayerTranslator.java | 6 +- .../player/BedrockRiderJumpTranslator.java | 4 +- .../BedrockSetPlayerGameTypeTranslator.java | 4 +- .../BedrockLevelSoundEventTranslator.java | 4 +- .../java/JavaAwardStatsTranslator.java | 4 +- .../java/JavaBossEventTranslator.java | 4 +- .../java/JavaChangeDifficultyTranslator.java | 4 +- .../protocol/java/JavaChatTranslator.java | 4 +- .../protocol/java/JavaCommandsTranslator.java | 10 +-- .../java/JavaCustomPayloadTranslator.java | 4 +- .../java/JavaCustomQueryTranslator.java | 4 +- .../java/JavaDisconnectTranslator.java | 4 +- .../java/JavaGameProfileTranslator.java | 4 +- .../java/JavaKeepAliveTranslator.java | 4 +- .../java/JavaLoginDisconnectTranslator.java | 4 +- .../protocol/java/JavaLoginTranslator.java | 4 +- .../protocol/java/JavaPingTranslator.java | 4 +- .../protocol/java/JavaRecipeTranslator.java | 4 +- .../protocol/java/JavaRespawnTranslator.java | 4 +- .../JavaSelectAdvancementsTabTranslator.java | 4 +- .../JavaUpdateAdvancementsTranslator.java | 6 +- .../java/JavaUpdateRecipesTranslator.java | 6 +- .../java/JavaUpdateTagsTranslator.java | 4 +- .../java/entity/JavaAnimateTranslator.java | 4 +- .../entity/JavaEntityEventTranslator.java | 4 +- .../JavaMoveEntityPosRotTranslator.java | 4 +- .../entity/JavaMoveEntityPosTranslator.java | 4 +- .../entity/JavaMoveEntityRotTranslator.java | 4 +- .../entity/JavaMoveVehicleTranslator.java | 4 +- .../entity/JavaRemoveEntitiesTranslator.java | 4 +- .../entity/JavaRemoveMobEffectTranslator.java | 4 +- .../java/entity/JavaRotateHeadTranslator.java | 4 +- .../entity/JavaSetEntityDataTranslator.java | 4 +- .../entity/JavaSetEntityLinkTranslator.java | 4 +- .../entity/JavaSetEntityMotionTranslator.java | 4 +- .../entity/JavaSetEquipmentTranslator.java | 4 +- .../entity/JavaSetPassengersTranslator.java | 4 +- .../entity/JavaTakeItemEntityTranslator.java | 4 +- .../entity/JavaTeleportEntityTranslator.java | 4 +- .../JavaUpdateAttributesTranslator.java | 4 +- .../entity/JavaUpdateMobEffectTranslator.java | 4 +- .../player/JavaBlockBreakAckTranslator.java | 4 +- .../player/JavaPlayerAbilitiesTranslator.java | 4 +- .../player/JavaPlayerInfoTranslator.java | 4 +- .../player/JavaPlayerPositionTranslator.java | 4 +- .../player/JavaSetCarriedItemTranslator.java | 4 +- .../player/JavaSetExperienceTranslator.java | 4 +- .../player/JavaSetHealthTranslator.java | 4 +- .../entity/spawn/JavaAddEntityTranslator.java | 4 +- .../spawn/JavaAddExperienceOrbTranslator.java | 4 +- .../entity/spawn/JavaAddMobTranslator.java | 4 +- .../spawn/JavaAddPaintingTranslator.java | 4 +- .../entity/spawn/JavaAddPlayerTranslator.java | 4 +- .../JavaContainerCloseTranslator.java | 4 +- .../JavaContainerSetContentTranslator.java | 4 +- .../JavaContainerSetDataTranslator.java | 4 +- .../JavaContainerSetSlotTranslator.java | 6 +- .../JavaHorseScreenOpenTranslator.java | 4 +- .../JavaMerchantOffersTranslator.java | 6 +- .../inventory/JavaOpenScreenTranslator.java | 4 +- .../level/JavaBlockDestructionTranslator.java | 4 +- .../level/JavaBlockEntityDataTranslator.java | 4 +- .../java/level/JavaBlockEventTranslator.java | 4 +- .../java/level/JavaBlockUpdateTranslator.java | 8 +-- .../java/level/JavaCustomSoundTranslator.java | 4 +- .../java/level/JavaExplodeTranslator.java | 4 +- .../level/JavaForgetLevelChunkTranslator.java | 4 +- .../java/level/JavaGameEventTranslator.java | 4 +- .../JavaLevelChunkWithLightTranslator.java | 4 +- .../java/level/JavaLevelEventTranslator.java | 4 +- .../level/JavaLevelParticlesTranslator.java | 6 +- .../java/level/JavaMapItemDataTranslator.java | 4 +- .../JavaSectionBlocksUpdateTranslator.java | 4 +- .../JavaSetChunkCacheCenterTranslator.java | 4 +- .../JavaSetChunkCacheRadiusTranslator.java | 4 +- ...JavaSetDefaultSpawnPositionTranslator.java | 4 +- .../java/level/JavaSetTimeTranslator.java | 4 +- .../java/level/JavaSoundTranslator.java | 4 +- .../java/level/JavaStopSoundTranslator.java | 4 +- .../JavaInitializeBorderTranslator.java | 4 +- .../border/JavaSetBorderCenterTranslator.java | 4 +- .../JavaSetBorderLerpSizeTranslator.java | 4 +- .../border/JavaSetBorderSizeTranslator.java | 4 +- .../JavaSetBorderWarningDelayTranslator.java | 4 +- ...avaSetBorderWarningDistanceTranslator.java | 4 +- .../JavaSetDisplayObjectiveTranslator.java | 4 +- .../JavaSetObjectiveTranslator.java | 4 +- .../JavaSetPlayerTeamTranslator.java | 4 +- .../scoreboard/JavaSetScoreTranslator.java | 8 +-- .../java/title/JavaClearTitlesTranslator.java | 4 +- .../title/JavaSetActionBarTextTranslator.java | 4 +- .../title/JavaSetSubtitleTextTranslator.java | 4 +- .../title/JavaSetTitleTextTranslator.java | 4 +- .../JavaSetTitlesAnimationTranslator.java | 4 +- .../BlockSoundInteractionTranslator.java | 6 +- .../EntitySoundInteractionTranslator.java | 4 +- .../sound/SoundInteractionTranslator.java | 4 +- .../BucketSoundInteractionTranslator.java | 4 +- .../ComparatorSoundInteractionTranslator.java | 4 +- .../block/DoorSoundInteractionTranslator.java | 4 +- .../FlintAndSteelInteractionTranslator.java | 4 +- .../block/GrassPathInteractionTranslator.java | 4 +- .../sound/block/HoeInteractionTranslator.java | 4 +- .../LeverSoundInteractionTranslator.java | 4 +- .../FeedBabySoundInteractionTranslator.java | 4 +- .../MilkEntitySoundInteractionTranslator.java | 4 +- .../translator/text/MessageTranslator.java | 6 +- .../geyser/util/BlockEntityUtils.java | 6 +- .../org/geysermc/geyser/util/BlockUtils.java | 14 ++-- .../org/geysermc/geyser/util/ChunkUtils.java | 12 ++-- .../geysermc/geyser/util/CooldownUtils.java | 10 +-- .../geysermc/geyser/util/DimensionUtils.java | 4 +- .../geysermc/geyser/util/InventoryUtils.java | 20 +++--- .../org/geysermc/geyser/util/ItemUtils.java | 4 +- .../geyser/util/LoginEncryptionUtils.java | 16 ++--- .../org/geysermc/geyser/util/NewsHandler.java | 8 +-- .../geyser/util/PluginMessageUtils.java | 4 +- .../geysermc/geyser/util/SettingsUtils.java | 4 +- .../geysermc/geyser/util/StatisticsUtils.java | 4 +- .../util/collection/LecternHasBookMap.java | 4 +- 394 files changed, 1103 insertions(+), 1114 deletions(-) rename api/base/src/main/java/org/geysermc/api/{Api.java => GeyserApi.java} (66%) rename api/{geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java => base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java} (90%) rename api/{geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java => base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java} (63%) create mode 100644 api/base/src/main/java/org/geysermc/api/geyser/package-info.java rename api/base/src/main/java/org/geysermc/api/session/{Session.java => Connection.java} (82%) rename core/src/main/java/org/geysermc/geyser/session/{GeyserSessionImpl.java => GeyserSession.java} (99%) diff --git a/api/base/src/main/java/org/geysermc/api/Geyser.java b/api/base/src/main/java/org/geysermc/api/Geyser.java index 99f343274..64b4f02b5 100644 --- a/api/base/src/main/java/org/geysermc/api/Geyser.java +++ b/api/base/src/main/java/org/geysermc/api/Geyser.java @@ -32,14 +32,14 @@ import org.checkerframework.checker.nullness.qual.NonNull; */ @NonNull public class Geyser { - private static Api api; + private static GeyserApi api; /** * Returns the base api. * * @return the base api */ - public static Api api() { + public static GeyserApi api() { if (api == null) { throw new RuntimeException("Api has not been registered yet!"); } @@ -47,26 +47,6 @@ public class Geyser { return api; } - /** - * Returns the api of the given type. - * - * @param apiClass the api class - * @param the type - * @return the api of the given type - */ - @SuppressWarnings("unchecked") - public static T api(@NonNull Class apiClass) { - if (apiClass.isInstance(api)) { - return (T) api; - } - - if (api == null) { - throw new RuntimeException("Api has not been registered yet!"); - } else { - throw new RuntimeException("Api was not an instance of " + apiClass + "! Was " + api.getClass().getCanonicalName()); - } - } - /** * Registers the given api type. The api cannot be * registered if {@link #registered()} is true as @@ -74,7 +54,7 @@ public class Geyser { * * @param api the api */ - public static void set(@NonNull Api api) { + public static void set(@NonNull GeyserApi api) { if (Geyser.api != null) { throw new RuntimeException("Cannot redefine already registered api!"); } diff --git a/api/base/src/main/java/org/geysermc/api/Api.java b/api/base/src/main/java/org/geysermc/api/GeyserApi.java similarity index 66% rename from api/base/src/main/java/org/geysermc/api/Api.java rename to api/base/src/main/java/org/geysermc/api/GeyserApi.java index 30d5dc134..fec8cbb3c 100644 --- a/api/base/src/main/java/org/geysermc/api/Api.java +++ b/api/base/src/main/java/org/geysermc/api/GeyserApi.java @@ -27,7 +27,8 @@ package org.geysermc.api; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.api.session.Session; +import org.geysermc.api.geyser.GeyserExtensionApi; +import org.geysermc.api.session.Connection; import java.util.List; import java.util.UUID; @@ -35,17 +36,16 @@ import java.util.UUID; /** * The base API class. */ -public interface Api { - +public interface GeyserApi { /** - * Gets the session from the given - * UUID, if applicable. + * Gets the session from the given UUID, if applicable. The player must be logged in to the Java server + * for this to return a non-null value. * * @param uuid the UUID of the session * @return the session from the given UUID, if applicable */ @Nullable - Session sessionByUuid(@NonNull UUID uuid); + Connection connectionByUuid(@NonNull UUID uuid); /** * Gets the session from the given @@ -55,7 +55,7 @@ public interface Api { * @return the session from the given UUID, if applicable */ @Nullable - Session sessionByXuid(@NonNull String xuid); + Connection connectionByXuid(@NonNull String xuid); /** * Gets the session from the given @@ -65,7 +65,7 @@ public interface Api { * @return the session from the given name, if applicable */ @Nullable - Session sessionByName(@NonNull String name); + Connection connectionByName(@NonNull String name); /** * Gets all the online sessions. @@ -73,5 +73,28 @@ public interface Api { * @return all the online sessions */ @NonNull - List onlineSessions(); + List onlineConnections(); + + /** + * Returns this as the Geyser extension API, if the platform supports it. + * + * @return the extension API, if this platform supports it. + */ + default GeyserExtensionApi asExtensionApi() { + return null; + } + + /** + * @return the major API version. Bumped whenever a significant breaking change or feature addition is added. + */ + default int majorApiVersion() { + return 0; + } + + /** + * @return the minor API version. May be bumped for new API additions. + */ + default int minorApiVersion() { + return 0; + } } diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java b/api/base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java similarity index 90% rename from api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java rename to api/base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java index 16f6f5366..5c21fa1de 100644 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/session/GeyserSession.java +++ b/api/base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java @@ -23,12 +23,12 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.api.session; +package org.geysermc.api.geyser; -import org.geysermc.api.session.Session; +import org.geysermc.api.session.Connection; /** * Represents a player session used in Geyser. */ -public interface GeyserSession extends Session { +public interface GeyserConnection extends Connection { } diff --git a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java b/api/base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java similarity index 63% rename from api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java rename to api/base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java index 31981914d..2a1266d04 100644 --- a/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java +++ b/api/base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java @@ -23,23 +23,14 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.geyser.api; +package org.geysermc.api.geyser; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.api.Api; -import org.geysermc.api.Geyser; -import org.geysermc.api.session.Session; -import org.geysermc.geyser.api.session.GeyserSession; - -import java.util.List; -import java.util.UUID; +import org.geysermc.api.GeyserApi; /** * Represents the API used in Geyser. */ -public interface GeyserApi extends Api { - +public interface GeyserExtensionApi extends GeyserApi { /** * Shuts down the current Geyser instance. */ @@ -58,36 +49,8 @@ public interface GeyserApi extends Api { */ boolean productionEnvironment(); - /** - * {@inheritDoc} - */ @Override - @Nullable GeyserSession sessionByUuid(@NonNull UUID uuid); - - /** - * {@inheritDoc} - */ - @Override - @Nullable GeyserSession sessionByXuid(@NonNull String xuid); - - /** - * {@inheritDoc} - */ - @Override - @Nullable GeyserSession sessionByName(@NonNull String name); - - /** - * {@inheritDoc} - */ - @NonNull - List onlineSessions(); - - /** - * Gets the {@link GeyserApi}. - * - * @return the Geyser API - */ - static GeyserApi api() { - return Geyser.api(GeyserApi.class); + default GeyserExtensionApi asExtensionApi() { + return this; } } diff --git a/api/base/src/main/java/org/geysermc/api/geyser/package-info.java b/api/base/src/main/java/org/geysermc/api/geyser/package-info.java new file mode 100644 index 000000000..d36f70d6b --- /dev/null +++ b/api/base/src/main/java/org/geysermc/api/geyser/package-info.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2019-2021 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.api.geyser; \ No newline at end of file diff --git a/api/base/src/main/java/org/geysermc/api/session/Session.java b/api/base/src/main/java/org/geysermc/api/session/Connection.java similarity index 82% rename from api/base/src/main/java/org/geysermc/api/session/Session.java rename to api/base/src/main/java/org/geysermc/api/session/Connection.java index 7862f1e70..dc4fb4701 100644 --- a/api/base/src/main/java/org/geysermc/api/session/Session.java +++ b/api/base/src/main/java/org/geysermc/api/session/Connection.java @@ -30,29 +30,30 @@ import org.checkerframework.checker.nullness.qual.NonNull; import java.util.UUID; /** - * Represents a player session. + * Represents a player connection. */ @NonNull -public interface Session { - +public interface Connection { /** - * Gets the name of the session. + * Gets the name of the connection. * - * @return the name of the session + * @return the name of the connection */ String name(); /** - * Gets the {@link UUID} of the session. + * Gets the {@link UUID} of the connection. * - * @return the UUID of the session + * @return the UUID of the connection */ UUID uuid(); /** - * Gets the XUID of the session. + * Gets the XUID of the connection. * - * @return the XUID of the session + * @return the XUID of the connection */ String xuid(); + + } diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java index 5b137c61c..f0a05687c 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/command/GeyserBungeeCommandExecutor.java @@ -32,7 +32,7 @@ import net.md_5.bungee.api.plugin.TabExecutor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; @@ -50,7 +50,7 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor @Override public void execute(CommandSender sender, String[] args) { BungeeCommandSender commandSender = new BungeeCommandSender(sender); - GeyserSessionImpl session = this.commandExecutor.getGeyserSession(commandSender); + GeyserSession session = this.commandExecutor.getGeyserSession(commandSender); if (args.length > 0) { GeyserCommand command = this.commandExecutor.getCommand(args[0]); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java index b6386dfee..af92091e5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/command/GeyserSpigotCommandExecutor.java @@ -32,7 +32,7 @@ import org.bukkit.command.TabExecutor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; @@ -48,7 +48,7 @@ public class GeyserSpigotCommandExecutor extends CommandExecutor implements TabE @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { SpigotCommandSender commandSender = new SpigotCommandSender(sender); - GeyserSessionImpl session = getGeyserSession(commandSender); + GeyserSession session = getGeyserSession(commandSender); if (args.length > 0) { GeyserCommand geyserCommand = getCommand(args[0]); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java index a77afec09..4d504bcf5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserPistonListener.java @@ -41,7 +41,7 @@ import org.bukkit.event.block.BlockPistonEvent; import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; @@ -88,12 +88,12 @@ public class GeyserPistonListener implements Listener { Object2IntMap attachedBlocks = new Object2IntOpenHashMap<>(); boolean blocksFilled = false; - for (Map.Entry entry : geyser.getSessionManager().getSessions().entrySet()) { + for (Map.Entry entry : geyser.getSessionManager().getSessions().entrySet()) { Player player = Bukkit.getPlayer(entry.getKey()); if (player == null || !player.getWorld().equals(world)) { continue; } - GeyserSessionImpl session = entry.getValue(); + GeyserSession session = entry.getValue(); int dX = Math.abs(location.getBlockX() - player.getLocation().getBlockX()) >> 4; int dZ = Math.abs(location.getBlockZ() - player.getLocation().getBlockZ()) >> 4; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java index 68c6fc413..b6aea9a37 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigot1_11CraftingListener.java @@ -48,7 +48,7 @@ import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.util.InventoryUtils; @@ -79,8 +79,8 @@ public class GeyserSpigot1_11CraftingListener implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { - GeyserSessionImpl session = null; - for (GeyserSessionImpl otherSession : geyser.getSessionManager().getSessions().values()) { + GeyserSession session = null; + for (GeyserSession otherSession : geyser.getSessionManager().getSessions().values()) { if (otherSession.name().equals(event.getPlayer().getName())) { session = otherSession; break; @@ -93,7 +93,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { sendServerRecipes(session); } - public void sendServerRecipes(GeyserSessionImpl session) { + public void sendServerRecipes(GeyserSession session) { int netId = InventoryUtils.LAST_RECIPE_NET_ID; CraftingDataPacket craftingDataPacket = new CraftingDataPacket(); @@ -161,7 +161,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener { } @SuppressWarnings("deprecation") - private Pair translateToBedrock(GeyserSessionImpl session, org.bukkit.inventory.ItemStack itemStack) { + private Pair translateToBedrock(GeyserSession session, org.bukkit.inventory.ItemStack itemStack) { if (itemStack != null && itemStack.getData() != null) { if (itemStack.getType().getId() == 0) { return new Pair<>(null, ItemData.AIR); diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java index 8f0d6e2db..a8fcee3e5 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/GeyserSpigotBlockPlaceListener.java @@ -33,7 +33,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.platform.spigot.world.manager.GeyserSpigotWorldManager; @@ -45,7 +45,7 @@ public class GeyserSpigotBlockPlaceListener implements Listener { @EventHandler public void place(final BlockPlaceEvent event) { - GeyserSessionImpl session = geyser.sessionByUuid(event.getPlayer().getUniqueId()); + GeyserSession session = geyser.connectionByUuid(event.getPlayer().getUniqueId()); if (session == null) { return; } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java index 12f197f24..ea1fadd0e 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12NativeWorldManager.java @@ -30,7 +30,7 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.storage.BlockSto import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; @@ -48,7 +48,7 @@ public class GeyserSpigot1_12NativeWorldManager extends GeyserSpigot1_12WorldMan } @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { return BlockStateValues.JAVA_AIR_ID; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java index b1072b847..f12968b1f 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigot1_12WorldManager.java @@ -36,7 +36,7 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.List; @@ -66,7 +66,7 @@ public class GeyserSpigot1_12WorldManager extends GeyserSpigotWorldManager { } @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { return BlockStateValues.JAVA_AIR_ID; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java index f3071ecdd..1aacb73e7 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotFallbackWorldManager.java @@ -26,11 +26,11 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; /** - * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSessionImpl, int, int, int)} + * Should only be used when we know {@link GeyserSpigotWorldManager#getBlockAt(GeyserSession, int, int, int)} * cannot be accurate. Typically, this is when ViaVersion is not installed but a client still manages to connect. * If this occurs to you somehow, please let us know!! */ @@ -40,7 +40,7 @@ public class GeyserSpigotFallbackWorldManager extends GeyserSpigotWorldManager { } @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { return BlockStateValues.JAVA_AIR_ID; } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java index 242d7ea23..caeb257f7 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotLegacyNativeWorldManager.java @@ -33,7 +33,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.platform.spigot.GeyserSpigotPlugin; import java.util.List; @@ -66,7 +66,7 @@ public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorl } @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { int nativeBlockId = super.getBlockAt(session, x, y, z); return oldToNewBlockId.getOrDefault(nativeBlockId, nativeBlockId); } diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java index 0c3e21c01..b1032671a 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.platform.spigot.world.manager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.adapters.spigot.SpigotAdapters; import org.geysermc.geyser.adapters.spigot.SpigotWorldAdapter; @@ -42,7 +42,7 @@ public class GeyserSpigotNativeWorldManager extends GeyserSpigotWorldManager { } @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { Player player = Bukkit.getPlayer(session.getPlayerEntity().getUsername()); if (player == null) { return BlockStateValues.JAVA_AIR_ID; diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 35eb292a6..8972b0ac6 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -39,7 +39,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.plugin.Plugin; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.GeyserWorldManager; import org.geysermc.geyser.level.block.BlockStateValues; @@ -66,7 +66,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { Player bukkitPlayer; if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) { return BlockStateValues.JAVA_AIR_ID; @@ -90,7 +90,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad) { + public NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad) { // Run as a task to prevent async issues Runnable lecternInfoGet = () -> { Player bukkitPlayer; @@ -158,7 +158,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { return true; } - public Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule) { + public Boolean getGameRuleBool(GeyserSession session, GameRule gameRule) { String value = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getGameRuleValue(gameRule.getJavaID()); if (!value.isEmpty()) { return Boolean.parseBoolean(value); @@ -167,7 +167,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule) { + public int getGameRuleInt(GeyserSession session, GameRule gameRule) { String value = Bukkit.getPlayer(session.getPlayerEntity().getUsername()).getWorld().getGameRuleValue(gameRule.getJavaID()); if (!value.isEmpty()) { return Integer.parseInt(value); @@ -176,7 +176,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager { } @Override - public boolean hasPermission(GeyserSessionImpl session, String permission) { + public boolean hasPermission(GeyserSession session, String permission) { return Bukkit.getPlayer(session.getPlayerEntity().getUsername()).hasPermission(permission); } diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java index 6fbd3e219..5b8496680 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/command/GeyserSpongeCommandExecutor.java @@ -30,7 +30,7 @@ import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import org.spongepowered.api.command.CommandCallable; import org.spongepowered.api.command.CommandResult; @@ -54,7 +54,7 @@ public class GeyserSpongeCommandExecutor extends CommandExecutor implements Comm @Override public CommandResult process(CommandSource source, String arguments) { CommandSender commandSender = new SpongeCommandSender(source); - GeyserSessionImpl session = getGeyserSession(commandSender); + GeyserSession session = getGeyserSession(commandSender); String[] args = arguments.split(" "); if (args.length > 0) { diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java index e0d957d4f..56d211986 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/gui/GeyserStandaloneGUI.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.platform.standalone.gui; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.platform.standalone.GeyserStandaloneLogger; import org.geysermc.geyser.platform.standalone.command.GeyserCommandManager; @@ -306,7 +306,7 @@ public class GeyserStandaloneGUI { // Update player table playerTableModel.getDataVector().removeAllElements(); - for (GeyserSessionImpl player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { + for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { Vector row = new Vector<>(); row.add(player.getSocketAddress().getHostName()); row.add(player.getPlayerEntity().getUsername()); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java index ecc9641c9..1034d6062 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/command/GeyserVelocityCommandExecutor.java @@ -31,7 +31,7 @@ import org.geysermc.geyser.command.CommandExecutor; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.Arrays; @@ -47,7 +47,7 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si @Override public void execute(Invocation invocation) { CommandSender sender = new VelocityCommandSender(invocation.source()); - GeyserSessionImpl session = getGeyserSession(sender); + GeyserSession session = getGeyserSession(sender); if (invocation.arguments().length > 0) { GeyserCommand command = getCommand(invocation.arguments()[0]); diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index d2d493ecf..8a1103834 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -73,11 +73,11 @@ public class GeyserConnector { } public GeyserSession getPlayerByXuid(String xuid) { - return new GeyserSession(GeyserImpl.getInstance().sessionByXuid(xuid)); + return new GeyserSession(GeyserImpl.getInstance().connectionByXuid(xuid)); } public GeyserSession getPlayerByUuid(UUID uuid) { - return new GeyserSession(GeyserImpl.getInstance().sessionByUuid(uuid)); + return new GeyserSession(GeyserImpl.getInstance().connectionByUuid(uuid)); } public boolean isProductionEnvironment() { diff --git a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 27c0ce5e0..05f9de722 100644 --- a/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -28,7 +28,6 @@ package org.geysermc.connector.network.session; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.protocol.bedrock.BedrockPacket; import org.geysermc.connector.network.session.auth.AuthData; -import org.geysermc.geyser.session.GeyserSessionImpl; /** * Deprecated, legacy code. Serves as a wrapper around @@ -38,9 +37,9 @@ import org.geysermc.geyser.session.GeyserSessionImpl; */ @Deprecated public class GeyserSession { - private final GeyserSessionImpl handle; + private final org.geysermc.geyser.session.GeyserSession handle; - public GeyserSession(GeyserSessionImpl handle) { + public GeyserSession(org.geysermc.geyser.session.GeyserSession handle) { this.handle = handle; } diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index a12a1c6d0..2e30a123a 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -41,35 +41,33 @@ import lombok.Getter; import lombok.Setter; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.common.PlatformType; import org.geysermc.api.Geyser; -import org.geysermc.geyser.api.GeyserApi; -import org.geysermc.geyser.api.session.GeyserSession; -import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.session.auth.AuthType; -import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.pack.ResourcePack; -import org.geysermc.geyser.session.SessionManager; -import org.geysermc.geyser.text.GeyserLocale; -import org.geysermc.geyser.text.MinecraftLocale; -import org.geysermc.geyser.util.Metrics; -import org.geysermc.geyser.network.ConnectorServerEventHandler; -import org.geysermc.geyser.session.GeyserSessionImpl; -import org.geysermc.geyser.translator.text.MessageTranslator; -import org.geysermc.geyser.translator.inventory.item.ItemTranslator; -import org.geysermc.geyser.level.WorldManager; -import org.geysermc.geyser.registry.BlockRegistries; -import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.scoreboard.ScoreboardUpdater; -import org.geysermc.geyser.skin.FloodgateSkinUploader; -import org.geysermc.geyser.util.*; +import org.geysermc.api.geyser.GeyserExtensionApi; +import org.geysermc.common.PlatformType; import org.geysermc.floodgate.crypto.AesCipher; import org.geysermc.floodgate.crypto.AesKeyProducer; import org.geysermc.floodgate.crypto.Base64Topping; import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.time.TimeSyncer; +import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.configuration.GeyserConfiguration; +import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.level.WorldManager; +import org.geysermc.geyser.network.ConnectorServerEventHandler; +import org.geysermc.geyser.pack.ResourcePack; +import org.geysermc.geyser.registry.BlockRegistries; +import org.geysermc.geyser.registry.Registries; +import org.geysermc.geyser.scoreboard.ScoreboardUpdater; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.session.SessionManager; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.skin.FloodgateSkinUploader; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.util.*; import javax.naming.directory.Attribute; import javax.naming.directory.InitialDirContext; @@ -78,18 +76,14 @@ import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.security.Key; import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; +import java.util.*; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.regex.Matcher; import java.util.regex.Pattern; @Getter -public class GeyserImpl implements GeyserApi { +public class GeyserImpl implements GeyserExtensionApi { public static final ObjectMapper JSON_MAPPER = new ObjectMapper() .enable(JsonParser.Feature.IGNORE_UNDEFINED) .enable(JsonParser.Feature.ALLOW_COMMENTS) @@ -297,7 +291,7 @@ public class GeyserImpl implements GeyserApi { metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION)); metrics.addCustomChart(new Metrics.AdvancedPie("playerPlatform", () -> { Map valueMap = new HashMap<>(); - for (GeyserSessionImpl session : sessionManager.getAllSessions()) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session == null) continue; if (session.getClientData() == null) continue; String os = session.getClientData().getDeviceOs().toString(); @@ -311,7 +305,7 @@ public class GeyserImpl implements GeyserApi { })); metrics.addCustomChart(new Metrics.AdvancedPie("playerVersion", () -> { Map valueMap = new HashMap<>(); - for (GeyserSessionImpl session : sessionManager.getAllSessions()) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session == null) continue; if (session.getClientData() == null) continue; String version = session.getClientData().getGameVersion(); @@ -403,8 +397,8 @@ public class GeyserImpl implements GeyserApi { } @Override - public @Nullable GeyserSessionImpl sessionByName(@NonNull String name) { - for (GeyserSessionImpl session : sessionManager.getAllSessions()) { + public @Nullable GeyserSession connectionByName(@NonNull String name) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session.name().equals(name) || session.getProtocol().getProfile().getName().equals(name)) { return session; } @@ -414,18 +408,18 @@ public class GeyserImpl implements GeyserApi { } @Override - public @NonNull List onlineSessions() { + public @NonNull List onlineConnections() { return this.sessionManager.getAllSessions(); } @Override - public @Nullable GeyserSessionImpl sessionByUuid(@NonNull UUID uuid) { + public @Nullable GeyserSession connectionByUuid(@NonNull UUID uuid) { return this.sessionManager.getSessions().get(uuid); } @Override - public @Nullable GeyserSessionImpl sessionByXuid(@NonNull String xuid) { - for (GeyserSessionImpl session : sessionManager.getAllSessions()) { + public @Nullable GeyserSession connectionByXuid(@NonNull String xuid) { + for (GeyserSession session : sessionManager.getAllSessions()) { if (session.xuid().equals(xuid)) { return session; } diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java index c30a1df56..a2f3441f4 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.command; import lombok.AllArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nullable; import java.util.ArrayList; @@ -48,12 +48,12 @@ public class CommandExecutor { } @Nullable - public GeyserSessionImpl getGeyserSession(CommandSender sender) { + public GeyserSession getGeyserSession(CommandSender sender) { if (sender.isConsole()) { return null; } - for (GeyserSessionImpl session : geyser.getSessionManager().getSessions().values()) { + for (GeyserSession session : geyser.getSessionManager().getSessions().values()) { if (sender.name().equals(session.getPlayerEntity().getUsername())) { return session; } diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java index 791ddd548..19b521ed6 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java @@ -30,7 +30,7 @@ import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.defaults.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.*; @@ -93,8 +93,8 @@ public abstract class CommandManager { return; } - if (sender instanceof GeyserSessionImpl) { - cmd.execute((GeyserSessionImpl) sender, sender, args); + if (sender instanceof GeyserSession) { + cmd.execute((GeyserSession) sender, sender, args); } else { if (!cmd.isBedrockOnly()) { cmd.execute(null, sender, args); diff --git a/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java index 593c17fe8..6971ad44d 100644 --- a/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/GeyserCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nullable; import java.util.ArrayList; @@ -49,7 +49,7 @@ public abstract class GeyserCommand { @Setter private List aliases = new ArrayList<>(); - public abstract void execute(@Nullable GeyserSessionImpl session, CommandSender sender, String[] args); + public abstract void execute(@Nullable GeyserSession session, CommandSender sender, String[] args); /** * If false, hides the command from being shown on the Geyser Standalone GUI. diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java index e9da5a2a0..41bb8e6cd 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/AdvancementsCommand.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class AdvancementsCommand extends GeyserCommand { public AdvancementsCommand(String name, String description, String permission) { @@ -35,7 +35,7 @@ public class AdvancementsCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { if (session != null) { session.getAdvancementsCache().buildAndShowMenuForm(); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java index 24ff41a60..1b69f48fb 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/DumpCommand.java @@ -36,7 +36,7 @@ import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.dump.DumpInfo; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.util.WebUtils; @@ -58,7 +58,7 @@ public class DumpCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { // Only allow the console to create dumps on Geyser Standalone if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index 8ca115007..4d4a21319 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -29,7 +29,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -53,7 +53,7 @@ public class HelpCommand extends GeyserCommand { * @param args Not used. */ @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { int page = 1; int maxPage = 1; String header = GeyserLocale.getPlayerLocaleString("geyser.commands.help.header", sender.getLocale(), page, maxPage); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java index a5a5df000..3ff648570 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ListCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.stream.Collectors; @@ -44,10 +44,10 @@ public class ListCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { String message = GeyserLocale.getPlayerLocaleString("geyser.commands.list.message", sender.getLocale(), geyser.getSessionManager().size(), - geyser.getSessionManager().getAllSessions().stream().map(GeyserSessionImpl::name).collect(Collectors.joining(" "))); + geyser.getSessionManager().getAllSessions().stream().map(GeyserSession::name).collect(Collectors.joining(" "))); sender.sendMessage(message); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java index 24a8c8f22..934cd8c87 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/OffhandCommand.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.BlockUtils; public class OffhandCommand extends GeyserCommand { @@ -41,7 +41,7 @@ public class OffhandCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { if (session == null) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java index 9ea44577b..1a72e1734 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/ReloadCommand.java @@ -29,7 +29,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; public class ReloadCommand extends GeyserCommand { @@ -42,7 +42,7 @@ public class ReloadCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java index fd9460255..349f7288b 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/SettingsCommand.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.command.defaults; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.SettingsUtils; public class SettingsCommand extends GeyserCommand { @@ -37,7 +37,7 @@ public class SettingsCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { if (session != null) { session.sendForm(SettingsUtils.buildForm(session)); } diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java index 39cbfce7e..c570770b7 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StatisticsCommand.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCl import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class StatisticsCommand extends GeyserCommand { @@ -39,7 +39,7 @@ public class StatisticsCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { if (session == null) return; session.setWaitingForStatistics(true); diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java index 6ef26f121..6b74f9c8b 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/StopCommand.java @@ -29,7 +29,7 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -46,7 +46,7 @@ public class StopCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { if (!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale())); return; diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index 164ddea92..706395d5d 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.util.WebUtils; @@ -54,7 +54,7 @@ public class VersionCommand extends GeyserCommand { } @Override - public void execute(GeyserSessionImpl session, CommandSender sender, String[] args) { + public void execute(GeyserSession session, CommandSender sender, String[] args) { String bedrockVersions; List supportedCodecs = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS; if (supportedCodecs.size() > 1) { diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index b4c1f7f6b..5a77b84fb 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -39,7 +39,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.text.AsteriskSerializer; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.network.MinecraftProtocol; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.util.WebUtils; import org.geysermc.floodgate.util.DeviceOs; @@ -113,7 +113,7 @@ public class DumpInfo { } this.userPlatforms = new Object2IntOpenHashMap<>(); - for (GeyserSessionImpl session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) { + for (GeyserSession session : GeyserImpl.getInstance().getSessionManager().getAllSessions()) { DeviceOs device = session.getClientData().getDeviceOs(); userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java index 132194711..b51f83f2c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java +++ b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java @@ -36,7 +36,7 @@ import org.geysermc.geyser.entity.type.living.animal.horse.HorseEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity; import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.EnumSet; @@ -62,7 +62,7 @@ public class InteractiveTagManager { * @param session the Bedrock client session * @param interactEntity the entity that the client is currently facing. */ - public static void updateTag(GeyserSessionImpl session, Entity interactEntity) { + public static void updateTag(GeyserSession session, Entity interactEntity) { ItemMapping mapping = session.getPlayerInventory().getItemInHand().getMapping(session); String javaIdentifierStripped = mapping.getJavaIdentifier().replace("minecraft:", ""); EntityType entityType = interactEntity.getDefinition().entityType(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java index 13a3140f2..dff1617f9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/BaseEntityFactory.java @@ -28,12 +28,12 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @FunctionalInterface public interface BaseEntityFactory extends EntityFactory { - T create(GeyserSessionImpl session, long javaId, long bedrockId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); + T create(GeyserSession session, long javaId, long bedrockId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java index 1c8800172..40a93c08b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/ExperienceOrbEntityFactory.java @@ -27,10 +27,10 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.ExpOrbEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; @FunctionalInterface public interface ExperienceOrbEntityFactory extends EntityFactory { - ExpOrbEntity create(GeyserSessionImpl session, int amount, long entityId, long geyserId, Vector3f position); + ExpOrbEntity create(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java index 2d5ff63b3..2990b0ac5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/PaintingEntityFactory.java @@ -27,12 +27,12 @@ package org.geysermc.geyser.entity.factory; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.PaintingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.PaintingType; import java.util.UUID; public interface PaintingEntityFactory extends EntityFactory { - PaintingEntity create(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction); + PaintingEntity create(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java index c8fc72eb2..b80db2570 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java @@ -30,13 +30,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractArrowEntity extends Entity { - public AbstractArrowEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Set the correct texture if using the resource pack diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java index a9c6bf11a..6063c81f9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java @@ -32,14 +32,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.Registries; import java.util.UUID; public class AreaEffectCloudEntity extends Entity { - public AreaEffectCloudEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AreaEffectCloudEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java index 85113ba2c..ac1b3fcbd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -65,7 +65,7 @@ public class BoatEntity extends Entity { // Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it private final float ROWING_SPEED = 0.05f; - public BoatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Initial rotation is incorrect super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); @@ -154,7 +154,7 @@ public class BoatEntity extends Entity { } } - private void updateLeftPaddle(GeyserSessionImpl session, Entity rower) { + private void updateLeftPaddle(GeyserSession session, Entity rower) { if (isPaddlingLeft) { paddleTimeLeft += ROWING_SPEED; sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_LEFT, paddleTimeLeft); @@ -167,7 +167,7 @@ public class BoatEntity extends Entity { } } - private void updateRightPaddle(GeyserSessionImpl session, Entity rower) { + private void updateRightPaddle(GeyserSession session, Entity rower) { if (isPaddlingRight) { paddleTimeRight += ROWING_SPEED; sendAnimationPacket(session, rower, AnimatePacket.Action.ROW_RIGHT, paddleTimeRight); @@ -180,7 +180,7 @@ public class BoatEntity extends Entity { } } - private void sendAnimationPacket(GeyserSessionImpl session, Entity rower, AnimatePacket.Action action, float rowTime) { + private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) { AnimatePacket packet = new AnimatePacket(); packet.setRuntimeEntityId(rower.getGeyserId()); packet.setAction(action); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java index 0b755f114..1764c721e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { - public CommandBlockMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CommandBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java index 5e6a15198..ec00c30be 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -43,7 +43,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { public int customBlockOffset = 0; public boolean showCustomBlock = false; - public DefaultBlockMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public DefaultBlockMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java index 421043ff6..aa907b7c6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java @@ -32,14 +32,14 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; import java.util.UUID; public class EnderCrystalEntity extends Entity { - public EnderCrystalEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EnderCrystalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index 7935566e8..3b01c428f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -45,7 +45,7 @@ import lombok.Setter; import net.kyori.adventure.text.Component; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.GeyserDirtyMetadata; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.util.MathUtils; @@ -55,7 +55,7 @@ import java.util.UUID; @Getter @Setter public class Entity { - protected final GeyserSessionImpl session; + protected final GeyserSession session; protected long entityId; protected final long geyserId; @@ -108,7 +108,7 @@ public class Entity { @Setter(AccessLevel.PROTECTED) // For players private boolean flagsDirty = false; - public Entity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public Entity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { this.session = session; this.entityId = entityId; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java index 1bd059e95..25135d0b5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class ExpOrbEntity extends Entity { private final int amount; - public ExpOrbEntity(GeyserSessionImpl session, int amount, long entityId, long geyserId, Vector3f position) { + public ExpOrbEntity(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position) { super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); this.amount = amount; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java index f6106f3b0..346861f96 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java @@ -30,14 +30,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class FallingBlockEntity extends Entity { private final int javaId; - public FallingBlockEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { + public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); this.javaId = javaId; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java index b6b383dcb..075178b55 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java @@ -38,7 +38,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.FireworkColor; import org.geysermc.geyser.util.MathUtils; import org.geysermc.floodgate.util.DeviceOs; @@ -50,7 +50,7 @@ import java.util.UUID; public class FireworkEntity extends Entity { - public FireworkEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FireworkEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java index bac3b9bb8..b5774bd78 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FishingHookEntity.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.translator.collision.BlockCollision; import org.geysermc.geyser.level.block.BlockStateValues; @@ -56,7 +56,7 @@ public class FishingHookEntity extends ThrowableEntity { private final BoundingBox boundingBox; - public FishingHookEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { + public FishingHookEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) { super(session, entityId, geyserId, uuid, EntityDefinitions.FISHING_BOBBER, position, motion, yaw, pitch, 0f); this.boundingBox = new BoundingBox(0.125, 0.125, 0.125, 0.25, 0.25, 0.25); @@ -140,7 +140,7 @@ public class FishingHookEntity extends ThrowableEntity { } } - private void sendSplashSound(GeyserSessionImpl session) { + private void sendSplashSound(GeyserSession session) { if (!getFlag(EntityFlag.SILENT)) { float volume = (float) (0.2f * Math.sqrt(0.2 * (motion.getX() * motion.getX() + motion.getZ() * motion.getZ()) + motion.getY() * motion.getY())); if (volume > 1) { diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java index b9134e7e5..ab34cb751 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; @@ -37,7 +37,7 @@ import java.util.UUID; public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { private boolean hasFuel = false; - public FurnaceMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FurnaceMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java index f3732a83d..dd98f9aba 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -46,7 +46,7 @@ public class ItemEntity extends ThrowableEntity { private int waterLevel = -1; - public ItemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java index 53094bdf3..0f73de739 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java @@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -77,7 +77,7 @@ public class ItemFrameEntity extends Entity { */ private boolean changed = true; - public ItemFrameEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) { + public ItemFrameEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, Direction direction) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 0f); NbtMapBuilder blockBuilder = NbtMap.builder() @@ -211,10 +211,10 @@ public class ItemFrameEntity extends Entity { /** * Finds the Java entity ID of an item frame from its Bedrock position. * @param position position of item frame in Bedrock. - * @param session GeyserSession. + * @param session GeyserConnection. * @return Java entity ID or -1 if not found. */ - public static ItemFrameEntity getItemFrameEntity(GeyserSessionImpl session, Vector3i position) { + public static ItemFrameEntity getItemFrameEntity(GeyserSession session, Vector3i position) { return session.getItemFrameCache().get(position); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java index 8d45d84ae..49548ec2a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -39,7 +39,7 @@ public class ItemedFireballEntity extends ThrowableEntity { */ protected int futureTicks = 3; - public ItemedFireballEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ItemedFireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw); float magnitude = motion.length(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java index 3443814bf..63e964a55 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class LeashKnotEntity extends Entity { - public LeashKnotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LeashKnotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Position is incorrect by default super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java index 8830117e6..1f5af0492 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; public class LightningEntity extends Entity { - public LightningEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LightningEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index 63d481182..678741424 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -47,7 +47,7 @@ import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.util.AttributeUtils; import org.geysermc.geyser.util.ChunkUtils; @@ -79,7 +79,7 @@ public class LivingEntity extends Entity { */ private boolean isMaxFrozenState = false; - public LivingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @@ -168,7 +168,7 @@ public class LivingEntity extends Entity { return new AttributeData(GeyserAttributeType.HEALTH.getBedrockIdentifier(), 0f, this.maxHealth, (float) Math.ceil(this.health), this.maxHealth); } - public void updateArmor(GeyserSessionImpl session) { + public void updateArmor(GeyserSession session) { if (!valid) return; ItemData helmet = this.helmet; @@ -194,7 +194,7 @@ public class LivingEntity extends Entity { session.sendUpstreamPacket(armorEquipmentPacket); } - public void updateMainHand(GeyserSessionImpl session) { + public void updateMainHand(GeyserSession session) { if (!valid) return; MobEquipmentPacket handPacket = new MobEquipmentPacket(); @@ -207,7 +207,7 @@ public class LivingEntity extends Entity { session.sendUpstreamPacket(handPacket); } - public void updateOffHand(GeyserSessionImpl session) { + public void updateOffHand(GeyserSession session) { if (!valid) return; MobEquipmentPacket offHandPacket = new MobEquipmentPacket(); @@ -226,7 +226,7 @@ public class LivingEntity extends Entity { * * @param attributes the Java list of attributes sent from the server */ - public void updateBedrockAttributes(GeyserSessionImpl session, List attributes) { + public void updateBedrockAttributes(GeyserSession session, List attributes) { if (!valid) return; List newAttributes = new ArrayList<>(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java index d71895466..ffb5e4018 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java @@ -30,13 +30,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class MinecartEntity extends Entity { - public MinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java index 32c0da71b..e97bb7090 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.PaintingType; import java.util.UUID; @@ -38,7 +38,7 @@ public class PaintingEntity extends Entity { private final PaintingType paintingName; private final int direction; - public PaintingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) { + public PaintingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, PaintingType paintingName, int direction) { super(session, entityId, geyserId, uuid, EntityDefinitions.PAINTING, position, Vector3f.ZERO, 0f, 0f, 0f); this.paintingName = paintingName; this.direction = direction; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java index 2ca179be0..2cd4cf3f6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity { - public SpawnerMinecartEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpawnerMinecartEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java index 31b06d4c4..e7edd32d5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class TNTEntity extends Entity implements Tickable { private int currentTick; - public TNTEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TNTEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java index 5b0ff57fb..67aa09794 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; @@ -44,7 +44,7 @@ public class ThrowableEntity extends Entity implements Tickable { protected Vector3f lastJavaPosition; - public ThrowableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrowableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.lastJavaPosition = position; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java index ae2de746c..7abffd0bf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -42,7 +42,7 @@ public class ThrowableItemEntity extends ThrowableEntity { private int age; private boolean invisible; - public ThrowableItemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrowableItemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.INVISIBLE, true); invisible = false; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java index 19d2b09b4..c4cd5d54a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.registry.type.ItemMapping; @@ -44,7 +44,7 @@ import java.util.UUID; public class ThrownPotionEntity extends ThrowableItemEntity { private static final EnumSet NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD); - public ThrownPotionEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrownPotionEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java index cb3e2471d..a60c0ab33 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.item.TippedArrowPotion; import java.util.UUID; @@ -39,7 +39,7 @@ import java.util.UUID; */ public class TippedArrowEntity extends AbstractArrowEntity { - public TippedArrowEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TippedArrowEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java index 5e1151db6..65591fb50 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class TridentEntity extends AbstractArrowEntity { - public TridentEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TridentEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java index fb40862cc..fbed041fe 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class WitherSkullEntity extends ItemedFireballEntity { private boolean isCharged; - public WitherSkullEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WitherSkullEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.futureTicks = 1; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java index 1a97bfb12..8fedce1e7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractFishEntity extends WaterEntity { - public AbstractFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.CAN_SWIM, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java index 6fb687f47..b250f3e8e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AgeableEntity extends CreatureEntity { - public AgeableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AgeableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java index 0c15fa95c..693a0cd46 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AmbientEntity extends MobEntity { - public AmbientEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AmbientEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java index 7f5ccd306..fb459bf54 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java @@ -38,7 +38,7 @@ import net.kyori.adventure.text.Component; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; import java.util.UUID; @@ -78,7 +78,7 @@ public class ArmorStandEntity extends LivingEntity { */ private boolean positionUpdateRequired = false; - public ArmorStandEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ArmorStandEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java index 07853429a..0a72a431e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class BatEntity extends AmbientEntity { - public BatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java index cef93a7a6..b5e7557da 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class CreatureEntity extends MobEntity { - public CreatureEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CreatureEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java index 3a6581d2f..91f839bc3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class FlyingEntity extends MobEntity { - public FlyingEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FlyingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java index dc49ec765..b5950b7bc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java @@ -27,12 +27,12 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GlowSquidEntity extends SquidEntity { - public GlowSquidEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GlowSquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java index a6cec0788..eb94e1406 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GolemEntity extends CreatureEntity { - public GolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java index 9a28d7032..f86392ed3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java @@ -29,13 +29,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class IronGolemEntity extends GolemEntity { - public IronGolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public IronGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that we should show cracks through a resource pack setFlag(EntityFlag.BRIBED, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java index 1610ee6e5..03cf9f3dc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class MagmaCubeEntity extends SlimeEntity { - public MagmaCubeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MagmaCubeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java index 0a06f67c6..e82b813d7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -43,7 +43,7 @@ public class MobEntity extends LivingEntity { @Getter private long leashHolderBedrockId; - public MobEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MobEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java index 5d9a4604c..100ed764d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SlimeEntity extends MobEntity { - public SlimeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SlimeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java index c8bf1d67a..1d8375529 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SnowGolemEntity extends GolemEntity { - public SnowGolemEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SnowGolemEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java index ada353196..b0e2fcb9e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import java.util.UUID; @@ -41,7 +41,7 @@ public class SquidEntity extends WaterEntity implements Tickable { private boolean inWater; - public SquidEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SquidEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java index c1940d043..acacd1f52 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class WaterEntity extends CreatureEntity { - public WaterEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WaterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java index 01e3b7a80..c7c15b288 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AgeableEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class AnimalEntity extends AgeableEntity { - public AnimalEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AnimalEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java index d8026d378..4dfa5fa8d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java @@ -31,13 +31,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class AxolotlEntity extends AnimalEntity { - public AxolotlEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AxolotlEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java index de761167d..7f9ec4255 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java @@ -33,14 +33,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class BeeEntity extends AnimalEntity { - public BeeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BeeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java index 051c53eae..506714dbc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class ChickenEntity extends AnimalEntity { - public ChickenEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChickenEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java index cf7e83108..127a70a0f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class FoxEntity extends AnimalEntity { - public FoxEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FoxEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java index a0701503f..708a95134 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -41,7 +41,7 @@ public class GoatEntity extends AnimalEntity { @Getter private boolean isScreamer; - public GoatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GoatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java index 9456361ee..ed0feed97 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.util.DimensionUtils; @@ -38,7 +38,7 @@ import java.util.UUID; public class HoglinEntity extends AnimalEntity { private boolean isImmuneToZombification; - public HoglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public HoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java index ffd7c138b..15473c8ac 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class MooshroomEntity extends AnimalEntity { - public MooshroomEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MooshroomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java index a769324c5..5244e3538 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class OcelotEntity extends AnimalEntity { - public OcelotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public OcelotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java index 74a4b85c0..7548ccef1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -42,7 +42,7 @@ public class PandaEntity extends AnimalEntity { private int mainGene; private int hiddenGene; - public PandaEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PandaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java index 000ace4b3..0be4c78f1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class PigEntity extends AnimalEntity { - public PigEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PigEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java index bf4991119..727804dbc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class PolarBearEntity extends AnimalEntity { - public PolarBearEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PolarBearEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java index 39fecff46..66853babf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class PufferFishEntity extends AbstractFishEntity { - public PufferFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PufferFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java index 0db826ecb..a1d80ac72 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class RabbitEntity extends AnimalEntity { - public RabbitEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public RabbitEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java index a494df017..757c5b574 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SheepEntity extends AnimalEntity { - public SheepEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SheepEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java index db4a44ede..d684fba06 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java @@ -30,7 +30,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -39,7 +39,7 @@ public class StriderEntity extends AnimalEntity { private boolean isCold = false; - public StriderEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public StriderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.FIRE_IMMUNE, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java index 08a204804..b883c91a9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import it.unimi.dsi.fastutil.ints.IntList; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.List; import java.util.UUID; @@ -48,7 +48,7 @@ public class TropicalFishEntity extends AbstractFishEntity { private static final List VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish"); private static final List COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black"); - public TropicalFishEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TropicalFishEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java index 8a70f9605..e892d7d5e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class TurtleEntity extends AnimalEntity { - public TurtleEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TurtleEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java index 6a7391461..7d0a3cf9a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; @@ -51,7 +51,7 @@ public class AbstractHorseEntity extends AnimalEntity { private static final Set DONKEY_AND_HORSE_FOODS = ImmutableSet.of("golden_apple", "enchanted_golden_apple", "golden_carrot", "sugar", "apple", "wheat", "hay_block"); - public AbstractHorseEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Specifies the size of the entity's inventory. Required to place slots in the entity. diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java index 5389d0236..ccf30dbc8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ChestedHorseEntity extends AbstractHorseEntity { - public ChestedHorseEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChestedHorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java index 77f25bc8a..31b5b7890 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class HorseEntity extends AbstractHorseEntity { - public HorseEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public HorseEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java index 7883a564d..c18778c81 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java @@ -31,14 +31,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class LlamaEntity extends ChestedHorseEntity { - public LlamaEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityData.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java index 399ee529b..770d30a05 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class TraderLlamaEntity extends LlamaEntity { - public TraderLlamaEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TraderLlamaEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java index 050c066d8..5538621d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; @@ -41,7 +41,7 @@ public class CatEntity extends TameableEntity { private byte collarColor; - public CatEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CatEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java index c291dbbe8..05f0a6ad5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal.tameable; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class ParrotEntity extends TameableEntity { - public ParrotEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ParrotEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java index 1a00a4803..d12839e92 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java @@ -34,7 +34,7 @@ import lombok.Getter; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; import java.util.UUID; @@ -46,7 +46,7 @@ public class TameableEntity extends AnimalEntity { @Getter protected long ownerBedrockId; - public TameableEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TameableEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java index 91d5088f2..13bb8e17d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.Set; @@ -49,7 +49,7 @@ public class WolfEntity extends TameableEntity { private byte collarColor; - public WolfEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WolfEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java index 0e40fd9a1..7981c9b23 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.merchant; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.AgeableEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractMerchantEntity extends AgeableEntity { - public AbstractMerchantEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractMerchantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java index b403f4362..012fb05f2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java @@ -37,7 +37,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.BlockRegistries; import java.util.Optional; @@ -88,7 +88,7 @@ public class VillagerEntity extends AbstractMerchantEntity { @Getter private boolean canTradeWith; - public VillagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java index 3a923ef7f..ae13cfeae 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractSkeletonEntity extends MonsterEntity { - public AbstractSkeletonEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractSkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java index 19ccaaef2..2f315368f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.DimensionUtils; import java.util.UUID; @@ -37,7 +37,7 @@ import java.util.UUID; public class BasePiglinEntity extends MonsterEntity { private boolean isImmuneToZombification; - public BasePiglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BasePiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java index 46e4576c9..2303f8091 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class BlazeEntity extends MonsterEntity { - public BlazeEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BlazeEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java index e601999cf..f1e0b6a65 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -41,7 +41,7 @@ public class CreeperEntity extends MonsterEntity { */ private boolean ignitedByFlintAndSteel = false; - public CreeperEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CreeperEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java index b25bc3168..9c237f117 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ElderGuardianEntity extends GuardianEntity { - public ElderGuardianEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ElderGuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java index 5319e4b2a..f49b51e6c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java @@ -36,7 +36,7 @@ import lombok.Data; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.type.living.MobEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.DimensionUtils; import java.util.Random; @@ -79,7 +79,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable { private float wingPosition; private float lastWingPosition; - public EnderDragonEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EnderDragonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java index 2ab9cc461..7cd4bb6cf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonPartEntity.java @@ -30,11 +30,11 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class EnderDragonPartEntity extends Entity { - public EnderDragonPartEntity(GeyserSessionImpl session, long entityId, long geyserId, float width, float height) { + public EnderDragonPartEntity(GeyserSession session, long entityId, long geyserId, float width, float height) { super(session, entityId, geyserId, null, EntityDefinitions.ENDER_DRAGON_PART, Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, width); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java index 771b00e36..469f48521 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java @@ -33,13 +33,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEvent2Packet; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class EndermanEntity extends MonsterEntity { - public EndermanEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EndermanEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java index a03f1df95..845a281d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.FlyingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GhastEntity extends FlyingEntity { - public GhastEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GhastEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java index 2c84efd77..6dd27cc39 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GiantEntity extends MonsterEntity { - public GiantEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GiantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityData.SCALE, 6f); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java index 9c1954134..0190f3c60 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GuardianEntity extends MonsterEntity { - public GuardianEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GuardianEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java index 0372c174a..fad45f982 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.CreatureEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class MonsterEntity extends CreatureEntity { - public MonsterEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MonsterEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java index 0854c2522..68f3e7d23 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java @@ -30,12 +30,12 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.FlyingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class PhantomEntity extends FlyingEntity { - public PhantomEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PhantomEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java index 084f1dc36..b98d6eabc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class PiglinEntity extends BasePiglinEntity { - public PiglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @@ -55,7 +55,7 @@ public class PiglinEntity extends BasePiglinEntity { } @Override - public void updateOffHand(GeyserSessionImpl session) { + public void updateOffHand(GeyserSession session) { // Check if the Piglin is holding Gold and set the ADMIRING flag accordingly so its pose updates setFlag(EntityFlag.ADMIRING, session.getTagCache().shouldPiglinAdmire(session.getItemMappings().getMapping(this.offHand))); super.updateBedrockMetadata(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java index d5d816a46..e60f81d2f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java @@ -33,13 +33,13 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.GolemEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ShulkerEntity extends GolemEntity { - public ShulkerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ShulkerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that invisibility should be fixed through the resource pack setFlag(EntityFlag.BRIBED, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java index 9339b6593..b1f6939aa 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SkeletonEntity extends AbstractSkeletonEntity { private boolean convertingToStray = false; - public SkeletonEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SkeletonEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java index af358a800..4f7b02d73 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SpiderEntity extends MonsterEntity { - public SpiderEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpiderEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java index f6017d479..938b18022 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class VexEntity extends MonsterEntity { - public VexEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VexEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java index d79fe4e8b..17da0a611 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class WitherEntity extends MonsterEntity { - public WitherEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WitherEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java index 364233d81..f0fe101da 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java @@ -30,13 +30,13 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ZoglinEntity extends MonsterEntity { - public ZoglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZoglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java index 1cd5c4c91..9e3301b48 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java @@ -30,14 +30,14 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ZombieEntity extends MonsterEntity { private boolean convertingToDrowned = false; - public ZombieEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java index 4fa3d88f8..54a5c4506 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java @@ -33,14 +33,14 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ZombieVillagerEntity extends ZombieEntity { private boolean isTransforming; - public ZombieVillagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieVillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java index aaf3d8001..2604ce12e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ZombifiedPiglinEntity extends ZombieEntity { - public ZombifiedPiglinEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombifiedPiglinEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.FIRE_IMMUNE, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java index ff24b7fb2..15ac1a0d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java @@ -27,13 +27,13 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractIllagerEntity extends RaidParticipantEntity { - public AbstractIllagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java index d13fc247a..477d9fef7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java @@ -28,26 +28,26 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; import java.util.UUID; public class PillagerEntity extends AbstractIllagerEntity { - public PillagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PillagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } @Override - public void updateMainHand(GeyserSessionImpl session) { //TODO + public void updateMainHand(GeyserSession session) { //TODO checkForCrossbow(); super.updateMainHand(session); } @Override - public void updateOffHand(GeyserSessionImpl session) { + public void updateOffHand(GeyserSession session) { checkForCrossbow(); super.updateOffHand(session); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java index cecb679aa..bd0f3ac5d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java @@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.type.living.monster.MonsterEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class RaidParticipantEntity extends MonsterEntity { - public RaidParticipantEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public RaidParticipantEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java index 0ada45517..7c2a05de1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -40,7 +40,7 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { private static final int ATTACK_PARTICLE_COLOR = (102 << 16) | (77 << 8) | 89; private static final int WOLOLO_PARTICLE_COLOR = (179 << 16) | (128 << 8) | 51; - public SpellcasterIllagerEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpellcasterIllagerEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // OptionalPack usage setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java index d6b239e10..a3b85dc73 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java @@ -29,13 +29,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class VindicatorEntity extends AbstractIllagerEntity { - public VindicatorEntity(GeyserSessionImpl session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VindicatorEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 4a3064825..8737ef847 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -52,7 +52,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.ParrotEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Score; @@ -81,7 +81,7 @@ public class PlayerEntity extends LivingEntity { */ private ParrotEntity rightParrot; - public PlayerEntity(GeyserSessionImpl session, long entityId, long geyserId, GameProfile gameProfile, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PlayerEntity(GeyserSession session, long entityId, long geyserId, GameProfile gameProfile, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, gameProfile.getId(), EntityDefinitions.PLAYER, position, motion, yaw, pitch, headYaw); profile = gameProfile; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index 4ee309290..c297bdb18 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Getter; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.AttributeUtils; import java.util.Collections; @@ -48,7 +48,7 @@ import java.util.Map; import java.util.UUID; /** - * The entity class specifically for a {@link GeyserSessionImpl}'s player. + * The entity class specifically for a {@link GeyserSession}'s player. */ public class SessionPlayerEntity extends PlayerEntity { /** @@ -70,9 +70,9 @@ public class SessionPlayerEntity extends PlayerEntity { */ private int fakeTradeXp; - private final GeyserSessionImpl session; + private final GeyserSession session; - public SessionPlayerEntity(GeyserSessionImpl session) { + public SessionPlayerEntity(GeyserSession session) { super(session, 1, 1, new GameProfile(UUID.randomUUID(), "unknown"), Vector3f.ZERO, Vector3f.ZERO, 0, 0, 0); valid = true; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java index 8bf3a8400..0afb3e8b5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SkullPlayerEntity.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AddPlayerPacket; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * A wrapper to handle skulls more effectively - skulls have to be treated as entities since there are no @@ -48,7 +48,7 @@ public class SkullPlayerEntity extends PlayerEntity { @Getter private final int blockState; - public SkullPlayerEntity(GeyserSessionImpl session, long geyserId, GameProfile gameProfile, Vector3f position, float rotation, int blockState) { + public SkullPlayerEntity(GeyserSession session, long geyserId, GameProfile gameProfile, Vector3f position, float rotation, int blockState) { super(session, 0, geyserId, gameProfile, position, Vector3f.ZERO, rotation, 0, rotation); this.blockState = blockState; setPlayerList(false); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Container.java index 2e1ef0542..464d683fa 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Container.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; /** @@ -60,7 +60,7 @@ public class Container extends Inventory { } @Override - public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSessionImpl session) { + public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { if (slot < this.size) { super.setItem(slot, newItem, session); } else { diff --git a/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java index 6be1f79c3..b16a3a07c 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/EnchantingContainer.java @@ -49,7 +49,7 @@ public class EnchantingContainer extends Container { for (int i = 0; i < geyserEnchantOptions.length; i++) { geyserEnchantOptions[i] = new GeyserEnchantOption(i); // Options cannot be null, so we build initial options - // GeyserSession can be safely null here because it's only needed for net IDs + // GeyserConnection can be safely null here because it's only needed for net IDs enchantOptions[i] = geyserEnchantOptions[i].build(null); } } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java index cc2eda74e..fc226f621 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Generic3X3Container.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.Generic3X3InventoryTranslator; public class Generic3X3Container extends Container { /** * Whether we need to set the container type as {@link com.nukkitx.protocol.bedrock.data.inventory.ContainerType#DROPPER}. * - * Used at {@link Generic3X3InventoryTranslator#openInventory(GeyserSessionImpl, Inventory)} + * Used at {@link Generic3X3InventoryTranslator#openInventory(GeyserSession, Inventory)} */ @Getter private boolean isDropper = false; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java index 6b789a075..8ecb3fe8d 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserEnchantOption.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.inventory; import com.nukkitx.protocol.bedrock.data.inventory.EnchantData; import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Arrays; import java.util.Collections; @@ -70,7 +70,7 @@ public class GeyserEnchantOption { this.javaIndex = javaIndex; } - public EnchantOptionData build(GeyserSessionImpl session) { + public EnchantOptionData build(GeyserSession session) { this.hasChanged = false; return new EnchantOptionData(xpCost, javaIndex + 16, EMPTY, enchantLevel == -1 ? EMPTY : Collections.singletonList(new EnchantData(bedrockEnchantIndex, enchantLevel)), EMPTY, diff --git a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java index bdc141045..a75631db0 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/GeyserItemStack.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import lombok.Data; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -91,14 +91,14 @@ public class GeyserItemStack { return isEmpty() ? null : new ItemStack(javaId, newAmount, nbt); } - public ItemData getItemData(GeyserSessionImpl session) { + public ItemData getItemData(GeyserSession session) { ItemData itemData = ItemTranslator.translateToBedrock(session, getItemStack()); itemData.setNetId(getNetId()); itemData.setUsingNetId(true); // Seems silly - this should probably be on the protocol level return itemData; } - public ItemMapping getMapping(GeyserSessionImpl session) { + public ItemMapping getMapping(GeyserSession session) { return session.getItemMappings().getMapping(this.javaId); } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java index bf58abf4c..6eaaf84a2 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/Inventory.java @@ -34,7 +34,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Arrays; @@ -102,7 +102,7 @@ public class Inventory { return items[slot]; } - public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSessionImpl session) { + public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { if (slot > this.size) { session.getGeyser().getLogger().debug("Tried to set an item out of bounds! " + this); return; @@ -123,7 +123,7 @@ public class Inventory { } } - protected static void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSessionImpl session) { + protected static void updateItemNetId(GeyserItemStack oldItem, GeyserItemStack newItem, GeyserSession session) { if (!newItem.isEmpty()) { if (newItem.getItemData(session).equals(oldItem.getItemData(session), false, false, false)) { newItem.setNetId(oldItem.getNetId()); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java index 57df2fe68..36114ccba 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/PlayerInventory.java @@ -29,7 +29,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class PlayerInventory extends Inventory { @@ -50,7 +50,7 @@ public class PlayerInventory extends Inventory { heldItemSlot = 0; } - public void setCursor(@NonNull GeyserItemStack newCursor, GeyserSessionImpl session) { + public void setCursor(@NonNull GeyserItemStack newCursor, GeyserSession session) { updateItemNetId(cursor, newCursor, session); cursor = newCursor; } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java index 0785c4eac..3dc35f5df 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/StonecutterContainer.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class StonecutterContainer extends Container { /** @@ -44,7 +44,7 @@ public class StonecutterContainer extends Container { } @Override - public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSessionImpl session) { + public void setItem(int slot, @NonNull GeyserItemStack newItem, GeyserSession session) { if (slot == 0 && newItem.getJavaId() != items[slot].getJavaId()) { // The pressed stonecutter button output resets whenever the input item changes this.stonecutterButton = -1; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java b/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java index e58c0bc0d..c239cc778 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/click/ClickPlan.java @@ -35,7 +35,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import lombok.Value; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.translator.inventory.CraftingInventoryTranslator; @@ -52,12 +52,12 @@ public class ClickPlan { private GeyserItemStack simulatedCursor; private boolean simulating; - private final GeyserSessionImpl session; + private final GeyserSession session; private final InventoryTranslator translator; private final Inventory inventory; private final int gridSize; - public ClickPlan(GeyserSessionImpl session, InventoryTranslator translator, Inventory inventory) { + public ClickPlan(GeyserSession session, InventoryTranslator translator, Inventory inventory) { this.session = session; this.translator = translator; this.inventory = inventory; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java index 59e32c97e..8dba5a69d 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/BlockInventoryHolder.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.util.BlockUtils; @@ -71,7 +71,7 @@ public class BlockInventoryHolder extends InventoryHolder { } @Override - public void prepareInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { // Check to see if there is an existing block we can use that the player just selected. // First, verify that the player's position has not changed, so we don't try to select a block wildly out of range. // (This could be a virtual inventory that the player is opening) @@ -108,7 +108,7 @@ public class BlockInventoryHolder extends InventoryHolder { * @return if the player's last interaction position and current position match. Used to ensure that we don't select * a block to hold the inventory that's wildly out of range. */ - protected boolean checkInteractionPosition(GeyserSessionImpl session) { + protected boolean checkInteractionPosition(GeyserSession session) { return session.getLastInteractionPlayerPosition().equals(session.getPlayerEntity().getPosition()); } @@ -119,7 +119,7 @@ public class BlockInventoryHolder extends InventoryHolder { return this.validBlocks.contains(javaBlockString[0]); } - protected void setCustomName(GeyserSessionImpl session, Vector3i position, Inventory inventory, int javaBlockState) { + protected void setCustomName(GeyserSession session, Vector3i position, Inventory inventory, int javaBlockState) { NbtMap tag = NbtMap.builder() .putInt("x", position.getX()) .putInt("y", position.getY()) @@ -132,7 +132,7 @@ public class BlockInventoryHolder extends InventoryHolder { } @Override - public void openInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); containerOpenPacket.setType(containerType); @@ -142,7 +142,7 @@ public class BlockInventoryHolder extends InventoryHolder { } @Override - public void closeInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { if (((Container) inventory).isUsingRealBlock()) { // No need to reset a block since we didn't change any blocks // But send a container close packet because we aren't destroying the original. diff --git a/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java b/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java index d90487a86..845e645e3 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/holder/InventoryHolder.java @@ -26,11 +26,11 @@ package org.geysermc.geyser.inventory.holder; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; public abstract class InventoryHolder { - public abstract void prepareInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory); - public abstract void openInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory); - public abstract void closeInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory); + public abstract void prepareInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); + public abstract void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); + public abstract void closeInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory); } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java index 2c162ef85..f95633768 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/AnvilInventoryUpdater.java @@ -40,7 +40,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; @@ -57,7 +57,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { private static final int MAX_LEVEL_COST = 40; @Override - public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { super.updateInventory(translator, session, inventory); AnvilContainer anvilContainer = (AnvilContainer) inventory; updateInventoryState(session, anvilContainer); @@ -79,7 +79,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; AnvilContainer anvilContainer = (AnvilContainer) inventory; @@ -107,7 +107,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return true; } - private void updateInventoryState(GeyserSessionImpl session, AnvilContainer anvilContainer) { + private void updateInventoryState(GeyserSession session, AnvilContainer anvilContainer) { GeyserItemStack input = anvilContainer.getInput(); if (!input.equals(anvilContainer.getLastInput())) { anvilContainer.setLastInput(input.copy()); @@ -133,7 +133,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param anvilContainer the anvil inventory * @return the slot to change the repair cost */ - private int getTargetSlot(GeyserSessionImpl session, AnvilContainer anvilContainer) { + private int getTargetSlot(GeyserSession session, AnvilContainer anvilContainer) { GeyserItemStack input = anvilContainer.getInput(); GeyserItemStack material = anvilContainer.getMaterial(); @@ -148,7 +148,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return 0; } - private void updateTargetSlot(InventoryTranslator translator, GeyserSessionImpl session, AnvilContainer anvilContainer, int slot) { + private void updateTargetSlot(InventoryTranslator translator, GeyserSession session, AnvilContainer anvilContainer, int slot) { ItemData itemData = anvilContainer.getItem(slot).getItemData(session); itemData = hijackRepairCost(session, anvilContainer, itemData); @@ -166,7 +166,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { session.sendUpstreamPacket(slotPacket); } - private ItemData hijackRepairCost(GeyserSessionImpl session, AnvilContainer anvilContainer, ItemData itemData) { + private ItemData hijackRepairCost(GeyserSession session, AnvilContainer anvilContainer, ItemData itemData) { if (itemData.isNull()) { return itemData; } @@ -208,7 +208,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param bedrock True to count enchantments like Bedrock * @return the number of levels needed */ - public int calcLevelCost(GeyserSessionImpl session, AnvilContainer anvilContainer, boolean bedrock) { + public int calcLevelCost(GeyserSession session, AnvilContainer anvilContainer, boolean bedrock) { GeyserItemStack input = anvilContainer.getInput(); GeyserItemStack material = anvilContainer.getMaterial(); @@ -262,7 +262,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param material the item's respective repair material * @return the number of levels needed or 0 if it is not possible to repair any further */ - private int calcRepairLevelCost(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { + private int calcRepairLevelCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { int newDamage = getDamage(input); int unitRepair = Math.min(newDamage, input.getMapping(session).getMaxDamage() / 4); if (unitRepair <= 0) { @@ -287,7 +287,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param material a matching item * @return the number of levels needed or 0 if it is not possible to repair any further */ - private int calcMergeRepairCost(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { + private int calcMergeRepairCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { // If the material item is damaged 112% or more, then the input item will not be repaired if (getDamage(input) > 0 && getDamage(material) < (material.getMapping(session).getMaxDamage() * 112 / 100)) { return 2; @@ -304,7 +304,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { * @param bedrock True to count enchantments like Bedrock, False to count like Java * @return the number of levels needed or -1 if no enchantments can be applied */ - private int calcMergeEnchantmentCost(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material, boolean bedrock) { + private int calcMergeEnchantmentCost(GeyserSession session, GeyserItemStack input, GeyserItemStack material, boolean bedrock) { boolean hasCompatible = false; Object2IntMap combinedEnchantments = getEnchantments(session, input, bedrock); int cost = 0; @@ -367,7 +367,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return cost; } - private Object2IntMap getEnchantments(GeyserSessionImpl session, GeyserItemStack itemStack, boolean bedrock) { + private Object2IntMap getEnchantments(GeyserSession session, GeyserItemStack itemStack, boolean bedrock) { if (itemStack.getNbt() == null) { return Object2IntMaps.emptyMap(); } @@ -405,20 +405,20 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return enchantments; } - private boolean isEnchantedBook(GeyserSessionImpl session, GeyserItemStack itemStack) { + private boolean isEnchantedBook(GeyserSession session, GeyserItemStack itemStack) { return itemStack.getJavaId() == session.getItemMappings().getStoredItems().enchantedBook().getJavaId(); } - private boolean isCombining(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { + private boolean isCombining(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { return isEnchantedBook(session, material) || (input.getJavaId() == material.getJavaId() && hasDurability(session, input)); } - private boolean isRepairing(GeyserSessionImpl session, GeyserItemStack input, GeyserItemStack material) { + private boolean isRepairing(GeyserSession session, GeyserItemStack input, GeyserItemStack material) { Set repairMaterials = input.getMapping(session).getRepairMaterials(); return repairMaterials != null && repairMaterials.contains(material.getMapping(session).getJavaIdentifier()); } - private boolean isRenaming(GeyserSessionImpl session, AnvilContainer anvilContainer, boolean bedrock) { + private boolean isRenaming(GeyserSession session, AnvilContainer anvilContainer, boolean bedrock) { if (anvilContainer.getResult().isEmpty()) { return false; } @@ -447,7 +447,7 @@ public class AnvilInventoryUpdater extends InventoryUpdater { return getTagIntValueOr(itemStack, "RepairCost", 0); } - private boolean hasDurability(GeyserSessionImpl session, GeyserItemStack itemStack) { + private boolean hasDurability(GeyserSession session, GeyserItemStack itemStack) { if (itemStack.getMapping(session).getMaxDamage() > 0) { return getTagIntValueOr(itemStack, "Unbreakable", 0) == 0; } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java index d8951b9d6..65147abb6 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ChestInventoryUpdater.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import lombok.AllArgsConstructor; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import org.geysermc.geyser.util.InventoryUtils; import org.geysermc.geyser.text.GeyserLocale; @@ -46,7 +46,7 @@ public class ChestInventoryUpdater extends InventoryUpdater { private final int paddedSize; @Override - public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { super.updateInventory(translator, session, inventory); List bedrockItems = new ArrayList<>(paddedSize); @@ -65,7 +65,7 @@ public class ChestInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java index 2790e1de7..dd1e810ca 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/ContainerInventoryUpdater.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; @@ -38,7 +38,7 @@ public class ContainerInventoryUpdater extends InventoryUpdater { public static final ContainerInventoryUpdater INSTANCE = new ContainerInventoryUpdater(); @Override - public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { super.updateInventory(translator, session, inventory); ItemData[] bedrockItems = new ItemData[translator.size]; @@ -53,7 +53,7 @@ public class ContainerInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java index 36f98da5a..10a556c81 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/HorseInventoryUpdater.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; @@ -38,7 +38,7 @@ public class HorseInventoryUpdater extends InventoryUpdater { public static final HorseInventoryUpdater INSTANCE = new HorseInventoryUpdater(); @Override - public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { super.updateInventory(translator, session, inventory); ItemData[] bedrockItems = new ItemData[translator.size]; @@ -53,7 +53,7 @@ public class HorseInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java index 33dee921b..6910aa447 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/InventoryUpdater.java @@ -30,13 +30,13 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; import java.util.Arrays; public class InventoryUpdater { - public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { ItemData[] bedrockItems = new ItemData[36]; for (int i = 0; i < 36; i++) { final int offset = i < 9 ? 27 : -9; @@ -48,7 +48,7 @@ public class InventoryUpdater { session.sendUpstreamPacket(contentPacket); } - public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { if (javaSlot >= translator.size) { InventorySlotPacket slotPacket = new InventorySlotPacket(); slotPacket.setContainerId(ContainerId.INVENTORY); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java index eeaa0fd7b..79b6bffc0 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/updater/UIInventoryUpdater.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.inventory.updater; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.InventoryTranslator; public class UIInventoryUpdater extends InventoryUpdater { public static final UIInventoryUpdater INSTANCE = new UIInventoryUpdater(); @Override - public void updateInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { super.updateInventory(translator, session, inventory); for (int i = 0; i < translator.size; i++) { @@ -51,7 +51,7 @@ public class UIInventoryUpdater extends InventoryUpdater { } @Override - public boolean updateSlot(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory, int javaSlot) { + public boolean updateSlot(InventoryTranslator translator, GeyserSession session, Inventory inventory, int javaSlot) { if (super.updateSlot(translator, session, inventory, javaSlot)) return true; diff --git a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java index 7253809e3..d766c4b4c 100644 --- a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java @@ -32,7 +32,7 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.ChunkCache; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -42,7 +42,7 @@ public class GeyserWorldManager extends WorldManager { private static final Object2ObjectMap gameruleCache = new Object2ObjectOpenHashMap<>(); @Override - public int getBlockAt(GeyserSessionImpl session, int x, int y, int z) { + public int getBlockAt(GeyserSession session, int x, int y, int z) { ChunkCache chunkCache = session.getChunkCache(); if (chunkCache != null) { // Chunk cache can be null if the session is closed asynchronously return chunkCache.getBlockAt(x, y, z); @@ -57,7 +57,7 @@ public class GeyserWorldManager extends WorldManager { } @Override - public NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad) { + public NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad) { // Without direct server access, we can't get lectern information on-the-fly. // I should have set this up so it's only called when there is a book in the block state. - Camotoy NbtMapBuilder lecternTag = LecternInventoryTranslator.getBaseLecternTag(x, y, z, 1); @@ -80,13 +80,13 @@ public class GeyserWorldManager extends WorldManager { } @Override - public void setGameRule(GeyserSessionImpl session, String name, Object value) { + public void setGameRule(GeyserSession session, String name, Object value) { session.sendDownstreamPacket(new ServerboundChatPacket("/gamerule " + name + " " + value)); gameruleCache.put(name, String.valueOf(value)); } @Override - public Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule) { + public Boolean getGameRuleBool(GeyserSession session, GameRule gameRule) { String value = gameruleCache.get(gameRule.getJavaID()); if (value != null) { return Boolean.parseBoolean(value); @@ -96,7 +96,7 @@ public class GeyserWorldManager extends WorldManager { } @Override - public int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule) { + public int getGameRuleInt(GeyserSession session, GameRule gameRule) { String value = gameruleCache.get(gameRule.getJavaID()); if (value != null) { return Integer.parseInt(value); @@ -106,17 +106,17 @@ public class GeyserWorldManager extends WorldManager { } @Override - public void setPlayerGameMode(GeyserSessionImpl session, GameMode gameMode) { + public void setPlayerGameMode(GeyserSession session, GameMode gameMode) { session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase())); } @Override - public void setDifficulty(GeyserSessionImpl session, Difficulty difficulty) { + public void setDifficulty(GeyserSession session, Difficulty difficulty) { session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase())); } @Override - public boolean hasPermission(GeyserSessionImpl session, String permission) { + public boolean hasPermission(GeyserSession session, String permission) { return false; } } diff --git a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java index edd95bb52..9aaf323c0 100644 --- a/core/src/main/java/org/geysermc/geyser/level/WorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/WorldManager.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * Class that manages or retrieves various information @@ -48,7 +48,7 @@ public abstract class WorldManager { * @param position the position * @return the block state at the specified location */ - public int getBlockAt(GeyserSessionImpl session, Position position) { + public int getBlockAt(GeyserSession session, Position position) { return this.getBlockAt(session, position.getX(), position.getY(), position.getZ()); } @@ -59,7 +59,7 @@ public abstract class WorldManager { * @param vector the position * @return the block state at the specified location */ - public int getBlockAt(GeyserSessionImpl session, Vector3i vector) { + public int getBlockAt(GeyserSession session, Vector3i vector) { return this.getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); } @@ -72,7 +72,7 @@ public abstract class WorldManager { * @param z the z coordinate to get the block at * @return the block state at the specified location */ - public abstract int getBlockAt(GeyserSessionImpl session, int x, int y, int z); + public abstract int getBlockAt(GeyserSession session, int x, int y, int z); /** * Checks whether or not this world manager requires a separate chunk cache/has access to more block data than the chunk cache. @@ -103,7 +103,7 @@ public abstract class WorldManager { * @return the Bedrock lectern block entity tag. This may not be the exact block entity tag - for example, Spigot's * block handled must be done on the server thread, so we send the tag manually there. */ - public abstract NbtMap getLecternDataAt(GeyserSessionImpl session, int x, int y, int z, boolean isChunkLoad); + public abstract NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad); /** * @return whether we should expect lectern data to update, or if we have to fall back on a workaround. @@ -117,7 +117,7 @@ public abstract class WorldManager { * @param name The gamerule to change * @param value The new value for the gamerule */ - public abstract void setGameRule(GeyserSessionImpl session, String name, Object value); + public abstract void setGameRule(GeyserSession session, String name, Object value); /** * Gets a gamerule value as a boolean @@ -126,7 +126,7 @@ public abstract class WorldManager { * @param gameRule The gamerule to fetch the value of * @return The boolean representation of the value */ - public abstract Boolean getGameRuleBool(GeyserSessionImpl session, GameRule gameRule); + public abstract Boolean getGameRuleBool(GeyserSession session, GameRule gameRule); /** * Get a gamerule value as an integer @@ -135,7 +135,7 @@ public abstract class WorldManager { * @param gameRule The gamerule to fetch the value of * @return The integer representation of the value */ - public abstract int getGameRuleInt(GeyserSessionImpl session, GameRule gameRule); + public abstract int getGameRuleInt(GeyserSession session, GameRule gameRule); /** * Change the game mode of the given session @@ -143,7 +143,7 @@ public abstract class WorldManager { * @param session The session of the player to change the game mode of * @param gameMode The game mode to change the player to */ - public abstract void setPlayerGameMode(GeyserSessionImpl session, GameMode gameMode); + public abstract void setPlayerGameMode(GeyserSession session, GameMode gameMode); /** * Change the difficulty of the Java server @@ -151,7 +151,7 @@ public abstract class WorldManager { * @param session The session of the user that requested the change * @param difficulty The difficulty to change to */ - public abstract void setDifficulty(GeyserSessionImpl session, Difficulty difficulty); + public abstract void setDifficulty(GeyserSession session, Difficulty difficulty); /** * Checks if the given session's player has a permission @@ -160,5 +160,5 @@ public abstract class WorldManager { * @param permission The permission node to check * @return True if the player has the requested permission, false if not */ - public abstract boolean hasPermission(GeyserSessionImpl session, String permission); + public abstract boolean hasPermission(GeyserSession session, String permission); } diff --git a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java index 60aba03f2..5bd72182f 100644 --- a/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/physics/CollisionManager.java @@ -35,7 +35,7 @@ import lombok.Setter; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.translator.collision.BlockCollision; import org.geysermc.geyser.translator.collision.ScaffoldingCollision; @@ -49,7 +49,7 @@ import java.util.Locale; public class CollisionManager { - private final GeyserSessionImpl session; + private final GeyserSession session; @Getter private final BoundingBox playerBoundingBox; @@ -85,7 +85,7 @@ public class CollisionManager { */ private static final double INCORRECT_MOVEMENT_THRESHOLD = 0.08; - public CollisionManager(GeyserSessionImpl session) { + public CollisionManager(GeyserSession session) { this.session = session; this.playerBoundingBox = new BoundingBox(0, 0, 0, 0.6, 1.8, 0.6); } @@ -224,7 +224,7 @@ public class CollisionManager { /** * Returns false if the movement is invalid, and in this case it shouldn't be sent to the server and should be * cancelled - * See {@link BlockCollision#correctPosition(GeyserSessionImpl, int, int, int, BoundingBox)} for more info + * See {@link BlockCollision#correctPosition(GeyserSession, int, int, int, BoundingBox)} for more info */ public boolean correctPlayerPosition() { diff --git a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java index 5d580fc05..2cd866365 100644 --- a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java @@ -36,7 +36,7 @@ import io.netty.util.concurrent.DefaultThreadFactory; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.ping.GeyserPingInfo; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import org.geysermc.geyser.text.GeyserLocale; @@ -168,7 +168,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { public void onSessionCreation(BedrockServerSession bedrockServerSession) { bedrockServerSession.setLogging(true); bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel()); - bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSessionImpl(geyser, bedrockServerSession, eventLoopGroup.next()))); + bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next()))); // Set the packet codec to default just in case we need to send disconnect packets. bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC); } diff --git a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index 1eeca3319..0dceed7e9 100644 --- a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.handler.BedrockPacketHandler; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * Bare bones implementation of BedrockPacketHandler suitable for extension. @@ -39,9 +39,9 @@ import org.geysermc.geyser.session.GeyserSessionImpl; */ public class LoggingPacketHandler implements BedrockPacketHandler { protected final GeyserImpl geyser; - protected final GeyserSessionImpl session; + protected final GeyserSession session; - LoggingPacketHandler(GeyserImpl geyser, GeyserSessionImpl session) { + LoggingPacketHandler(GeyserImpl geyser, GeyserSession session) { this.geyser = geyser; this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index 76a238ad5..4d22bd7ce 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.pack.ResourcePack; import org.geysermc.geyser.pack.ResourcePackManifest; import org.geysermc.geyser.registry.BlockRegistries; @@ -47,7 +47,7 @@ import java.io.InputStream; public class UpstreamPacketHandler extends LoggingPacketHandler { - public UpstreamPacketHandler(GeyserImpl geyser, GeyserSessionImpl session) { + public UpstreamPacketHandler(GeyserImpl geyser, GeyserSession session) { super(geyser, session); } diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java index 781644056..7e2b18a51 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java @@ -57,7 +57,7 @@ public final class LocalSession extends TcpSession { @Override public void connect() { if (this.disconnected) { - throw new IllegalStateException("Session has already been disconnected."); + throw new IllegalStateException("Connection has already been disconnected."); } if (DEFAULT_EVENT_LOOP_GROUP == null) { diff --git a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java index 6f9e766a0..e74d15001 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/PacketTranslatorRegistry.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import io.netty.channel.EventLoop; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.loader.RegistryLoaders; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.text.GeyserLocale; @@ -53,7 +53,7 @@ public class PacketTranslatorRegistry extends AbstractMappedRegistry boolean translate(Class clazz, P packet, GeyserSessionImpl session) { + public

boolean translate(Class clazz, P packet, GeyserSession session) { if (session.getUpstream().isClosed() || session.isClosed()) { return false; } @@ -77,7 +77,7 @@ public class PacketTranslatorRegistry extends AbstractMappedRegistry void translate0(GeyserSessionImpl session, PacketTranslator

translator, P packet) { + private

void translate0(GeyserSession session, PacketTranslator

translator, P packet) { if (session.isClosed()) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java index 7cdb85838..cd5ad17ce 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java +++ b/core/src/main/java/org/geysermc/geyser/registry/type/ParticleMapping.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.registry.type; import com.nukkitx.protocol.bedrock.data.LevelEventType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.ParametersAreNullableByDefault; @ParametersAreNullableByDefault public record ParticleMapping(LevelEventType levelEventType, String identifier) { - public int getParticleId(GeyserSessionImpl session) { + public int getParticleId(GeyserSession session) { if (this.levelEventType == null) { return -1; } diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java index be7ca3c84..2d7f2373f 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/Scoreboard.java @@ -35,7 +35,7 @@ import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import javax.annotation.Nullable; @@ -46,7 +46,7 @@ import java.util.concurrent.atomic.AtomicLong; import static org.geysermc.geyser.scoreboard.UpdateType.*; public final class Scoreboard { - private final GeyserSessionImpl session; + private final GeyserSession session; private final GeyserLogger logger; @Getter private final AtomicLong nextId = new AtomicLong(0); @@ -59,7 +59,7 @@ public final class Scoreboard { private int lastAddScoreCount = 0; private int lastRemoveScoreCount = 0; - public Scoreboard(GeyserSessionImpl session) { + public Scoreboard(GeyserSession session) { this.session = session; this.logger = GeyserImpl.getInstance().getLogger(); } diff --git a/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java index 4f4cd8601..80a4491ba 100644 --- a/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java +++ b/core/src/main/java/org/geysermc/geyser/scoreboard/ScoreboardUpdater.java @@ -29,7 +29,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.text.GeyserLocale; @@ -73,10 +73,10 @@ public final class ScoreboardUpdater extends Thread { long currentTime = System.currentTimeMillis(); // reset score-packets per second every second - Collection sessions = geyser.getSessionManager().getSessions().values(); + Collection sessions = geyser.getSessionManager().getSessions().values(); if (currentTime - lastPacketsPerSecondUpdate >= 1000) { lastPacketsPerSecondUpdate = currentTime; - for (GeyserSessionImpl session : sessions) { + for (GeyserSession session : sessions) { ScoreboardSession scoreboardSession = session.getWorldCache().getScoreboardSession(); int oldPps = scoreboardSession.getPacketsPerSecond(); @@ -96,7 +96,7 @@ public final class ScoreboardUpdater extends Thread { if (currentTime - lastUpdate >= FIRST_MILLIS_BETWEEN_UPDATES) { lastUpdate = currentTime; - for (GeyserSessionImpl session : sessions) { + for (GeyserSession session : sessions) { WorldCache worldCache = session.getWorldCache(); ScoreboardSession scoreboardSession = worldCache.getScoreboardSession(); @@ -172,7 +172,7 @@ public final class ScoreboardUpdater extends Thread { @RequiredArgsConstructor @Getter public static final class ScoreboardSession { - private final GeyserSessionImpl session; + private final GeyserSession session; private final AtomicInteger pendingPacketsPerSecond = new AtomicInteger(0); private int packetsPerSecond; private long lastUpdate; diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSessionImpl.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java similarity index 99% rename from core/src/main/java/org/geysermc/geyser/session/GeyserSessionImpl.java rename to core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 7a93a2653..595603f41 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSessionImpl.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -76,7 +76,7 @@ import lombok.Setter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.api.session.GeyserSession; +import org.geysermc.api.geyser.GeyserConnection; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.entity.InteractiveTagManager; import org.geysermc.geyser.session.auth.AuthType; @@ -121,7 +121,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @Getter -public class GeyserSessionImpl implements GeyserSession, CommandSender { +public class GeyserSession implements GeyserConnection, CommandSender { private final GeyserImpl geyser; private final UpstreamSession upstream; @@ -227,7 +227,7 @@ public class GeyserSessionImpl implements GeyserSession, CommandSender { /** * Stores a list of all lectern locations and their block entity tags. - * See {@link WorldManager#getLecternDataAt(GeyserSessionImpl, int, int, int, boolean)} + * See {@link WorldManager#getLecternDataAt(GeyserSession, int, int, int, boolean)} * for more information. */ private final Set lecternCache; @@ -459,7 +459,7 @@ public class GeyserSessionImpl implements GeyserSession, CommandSender { private MinecraftProtocol protocol; - public GeyserSessionImpl(GeyserImpl geyser, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { + public GeyserSession(GeyserImpl geyser, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { this.geyser = geyser; this.upstream = new UpstreamSession(bedrockServerSession); this.eventLoop = eventLoop; @@ -902,7 +902,7 @@ public class GeyserSessionImpl implements GeyserSession, CommandSender { @Override public void packetReceived(PacketReceivedEvent event) { Packet packet = event.getPacket(); - Registries.JAVA_PACKET_TRANSLATORS.translate(packet.getClass(), packet, GeyserSessionImpl.this); + Registries.JAVA_PACKET_TRANSLATORS.translate(packet.getClass(), packet, GeyserSession.this); } @Override @@ -1463,7 +1463,7 @@ public class GeyserSessionImpl implements GeyserSession, CommandSender { public void refreshEmotes(List emotes) { this.emotes.addAll(emotes); - for (GeyserSessionImpl player : geyser.getSessionManager().getSessions().values()) { + for (GeyserSession player : geyser.getSessionManager().getSessions().values()) { List pieces = new ArrayList<>(); for (UUID piece : emotes) { if (!player.getEmotes().contains(piece)) { diff --git a/core/src/main/java/org/geysermc/geyser/session/SessionManager.java b/core/src/main/java/org/geysermc/geyser/session/SessionManager.java index e70015b81..5aecdf175 100644 --- a/core/src/main/java/org/geysermc/geyser/session/SessionManager.java +++ b/core/src/main/java/org/geysermc/geyser/session/SessionManager.java @@ -38,31 +38,31 @@ public final class SessionManager { * A list of all players who don't currently have a permanent UUID attached yet. */ @Getter(AccessLevel.PACKAGE) - private final Set pendingSessions = ConcurrentHashMap.newKeySet(); + private final Set pendingSessions = ConcurrentHashMap.newKeySet(); /** * A list of all players who are currently in-game. */ @Getter - private final Map sessions = new ConcurrentHashMap<>(); + private final Map sessions = new ConcurrentHashMap<>(); /** * Called once the player has successfully authenticated to the Geyser server. */ - public void addPendingSession(GeyserSessionImpl session) { + public void addPendingSession(GeyserSession session) { pendingSessions.add(session); } /** * Called once a player has successfully logged into their Java server. */ - public void addSession(UUID uuid, GeyserSessionImpl session) { + public void addSession(UUID uuid, GeyserSession session) { pendingSessions.remove(session); sessions.put(uuid, session); } - public void removeSession(GeyserSessionImpl session) { + public void removeSession(GeyserSession session) { if (sessions.remove(session.getPlayerEntity().getUuid()) == null) { - // Session was likely pending + // Connection was likely pending pendingSessions.remove(session); } } @@ -70,16 +70,16 @@ public final class SessionManager { /** * Creates a new, immutable list containing all pending and active sessions. */ - public List getAllSessions() { - return ImmutableList.builder() // builderWithExpectedSize is probably not a good idea yet as older Spigot builds probably won't have it. + public List getAllSessions() { + return ImmutableList.builder() // builderWithExpectedSize is probably not a good idea yet as older Spigot builds probably won't have it. .addAll(pendingSessions) .addAll(sessions.values()) .build(); } public void disconnectAll(String message) { - Collection sessions = getAllSessions(); - for (GeyserSessionImpl session : sessions) { + Collection sessions = getAllSessions(); + for (GeyserSession session : sessions) { session.disconnect(GeyserLocale.getPlayerLocaleString(message, session.getLocale())); } } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java index d99f963ad..b6dde975c 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/AdvancementsCache.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSeenAdvancementsPacket; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.level.GeyserAdvancement; import org.geysermc.geyser.text.GeyserLocale; @@ -60,9 +60,9 @@ public class AdvancementsCache { @Setter private String currentAdvancementCategoryId = null; - private final GeyserSessionImpl session; + private final GeyserSession session; - public AdvancementsCache(GeyserSessionImpl session) { + public AdvancementsCache(GeyserSession session) { this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java index 55ed10df4..faaeafdb9 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BookEditCache.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket; import lombok.Setter; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * Manages updating the current writable book. @@ -37,7 +37,7 @@ import org.geysermc.geyser.session.GeyserSessionImpl; * book packets. Because of this, we need to ensure packets are only send every second or so at maximum. */ public class BookEditCache { - private final GeyserSessionImpl session; + private final GeyserSession session; @Setter private ServerboundEditBookPacket packet; /** @@ -45,7 +45,7 @@ public class BookEditCache { */ private long lastBookUpdate; - public BookEditCache(GeyserSessionImpl session) { + public BookEditCache(GeyserSession session) { this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java index 842be51d6..9595a3daf 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java @@ -32,12 +32,12 @@ import com.nukkitx.protocol.bedrock.packet.BossEventPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import lombok.AllArgsConstructor; import net.kyori.adventure.text.Component; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; @AllArgsConstructor public class BossBar { - private final GeyserSessionImpl session; + private final GeyserSession session; private final long entityId; private Component title; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java index eda21b9ce..522c00d2a 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/ChunkCache.java @@ -30,7 +30,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.chunk.GeyserChunk; import org.geysermc.geyser.util.MathUtils; @@ -51,7 +51,7 @@ public class ChunkCache { @Setter private boolean isExtendedHeight = false; - public ChunkCache(GeyserSessionImpl session) { + public ChunkCache(GeyserSession session) { this.cache = !session.getGeyser().getWorldManager().hasOwnChunkCache(); // To prevent Spigot from initializing chunks = cache ? new Long2ObjectOpenHashMap<>() : null; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java index 48b05fd70..eb1bc6e9a 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/EntityCache.java @@ -35,7 +35,7 @@ import lombok.Getter; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.*; import java.util.concurrent.atomic.AtomicLong; @@ -59,7 +59,7 @@ public class EntityCache { @Getter private final AtomicLong nextEntityId = new AtomicLong(2L); - public EntityCache(GeyserSessionImpl session) { + public EntityCache(GeyserSession session) { cachedPlayerEntityLinks.defaultReturnValue(-1L); } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java index e3e5f3b7c..6f7d180de 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/FormCache.java @@ -32,7 +32,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.RequiredArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.cumulus.Form; import org.geysermc.cumulus.SimpleForm; @@ -44,7 +44,7 @@ import java.util.function.Consumer; public class FormCache { private final AtomicInteger formId = new AtomicInteger(0); private final Int2ObjectMap forms = new Int2ObjectOpenHashMap<>(); - private final GeyserSessionImpl session; + private final GeyserSession session; public int addForm(Form form) { int windowId = formId.getAndIncrement(); diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java index a0809e590..05e59a5bb 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PistonCache.java @@ -34,7 +34,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.translator.level.block.entity.PistonBlockEntity; import org.geysermc.geyser.level.physics.Axis; @@ -44,7 +44,7 @@ import java.util.Map; @Getter public class PistonCache { @Getter(AccessLevel.PRIVATE) - private final GeyserSessionImpl session; + private final GeyserSession session; /** * Maps the position of a piston to its block entity @@ -84,7 +84,7 @@ public class PistonCache { @Setter private boolean playerAttachedToHoney = false; - public PistonCache(GeyserSessionImpl session) { + public PistonCache(GeyserSession session) { this.session = session; } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java index a2a9a6c1c..534045f81 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/PreferencesCache.java @@ -28,12 +28,12 @@ package org.geysermc.geyser.session.cache; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.CooldownUtils; @Getter public class PreferencesCache { - private final GeyserSessionImpl session; + private final GeyserSession session; /** * True if the client prefers being shown their coordinates, regardless if they're being shown or not. @@ -59,7 +59,7 @@ public class PreferencesCache { @Setter private CooldownUtils.CooldownType cooldownPreference = CooldownUtils.getDefaultShowCooldown(); - public PreferencesCache(GeyserSessionImpl session) { + public PreferencesCache(GeyserSession session) { this.session = session; prefersCustomSkulls = session.getGeyser().getConfig().isAllowCustomSkulls(); @@ -70,7 +70,7 @@ public class PreferencesCache { * * If {@link #prefersShowCoordinates} is true, coordinates will be shown, unless either of the following conditions apply:
*
- * {@link GeyserSessionImpl#reducedDebugInfo} is enabled + * {@link GeyserSession#reducedDebugInfo} is enabled * {@link GeyserConfiguration#isShowCoordinates()} is disabled */ public void updateShowCoordinates() { diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java index ac99623b5..5c486af49 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java @@ -35,7 +35,7 @@ import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import javax.annotation.Nonnull; import java.util.Collections; @@ -114,9 +114,9 @@ public class WorldBorder { */ private long lastUpdatedWorldBorderTime = 0; - private final GeyserSessionImpl session; + private final GeyserSession session; - public WorldBorder(GeyserSessionImpl session) { + public WorldBorder(GeyserSession session) { this.session = session; // Initialize all min/max/warning variables update(); @@ -300,7 +300,7 @@ public class WorldBorder { /** * Send the following fog IDs to the client */ - public static void sendFog(GeyserSessionImpl session, String... fogNameSpaces) { + public static void sendFog(GeyserSession session, String... fogNameSpaces) { PlayerFogPacket packet = new PlayerFogPacket(); Collections.addAll(packet.getFogStack(), fogNameSpaces); session.sendUpstreamPacket(packet); @@ -309,7 +309,7 @@ public class WorldBorder { /** * Clear any additional fog sent to the client */ - public static void removeFog(GeyserSessionImpl session) { + public static void removeFog(GeyserSession session) { session.sendUpstreamPacket(new PlayerFogPacket()); } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java index 59fe70ab2..a9564b157 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldCache.java @@ -28,19 +28,19 @@ package org.geysermc.geyser.session.cache; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import lombok.Getter; import lombok.Setter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.scoreboard.Scoreboard; import org.geysermc.geyser.scoreboard.ScoreboardUpdater.ScoreboardSession; @Getter public class WorldCache { - private final GeyserSessionImpl session; + private final GeyserSession session; private final ScoreboardSession scoreboardSession; private Scoreboard scoreboard; @Setter private Difficulty difficulty = Difficulty.EASY; - public WorldCache(GeyserSessionImpl session) { + public WorldCache(GeyserSession session) { this.session = session; this.scoreboard = new Scoreboard(session); scoreboardSession = new ScoreboardSession(session); diff --git a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java index 792adb654..5fc45c703 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java @@ -32,7 +32,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserLogger; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.Constants; import org.geysermc.geyser.util.PluginMessageUtils; import org.geysermc.floodgate.util.WebsocketEventType; @@ -111,7 +111,7 @@ public final class FloodgateSkinUploader { } String xuid = node.get("xuid").asText(); - GeyserSessionImpl session = geyser.sessionByXuid(xuid); + GeyserSession session = geyser.connectionByXuid(xuid); if (session != null) { if (!node.get("success").asBoolean()) { diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index 58721bb1c..05f49a664 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.auth.BedrockClientData; import org.geysermc.geyser.text.GeyserLocale; @@ -48,7 +48,7 @@ public class SkinManager { /** * Builds a Bedrock player list entry from our existing, cached Bedrock skin information */ - public static PlayerListPacket.Entry buildCachedEntry(GeyserSessionImpl session, PlayerEntity playerEntity) { + public static PlayerListPacket.Entry buildCachedEntry(GeyserSession session, PlayerEntity playerEntity) { GameProfileData data = GameProfileData.from(playerEntity.getProfile()); SkinProvider.Cape cape = SkinProvider.getCachedCape(data.capeUrl()); SkinProvider.SkinGeometry geometry = SkinProvider.SkinGeometry.getLegacy(data.isAlex()); @@ -74,7 +74,7 @@ public class SkinManager { /** * With all the information needed, build a Bedrock player entry with translated skin information. */ - public static PlayerListPacket.Entry buildEntryManually(GeyserSessionImpl session, UUID uuid, String username, long geyserId, + public static PlayerListPacket.Entry buildEntryManually(GeyserSession session, UUID uuid, String username, long geyserId, String skinId, byte[] skinData, String capeId, byte[] capeData, SkinProvider.SkinGeometry geometry) { @@ -86,7 +86,7 @@ public class SkinManager { // This attempts to find the XUID of the player so profile images show up for Xbox accounts String xuid = ""; - GeyserSessionImpl playerSession = GeyserImpl.getInstance().sessionByUuid(uuid); + GeyserSession playerSession = GeyserImpl.getInstance().connectionByUuid(uuid); if (playerSession != null) { xuid = playerSession.getAuthData().xuid(); @@ -112,7 +112,7 @@ public class SkinManager { return entry; } - public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSessionImpl session, + public static void requestAndHandleSkinAndCape(PlayerEntity entity, GeyserSession session, Consumer skinAndCapeConsumer) { GameProfileData data = GameProfileData.from(entity.getProfile()); @@ -280,7 +280,7 @@ public class SkinManager { String skinUrl = isAlex ? SkinProvider.EMPTY_SKIN_ALEX.getTextureUrl() : SkinProvider.EMPTY_SKIN.getTextureUrl(); String capeUrl = SkinProvider.EMPTY_CAPE.getTextureUrl(); if (("steve".equals(skinUrl) || "alex".equals(skinUrl)) && GeyserImpl.getInstance().getConfig().getRemote().getAuthType() != AuthType.ONLINE) { - GeyserSessionImpl session = GeyserImpl.getInstance().sessionByUuid(profile.getId()); + GeyserSession session = GeyserImpl.getInstance().connectionByUuid(profile.getId()); if (session != null) { skinUrl = session.getClientData().getSkinId(); diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java index 5b51d203b..a79ed5b7f 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java @@ -37,7 +37,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.util.WebUtils; @@ -143,7 +143,7 @@ public class SkinProvider { String newSkinUrl = skinUrl; if ("steve".equals(skinUrl) || "alex".equals(skinUrl)) { - GeyserSessionImpl session = GeyserImpl.getInstance().sessionByUuid(playerId); + GeyserSession session = GeyserImpl.getInstance().connectionByUuid(playerId); if (session != null) { newSkinUrl = session.getClientData().getSkinId(); diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java index c42b9522d..100f06caf 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkullSkinManager.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.skin.SerializedSkin; import com.nukkitx.protocol.bedrock.packet.PlayerSkinPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.GeyserLocale; import java.util.Collections; @@ -48,7 +48,7 @@ public class SkullSkinManager extends SkinManager { ); } - public static void requestAndHandleSkin(PlayerEntity entity, GeyserSessionImpl session, + public static void requestAndHandleSkin(PlayerEntity entity, GeyserSession session, Consumer skinConsumer) { GameProfileData data = GameProfileData.from(entity.getProfile()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java index 53fc0649f..964faab0a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/BlockCollision.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3i; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.level.physics.CollisionManager; import org.geysermc.geyser.level.physics.Axis; @@ -72,7 +72,7 @@ public class BlockCollision { * While the Java server should do this, it could result in false flags by anticheat * This functionality is currently only used in 6 or 7 layer snow */ - public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { double playerMinY = playerCollision.getMiddleY() - (playerCollision.getSizeY() / 2); for (BoundingBox b : this.boundingBoxes) { double boxMinY = (b.getMiddleY() + y) - (b.getSizeY() / 2); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java index 4379c68b1..3c858dc92 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/DoorCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @@ -59,7 +59,7 @@ public class DoorCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { boolean result = super.correctPosition(session, x, y, z, playerCollision); // Hack to prevent false positives playerCollision.setSizeX(playerCollision.getSizeX() - 0.0001); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java index 72f525151..fddc2e39b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/ScaffoldingCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; /** @@ -40,7 +40,7 @@ public class ScaffoldingCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { // Hack to not check below the player playerCollision.setSizeY(playerCollision.getSizeY() - 0.001); playerCollision.setMiddleY(playerCollision.getMiddleY() + 0.002); diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java index 39250282a..912d6a9b9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/SnowCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; @EqualsAndHashCode(callSuper = true) @@ -61,7 +61,7 @@ public class SnowCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { if (layers == 1) { // 1 layer of snow does not have collision return true; diff --git a/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java b/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java index f0d312b35..49b9f6c3f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java +++ b/core/src/main/java/org/geysermc/geyser/translator/collision/TrapdoorCollision.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.collision; import lombok.EqualsAndHashCode; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.level.physics.CollisionManager; @@ -67,7 +67,7 @@ public class TrapdoorCollision extends BlockCollision { } @Override - public boolean correctPosition(GeyserSessionImpl session, int x, int y, int z, BoundingBox playerCollision) { + public boolean correctPosition(GeyserSession session, int x, int y, int z, BoundingBox playerCollision) { boolean result = super.correctPosition(session, x, y, z, playerCollision); // Check for door bug (doors are 0.1875 blocks thick on Java but 0.1825 blocks thick on Bedrock) if (this.checkIntersection(x, y, z, playerCollision)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java index 525dfaf3e..d34f5195c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AbstractBlockInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.holder.InventoryHolder; import org.geysermc.geyser.inventory.updater.InventoryUpdater; @@ -65,27 +65,27 @@ public abstract class AbstractBlockInventoryTranslator extends BaseInventoryTran } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { holder.prepareInventory(this, session, inventory); } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { holder.openInventory(this, session, inventory); } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { holder.closeInventory(this, session, inventory); } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { + public void updateSlot(GeyserSession session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java index 486c500de..b7aaad7b1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/AnvilInventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.AnvilInventoryUpdater; @@ -77,7 +77,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { // The only property sent by Java is key 0 which is the level cost if (key != 0) return; AnvilContainer anvilContainer = (AnvilContainer) inventory; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java index f1db5e77c..becca359b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BaseInventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; @@ -41,7 +41,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator { } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { // } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java index f7e6ebe37..f0820d9e8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BeaconInventoryTranslator.java @@ -41,7 +41,7 @@ import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import org.geysermc.geyser.inventory.BeaconContainer; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -53,13 +53,13 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator public BeaconInventoryTranslator() { super(1, new BlockInventoryHolder("minecraft:beacon", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.BEACON) { @Override - protected boolean checkInteractionPosition(GeyserSessionImpl session) { + protected boolean checkInteractionPosition(GeyserSession session) { // Since we can't fall back to a virtual inventory, let's make opening one easier return true; } @Override - public void openInventory(InventoryTranslator translator, GeyserSessionImpl session, Inventory inventory) { + public void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { if (!((BeaconContainer) inventory).isUsingRealBlock()) { InventoryUtils.closeInventory(session, inventory.getId(), false); return; @@ -70,7 +70,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { //FIXME?: Beacon graphics look weird after inputting an item. This might be a Bedrock bug, since it resets to nothing // on BDS BeaconContainer beaconContainer = (BeaconContainer) inventory; @@ -109,7 +109,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // Input a beacon payment BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0]; ServerboundSetBeaconPacket packet = new ServerboundSetBeaconPacket(beaconPayment.getPrimaryEffect(), beaconPayment.getSecondaryEffect()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java index 03c0ef224..43bea55ab 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/BrewingInventoryTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; @@ -40,7 +40,7 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { super.openInventory(session, inventory); ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); dataPacket.setWindowId((byte) inventory.getId()); @@ -50,7 +50,7 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); dataPacket.setWindowId((byte) inventory.getId()); switch (key) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java index b4dd3048a..08caa7784 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/CartographyInventoryTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -42,7 +42,7 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { if (javaDestinationSlot == 0) { // Bedrock Edition can use paper or an empty map in slot 0 diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java index dd8b22fad..f18a902ff 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/EnchantingInventoryTranslator.java @@ -37,7 +37,7 @@ import org.geysermc.geyser.inventory.EnchantingContainer; import org.geysermc.geyser.inventory.GeyserEnchantOption; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; import org.geysermc.geyser.inventory.item.Enchantment; @@ -51,7 +51,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { int slotToUpdate; EnchantingContainer enchantingInventory = (EnchantingContainer) inventory; boolean shouldUpdate = false; @@ -109,7 +109,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // Client has requested an item to be enchanted CraftRecipeStackRequestActionData craftRecipeData = (CraftRecipeStackRequestActionData) request.getActions()[0]; EnchantingContainer enchantingInventory = (EnchantingContainer) inventory; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java index 2119a8aed..4265b39e3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/Generic3X3InventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import org.geysermc.geyser.inventory.Generic3X3Container; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; @@ -50,7 +50,7 @@ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTransla } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); // Required for opening the real block - otherwise, if the container type is incorrect, it refuses to open diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index 0e5fbbd90..d6bc4b186 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -46,7 +46,7 @@ import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.click.Click; @@ -109,12 +109,12 @@ public abstract class InventoryTranslator { public final int size; - public abstract void prepareInventory(GeyserSessionImpl session, Inventory inventory); - public abstract void openInventory(GeyserSessionImpl session, Inventory inventory); - public abstract void closeInventory(GeyserSessionImpl session, Inventory inventory); - public abstract void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value); - public abstract void updateInventory(GeyserSessionImpl session, Inventory inventory); - public abstract void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot); + public abstract void prepareInventory(GeyserSession session, Inventory inventory); + public abstract void openInventory(GeyserSession session, Inventory inventory); + public abstract void closeInventory(GeyserSession session, Inventory inventory); + public abstract void updateProperty(GeyserSession session, Inventory inventory, int key, int value); + public abstract void updateInventory(GeyserSession session, Inventory inventory); + public abstract void updateSlot(GeyserSession session, Inventory inventory, int slot); public abstract int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData); public abstract int javaSlotToBedrock(int javaSlot); public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot); @@ -129,7 +129,7 @@ public abstract class InventoryTranslator { * * @return true if this transfer should be rejected */ - public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { return false; } @@ -145,11 +145,11 @@ public abstract class InventoryTranslator { /** * If {@link #shouldHandleRequestFirst(StackRequestActionData, Inventory)} returns true, this will be called */ - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { return rejectRequest(request); } - public void translateRequests(GeyserSessionImpl session, Inventory inventory, List requests) { + public void translateRequests(GeyserSession session, Inventory inventory, List requests) { boolean refresh = false; ItemStackResponsePacket responsePacket = new ItemStackResponsePacket(); for (ItemStackRequest request : requests) { @@ -188,7 +188,7 @@ public abstract class InventoryTranslator { } } - public ItemStackResponsePacket.Response translateRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { ClickPlan plan = new ClickPlan(session, this, inventory); IntSet affectedSlots = new IntOpenHashSet(); for (StackRequestActionData action : request.getActions()) { @@ -410,7 +410,7 @@ public abstract class InventoryTranslator { return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots)); } - public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { int resultSize = 0; int timesCrafted; CraftState craftState = CraftState.START; @@ -511,7 +511,7 @@ public abstract class InventoryTranslator { return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots())); } - public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { int gridSize; int gridDimensions; if (this instanceof PlayerInventoryTranslator) { @@ -708,7 +708,7 @@ public abstract class InventoryTranslator { /** * Handled in {@link PlayerInventoryTranslator} */ - public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { return rejectRequest(request); } @@ -770,14 +770,14 @@ public abstract class InventoryTranslator { /** * Print out the contents of an ItemStackRequest, should the net ID check fail. */ - protected void dumpStackRequestDetails(GeyserSessionImpl session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) { + protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) { session.getGeyser().getLogger().error("Source: " + source.toString() + " Result: " + checkNetId(session, inventory, source)); session.getGeyser().getLogger().error("Destination: " + destination.toString() + " Result: " + checkNetId(session, inventory, destination)); session.getGeyser().getLogger().error("Geyser's record of source slot: " + inventory.getItem(bedrockSlotToJava(source))); session.getGeyser().getLogger().error("Geyser's record of destination slot: " + inventory.getItem(bedrockSlotToJava(destination))); } - public boolean checkNetId(GeyserSessionImpl session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { + public boolean checkNetId(GeyserSession session, Inventory inventory, StackRequestSlotInfoData slotInfoData) { int netId = slotInfoData.getStackNetworkId(); // "In my testing, sometimes the client thinks the netId of an item in the crafting grid is 1, even though we never said it was. // I think it only happens when we manually set the grid but that was my quick fix" @@ -835,7 +835,7 @@ public abstract class InventoryTranslator { return -1; } - public List makeContainerEntries(GeyserSessionImpl session, Inventory inventory, Set affectedSlots) { + public List makeContainerEntries(GeyserSession session, Inventory inventory, Set affectedSlots) { Map> containerMap = new HashMap<>(); for (int slot : affectedSlots) { BedrockContainerSlot bedrockSlot = javaSlotToBedrockContainer(slot); @@ -854,7 +854,7 @@ public abstract class InventoryTranslator { return containerEntries; } - public static ItemStackResponsePacket.ItemEntry makeItemEntry(GeyserSessionImpl session, int bedrockSlot, GeyserItemStack itemStack) { + public static ItemStackResponsePacket.ItemEntry makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) { ItemStackResponsePacket.ItemEntry itemEntry; if (!itemStack.isEmpty()) { // As of 1.16.210: Bedrock needs confirmation on what the current item durability is. diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java index 623b9e708..b59914a13 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LecternInventoryTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.LecternContainer; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.updater.InventoryUpdater; import org.geysermc.geyser.util.BlockEntityUtils; import org.geysermc.geyser.util.InventoryUtils; @@ -55,19 +55,19 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { if (key == 0) { // Lectern page update LecternContainer lecternContainer = (LecternContainer) inventory; lecternContainer.setCurrentBedrockPage(value / 2); @@ -77,7 +77,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { GeyserItemStack itemStack = inventory.getItem(0); if (!itemStack.isEmpty()) { updateBook(session, inventory, itemStack); @@ -85,7 +85,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { } @Override - public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { + public void updateSlot(GeyserSession session, Inventory inventory, int slot) { this.updater.updateSlot(this, session, inventory, slot); if (slot == 0) { updateBook(session, inventory, inventory.getItem(0)); @@ -95,7 +95,7 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator { /** * Translate the data of the book in the lectern into a block entity tag. */ - private void updateBook(GeyserSessionImpl session, Inventory inventory, GeyserItemStack book) { + private void updateBook(GeyserSession session, Inventory inventory, GeyserItemStack book) { LecternContainer lecternContainer = (LecternContainer) inventory; if (session.isDroppingLecternBook()) { // We have to enter the inventory GUI to eject the book diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java index fcdf68cd9..d035543bc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/LoomInventoryTranslator.java @@ -43,7 +43,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -102,7 +102,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { if (javaDestinationSlot != 1) { return false; @@ -125,7 +125,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { StackRequestActionData headerData = request.getActions()[0]; StackRequestActionData data = request.getActions()[1]; if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java index 9aaca1893..cf0c475f0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/MerchantInventoryTranslator.java @@ -39,7 +39,7 @@ import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.InventoryUpdater; @@ -92,7 +92,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { MerchantContainer merchantInventory = (MerchantContainer) inventory; if (merchantInventory.getVillager() == null) { long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); @@ -118,13 +118,13 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { //Handled in JavaMerchantOffersTranslator //TODO: send a blank inventory here in case the villager doesn't send a TradeList packet } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { MerchantContainer merchantInventory = (MerchantContainer) inventory; if (merchantInventory.getVillager() != null) { merchantInventory.getVillager().despawnEntity(); @@ -132,19 +132,19 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // We're not crafting here // Called at least by consoles when pressing a trade option button return translateRequest(session, inventory, request); } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { + public void updateSlot(GeyserSession session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java index 026bf5be3..19fe3f58a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/PlayerInventoryTranslator.java @@ -39,7 +39,7 @@ import it.unimi.dsi.fastutil.ints.IntSet; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -58,7 +58,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { updateCraftingGrid(session, inventory); InventoryContentPacket inventoryContentPacket = new InventoryContentPacket(); @@ -94,10 +94,10 @@ public class PlayerInventoryTranslator extends InventoryTranslator { /** * Update the crafting grid for the player to hide/show the barriers in the creative inventory - * @param session Session of the player + * @param session Connection of the player * @param inventory Inventory of the player */ - public static void updateCraftingGrid(GeyserSessionImpl session, Inventory inventory) { + public static void updateCraftingGrid(GeyserSession session, Inventory inventory) { // Crafting grid for (int i = 1; i < 5; i++) { InventorySlotPacket slotPacket = new InventorySlotPacket(); @@ -115,7 +115,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { + public void updateSlot(GeyserSession session, Inventory inventory, int slot) { if (slot >= 1 && slot <= 44) { InventorySlotPacket slotPacket = new InventorySlotPacket(); if (slot >= 9) { @@ -208,7 +208,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { if (session.getGameMode() != GameMode.CREATIVE) { return super.translateRequest(session, inventory, request); } @@ -365,7 +365,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { ItemStack javaCreativeItem = null; IntSet affectedSlots = new IntOpenHashSet(); CraftState craftState = CraftState.START; @@ -451,7 +451,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator { return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots)); } - private static void sendCreativeAction(GeyserSessionImpl session, Inventory inventory, int slot) { + private static void sendCreativeAction(GeyserSession session, Inventory inventory, int slot) { GeyserItemStack item = inventory.getItem(slot); ItemStack itemStack = item.isEmpty() ? new ItemStack(-1, 0, null) : item.getItemStack(); @@ -469,18 +469,18 @@ public class PlayerInventoryTranslator extends InventoryTranslator { } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java index 67d1a3989..f92474fb3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/ShulkerInventoryTranslator.java @@ -33,7 +33,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.updater.ContainerInventoryUpdater; @@ -51,7 +51,7 @@ public class ShulkerInventoryTranslator extends AbstractBlockInventoryTranslator } @Override - protected void setCustomName(GeyserSessionImpl session, Vector3i position, Inventory inventory, int javaBlockState) { + protected void setCustomName(GeyserSession session, Vector3i position, Inventory inventory, int javaBlockState) { NbtMapBuilder tag = NbtMap.builder() .putInt("x", position.getX()) .putInt("y", position.getY()) diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java index 816a32634..ed1f38799 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; import org.geysermc.geyser.inventory.StonecutterContainer; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.inventory.updater.UIInventoryUpdater; @@ -57,7 +57,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl } @Override - public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSessionImpl session, Inventory inventory, ItemStackRequest request) { + public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) { // TODO: Also surely to change in the future StackRequestActionData data = request.getActions()[1]; if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java index 94a7c624c..417aa5bf3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/ChestInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.translator.inventory.BaseInventoryTranslator; import org.geysermc.geyser.inventory.updater.ChestInventoryUpdater; @@ -42,7 +42,7 @@ public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { } @Override - public boolean shouldRejectItemPlace(GeyserSessionImpl session, Inventory inventory, ContainerSlotType bedrockSourceContainer, + public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer, int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) { // Reject any item placements that occur in the unusable inventory space if (bedrockSourceContainer == ContainerSlotType.CONTAINER && javaSourceSlot >= this.size) { @@ -52,12 +52,12 @@ public abstract class ChestInventoryTranslator extends BaseInventoryTranslator { } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { + public void updateSlot(GeyserSession session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java index 448fb3df7..a42001d34 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/DoubleChestInventoryTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.DoubleChestValue; import org.geysermc.geyser.translator.level.block.entity.DoubleChestBlockEntityTranslator; @@ -50,7 +50,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { // See BlockInventoryHolder - same concept there except we're also dealing with a specific block state if (session.getLastInteractionPlayerPosition().equals(session.getPlayerEntity().getPosition())) { int javaBlockId = session.getGeyser().getWorldManager().getBlockAt(session, session.getLastInteractionBlockPosition()); @@ -128,7 +128,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); containerOpenPacket.setId((byte) inventory.getId()); containerOpenPacket.setType(ContainerType.CONTAINER); @@ -138,7 +138,7 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { if (((Container) inventory).isUsingRealBlock()) { // No need to reset a block since we didn't change any blocks // But send a container close packet because we aren't destroying the original. diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java index a7e3b8ec7..86696b21b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/chest/SingleChestInventoryTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.chest; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.holder.BlockInventoryHolder; import org.geysermc.geyser.inventory.holder.InventoryHolder; @@ -52,17 +52,17 @@ public class SingleChestInventoryTranslator extends ChestInventoryTranslator { } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { holder.prepareInventory(this, session, inventory); } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { holder.openInventory(this, session, inventory); } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { holder.closeInventory(this, session, inventory); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java index f40586753..de7ea4de7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/furnace/AbstractFurnaceInventoryTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import org.geysermc.geyser.inventory.SlotType; import org.geysermc.geyser.translator.inventory.AbstractBlockInventoryTranslator; @@ -41,7 +41,7 @@ public abstract class AbstractFurnaceInventoryTranslator extends AbstractBlockIn } @Override - public void updateProperty(GeyserSessionImpl session, Inventory inventory, int key, int value) { + public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) { ContainerSetDataPacket dataPacket = new ContainerSetDataPacket(); dataPacket.setWindowId((byte) inventory.getId()); switch (key) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java index 689cb0a9d..b4c49cb12 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/AbstractHorseInventoryTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.horse; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.BaseInventoryTranslator; import org.geysermc.geyser.inventory.updater.HorseInventoryUpdater; import org.geysermc.geyser.inventory.updater.InventoryUpdater; @@ -40,24 +40,24 @@ public abstract class AbstractHorseInventoryTranslator extends BaseInventoryTran } @Override - public void prepareInventory(GeyserSessionImpl session, Inventory inventory) { + public void prepareInventory(GeyserSession session, Inventory inventory) { } @Override - public void openInventory(GeyserSessionImpl session, Inventory inventory) { + public void openInventory(GeyserSession session, Inventory inventory) { } @Override - public void closeInventory(GeyserSessionImpl session, Inventory inventory) { + public void closeInventory(GeyserSession session, Inventory inventory) { } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { updater.updateInventory(this, session, inventory); } @Override - public void updateSlot(GeyserSessionImpl session, Inventory inventory, int slot) { + public void updateSlot(GeyserSession session, Inventory inventory, int slot) { updater.updateSlot(this, session, inventory, slot); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java index 8866af56e..79f34da57 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/horse/ChestedHorseInventoryTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.inventory.BedrockContainerSlot; import java.util.Arrays; @@ -85,7 +85,7 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven } @Override - public void updateInventory(GeyserSessionImpl session, Inventory inventory) { + public void updateInventory(GeyserSession session, Inventory inventory) { ItemData[] bedrockItems = new ItemData[36]; for (int i = 0; i < 36; i++) { final int offset = i < 9 ? 27 : -9; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java index 427b70a65..046db67c9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/ItemTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMapping; @@ -126,7 +126,7 @@ public abstract class ItemTranslator { } @Nonnull - public static ItemData translateToBedrock(GeyserSessionImpl session, ItemStack stack) { + public static ItemData translateToBedrock(GeyserSession session, ItemStack stack) { if (stack == null) { return ItemData.AIR; } @@ -402,7 +402,7 @@ public abstract class ItemTranslator { * * @return the new tag to use, should the current one be null */ - public static CompoundTag translateDisplayProperties(GeyserSessionImpl session, CompoundTag tag, ItemMapping mapping) { + public static CompoundTag translateDisplayProperties(GeyserSession session, CompoundTag tag, ItemMapping mapping) { return translateDisplayProperties(session, tag, mapping, 'f'); } @@ -410,7 +410,7 @@ public abstract class ItemTranslator { * @param translationColor if this item is not available on Java, the color that the new name should be. * Normally, this should just be white, but for shulker boxes this should be gray. */ - public static CompoundTag translateDisplayProperties(GeyserSessionImpl session, CompoundTag tag, ItemMapping mapping, char translationColor) { + public static CompoundTag translateDisplayProperties(GeyserSession session, CompoundTag tag, ItemMapping mapping, char translationColor) { boolean hasCustomName = false; if (tag != null) { CompoundTag display = tag.get("display"); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java index c9c4dc5d4..6c2c501fd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/NbtItemStackTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.type.ItemMapping; public class NbtItemStackTranslator { @@ -37,7 +37,7 @@ public class NbtItemStackTranslator { * @param itemTag the item's CompoundTag * @param mapping Geyser's item mapping */ - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java index 418023766..071ead230 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/AxolotlBucketTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -38,7 +38,7 @@ import org.geysermc.geyser.text.MinecraftLocale; public class AxolotlBucketTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { // Bedrock Edition displays the properties of the axolotl. Java does not. // To work around this, set the custom name to the Axolotl translation and it's displayed correctly itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java index 83279671e..10ad58544 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BasicItemTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; @@ -40,7 +40,7 @@ import java.util.List; public class BasicItemTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { Tag damage = itemTag.get("Damage"); if (damage instanceof IntTag) { int originalDurability = ((IntTag) damage).getValue(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java index d24018287..b3371aab7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/BookPagesTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -42,7 +42,7 @@ import java.util.List; public class BookPagesTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("pages")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java index f74129eab..e1dda45ed 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/CrossbowTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.opennbt.tag.builtin.*; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class CrossbowTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { if (itemTag.get("ChargedProjectiles") != null) { ListTag chargedProjectiles = itemTag.get("ChargedProjectiles"); if (!chargedProjectiles.getValue().isEmpty()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java index aac5caa92..8a009bc2d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantedBookTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class EnchantedBookTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("StoredEnchantments")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java index f011c7045..ddc5f3780 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/EnchantmentTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.inventory.item.Enchantment; @@ -41,7 +41,7 @@ import java.util.Map; public class EnchantmentTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { List newTags = new ArrayList<>(); Tag enchantmentTag = itemTag.get("Enchantments"); if (enchantmentTag instanceof ListTag listTag) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java index 25b498277..8c1154dea 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkRocketTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.util.MathUtils; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.MathUtils; public class FireworkRocketTranslator extends FireworkBaseTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { CompoundTag fireworks = itemTag.get("Fireworks"); if (fireworks == null) { return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java index c1ff272f2..e66589f6d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/FireworkStarTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntArrayTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class FireworkStarTranslator extends FireworkBaseTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { Tag explosion = itemTag.get("Explosion"); if (explosion instanceof CompoundTag) { CompoundTag newExplosion = translateExplosionToBedrock((CompoundTag) explosion, "FireworksItem"); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java index c66968124..ddf76b595 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LeatherArmorTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.IntTag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -42,7 +42,7 @@ public class LeatherArmorTranslator extends NbtItemStackTranslator { "minecraft:leather_leggings", "minecraft:leather_boots", "minecraft:leather_horse_armor"); @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { CompoundTag displayTag = itemTag.get("display"); if (displayTag == null) { return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java index ca4cd2fcb..924735626 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/LodestoneCompassTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -35,7 +35,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class LodestoneCompassTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { Tag lodestoneTag = itemTag.get("LodestoneTracked"); if (lodestoneTag instanceof ByteTag) { int trackId = session.getLodestoneCache().store(itemTag); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java index 1d96db42a..23739340e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/MapItemTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -35,7 +35,7 @@ import org.geysermc.geyser.registry.type.ItemMapping; public class MapItemTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { // Can be either an IntTag or ShortTag Tag mapId = itemTag.get("map"); if (mapId == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java index 18ccde054..1e182568a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/PlayerHeadTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -38,7 +38,7 @@ import org.geysermc.geyser.text.MinecraftLocale; public class PlayerHeadTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("display") || !((CompoundTag) itemTag.get("display")).contains("Name")) { if (itemTag.contains("SkullOwner")) { StringTag name; diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java index 4182278d6..f4160ec08 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/ShulkerBoxItemTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory.item.nbt; import com.github.steveice10.mc.protocol.data.game.Identifier; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.MathUtils; public class ShulkerBoxItemTranslator extends NbtItemStackTranslator { @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { if (!itemTag.contains("BlockEntityTag")) return; // Empty shulker box CompoundTag blockEntityTag = itemTag.get("BlockEntityTag"); diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java index 7c396fd28..316ebc1ae 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/item/nbt/TropicalFishBucketTranslator.java @@ -31,7 +31,7 @@ import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.Style; import net.kyori.adventure.text.format.TextDecoration; import org.geysermc.geyser.entity.type.living.animal.TropicalFishEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemRemapper; import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.inventory.item.NbtItemStackTranslator; @@ -47,7 +47,7 @@ public class TropicalFishBucketTranslator extends NbtItemStackTranslator { private static final Style LORE_STYLE = Style.style(NamedTextColor.GRAY, TextDecoration.ITALIC); @Override - public void translateToBedrock(GeyserSessionImpl session, CompoundTag itemTag, ItemMapping mapping) { + public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) { // Prevent name from appearing as "Bucket of" itemTag.put(new ByteTag("AppendCustomName", (byte) 1)); itemTag.put(new StringTag("CustomName", MinecraftLocale.getLocaleString("entity.minecraft.tropical_fish", session.getLocale()))); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java index 2358b197d..6cafb6012 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/BiomeTranslator.java @@ -35,7 +35,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.chunk.BlockStorage; import org.geysermc.geyser.level.chunk.GeyserChunkSection; import org.geysermc.geyser.level.chunk.bitarray.BitArray; @@ -47,7 +47,7 @@ import org.geysermc.geyser.util.MathUtils; // Array index formula by https://wiki.vg/Chunk_Format public class BiomeTranslator { - public static void loadServerBiomes(GeyserSessionImpl session, CompoundTag codec) { + public static void loadServerBiomes(GeyserSession session, CompoundTag codec) { Int2IntMap biomeTranslations = session.getBiomeTranslations(); biomeTranslations.clear(); @@ -87,7 +87,7 @@ public class BiomeTranslator { } } - public static BlockStorage toNewBedrockBiome(GeyserSessionImpl session, DataPalette biomeData) { + public static BlockStorage toNewBedrockBiome(GeyserSession session, DataPalette biomeData) { Int2IntMap biomeTranslations = session.getBiomeTranslations(); // As of 1.17.10: the client expects the same format as a chunk but filled with biomes // As of 1.18 this is the same as Java Edition diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java index af1eea293..3534e5be7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BedrockOnlyBlockEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * Implemented only if a block is a block entity in Bedrock and not Java Edition. @@ -42,11 +42,11 @@ public interface BedrockOnlyBlockEntity extends RequiresBlockState { /** * Update the block on Bedrock Edition. - * @param session GeyserSession. + * @param session GeyserConnection. * @param blockState The Java block state. * @param position The Bedrock block position. */ - void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position); + void updateBlock(GeyserSession session, int blockState, Vector3i position); /** * Get the tag of the Bedrock-only block entity @@ -54,7 +54,7 @@ public interface BedrockOnlyBlockEntity extends RequiresBlockState { * @param blockState Java BlockState of block. * @return Bedrock tag, or null if not a Bedrock-only Block Entity */ - static NbtMap getTag(GeyserSessionImpl session, Vector3i position, int blockState) { + static NbtMap getTag(GeyserSession session, Vector3i position, int blockState) { if (FlowerPotBlockEntityTranslator.isFlowerBlock(blockState)) { return FlowerPotBlockEntityTranslator.getTag(session, blockState, position); } else if (PistonBlockEntityTranslator.isBlock(blockState)) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java index 9fe087cb9..e41f9e492 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.DoubleChestValue; import org.geysermc.geyser.util.BlockEntityUtils; @@ -45,7 +45,7 @@ public class DoubleChestBlockEntityTranslator extends BlockEntityTranslator impl } @Override - public void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position) { + public void updateBlock(GeyserSession session, int blockState, Vector3i position) { CompoundTag javaTag = getConstantJavaTag("chest", position.getX(), position.getY(), position.getZ()); NbtMapBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(BlockEntityType.CHEST), position.getX(), position.getY(), position.getZ()); translateTag(tagBuilder, javaTag, blockState); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java index 01d3952a6..b6c498d9f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/FlowerPotBlockEntityTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.util.BlockEntityUtils; @@ -49,7 +49,7 @@ public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity { * @param position Bedrock position of flower pot. * @return Bedrock tag of flower pot. */ - public static NbtMap getTag(GeyserSessionImpl session, int blockState, Vector3i position) { + public static NbtMap getTag(GeyserSession session, int blockState, Vector3i position) { NbtMapBuilder tagBuilder = NbtMap.builder() .putInt("x", position.getX()) .putInt("y", position.getY()) @@ -75,7 +75,7 @@ public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity { } @Override - public void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position) { + public void updateBlock(GeyserSession session, int blockState, Vector3i position) { NbtMap tag = getTag(session, blockState, position); BlockEntityUtils.updateBlockEntity(session, tag, position); UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java index db29afc6f..1d61d0e30 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/NoteblockBlockEntityTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; /** @@ -36,7 +36,7 @@ import org.geysermc.geyser.level.block.BlockStateValues; */ public class NoteblockBlockEntityTranslator { - public static void translate(GeyserSessionImpl session, Position position) { + public static void translate(GeyserSession session, Position position) { int blockState = session.getGeyser().getWorldManager().getBlockAt(session, position); BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(position.getX(), position.getY(), position.getZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java index 44d87a70c..1363f6641 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/PistonBlockEntity.java @@ -39,7 +39,7 @@ import lombok.Getter; import org.geysermc.common.PlatformType; import org.geysermc.geyser.level.physics.Axis; import org.geysermc.geyser.level.physics.Direction; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.level.physics.BoundingBox; import org.geysermc.geyser.level.physics.CollisionManager; @@ -54,7 +54,7 @@ import java.util.Queue; import java.util.Set; public class PistonBlockEntity { - private final GeyserSessionImpl session; + private final GeyserSession session; @Getter private final Vector3i position; private final Direction orientation; @@ -104,7 +104,7 @@ public class PistonBlockEntity { HONEY_BOUNDING_BOX = new BoundingBox(0.5, honeyHeight + boundingBoxHeight / 2, 0.5, blockBoundingBox.getSizeX(), boundingBoxHeight, blockBoundingBox.getSizeZ()); } - public PistonBlockEntity(GeyserSessionImpl session, Vector3i position, Direction orientation, boolean sticky, boolean extended) { + public PistonBlockEntity(GeyserSession session, Vector3i position, Direction orientation, boolean sticky, boolean extended) { this.session = session; this.position = position; this.orientation = orientation; diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java index 6bdc8e16f..b6b41db6d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SkullBlockEntityTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.skin.SkinProvider; import org.geysermc.geyser.skin.SkullSkinManager; @@ -85,7 +85,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements return CompletableFuture.completedFuture(null); } - public static void spawnPlayer(GeyserSessionImpl session, CompoundTag tag, int posX, int posY, int posZ, int blockState) { + public static void spawnPlayer(GeyserSession session, CompoundTag tag, int posX, int posY, int posZ, int blockState) { float x = posX + .5f; float y = posY - .01f; float z = posZ + .5f; @@ -123,7 +123,7 @@ public class SkullBlockEntityTranslator extends BlockEntityTranslator implements }); } - private static void spawnPlayer(GeyserSessionImpl session, GameProfile profile, Vector3i blockPosition, + private static void spawnPlayer(GeyserSession session, GameProfile profile, Vector3i blockPosition, Vector3f entityPosition, float rotation, int blockState) { long geyserId = session.getEntityCache().getNextEntityId().incrementAndGet(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java index 34fe04a76..c06998af4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/LevelEventTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * Represents an event capable of translating itself into bedrock @@ -35,8 +35,8 @@ public interface LevelEventTranslator { /** * Translates the given {@link ClientboundLevelEventPacket} into bedrock and sends it upstream. * - * @param session GeyserSession + * @param session GeyserConnection * @param packet the effect packet to handle */ - void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet); + void translate(GeyserSession session, ClientboundLevelEventPacket packet); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java index 6d976989f..df882d0d0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/PlaySoundEventTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.event; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; @@ -36,7 +36,7 @@ import java.util.concurrent.ThreadLocalRandom; public record PlaySoundEventTranslator(String name, float volume, boolean pitchSub, float pitchMul, float pitchAdd, boolean relative) implements LevelEventTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { Random rand = ThreadLocalRandom.current(); PlaySoundPacket playSoundPacket = new PlaySoundPacket(); playSoundPacket.setSound(name); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java index b12065744..5c3e890a2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundEventEventTranslator.java @@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public record SoundEventEventTranslator(SoundEvent soundEvent, String identifier, int extraData) implements LevelEventTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { LevelSoundEventPacket levelSoundEvent = new LevelSoundEventPacket(); levelSoundEvent.setSound(soundEvent); levelSoundEvent.setIdentifier(identifier); diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java index b5414bc40..48a4bf2fd 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/event/SoundLevelEventTranslator.java @@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public record SoundLevelEventTranslator(LevelEventType levelEventType, int data) implements LevelEventTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { LevelEventPacket eventPacket = new LevelEventPacket(); eventPacket.setType(levelEventType); eventPacket.setData(data); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java index 1045e8ef8..37485120d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/PacketTranslator.java @@ -25,11 +25,11 @@ package org.geysermc.geyser.translator.protocol; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public abstract class PacketTranslator { - public abstract void translate(GeyserSessionImpl session, T packet); + public abstract void translate(GeyserSession session, T packet); /** * Determines if this packet should be handled in the session's event loop. This should generally be true - diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java index 5a29d4a24..d4de9e22a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAdventureSettingsTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.nukkitx.protocol.bedrock.data.AdventureSetting; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockAdventureSettingsTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, AdventureSettingsPacket packet) { + public void translate(GeyserSession session, AdventureSettingsPacket packet) { boolean isFlying = packet.getSettings().contains(AdventureSetting.FLYING); if (!isFlying && session.getGameMode() == GameMode.SPECTATOR) { // We should always be flying in spectator mode diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java index b03272a87..d52a66be7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockAnimateTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundPaddleBoatPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit; public class BedrockAnimateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, AnimatePacket packet) { + public void translate(GeyserSession session, AnimatePacket packet) { // Stop the player sending animations before they have fully spawned into the server if (!session.isSpawned()) { return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java index 8c5e449c5..828f5a934 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockEntityDataTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.SignUtils; @@ -39,7 +39,7 @@ import org.geysermc.geyser.util.SignUtils; public class BedrockBlockEntityDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, BlockEntityDataPacket packet) { + public void translate(GeyserSession session, BlockEntityDataPacket packet) { NbtMap tag = packet.getData(); if (tag.getString("id").equals("Sign")) { // This is the reason why this all works - Bedrock sends packets every time you update the sign, Java only wants the final packet diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java index 87a433567..a0bd43455 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBlockPickRequestTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.BlockPickRequestPacket; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.ItemFrameEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class BedrockBlockPickRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, BlockPickRequestPacket packet) { + public void translate(GeyserSession session, BlockPickRequestPacket packet) { Vector3i vector = packet.getBlockPosition(); int blockToPick = session.getGeyser().getWorldManager().getBlockAt(session, vector.getX(), vector.getY(), vector.getZ()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java index 3d113d8d3..bead427db 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockBookEditTranslator.java @@ -33,7 +33,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.protocol.bedrock.packet.BookEditPacket; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -49,7 +49,7 @@ public class BedrockBookEditTranslator extends PacketTranslator private static final int MAXIMUM_TITLE_LENGTH = 128 * 4; @Override - public void translate(GeyserSessionImpl session, BookEditPacket packet) { + public void translate(GeyserSession session, BookEditPacket packet) { if (packet.getText() != null && !packet.getText().isEmpty() && packet.getText().getBytes(StandardCharsets.UTF_8).length > MAXIMUM_PAGE_LENGTH) { session.getGeyser().getLogger().warning("Page length greater than server allowed!"); return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java index 4f6750444..f0cf4ff8c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandBlockUpdateTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockCommandBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, CommandBlockUpdatePacket packet) { + public void translate(GeyserSession session, CommandBlockUpdatePacket packet) { String command = packet.getCommand(); boolean outputTracked = packet.isOutputTracked(); if (packet.isBlock()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java index bc25acc16..a67b81434 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockCommandRequestTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandManager; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class BedrockCommandRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, CommandRequestPacket packet) { + public void translate(GeyserSession session, CommandRequestPacket packet) { String command = packet.getCommand().replace("/", ""); CommandManager commandManager = GeyserImpl.getInstance().getCommandManager(); if (session.getGeyser().getPlatformType() == PlatformType.STANDALONE && command.trim().startsWith("geyser ") && commandManager.getCommands().containsKey(command.split(" ")[1])) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java index 00cf6607c..4c1f55018 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.InventoryUtils; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class BedrockContainerCloseTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ContainerClosePacket packet) { + public void translate(GeyserSession session, ContainerClosePacket packet) { byte windowId = packet.getId(); //Client wants close confirmation diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java index 1f5ad7c15..dac5fe638 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEmoteListTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.EmoteListPacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockEmoteListTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, EmoteListPacket packet) { + public void translate(GeyserSession session, EmoteListPacket packet) { if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() == EmoteOffhandWorkaroundOption.NO_EMOTES) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java index 9ea36061e..732142573 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.nukkitx.protocol.bedrock.packet.EntityPickRequestPacket; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.type.ItemMapping; @@ -44,7 +44,7 @@ import java.util.Locale; public class BedrockEntityPickRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, EntityPickRequestPacket packet) { + public void translate(GeyserSession session, EntityPickRequestPacket packet) { if (session.getGameMode() != GameMode.CREATIVE) return; // Apparently Java behavior Entity entity = session.getEntityCache().getEntityByGeyserId(packet.getRuntimeEntityId()); if (entity == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java index 520aa8d93..b7961c8fb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockFilterTextTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.nukkitx.protocol.bedrock.packet.FilterTextPacket; import org.geysermc.geyser.inventory.AnvilContainer; import org.geysermc.geyser.inventory.CartographyContainer; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -43,7 +43,7 @@ import org.geysermc.geyser.util.ItemUtils; public class BedrockFilterTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, FilterTextPacket packet) { + public void translate(GeyserSession session, FilterTextPacket packet) { if (session.getOpenInventory() instanceof CartographyContainer) { // We don't want to be able to rename in the cartography table return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java index 2ad827b9d..d779ab339 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockInventoryTransactionTranslator.java @@ -45,7 +45,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; @@ -70,7 +70,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ItemFrameDropItemPacket packet) { + public void translate(GeyserSession session, ItemFrameDropItemPacket packet) { Entity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition()); if (entity != null) { ServerboundInteractPacket interactPacket = new ServerboundInteractPacket((int) entity.getEntityId(), diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java index afa9992f9..efa0dabcc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockItemStackRequestTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.inventory.InventoryTranslator; public class BedrockItemStackRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ItemStackRequestPacket packet) { + public void translate(GeyserSession session, ItemStackRequestPacket packet) { Inventory inventory = session.getOpenInventory(); if (inventory == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java index b6c7a8626..d7e97825c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockLecternUpdateTranslator.java @@ -33,7 +33,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket; import com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket; import org.geysermc.geyser.inventory.LecternContainer; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.InventoryUtils; @@ -45,7 +45,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class BedrockLecternUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, LecternUpdatePacket packet) { + public void translate(GeyserSession session, LecternUpdatePacket packet) { if (packet.isDroppingBook()) { // Bedrock drops the book outside of the GUI. Java drops it in the GUI // So, we enter the GUI and then drop it! :) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java index 4297f6d2c..788f65134 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMapInfoRequestTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.packet.MapInfoRequestPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; public class BedrockMapInfoRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, MapInfoRequestPacket packet) { + public void translate(GeyserSession session, MapInfoRequestPacket packet) { long mapId = packet.getUniqueMapId(); ClientboundMapItemDataPacket mapPacket = session.getStoredMaps().remove(mapId); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java index fa42a3c39..7a077c8b3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMobEquipmentTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.CooldownUtils; @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; public class BedrockMobEquipmentTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, MobEquipmentPacket packet) { + public void translate(GeyserSession session, MobEquipmentPacket packet) { if (!session.isSpawned() || packet.getHotbarSlot() > 8 || packet.getContainerId() != ContainerId.INVENTORY || session.getPlayerInventory().getHeldItemSlot() == packet.getHotbarSlot()) { // For the last condition - Don't update the slot if the slot is the same - not Java Edition behavior and messes with plugins such as Grief Prevention diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java index ff6795d26..6d971daeb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -42,7 +42,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, MoveEntityAbsolutePacket packet) { + public void translate(GeyserSession session, MoveEntityAbsolutePacket packet) { session.setLastVehicleMoveTimestamp(System.currentTimeMillis()); Entity ridingEntity = session.getRidingVehicleEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java index 238ed86aa..9ecce9a57 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockNetworkStackLatencyTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.floodgate.util.DeviceOs; @@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit; public class BedrockNetworkStackLatencyTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, NetworkStackLatencyPacket packet) { + public void translate(GeyserSession session, NetworkStackLatencyPacket packet) { long pingId; // so apparently, as of 1.16.200 // PS4 divides the network stack latency timestamp FOR US!!! diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java index d0bb391d4..f3967ddf5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPacketViolationWarningTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.PacketViolationWarningPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockPacketViolationWarningTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, PacketViolationWarningPacket packet) { + public void translate(GeyserSession session, PacketViolationWarningPacket packet) { // Not translated since this is something that the developers need to know session.getGeyser().getLogger().error("Packet violation warning sent from client! " + packet.toString()); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java index ef394aa8c..75199ae74 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPlayerInputTranslator.java @@ -34,7 +34,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; import org.geysermc.geyser.entity.type.living.animal.horse.LlamaEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -45,7 +45,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockPlayerInputTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, PlayerInputPacket packet) { + public void translate(GeyserSession session, PlayerInputPacket packet) { ServerboundPlayerInputPacket playerInputPacket = new ServerboundPlayerInputPacket( packet.getInputMotion().getX(), packet.getInputMotion().getY(), packet.isJumping(), packet.isSneaking() ); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java index 19c9f702f..59082ccdc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockPositionTrackingDBClientRequestTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtType; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket; import com.nukkitx.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.LodestoneCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class BedrockPositionTrackingDBClientRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, PositionTrackingDBClientRequestPacket packet) { + public void translate(GeyserSession session, PositionTrackingDBClientRequestPacket packet) { PositionTrackingDBServerBroadcastPacket broadcastPacket = new PositionTrackingDBServerBroadcastPacket(); broadcastPacket.setTrackingId(packet.getTrackingId()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java index e3f259394..59712da7f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockRespawnTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import com.nukkitx.protocol.bedrock.packet.RespawnPacket; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockRespawnTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, RespawnPacket packet) { + public void translate(GeyserSession session, RespawnPacket packet) { if (packet.getState() == RespawnPacket.State.CLIENT_READY) { // Previously we only sent the respawn packet before the server finished loading // The message included was 'Otherwise when immediate respawn is on the client never loads' diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java index 281cbb085..1840c9b0d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockServerSettingsRequestTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.ServerSettingsRequestPacket; import com.nukkitx.protocol.bedrock.packet.ServerSettingsResponsePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.SettingsUtils; @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit; @Translator(packet = ServerSettingsRequestPacket.class) public class BedrockServerSettingsRequestTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ServerSettingsRequestPacket packet) { + public void translate(GeyserSession session, ServerSettingsRequestPacket packet) { CustomForm window = SettingsUtils.buildForm(session); int windowId = session.getFormCache().addForm(window); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index e81b8f30f..bc6d1f4e4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.nukkitx.protocol.bedrock.packet.SetLocalPlayerAsInitializedPacket; import org.geysermc.geyser.session.auth.AuthType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.LoginEncryptionUtils; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.LoginEncryptionUtils; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, SetLocalPlayerAsInitializedPacket packet) { + public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) { if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) { if (!session.getUpstream().isInitialized()) { session.getUpstream().setInitialized(true); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java index 719cf190c..19797b8a2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockShowCreditsTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket; public class BedrockShowCreditsTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ShowCreditsPacket packet) { + public void translate(GeyserSession session, ShowCreditsPacket packet) { if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) { ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN); session.sendDownstreamPacket(javaRespawnPacket); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java index a1fbe6622..3cf121cf9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class BedrockTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, TextPacket packet) { + public void translate(GeyserSession session, TextPacket packet) { String message = packet.getMessage(); if (message.isBlank()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java index 88f44a719..775ec15b5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/BedrockEntityEventTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.MerchantContainer; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit; public class BedrockEntityEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, EntityEventPacket packet) { + public void translate(GeyserSession session, EntityEventPacket packet) { switch (packet.getType()) { case EATING_ITEM -> { // Resend the packet so we get the eating sounds diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java index 58c4b7822..711285948 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java @@ -40,7 +40,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -54,7 +54,7 @@ import java.util.ArrayList; public class BedrockActionTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, PlayerActionPacket packet) { + public void translate(GeyserSession session, PlayerActionPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); // Send book update before any player action diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java index 62f0dddcf..a4fe12d4e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockEmoteTranslator.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.nukkitx.protocol.bedrock.packet.EmotePacket; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.BlockUtils; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.BlockUtils; public class BedrockEmoteTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, EmotePacket packet) { + public void translate(GeyserSession session, EmotePacket packet) { if (session.getGeyser().getConfig().getEmoteOffhandWorkaround() != EmoteOffhandWorkaroundOption.DISABLED) { // Activate the workaround - we should trigger the offhand now ServerboundPlayerActionPacket swapHandsPacket = new ServerboundPlayerActionPacket(PlayerAction.SWAP_HANDS, BlockUtils.POSITION_ZERO, @@ -53,7 +53,7 @@ public class BedrockEmoteTranslator extends PacketTranslator { } long javaId = session.getPlayerEntity().getEntityId(); - for (GeyserSessionImpl otherSession : session.getGeyser().getSessionManager().getSessions().values()) { + for (GeyserSession otherSession : session.getGeyser().getSessionManager().getSessions().values()) { if (otherSession != session) { if (otherSession.isClosed()) continue; if (otherSession.getEventLoop().inEventLoop()) { @@ -65,7 +65,7 @@ public class BedrockEmoteTranslator extends PacketTranslator { } } - private void playEmote(GeyserSessionImpl otherSession, long javaId, String emoteId) { + private void playEmote(GeyserSession otherSession, long javaId, String emoteId) { Entity otherEntity = otherSession.getEntityCache().getEntityByJavaId(javaId); // Must be ran on same thread if (otherEntity == null) return; EmotePacket otherEmotePacket = new EmotePacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java index a32d9808f..26a25725e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockInteractTranslator.java @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.InteractPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.entity.InteractiveTagManager; @@ -46,7 +46,7 @@ import org.geysermc.geyser.entity.InteractiveTagManager; public class BedrockInteractTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, InteractPacket packet) { + public void translate(GeyserSession session, InteractPacket packet) { Entity entity; if (packet.getRuntimeEntityId() == session.getPlayerEntity().getGeyserId()) { //Player is not in entity cache diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java index ecf0b2225..76d7edc17 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -47,7 +47,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, RiderJumpPacket packet) { + public void translate(GeyserSession session, RiderJumpPacket packet) { Entity vehicle = session.getRidingVehicleEntity(); if (vehicle instanceof AbstractHorseEntity) { ServerboundPlayerCommandPacket playerCommandPacket = new ServerboundPlayerCommandPacket((int) vehicle.getEntityId(), PlayerState.START_HORSE_JUMP, packet.getJumpStrength()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java index f57d7957a..b149f8836 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockSetPlayerGameTypeTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.entity.player; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class BedrockSetPlayerGameTypeTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, SetPlayerGameTypePacket packet) { + public void translate(GeyserSession session, SetPlayerGameTypePacket packet) { // no SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket(); playerGameTypePacket.setGamemode(session.getGameMode().ordinal()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java index 9969e55f4..2ac8587bf 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/world/BedrockLevelSoundEventTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.bedrock.world; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.CooldownUtils; @@ -36,7 +36,7 @@ import org.geysermc.geyser.util.CooldownUtils; public class BedrockLevelSoundEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, LevelSoundEventPacket packet) { + public void translate(GeyserSession session, LevelSoundEventPacket packet) { // lol what even :thinking: session.sendUpstreamPacket(packet); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java index eb3b52040..8f4e93635 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaAwardStatsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.StatisticsUtils; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.StatisticsUtils; public class JavaAwardStatsTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAwardStatsPacket packet) { + public void translate(GeyserSession session, ClientboundAwardStatsPacket packet) { session.updateStatistics(packet.getStatistics()); if (session.isWaitingForStatistics()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java index c15ea56dd..2c49baa56 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java @@ -25,7 +25,7 @@ package org.geysermc.geyser.translator.protocol.java; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.BossBar; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundBo public class JavaBossEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundBossEventPacket packet) { + public void translate(GeyserSession session, ClientboundBossEventPacket packet) { BossBar bossBar = session.getEntityCache().getBossBar(packet.getUuid()); switch (packet.getAction()) { case ADD: diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java index 9aa747187..e0c3a9b95 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChangeDifficultyTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.SetDifficultyPacket; public class JavaChangeDifficultyTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundChangeDifficultyPacket packet) { + public void translate(GeyserSession session, ClientboundChangeDifficultyPacket packet) { SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket(); setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal()); session.sendUpstreamPacket(setDifficultyPacket); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java index 93daa4c45..1c771ff52 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaChatTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaChatTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundChatPacket packet) { + public void translate(GeyserSession session, ClientboundChatPacket packet) { TextPacket textPacket = new TextPacket(); textPacket.setPlatformChatId(""); textPacket.setSourceName(""); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index feef811e4..d0ab68d8f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -43,7 +43,7 @@ import lombok.Getter; import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.inventory.item.Enchantment; @@ -98,7 +98,7 @@ public class JavaCommandsTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundCustomQueryPacket packet) { + public void translate(GeyserSession session, ClientboundCustomQueryPacket packet) { // A vanilla client doesn't know any PluginMessage in the Login state, so we don't know any either. // Note: Fabric Networking API v1 will not let the client log in without sending this session.sendDownstreamPacket( diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java index 4822d8b4a..e073e6f27 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaDisconnectTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisconnectPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaDisconnectTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundDisconnectPacket packet) { + public void translate(GeyserSession session, ClientboundDisconnectPacket packet) { session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java index 833dfe732..307c27c29 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaGameProfileTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.skin.SkinManager; @@ -38,7 +38,7 @@ import org.geysermc.geyser.skin.SkinManager; public class JavaGameProfileTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundGameProfilePacket packet) { + public void translate(GeyserSession session, ClientboundGameProfilePacket packet) { PlayerEntity playerEntity = session.getPlayerEntity(); AuthType remoteAuthType = session.getRemoteAuthType(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java index 208768ff8..680debe49 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaKeepAliveTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket; import com.nukkitx.protocol.bedrock.packet.NetworkStackLatencyPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaKeepAliveTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundKeepAlivePacket packet) { + public void translate(GeyserSession session, ClientboundKeepAlivePacket packet) { if (!session.getGeyser().getConfig().isForwardPlayerPing()) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java index 531d4a791..ce5fabe30 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginDisconnectTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaLoginDisconnectTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLoginDisconnectPacket packet) { + public void translate(GeyserSession session, ClientboundLoginDisconnectPacket packet) { // The client doesn't manually get disconnected so we have to do it ourselves session.disconnect(MessageTranslator.convertMessage(packet.getReason(), session.getLocale())); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java index 90c21c8d0..855f5b144 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java @@ -36,7 +36,7 @@ import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.level.BiomeTranslator; @@ -52,7 +52,7 @@ public class JavaLoginTranslator extends PacketTranslator SKIN_PART_VALUES = Arrays.asList(SkinPart.values()); @Override - public void translate(GeyserSessionImpl session, ClientboundLoginPacket packet) { + public void translate(GeyserSession session, ClientboundLoginPacket packet) { PlayerEntity entity = session.getPlayerEntity(); entity.setEntityId(packet.getEntityId()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java index 9a1ef7f08..a3b2e34b7 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaPingTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundPongPacket; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPingPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaPingTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundPingPacket packet) { + public void translate(GeyserSession session, ClientboundPingPacket packet) { session.sendDownstreamPacket(new ServerboundPongPacket(packet.getId())); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java index 908ac6e4c..0a329f607 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRecipeTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.UnlockRecipesAction; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRecipePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import java.util.Arrays; public class JavaRecipeTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundRecipePacket packet) { + public void translate(GeyserSession session, ClientboundRecipePacket packet) { if (packet.getAction() == UnlockRecipesAction.REMOVE) { session.getUnlockedRecipes().removeAll(Arrays.asList(packet.getRecipes())); } else { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java index a72a054ef..8f97b1a8d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaRespawnTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -43,7 +43,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class JavaRespawnTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundRespawnPacket packet) { + public void translate(GeyserSession session, ClientboundRespawnPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); entity.setHealth(entity.getMaxHealth()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java index 5acb35059..3f82dffb1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaSelectAdvancementsTabTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.AdvancementsCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSelectAdvancementsTabTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSelectAdvancementsTabPacket packet) { + public void translate(GeyserSession session, ClientboundSelectAdvancementsTabPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); advancementsCache.setCurrentAdvancementCategoryId(packet.getTabId()); advancementsCache.buildAndShowListForm(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java index be17064f3..c1f6f77d2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateAdvancementsTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.data.game.advancement.Advancement; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateAdvancementsPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -42,7 +42,7 @@ import java.util.Map; public class JavaUpdateAdvancementsTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundUpdateAdvancementsPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateAdvancementsPacket packet) { AdvancementsCache advancementsCache = session.getAdvancementsCache(); if (packet.isReset()) { advancementsCache.getStoredAdvancements().clear(); @@ -72,7 +72,7 @@ public class JavaUpdateAdvancementsTranslator extends PacketTranslator> recipeTypes = Registries.CRAFTING_DATA.forVersion(session.getUpstream().getProtocolVersion()); // Get the last known network ID (first used for the pregenerated recipes) and increment from there. int netId = InventoryUtils.LAST_RECIPE_NET_ID + 1; @@ -185,7 +185,7 @@ public class JavaUpdateRecipesTranslator extends PacketTranslator, IntSet> squashedOptions = new HashMap<>(); for (int i = 0; i < ingredients.length; i++) { if (ingredients[i].getOptions().length == 0) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java index 59aee47cc..5c9d84457 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaUpdateTagsTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundUpdateTagsPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaUpdateTagsTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundUpdateTagsPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateTagsPacket packet) { session.getTagCache().loadPacket(packet); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java index 98f7172b4..d7fc79f1e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaAnimateTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.AnimateEntityPacket; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.DimensionUtils; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class JavaAnimateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAnimatePacket packet) { + public void translate(GeyserSession session, ClientboundAnimatePacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java index fccfaef41..1c3239d69 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java @@ -36,7 +36,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.FishingHookEntity; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -46,7 +46,7 @@ import java.util.concurrent.ThreadLocalRandom; public class JavaEntityEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundEntityEventPacket packet) { + public void translate(GeyserSession session, ClientboundEntityEventPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java index ae27b54c2..4f15b0717 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosRotTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosRotPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveEntityPosRotTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundMoveEntityPosRotPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityPosRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java index 1a93b0ea1..aeb080465 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityPosTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityPosPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveEntityPosTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundMoveEntityPosPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityPosPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java index fa3efc5e1..b2b59480b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveEntityRotTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveEntityRotTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundMoveEntityRotPacket packet) { + public void translate(GeyserSession session, ClientboundMoveEntityRotPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java index 29f3620a9..90e121250 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaMoveVehicleTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaMoveVehicleTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundMoveVehiclePacket packet) { + public void translate(GeyserSession session, ClientboundMoveVehiclePacket packet) { Entity entity = session.getRidingVehicleEntity(); if (entity == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java index 1783316ae..043756db0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveEntitiesTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaRemoveEntitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundRemoveEntitiesPacket packet) { + public void translate(GeyserSession session, ClientboundRemoveEntitiesPacket packet) { for (int entityId : packet.getEntityIds()) { Entity entity = session.getEntityCache().getEntityByJavaId(entityId); if (entity != null) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java index 8fe9db808..bc78bb33e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRemoveMobEffectTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.EntityUtils; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.EntityUtils; public class JavaRemoveMobEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundRemoveMobEffectPacket packet) { + public void translate(GeyserSession session, ClientboundRemoveMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java index 3f598dd3b..edcad7af6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaRotateHeadTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaRotateHeadTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundRotateHeadPacket packet) { + public void translate(GeyserSession session, ClientboundRotateHeadPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java index c63905cd6..987e5fcb2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundSetEntityDataPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.entity.InteractiveTagManager; @@ -39,7 +39,7 @@ public class JavaSetEntityDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetEntityLinkPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityLinkPacket packet) { Entity holderId; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { holderId = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java index da8920c29..5febe4813 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityMotionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemEntity; import org.geysermc.geyser.entity.type.living.animal.horse.AbstractHorseEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; public class JavaSetEntityMotionTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetEntityMotionPacket packet) { + public void translate(GeyserSession session, ClientboundSetEntityMotionPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java index 7222d46dd..0058ed61e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEquipmentTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.Client import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.inventory.item.ItemTranslator; public class JavaSetEquipmentTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetEquipmentPacket packet) { + public void translate(GeyserSession session, ClientboundSetEquipmentPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java index 4f9729c5f..f4a6f94ed 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetPassengersTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.EntityUtils; @@ -43,7 +43,7 @@ import java.util.Arrays; public class JavaSetPassengersTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetPassengersPacket packet) { + public void translate(GeyserSession session, ClientboundSetPassengersPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java index daf89633f..75d7bc976 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTakeItemEntityTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.TakeItemEntityPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ExpOrbEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -44,7 +44,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaTakeItemEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundTakeItemEntityPacket packet) { + public void translate(GeyserSession session, ClientboundTakeItemEntityPacket packet) { // Collected entity is the other entity Entity collectedEntity = session.getEntityCache().getEntityByJavaId(packet.getCollectedEntityId()); if (collectedEntity == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java index d6ebd6efb..cbd994d79 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaTeleportEntityTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundTeleportEntityPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaTeleportEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundTeleportEntityPacket packet) { + public void translate(GeyserSession session, ClientboundTeleportEntityPacket packet) { Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId()); if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java index 7d64a880e..c3a4e4ac4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateAttributesTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateAttributesPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.LivingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaUpdateAttributesTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundUpdateAttributesPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateAttributesPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java index ee53f281b..2d4161739 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaUpdateMobEffectTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundUpdateMobEffectPacket; import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.EntityUtils; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.EntityUtils; public class JavaUpdateMobEffectTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundUpdateMobEffectPacket packet) { + public void translate(GeyserSession session, ClientboundUpdateMobEffectPacket packet) { Entity entity; if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) { entity = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java index 08449c108..6fbdb4fc6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaBlockBreakAckTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -40,7 +40,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaBlockBreakAckTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundBlockBreakAckPacket packet) { + public void translate(GeyserSession session, ClientboundBlockBreakAckPacket packet) { ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); if (packet.getAction() == PlayerAction.START_DIGGING && !packet.isSuccessful()) { LevelEventPacket stopBreak = new LevelEventPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java index b409db27a..98b69a0b8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerAbilitiesTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerAbilitiesPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaPlayerAbilitiesTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundPlayerAbilitiesPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerAbilitiesPacket packet) { session.setCanFly(packet.isCanFly()); session.setFlying(packet.isFlying()); session.sendAdventureSettings(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java index ce5f0b798..d8ffdccb6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerInfoTranslator.java @@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.PlayerListPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.skin.SkinManager; @@ -40,7 +40,7 @@ import org.geysermc.geyser.skin.SkinManager; @Translator(packet = ClientboundPlayerInfoPacket.class) public class JavaPlayerInfoTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundPlayerInfoPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerInfoPacket packet) { if (packet.getAction() != PlayerListEntryAction.ADD_PLAYER && packet.getAction() != PlayerListEntryAction.REMOVE_PLAYER) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java index a8a630656..3e94321f9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerPositionTranslator.java @@ -37,7 +37,7 @@ import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.TeleportCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -49,7 +49,7 @@ import org.geysermc.geyser.text.GeyserLocale; public class JavaPlayerPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundPlayerPositionPacket packet) { + public void translate(GeyserSession session, ClientboundPlayerPositionPacket packet) { if (!session.isLoggedIn()) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java index 3f7de9126..dc10bad34 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetCarriedItemTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundSetCarriedItemPacket; import com.nukkitx.protocol.bedrock.packet.PlayerHotbarPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetCarriedItemTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetCarriedItemPacket packet) { + public void translate(GeyserSession session, ClientboundSetCarriedItemPacket packet) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); hotbarPacket.setSelectedHotbarSlot(packet.getSlot()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java index 794755833..3ac9bf9e3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetExperienceTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.AttributeData; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -40,7 +40,7 @@ import java.util.Arrays; public class JavaSetExperienceTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetExperiencePacket packet) { + public void translate(GeyserSession session, ClientboundSetExperiencePacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); AttributeData experience = GeyserAttributeType.EXPERIENCE.getAttribute(packet.getExperience()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java index 40a6d38e5..8e96ed42e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaSetHealthTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.packet.SetHealthPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -41,7 +41,7 @@ import java.util.List; public class JavaSetHealthTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetHealthPacket packet) { + public void translate(GeyserSession session, ClientboundSetHealthPacket packet) { SessionPlayerEntity entity = session.getPlayerEntity(); int health = (int) Math.ceil(packet.getHealth()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java index d1ccd7b1b..b80b59ff4 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddEntityTranslator.java @@ -38,7 +38,7 @@ import org.geysermc.geyser.entity.type.FallingBlockEntity; import org.geysermc.geyser.entity.type.FishingHookEntity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; @@ -48,7 +48,7 @@ import org.geysermc.geyser.text.GeyserLocale; public class JavaAddEntityTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAddEntityPacket packet) { + public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); float yaw = packet.getYaw(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java index 1774ec934..33e230c14 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddExperienceOrbTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn. import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ExpOrbEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaAddExperienceOrbTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAddExperienceOrbPacket packet) { + public void translate(GeyserSession session, ClientboundAddExperienceOrbPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Entity entity = new ExpOrbEntity( diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java index a466969aa..e6b82f365 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddMobTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.factory.BaseEntityFactory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; @@ -40,7 +40,7 @@ import org.geysermc.geyser.text.GeyserLocale; public class JavaAddMobTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAddMobPacket packet) { + public void translate(GeyserSession session, ClientboundAddMobPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); Vector3f motion = Vector3f.from(packet.getMotionX(), packet.getMotionY(), packet.getMotionZ()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java index 17e4a800e..433d78477 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.spawn; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPaintingPacket; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.PaintingEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.PaintingType; @@ -37,7 +37,7 @@ import org.geysermc.geyser.level.PaintingType; public class JavaAddPaintingTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAddPaintingPacket packet) { + public void translate(GeyserSession session, ClientboundAddPaintingPacket packet) { Vector3f position = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); PaintingEntity entity = new PaintingEntity(session, packet.getEntityId(), diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java index 8dbdf81e9..74dcaf022 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPlayerTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn. import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.text.GeyserLocale; @@ -39,7 +39,7 @@ import org.geysermc.geyser.skin.SkinManager; public class JavaAddPlayerTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundAddPlayerPacket packet) { + public void translate(GeyserSession session, ClientboundAddPlayerPacket packet) { Vector3f position = Vector3f.from(packet.getX(), packet.getY(), packet.getZ()); float yaw = packet.getYaw(); float pitch = packet.getPitch(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java index e12f2ee8d..9a4ff8f26 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerCloseTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerClosePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.InventoryUtils; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class JavaContainerCloseTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundContainerClosePacket packet) { + public void translate(GeyserSession session, ClientboundContainerClosePacket packet) { // Sometimes the server can request a window close of ID 0... when the window isn't even open // Don't confirm in this instance InventoryUtils.closeInventory(session, packet.getContainerId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getContainerId())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java index 3d3255768..0d572ca92 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetContentTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -38,7 +38,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class JavaContainerSetContentTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundContainerSetContentPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetContentPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId()); if (inventory == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java index 92cfe9619..2ffab0d38 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetDataTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.inventory; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.InventoryUtils; public class JavaContainerSetDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundContainerSetDataPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetDataPacket packet) { Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId()); if (inventory == null) return; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java index 43d55c47a..54cc91ca6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaContainerSetSlotTranslator.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit; public class JavaContainerSetSlotTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundContainerSetSlotPacket packet) { + public void translate(GeyserSession session, ClientboundContainerSetSlotPacket packet) { if (packet.getContainerId() == 255) { //cursor GeyserItemStack newItem = GeyserItemStack.from(packet.getItem()); session.getPlayerInventory().setCursor(newItem, session); @@ -92,7 +92,7 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundMerchantOffersPacket packet) { + public void translate(GeyserSession session, ClientboundMerchantOffersPacket packet) { Inventory openInventory = session.getOpenInventory(); if (!(openInventory instanceof MerchantContainer merchantInventory && openInventory.getId() == packet.getContainerId())) { return; @@ -132,7 +132,7 @@ public class JavaMerchantOffersTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundOpenScreenPacket packet) { + public void translate(GeyserSession session, ClientboundOpenScreenPacket packet) { if (packet.getContainerId() == 0) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java index f14d05be6..65db15d83 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockDestructionTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.BlockRegistries; @@ -41,7 +41,7 @@ import org.geysermc.geyser.util.BlockUtils; public class JavaBlockDestructionTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundBlockDestructionPacket packet) { + public void translate(GeyserSession session, ClientboundBlockDestructionPacket packet) { int state = session.getGeyser().getWorldManager().getBlockAt(session, packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()); int breakTime = (int) (65535 / Math.ceil(BlockUtils.getBreakTime(session, BlockRegistries.JAVA_BLOCKS.get(state), ItemMapping.AIR, new CompoundTag(""), false) * 20)); LevelEventPacket levelEventPacket = new LevelEventPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java index 1d999542f..1c11b298e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java @@ -32,7 +32,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.Clientb import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -45,7 +45,7 @@ import org.geysermc.geyser.util.BlockEntityUtils; public class JavaBlockEntityDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundBlockEntityDataPacket packet) { + public void translate(GeyserSession session, ClientboundBlockEntityDataPacket packet) { BlockEntityTranslator translator = BlockEntityUtils.getBlockEntityTranslator(packet.getType()); // The Java block state is used in BlockEntityTranslator.translateTag() to make up for some inconsistencies // between Java block states and Bedrock block entity data diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java index a46524010..3504168a5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEventTranslator.java @@ -35,7 +35,7 @@ import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEventPacket; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.PistonCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -48,7 +48,7 @@ import org.geysermc.geyser.level.physics.Direction; public class JavaBlockEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundBlockEventPacket packet) { + public void translate(GeyserSession session, ClientboundBlockEventPacket packet) { BlockEventPacket blockEventPacket = new BlockEventPacket(); blockEventPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java index 7bebcd11f..298bd4b90 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockUpdateTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; @@ -42,7 +42,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundBlockUpdatePacket packet) { + public void translate(GeyserSession session, ClientboundBlockUpdatePacket packet) { Position pos = packet.getEntry().getPosition(); boolean updatePlacement = session.getGeyser().getPlatformType() != PlatformType.SPIGOT && // Spigot simply listens for the block place event session.getGeyser().getWorldManager().getBlockAt(session, pos) != packet.getEntry().getBlock(); @@ -53,7 +53,7 @@ public class JavaBlockUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundCustomSoundPacket packet) { + public void translate(GeyserSession session, ClientboundCustomSoundPacket packet) { String packetSound; if (packet.getSound() instanceof BuiltinSound) { packetSound = ((BuiltinSound) packet.getSound()).getName(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java index f07c19fa3..d97035b5c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaExplodeTranslator.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -44,7 +44,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaExplodeTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundExplodePacket packet) { + public void translate(GeyserSession session, ClientboundExplodePacket packet) { for (Position position : packet.getExploded()) { Vector3i pos = Vector3i.from(packet.getX() + position.getX(), packet.getY() + position.getY(), packet.getZ() + position.getZ()); ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, pos); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java index 967edbcf4..8204ceea5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaForgetLevelChunkTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; import com.nukkitx.math.vector.Vector3i; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import java.util.Iterator; public class JavaForgetLevelChunkTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundForgetLevelChunkPacket packet) { + public void translate(GeyserSession session, ClientboundForgetLevelChunkPacket packet) { session.getChunkCache().removeChunk(packet.getX(), packet.getZ()); //Checks if a skull is in an unloaded chunk then removes it diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java index cd1b5f37d..642f707a8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaGameEventTranslator.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import com.nukkitx.protocol.bedrock.packet.*; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.PlayerInventoryTranslator; @@ -49,7 +49,7 @@ import org.geysermc.geyser.text.MinecraftLocale; public class JavaGameEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundGameEventPacket packet) { + public void translate(GeyserSession session, ClientboundGameEventPacket packet) { PlayerEntity entity = session.getPlayerEntity(); switch (packet.getNotification()) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java index 006620cad..4a749c6d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java @@ -50,7 +50,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; import org.geysermc.geyser.entity.type.ItemFrameEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.level.BiomeTranslator; @@ -77,7 +77,7 @@ import static org.geysermc.geyser.util.ChunkUtils.*; public class JavaLevelChunkWithLightTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLevelChunkWithLightPacket packet) { + public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacket packet) { if (session.isSpawned()) { ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt()); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java index 366a4c94c..d861d0338 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelEventTranslator.java @@ -42,7 +42,7 @@ import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import com.nukkitx.protocol.bedrock.packet.TextPacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.level.event.LevelEventTranslator; @@ -56,7 +56,7 @@ import java.util.Locale; public class JavaLevelEventTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLevelEventPacket packet) { + public void translate(GeyserSession session, ClientboundLevelEventPacket packet) { // Separate case since each RecordEventData in Java is an individual track in Bedrock if (packet.getEvent() == com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent.RECORD) { RecordEventData recordEventData = (RecordEventData) packet.getData(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java index 4f4251750..7cbdc2a4b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.SpawnParticleEffectPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -50,7 +50,7 @@ import java.util.function.Function; public class JavaLevelParticlesTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundLevelParticlesPacket packet) { + public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) { Function particleCreateFunction = createParticle(session, packet.getParticle()); if (particleCreateFunction != null) { if (packet.getAmount() == 0) { @@ -80,7 +80,7 @@ public class JavaLevelParticlesTranslator extends PacketTranslator createParticle(GeyserSessionImpl session, Particle particle) { + private Function createParticle(GeyserSession session, Particle particle) { switch (particle.getType()) { case BLOCK -> { int blockState = session.getBlockMappings().getBedrockBlockId(((BlockParticleData) particle.getData()).getBlockState()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java index ed9aceac2..c5b296f4f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaMapItemDataTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.level.map.MapIcon; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; import com.nukkitx.protocol.bedrock.data.MapDecoration; import com.nukkitx.protocol.bedrock.data.MapTrackedObject; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.BedrockMapIcon; @@ -41,7 +41,7 @@ import org.geysermc.geyser.level.MapColor; public class JavaMapItemDataTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundMapItemDataPacket packet) { + public void translate(GeyserSession session, ClientboundMapItemDataPacket packet) { com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket mapItemDataPacket = new com.nukkitx.protocol.bedrock.packet.ClientboundMapItemDataPacket(); boolean shouldStore = false; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java index d1cc3704e..c301ee462 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSectionBlocksUpdateTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.ChunkUtils; @@ -36,7 +36,7 @@ import org.geysermc.geyser.util.ChunkUtils; public class JavaSectionBlocksUpdateTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSectionBlocksUpdatePacket packet) { + public void translate(GeyserSession session, ClientboundSectionBlocksUpdatePacket packet) { for (BlockChangeEntry entry : packet.getEntries()) { ChunkUtils.updateBlock(session, entry.getBlock(), entry.getPosition()); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java index 8f1147cb3..901a4d82e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheCenterTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.ChunkUtils; @@ -36,7 +36,7 @@ import com.nukkitx.math.vector.Vector3i; public class JavaSetChunkCacheCenterTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetChunkCacheCenterPacket packet) { + public void translate(GeyserSession session, ClientboundSetChunkCacheCenterPacket packet) { if (!session.isSpawned() && session.getLastChunkPosition() == null) { ChunkUtils.updateChunkPosition(session, Vector3i.from(packet.getChunkX() << 4, 64, packet.getChunkZ() << 4)); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java index 919f860df..50ed540ea 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetChunkCacheRadiusTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -34,7 +34,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetChunkCacheRadiusTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetChunkCacheRadiusPacket packet) { + public void translate(GeyserSession session, ClientboundSetChunkCacheRadiusPacket packet) { session.setRenderDistance(packet.getViewDistance()); } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java index e38cf00fd..8067341e1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetDefaultSpawnPositionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.protocol.bedrock.packet.SetSpawnPositionPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.DimensionUtils; @@ -37,7 +37,7 @@ import org.geysermc.geyser.util.DimensionUtils; public class JavaSetDefaultSpawnPositionTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetDefaultSpawnPositionPacket packet) { + public void translate(GeyserSession session, ClientboundSetDefaultSpawnPositionPacket packet) { SetSpawnPositionPacket spawnPositionPacket = new SetSpawnPositionPacket(); spawnPositionPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); spawnPositionPacket.setSpawnForced(true); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java index 6170b2b32..9ff6965ca 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSetTimeTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; import com.nukkitx.protocol.bedrock.packet.SetTimePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetTimeTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetTimePacket packet) { + public void translate(GeyserSession session, ClientboundSetTimePacket packet) { // Bedrock sends a GameRulesChangedPacket if there is no daylight cycle // Java just sends a negative long if there is no daylight cycle long time = packet.getTime(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java index ad0af4f10..e9f9337aa 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaSoundTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; @@ -44,7 +44,7 @@ import org.geysermc.geyser.registry.type.SoundMapping; public class JavaSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSoundPacket packet) { + public void translate(GeyserSession session, ClientboundSoundPacket packet) { String packetSound = packet.getSound().getName(); SoundMapping soundMapping = Registries.SOUNDS.get(packetSound); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java index e791407f2..75a99f0af 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaStopSoundTranslator.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.sound.BuiltinSound; import com.github.steveice10.mc.protocol.data.game.level.sound.CustomSound; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.registry.Registries; @@ -39,7 +39,7 @@ import org.geysermc.geyser.registry.type.SoundMapping; public class JavaStopSoundTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundStopSoundPacket packet) { + public void translate(GeyserSession session, ClientboundStopSoundPacket packet) { // Runs if all sounds are stopped if (packet.getSound() == null) { StopSoundPacket stopPacket = new StopSoundPacket(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java index f0574f99f..1f7ea7657 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaInitializeBorderTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundInitializeBorderPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaInitializeBorderTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundInitializeBorderPacket packet) { + public void translate(GeyserSession session, ClientboundInitializeBorderPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); worldBorder.setOldDiameter(packet.getOldSize()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java index 6a60f6f38..6895cf944 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderCenterTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderCenterPacket; import com.nukkitx.math.vector.Vector2d; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderCenterTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetBorderCenterPacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderCenterPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setCenter(Vector2d.from(packet.getNewCenterX(), packet.getNewCenterZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java index 2fe5eb392..3eae4b1f5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderLerpSizeTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderLerpSizePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderLerpSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetBorderLerpSizePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderLerpSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getOldSize()); worldBorder.setNewDiameter(packet.getNewSize()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java index 2adee0f41..076924735 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderSizeTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderSizePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderSizeTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetBorderSizePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderSizePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setOldDiameter(packet.getSize()); worldBorder.setNewDiameter(packet.getSize()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java index 7e7e91f13..b3104fb9a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDelayTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDelayPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderWarningDelayTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetBorderWarningDelayPacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderWarningDelayPacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningDelay(packet.getWarningDelay()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java index 8288f804e..b4483b9a6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/border/JavaSetBorderWarningDistanceTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.level.border; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.border.ClientboundSetBorderWarningDistancePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldBorder; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetBorderWarningDistanceTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetBorderWarningDistancePacket packet) { + public void translate(GeyserSession session, ClientboundSetBorderWarningDistancePacket packet) { WorldBorder worldBorder = session.getWorldBorder(); worldBorder.setWarningBlocks(packet.getWarningBlocks()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java index ffe7386fb..fe141486e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetDisplayObjectiveTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.translator.protocol.java.scoreboard; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.scoreboard.ScoreboardUpdater; public class JavaSetDisplayObjectiveTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetDisplayObjectivePacket packet) { + public void translate(GeyserSession session, ClientboundSetDisplayObjectivePacket packet) { WorldCache worldCache = session.getWorldCache(); Scoreboard scoreboard = worldCache.getScoreboard(); int pps = worldCache.increaseAndGetScoreboardPacketsPerSecond(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java index 20932f9cd..79c0036ad 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetObjectiveTranslator.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.scoreboard.Cl import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.entity.type.player.PlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.WorldCache; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -46,7 +46,7 @@ public class JavaSetObjectiveTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundClearTitlesPacket packet) { + public void translate(GeyserSession session, ClientboundClearTitlesPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); // TODO handle packet.isResetTimes() titlePacket.setType(SetTitlePacket.Type.CLEAR); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java index e4fa7fe46..914ddafb9 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetActionBarTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetActionBarTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaSetActionBarTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetActionBarTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetActionBarTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java index 70e3716a2..521f5eba6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetSubtitleTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetSubtitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaSetSubtitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetSubtitleTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetSubtitleTextPacket packet) { String text; if (packet.getText() == null) { //TODO 1.17 can this happen? text = " "; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java index 8a2594ffb..04eb76bb5 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitleTextTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitleTextPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class JavaSetTitleTextTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetTitleTextPacket packet) { + public void translate(GeyserSession session, ClientboundSetTitleTextPacket packet) { String text; if (packet.getText() == null) { // This can happen, see https://github.com/KyoriPowered/adventure/issues/447 text = " "; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java index 6d96bc8ea..b8bbc780a 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/title/JavaSetTitlesAnimationTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.title; import com.github.steveice10.mc.protocol.packet.ingame.clientbound.title.ClientboundSetTitlesAnimationPacket; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.protocol.Translator; public class JavaSetTitlesAnimationTranslator extends PacketTranslator { @Override - public void translate(GeyserSessionImpl session, ClientboundSetTitlesAnimationPacket packet) { + public void translate(GeyserSession session, ClientboundSetTitlesAnimationPacket packet) { SetTitlePacket titlePacket = new SetTitlePacket(); titlePacket.setType(SetTitlePacket.Type.TIMES); titlePacket.setText(""); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java index d42aa9a50..5e6e8d9e8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/BlockSoundInteractionTranslator.java @@ -32,7 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.util.BlockUtils; @@ -51,7 +51,7 @@ public interface BlockSoundInteractionTranslator extends SoundInteractionTransla * @param position the position of the block * @param identifier the identifier of the block */ - static void handleBlockInteraction(GeyserSessionImpl session, Vector3f position, String identifier) { + static void handleBlockInteraction(GeyserSession session, Vector3f position, String identifier) { // If we need to get the hand identifier, only get it once and save it to a variable String handIdentifier = null; @@ -98,7 +98,7 @@ public interface BlockSoundInteractionTranslator extends SoundInteractionTransla /** * Determines if the adventure gamemode would prevent this item from actually succeeding */ - static boolean canInteract(GeyserSessionImpl session, GeyserItemStack itemInHand, String blockIdentifier) { + static boolean canInteract(GeyserSession session, GeyserItemStack itemInHand, String blockIdentifier) { if (session.getGameMode() != GameMode.ADVENTURE) { // There are no restrictions on the item return true; diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java index 27b026a46..4a88696f8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/EntitySoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound; import com.nukkitx.math.vector.Vector3f; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.Registries; import java.util.Map; @@ -46,7 +46,7 @@ public interface EntitySoundInteractionTranslator extends SoundInteractionTransl * @param position the position of the block * @param entity the entity interacted with */ - static void handleEntityInteraction(GeyserSessionImpl session, Vector3f position, Entity entity) { + static void handleEntityInteraction(GeyserSession session, Vector3f position, Entity entity) { // If we need to get the hand identifier, only get it once and save it to a variable String handIdentifier = null; diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java index be0ccb0c8..7cccbb21d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/SoundInteractionTranslator.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.sound; import com.nukkitx.math.vector.Vector3f; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; /** * Handler for playing sounds when right-clicking @@ -48,5 +48,5 @@ public interface SoundInteractionTranslator { * @param position the position of the block * @param value the value */ - void translate(GeyserSessionImpl session, Vector3f position, T value); + void translate(GeyserSession session, Vector3f position, T value); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java index 072e0bf56..1af30e658 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/BucketSoundInteractionTranslator.java @@ -29,7 +29,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.geyser.inventory.GeyserItemStack; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -37,7 +37,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class BucketSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { if (session.getBucketScheduledFuture() == null) { return; // No bucket was really interacted with } diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java index 9fb95fbb5..8c10076d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/ComparatorSoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class ComparatorSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { boolean powered = identifier.contains("mode=compare"); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java index 38f53d855..1115760eb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/DoorSoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class DoorSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { if (identifier.contains("iron")) return; LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setType(LevelEventType.SOUND_DOOR_OPEN); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java index 920ece899..09e86f461 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/FlintAndSteelInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class FlintAndSteelInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java index fc258978f..6c91b24a0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/GrassPathInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; import org.geysermc.geyser.registry.BlockRegistries; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.BlockRegistries; public class GrassPathInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java index a37650849..799364498 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/HoeInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.SoundEvent; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; import org.geysermc.geyser.registry.BlockRegistries; @@ -37,7 +37,7 @@ import org.geysermc.geyser.registry.BlockRegistries; public class HoeInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { LevelSoundEventPacket levelSoundEventPacket = new LevelSoundEventPacket(); levelSoundEventPacket.setPosition(position); levelSoundEventPacket.setBabySound(false); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java index a1b6247a1..a57d337b1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/block/LeverSoundInteractionTranslator.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.sound.block; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.LevelEventType; import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.BlockSoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class LeverSoundInteractionTranslator implements BlockSoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, String identifier) { + public void translate(GeyserSession session, Vector3f position, String identifier) { boolean powered = identifier.contains("powered=true"); LevelEventPacket levelEventPacket = new LevelEventPacket(); levelEventPacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java index bc8822c8c..ea160538e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/FeedBabySoundInteractionTranslator.java @@ -32,7 +32,7 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; import org.geysermc.geyser.entity.type.living.animal.OcelotEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.CatEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -40,7 +40,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class FeedBabySoundInteractionTranslator implements EntitySoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, Entity entity) { + public void translate(GeyserSession session, Vector3f position, Entity entity) { if (entity instanceof AnimalEntity animalEntity && !(entity instanceof CatEntity || entity instanceof OcelotEntity)) { String handIdentifier = session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier(); boolean isBaby = animalEntity.isBaby(); diff --git a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java index 47fad3559..e8698ff23 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/sound/entity/MilkEntitySoundInteractionTranslator.java @@ -31,7 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.GoatEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.sound.EntitySoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; @@ -39,7 +39,7 @@ import org.geysermc.geyser.translator.sound.SoundTranslator; public class MilkEntitySoundInteractionTranslator implements EntitySoundInteractionTranslator { @Override - public void translate(GeyserSessionImpl session, Vector3f position, Entity value) { + public void translate(GeyserSession session, Vector3f position, Entity value) { if (!session.getPlayerInventory().getItemInHand().getMapping(session).getJavaIdentifier().equals("minecraft:bucket")) { return; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java index eab6c4ba6..d22b47768 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java @@ -33,7 +33,7 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.MinecraftTranslationRegistry; import org.geysermc.geyser.text.GsonComponentSerializerWrapper; import org.geysermc.geyser.text.GeyserLocale; @@ -223,10 +223,10 @@ public class MessageTranslator { * Checks if the given message is over 256 characters (Java edition server chat limit) and sends a message to the user if it is * * @param message Message to check - * @param session {@link GeyserSessionImpl} for the user + * @param session {@link GeyserSession} for the user * @return True if the message is too long, false if not */ - public static boolean isTooLong(String message, GeyserSessionImpl session) { + public static boolean isTooLong(String message, GeyserSession session) { if (message.length() > 256) { session.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.chat.too_long", session.getLocale(), message.length())); return true; diff --git a/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java index 0f6cc07a3..6d4258d7e 100644 --- a/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockEntityUtils.java @@ -31,7 +31,7 @@ import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity; import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; import org.geysermc.geyser.translator.level.block.entity.FlowerPotBlockEntityTranslator; @@ -89,11 +89,11 @@ public class BlockEntityUtils { return Registries.BLOCK_ENTITIES.get(type); } - public static void updateBlockEntity(GeyserSessionImpl session, @Nonnull NbtMap blockEntity, Position position) { + public static void updateBlockEntity(GeyserSession session, @Nonnull NbtMap blockEntity, Position position) { updateBlockEntity(session, blockEntity, Vector3i.from(position.getX(), position.getY(), position.getZ())); } - public static void updateBlockEntity(GeyserSessionImpl session, @Nonnull NbtMap blockEntity, Vector3i position) { + public static void updateBlockEntity(GeyserSession session, @Nonnull NbtMap blockEntity, Vector3i position) { BlockEntityDataPacket blockEntityPacket = new BlockEntityDataPacket(); blockEntityPacket.setBlockPosition(position); blockEntityPacket.setData(blockEntity); diff --git a/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java b/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java index 125d13662..c43cc3311 100644 --- a/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/BlockUtils.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.nukkitx.math.vector.Vector3i; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.collision.BlockCollision; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.Registries; @@ -43,7 +43,7 @@ public class BlockUtils { */ public static final Position POSITION_ZERO = new Position(0, 0, 0); - private static boolean correctTool(GeyserSessionImpl session, BlockMapping blockMapping, String itemToolType) { + private static boolean correctTool(GeyserSession session, BlockMapping blockMapping, String itemToolType) { switch (itemToolType) { case "axe": return session.getTagCache().isAxeEffective(blockMapping); @@ -78,7 +78,7 @@ public class BlockUtils { }; } - private static boolean canToolTierBreakBlock(GeyserSessionImpl session, BlockMapping blockMapping, String toolTier) { + private static boolean canToolTierBreakBlock(GeyserSession session, BlockMapping blockMapping, String toolTier) { if (toolTier.equals("netherite") || toolTier.equals("diamond")) { // As of 1.17, these tiers can mine everything that is mineable return true; @@ -139,7 +139,7 @@ public class BlockUtils { return 1.0 / speed; } - public static double getBreakTime(GeyserSessionImpl session, BlockMapping blockMapping, ItemMapping item, CompoundTag nbtData, boolean isSessionPlayer) { + public static double getBreakTime(GeyserSession session, BlockMapping blockMapping, ItemMapping item, CompoundTag nbtData, boolean isSessionPlayer) { boolean isShearsEffective = session.getTagCache().isShearsEffective(blockMapping); //TODO called twice boolean canHarvestWithHand = blockMapping.isCanBreakWithHand(); String toolType = ""; @@ -178,7 +178,7 @@ public class BlockUtils { outOfWaterButNotOnGround, insideWaterNotOnGround); } - public static double getSessionBreakTime(GeyserSessionImpl session, BlockMapping blockMapping) { + public static double getSessionBreakTime(GeyserSession session, BlockMapping blockMapping) { PlayerInventory inventory = session.getPlayerInventory(); GeyserItemStack item = inventory.getItemInHand(); ItemMapping mapping; @@ -234,11 +234,11 @@ public class BlockUtils { return Registries.COLLISIONS.get(blockId); } - public static BlockCollision getCollisionAt(GeyserSessionImpl session, Vector3i blockPos) { + public static BlockCollision getCollisionAt(GeyserSession session, Vector3i blockPos) { return getCollision(session.getGeyser().getWorldManager().getBlockAt(session, blockPos)); } - public static BlockCollision getCollisionAt(GeyserSessionImpl session, int x, int y, int z) { + public static BlockCollision getCollisionAt(GeyserSession session, int x, int y, int z) { return getCollision(session.getGeyser().getWorldManager().getBlockAt(session, x, y, z)); } } diff --git a/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java b/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java index 2b7713235..cb80e209b 100644 --- a/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/ChunkUtils.java @@ -40,7 +40,7 @@ import it.unimi.dsi.fastutil.ints.IntLists; import lombok.experimental.UtilityClass; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.translator.level.block.entity.BedrockOnlyBlockEntity; @@ -115,7 +115,7 @@ public class ChunkUtils { return (yzx >> 8) | (yzx & 0x0F0) | ((yzx & 0x00F) << 8); } - public static void updateChunkPosition(GeyserSessionImpl session, Vector3i position) { + public static void updateChunkPosition(GeyserSession session, Vector3i position) { Vector2i chunkPos = session.getLastChunkPosition(); Vector2i newChunkPos = Vector2i.from(position.getX() >> 4, position.getZ() >> 4); @@ -136,7 +136,7 @@ public class ChunkUtils { * @param blockState the Java block state of the block * @param position the position of the block */ - public static void updateBlock(GeyserSessionImpl session, int blockState, Position position) { + public static void updateBlock(GeyserSession session, int blockState, Position position) { Vector3i pos = Vector3i.from(position.getX(), position.getY(), position.getZ()); updateBlock(session, blockState, pos); } @@ -148,7 +148,7 @@ public class ChunkUtils { * @param blockState the Java block state of the block * @param position the position of the block */ - public static void updateBlock(GeyserSessionImpl session, int blockState, Vector3i position) { + public static void updateBlock(GeyserSession session, int blockState, Vector3i position) { // Checks for item frames so they aren't tripped up and removed ItemFrameEntity itemFrameEntity = ItemFrameEntity.getItemFrameEntity(session, position); if (itemFrameEntity != null) { @@ -205,7 +205,7 @@ public class ChunkUtils { session.getChunkCache().updateBlock(position.getX(), position.getY(), position.getZ(), blockState); } - public static void sendEmptyChunks(GeyserSessionImpl session, Vector3i position, int radius, boolean forceUpdate) { + public static void sendEmptyChunks(GeyserSession session, Vector3i position, int radius, boolean forceUpdate) { int chunkX = position.getX() >> 4; int chunkZ = position.getZ() >> 4; for (int x = -radius; x <= radius; x++) { @@ -234,7 +234,7 @@ public class ChunkUtils { * Process the minimum and maximum heights for this dimension, and processes the world coordinate scale. * This must be done after the player has switched dimensions so we know what their dimension is */ - public static void loadDimensionTag(GeyserSessionImpl session, CompoundTag dimensionTag) { + public static void loadDimensionTag(GeyserSession session, CompoundTag dimensionTag) { int minY = ((IntTag) dimensionTag.get("min_y")).getValue(); int maxY = ((IntTag) dimensionTag.get("height")).getValue(); // Logical height can be ignored probably - seems to be for artificial limits like the Nether. diff --git a/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java b/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java index 06c2a8f3e..c149996b8 100644 --- a/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/CooldownUtils.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.util; import com.nukkitx.protocol.bedrock.packet.SetTitlePacket; import lombok.Getter; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.cache.PreferencesCache; import java.util.concurrent.TimeUnit; @@ -51,7 +51,7 @@ public class CooldownUtils { * Starts sending the fake cooldown to the Bedrock client. If the cooldown is not disabled, the sent type is the cooldownPreference in {@link PreferencesCache} * @param session GeyserSession */ - public static void sendCooldown(GeyserSessionImpl session) { + public static void sendCooldown(GeyserSession session) { if (DEFAULT_SHOW_COOLDOWN == CooldownType.DISABLED) return; CooldownType sessionPreference = session.getPreferencesCache().getCooldownPreference(); if (sessionPreference == CooldownType.DISABLED) return; @@ -75,7 +75,7 @@ public class CooldownUtils { * @param sessionPreference The type of cooldown the client prefers * @param lastHitTime The time of the last hit. Used to gauge how long the cooldown is taking. */ - private static void computeCooldown(GeyserSessionImpl session, CooldownType sessionPreference, long lastHitTime) { + private static void computeCooldown(GeyserSession session, CooldownType sessionPreference, long lastHitTime) { if (session.isClosed()) return; // Don't run scheduled tasks if the client left if (lastHitTime != session.getLastHitTime()) return; // Means another cooldown has started so there's no need to continue this one SetTitlePacket titlePacket = new SetTitlePacket(); @@ -108,7 +108,7 @@ public class CooldownUtils { } } - private static boolean hasCooldown(GeyserSessionImpl session) { + private static boolean hasCooldown(GeyserSession session) { long time = System.currentTimeMillis() - session.getLastHitTime(); double cooldown = restrain(((double) time) * session.getAttackSpeed() / 1000d, 1.5); return cooldown < 1.1; @@ -121,7 +121,7 @@ public class CooldownUtils { return Math.min(x, max); } - private static String getTitle(GeyserSessionImpl session) { + private static String getTitle(GeyserSession session) { long time = System.currentTimeMillis() - session.getLastHitTime(); double cooldown = restrain(((double) time) * session.getAttackSpeed() / 1000d, 1); diff --git a/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java index 352a8e996..c729c0b1e 100644 --- a/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/DimensionUtils.java @@ -34,7 +34,7 @@ import com.nukkitx.protocol.bedrock.packet.MobEffectPacket; import com.nukkitx.protocol.bedrock.packet.StopSoundPacket; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.type.Entity; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.util.Set; @@ -56,7 +56,7 @@ public class DimensionUtils { */ public static final String THE_END = "minecraft:the_end"; - public static void switchDimension(GeyserSessionImpl session, String javaDimension) { + public static void switchDimension(GeyserSession session, String javaDimension) { int bedrockDimension = javaToBedrock(javaDimension); Entity player = session.getPlayerEntity(); diff --git a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java index 907aef169..1b671b2fe 100644 --- a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java @@ -41,7 +41,7 @@ import org.geysermc.geyser.inventory.Container; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.translator.inventory.InventoryTranslator; @@ -64,7 +64,7 @@ public class InventoryUtils { public static final ItemStack REFRESH_ITEM = new ItemStack(1, 127, new CompoundTag("")); - public static void openInventory(GeyserSessionImpl session, Inventory inventory) { + public static void openInventory(GeyserSession session, Inventory inventory) { session.setOpenInventory(inventory); if (session.isClosingInventory()) { //Wait for close confirmation from client before opening the new inventory. @@ -75,7 +75,7 @@ public class InventoryUtils { displayInventory(session, inventory); } - public static void displayInventory(GeyserSessionImpl session, Inventory inventory) { + public static void displayInventory(GeyserSession session, Inventory inventory) { InventoryTranslator translator = session.getInventoryTranslator(); if (translator != null) { translator.prepareInventory(session, inventory); @@ -100,7 +100,7 @@ public class InventoryUtils { } } - public static void closeInventory(GeyserSessionImpl session, int windowId, boolean confirm) { + public static void closeInventory(GeyserSession session, int windowId, boolean confirm) { session.getPlayerInventory().setCursor(GeyserItemStack.EMPTY, session); updateCursor(session); @@ -116,7 +116,7 @@ public class InventoryUtils { session.setOpenInventory(null); } - public static Inventory getInventory(GeyserSessionImpl session, int windowId) { + public static Inventory getInventory(GeyserSession session, int windowId) { if (windowId == 0) { return session.getPlayerInventory(); } else { @@ -128,7 +128,7 @@ public class InventoryUtils { } } - public static void updateCursor(GeyserSessionImpl session) { + public static void updateCursor(GeyserSession session) { InventorySlotPacket cursorPacket = new InventorySlotPacket(); cursorPacket.setContainerId(ContainerId.UI); cursorPacket.setSlot(0); @@ -177,12 +177,12 @@ public class InventoryUtils { } /** - * See {@link #findOrCreateItem(GeyserSessionImpl, String)}. This is for finding a specified {@link ItemStack}. + * See {@link #findOrCreateItem(GeyserSession, String)}. This is for finding a specified {@link ItemStack}. * * @param session the Bedrock client's session * @param itemStack the item to try to find a match for. NBT will also be accounted for. */ - public static void findOrCreateItem(GeyserSessionImpl session, ItemStack itemStack) { + public static void findOrCreateItem(GeyserSession session, ItemStack itemStack) { PlayerInventory inventory = session.getPlayerInventory(); if (itemStack == null || itemStack.getId() == 0) { @@ -241,7 +241,7 @@ public class InventoryUtils { * @param session the Bedrock client's session * @param itemName the Java identifier of the item to search/select */ - public static void findOrCreateItem(GeyserSessionImpl session, String itemName) { + public static void findOrCreateItem(GeyserSession session, String itemName) { // Get the inventory to choose a slot to pick PlayerInventory inventory = session.getPlayerInventory(); @@ -320,7 +320,7 @@ public class InventoryUtils { * @param session GeyserSession * @param slot inventory slot to be selected */ - private static void setHotbarItem(GeyserSessionImpl session, int slot) { + private static void setHotbarItem(GeyserSession session, int slot) { PlayerHotbarPacket hotbarPacket = new PlayerHotbarPacket(); hotbarPacket.setContainerId(0); // Java inventory slot to hotbar slot ID diff --git a/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java b/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java index 3307e3e88..0eed01613 100644 --- a/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/ItemUtils.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.opennbt.tag.builtin.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; public class ItemUtils { @@ -49,7 +49,7 @@ public class ItemUtils { /** * @return the correct Bedrock durability for this item. */ - public static int getCorrectBedrockDurability(GeyserSessionImpl session, int javaId, int original) { + public static int getCorrectBedrockDurability(GeyserSession session, int javaId, int original) { if (javaId == session.getItemMappings().getStoredItems().fishingRod().getJavaId()) { // Java durability: 64 // Bedrock durability : 384 diff --git a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java index 128b0bcb5..213953bdd 100644 --- a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java @@ -39,7 +39,7 @@ import com.nukkitx.protocol.bedrock.packet.ServerToClientHandshakePacket; import com.nukkitx.protocol.bedrock.util.EncryptionUtils; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.auth.AuthData; import org.geysermc.geyser.session.auth.BedrockClientData; import org.geysermc.cumulus.CustomForm; @@ -115,7 +115,7 @@ public class LoginEncryptionUtils { return mojangSigned; } - public static void encryptPlayerConnection(GeyserSessionImpl session, LoginPacket loginPacket) { + public static void encryptPlayerConnection(GeyserSession session, LoginPacket loginPacket) { JsonNode certData; try { certData = JSON_MAPPER.readTree(loginPacket.getChainData().toByteArray()); @@ -131,7 +131,7 @@ public class LoginEncryptionUtils { encryptConnectionWithCert(session, loginPacket.getSkinData().toString(), certChainData); } - private static void encryptConnectionWithCert(GeyserSessionImpl session, String clientData, JsonNode certChainData) { + private static void encryptConnectionWithCert(GeyserSession session, String clientData, JsonNode certChainData) { try { GeyserImpl geyser = session.getGeyser(); @@ -190,7 +190,7 @@ public class LoginEncryptionUtils { } } - private static void startEncryptionHandshake(GeyserSessionImpl session, PublicKey key) throws Exception { + private static void startEncryptionHandshake(GeyserSession session, PublicKey key) throws Exception { KeyPairGenerator generator = KeyPairGenerator.getInstance("EC"); generator.initialize(new ECGenParameterSpec("secp384r1")); KeyPair serverKeyPair = generator.generateKeyPair(); @@ -212,7 +212,7 @@ public class LoginEncryptionUtils { } } - public static void buildAndShowLoginWindow(GeyserSessionImpl session) { + public static void buildAndShowLoginWindow(GeyserSession session) { // Set DoDaylightCycle to false so the time doesn't accelerate while we're here session.setDaylightCycle(false); @@ -256,7 +256,7 @@ public class LoginEncryptionUtils { })); } - public static void buildAndShowLoginDetailsWindow(GeyserSessionImpl session) { + public static void buildAndShowLoginDetailsWindow(GeyserSession session) { session.sendForm( CustomForm.builder() .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) @@ -278,7 +278,7 @@ public class LoginEncryptionUtils { /** * Prompts the user between either OAuth code login or manual password authentication */ - public static void buildAndShowMicrosoftAuthenticationWindow(GeyserSessionImpl session) { + public static void buildAndShowMicrosoftAuthenticationWindow(GeyserSession session) { session.sendForm( SimpleForm.builder() .translator(GeyserLocale::getPlayerLocaleString, session.getLocale()) @@ -306,7 +306,7 @@ public class LoginEncryptionUtils { /** * Shows the code that a user must input into their browser */ - public static void buildAndShowMicrosoftCodeWindow(GeyserSessionImpl session, MsaAuthenticationService.MsCodeResponse msCode) { + public static void buildAndShowMicrosoftCodeWindow(GeyserSession session, MsaAuthenticationService.MsCodeResponse msCode) { session.sendForm( ModalForm.builder() .title("%xbox.signin") diff --git a/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java b/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java index babbc8a62..df163f5b1 100644 --- a/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java +++ b/core/src/main/java/org/geysermc/geyser/util/NewsHandler.java @@ -32,7 +32,7 @@ import com.google.gson.JsonSyntaxException; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserLogger; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.floodgate.news.NewsItem; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.news.data.AnnouncementData; @@ -88,13 +88,13 @@ public class NewsHandler { } catch (JsonSyntaxException ignored) {} } - public void handleNews(GeyserSessionImpl session, NewsItemAction action) { + public void handleNews(GeyserSession session, NewsItemAction action) { for (NewsItem news : getActiveNews(action)) { handleNewsItem(session, news, action); } } - private void handleNewsItem(GeyserSessionImpl session, NewsItem news, NewsItemAction action) { + private void handleNewsItem(GeyserSession session, NewsItem news, NewsItemAction action) { switch (action) { case ON_SERVER_STARTED: if (!firstCheck) { @@ -110,7 +110,7 @@ public class NewsHandler { // } break; case BROADCAST_TO_OPERATORS: - for (GeyserSessionImpl player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { + for (GeyserSession player : GeyserImpl.getInstance().getSessionManager().getSessions().values()) { if (player.getOpPermissionLevel() >= 2) { session.sendMessage(ChatColor.GREEN + news.getMessage()); } diff --git a/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java b/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java index ac39f6823..ed706eeca 100644 --- a/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/PluginMessageUtils.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.google.common.base.Charsets; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import java.nio.ByteBuffer; @@ -73,7 +73,7 @@ public class PluginMessageUtils { return SKIN_CHANNEL; } - public static void sendMessage(GeyserSessionImpl session, String channel, byte[] data) { + public static void sendMessage(GeyserSession session, String channel, byte[] data) { session.sendDownstreamPacket(new ServerboundCustomPayloadPacket(channel, data)); } diff --git a/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java b/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java index 8adbc6e4e..28fb53ab1 100644 --- a/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/SettingsUtils.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.setting.Difficulty; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.level.GameRule; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.level.WorldManager; import org.geysermc.cumulus.CustomForm; import org.geysermc.cumulus.component.DropdownComponent; @@ -43,7 +43,7 @@ public class SettingsUtils { * * @param session The session to build the form for */ - public static CustomForm buildForm(GeyserSessionImpl session) { + public static CustomForm buildForm(GeyserSession session) { // Cache the language for cleaner access String language = session.getLocale(); diff --git a/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java index 805fec807..aa5893462 100644 --- a/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.util; import com.github.steveice10.mc.protocol.data.MagicValues; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.statistic.*; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.cumulus.SimpleForm; @@ -49,7 +49,7 @@ public class StatisticsUtils { * * @param session The session to build the form for */ - public static void buildAndSendStatisticsMenu(GeyserSessionImpl session) { + public static void buildAndSendStatisticsMenu(GeyserSession session) { // Cache the language for cleaner access String language = session.getLocale(); diff --git a/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java index 6226ecbbd..aaa780ed5 100644 --- a/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java +++ b/core/src/main/java/org/geysermc/geyser/util/collection/LecternHasBookMap.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.util.collection; import com.nukkitx.math.vector.Vector3i; import com.nukkitx.nbt.NbtMap; -import org.geysermc.geyser.session.GeyserSessionImpl; +import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.util.BlockEntityUtils; @@ -41,7 +41,7 @@ public class LecternHasBookMap extends FixedInt2BooleanMap { * Update a potential lectern within the world. This is a map method so it can use the internal fields to * optimize lectern determining. */ - public void handleBlockChange(GeyserSessionImpl session, int blockState, Vector3i position) { + public void handleBlockChange(GeyserSession session, int blockState, Vector3i position) { WorldManager worldManager = session.getGeyser().getWorldManager(); int offset = blockState - this.start; From c3eaee6267c53c15603996e7e38532a04ee3245e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:32:17 -0500 Subject: [PATCH 702/766] Legacy API: return null if player is null --- .../org/geysermc/connector/GeyserConnector.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index 8a1103834..0ecc40c7e 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -73,11 +73,21 @@ public class GeyserConnector { } public GeyserSession getPlayerByXuid(String xuid) { - return new GeyserSession(GeyserImpl.getInstance().connectionByXuid(xuid)); + org.geysermc.geyser.session.GeyserSession session = GeyserImpl.getInstance().connectionByXuid(xuid); + if (session != null) { + return new GeyserSession(session); + } else { + return null; + } } public GeyserSession getPlayerByUuid(UUID uuid) { - return new GeyserSession(GeyserImpl.getInstance().connectionByUuid(uuid)); + org.geysermc.geyser.session.GeyserSession session = GeyserImpl.getInstance().connectionByUuid(uuid); + if (session != null) { + return new GeyserSession(session); + } else { + return null; + } } public boolean isProductionEnvironment() { From 58330bdcc2c28838772e1bbc52bc2a1d0e3eb574 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 22 Nov 2021 21:57:09 -0500 Subject: [PATCH 703/766] API: re-include some previous changes The API will not be updated/promoted until after 1.18 so the team can focus on the update. --- .../main/java/org/geysermc/api/Geyser.java | 26 +++++++++++-- .../{GeyserApi.java => GeyserApiBase.java} | 12 +----- .../org/geysermc/api/geyser/package-info.java | 29 --------------- .../org/geysermc/geyser/api/GeyserApi.java} | 37 ++++++++++++++++--- .../api/connection}/GeyserConnection.java | 2 +- 5 files changed, 56 insertions(+), 50 deletions(-) rename api/base/src/main/java/org/geysermc/api/{GeyserApi.java => GeyserApiBase.java} (89%) delete mode 100644 api/base/src/main/java/org/geysermc/api/geyser/package-info.java rename api/{base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java => geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java} (67%) rename api/{base/src/main/java/org/geysermc/api/geyser => geyser/src/main/java/org/geysermc/geyser/api/connection}/GeyserConnection.java (96%) diff --git a/api/base/src/main/java/org/geysermc/api/Geyser.java b/api/base/src/main/java/org/geysermc/api/Geyser.java index 64b4f02b5..c5ae7fa4d 100644 --- a/api/base/src/main/java/org/geysermc/api/Geyser.java +++ b/api/base/src/main/java/org/geysermc/api/Geyser.java @@ -32,14 +32,14 @@ import org.checkerframework.checker.nullness.qual.NonNull; */ @NonNull public class Geyser { - private static GeyserApi api; + private static GeyserApiBase api; /** * Returns the base api. * * @return the base api */ - public static GeyserApi api() { + public static GeyserApiBase api() { if (api == null) { throw new RuntimeException("Api has not been registered yet!"); } @@ -47,6 +47,26 @@ public class Geyser { return api; } + /** + * Returns the api of the given type. + * + * @param apiClass the api class + * @param the type + * @return the api of the given type + */ + @SuppressWarnings("unchecked") + public static T api(@NonNull Class apiClass) { + if (apiClass.isInstance(api)) { + return (T) api; + } + + if (api == null) { + throw new RuntimeException("Api has not been registered yet!"); + } else { + throw new RuntimeException("Api was not an instance of " + apiClass + "! Was " + api.getClass().getCanonicalName()); + } + } + /** * Registers the given api type. The api cannot be * registered if {@link #registered()} is true as @@ -54,7 +74,7 @@ public class Geyser { * * @param api the api */ - public static void set(@NonNull GeyserApi api) { + public static void set(@NonNull GeyserApiBase api) { if (Geyser.api != null) { throw new RuntimeException("Cannot redefine already registered api!"); } diff --git a/api/base/src/main/java/org/geysermc/api/GeyserApi.java b/api/base/src/main/java/org/geysermc/api/GeyserApiBase.java similarity index 89% rename from api/base/src/main/java/org/geysermc/api/GeyserApi.java rename to api/base/src/main/java/org/geysermc/api/GeyserApiBase.java index fec8cbb3c..1acf9b5f8 100644 --- a/api/base/src/main/java/org/geysermc/api/GeyserApi.java +++ b/api/base/src/main/java/org/geysermc/api/GeyserApiBase.java @@ -27,7 +27,6 @@ package org.geysermc.api; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; -import org.geysermc.api.geyser.GeyserExtensionApi; import org.geysermc.api.session.Connection; import java.util.List; @@ -36,7 +35,7 @@ import java.util.UUID; /** * The base API class. */ -public interface GeyserApi { +public interface GeyserApiBase { /** * Gets the session from the given UUID, if applicable. The player must be logged in to the Java server * for this to return a non-null value. @@ -75,15 +74,6 @@ public interface GeyserApi { @NonNull List onlineConnections(); - /** - * Returns this as the Geyser extension API, if the platform supports it. - * - * @return the extension API, if this platform supports it. - */ - default GeyserExtensionApi asExtensionApi() { - return null; - } - /** * @return the major API version. Bumped whenever a significant breaking change or feature addition is added. */ diff --git a/api/base/src/main/java/org/geysermc/api/geyser/package-info.java b/api/base/src/main/java/org/geysermc/api/geyser/package-info.java deleted file mode 100644 index d36f70d6b..000000000 --- a/api/base/src/main/java/org/geysermc/api/geyser/package-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.api.geyser; \ No newline at end of file diff --git a/api/base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java similarity index 67% rename from api/base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java rename to api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java index 2a1266d04..6a5e7ccab 100644 --- a/api/base/src/main/java/org/geysermc/api/geyser/GeyserExtensionApi.java +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/GeyserApi.java @@ -23,14 +23,20 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.api.geyser; +package org.geysermc.geyser.api; -import org.geysermc.api.GeyserApi; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.geysermc.api.GeyserApiBase; +import org.geysermc.geyser.api.connection.GeyserConnection; + +import java.util.List; +import java.util.UUID; /** * Represents the API used in Geyser. */ -public interface GeyserExtensionApi extends GeyserApi { +public interface GeyserApi extends GeyserApiBase { /** * Shuts down the current Geyser instance. */ @@ -49,8 +55,27 @@ public interface GeyserExtensionApi extends GeyserApi { */ boolean productionEnvironment(); + /** + * {@inheritDoc} + */ @Override - default GeyserExtensionApi asExtensionApi() { - return this; - } + @Nullable GeyserConnection connectionByUuid(@NonNull UUID uuid); + + /** + * {@inheritDoc} + */ + @Override + @Nullable GeyserConnection connectionByXuid(@NonNull String xuid); + + /** + * {@inheritDoc} + */ + @Override + @Nullable GeyserConnection connectionByName(@NonNull String name); + + /** + * {@inheritDoc} + */ + @NonNull + List onlineConnections(); } diff --git a/api/base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java b/api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java similarity index 96% rename from api/base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java rename to api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java index 5c21fa1de..a38dc2f91 100644 --- a/api/base/src/main/java/org/geysermc/api/geyser/GeyserConnection.java +++ b/api/geyser/src/main/java/org/geysermc/geyser/api/connection/GeyserConnection.java @@ -23,7 +23,7 @@ * @link https://github.com/GeyserMC/Geyser */ -package org.geysermc.api.geyser; +package org.geysermc.geyser.api.connection; import org.geysermc.api.session.Connection; From 5acd9cd2c5a44e7073242ed74dcb276c2851bb27 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 22 Nov 2021 22:14:41 -0500 Subject: [PATCH 704/766] Some missed name changes --- .../java/org/geysermc/geyser/GeyserImpl.java | 4 +- .../geyser/session/GeyserSession.java | 41 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index 2e30a123a..02fc29887 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -42,7 +42,6 @@ import lombok.Setter; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.api.Geyser; -import org.geysermc.api.geyser.GeyserExtensionApi; import org.geysermc.common.PlatformType; import org.geysermc.floodgate.crypto.AesCipher; import org.geysermc.floodgate.crypto.AesKeyProducer; @@ -50,6 +49,7 @@ import org.geysermc.floodgate.crypto.Base64Topping; import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.news.NewsItemAction; import org.geysermc.floodgate.time.TimeSyncer; +import org.geysermc.geyser.api.GeyserApi; import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.entity.EntityDefinitions; @@ -83,7 +83,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; @Getter -public class GeyserImpl implements GeyserExtensionApi { +public class GeyserImpl implements GeyserApi { public static final ObjectMapper JSON_MAPPER = new ObjectMapper() .enable(JsonParser.Feature.IGNORE_UNDEFINED) .enable(JsonParser.Feature.ALLOW_COMMENTS) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 595603f41..22bb367b5 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -41,10 +41,10 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import com.github.steveice10.packetlib.BuiltinFlags; import com.github.steveice10.packetlib.event.session.*; @@ -74,40 +74,43 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import org.geysermc.common.PlatformType; +import org.geysermc.cumulus.Form; +import org.geysermc.cumulus.util.FormBuilder; +import org.geysermc.floodgate.crypto.FloodgateCipher; +import org.geysermc.floodgate.util.BedrockData; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.api.geyser.GeyserConnection; +import org.geysermc.geyser.api.connection.GeyserConnection; import org.geysermc.geyser.command.CommandSender; -import org.geysermc.geyser.entity.InteractiveTagManager; -import org.geysermc.geyser.session.auth.AuthType; -import org.geysermc.geyser.network.netty.LocalSession; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; +import org.geysermc.geyser.entity.InteractiveTagManager; +import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.Tickable; -import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.entity.type.player.SkullPlayerEntity; import org.geysermc.geyser.inventory.Inventory; import org.geysermc.geyser.inventory.PlayerInventory; import org.geysermc.geyser.level.WorldManager; -import org.geysermc.geyser.session.auth.AuthData; -import org.geysermc.geyser.session.auth.BedrockClientData; -import org.geysermc.geyser.session.cache.*; -import org.geysermc.geyser.text.GeyserLocale; -import org.geysermc.geyser.text.MinecraftLocale; -import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.level.physics.CollisionManager; -import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.network.netty.LocalSession; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.BlockMappings; import org.geysermc.geyser.registry.type.ItemMappings; +import org.geysermc.geyser.session.auth.AuthData; +import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.session.auth.BedrockClientData; +import org.geysermc.geyser.session.cache.*; import org.geysermc.geyser.skin.FloodgateSkinUploader; -import org.geysermc.geyser.util.*; -import org.geysermc.cumulus.Form; -import org.geysermc.cumulus.util.FormBuilder; -import org.geysermc.floodgate.crypto.FloodgateCipher; -import org.geysermc.floodgate.util.BedrockData; +import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.MinecraftLocale; +import org.geysermc.geyser.translator.inventory.InventoryTranslator; +import org.geysermc.geyser.translator.text.MessageTranslator; +import org.geysermc.geyser.util.ChunkUtils; +import org.geysermc.geyser.util.DimensionUtils; +import org.geysermc.geyser.util.LoginEncryptionUtils; +import org.geysermc.geyser.util.MathUtils; import java.net.ConnectException; import java.net.InetAddress; From 98816f1eaa728ae959463b7242732b5a22064ea5 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 22 Nov 2021 22:37:22 -0500 Subject: [PATCH 705/766] 1.18 Bedrock properly works now --- .../populator/BlockRegistryPopulator.java | 4 +- .../populator/ItemRegistryPopulator.java | 2 + .../bedrock/block_palette.1_18_0.nbt | Bin 0 -> 41760 bytes .../bedrock/creative_items.1_18_0.json | 5206 +++++++++++++++++ .../bedrock/runtime_item_states.1_18_0.json | 4322 ++++++++++++++ 5 files changed, 9533 insertions(+), 1 deletion(-) create mode 100644 core/src/main/resources/bedrock/block_palette.1_18_0.nbt create mode 100644 core/src/main/resources/bedrock/creative_items.1_18_0.json create mode 100644 core/src/main/resources/bedrock/runtime_item_states.1_18_0.json diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index 504fd5b8e..0f2d0c941 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableMap; import com.nukkitx.nbt.*; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; +import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; @@ -64,7 +65,8 @@ public class BlockRegistryPopulator { static { ImmutableMap.Builder, BiFunction> stateMapperBuilder = ImmutableMap., BiFunction>builder() .put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER) - .put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER); + .put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER) + .put(ObjectIntPair.of("1_18_0", Bedrock_v475.V475_CODEC.getProtocolVersion()), EMPTY_MAPPER); BLOCK_MAPPERS = stateMapperBuilder.build(); } diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index 52d55d2d3..e672a75aa 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -37,6 +37,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; +import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.*; import org.geysermc.geyser.GeyserImpl; @@ -61,6 +62,7 @@ public class ItemRegistryPopulator { PALETTE_VERSIONS = new Object2ObjectOpenHashMap<>(); PALETTE_VERSIONS.put("1_17_30", new PaletteVersion(Bedrock_v465.V465_CODEC.getProtocolVersion(), Collections.emptyMap())); PALETTE_VERSIONS.put("1_17_40", new PaletteVersion(Bedrock_v471.V471_CODEC.getProtocolVersion(), Collections.emptyMap())); + PALETTE_VERSIONS.put("1_18_0", new PaletteVersion(Bedrock_v475.V475_CODEC.getProtocolVersion(), Collections.emptyMap())); } private record PaletteVersion(int protocolVersion, Map additionalTranslatedItems) { diff --git a/core/src/main/resources/bedrock/block_palette.1_18_0.nbt b/core/src/main/resources/bedrock/block_palette.1_18_0.nbt new file mode 100644 index 0000000000000000000000000000000000000000..0415c135a3e1221c962da5a1ea3b831b4cab3d76 GIT binary patch literal 41760 zcmeFZWn5Lk_b;r1fP_dlDhMil=q@OwR zzn}ZR_j&Pro;Sby=K5loy=Lw0nVGd_zU#YY@5eBVJOBP+uG9xdFH4tXzDA?9SIqpD zLszaIm1})GyVmCz6P>HnKV<5z_kQjpx)=?ut-n~2s8Z^PVIKhwDYh|0NSue#&?NxNKH{8uH>Rp@Jk^X#@L4WRQk7Rn3p)j-Z{?SP|n_Wlb zQj%ndKrmsYP~-Bevr*V|l74;FE~spKUGZ;MA0A_cfSTWuyMALz)!g{rliQ|;Uw~TR z8I?@U%|n7yw#JrLp`JZ9yXhl=l`9tncmUPmwSc_N-nRM=VO)aoi*wby{+8C`25@=co6wZ~T|)Gw=(w1i zcZ!|XAxh}*m&d)^rh)^<>BQ?sDZF2Om&#UTj?NWf{~BZn*KyJ9tQ&h~)y^Ets~&Gl zMfH!z+sD2gZ);=MF7wKnf2+1R%->kC_k8;@sUbQ42zKUO(r2@D@k@9p(kq|#LQ>`= zCv3-qzog&MD0#cHp^)~%H*5#XP5p=3%Uq}QJT;F%CrJMX6#LS~$~V%iHiv0(F{wDC z1COX@M?modS$K`~JugWBSox0#DNV&Pf&oU z7b)TdB8OfQ^r?6TZ6{Cls|AXK3mylZ?=5?CDl&fA*EH)t?UGA1RNq;Cb!XJ1jdDb*x-(s;Q&+C2F%gnlYi*tBZ<`t#dO zPQ1l0Z}uLsY?fhzO4h!cvc2-)lSE#tPdMXmYys|&{@tCHG1T;Yiu-)C1(ywQr3h z^&nED(j8q&qi>ygbXmtRmiQs#>{CU;`Zo0IvH)@ClQh%b2C)Q2Y_itsH9x<<&MXmP zMSKUldQbd$9fp|ZyOYUzBA=(r9PRMecFMf1?7q5*6LI`Rp4R6uCo|#}b`f;Km&G~` zTUxR&b>(PFo?_V*Hm#DY?GOGv^xL5!dA!3sVViqac)ePovY*d-c-O)EaiaRFY6EK0 z{-lD z7i>MhsXN|oY-mm^Xpnc!KMw9Fd3zZu;d)-<%;6T*?~!b&fr^8+xEUyA%g$L4cC>R| z$3zhlURqmuKN+s~`(~Nta(lDpZ$^U{Yj-W~kN~*v4!L5!{5{^=SIPSW{o~`ctmMnKSpFYUSxa)S`y&U8n=aDB)0vMKI%NkWn2&{<$_LQ3w!Hi* z(|xYl&K(nf5VsvJ{k?yB`MdEAkB!=ynUcw)#p3Awrsv*edaBc!1&67=Q|QSTJ9XJ6 zF$|9>o_o1g+&I+MX}n0ZN;p|upF72L66SexvEU#QYdSirvYoc0(y0C`m%+#M7v=o9 zoZg>9BBFYsHAeTer~HGDghn3;4L>5P514#@!8S;MGZ-AOkrS{HEBUA8B28*;Hn#4R zZ)_4e{14Bw6WgQfBFjm0FM{If`15|$%NVO^rL zo$*=Mq?pplifezj?Y0+KY-0~?)2QC3QKbl=_sQLh@=v;3<1oM>>hjPXjkl*ss{eGk`#-F(<5nZhfc*zeU+*gD2VW&qpzMLguk-7J?rgQ zf`4sH8dvws%afeFb=&@ML7i(zG)h1;8XU5<=q6>fyx8GyTG&kat3Yg&3nPx0SxLcD;3?RCiZByxhR`(H!@^RGLO6 zZ~MK1XN_cCQbI{+D{0iYDE5lsroO`KDkm75Zg1`a$vv;Wm!c!fkd%JD`$6u4sDJpf z?kI-Kd=y?Me6n?LXJ9?yo}`fV&8^nj{O#q{?PWW-#7w5=R@LNArl;0bS?yg@vUZ)l zCvLh<{78$m^5eedEb|l37fx7z`urTW$#OnA_{8GI-Gi+~?0QU^eC=f^JX$sRW8_u2 z*s)j{uxHf;gGpWNLmQtgKlMw%#xwH6KK#qBt@k3U6%Qp2PX^meoD!09#yeY&{yi3M zcsC`Mm-tRx0I2Y}+Slt^hK!1H;TAlZ;9te?`=K26WFjHxH&tH;>Po%D%g$eq#OT3- z;1T!++e}*W^kE|DfT!cU0O37RjzO=zcNlkieRt+k2~oAPKx4*}<^<0v3?&`;_0cyB z9W+Ay6=vUV)e_7JD+lce{ zdUJbMT;zoJO-Xnl)w9VC3Eb$N<;B3)6_;JqDJfN7ghV$gjBp>##afzKo<#|XPKbTk z^)beMz$eiW{K%*We3tV@VL;H4M(U;An`h3Y=50QLZqr7fB)Y=+Kv7-N8X|1jib|Y=wd!CQ$^HKa{ctg(s z*Qd!nq9{=0z0j+Pmia>JXO z2isn=4gnD+L7)(0|EL=H9fag%{dkehM*xOdi z0}5joHKVz|{68HxSO<3QemtEPYj)SK{G!h=8F-5#Xr`<5ZOOuuh`O)Bb%Z=aPy)zs z3D%4dY+ntU%T~~;QMK&-v4_7<7$Kr(Ug+_pDWG1gOEdQTVl$v``DFepbjc~5D3gvS zWIXgm&)(yJ>MLt!?bYGYCGTt!RbhRbE@STtxe(3m>EHD#PQrOdSbz0$`)p=Ba`+pe zdl_4oZ|Y-mkGNWa(1pMwN7nmzPG9xV-?o6PQ@f>JL6MQ@m8n?`Y;+q?9pL&di?kLr<-VakM?V6@vQZ& zJpNwv6td*n*Cxzg7cMWb{eB5INpaIc|FvZg)C&gfMOk41bzj@^KYQ& zKo+J^pg@lXMHaGRRMj~l-Qd$D8?u3=`%fo~ zzpyK!x#p1dcAj~wcv!pV9r8x*QT~g#XZl8^d7Js(xtg4f!ESXoUyrY~5}34DtXYd8 zN;{}8xy3?e6FCM+9u7GK;0cI@DDby7@Uy7hEN>-3JKRnOY`w!ogh#40j2c&tHt7p< zE!C{KHO)e|f8?LWCUO;4mXw|xt2vMToa;(ErFQPBoEK>%a-cfyEl%Hx-#Mw%i`$lR zp3{iy=UL6YF0~&%hZE+%sL^gv#y+>bR$7X)eg66Skeb5e3Hdr53}?B{8>Qv1cWO9} ze_!aH`o#oW+Ip9ZfpfT@jlUq7m)(UKFJnx1{lczI=$j);uhaAWuY)l%H|-_)+%dqT zb*<;GqL%Hf5A~PfGJEsap{msnUot&YNs1zob*gB{zlqf;AuNWPY&$C7RIYrwk!VgTifb!Yz3ioMo27UyErKc<5pCgI$FAtl$ZNn z0ZC(llEAN!5aU@gj!e0)-Bmm$@-Z~gPA--#x{=jA7lvJ*6vreYqQ1+M8cMZRy>{3P zff>)zab&_u$f1;UhBYrfJk1=hd0zQ7AE7el#clw86};A{*=SQy^R#p93lT|oorH-z zi6Nb2xz>YWDGe;KdNspeA+pA^6a@6J;)j0jKRkay^ZihIpX`kn=XAITF&*_G*mUD` z#_AykHH5`IwT2%yLwbzoA9K*dOQ;`m!!6ki;6!%WZY!yK`ih|4sM%3bttHju%Wej& zg!m!XH_Lqky~yqw^-OsL1H!ISK9)^^W!rmFuNmqe>(Z0(aydVwMd3MxJejdBrKRZP zg1?ZVDy6kJP~iQr^j@Ot1ixJq4?Rwq`|tb0K;v1y+mW%k9hvdlk?}A=j!a7vS~Lzl zyqM-8S1I^klZwFaE3;(P{WfZwU2W{KnU?<<1&3wcFW&u|dOG{w*RwAfL16ff=;Xq? z>SVa1^Q$yYsMrl^NEsL34|kmmf$>3~CUBp)P?KjknnSQ^!kui3gi?Rd!HO{-a%EWV z9q8hA*KmMeLLXyi(}Q4cc#N=x?1xpYATAxdke zNu8P(d5iCrf2|EkX<`LV5lqdb*O5m#CCek2q?ndjV%ap^RmOx$%8fwGvll@&+@|pW zJzlaRhNW4HcjQS)eTPefEbjziNwpDVtSL1hqL+?Qoal0gTJyA-@rZ8oe7+dcU8|qg&OeOkFFDo?p|#8+77-*FEA7~r!1{)OlIwxR9!}? z4&;Sd**Qn`JEhfCBzo14X96KD>?LJ0R_DLEpnwo`S&f0cD)$bF;#W*j3I^FoS#Sa@75jYeY9 zxyCbRDbE|FA>5Qv)$!P-O8vl6D5X@j@$P&RN7RdkDV~{amrVRN^|Ju?qrNee8uBmZ z9o^CNQuN*4G0Y0?uQF!~ayZ+JOLm<$@uk#H13b$6)Y2vx=HJ_lPP)H%p6Ah0|HhO- z!BN$wh-XtiBe-A3{zE-C~@+JG^Np&VZ5m{H&aE2U_{xOB+ z)VNme#@75hlt%x#tTfPGYZ<(h=Oux2MJ`9Eze-`TH9kdKL-WmiygP4E`5&-^z)=<@#t==#3~sPW$b`75Am%Ms~bQCPf~n4;y^2EUJCLL=?3#r!+} zrgr4`pv7UIT=bIbJ(~`TVNwW@&%9#MjQbN|S*t5&9@1?zvt2?LQt%sx`=KS1qGgm# z5pyVdok*Kx$*%pcAxZUPwCSMmvOs4Wws>ZCKsN_R8=ItkLjTRz;+nS=T}a^x4)@6iMn%skn{4J#E1{IUr?Jj; zmgY)EB|9#Yz>18fcH?A~b?B${VptR%ootE}^$mled7csq=j0y9>GBUfo028a9i_17 z8dr;>8L8_hf2HcJ%*2|>)op(rZ7z6zIp>2YAXznun@!4EzS*r?ZS2+Rw@Jq3sQ6w}#0Rr-XXu*E-N^OE&*++c<*_)B4!a z@6^RhN*~W`yW&poU+cpPda9H8GnOT2^WEcCd;Et@%D;^M46dHg*j%ndORcq4ygny>$So{#czsOdT#((+ z+;@LeeWE()98+Wn-#ee~Qc~`3PV~NqR&#&Zr{oV08Vl(zeWUlWf|X~JlJ}DEy4p_M zCtYP-`3p;6(;X&*FMIq96M615759;|@{Vb?-|ygOEML$tg%DG2=U0L@I#t{JQVYy5Ct_)!H1!-P z&7lG%1W<~^2TBr;Im7EMw6fNn9!!sZ-7WF9wyK4%;`ilgvMknRgUSbOP-z7fMqN-@ z5V4eHGC5ZCcDe+=w~to1#-(-3X;+^-`FK-EhM!uf-)C-wC)%pGp=Z4>VFi7E5d zn~cN9LJN6;?0WNeLc*e-s^neH9-V$2)Vwm&S4%IA@2*KYedMa5HhGv9-n_hho(ir0 z<^HO!@&yYEPkHdviMZQWR^n9!+|R>OcC+gQ2?Zgms>#c&xjPEU97Qa|$EjYzO*;w| zJ4X-HrY*`hoE~}<_?2p#&dDsKbsY)c`q69GY%=3_JO{5dZqDlc zeY)0%M^D_HRGBD}7jpm*`LUw&Zcer@V--}4PN_vJVQ#7{6yuvP{Ts`g7uUtiYsU&z z*SMobf9AHK#R!(eLiKL#C6iN0*|@G7-7j-P0}Y@eI<)I-Zh=xU1h{8 zigqLJf(&6=VKQxsc?a3N77%J8nICQGOW7HJEmh}s&_0iMA4-3as%R5s?x`TnKAt2- zDVLvyrl@_;#vVztf-UOQCUY8IetYYadsBXP=VbBsUCZ$UE#{I{lc~XCOeKecjwf8} zU09$}3@R2#N&FM89ZWmnALu!J0%l?seMwpoai!hF-`93(?*ow?5Y6cTkv0hs&EL_kd^!DH1}8@POzH6^NjBfye+UA_pQqbRarJiasMn zw8&>Y03yG8K$L?NF(IFY1w{BLK-7yAaYZz&A59x4^>QW8*BuM}A1V_2ZCJ_AV>AaX z*Mzi*U{Y!drOB{kvz-K2LdMG(?M0H9<~`~c@}{fD$JX637dDrnGOQ-6_If+?u#&by z3i#i;u<(Z~o-9)6_QEM?D16B(gT4vj`5U5rrsE5u%c*LKw2!<;`R*;M|F=qn!>HF7 z_BVZ!QmxE}$BvCB7j6D1Qk1*_u+isob?h z$f-P1qs{XxA`d3|G}^g4EalvAb9$G33p+DX#*{5|htHqS!MQ(rCDe;cFnLbUDZz9~ zxx)=#$m!jB$JxqC&ax-lc}|aN_!zMSUkK>#&c*%7$@6^~`Qk-SjiN*_{1; z8A7$yrIXP0&E0M2wnFvJ^|Mpz{Vt2zqz1ijJZ_`Bth%*jopjHpOPpWvlEmpWSGTX= z_pQ>!*cRl!#eHVosJ+=^eRWh@9%jp zrX0BD-qbo>G!C6iW7Rf3z2*xhTxibaBYg8`nZ7JX`8!91z%SOMfy_6!Zv-5&lj}-j zYpNWH?PYY>X_qxSsci<~a#`MuEth&py(3beIU@L$zL3TAiT-xQGEw2hx=yM6ep%z# zo58}6=sWY;0@Lo0^8nlE?K`!guUW55o1gAS_jbAxmvrdx8XjqOKDOJ0!%dqQ_oMr& z9MSB7ly;e{liF?)E@#@rjL~pDoqWe32ll}9i9?#rwV5(_#1oebZb+B zOrLn96jPRNDz9=xi1ZkRP5v=oirvR*ZR6lh{(Pwz)4%bNn7va+6m-@0Ve5TP_9WjO zAf50;JM7RA1mn5?FesI(c1$cB3?Q4bfXUaaVDQX{CaTh3U?vtxUAs+;1hFO!SrUrR zm{!889HrY!7f4*?Om+BCs(~~TjBR+8WqU^H0`U`V<==mq!{}dT8+9}nPdB28R zIU_z&r;|#toTm{aKKAMV;~k<17990A5fBz$2Qre#{Ljs;baY5R;tmw zqMv+CNm7Tv<7MIG_`EDGQ3@(Nk;{Jbtse_e{?K!peuZIBuT~=>#4=$RWNS4+2)hax z2KjPr(8tJj7zV{&UC=`67%Yfly*?<#cMTRqzTFV?bMXWgl-TMsY2$|1MDUk2Pl1)j z2<^tWa#sq~YR*T~+7r(}`HXe=2P=&==8bXHnUti$a$`?rW6(q@L14tL5#O}F;7(Dn z1T}P|^(hX-dMN^pjMwf}3w9ju_r=d|D2LuL%2N&%89sk#UgS#<$l22wEJ1Fz4|I9F zfo@`p-K34{LD95}j@q=YU@K}^w{5B9vcrtbpw~n>yWnoO8=@ZvQN-L) zHzDKavatAOpEe8c3@Om4=BWxDxY74?LtzGqp7|p@2&E5L)-x z%E5!C8Ynns32B$s>CRZD0B&<*ILA9|M#?)^ywZU9{-5#xZP zC;jw^wfcPUgyS!3ODG$)+0k{kBLy5izRPFQ+V8+t`7diXGaI!9`HgYo-S!ri`OpTO zU@IB?`PmI+Xw0s3GGVb9&-u5Y&$WYDpO|Jth3QOwS^s%?(B+c;Hh9VfG))LOr@wum zT|?m|+p`4j@;jLXTGsubD!y*3Q|xoYNC%9av2V{OLsEXB3VL;|F55FkrCv9GBO4s| z%TDU@s_8=6%!{%`ZfFUZ~(YlC)zzlFRCh2JB{F4glZ)RhL-uGH(=)s;Z^8KK*Z zFM*#E{Wyyv5Vkm!oiE*WnBUZv*=R(mV<(R=v;UV?VXP&)(p z)>jnmt)Zs|@_*jZwxfnQK;=h78QVXF9z*3u&lIK8 z_=af}d+kg-ZHTJs8N_Au;W=e8juYlakb~6P7f1 z>=xXS=wv+coh{f23M;;7z!UCBm=d@Z0qb^KC@u{aocRfK%~mXFaJgK8E~N<2eY4cK z!_yM9@Zd6LRE-pm-T$U!8iUr4d#{nHvMH!2=Q3uKo)nMg^9}pVJ=(O)1N}9M_mVr% zo6)(E^y#my!yoCSS?%BFK;)P-pgruk(WGSqpXj8SZ4H9)U{)H?nIvH*h^hgdK+Z-xo5lkm-H6JSVA%w2IceQ<~ zybT{^-PW*}+%VYSsH(W?M{(;ysx{mkhJRn6{S)qyp~}DuiFVXb2O}`7a_ygR4vpkH z-zm4F7A$lj_KPdv!IT@_h@!}Lcre9I4`Se83?7`+9*l%&-_X z)9;&PQkcju7|r!Kcf*4dTH`gX;~;hfZX6d@9Q5uxgtYy7^yJEL!9P_mrD;qi2x)OS zY(pZ^$@$tkB|_t%D^J_sKn`s`$U_bX{If{ientY_k%5=e)RupMZgn##1Ys1kX5a7z zIjSI~R_rt;m^>y`ucakHk7KPP@$4L`A=5bQG`0_UOsa*XKlLuR@9=a4Ev#P5Rze1? zESGBMy_EJ#u6_@T6Ysht6PDOEUH~hc1eSK#N14-cF zF{|99cwkFopGBoz%G}ov(0(sD!g<~8i2@JO{oOb<=R(kk@8V(tt$m|^5rtpd<3%UM z#IFAm5362Xwo_?43cs|~Eu)o@NAIQL#d!f(;Vso=CzQs4e8MpUb$7X1Y3Za)=Vht` zZ@~mk;kSuhfdby$f^R_&DAn^#{%dhpQ*gmk|J;&HL251VDL;KPe1 z$k<<5EU>Y+eelX?Q&?<-ay1Si`))U_Z(b~MMKU-?gNX(YqF(!nKqwN!gUHsK063(F z2a&Hd2L+{a!-KS&0`Ue7LrL*?2ZHewX@3ASnt#%t zZav)!Kp>>2LvB62vONg7OmoIZnDx*P{Y2V#gaNqj1j{xUQGjAN!4i)~DiHt5{|6-g z6$);W!uLgKfMP_!I&Ypm2y_=PK>@l9OCf7V0sh@n(d-KLvY16_Qd|JujB9Y({S{Ul zEqR(;t6pBltP+#rf~~A%{?4*N%%1doKx+kU@E*V`#oYj;glLojkkZ*V?NB384)Z^ha{%rVyVwC*mFuAT&(<4nfVX&c5Urm!D$&pbY~u~E zjmdTx;~Wy(^sZFVTmx(a04(Da5TJsIr?~-wjaMB~WrG-V_IOR{f+Pg&osM`878-Xd0Iu)7VC@cNrLklH<8Un13T7Oer!feuZ82vjBzOXjOYe4jxi5BEssH1q zz8aRdTh4VBZ`B>mTRC!Zol;J(uC&kIA4Oc!=}7mP$x-(;M9vDp5&Zcm!lD^hy3f1Y zbzl5Wi}b)6Uk~KaqbS1i@C#YYnPG3bHsI~hO3?m%U*9fH@AXrTzl9oBh2Oyd6uO2M z-Y)NB>Pj<&*Nj?6j4uJ0C91xPA`}?%3D&dXSQ0oug9lTu{>(;*5yOMY)|wD0cJ%OI z^5tekP$W0lNcR9-NtK2_pj>Z7Wc#YYA5d(!AvzaL;181803;8DAgw+R2SShB-zw?a zk^7sbbqEBxzYSY~eF0c~6{H=xzx7nMBNkFigZ+4x;QtrQ{9iEhf5FUu0?eF#_`p`P z_lN7f`CvCC0PZwc(Zr<#{>Z)4z+6#IM?n(Pdg@aO5`(sAqzwsnl@ z&4E+w4E71E>CI^591Pa^9O>eL+8hk-`yn*2RqGXWzb$>NPLsA#1WkJ!C{8J&AUT={saZTz$!k1}He>L_D3TiVz8Aa-wQKne?TOI8Fw~ z6uI;z=_yVI+oHGW&<+YN22biN=>h5VrFB~i6AE*ck!NpuZ5cyD;+t|}tuqxPOZm8_ zcfozcStiw~()asTMs_MkviFOR!X&lR%z6ay7nj$lVp9yj^}tUz85)a~I$At#i@8V) zGJ(BUs0EO{SD$c`T%OU$^aJ!z8w8SHi$vGHG;e%$6Fb5*usEU@*wooPx@gxO>< z?A%;T&Sm5+Osgc_TdVbu>UenRWEM2JhlA?9nBUpS#O1Ewt|BjIpf%$FstcMk8awkm zx7L2}|zCjW*H5AX0~&00A;w?L-O$heFFwaY85G)lsE4 z%bY=2%p#tq`vvf^Ggu_hr8l>`vNITcf0=%-qn4e)Gn+Y`rsE9wK?)>­vL!Lf=f zJuU0N{$gF zk&t6Zq**e-XJEMQAXp{fumDC*#?$r+6(<4MH<|(j9}hT1aMeGDC*|L8pOij+L?;q2Sd6AHJ}6H1kt4BKR?q+GgTM_+j*Q9wQj6R zGeK-q3FP2f7H#+~C;QOg$ctFOu>gBtan^wT!M0|Sm0*GZAV-`-2k!RbA^!0)nv^Go z0ya)8hn>(8+GYW#3jj!NsiGa(i1>FrZk4V$IOIq0p6I1I%*v;oUPZX-RwVA!0sZ(;| zv_Ioxtq~C4uWlUE%pCOg_%@!)zQxv6<)I?9kuOK8f zu}DvbhomNIq@KoeNy`tOS24+ zES=3)zrRAGkyK2X5nyRP0uJZ-=iPq<4mGH@G0y_R#_RyxrFgLew5rxY6+|wD6OBC4 zgn*<7Ir1>Ph3-fJl6l`dZU2Itc03;&rhiQ2E)XCC)<~oP*gJHp5Y^@n4jYYg^^Jwcyu!8YObJ~d^T}>-@z}L& zu8LcK1%hS0MLFyrJmrdE(_8vjB2H~@v2@PBb^0(2T}206h62Aa>&@)E%9z`pYbWo zQ76r1+LBb^KTo}i@`G8H^MJHNYR}hd= z-Hz!n^!O$_GHZteQIJ_XQedHWEMB(Qn=ZDZUox*A@*{C8XpNxD1c{>9ZCRM6S?!P? z@!x{7k8SOY%$9H0K_+U(J)@2Jj~>{0d)2i@sDCpu+lpL75rZ`@Wady73uIlS%-u6S zgHWBOynYBtOr>!(3?Z%kKuh1;P8me7y@h2+9&+XckUH;fq{=FT{O;1G1@Zw3^4on{ zXuBI5$Y?yEO+%|@qk(4Q&@QR%8%X}qpp`~_=m?b@dBrIG3FibVx#G$pjoj5Rra&vU zb&sV4JP0t)WY&PenRYSEjE73j=venSYr`?X>ZWN8#{)Y#>!fv^x$vSkb|V0y-u%PT~9Ac0k9x|A6Fg`~fFZ1y*#wH=A2VX%DlD|Qk`w0+;mGTyJ zA_e?Ic6e5tew8|s`!D+2K4G)#N_Mi1OSQsFbtMN#=cQ2LoO+TIuIo~$xaE41GrW6J zs5qSZk|P?YQm79r0jv1zy4$-Oh5@Er)5;wWkQ1!6Rv;M#5^eU&Fbu%Q#aeseff;9Q z>1CxsCfXXVq*@;)@~U{0_Ih8y0{`QtUJYK_v{JYi@`h=Wfsr z=*XVr_I(y62(%bS4n92` z2r^MT&|qJzL=EVO5@R%JMIebBe5M~xhX%Zzrm_V;9fWL(=t{i@9p!G8k$260n-`c)O zz_hXa1nOLmV+;HN2-YU8VEW$wN@aDm+}x=*ygD^0=nXBYG;TV%1+~s#$!^U zAl(Xrb8MbpL7>NwVP9*JolfEUYo(ByYI0jk!U0KAC7z+E9zra{wKMKjVlKI|Z>UA*Pqvu304A->BYqdT{Y z`}o%FAp%Rsj8DA_RcYnbN`5AGI+5`pKSfIwvogy~D@|Zi9kigB1baYcR1*|oPyh=e zGp!9ufi%D{NX_eliVpg~X&Q_ApenmLaEQjNAt<}}Hw=T)8XSBX!v;>rJdEdEc`6N1%%f$H zREqd_FeU|{7(H;-0H?ee6avoRbPNUZBn=#7p?uK*im_b=hzCHpn5zI1T#$1xE}w0a z0H-H*xNBVz;Gj_V4;E^G;EZbq+x$Vdu`8=xQ#2`K≥SYbNZ z>d;R7VZgliIAydkmFb#`VR@=+{e&(@5m#g#flQQj{m>Gzdtq5h#u_8D1@37SaaHn_ zEDTt?l(kz1GOL=#SwDpAdgK%UJRnRRB-b}bhN-SU3d@jTYW^C)Kp;%DzF=f_&c30U z(w1!ch&R|m3F6Z(KRn2?ASuXbe8N-o*CEA&j0E7>G5%$vanHx2y@$>Zp|SW*MB9w! z0im(4Bct_0dipMCMSA+vTTicSz4dej$gQU{-+DSv`>m%VvAQ$2;%*eL-xw*bpf&Q` z05?b~fpY`j4gTem(!qh4kH}oq#6PeDLQ-<;e+ei@0CvcQ0N5#D1IK7Uo&h7yKoEIk z#F7z?4&0l}`qP0Z=yB%sdqL!p5oZE;AV?x>TKgWn8wOb!95!lafKaSnSqgml`wyg8 z@|*)BN2ZjRW&nOM+615lA_uZh!RieFsf;urLCf!AP@Nb8i6|)X9)LDw{Xomk1Ni{{ zz~zuDfKQ6SDJeT-ehFk3iMBz)30m>HY6*FE2ANh}0$}H#xg!MwOks?NNCANEk`$o} z%)nl|93W5qZwuI^^a531e4B{X?Sg zM>Dp5H4zTpSr8`Qt(yX$9@$-npZMJQa?d-LAYtU0js;vm9XG>0Aumu#sBcsvhkAVr z)un)1_L%p7i2EFz3NM+ubX6z6jqcdHH@N44Hx25qY%2AW!5fh^H&}(Gn#Fa92H2r% zZJky$PxoE%#5uM2yGt`_Z?AYwFUSQ&Q@rTLaXBZyF{&UAY(Esx5jyskw}};0NApf_ zjT2+ktZCi5|D$>fTExHpn8C95e(M7*hikig<2s@#MO^ETF{;-%w-S6_Y{dDG^WA`Z z0t+3keW%7|OnceJ$0vV(h)Dck+3KpOUFlY=+(lfO=fUpo_9%TdmXxIVEFX@w=o!%d z*;ZJ4Sv+AYkQXI@bi43{48}@`{U_0a|6W-SIsdB{G&?ToHd<7aTzA#7`9F{SA3hjy zD2NgjT5rYx6+clS(=L?bfio}EF%Rr9kENlD?3~I3)iZhylf)dyDS{7k8TUIUS#+ zw%%yZ^-z3%rNJloiGM3FP)VKWAOe2`|8eU{$WrQvmb$0oR4y$1jdth(pTurd`#M4S zC`Izy5j`hQVLUUUa`h*VQ^)vMo{p%6*8QBa7z#Z7v^EVrQfqSR%<7d;%hTmJPtvrd zI{npTXB_21?Nqp@YTS!}MjCVOhuilR>tIolrG{_f zZ3FuK2?^{^TBfi_#PDE}>SBNG|%re|TAS zn3tnJ_6{cIZhYKJ{z}6=>bN&s~8Wt50@Xl&(6={D(+EZ z(S-+1L@X~#ggpyaasRdfst%hNIk9qgS4E$zal|}tSs%hv;)uD|<@+Yzgyny^d=aBx zCGMT)(t_GSXsjIRknNBc*DuVYU@JfBc~Wh~VBc(bQf=pFn7dZm|3f*FfV#B5mw-~4 zE7{9BIV9m4(g?G?!G=w;CSUOd@>k}bsZ{#}w5jxFbzPN;JQvLDy5eBUv=CPP4cZqW z;Ew@B^(e>wW~YA>ewHQO!w|2#dbBCnuf8osWz`tdUgLnj8E!=$4~=w@yIg#iR-G(U z`O}9IGrvm;yg}qrXgT6DFtMMly?f+gQOHwU$;Ul;mgd2*Jr~(_T%+@*zcQZxWSX`k zJ^aLnU03zYJ+WUxPoO0L&+F-s2>dAVktOMR9?b+>AJ3~Ig9O%S)PMsoDjW*5`XNt! zxt0L2LeBZ|VbH?3JKVx{RASjc_vcU3@(p_Jjc|QFZC(9ERGz2XX`{a7JWfZ&+$SNF zaKrn;!9=e3jJ6(O9mV$fq*X#4A->ZN`J@vU{LaKKyW6BhpeB9)q#;bvx4v-M0O$Y# zH9b(nbr1}55}|&vZxDu#>4{kOy;r&JI&g6y3LYT1apjuwb8fs??+5jZqEn}Q^*nUU z9WN@}ughY49Vp1>CHnffFzugsM!p?~?bI!{CEIkVUYQzS*c5*H70i86{nZ0}+-O$c z*n5}P);*F-??6Q7XMf15W23~8e}{%y%E3F|HvyQOWDM`*!V>Z@5@{_{qA3kf%2zNb zHpIf(C3I!n|EGdVA#J@VGoMm@n51u*=k%3(ZQX=>#nFk3UW2BtNpGk{(vOffn!L=( z{x)|`Vk;J!ujgdXk70o$hrMYNdVvXXqcqx>?%(Gr`RvCHC)Cc~Eb0B$S2?@pd6~Jr z1dT1Xem|}}UhV0=#jh)=`4_%4AKK&e6nAc@LtXmcScjZa)R?f16e&PKPi`jR%^?z#+>*aV2lOmnq z&EkLGOlnfbPK5+4?8oY3gf4Q_4UicMiV7pY>tWmaajgZfB{p1yGPF2hZ;i*hPiErOy*sU9qiqD)e1w3*Qj(FOd_|_PR(#e3x z6Dj(R6j=b#GC2_SAVpPF9@bMUd-*kgYccenuJhnEi1+P1Z4e}!Qkl$6Up`JLcD`A> zPr6kUm_@v0RQ2xbqPWwF?4Qykgw9h5rxi@HTw3+ccY!TZ{yOSisc!RS(q^c#3;Dk#1Gc9V}4q9XCtjDuniL{&_3JnOKn%m^sXRJm47jeJ$R3G=A1# z)vX>H(#{=RAQ2z$WWzIj6)>A9<7Ky#T~s)GnIYMo`xJbL00;RYfcX4MH^W$mIr2vWvSvz=TT zBt6uy`bi|WQM0)=2hI<()vm(x>WV|O-&X60kFd?ZM!t{jEHV=NU+-i8d5}|BH1(YL z_^-q#DTV7t28uBvk{X8_oc+0Z=CQgtb&C(fXeS--;&oJi`e~QIh)LN|{qv{Y!glYe zkc%zlU-u)gVJb@WhB?o9C-jcU%jUgl-j=%E-xOr0HMKTIGZ()bBJEh~43Bn>rbxK^ z<09?$z(qb8+38sA`7t&O?y;wPTGLV4bi zfX;jbQYe5F_9Bo%C{h@N6jH2d=;I3e24OFaPJVv-n8x4r*m3b|U?=!;&EGdvH2$yF z#OBck-76WMscm$tJ}nlXFTe~YI(Lr}Z+JFbp6w}S__@I#BZAc|f50XGd`(V3Z9`kl z>nMYY@sAMWXU`m6{i$Mc{qplQv3yn4{KC@Q3880ck537qIKSw~B&6HE$kTgt9C{I| z1Z8|-oky4Wtnr0P&bjz^lGs6QD=JLRIrsr_%nm*Q6Yw{>|5d^=Nk^}tQz9o{RAm%{ zcyITM1=6(iMHlMV_P;6qzSP^vldxOK+iZv%GJW+};n#-*P}_U!$w^n3d11lNcqG)z zgZ#u6N8)UlxOp%Xy6N&6bEg=6Lt^ z57nN8P_G`!i?Iluw7mkcV##{6c?~ajoD>a)v#sF|ciQaN@>bnvy>13y_~_4gKW0aM zRAkHX$Rz6Rk!5{O#ui2E|L1o_SfrkrJyoR$asKyR5tAvx$+Y!d8_h zdkd&Io^M?gNC<%h2?PivSa1mL4#9&53r=u%cM0wg+}(mpZ~_GP;2zv{a2R+szyJT- zd(V02zO~+2i{ACsSG%gKt9H%w6y1Br>fn}D)ruO1WpGH6XUn8fXr2!thay|9y`Fp7 z05|;^50Bn!%O%XvqUpLZmo718b?pv*+72&~&TSd61`RvOxpeWib89>Z9f_{)9{Q$X zAvk>IImc%b69s)ZeAclH5P*V=ej!EU^fy?XLO>5lyShi;nP-O&;;bM>LJEHMw)9dk z3S2uQ3%eLrAu?z)n(1wBh@t_@Uz9IWU_7pq*Xa_fcGtEe>ovs!!;X=^3>s?I@3;as zW;Mq+vRD2cc=Ph5^omrFF`BK&kec5UwUOR|YGq7mRimHGXQy#J8{vt}(Aj z3ar9DqhE-X2?KpLr!2i1AHbE35?D3@%UD6LOc-pi7>D#|d?4)tBWqaAxIgc~dA*iR1`S{rs!#VFOnfukpO1LhbZ*mt zg{ChnYLV_MLQ zjTzT?Is*jp8-@XXaa`qess8bH9;fs78rbIJt1It#S_ZcFWwee(QM~yJDyeZC(FP7( zp;5PTBP%80;{S5-Qw{yJpTDQMAucyvW;Pb|GS1$sDR(kctPIWk!M zU@fo)JaSSnl(?!@+?(m3h&4aH{V?gHMA;RPLiG(FJ&{(NDngU%qv^)LtAS+ND?{#U z-14PdGwt?)k8(Kj#X*nt@hqmHCRH_ocqnyAtbEK%OB?h$;mg9*KP);Yax zRMrbqCd*Kh)66@`FarZHlDTwoRWOsOlNU1zJA#t{HUQcHYz$D3sFUas4LgD-7S5!g z^TAg;Nb{xOr=yU0Mdvil_#_i2u0R~;u|Knh7ieX$O(WnX1A~!}0^Qgdg{F}+(|{UP zIH03dHDc<7xv`?&d*agFE)Oaw0_q1pzV_%@6v)KUIV}^%F|kh+1miq5X4Xo8eq_K* z@-4mF7BETBNi<-R;0)<7lS~Hcz$C#L2;rFV^(UWFRd4MZh9s=5qeANL(-uFgvZEg;}KSc#b<< z-%*%$JNRvi!(*H@hZiTQC<1HrDC~bSR=pMtCTCST=-@1ZT}%`c1^uAsS*W;l1z-jq z>;+6?z_svM*BXLrIUlOR`R7{TOtZtoaCpoC%dBzGQUyK`O~(1)46a1ua0DZOnK0Tj zQN)44<}puN!UdBV_2D5-z}OX3`p?ESo_WV5WuR0&%cV~jZ9A@K98t?FMsB}#@B(-4 zmM(sO3_T@?e#PMdI-26`t>}GJouZ<4dUQTTqoO)r| z^UzF_P&w9aIkxUm)^2o_uo@a-l^37yb?b;h?tg(W#rxDimqxw{=%z(;vE{N^yz0b! zYC6ZKQ;1As$>R?T=kkuwkUpKuC2`D!PAKgryDng<&CLBJ_FqQORgUm zHAtdvEnbRK$bGfzX*}Vn zRFUz|(Cj?&eIaX_rX!rdWv&{`6J5I?KVGZLRpFgHaN&8uvcCCXEhS}VQdzif!9_&& zXIDmTq|To=HGcbIh4AUlK?{wM>Ym7*z#FpZTyKjSGf0?I66_t^#^!Hv~pm)yVIZyZf_9*+{(3TVcM>3OP&m-%n)>#>N8Q9kK$^O$MGC!QSq zxoy{w6va?t!Nt04!^BfA5)r0jM{f4}umzLNuL)$oMA9mdD$T?f`8nU0jCDWhxo@M} zx@zaQ@i`795L#((#(}oY@4Y&C>9lhAet~T%i{rNZ{t%%vlm3<-KO%m<$%GYwP>Yqu zz%op1Gv`>Hl~Ble#dT}Y)O_?7_+LJ%IBb8L`h6}w=RWtMWPT(KBIxtncw3aMc~azh z^zckCJLH5a)v)HhV)%)H@t?vSr6@<$KVLk_BkKN@OsW2vwI=uc6Rco}yJ?rAqv;@f zM{Cm?!R(*49%*A5>ip6>baX`I z=LreGxuOoqNVD@JwqIOA6b8s}n%-RNK4QO5mL9^racomU6Hjv&g4&_7kdj?h!>V)ekk0hD~NPO$9_1I&VX%ZEC;;SnBOhEiI68Q zsP+O>0}5G+*Pejo2P_d_(E%Hj9szX!3oAsq9t2onpi5#R1jVS$@_Mc=FYqnB>p!!8 zl@Iu}S^xdvv<3R8^RGi`4C!72H1>ZzzO;d^ulV68$rrUF(fxlPL55r=LWrKe*ZQDE zCeS@FE?zG|_rSOif%8Ry5$FZ|gcVo0Te8;smqZm;i~e$wZzrUhLn|4V8A+@ev}l~G za|T;=osiiZuMCv-G{F}W>GWD>m*-k@ME>u><>^nzze^JeuEXTt)&w57GWTVS<|kt*)ED2h@1d0-Ad z@vm(^e*fCkJ71Jy4Kh7YHgw2=NmpI{R#yE~P z7W>4QOLP+sD~lW{3675I*Hf2h|EfzzAM}6wCMHLsnStjQltNP~f1=>i6GhNMUs7;R z*4(#12*(rkGHTbOcAxk2Sr*EH=NV1d62nMNFQZ~I6o@?S?gcY zOhlp^-s`?A|EPQ7>pt9a(znO=ZQ2{DbNMYD3qJ^czD^&UlP8VDFhU|oAC-0N#h5_0KS(l6}Aw|_TSu*v>jlXD}* zC6(6xy=Du5uq*&*Zl$;e^8l~{;6*V2)c{D90dNUGSQP-=cR=UDIOsD+oe1{lN`zXn z_E%I>vG>GTN>XS0-k<6E<)D&vWbONuQ+5euaCF8?C}Vaw#xY^ZP`OK9F<7Ea`;1y-7NxM3Dc(CR@- zbhM;$W}zf^@puj-Yd9+W(daSaD?Chm10ms${vIY0Cee7P$f$OC4cJGPWHz)Opx8fD zW7YrLGd1N!6e2R#zS_MR8xxag*lu`y!OQk|~sY@q~|_CWN?P9#vZ;g-$A2Yb19 ze>qV5b#)` z?m2L_e-LsN=UCr+*U!zf2{lNUfq;#X2Uh_#W7^itA2p@RKus5>R(BQWSxkDD9eE(m zT}`y#=aoZx_euOxkzfw^;}@8TfqoRflp>g`a4=|}j)A5}9vnLwJZ6#JMMNGD0hC92 zC&yjw4T>1Js~>?oe^^pNdS?xia?-o@oxX>l$O9PDzT5YpN-+0WKzfHuFlX&(&^{3Z z)fT@*BA9F6>wAz9zdYuy768Z@C~1jbK90pe1;7~?Kz212y4Ge<)j~Bo)7{dyEZK|( zy?)59K8@Z|oyvD9T#q7rM?SZ8Jq6W2+pHZ3bzaDh6hA(G@Z=t4pR=?!X1>*ZM2gKO z`_{0du_tdk?mU&fmSg=xxLb5ZBPcYitraIYicNJ8cndS*0^Y*tVBW$ufw!=_ci4#* z46X`>gTSx7v&_>Tn{oo(m)n>K0OUo#Y2zV5&<8im&D$i5;9i;GsQcs{LfNHoR_fqL zuJ$s|USW%S4Mg=S(uF16aPTH)j>a42xzh_nzuE*(=WHDRNu8{ZI@m2xbVFB`$zRl zb@6~`{0zE?XJ}^P7u5?0=01(Lww~4n!$z8<6C7qHOZXR6Kd#zo zO9?D$epb|E-N&Oj(jh5#i+IQZX7A*yAkKnF&fnw<-b-4qCQ3eVXzMU*8cli7xC>l_ z>5KPke}>+6WH%qHCERrVk`ptou~YcR^PS%MBF3`ffr8o;B~t$7HFtAS+~%Umvf@#z zsI6^dat1>^BiN_cQ&{$yl*R34+lxyt56!nX_S7j$ClyJra;z#cl+U!dq|nIWpEJ`a zTWk;id)Mz%dH`u%9e~#7?S4qZ?evNMa2}K;;2-3S6%&DvlpmI|BiP2wwvTHLU+vAqSQ|)v#Ry=Gf%N|GYf`Lq0q8;CXuQ# z-aw|GQ+=aHv|BuNb01G$v=MQjdq8wKjhNl6Gb;9wHh_;+o`sYDTYAjRE_j6;62Xu^Ua*UeOL@1=TF%=Z_~c5IXUYBj+>+G9D3@y zMYqbLhHol{FRs7sQMSJEwDd1+ zkKPS;`x2v5#x~gZ{YZ6b_SH_-9g||)(J5RUsN^72|yK2`(x$Y)T zosCD9Ox4&w%O_-_b?yXIr7gDxcm5*IF+tf|hI5)>=-!DC|0VCtBd=uo_67CBC2Q|x zG~#2gs(W@j^X{_{?nulFvQLwe--`}i3B>zLRVFW6%tS3mOI4JP_orNS6k4@O6k01( zB|sJ%bL!5GfVe^(5Hs*+CD<2?73)-2GbA~LTaLj+L9PVv&D^zvn%mJ{)$vtyE$IXW z?|HV;Os$gSxam}Ua&!qUTAta5b0s)>;1+>3k9U!aq(JU2?Q!`xNhZFGd%DY?&H1s; zSShWmt_Icy+-=MV%cIfF(=ZfBy5(m;F`>1Ux6F+}nE;w-Y_ zUP|RenVb;}kB>DCUyM1lpeeUwB|jcNjz4ULRQzwpy(M|>1$lS6e7~mW{+Bb~|KK=# z%iYS6l8!=Rk3=M|z`r4-C9gW%Y)1MoG|?HCu*jD{L2>L+vi#4})a=K`)`8K%OwSL; z-d2e}^`9;b7kK>C+Hg4^e~`Oemv7cVU$WlWtm#5v4c%ZW^M1W8iWKqQm9`$B-!!bD z_BL!EK>O3kbG@%W(j5pPWov!|u3sM$UFcosNgQgVelKJ`{4y z>Diu`1ckE@QjPQr+EP5}Htk1uAgJ9y!Y?Ej7~`b78E^6Gd7>p?W-I$Flm(AUR?3UD zf~f9a1tPW&HW*0N>5>9!`EvXB^RNIp?ziBpnqdokbGL_pZ|KF0yv!f=8nJ*pl(_BZ z{zbVUz((3lC5+&j3|^vnHsqPtN-&kzKKRBaY(vYE?G-reHm`X}P`tsNn++^3m1tGqGQ^ETdKhdZ`i|GSKtzjh6IorMl5!8VeG z&d(Da)B^!fy#AZM0e+UV8Dtzhc&2D=SkA>091Z0i*ceY61o5zt@hm2z&aLu|woC-} zqd9Za&8^C^kn=3=CW2DBm;;-_{TPBHR`%+y^kq?}hKYU@U^{5V9)uw z7mD_nx3XGsOYmR{n0@E#ZNPLox~#|l5@pYHww?;djBT;_07O0w5bV^LcFTz#0cp-f z=&2tEWwhB=%x*7`w9|_*3FwkpH4IAi4%;h^9~k?4By>2?OX$x`p+TvG9Q(uP9z5t; z#hxPR#`#f2_J~)n9Lu-(b4KEq#Fft8)%SUsJxE+ZL{FnEs}?-n>l$D4BRWe+WPIZx zBa`bQz>K9_LqqOYv<-SnOd4Cb4ltHo(6=aK)iKb1?pVjNF|S!J(Tl0#2(^oK$dTA5fcafU4uy zi07!ANiI*^jM&SueDPGP+0r*ls(}u}f&3?;AN@|f;F#kQPG4h7>NCDkuYptn^9QfS zq#2aC{oSo$8X}p212f)R-8w}z>$ADJ)#$MrTp0$Lp6J5^Xt!oxBb#SQYV_VeM@8rlp;wAm*UbP=`gzD zCJ|rW{gFup*|VbUd%x}%8;X^^7FMt(7xAELX=C-6HO_hS z*U9L^=yd9?Oxv=Aw$Wvbz!G(rC>#IoT+^Zz{c6czb!VwprIw6!Kp_p$tt(wc{d?_Y zdd_aSW9{+i7h9{LJ;7!kfBdl{6g(Spm<;cJJ{SO*}i9Hk{+46K#Q|?`UOgtP8hk2 zjd=k@jt;0H7zF_oB_E)aANS;~Qss>2?AlDM-k<#Q%md4V0m*`*coAnHZN@KbN}KLx z2-Tc^?=dd|?84*Fx~V~?C)eLR_rjAtX1k^ZIYIRneO=H`Vt&X$Kt=jCPTq04p3ZiJhTQf`F4 z|HgH7*|Qb(PS3dn#@l&cH}yL|7FF=~@ms%f-IP22QTE2w*s{Bi$DCGdSxtlKOx8Il z#<__vyk!FVbtByhgY?)T=#6Wk#_v9!B~r2FT?&{=NDS_<&9OsbvvG0BORqUfc{x`4 zoovb!l=Cqx)JNBy5TkqEbAy#Ct*bl24)M}`>KPzzrh({Z|Lf7;_BJ7%Ay{R`-s0Cy z?1A9;*qNJCyi{LCZiVj(;`#sE<9_nOif4S~zIiL`$7n(jeK27Pv(9eeuI4lF^a^cO zPyx#g0IrV^&tcb$is@$YyxoQE_x;Ud6-TA#njAuA)hNsEWlxLy-6C6O#G_LVOifs{ zEGtx11KgcZNJ)qFg2Gun37G$s-W}Fe_m!)r;|?Z9`jg|%Q(i@B=_IPIF6ey==E8dY zeoI<0IEh6K?6a7E5E*g}VY^DF+P*nt-qA!j=0I;U36JJ&Cpe~OSRU>cz~lQr-0$8O z6mBhH@TxlroT5Ee-kmzt9#lbYYerlTY2EKzE*~m;N6mHS^tUf?(;@S!m)EX`(63RM zs)YwgR|ctZJEPW=<12ed#>?F^zDiezK0KOpry=RIKdvZ`$_}o7x7u&t|7PAio4>P_ zacMCTPf1u8T^O%@cib}P{cv=>e*mJ8Rcq_4yAC*d#%)v2To`5)YR+7_e%&5veBC)h z@Tq)1thLg9`}&9^*3s%wu9%22_BGF1qYg+TjSIH8G&G7BpJ}JyWmyP z82xV(O0)eN5lgoJw>N7?`tI41ct89B~=Kbc4L+gN5LPQ7L_}9VP38jhq zoH^3_+SA?%Xj)$zlIvajYW1km=FQD}Rm_#gW7q>19o+&g^fUV$io+O0Gf2bbXN_jj zaz=^W+&X*K%}7NRPKI5W+0XVOJgb zkgXQgA`$y#fm>1g`_HYPm*0(lKidihK7PenU6=8v41D%cU&&-}h=3dhD4M==6Bbb% z&^U(C%>ABP4@v^U4|3yW*SS4kt&MKL(|68<5JO1P5~+xS)y%|kzNx z1fYEzjj=BNh-A056Xq|7+l;5wpNf=8^sY%;dDE%pi1%!&BZfomqWsS!QT_UMPCi0x zqPRLDSw%!GiiGwX)925j^Fq_1OVi_R`nY$(&S>?JqEWQSfttC3g9q;1#^^!t5TJDY zOG57GqG!YiA!cyzql;wS5%&}eU-_PJ{gb3|-8SHv#JTJ28y1{cJpGgC(Yh?Ib4Kn? z*5ziucD~I%>C1P#y;U5Pd#TO?b%i zYdWrGS#c`_btAYP0I`@+}5&n6$ED5*0?vp5^cX*v3y%KCUw+L6{XsY(Y`0JK0(M& zpLh$RCau4XsGuFl+_!5|Oph;(*L}C<+>5qkl^66_d~vet7L(4Aa0C9k*9863e9@mB zRAA5c&?t;`xcGeyb$GkwY5W>j#bDd1M|$RG-n#o6ZsB~Fk$dPuj0?ohy{#Gh@&hh3 zpZvk2E>oE1X<1E=>P)GgYrySe>Ox;Gomk9AFhMG;$)<80MRQDj4`=ZHT`cl8LFVj&nLcIX?Y55zU(cv5Z0YIWzr&Sbp1omL*FvxE zF0hq+@pJd(n4MJ?Ue@N~{F!raEzaD*r^{#a-j;m#R%@3>rA=8C5AyJ7FRpdS;r;mC ztPQt~ADm;DZv(UN+0aUB#)`xoao$NQt-K91Q`&5~T^3Zz<%ZCdJOw|k#*0>Tz`Z>; z?6ItevZ%DJIXA_yX>mS0PuFwn4})g*a}TQ1o0m&ET!h;ck8C3@=MRS~U*gRL8%cc+ zoPYX!%qU~n_b$lzB>G9Xk#}kGk?uliPY5l(|FS#jlW&BSDRm<9_u0OrgzA1BgZ0m7 zPVE+?68U{%0j%HqpMJ8?1hqC8DiuiRZeou9K=xzVQwNH^2ij2=^C6QdVok`iBW_aq z8qj=Bu_L=TWM?kOwLp0*ZSXs&ieJF z4izfKPssB#VaaYyfJO&0$>c5mxjf8GcJ8A5@B(=okhP;he!bY26j+@s(ikypN|j0d zdI5}S3yR)#f1C1nF6(!xq4T&K12aAR0SW`S0S{(uY8kHA56o}zCO)$(Qq@**(QUH$ zeg@fCfmMb&TWZuz=75hNE6krgAKGWYsgDa z{|6&B7ckXC@=wRcJmN0?)iD!XmG%G0cxhCtb5NRrX$irztp1m!{kG^g z{C``Sx*gfMD44lyX)wJo>mc{`jX>EQ+Q>wV-v8;7O|u{a9sNnOJ}!PIkX&8@KINfH z+^BKmAVSNJFWS=EqIHG%hY!{#(H+|~yc_)|B$Qo2yafCk$$EXKC$!VAKHGP5e>5xq zA}%qEz5l$pQICKmo%V8NUU+2i@Fu5C>O(a|Y;il)PWe%7&Z}^r;ZW1}ah%@Moxffg zDu7eBr*YB01H$-TfiP;CA8JGw0uaNQo(4hw!1vf_)Bbuh687Xxmn$2bJ}*9T&pNyw zFCKBv1iW4ghhVtzlix1Z_(2P#KA{A*IM!B=&RA>_DFNLlUF`R ziGnR&{Vb@w+k5XY(a+fv=FX|llKY6Zus_u7PIOI-F59>x{g%|xyBKlbKeI$-}5id=;#2FLE8$2k^dbLDIpQQ8=J0eF6 z8h1$wYJaUZC!0KxHb6h0j{T3$DU-uG$FfEg9A^Aqdseeb82rLSi5F`Q^w;)AdLydQ zMXbAKl>md3Kck&0`FUo@{Z}K8mz45YVtfG zSRoh=uU3!k1};1(`3ZBHpbTj9TQ~xqY}WhCR~#LhA4#9g_Yph4ijXlO4VpA$WzIrn z=+G2fhs_aSUz)u4pCo6c&qSq!pZhYgkNbM!7fTG^5OMU->RE+MX^K9s_ zULmENSEc^btEY$grtH3<9%746?2*BVN&Oc^S=qBA-hECS2h-{C)E*Da*n4llGG~Rn z{G2$};K82u)IeXRS?nX~sK_OwFu&78VINRQieMWqkV790_9mv!u)VR^0QMvHtTsky z3jsfIG|-)xK1<=hT2*puMbzJ6h)13Fq@Z<&rud`z!Z-+a!KX7x242aJ*$MDM2_Gkx;Wgamb8&Dvvx7q z(~+!;zZ@vL0#m61-lC`Sh;x=La&?++j=UO4ZoZUqJ+Z!RGA?iN@*_uX`Zd6RKjYET zulTzrns2B!cWPsIym;HH0oO8zjDbEQ)meqH_xHUnP2iRhSMR{m+>FH)!B_N&%H!AbT2dD5A!z-hZdj;BLj0;zZD-<{G zVghkA8eAw~aWqIFz;HkujWFX*1`tQ12n6c@?D`rA)&b&Zd@}B&Bc^cX^?pN+3eM3L zel#nSNdcl$2o*RV6o5tpb-;|pz!nu)@z21j1~ZmC`pq89nCq^XlwyiwE=w=7&uO(H3WQI zFgbuV0FguV!2&pyc0uYJN&NTxeKm3(`uF_t=%~wN5T>K{{?cGyUrX*Iv|kM$0_*2@ zJ_~&Ya{Dh0?%Y3WeFT6FGbVBWZOB5Cu5%PxO=DJ%Us5z}z1x$EyD$abS(~p3-%XWVuU^sBbLftK&%gWt99Pf`*bwlVnHUbvW2QD238T?Kb4tHJ z1+cB7#crAd6k^P%t>|)d32PdAf@nFH)p$QjtOFuaAvMrUX;{dhol_^*x*z`MIQWl? zI%~Lzzr|%jZpWCtovSHw!Q;-ZiUO}|KhT1}$;A?gX}gIioQgEqoQJeF)2e?JbbNd1 zeN|IgHf~AtCVazu+OvnC%^XF{k+M-?;;g-|8?Ir@U zgRfRd$nHrX>TalgDTv~W2~-dFr#TK1gT9t}#LrYMCZ~tnC_Ez!@exPC?nvM ztJ+3NZdcx}Ahft$6;41zxtg1xgx=>a8SNwWVW?j&9WseWrK& zcTQm}63&EYlu&TNRULjlWqV=n7UY}XgT0)tr&)&w`QJ>VuxGBm*n0lANhVeKF;@45 zXHG+#-0PXEkhNQW1G3f{IGEo|)9; z$1I?*prLIPw2=%76*X6kL7{YQn}E5QYN;qc>`8$4*1-bHkNs}7I@Vzcwyy;0K;W;Z zCG5T>OX(cjQ}_;(bo3b9|fuxj|*3^Z#}n+YX5pU|>@z@y_LnC__rT(=YDA93DMxz5Zvx6%4>-xb02j`Dw6vb{_{ z%OvRQYF=x=_(K^)NRoE-LG$@`D=qOiYutCZ2+1#2jyUMQ{U&(OPgPFUIX~*dglan* zNcx=cRExCs5;Ts^B`(^#!A^0)V;5Bu6?<$ie&l$m0N;7s$2Zcp5qV#Ff2g#m;W^`* z`R?5pm77PM#boHu2r}n149B@@x`i`7ZTHA@zPP1f5Pga=)8i~9sAcmNQS>*7a6!0^ zub&_@NW|30Wb#YOTFPUC;fTfU0<0y?V>`J6>Ls*=TyVOdbhWvqk%y#$sD1I^bjja5 zfh+iyM+ZxunuHl&VY*^0Whz*+H_ZsFXRsq8@XMh*_0W4A+{Xf6s6d5b)A z!$v(7fh*pJ*N>QJK001Nrsl)qqx!djwgoyKx%Fg?ekwUEgZ}9|Gf#||Dttk~xdepg zR14g2@P-;svjk|z(#JC6pAN8J$$6^~?|Bl1vhGJw=$6{!acmdOll~r#KfGosZKk=V z6ZuF`=*oAQ)?ewz8CjD5e1H6XStzqij^Hy@72EGO7et|dGc0UO3CSSx-(2cR%5fB^ zpLn#u8!7m4l?0mD?>f4WI+#ze%CX~$xG=0!wVh5#wQGKRNNjo)sJn9AGKj6AqHibk z^Vf!7E)NCnyA!6yzi*=ZyMN@eEgC9+IAhgP4|-2@H+YC@(36`OW=2@=MGzlQjCWd@ z6mN<2VK&(1OC{=Qr7qUm*AATDU4EJPydSPlI{+XBz_+uDf4U=MS2uGWYaQAP#-(F&4bxDhH=!rsK zEqZj+`Rk-{;6g8yHNTaSwuCsh@J_pR6CgmqCz?b z3@En*?h0eQvtfP@zqMbV69ARWN}%G`N;UgN`USUj_M))Mjnm_&RpiW9$Fo6%xRLQ1Y+a1dIh&l4`DHVmPS~vb$h*|64>56yj z-COUb=XQ|UU{S=kPy&J)XJiu;`?(e!!6daTZ3-1gI~i@d6Ma! z;19T5XwX?6WerodmWw|Ow%i2~rroDC7okvi`>big(!Q3pcg;nim0Csi`#Cg8(e0wq z-52|nhyum!xYIrS1blN3P7B!+aEpmMV!ZU#Eh&CHua~mKZ3H<$hdsjb~tya z7Q8r-5zxo?-vGRtU?7a%5 zqD=6oT%=Pf->#7DRr(Ps8*pomy>~@3xl$zW4f3D{$Osh4KNfw2zQx{KDUpB7`v|Q; zxnQ7~Y*);F$odFX2)Kb4%0F4tV7r}IlvG>|RJ>`H~Ynn-K)$9kPK>TN3 zI5HJZIT3v6J<1A!jRG>Id5b^L(?>dg@k+`RxY0~L!QT54Fz;1fglBSQAD>HDB;WgH zZ;)V*7d`ZjPM|Q?IO5Okdn+X3h)b6QmAD434o_r1pP)Hsu6ZL#LVq8*^BJ95 z5(JS&ZiU6F{BUBDkq9_%QufU?#V@?s>3cJbD#gVvp4_D;o6x~4{mCZrc>=@*8h$US zd1~&2)nnVVriZp}(%+USteC~inrBt3yTf&^NS$;2;vF8kC&NT49PiV}wnUlb_m`~_ zwF$YBR-Dt31w#-<14ZeDiqne_f9lx{^~PNGLm_g+BvSl1grQdvlJHx>J$Z2UBKn_w zxN?|~IKoP4A}xnI-lmfm3k*&SalR+j<0ClmMRWS$&o|jYxT|}mj$roWRV%r~S9FI; zeS(8*w97vDh49cH!gDGOZF+dWt8{ce;Btua{VFvoXLy758msI3%We@ya$%-ZseXCs z^Uut$Jpw%DgGSDZ2#*jG(`_Q6F5mUJI%d-T+DY9YW9%rQ!p!iZb0f<$x6RTCBShX+ z55F)UC-t4bXbd0dzLghY3^{x_cWpM9UtX6y&sM_tf=l!KJYET7hp3o%jPkQk(yUZ! zP4)vBmESBs)_Jj_JS}-b17`UPDXOn}kNrTfV#dE=!Z-Z>`rvmkh(`W&e)ldi)^10U zPH4DJM~IbDl{r*1-^Zr`qg&+}klca#~Ykdb@cfvE<^=@;p_PU-5|zMGj7< zq{w6p@Yd|887?A1fKB>Jq4&3h$mA;+#XBT+{(B*pa+#3t^l~TUr?^}TpWE8uIF@x3 zVF_P7CEOpH%fb%k=5VK+=_5Hge&mW&6I*4a51n`vzt~X@OnuR7f9cbmJh1eL5IDQ_ z=>3Hne|Wa+-9vn>hu(rz7a-k(ZCv7i^h)*Jc|gNj)_NCq?^9>i*GO9U<(xb1Hr*Ze zQw?i>;mtH{Px4sHIbF!`Rp0U6h0~%D+Vx-~$+4`5`u8TR9AHOXvGcp-#)(D`nfLml zeE%wzbqAH5{p65c8{hK|vSp1TNiJ%;iI0`TDJ;`3ubI6iLN%hKkNH})gc|;n`!Ju`5#Ku>$aYXzqze=e+}5;DZE9PUU#k(~ zbT0*Ao5Cw7A+p7OE!D;BI8kQ2`Fc&0RLkUnJsC=&9e{tPsU+GEq2QkuR`UEOli3%0 z1?p_hh|` z;*ft-nBaONVayvH*}#{ZWhPYwEgV9e#q-WCztpcTUu@!DqQ9`pSOrRKKxwX^ zxkN>RC?F<|_(wt0Cya#8TIA37i&T*JUg2^fOKQkR)$~bbq0KBylF8tgIu@E;)XzY8 z%Tf$lE(~vN)y3KO;L1qfIvPyJl-;y+z=y)U#kTw%gNmm7boQ@{s1GWdIsknzpaZ}g zF#rqzFo6M602;PDgS57UjFL;2Q(vukCJ$0OZZFq;M|-A-k6vI`N8`e$5LY`3i6 zCmbGR8b@cim*bfZ@&8dC_u2c8a`miav4FyNeuwYV6M62(e1Ccjo%1@i{D@v1Nt`Tn z5FmRoH;^hc&+J!Bk)^SHwRhJ0o%`{}I#&YmzDqRS5O>D6=e4p$nOu|Hga$9`Wq&1g zmSHg#`0Rfx)JJQSZ6Hz{bL@mBb(Lcsi5FZX30Gio_Wa#g&Q~dbJ0OCO%tQq5 zHb{tzd{b+A6=P&CDe|t9L7~*#Nme9fTv$Pkfwg3HrgwP5jB}q@jzq|cTyq4urE0w+ zFgdqFrsI4`0w-oTaDH%=Rx9Hv#U^4LB_`^E2OLXO~p! zbIE8jp7Gq>7xBCw%n|}35sh(xB{=y8AsW8{AOV2H_pV=Tuw#P|aftyqi~$S*0NnuK zz6Bs1#=LR;GFeVtWl8dm%8Vm&Rty8}b={q$#Xb^JXj(t^{6U9r&PTye%j3U-LMsEl zei`vk5TP_kC~nGVug{C$QSB&j$)^cK6sU4|;b0%m(ucp{e@ZwKw&u!-6uQ0YL75R` zpXx%m!_>aC4IRb5%Dg#i|HB!X((cU0MilYsem78z9Jq_h#q@5Rbs@p%` z4O)6GcHP9aSQ(v(V}5g#zac<$kf$aBLXDW3dr}{zlY8wloA3+9v{3%?><-n_)$gz2 z=}4&&Qba!+V5It38%e%8Avh%ah}up~{eGdTsDp!C)IbB5?YtoG`5xJ@y2!>~j<8T} zL(zhq5!IODqBvy(nmuXkw^6y_uUWgANIC#4<&irQ#sr|7pOrOYFRS`h)a2!21N=fY#TmJB;!LZ zQe-J?i!=gqFOdAT3DkAS%|N8ir_E;fl#*ZQQ;3aA>KHFjl;+vAE286e_Ob08ge#)4 zb`P=r9DUpa(j>eqqSsU15NU4z5*!C542ALGJqC?Wq@TCWK5XaIE+?yOreKcN@X{m* zX(ygTYEu|kyGJziYKX<}=&iaXBL9dUbTiY1zFk>G+*PWBPS%&`$(TF4t_C~Pjms{s z)QON=Xh|sz{i&OzDLAq$(~_z;ODHF&HQH5Yts;`q6Nnt?GRj5pJm1f`C}9|FE%+Pu zA!4SH4Z3i_AyYR&B4U*&$;Otk!dDOf+X^=~sCW!cFM*JJ-kpi>lhW9HuEyf>+8N%Xf_If|-GtCfq-*3@D16PB4d!_y5^1gAPa^-a>HpLdkaYZP+H zuJpF+pO0S}TfEBo)JpfUp1uHwWWn5$4xyc!uI*7$TBsfEdeiZAN!9^zkDrnWQHV$W ziamtd$7wbbqRG>uvhBWn=KnL5x@#~iQ~|lr_IGYwFLq1UZAGE#39488~!3+mBYu z{90}@OMg0v`_+L1`|&C1l4cz(#*bQXoXNiY*3|!fShjO1W^s3CYPq7`{hJZ|yMWLx zIzNWL$;@aRvQJL#f;#vz3S1F-&Ge$>ayFze#A!GPw2e*Cyq>i0lX^?$s=e^2x=TG2 zwtAqJB|v(0?Xghqg&mkLfDF0s$yDmjxnQ#69i32y)`h-|35U-{Ak`Nvvgvz+LGzsX z**6r=aCqMpcO{Gl?@Sbgp9eaN{sY93+c#FvryyH7?QNl{VmW7MsW0>@2N{vN;$yyw zA|Rc)F9&WyDr;p=Yqy>bQc?4)nq}L`X>7*2<5{26n7l{5Rc3wxQLfAg{j$x#S?Z~o zHu7;DIGsuON{+za@7!$Ul~u%Y_M^3b?jCH ze5sD9iggl`NFgS=F)BH~z}^7Hk>QKN?|Xs7t10U+u?Q1WVk0=Zi3v3U-@ch6yyeo6 zkZ36QVOtvz`^`KSUtEJqvY{Y9rY69lT|U-kSPestQlv9hE@czRyL;F5dokyP zk?AKDuk;Wd3i|#1yy-`U%XY`)X`3@i`GgLKD%7V6kGx@_#5&7RkA(bE#`e2YQw40t zx2cv4JLYcaS#!mdg1a{d2`5`kDTFO8b2Xnxhv71*)%kzYZoZf z7dbUsd%)%5pFBVj0!mmMPz^DFGRfmPYver(;62OdJ^M&_^NH|Ao$yAC@J5C3Mwak~ zu*$Zo&RWV02`9>GF}zzO_0sTkY>Q4^y59CDPL$<*!-Z{-$HYq~TxE}`gA=KWvP>w$ zeE!T~xB7-+v&6fy+}9Rhi-k?5&9BN8<*$s)_b3hyMfkR=;s3R|K2Pg7ZV6IHb}kDe6Y+jOxz7GJ&fY_&B41Ti%Q)Zj zr_DBz?1U0;EcKyYywO167MetJUnR$hUc*QwJp2Dta;D)> zw|g9yHHwg-WRFQS=RsrNJ(g^PGRBaQC7Bsd3kumr%2FYXEQydO+hE36#+I!JA^VK& zAw!mAX)2RC_jJy=&N*++b)6T#`}*A9|L?wE{IBc2?*I4u;@`e7M5ecHUhMQDB$@PG{7Or9aQ8%{C%~!NO(*hccaRm?zK-C3+ zBY@R&08RlYa{{oR-Qxh@{Ya8ZeITO50k1f@8Ci7B8UeSHay1a#K_cLTp1MOOd5h*; zdt+TP6+JFXflhql0S=(-LD_<`2KBlQH>RhUW{C$Urq2k`BET4t_vE=Qo>qz1eb$W< z3Gx|%4;QGkEn``S0mh_}DQ!89ot2+$?O4uU*MAR83~(pN z?SYQvhpftM(DryLny>m_E=Gc^74@gP{d_ZaYvN!icp0xsVe1-p#a~nf92+Wkd%tZ{ zQ=ct91s*2rubE>+o0XefAEXWzot8NR+=(3x%FjwzIkI-V6d0NpZ=Xgs#qOqLvrqd% zZ16$m&>A?`ysQAG>?6bt#xBW*K`>kntINj-h->iMnVCUjC#|SO@1Y>8?(pfEmunyy z4-8D>`)y3qg9@N)NA|vd^tB_aNOl%Oj?0K+wSaShg4{US1i(s12fo(;z>Oqec+PHC z%@I|A;knq=foD~KuiI_Np#vW~LDGyvgC?tF(1Z;!p4fuJ)}yGb&DEXH)*ZqZX5)j$ zaJq^60!=4yb1J42fnJ1s|Cx;R)EXYmFSSoV$nOv-+EYFmSY4OC_SwLp%(u4X-f29? zvFkFu1VN+FeYK2j-n(c{?3Hq*m%M!E0gM2+djY_Aw&D#y5egI^0CoWQ{5i2xq2ZQK z&nfUdLCalJL)+I$Rg|NGmB!z*2Ps!DIJ?e=a?XC84;6L3)}Nvjbi!0=9E|De*q zcsoC7jq1@%FRw3|+RhzYMaB(22kIl*>67d0dgr)5sPGFOE5s*CVP?F*5}UinFg z=%GGqUs`W(ywsf6IrI}b)Rz~ZrQ4_(8`~p>@ri-OyyUP)c*STz)l3RSkIXHp#_o$M zW`i<-P&Oz5uw;V*0C6_R0$_Nosn097RO{vDX0cYQ5>X>qIdTST@Fa>bLCX7!6tw-5 zXfntX<-=)H$sdp)=yv)OEMK0t$V@6; z+6@U=8`3Cs)~+Zm#iB|JU64HMyO$i1-AG&hn6ce(PcI1X;>Ba?M;9+eI(Efe43Vb7~og+s*foaWNE@;RKW5XvUba<&4(5D5Y& zcb!r_XPcn_(d0@8UR8Lic}{@4P6J4hfk}Wy2B{3i=vLy?)4@wQru;wvpaX2${*F1y_4>+u_3=R&iNRxQf;3sB@nd4f62dEA%c0`vwobs9`Wv-@xXW%Cre#q@&0n#k z8Nw^{;;6ZK z4`eiXzHdPfSS`To-ywC_;r|_~!msE*tUF!>WWaqsi%C*^!_*JlRE0mua;;mCQyV39 zus;%N7X=4vo8)O3+UE4FVA>dkI;)|&p8_K%*wIPO=EXR)xi2jPZC-)vVZq4wv-EeL z+%uAvYhaL8KXDO^d+Q6f>`2#0?yiB^T7X^)uqex7gqG0+c2cIm1Y7+|5)kyWo9_N1 z7M*ykBZAQ5VhWojAssPPEM&y&H+LS&ZZDAd7mzw78k6iRCS4`HLSgFFujz}+ zr2B6^m1wL}_5O2cV20SscTp;z5)q|#L~x^oob^-L@s#(-bqBp_S8)|H^fhoPUr+<&VLHv(0M&8|_QENiUU^L(6z^}~fA2X+` zN?O$U$)aV~=ZzMA=>3*A1i$GTUzS|O%WH$3ntSz>rU?*j;&q!CdHmvV6?!Q< z08Vd%O7@465-rKnxNG4-nUGuGuOBX$L}=?8YNs+q^3&dGJIUP+_Za*6jOX}_xR}0V mmsQ;8Vqx1!AtT8rjJd+L5+Nh%>1p-d=>980na6kzbNn5zQoU9H literal 0 HcmV?d00001 diff --git a/core/src/main/resources/bedrock/creative_items.1_18_0.json b/core/src/main/resources/bedrock/creative_items.1_18_0.json new file mode 100644 index 000000000..d32ba0cbf --- /dev/null +++ b/core/src/main/resources/bedrock/creative_items.1_18_0.json @@ -0,0 +1,5206 @@ +{ + "items" : [ + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5797 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5798 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5799 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5800 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5801 + }, + { + "id" : "minecraft:planks", + "blockRuntimeId" : 5802 + }, + { + "id" : "minecraft:crimson_planks", + "blockRuntimeId" : 3840 + }, + { + "id" : "minecraft:warped_planks", + "blockRuntimeId" : 7598 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1319 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1320 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1321 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1322 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1323 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1324 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1331 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1326 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1327 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1325 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1328 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1332 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1329 + }, + { + "id" : "minecraft:cobblestone_wall", + "blockRuntimeId" : 1330 + }, + { + "id" : "minecraft:blackstone_wall", + "blockRuntimeId" : 507 + }, + { + "id" : "minecraft:polished_blackstone_wall", + "blockRuntimeId" : 6041 + }, + { + "id" : "minecraft:polished_blackstone_brick_wall", + "blockRuntimeId" : 5838 + }, + { + "id" : "minecraft:cobbled_deepslate_wall", + "blockRuntimeId" : 1156 + }, + { + "id" : "minecraft:deepslate_tile_wall", + "blockRuntimeId" : 4298 + }, + { + "id" : "minecraft:polished_deepslate_wall", + "blockRuntimeId" : 6216 + }, + { + "id" : "minecraft:deepslate_brick_wall", + "blockRuntimeId" : 4115 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4774 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4775 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4776 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4777 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4778 + }, + { + "id" : "minecraft:fence", + "blockRuntimeId" : 4779 + }, + { + "id" : "minecraft:nether_brick_fence", + "blockRuntimeId" : 5689 + }, + { + "id" : "minecraft:crimson_fence", + "blockRuntimeId" : 3818 + }, + { + "id" : "minecraft:warped_fence", + "blockRuntimeId" : 7576 + }, + { + "id" : "minecraft:fence_gate", + "blockRuntimeId" : 4780 + }, + { + "id" : "minecraft:spruce_fence_gate", + "blockRuntimeId" : 7010 + }, + { + "id" : "minecraft:birch_fence_gate", + "blockRuntimeId" : 400 + }, + { + "id" : "minecraft:jungle_fence_gate", + "blockRuntimeId" : 5253 + }, + { + "id" : "minecraft:acacia_fence_gate", + "blockRuntimeId" : 44 + }, + { + "id" : "minecraft:dark_oak_fence_gate", + "blockRuntimeId" : 3981 + }, + { + "id" : "minecraft:crimson_fence_gate", + "blockRuntimeId" : 3819 + }, + { + "id" : "minecraft:warped_fence_gate", + "blockRuntimeId" : 7577 + }, + { + "id" : "minecraft:normal_stone_stairs", + "blockRuntimeId" : 5708 + }, + { + "id" : "minecraft:stone_stairs", + "blockRuntimeId" : 7281 + }, + { + "id" : "minecraft:mossy_cobblestone_stairs", + "blockRuntimeId" : 5668 + }, + { + "id" : "minecraft:oak_stairs", + "blockRuntimeId" : 5717 + }, + { + "id" : "minecraft:spruce_stairs", + "blockRuntimeId" : 7042 + }, + { + "id" : "minecraft:birch_stairs", + "blockRuntimeId" : 432 + }, + { + "id" : "minecraft:jungle_stairs", + "blockRuntimeId" : 5285 + }, + { + "id" : "minecraft:acacia_stairs", + "blockRuntimeId" : 76 + }, + { + "id" : "minecraft:dark_oak_stairs", + "blockRuntimeId" : 4013 + }, + { + "id" : "minecraft:stone_brick_stairs", + "blockRuntimeId" : 7187 + }, + { + "id" : "minecraft:mossy_stone_brick_stairs", + "blockRuntimeId" : 5676 + }, + { + "id" : "minecraft:sandstone_stairs", + "blockRuntimeId" : 6710 + }, + { + "id" : "minecraft:smooth_sandstone_stairs", + "blockRuntimeId" : 6903 + }, + { + "id" : "minecraft:red_sandstone_stairs", + "blockRuntimeId" : 6637 + }, + { + "id" : "minecraft:smooth_red_sandstone_stairs", + "blockRuntimeId" : 6895 + }, + { + "id" : "minecraft:granite_stairs", + "blockRuntimeId" : 4989 + }, + { + "id" : "minecraft:polished_granite_stairs", + "blockRuntimeId" : 6386 + }, + { + "id" : "minecraft:diorite_stairs", + "blockRuntimeId" : 4476 + }, + { + "id" : "minecraft:polished_diorite_stairs", + "blockRuntimeId" : 6378 + }, + { + "id" : "minecraft:andesite_stairs", + "blockRuntimeId" : 144 + }, + { + "id" : "minecraft:polished_andesite_stairs", + "blockRuntimeId" : 5814 + }, + { + "id" : "minecraft:brick_stairs", + "blockRuntimeId" : 876 + }, + { + "id" : "minecraft:nether_brick_stairs", + "blockRuntimeId" : 5690 + }, + { + "id" : "minecraft:red_nether_brick_stairs", + "blockRuntimeId" : 6625 + }, + { + "id" : "minecraft:end_brick_stairs", + "blockRuntimeId" : 4720 + }, + { + "id" : "minecraft:quartz_stairs", + "blockRuntimeId" : 6559 + }, + { + "id" : "minecraft:smooth_quartz_stairs", + "blockRuntimeId" : 6887 + }, + { + "id" : "minecraft:purpur_stairs", + "blockRuntimeId" : 6537 + }, + { + "id" : "minecraft:prismarine_stairs", + "blockRuntimeId" : 6449 + }, + { + "id" : "minecraft:dark_prismarine_stairs", + "blockRuntimeId" : 4037 + }, + { + "id" : "minecraft:prismarine_bricks_stairs", + "blockRuntimeId" : 6441 + }, + { + "id" : "minecraft:crimson_stairs", + "blockRuntimeId" : 3860 + }, + { + "id" : "minecraft:warped_stairs", + "blockRuntimeId" : 7618 + }, + { + "id" : "minecraft:blackstone_stairs", + "blockRuntimeId" : 499 + }, + { + "id" : "minecraft:polished_blackstone_stairs", + "blockRuntimeId" : 6033 + }, + { + "id" : "minecraft:polished_blackstone_brick_stairs", + "blockRuntimeId" : 5830 + }, + { + "id" : "minecraft:cut_copper_stairs", + "blockRuntimeId" : 3913 + }, + { + "id" : "minecraft:exposed_cut_copper_stairs", + "blockRuntimeId" : 4756 + }, + { + "id" : "minecraft:weathered_cut_copper_stairs", + "blockRuntimeId" : 7745 + }, + { + "id" : "minecraft:oxidized_cut_copper_stairs", + "blockRuntimeId" : 5758 + }, + { + "id" : "minecraft:waxed_cut_copper_stairs", + "blockRuntimeId" : 7689 + }, + { + "id" : "minecraft:waxed_exposed_cut_copper_stairs", + "blockRuntimeId" : 7703 + }, + { + "id" : "minecraft:waxed_weathered_cut_copper_stairs", + "blockRuntimeId" : 7731 + }, + { + "id" : "minecraft:waxed_oxidized_cut_copper_stairs", + "blockRuntimeId" : 7717 + }, + { + "id" : "minecraft:cobbled_deepslate_stairs", + "blockRuntimeId" : 1148 + }, + { + "id" : "minecraft:deepslate_tile_stairs", + "blockRuntimeId" : 4290 + }, + { + "id" : "minecraft:polished_deepslate_stairs", + "blockRuntimeId" : 6208 + }, + { + "id" : "minecraft:deepslate_brick_stairs", + "blockRuntimeId" : 4107 + }, + { + "id" : "minecraft:wooden_door" + }, + { + "id" : "minecraft:spruce_door" + }, + { + "id" : "minecraft:birch_door" + }, + { + "id" : "minecraft:jungle_door" + }, + { + "id" : "minecraft:acacia_door" + }, + { + "id" : "minecraft:dark_oak_door" + }, + { + "id" : "minecraft:iron_door" + }, + { + "id" : "minecraft:crimson_door" + }, + { + "id" : "minecraft:warped_door" + }, + { + "id" : "minecraft:trapdoor", + "blockRuntimeId" : 7363 + }, + { + "id" : "minecraft:spruce_trapdoor", + "blockRuntimeId" : 7066 + }, + { + "id" : "minecraft:birch_trapdoor", + "blockRuntimeId" : 456 + }, + { + "id" : "minecraft:jungle_trapdoor", + "blockRuntimeId" : 5309 + }, + { + "id" : "minecraft:acacia_trapdoor", + "blockRuntimeId" : 100 + }, + { + "id" : "minecraft:dark_oak_trapdoor", + "blockRuntimeId" : 4021 + }, + { + "id" : "minecraft:iron_trapdoor", + "blockRuntimeId" : 5168 + }, + { + "id" : "minecraft:crimson_trapdoor", + "blockRuntimeId" : 3887 + }, + { + "id" : "minecraft:warped_trapdoor", + "blockRuntimeId" : 7645 + }, + { + "id" : "minecraft:iron_bars", + "blockRuntimeId" : 5133 + }, + { + "id" : "minecraft:glass", + "blockRuntimeId" : 4883 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7088 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7096 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7095 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7103 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7100 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7102 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7089 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7092 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7093 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7101 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7097 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7091 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7099 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7098 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7090 + }, + { + "id" : "minecraft:stained_glass", + "blockRuntimeId" : 7094 + }, + { + "id" : "minecraft:tinted_glass", + "blockRuntimeId" : 7352 + }, + { + "id" : "minecraft:glass_pane", + "blockRuntimeId" : 4884 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7104 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7112 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7111 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7119 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7116 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7118 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7105 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7108 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7109 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7117 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7113 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7107 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7115 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7114 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7106 + }, + { + "id" : "minecraft:stained_glass_pane", + "blockRuntimeId" : 7110 + }, + { + "id" : "minecraft:ladder", + "blockRuntimeId" : 5357 + }, + { + "id" : "minecraft:scaffolding", + "blockRuntimeId" : 6730 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7223 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7273 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7226 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7244 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7903 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7904 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7905 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7906 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7907 + }, + { + "id" : "minecraft:wooden_slab", + "blockRuntimeId" : 7908 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7228 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7271 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7224 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7274 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7245 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7239 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7275 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7256 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7261 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7262 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7259 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7260 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7258 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7257 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7227 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7230 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7246 + }, + { + "id" : "minecraft:double_stone_slab3", + "blockRuntimeId" : 7255 + }, + { + "id" : "minecraft:double_stone_slab", + "blockRuntimeId" : 7229 + }, + { + "id" : "minecraft:double_stone_slab4", + "blockRuntimeId" : 7272 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7240 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7241 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7242 + }, + { + "id" : "minecraft:double_stone_slab2", + "blockRuntimeId" : 7243 + }, + { + "id" : "minecraft:crimson_slab", + "blockRuntimeId" : 3858 + }, + { + "id" : "minecraft:warped_slab", + "blockRuntimeId" : 7616 + }, + { + "id" : "minecraft:blackstone_slab", + "blockRuntimeId" : 497 + }, + { + "id" : "minecraft:polished_blackstone_slab", + "blockRuntimeId" : 6031 + }, + { + "id" : "minecraft:polished_blackstone_brick_slab", + "blockRuntimeId" : 5828 + }, + { + "id" : "minecraft:cut_copper_slab", + "blockRuntimeId" : 3911 + }, + { + "id" : "minecraft:exposed_cut_copper_slab", + "blockRuntimeId" : 4754 + }, + { + "id" : "minecraft:weathered_cut_copper_slab", + "blockRuntimeId" : 7743 + }, + { + "id" : "minecraft:oxidized_cut_copper_slab", + "blockRuntimeId" : 5756 + }, + { + "id" : "minecraft:waxed_cut_copper_slab", + "blockRuntimeId" : 7687 + }, + { + "id" : "minecraft:waxed_exposed_cut_copper_slab", + "blockRuntimeId" : 7701 + }, + { + "id" : "minecraft:waxed_weathered_cut_copper_slab", + "blockRuntimeId" : 7729 + }, + { + "id" : "minecraft:waxed_oxidized_cut_copper_slab", + "blockRuntimeId" : 7715 + }, + { + "id" : "minecraft:cobbled_deepslate_slab", + "blockRuntimeId" : 1146 + }, + { + "id" : "minecraft:polished_deepslate_slab", + "blockRuntimeId" : 6206 + }, + { + "id" : "minecraft:deepslate_tile_slab", + "blockRuntimeId" : 4288 + }, + { + "id" : "minecraft:deepslate_brick_slab", + "blockRuntimeId" : 4105 + }, + { + "id" : "minecraft:brick_block", + "blockRuntimeId" : 875 + }, + { + "id" : "minecraft:chiseled_nether_bricks", + "blockRuntimeId" : 1130 + }, + { + "id" : "minecraft:cracked_nether_bricks", + "blockRuntimeId" : 3769 + }, + { + "id" : "minecraft:quartz_bricks", + "blockRuntimeId" : 6557 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7289 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7290 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7291 + }, + { + "id" : "minecraft:stonebrick", + "blockRuntimeId" : 7292 + }, + { + "id" : "minecraft:end_bricks", + "blockRuntimeId" : 4728 + }, + { + "id" : "minecraft:prismarine", + "blockRuntimeId" : 6440 + }, + { + "id" : "minecraft:polished_blackstone_bricks", + "blockRuntimeId" : 6000 + }, + { + "id" : "minecraft:cracked_polished_blackstone_bricks", + "blockRuntimeId" : 3770 + }, + { + "id" : "minecraft:gilded_blackstone", + "blockRuntimeId" : 4882 + }, + { + "id" : "minecraft:chiseled_polished_blackstone", + "blockRuntimeId" : 1131 + }, + { + "id" : "minecraft:deepslate_tiles", + "blockRuntimeId" : 4460 + }, + { + "id" : "minecraft:cracked_deepslate_tiles", + "blockRuntimeId" : 3768 + }, + { + "id" : "minecraft:deepslate_bricks", + "blockRuntimeId" : 4277 + }, + { + "id" : "minecraft:cracked_deepslate_bricks", + "blockRuntimeId" : 3767 + }, + { + "id" : "minecraft:chiseled_deepslate", + "blockRuntimeId" : 1129 + }, + { + "id" : "minecraft:cobblestone", + "blockRuntimeId" : 1318 + }, + { + "id" : "minecraft:mossy_cobblestone", + "blockRuntimeId" : 5667 + }, + { + "id" : "minecraft:cobbled_deepslate", + "blockRuntimeId" : 1143 + }, + { + "id" : "minecraft:smooth_stone", + "blockRuntimeId" : 6911 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6706 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6707 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6708 + }, + { + "id" : "minecraft:sandstone", + "blockRuntimeId" : 6709 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6633 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6634 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6635 + }, + { + "id" : "minecraft:red_sandstone", + "blockRuntimeId" : 6636 + }, + { + "id" : "minecraft:coal_block", + "blockRuntimeId" : 1141 + }, + { + "id" : "minecraft:dried_kelp_block", + "blockRuntimeId" : 4584 + }, + { + "id" : "minecraft:gold_block", + "blockRuntimeId" : 4975 + }, + { + "id" : "minecraft:iron_block", + "blockRuntimeId" : 5134 + }, + { + "id" : "minecraft:copper_block", + "blockRuntimeId" : 3677 + }, + { + "id" : "minecraft:exposed_copper", + "blockRuntimeId" : 4752 + }, + { + "id" : "minecraft:weathered_copper", + "blockRuntimeId" : 7741 + }, + { + "id" : "minecraft:oxidized_copper", + "blockRuntimeId" : 5754 + }, + { + "id" : "minecraft:waxed_copper", + "blockRuntimeId" : 7685 + }, + { + "id" : "minecraft:waxed_exposed_copper", + "blockRuntimeId" : 7699 + }, + { + "id" : "minecraft:waxed_weathered_copper", + "blockRuntimeId" : 7727 + }, + { + "id" : "minecraft:waxed_oxidized_copper", + "blockRuntimeId" : 7713 + }, + { + "id" : "minecraft:cut_copper", + "blockRuntimeId" : 3910 + }, + { + "id" : "minecraft:exposed_cut_copper", + "blockRuntimeId" : 4753 + }, + { + "id" : "minecraft:weathered_cut_copper", + "blockRuntimeId" : 7742 + }, + { + "id" : "minecraft:oxidized_cut_copper", + "blockRuntimeId" : 5755 + }, + { + "id" : "minecraft:waxed_cut_copper", + "blockRuntimeId" : 7686 + }, + { + "id" : "minecraft:waxed_exposed_cut_copper", + "blockRuntimeId" : 7700 + }, + { + "id" : "minecraft:waxed_weathered_cut_copper", + "blockRuntimeId" : 7728 + }, + { + "id" : "minecraft:waxed_oxidized_cut_copper", + "blockRuntimeId" : 7714 + }, + { + "id" : "minecraft:emerald_block", + "blockRuntimeId" : 4717 + }, + { + "id" : "minecraft:diamond_block", + "blockRuntimeId" : 4474 + }, + { + "id" : "minecraft:lapis_block", + "blockRuntimeId" : 5365 + }, + { + "id" : "minecraft:raw_iron_block", + "blockRuntimeId" : 6579 + }, + { + "id" : "minecraft:raw_copper_block", + "blockRuntimeId" : 6577 + }, + { + "id" : "minecraft:raw_gold_block", + "blockRuntimeId" : 6578 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6545 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6547 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6546 + }, + { + "id" : "minecraft:quartz_block", + "blockRuntimeId" : 6548 + }, + { + "id" : "minecraft:prismarine", + "blockRuntimeId" : 6438 + }, + { + "id" : "minecraft:prismarine", + "blockRuntimeId" : 6439 + }, + { + "id" : "minecraft:slime", + "blockRuntimeId" : 6864 + }, + { + "id" : "minecraft:honey_block", + "blockRuntimeId" : 5112 + }, + { + "id" : "minecraft:honeycomb_block", + "blockRuntimeId" : 5113 + }, + { + "id" : "minecraft:hay_block", + "blockRuntimeId" : 5084 + }, + { + "id" : "minecraft:bone_block", + "blockRuntimeId" : 692 + }, + { + "id" : "minecraft:nether_brick", + "blockRuntimeId" : 5688 + }, + { + "id" : "minecraft:red_nether_brick", + "blockRuntimeId" : 6624 + }, + { + "id" : "minecraft:netherite_block", + "blockRuntimeId" : 5705 + }, + { + "id" : "minecraft:lodestone", + "blockRuntimeId" : 5563 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7915 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7923 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7922 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7930 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7927 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7929 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7916 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7919 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7920 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7928 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7924 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7918 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7926 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7925 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7917 + }, + { + "id" : "minecraft:wool", + "blockRuntimeId" : 7921 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 963 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 971 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 970 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 978 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 975 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 977 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 964 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 967 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 968 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 976 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 972 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 966 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 974 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 973 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 965 + }, + { + "id" : "minecraft:carpet", + "blockRuntimeId" : 969 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3660 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3668 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3667 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3675 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3672 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3674 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3661 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3664 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3665 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3673 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3669 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3663 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3671 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3670 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3662 + }, + { + "id" : "minecraft:concrete_powder", + "blockRuntimeId" : 3666 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3644 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3652 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3651 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3659 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3656 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3658 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3645 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3648 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3649 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3657 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3653 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3647 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3655 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3654 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3646 + }, + { + "id" : "minecraft:concrete", + "blockRuntimeId" : 3650 + }, + { + "id" : "minecraft:clay", + "blockRuntimeId" : 1139 + }, + { + "id" : "minecraft:hardened_clay", + "blockRuntimeId" : 5083 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7120 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7128 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7127 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7135 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7132 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7134 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7121 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7124 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7125 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7133 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7129 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7123 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7131 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7130 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7122 + }, + { + "id" : "minecraft:stained_hardened_clay", + "blockRuntimeId" : 7126 + }, + { + "id" : "minecraft:white_glazed_terracotta", + "blockRuntimeId" : 7800 + }, + { + "id" : "minecraft:silver_glazed_terracotta", + "blockRuntimeId" : 6846 + }, + { + "id" : "minecraft:gray_glazed_terracotta", + "blockRuntimeId" : 5010 + }, + { + "id" : "minecraft:black_glazed_terracotta", + "blockRuntimeId" : 488 + }, + { + "id" : "minecraft:brown_glazed_terracotta", + "blockRuntimeId" : 894 + }, + { + "id" : "minecraft:red_glazed_terracotta", + "blockRuntimeId" : 6601 + }, + { + "id" : "minecraft:orange_glazed_terracotta", + "blockRuntimeId" : 5748 + }, + { + "id" : "minecraft:yellow_glazed_terracotta", + "blockRuntimeId" : 7942 + }, + { + "id" : "minecraft:lime_glazed_terracotta", + "blockRuntimeId" : 5532 + }, + { + "id" : "minecraft:green_glazed_terracotta", + "blockRuntimeId" : 5026 + }, + { + "id" : "minecraft:cyan_glazed_terracotta", + "blockRuntimeId" : 3931 + }, + { + "id" : "minecraft:light_blue_glazed_terracotta", + "blockRuntimeId" : 5484 + }, + { + "id" : "minecraft:blue_glazed_terracotta", + "blockRuntimeId" : 685 + }, + { + "id" : "minecraft:purple_glazed_terracotta", + "blockRuntimeId" : 6519 + }, + { + "id" : "minecraft:magenta_glazed_terracotta", + "blockRuntimeId" : 5596 + }, + { + "id" : "minecraft:pink_glazed_terracotta", + "blockRuntimeId" : 5779 + }, + { + "id" : "minecraft:purpur_block", + "blockRuntimeId" : 6525 + }, + { + "id" : "minecraft:purpur_block", + "blockRuntimeId" : 6527 + }, + { + "id" : "minecraft:nether_wart_block", + "blockRuntimeId" : 5704 + }, + { + "id" : "minecraft:warped_wart_block", + "blockRuntimeId" : 7667 + }, + { + "id" : "minecraft:shroomlight", + "blockRuntimeId" : 6829 + }, + { + "id" : "minecraft:crimson_nylium", + "blockRuntimeId" : 3839 + }, + { + "id" : "minecraft:warped_nylium", + "blockRuntimeId" : 7597 + }, + { + "id" : "minecraft:basalt", + "blockRuntimeId" : 214 + }, + { + "id" : "minecraft:polished_basalt", + "blockRuntimeId" : 5822 + }, + { + "id" : "minecraft:smooth_basalt", + "blockRuntimeId" : 6886 + }, + { + "id" : "minecraft:soul_soil", + "blockRuntimeId" : 6956 + }, + { + "id" : "minecraft:dirt", + "blockRuntimeId" : 4484 + }, + { + "id" : "minecraft:dirt", + "blockRuntimeId" : 4485 + }, + { + "id" : "minecraft:farmland", + "blockRuntimeId" : 4766 + }, + { + "id" : "minecraft:grass", + "blockRuntimeId" : 4997 + }, + { + "id" : "minecraft:grass_path", + "blockRuntimeId" : 4998 + }, + { + "id" : "minecraft:podzol", + "blockRuntimeId" : 5803 + }, + { + "id" : "minecraft:mycelium", + "blockRuntimeId" : 5685 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7180 + }, + { + "id" : "minecraft:iron_ore", + "blockRuntimeId" : 5167 + }, + { + "id" : "minecraft:gold_ore", + "blockRuntimeId" : 4976 + }, + { + "id" : "minecraft:diamond_ore", + "blockRuntimeId" : 4475 + }, + { + "id" : "minecraft:lapis_ore", + "blockRuntimeId" : 5366 + }, + { + "id" : "minecraft:redstone_ore", + "blockRuntimeId" : 6647 + }, + { + "id" : "minecraft:coal_ore", + "blockRuntimeId" : 1142 + }, + { + "id" : "minecraft:copper_ore", + "blockRuntimeId" : 3678 + }, + { + "id" : "minecraft:emerald_ore", + "blockRuntimeId" : 4718 + }, + { + "id" : "minecraft:quartz_ore", + "blockRuntimeId" : 6558 + }, + { + "id" : "minecraft:nether_gold_ore", + "blockRuntimeId" : 5698 + }, + { + "id" : "minecraft:ancient_debris", + "blockRuntimeId" : 143 + }, + { + "id" : "minecraft:deepslate_iron_ore", + "blockRuntimeId" : 4283 + }, + { + "id" : "minecraft:deepslate_gold_ore", + "blockRuntimeId" : 4282 + }, + { + "id" : "minecraft:deepslate_diamond_ore", + "blockRuntimeId" : 4280 + }, + { + "id" : "minecraft:deepslate_lapis_ore", + "blockRuntimeId" : 4284 + }, + { + "id" : "minecraft:deepslate_redstone_ore", + "blockRuntimeId" : 4285 + }, + { + "id" : "minecraft:deepslate_emerald_ore", + "blockRuntimeId" : 4281 + }, + { + "id" : "minecraft:deepslate_coal_ore", + "blockRuntimeId" : 4278 + }, + { + "id" : "minecraft:deepslate_copper_ore", + "blockRuntimeId" : 4279 + }, + { + "id" : "minecraft:gravel", + "blockRuntimeId" : 4999 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7181 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7183 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7185 + }, + { + "id" : "minecraft:blackstone", + "blockRuntimeId" : 494 + }, + { + "id" : "minecraft:deepslate", + "blockRuntimeId" : 4100 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7182 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7184 + }, + { + "id" : "minecraft:stone", + "blockRuntimeId" : 7186 + }, + { + "id" : "minecraft:polished_blackstone", + "blockRuntimeId" : 5825 + }, + { + "id" : "minecraft:polished_deepslate", + "blockRuntimeId" : 6203 + }, + { + "id" : "minecraft:sand", + "blockRuntimeId" : 6704 + }, + { + "id" : "minecraft:sand", + "blockRuntimeId" : 6705 + }, + { + "id" : "minecraft:cactus", + "blockRuntimeId" : 920 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5564 + }, + { + "id" : "minecraft:stripped_oak_log", + "blockRuntimeId" : 7319 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5565 + }, + { + "id" : "minecraft:stripped_spruce_log", + "blockRuntimeId" : 7322 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5566 + }, + { + "id" : "minecraft:stripped_birch_log", + "blockRuntimeId" : 7304 + }, + { + "id" : "minecraft:log", + "blockRuntimeId" : 5567 + }, + { + "id" : "minecraft:stripped_jungle_log", + "blockRuntimeId" : 7316 + }, + { + "id" : "minecraft:log2", + "blockRuntimeId" : 5576 + }, + { + "id" : "minecraft:stripped_acacia_log", + "blockRuntimeId" : 7301 + }, + { + "id" : "minecraft:log2", + "blockRuntimeId" : 5577 + }, + { + "id" : "minecraft:stripped_dark_oak_log", + "blockRuntimeId" : 7313 + }, + { + "id" : "minecraft:crimson_stem", + "blockRuntimeId" : 3884 + }, + { + "id" : "minecraft:stripped_crimson_stem", + "blockRuntimeId" : 7310 + }, + { + "id" : "minecraft:warped_stem", + "blockRuntimeId" : 7642 + }, + { + "id" : "minecraft:stripped_warped_stem", + "blockRuntimeId" : 7328 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7807 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7813 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7808 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7814 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7809 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7815 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7810 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7816 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7811 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7817 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7812 + }, + { + "id" : "minecraft:wood", + "blockRuntimeId" : 7818 + }, + { + "id" : "minecraft:crimson_hyphae", + "blockRuntimeId" : 3836 + }, + { + "id" : "minecraft:stripped_crimson_hyphae", + "blockRuntimeId" : 7307 + }, + { + "id" : "minecraft:warped_hyphae", + "blockRuntimeId" : 7594 + }, + { + "id" : "minecraft:stripped_warped_hyphae", + "blockRuntimeId" : 7325 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5410 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5411 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5412 + }, + { + "id" : "minecraft:leaves", + "blockRuntimeId" : 5413 + }, + { + "id" : "minecraft:leaves2", + "blockRuntimeId" : 5426 + }, + { + "id" : "minecraft:leaves2", + "blockRuntimeId" : 5427 + }, + { + "id" : "minecraft:azalea_leaves", + "blockRuntimeId" : 169 + }, + { + "id" : "minecraft:azalea_leaves_flowered", + "blockRuntimeId" : 173 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6718 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6719 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6720 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6721 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6722 + }, + { + "id" : "minecraft:sapling", + "blockRuntimeId" : 6723 + }, + { + "id" : "minecraft:bee_nest", + "blockRuntimeId" : 236 + }, + { + "id" : "minecraft:wheat_seeds" + }, + { + "id" : "minecraft:pumpkin_seeds" + }, + { + "id" : "minecraft:melon_seeds" + }, + { + "id" : "minecraft:beetroot_seeds" + }, + { + "id" : "minecraft:wheat" + }, + { + "id" : "minecraft:beetroot" + }, + { + "id" : "minecraft:potato" + }, + { + "id" : "minecraft:poisonous_potato" + }, + { + "id" : "minecraft:carrot" + }, + { + "id" : "minecraft:golden_carrot" + }, + { + "id" : "minecraft:apple" + }, + { + "id" : "minecraft:golden_apple" + }, + { + "id" : "minecraft:enchanted_golden_apple" + }, + { + "id" : "minecraft:melon_block", + "blockRuntimeId" : 5609 + }, + { + "id" : "minecraft:melon_slice" + }, + { + "id" : "minecraft:glistering_melon_slice" + }, + { + "id" : "minecraft:sweet_berries" + }, + { + "id" : "minecraft:glow_berries" + }, + { + "id" : "minecraft:pumpkin", + "blockRuntimeId" : 6457 + }, + { + "id" : "minecraft:carved_pumpkin", + "blockRuntimeId" : 988 + }, + { + "id" : "minecraft:lit_pumpkin", + "blockRuntimeId" : 5551 + }, + { + "id" : "minecraft:honeycomb" + }, + { + "id" : "minecraft:tallgrass", + "blockRuntimeId" : 7349 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4504 + }, + { + "id" : "minecraft:tallgrass", + "blockRuntimeId" : 7348 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4503 + }, + { + "id" : "minecraft:nether_sprouts" + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3682 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3680 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3681 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3679 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3683 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3687 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3685 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3686 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3684 + }, + { + "id" : "minecraft:coral", + "blockRuntimeId" : 3688 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3702 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3700 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3701 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3699 + }, + { + "id" : "minecraft:coral_fan", + "blockRuntimeId" : 3703 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3712 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3710 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3711 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3709 + }, + { + "id" : "minecraft:coral_fan_dead", + "blockRuntimeId" : 3713 + }, + { + "id" : "minecraft:kelp" + }, + { + "id" : "minecraft:seagrass", + "blockRuntimeId" : 6825 + }, + { + "id" : "minecraft:crimson_roots", + "blockRuntimeId" : 3857 + }, + { + "id" : "minecraft:warped_roots", + "blockRuntimeId" : 7615 + }, + { + "id" : "minecraft:yellow_flower", + "blockRuntimeId" : 7941 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6590 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6591 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6592 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6593 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6594 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6595 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6596 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6597 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6598 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6599 + }, + { + "id" : "minecraft:red_flower", + "blockRuntimeId" : 6600 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4501 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4502 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4505 + }, + { + "id" : "minecraft:double_plant", + "blockRuntimeId" : 4506 + }, + { + "id" : "minecraft:wither_rose", + "blockRuntimeId" : 7806 + }, + { + "id" : "minecraft:white_dye" + }, + { + "id" : "minecraft:light_gray_dye" + }, + { + "id" : "minecraft:gray_dye" + }, + { + "id" : "minecraft:black_dye" + }, + { + "id" : "minecraft:brown_dye" + }, + { + "id" : "minecraft:red_dye" + }, + { + "id" : "minecraft:orange_dye" + }, + { + "id" : "minecraft:yellow_dye" + }, + { + "id" : "minecraft:lime_dye" + }, + { + "id" : "minecraft:green_dye" + }, + { + "id" : "minecraft:cyan_dye" + }, + { + "id" : "minecraft:light_blue_dye" + }, + { + "id" : "minecraft:blue_dye" + }, + { + "id" : "minecraft:purple_dye" + }, + { + "id" : "minecraft:magenta_dye" + }, + { + "id" : "minecraft:pink_dye" + }, + { + "id" : "minecraft:ink_sac" + }, + { + "id" : "minecraft:glow_ink_sac" + }, + { + "id" : "minecraft:cocoa_beans" + }, + { + "id" : "minecraft:lapis_lazuli" + }, + { + "id" : "minecraft:bone_meal" + }, + { + "id" : "minecraft:vine", + "blockRuntimeId" : 7502 + }, + { + "id" : "minecraft:weeping_vines", + "blockRuntimeId" : 7756 + }, + { + "id" : "minecraft:twisting_vines", + "blockRuntimeId" : 7430 + }, + { + "id" : "minecraft:waterlily", + "blockRuntimeId" : 7684 + }, + { + "id" : "minecraft:deadbush", + "blockRuntimeId" : 4099 + }, + { + "id" : "minecraft:bamboo", + "blockRuntimeId" : 177 + }, + { + "id" : "minecraft:snow", + "blockRuntimeId" : 6912 + }, + { + "id" : "minecraft:ice", + "blockRuntimeId" : 5126 + }, + { + "id" : "minecraft:packed_ice", + "blockRuntimeId" : 5768 + }, + { + "id" : "minecraft:blue_ice", + "blockRuntimeId" : 691 + }, + { + "id" : "minecraft:snow_layer", + "blockRuntimeId" : 6913 + }, + { + "id" : "minecraft:pointed_dripstone", + "blockRuntimeId" : 5809 + }, + { + "id" : "minecraft:dripstone_block", + "blockRuntimeId" : 4585 + }, + { + "id" : "minecraft:moss_carpet", + "blockRuntimeId" : 5666 + }, + { + "id" : "minecraft:moss_block", + "blockRuntimeId" : 5665 + }, + { + "id" : "minecraft:dirt_with_roots", + "blockRuntimeId" : 4486 + }, + { + "id" : "minecraft:hanging_roots", + "blockRuntimeId" : 5048 + }, + { + "id" : "minecraft:big_dripleaf", + "blockRuntimeId" : 328 + }, + { + "id" : "minecraft:small_dripleaf_block", + "blockRuntimeId" : 6878 + }, + { + "id" : "minecraft:spore_blossom", + "blockRuntimeId" : 6965 + }, + { + "id" : "minecraft:azalea", + "blockRuntimeId" : 168 + }, + { + "id" : "minecraft:flowering_azalea", + "blockRuntimeId" : 4815 + }, + { + "id" : "minecraft:glow_lichen", + "blockRuntimeId" : 4972 + }, + { + "id" : "minecraft:amethyst_block", + "blockRuntimeId" : 136 + }, + { + "id" : "minecraft:budding_amethyst", + "blockRuntimeId" : 919 + }, + { + "id" : "minecraft:amethyst_cluster", + "blockRuntimeId" : 137 + }, + { + "id" : "minecraft:large_amethyst_bud", + "blockRuntimeId" : 5367 + }, + { + "id" : "minecraft:medium_amethyst_bud", + "blockRuntimeId" : 5603 + }, + { + "id" : "minecraft:small_amethyst_bud", + "blockRuntimeId" : 6865 + }, + { + "id" : "minecraft:tuff", + "blockRuntimeId" : 7417 + }, + { + "id" : "minecraft:calcite", + "blockRuntimeId" : 943 + }, + { + "id" : "minecraft:chicken" + }, + { + "id" : "minecraft:porkchop" + }, + { + "id" : "minecraft:beef" + }, + { + "id" : "minecraft:mutton" + }, + { + "id" : "minecraft:rabbit" + }, + { + "id" : "minecraft:cod" + }, + { + "id" : "minecraft:salmon" + }, + { + "id" : "minecraft:tropical_fish" + }, + { + "id" : "minecraft:pufferfish" + }, + { + "id" : "minecraft:brown_mushroom", + "blockRuntimeId" : 900 + }, + { + "id" : "minecraft:red_mushroom", + "blockRuntimeId" : 6607 + }, + { + "id" : "minecraft:crimson_fungus", + "blockRuntimeId" : 3835 + }, + { + "id" : "minecraft:warped_fungus", + "blockRuntimeId" : 7593 + }, + { + "id" : "minecraft:brown_mushroom_block", + "blockRuntimeId" : 915 + }, + { + "id" : "minecraft:red_mushroom_block", + "blockRuntimeId" : 6622 + }, + { + "id" : "minecraft:brown_mushroom_block", + "blockRuntimeId" : 916 + }, + { + "id" : "minecraft:brown_mushroom_block", + "blockRuntimeId" : 901 + }, + { + "id" : "minecraft:egg" + }, + { + "id" : "minecraft:sugar_cane" + }, + { + "id" : "minecraft:sugar" + }, + { + "id" : "minecraft:rotten_flesh" + }, + { + "id" : "minecraft:bone" + }, + { + "id" : "minecraft:web", + "blockRuntimeId" : 7755 + }, + { + "id" : "minecraft:spider_eye" + }, + { + "id" : "minecraft:mob_spawner", + "blockRuntimeId" : 5658 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5659 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5660 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5661 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5662 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5663 + }, + { + "id" : "minecraft:monster_egg", + "blockRuntimeId" : 5664 + }, + { + "id" : "minecraft:infested_deepslate", + "blockRuntimeId" : 5127 + }, + { + "id" : "minecraft:dragon_egg", + "blockRuntimeId" : 4583 + }, + { + "id" : "minecraft:turtle_egg", + "blockRuntimeId" : 7418 + }, + { + "id" : "minecraft:chicken_spawn_egg" + }, + { + "id" : "minecraft:bee_spawn_egg" + }, + { + "id" : "minecraft:cow_spawn_egg" + }, + { + "id" : "minecraft:pig_spawn_egg" + }, + { + "id" : "minecraft:sheep_spawn_egg" + }, + { + "id" : "minecraft:wolf_spawn_egg" + }, + { + "id" : "minecraft:polar_bear_spawn_egg" + }, + { + "id" : "minecraft:ocelot_spawn_egg" + }, + { + "id" : "minecraft:cat_spawn_egg" + }, + { + "id" : "minecraft:mooshroom_spawn_egg" + }, + { + "id" : "minecraft:bat_spawn_egg" + }, + { + "id" : "minecraft:parrot_spawn_egg" + }, + { + "id" : "minecraft:rabbit_spawn_egg" + }, + { + "id" : "minecraft:llama_spawn_egg" + }, + { + "id" : "minecraft:horse_spawn_egg" + }, + { + "id" : "minecraft:donkey_spawn_egg" + }, + { + "id" : "minecraft:mule_spawn_egg" + }, + { + "id" : "minecraft:skeleton_horse_spawn_egg" + }, + { + "id" : "minecraft:zombie_horse_spawn_egg" + }, + { + "id" : "minecraft:tropical_fish_spawn_egg" + }, + { + "id" : "minecraft:cod_spawn_egg" + }, + { + "id" : "minecraft:pufferfish_spawn_egg" + }, + { + "id" : "minecraft:salmon_spawn_egg" + }, + { + "id" : "minecraft:dolphin_spawn_egg" + }, + { + "id" : "minecraft:turtle_spawn_egg" + }, + { + "id" : "minecraft:panda_spawn_egg" + }, + { + "id" : "minecraft:fox_spawn_egg" + }, + { + "id" : "minecraft:creeper_spawn_egg" + }, + { + "id" : "minecraft:enderman_spawn_egg" + }, + { + "id" : "minecraft:silverfish_spawn_egg" + }, + { + "id" : "minecraft:skeleton_spawn_egg" + }, + { + "id" : "minecraft:wither_skeleton_spawn_egg" + }, + { + "id" : "minecraft:stray_spawn_egg" + }, + { + "id" : "minecraft:slime_spawn_egg" + }, + { + "id" : "minecraft:spider_spawn_egg" + }, + { + "id" : "minecraft:zombie_spawn_egg" + }, + { + "id" : "minecraft:zombie_pigman_spawn_egg" + }, + { + "id" : "minecraft:husk_spawn_egg" + }, + { + "id" : "minecraft:drowned_spawn_egg" + }, + { + "id" : "minecraft:squid_spawn_egg" + }, + { + "id" : "minecraft:glow_squid_spawn_egg" + }, + { + "id" : "minecraft:cave_spider_spawn_egg" + }, + { + "id" : "minecraft:witch_spawn_egg" + }, + { + "id" : "minecraft:guardian_spawn_egg" + }, + { + "id" : "minecraft:elder_guardian_spawn_egg" + }, + { + "id" : "minecraft:endermite_spawn_egg" + }, + { + "id" : "minecraft:magma_cube_spawn_egg" + }, + { + "id" : "minecraft:strider_spawn_egg" + }, + { + "id" : "minecraft:hoglin_spawn_egg" + }, + { + "id" : "minecraft:piglin_spawn_egg" + }, + { + "id" : "minecraft:zoglin_spawn_egg" + }, + { + "id" : "minecraft:piglin_brute_spawn_egg" + }, + { + "id" : "minecraft:goat_spawn_egg" + }, + { + "id" : "minecraft:axolotl_spawn_egg" + }, + { + "id" : "minecraft:ghast_spawn_egg" + }, + { + "id" : "minecraft:blaze_spawn_egg" + }, + { + "id" : "minecraft:shulker_spawn_egg" + }, + { + "id" : "minecraft:vindicator_spawn_egg" + }, + { + "id" : "minecraft:evoker_spawn_egg" + }, + { + "id" : "minecraft:vex_spawn_egg" + }, + { + "id" : "minecraft:villager_spawn_egg" + }, + { + "id" : "minecraft:wandering_trader_spawn_egg" + }, + { + "id" : "minecraft:zombie_villager_spawn_egg" + }, + { + "id" : "minecraft:phantom_spawn_egg" + }, + { + "id" : "minecraft:pillager_spawn_egg" + }, + { + "id" : "minecraft:ravager_spawn_egg" + }, + { + "id" : "minecraft:obsidian", + "blockRuntimeId" : 5737 + }, + { + "id" : "minecraft:crying_obsidian", + "blockRuntimeId" : 3909 + }, + { + "id" : "minecraft:bedrock", + "blockRuntimeId" : 234 + }, + { + "id" : "minecraft:soul_sand", + "blockRuntimeId" : 6955 + }, + { + "id" : "minecraft:netherrack", + "blockRuntimeId" : 5706 + }, + { + "id" : "minecraft:magma", + "blockRuntimeId" : 5602 + }, + { + "id" : "minecraft:nether_wart" + }, + { + "id" : "minecraft:end_stone", + "blockRuntimeId" : 4745 + }, + { + "id" : "minecraft:chorus_flower", + "blockRuntimeId" : 1132 + }, + { + "id" : "minecraft:chorus_plant", + "blockRuntimeId" : 1138 + }, + { + "id" : "minecraft:chorus_fruit" + }, + { + "id" : "minecraft:popped_chorus_fruit" + }, + { + "id" : "minecraft:sponge", + "blockRuntimeId" : 6963 + }, + { + "id" : "minecraft:sponge", + "blockRuntimeId" : 6964 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3689 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3690 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3691 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3692 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3693 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3694 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3695 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3696 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3697 + }, + { + "id" : "minecraft:coral_block", + "blockRuntimeId" : 3698 + }, + { + "id" : "minecraft:leather_helmet" + }, + { + "id" : "minecraft:chainmail_helmet" + }, + { + "id" : "minecraft:iron_helmet" + }, + { + "id" : "minecraft:golden_helmet" + }, + { + "id" : "minecraft:diamond_helmet" + }, + { + "id" : "minecraft:netherite_helmet" + }, + { + "id" : "minecraft:leather_chestplate" + }, + { + "id" : "minecraft:chainmail_chestplate" + }, + { + "id" : "minecraft:iron_chestplate" + }, + { + "id" : "minecraft:golden_chestplate" + }, + { + "id" : "minecraft:diamond_chestplate" + }, + { + "id" : "minecraft:netherite_chestplate" + }, + { + "id" : "minecraft:leather_leggings" + }, + { + "id" : "minecraft:chainmail_leggings" + }, + { + "id" : "minecraft:iron_leggings" + }, + { + "id" : "minecraft:golden_leggings" + }, + { + "id" : "minecraft:diamond_leggings" + }, + { + "id" : "minecraft:netherite_leggings" + }, + { + "id" : "minecraft:leather_boots" + }, + { + "id" : "minecraft:chainmail_boots" + }, + { + "id" : "minecraft:iron_boots" + }, + { + "id" : "minecraft:golden_boots" + }, + { + "id" : "minecraft:diamond_boots" + }, + { + "id" : "minecraft:netherite_boots" + }, + { + "id" : "minecraft:wooden_sword" + }, + { + "id" : "minecraft:stone_sword" + }, + { + "id" : "minecraft:iron_sword" + }, + { + "id" : "minecraft:golden_sword" + }, + { + "id" : "minecraft:diamond_sword" + }, + { + "id" : "minecraft:netherite_sword" + }, + { + "id" : "minecraft:wooden_axe" + }, + { + "id" : "minecraft:stone_axe" + }, + { + "id" : "minecraft:iron_axe" + }, + { + "id" : "minecraft:golden_axe" + }, + { + "id" : "minecraft:diamond_axe" + }, + { + "id" : "minecraft:netherite_axe" + }, + { + "id" : "minecraft:wooden_pickaxe" + }, + { + "id" : "minecraft:stone_pickaxe" + }, + { + "id" : "minecraft:iron_pickaxe" + }, + { + "id" : "minecraft:golden_pickaxe" + }, + { + "id" : "minecraft:diamond_pickaxe" + }, + { + "id" : "minecraft:netherite_pickaxe" + }, + { + "id" : "minecraft:wooden_shovel" + }, + { + "id" : "minecraft:stone_shovel" + }, + { + "id" : "minecraft:iron_shovel" + }, + { + "id" : "minecraft:golden_shovel" + }, + { + "id" : "minecraft:diamond_shovel" + }, + { + "id" : "minecraft:netherite_shovel" + }, + { + "id" : "minecraft:wooden_hoe" + }, + { + "id" : "minecraft:stone_hoe" + }, + { + "id" : "minecraft:iron_hoe" + }, + { + "id" : "minecraft:golden_hoe" + }, + { + "id" : "minecraft:diamond_hoe" + }, + { + "id" : "minecraft:netherite_hoe" + }, + { + "id" : "minecraft:bow" + }, + { + "id" : "minecraft:crossbow" + }, + { + "id" : "minecraft:arrow" + }, + { + "id" : "minecraft:arrow", + "damage" : 6 + }, + { + "id" : "minecraft:arrow", + "damage" : 7 + }, + { + "id" : "minecraft:arrow", + "damage" : 8 + }, + { + "id" : "minecraft:arrow", + "damage" : 9 + }, + { + "id" : "minecraft:arrow", + "damage" : 10 + }, + { + "id" : "minecraft:arrow", + "damage" : 11 + }, + { + "id" : "minecraft:arrow", + "damage" : 12 + }, + { + "id" : "minecraft:arrow", + "damage" : 13 + }, + { + "id" : "minecraft:arrow", + "damage" : 14 + }, + { + "id" : "minecraft:arrow", + "damage" : 15 + }, + { + "id" : "minecraft:arrow", + "damage" : 16 + }, + { + "id" : "minecraft:arrow", + "damage" : 17 + }, + { + "id" : "minecraft:arrow", + "damage" : 18 + }, + { + "id" : "minecraft:arrow", + "damage" : 19 + }, + { + "id" : "minecraft:arrow", + "damage" : 20 + }, + { + "id" : "minecraft:arrow", + "damage" : 21 + }, + { + "id" : "minecraft:arrow", + "damage" : 22 + }, + { + "id" : "minecraft:arrow", + "damage" : 23 + }, + { + "id" : "minecraft:arrow", + "damage" : 24 + }, + { + "id" : "minecraft:arrow", + "damage" : 25 + }, + { + "id" : "minecraft:arrow", + "damage" : 26 + }, + { + "id" : "minecraft:arrow", + "damage" : 27 + }, + { + "id" : "minecraft:arrow", + "damage" : 28 + }, + { + "id" : "minecraft:arrow", + "damage" : 29 + }, + { + "id" : "minecraft:arrow", + "damage" : 30 + }, + { + "id" : "minecraft:arrow", + "damage" : 31 + }, + { + "id" : "minecraft:arrow", + "damage" : 32 + }, + { + "id" : "minecraft:arrow", + "damage" : 33 + }, + { + "id" : "minecraft:arrow", + "damage" : 34 + }, + { + "id" : "minecraft:arrow", + "damage" : 35 + }, + { + "id" : "minecraft:arrow", + "damage" : 36 + }, + { + "id" : "minecraft:arrow", + "damage" : 37 + }, + { + "id" : "minecraft:arrow", + "damage" : 38 + }, + { + "id" : "minecraft:arrow", + "damage" : 39 + }, + { + "id" : "minecraft:arrow", + "damage" : 40 + }, + { + "id" : "minecraft:arrow", + "damage" : 41 + }, + { + "id" : "minecraft:arrow", + "damage" : 42 + }, + { + "id" : "minecraft:arrow", + "damage" : 43 + }, + { + "id" : "minecraft:shield" + }, + { + "id" : "minecraft:cooked_chicken" + }, + { + "id" : "minecraft:cooked_porkchop" + }, + { + "id" : "minecraft:cooked_beef" + }, + { + "id" : "minecraft:cooked_mutton" + }, + { + "id" : "minecraft:cooked_rabbit" + }, + { + "id" : "minecraft:cooked_cod" + }, + { + "id" : "minecraft:cooked_salmon" + }, + { + "id" : "minecraft:bread" + }, + { + "id" : "minecraft:mushroom_stew" + }, + { + "id" : "minecraft:beetroot_soup" + }, + { + "id" : "minecraft:rabbit_stew" + }, + { + "id" : "minecraft:baked_potato" + }, + { + "id" : "minecraft:cookie" + }, + { + "id" : "minecraft:pumpkin_pie" + }, + { + "id" : "minecraft:cake" + }, + { + "id" : "minecraft:dried_kelp" + }, + { + "id" : "minecraft:fishing_rod" + }, + { + "id" : "minecraft:carrot_on_a_stick" + }, + { + "id" : "minecraft:warped_fungus_on_a_stick" + }, + { + "id" : "minecraft:snowball" + }, + { + "id" : "minecraft:shears" + }, + { + "id" : "minecraft:flint_and_steel" + }, + { + "id" : "minecraft:lead" + }, + { + "id" : "minecraft:clock" + }, + { + "id" : "minecraft:compass" + }, + { + "id" : "minecraft:empty_map" + }, + { + "id" : "minecraft:empty_map", + "damage" : 2 + }, + { + "id" : "minecraft:saddle" + }, + { + "id" : "minecraft:leather_horse_armor" + }, + { + "id" : "minecraft:iron_horse_armor" + }, + { + "id" : "minecraft:golden_horse_armor" + }, + { + "id" : "minecraft:diamond_horse_armor" + }, + { + "id" : "minecraft:trident" + }, + { + "id" : "minecraft:turtle_helmet" + }, + { + "id" : "minecraft:elytra" + }, + { + "id" : "minecraft:totem_of_undying" + }, + { + "id" : "minecraft:glass_bottle" + }, + { + "id" : "minecraft:experience_bottle" + }, + { + "id" : "minecraft:potion" + }, + { + "id" : "minecraft:potion", + "damage" : 1 + }, + { + "id" : "minecraft:potion", + "damage" : 2 + }, + { + "id" : "minecraft:potion", + "damage" : 3 + }, + { + "id" : "minecraft:potion", + "damage" : 4 + }, + { + "id" : "minecraft:potion", + "damage" : 5 + }, + { + "id" : "minecraft:potion", + "damage" : 6 + }, + { + "id" : "minecraft:potion", + "damage" : 7 + }, + { + "id" : "minecraft:potion", + "damage" : 8 + }, + { + "id" : "minecraft:potion", + "damage" : 9 + }, + { + "id" : "minecraft:potion", + "damage" : 10 + }, + { + "id" : "minecraft:potion", + "damage" : 11 + }, + { + "id" : "minecraft:potion", + "damage" : 12 + }, + { + "id" : "minecraft:potion", + "damage" : 13 + }, + { + "id" : "minecraft:potion", + "damage" : 14 + }, + { + "id" : "minecraft:potion", + "damage" : 15 + }, + { + "id" : "minecraft:potion", + "damage" : 16 + }, + { + "id" : "minecraft:potion", + "damage" : 17 + }, + { + "id" : "minecraft:potion", + "damage" : 18 + }, + { + "id" : "minecraft:potion", + "damage" : 19 + }, + { + "id" : "minecraft:potion", + "damage" : 20 + }, + { + "id" : "minecraft:potion", + "damage" : 21 + }, + { + "id" : "minecraft:potion", + "damage" : 22 + }, + { + "id" : "minecraft:potion", + "damage" : 23 + }, + { + "id" : "minecraft:potion", + "damage" : 24 + }, + { + "id" : "minecraft:potion", + "damage" : 25 + }, + { + "id" : "minecraft:potion", + "damage" : 26 + }, + { + "id" : "minecraft:potion", + "damage" : 27 + }, + { + "id" : "minecraft:potion", + "damage" : 28 + }, + { + "id" : "minecraft:potion", + "damage" : 29 + }, + { + "id" : "minecraft:potion", + "damage" : 30 + }, + { + "id" : "minecraft:potion", + "damage" : 31 + }, + { + "id" : "minecraft:potion", + "damage" : 32 + }, + { + "id" : "minecraft:potion", + "damage" : 33 + }, + { + "id" : "minecraft:potion", + "damage" : 34 + }, + { + "id" : "minecraft:potion", + "damage" : 35 + }, + { + "id" : "minecraft:potion", + "damage" : 36 + }, + { + "id" : "minecraft:potion", + "damage" : 37 + }, + { + "id" : "minecraft:potion", + "damage" : 38 + }, + { + "id" : "minecraft:potion", + "damage" : 39 + }, + { + "id" : "minecraft:potion", + "damage" : 40 + }, + { + "id" : "minecraft:potion", + "damage" : 41 + }, + { + "id" : "minecraft:potion", + "damage" : 42 + }, + { + "id" : "minecraft:splash_potion" + }, + { + "id" : "minecraft:splash_potion", + "damage" : 1 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 2 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 3 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 4 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 5 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 6 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 7 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 8 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 9 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 10 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 11 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 12 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 13 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 14 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 15 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 16 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 17 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 18 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 19 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 20 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 21 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 22 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 23 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 24 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 25 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 26 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 27 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 28 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 29 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 30 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 31 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 32 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 33 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 34 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 35 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 36 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 37 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 38 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 39 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 40 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 41 + }, + { + "id" : "minecraft:splash_potion", + "damage" : 42 + }, + { + "id" : "minecraft:lingering_potion" + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 1 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 2 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 3 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 4 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 5 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 6 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 7 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 8 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 9 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 10 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 11 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 12 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 13 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 14 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 15 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 16 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 17 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 18 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 19 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 20 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 21 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 22 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 23 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 24 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 25 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 26 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 27 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 28 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 29 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 30 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 31 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 32 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 33 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 34 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 35 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 36 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 37 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 38 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 39 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 40 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 41 + }, + { + "id" : "minecraft:lingering_potion", + "damage" : 42 + }, + { + "id" : "minecraft:spyglass" + }, + { + "id" : "minecraft:stick" + }, + { + "id" : "minecraft:bed" + }, + { + "id" : "minecraft:bed", + "damage" : 8 + }, + { + "id" : "minecraft:bed", + "damage" : 7 + }, + { + "id" : "minecraft:bed", + "damage" : 15 + }, + { + "id" : "minecraft:bed", + "damage" : 12 + }, + { + "id" : "minecraft:bed", + "damage" : 14 + }, + { + "id" : "minecraft:bed", + "damage" : 1 + }, + { + "id" : "minecraft:bed", + "damage" : 4 + }, + { + "id" : "minecraft:bed", + "damage" : 5 + }, + { + "id" : "minecraft:bed", + "damage" : 13 + }, + { + "id" : "minecraft:bed", + "damage" : 9 + }, + { + "id" : "minecraft:bed", + "damage" : 3 + }, + { + "id" : "minecraft:bed", + "damage" : 11 + }, + { + "id" : "minecraft:bed", + "damage" : 10 + }, + { + "id" : "minecraft:bed", + "damage" : 2 + }, + { + "id" : "minecraft:bed", + "damage" : 6 + }, + { + "id" : "minecraft:torch", + "blockRuntimeId" : 7357 + }, + { + "id" : "minecraft:soul_torch", + "blockRuntimeId" : 6957 + }, + { + "id" : "minecraft:sea_pickle", + "blockRuntimeId" : 6817 + }, + { + "id" : "minecraft:lantern", + "blockRuntimeId" : 5363 + }, + { + "id" : "minecraft:soul_lantern", + "blockRuntimeId" : 6953 + }, + { + "id" : "minecraft:candle", + "blockRuntimeId" : 953 + }, + { + "id" : "minecraft:white_candle", + "blockRuntimeId" : 7790 + }, + { + "id" : "minecraft:orange_candle", + "blockRuntimeId" : 5738 + }, + { + "id" : "minecraft:magenta_candle", + "blockRuntimeId" : 5586 + }, + { + "id" : "minecraft:light_blue_candle", + "blockRuntimeId" : 5474 + }, + { + "id" : "minecraft:yellow_candle", + "blockRuntimeId" : 7931 + }, + { + "id" : "minecraft:lime_candle", + "blockRuntimeId" : 5522 + }, + { + "id" : "minecraft:pink_candle", + "blockRuntimeId" : 5769 + }, + { + "id" : "minecraft:gray_candle", + "blockRuntimeId" : 5000 + }, + { + "id" : "minecraft:light_gray_candle", + "blockRuntimeId" : 5490 + }, + { + "id" : "minecraft:cyan_candle", + "blockRuntimeId" : 3921 + }, + { + "id" : "minecraft:purple_candle", + "blockRuntimeId" : 6509 + }, + { + "id" : "minecraft:blue_candle", + "blockRuntimeId" : 675 + }, + { + "id" : "minecraft:brown_candle", + "blockRuntimeId" : 884 + }, + { + "id" : "minecraft:green_candle", + "blockRuntimeId" : 5016 + }, + { + "id" : "minecraft:red_candle", + "blockRuntimeId" : 6580 + }, + { + "id" : "minecraft:black_candle", + "blockRuntimeId" : 478 + }, + { + "id" : "minecraft:crafting_table", + "blockRuntimeId" : 3771 + }, + { + "id" : "minecraft:cartography_table", + "blockRuntimeId" : 987 + }, + { + "id" : "minecraft:fletching_table", + "blockRuntimeId" : 4812 + }, + { + "id" : "minecraft:smithing_table", + "blockRuntimeId" : 6879 + }, + { + "id" : "minecraft:beehive", + "blockRuntimeId" : 260 + }, + { + "id" : "minecraft:campfire" + }, + { + "id" : "minecraft:soul_campfire" + }, + { + "id" : "minecraft:furnace", + "blockRuntimeId" : 4876 + }, + { + "id" : "minecraft:blast_furnace", + "blockRuntimeId" : 669 + }, + { + "id" : "minecraft:smoker", + "blockRuntimeId" : 6880 + }, + { + "id" : "minecraft:respawn_anchor", + "blockRuntimeId" : 6699 + }, + { + "id" : "minecraft:brewing_stand" + }, + { + "id" : "minecraft:anvil", + "blockRuntimeId" : 152 + }, + { + "id" : "minecraft:anvil", + "blockRuntimeId" : 156 + }, + { + "id" : "minecraft:anvil", + "blockRuntimeId" : 160 + }, + { + "id" : "minecraft:grindstone", + "blockRuntimeId" : 5032 + }, + { + "id" : "minecraft:enchanting_table", + "blockRuntimeId" : 4719 + }, + { + "id" : "minecraft:bookshelf", + "blockRuntimeId" : 704 + }, + { + "id" : "minecraft:lectern", + "blockRuntimeId" : 5434 + }, + { + "id" : "minecraft:cauldron" + }, + { + "id" : "minecraft:composter", + "blockRuntimeId" : 3635 + }, + { + "id" : "minecraft:chest", + "blockRuntimeId" : 1123 + }, + { + "id" : "minecraft:trapped_chest", + "blockRuntimeId" : 7379 + }, + { + "id" : "minecraft:ender_chest", + "blockRuntimeId" : 4746 + }, + { + "id" : "minecraft:barrel", + "blockRuntimeId" : 201 + }, + { + "id" : "minecraft:undyed_shulker_box", + "blockRuntimeId" : 7462 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6830 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6838 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6837 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6845 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6842 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6844 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6831 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6834 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6835 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6843 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6839 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6833 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6841 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6840 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6832 + }, + { + "id" : "minecraft:shulker_box", + "blockRuntimeId" : 6836 + }, + { + "id" : "minecraft:armor_stand" + }, + { + "id" : "minecraft:noteblock", + "blockRuntimeId" : 5716 + }, + { + "id" : "minecraft:jukebox", + "blockRuntimeId" : 5208 + }, + { + "id" : "minecraft:music_disc_13" + }, + { + "id" : "minecraft:music_disc_cat" + }, + { + "id" : "minecraft:music_disc_blocks" + }, + { + "id" : "minecraft:music_disc_chirp" + }, + { + "id" : "minecraft:music_disc_far" + }, + { + "id" : "minecraft:music_disc_mall" + }, + { + "id" : "minecraft:music_disc_mellohi" + }, + { + "id" : "minecraft:music_disc_stal" + }, + { + "id" : "minecraft:music_disc_strad" + }, + { + "id" : "minecraft:music_disc_ward" + }, + { + "id" : "minecraft:music_disc_11" + }, + { + "id" : "minecraft:music_disc_wait" + }, + { + "id" : "minecraft:music_disc_otherside" + }, + { + "id" : "minecraft:music_disc_pigstep" + }, + { + "id" : "minecraft:glowstone_dust" + }, + { + "id" : "minecraft:glowstone", + "blockRuntimeId" : 4974 + }, + { + "id" : "minecraft:redstone_lamp", + "blockRuntimeId" : 6646 + }, + { + "id" : "minecraft:sealantern", + "blockRuntimeId" : 6828 + }, + { + "id" : "minecraft:oak_sign" + }, + { + "id" : "minecraft:spruce_sign" + }, + { + "id" : "minecraft:birch_sign" + }, + { + "id" : "minecraft:jungle_sign" + }, + { + "id" : "minecraft:acacia_sign" + }, + { + "id" : "minecraft:dark_oak_sign" + }, + { + "id" : "minecraft:crimson_sign" + }, + { + "id" : "minecraft:warped_sign" + }, + { + "id" : "minecraft:painting" + }, + { + "id" : "minecraft:frame" + }, + { + "id" : "minecraft:glow_frame" + }, + { + "id" : "minecraft:honey_bottle" + }, + { + "id" : "minecraft:flower_pot" + }, + { + "id" : "minecraft:bowl" + }, + { + "id" : "minecraft:bucket" + }, + { + "id" : "minecraft:milk_bucket" + }, + { + "id" : "minecraft:water_bucket" + }, + { + "id" : "minecraft:lava_bucket" + }, + { + "id" : "minecraft:cod_bucket" + }, + { + "id" : "minecraft:salmon_bucket" + }, + { + "id" : "minecraft:tropical_fish_bucket" + }, + { + "id" : "minecraft:pufferfish_bucket" + }, + { + "id" : "minecraft:powder_snow_bucket" + }, + { + "id" : "minecraft:axolotl_bucket" + }, + { + "id" : "minecraft:skull", + "damage" : 3 + }, + { + "id" : "minecraft:skull", + "damage" : 2 + }, + { + "id" : "minecraft:skull", + "damage" : 4 + }, + { + "id" : "minecraft:skull", + "damage" : 5 + }, + { + "id" : "minecraft:skull" + }, + { + "id" : "minecraft:skull", + "damage" : 1 + }, + { + "id" : "minecraft:beacon", + "blockRuntimeId" : 217 + }, + { + "id" : "minecraft:bell", + "blockRuntimeId" : 292 + }, + { + "id" : "minecraft:conduit", + "blockRuntimeId" : 3676 + }, + { + "id" : "minecraft:stonecutter_block", + "blockRuntimeId" : 7295 + }, + { + "id" : "minecraft:end_portal_frame", + "blockRuntimeId" : 4731 + }, + { + "id" : "minecraft:coal" + }, + { + "id" : "minecraft:charcoal" + }, + { + "id" : "minecraft:diamond" + }, + { + "id" : "minecraft:iron_nugget" + }, + { + "id" : "minecraft:raw_iron" + }, + { + "id" : "minecraft:raw_gold" + }, + { + "id" : "minecraft:raw_copper" + }, + { + "id" : "minecraft:copper_ingot" + }, + { + "id" : "minecraft:iron_ingot" + }, + { + "id" : "minecraft:netherite_scrap" + }, + { + "id" : "minecraft:netherite_ingot" + }, + { + "id" : "minecraft:gold_nugget" + }, + { + "id" : "minecraft:gold_ingot" + }, + { + "id" : "minecraft:emerald" + }, + { + "id" : "minecraft:quartz" + }, + { + "id" : "minecraft:clay_ball" + }, + { + "id" : "minecraft:brick" + }, + { + "id" : "minecraft:netherbrick" + }, + { + "id" : "minecraft:prismarine_shard" + }, + { + "id" : "minecraft:amethyst_shard" + }, + { + "id" : "minecraft:prismarine_crystals" + }, + { + "id" : "minecraft:nautilus_shell" + }, + { + "id" : "minecraft:heart_of_the_sea" + }, + { + "id" : "minecraft:scute" + }, + { + "id" : "minecraft:phantom_membrane" + }, + { + "id" : "minecraft:string" + }, + { + "id" : "minecraft:feather" + }, + { + "id" : "minecraft:flint" + }, + { + "id" : "minecraft:gunpowder" + }, + { + "id" : "minecraft:leather" + }, + { + "id" : "minecraft:rabbit_hide" + }, + { + "id" : "minecraft:rabbit_foot" + }, + { + "id" : "minecraft:fire_charge" + }, + { + "id" : "minecraft:blaze_rod" + }, + { + "id" : "minecraft:blaze_powder" + }, + { + "id" : "minecraft:magma_cream" + }, + { + "id" : "minecraft:fermented_spider_eye" + }, + { + "id" : "minecraft:dragon_breath" + }, + { + "id" : "minecraft:shulker_shell" + }, + { + "id" : "minecraft:ghast_tear" + }, + { + "id" : "minecraft:slime_ball" + }, + { + "id" : "minecraft:ender_pearl" + }, + { + "id" : "minecraft:ender_eye" + }, + { + "id" : "minecraft:nether_star" + }, + { + "id" : "minecraft:end_rod", + "blockRuntimeId" : 4739 + }, + { + "id" : "minecraft:lightning_rod", + "blockRuntimeId" : 5516 + }, + { + "id" : "minecraft:end_crystal" + }, + { + "id" : "minecraft:paper" + }, + { + "id" : "minecraft:book" + }, + { + "id" : "minecraft:writable_book" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQAAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQBAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQCAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQDAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQEAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQFAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQGAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQHAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQIAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQJAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQKAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQLAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQMAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQMAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQNAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQNAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQOAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQPAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQQAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQRAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQSAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQTAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQUAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQUAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQVAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQWAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQXAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQYAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQZAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQZAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQaAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQbAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQcAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQdAAIDAGx2bAUAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQeAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQfAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQgAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQhAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQiAAIDAGx2bAQAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQjAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAEAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAIAAAA=" + }, + { + "id" : "minecraft:enchanted_book", + "nbt_b64" : "CgAACQQAZW5jaAoBAAAAAgIAaWQkAAIDAGx2bAMAAAA=" + }, + { + "id" : "minecraft:oak_boat" + }, + { + "id" : "minecraft:spruce_boat" + }, + { + "id" : "minecraft:birch_boat" + }, + { + "id" : "minecraft:jungle_boat" + }, + { + "id" : "minecraft:acacia_boat" + }, + { + "id" : "minecraft:dark_oak_boat" + }, + { + "id" : "minecraft:rail", + "blockRuntimeId" : 6567 + }, + { + "id" : "minecraft:golden_rail", + "blockRuntimeId" : 4977 + }, + { + "id" : "minecraft:detector_rail", + "blockRuntimeId" : 4462 + }, + { + "id" : "minecraft:activator_rail", + "blockRuntimeId" : 122 + }, + { + "id" : "minecraft:minecart" + }, + { + "id" : "minecraft:chest_minecart" + }, + { + "id" : "minecraft:hopper_minecart" + }, + { + "id" : "minecraft:tnt_minecart" + }, + { + "id" : "minecraft:redstone" + }, + { + "id" : "minecraft:redstone_block", + "blockRuntimeId" : 6645 + }, + { + "id" : "minecraft:redstone_torch", + "blockRuntimeId" : 6648 + }, + { + "id" : "minecraft:lever", + "blockRuntimeId" : 5442 + }, + { + "id" : "minecraft:wooden_button", + "blockRuntimeId" : 7843 + }, + { + "id" : "minecraft:spruce_button", + "blockRuntimeId" : 6966 + }, + { + "id" : "minecraft:birch_button", + "blockRuntimeId" : 356 + }, + { + "id" : "minecraft:jungle_button", + "blockRuntimeId" : 5209 + }, + { + "id" : "minecraft:acacia_button" + }, + { + "id" : "minecraft:dark_oak_button", + "blockRuntimeId" : 3937 + }, + { + "id" : "minecraft:stone_button", + "blockRuntimeId" : 7195 + }, + { + "id" : "minecraft:crimson_button", + "blockRuntimeId" : 3772 + }, + { + "id" : "minecraft:warped_button", + "blockRuntimeId" : 7530 + }, + { + "id" : "minecraft:polished_blackstone_button", + "blockRuntimeId" : 6001 + }, + { + "id" : "minecraft:tripwire_hook", + "blockRuntimeId" : 7401 + }, + { + "id" : "minecraft:wooden_pressure_plate", + "blockRuntimeId" : 7887 + }, + { + "id" : "minecraft:spruce_pressure_plate", + "blockRuntimeId" : 7026 + }, + { + "id" : "minecraft:birch_pressure_plate", + "blockRuntimeId" : 416 + }, + { + "id" : "minecraft:jungle_pressure_plate", + "blockRuntimeId" : 5269 + }, + { + "id" : "minecraft:acacia_pressure_plate", + "blockRuntimeId" : 60 + }, + { + "id" : "minecraft:dark_oak_pressure_plate", + "blockRuntimeId" : 3997 + }, + { + "id" : "minecraft:crimson_pressure_plate", + "blockRuntimeId" : 3841 + }, + { + "id" : "minecraft:warped_pressure_plate", + "blockRuntimeId" : 7599 + }, + { + "id" : "minecraft:stone_pressure_plate", + "blockRuntimeId" : 7207 + }, + { + "id" : "minecraft:light_weighted_pressure_plate", + "blockRuntimeId" : 5500 + }, + { + "id" : "minecraft:heavy_weighted_pressure_plate", + "blockRuntimeId" : 5096 + }, + { + "id" : "minecraft:polished_blackstone_pressure_plate", + "blockRuntimeId" : 6015 + }, + { + "id" : "minecraft:observer", + "blockRuntimeId" : 5725 + }, + { + "id" : "minecraft:daylight_detector", + "blockRuntimeId" : 4067 + }, + { + "id" : "minecraft:repeater" + }, + { + "id" : "minecraft:comparator" + }, + { + "id" : "minecraft:hopper" + }, + { + "id" : "minecraft:dropper", + "blockRuntimeId" : 4589 + }, + { + "id" : "minecraft:dispenser", + "blockRuntimeId" : 4490 + }, + { + "id" : "minecraft:piston", + "blockRuntimeId" : 5786 + }, + { + "id" : "minecraft:sticky_piston", + "blockRuntimeId" : 7169 + }, + { + "id" : "minecraft:tnt", + "blockRuntimeId" : 7353 + }, + { + "id" : "minecraft:name_tag" + }, + { + "id" : "minecraft:loom", + "blockRuntimeId" : 5582 + }, + { + "id" : "minecraft:banner" + }, + { + "id" : "minecraft:banner", + "damage" : 8 + }, + { + "id" : "minecraft:banner", + "damage" : 7 + }, + { + "id" : "minecraft:banner", + "damage" : 15 + }, + { + "id" : "minecraft:banner", + "damage" : 12 + }, + { + "id" : "minecraft:banner", + "damage" : 14 + }, + { + "id" : "minecraft:banner", + "damage" : 1 + }, + { + "id" : "minecraft:banner", + "damage" : 4 + }, + { + "id" : "minecraft:banner", + "damage" : 5 + }, + { + "id" : "minecraft:banner", + "damage" : 13 + }, + { + "id" : "minecraft:banner", + "damage" : 9 + }, + { + "id" : "minecraft:banner", + "damage" : 3 + }, + { + "id" : "minecraft:banner", + "damage" : 11 + }, + { + "id" : "minecraft:banner", + "damage" : 10 + }, + { + "id" : "minecraft:banner", + "damage" : 2 + }, + { + "id" : "minecraft:banner", + "damage" : 6 + }, + { + "id" : "minecraft:banner", + "damage" : 15, + "nbt_b64" : "CgAAAwQAVHlwZQEAAAAA" + }, + { + "id" : "minecraft:creeper_banner_pattern" + }, + { + "id" : "minecraft:skull_banner_pattern" + }, + { + "id" : "minecraft:flower_banner_pattern" + }, + { + "id" : "minecraft:mojang_banner_pattern" + }, + { + "id" : "minecraft:field_masoned_banner_pattern" + }, + { + "id" : "minecraft:bordure_indented_banner_pattern" + }, + { + "id" : "minecraft:piglin_banner_pattern" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwAAAAAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAABwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAIBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAHBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAPBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAMBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAOBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAABBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAEBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAFBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAANBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAJBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAADBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAALBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAKBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAACBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_rocket", + "nbt_b64" : "CgAACgkARmlyZXdvcmtzCQoARXhwbG9zaW9ucwoBAAAABw0ARmlyZXdvcmtDb2xvcgEAAAAGBwwARmlyZXdvcmtGYWRlAAAAAAEPAEZpcmV3b3JrRmxpY2tlcgABDQBGaXJld29ya1RyYWlsAAEMAEZpcmV3b3JrVHlwZQAAAQYARmxpZ2h0AQAA" + }, + { + "id" : "minecraft:firework_star", + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yIR0d/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 8, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yUk9H/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 7, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yl52d/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 15, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9y8PDw/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 12, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9y2rM6/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 14, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yHYD5/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 1, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yJi6w/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 4, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABAcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yqkQ8/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 5, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yuDKJ/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 13, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAADQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yvU7H/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 9, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACQcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yqovz/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 3, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yMlSD/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 11, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACwcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yPdj+/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 10, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAACgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yH8eA/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 2, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAAAgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9yFnxe/wA=" + }, + { + "id" : "minecraft:firework_star", + "damage" : 6, + "nbt_b64" : "CgAACg0ARmlyZXdvcmtzSXRlbQcNAEZpcmV3b3JrQ29sb3IBAAAABgcMAEZpcmV3b3JrRmFkZQAAAAABDwBGaXJld29ya0ZsaWNrZXIAAQ0ARmlyZXdvcmtUcmFpbAABDABGaXJld29ya1R5cGUAAAMLAGN1c3RvbUNvbG9ynJwW/wA=" + }, + { + "id" : "minecraft:chain" + }, + { + "id" : "minecraft:target", + "blockRuntimeId" : 7351 + }, + { + "id" : "minecraft:lodestone_compass" + } + ] +} \ No newline at end of file diff --git a/core/src/main/resources/bedrock/runtime_item_states.1_18_0.json b/core/src/main/resources/bedrock/runtime_item_states.1_18_0.json new file mode 100644 index 000000000..315547438 --- /dev/null +++ b/core/src/main/resources/bedrock/runtime_item_states.1_18_0.json @@ -0,0 +1,4322 @@ +[ + { + "name" : "minecraft:acacia_boat", + "id" : 379 + }, + { + "name" : "minecraft:acacia_button", + "id" : -140 + }, + { + "name" : "minecraft:acacia_door", + "id" : 556 + }, + { + "name" : "minecraft:acacia_fence_gate", + "id" : 187 + }, + { + "name" : "minecraft:acacia_pressure_plate", + "id" : -150 + }, + { + "name" : "minecraft:acacia_sign", + "id" : 579 + }, + { + "name" : "minecraft:acacia_stairs", + "id" : 163 + }, + { + "name" : "minecraft:acacia_standing_sign", + "id" : -190 + }, + { + "name" : "minecraft:acacia_trapdoor", + "id" : -145 + }, + { + "name" : "minecraft:acacia_wall_sign", + "id" : -191 + }, + { + "name" : "minecraft:activator_rail", + "id" : 126 + }, + { + "name" : "minecraft:agent_spawn_egg", + "id" : 487 + }, + { + "name" : "minecraft:air", + "id" : -158 + }, + { + "name" : "minecraft:allow", + "id" : 210 + }, + { + "name" : "minecraft:amethyst_block", + "id" : -327 + }, + { + "name" : "minecraft:amethyst_cluster", + "id" : -329 + }, + { + "name" : "minecraft:amethyst_shard", + "id" : 624 + }, + { + "name" : "minecraft:ancient_debris", + "id" : -271 + }, + { + "name" : "minecraft:andesite_stairs", + "id" : -171 + }, + { + "name" : "minecraft:anvil", + "id" : 145 + }, + { + "name" : "minecraft:apple", + "id" : 257 + }, + { + "name" : "minecraft:armor_stand", + "id" : 552 + }, + { + "name" : "minecraft:arrow", + "id" : 301 + }, + { + "name" : "minecraft:axolotl_bucket", + "id" : 369 + }, + { + "name" : "minecraft:axolotl_spawn_egg", + "id" : 500 + }, + { + "name" : "minecraft:azalea", + "id" : -337 + }, + { + "name" : "minecraft:azalea_leaves", + "id" : -324 + }, + { + "name" : "minecraft:azalea_leaves_flowered", + "id" : -325 + }, + { + "name" : "minecraft:baked_potato", + "id" : 281 + }, + { + "name" : "minecraft:balloon", + "id" : 597 + }, + { + "name" : "minecraft:bamboo", + "id" : -163 + }, + { + "name" : "minecraft:bamboo_sapling", + "id" : -164 + }, + { + "name" : "minecraft:banner", + "id" : 567 + }, + { + "name" : "minecraft:banner_pattern", + "id" : 629 + }, + { + "name" : "minecraft:barrel", + "id" : -203 + }, + { + "name" : "minecraft:barrier", + "id" : -161 + }, + { + "name" : "minecraft:basalt", + "id" : -234 + }, + { + "name" : "minecraft:bat_spawn_egg", + "id" : 453 + }, + { + "name" : "minecraft:beacon", + "id" : 138 + }, + { + "name" : "minecraft:bed", + "id" : 418 + }, + { + "name" : "minecraft:bedrock", + "id" : 7 + }, + { + "name" : "minecraft:bee_nest", + "id" : -218 + }, + { + "name" : "minecraft:bee_spawn_egg", + "id" : 494 + }, + { + "name" : "minecraft:beef", + "id" : 273 + }, + { + "name" : "minecraft:beehive", + "id" : -219 + }, + { + "name" : "minecraft:beetroot", + "id" : 285 + }, + { + "name" : "minecraft:beetroot_seeds", + "id" : 295 + }, + { + "name" : "minecraft:beetroot_soup", + "id" : 286 + }, + { + "name" : "minecraft:bell", + "id" : -206 + }, + { + "name" : "minecraft:big_dripleaf", + "id" : -323 + }, + { + "name" : "minecraft:birch_boat", + "id" : 376 + }, + { + "name" : "minecraft:birch_button", + "id" : -141 + }, + { + "name" : "minecraft:birch_door", + "id" : 554 + }, + { + "name" : "minecraft:birch_fence_gate", + "id" : 184 + }, + { + "name" : "minecraft:birch_pressure_plate", + "id" : -151 + }, + { + "name" : "minecraft:birch_sign", + "id" : 577 + }, + { + "name" : "minecraft:birch_stairs", + "id" : 135 + }, + { + "name" : "minecraft:birch_standing_sign", + "id" : -186 + }, + { + "name" : "minecraft:birch_trapdoor", + "id" : -146 + }, + { + "name" : "minecraft:birch_wall_sign", + "id" : -187 + }, + { + "name" : "minecraft:black_candle", + "id" : -428 + }, + { + "name" : "minecraft:black_candle_cake", + "id" : -445 + }, + { + "name" : "minecraft:black_dye", + "id" : 395 + }, + { + "name" : "minecraft:black_glazed_terracotta", + "id" : 235 + }, + { + "name" : "minecraft:blackstone", + "id" : -273 + }, + { + "name" : "minecraft:blackstone_double_slab", + "id" : -283 + }, + { + "name" : "minecraft:blackstone_slab", + "id" : -282 + }, + { + "name" : "minecraft:blackstone_stairs", + "id" : -276 + }, + { + "name" : "minecraft:blackstone_wall", + "id" : -277 + }, + { + "name" : "minecraft:blast_furnace", + "id" : -196 + }, + { + "name" : "minecraft:blaze_powder", + "id" : 429 + }, + { + "name" : "minecraft:blaze_rod", + "id" : 423 + }, + { + "name" : "minecraft:blaze_spawn_egg", + "id" : 456 + }, + { + "name" : "minecraft:bleach", + "id" : 595 + }, + { + "name" : "minecraft:blue_candle", + "id" : -424 + }, + { + "name" : "minecraft:blue_candle_cake", + "id" : -441 + }, + { + "name" : "minecraft:blue_dye", + "id" : 399 + }, + { + "name" : "minecraft:blue_glazed_terracotta", + "id" : 231 + }, + { + "name" : "minecraft:blue_ice", + "id" : -11 + }, + { + "name" : "minecraft:boat", + "id" : 627 + }, + { + "name" : "minecraft:bone", + "id" : 415 + }, + { + "name" : "minecraft:bone_block", + "id" : 216 + }, + { + "name" : "minecraft:bone_meal", + "id" : 411 + }, + { + "name" : "minecraft:book", + "id" : 387 + }, + { + "name" : "minecraft:bookshelf", + "id" : 47 + }, + { + "name" : "minecraft:border_block", + "id" : 212 + }, + { + "name" : "minecraft:bordure_indented_banner_pattern", + "id" : 586 + }, + { + "name" : "minecraft:bow", + "id" : 300 + }, + { + "name" : "minecraft:bowl", + "id" : 321 + }, + { + "name" : "minecraft:bread", + "id" : 261 + }, + { + "name" : "minecraft:brewing_stand", + "id" : 431 + }, + { + "name" : "minecraft:brewingstandblock", + "id" : 117 + }, + { + "name" : "minecraft:brick", + "id" : 383 + }, + { + "name" : "minecraft:brick_block", + "id" : 45 + }, + { + "name" : "minecraft:brick_stairs", + "id" : 108 + }, + { + "name" : "minecraft:brown_candle", + "id" : -425 + }, + { + "name" : "minecraft:brown_candle_cake", + "id" : -442 + }, + { + "name" : "minecraft:brown_dye", + "id" : 398 + }, + { + "name" : "minecraft:brown_glazed_terracotta", + "id" : 232 + }, + { + "name" : "minecraft:brown_mushroom", + "id" : 39 + }, + { + "name" : "minecraft:brown_mushroom_block", + "id" : 99 + }, + { + "name" : "minecraft:bubble_column", + "id" : -160 + }, + { + "name" : "minecraft:bucket", + "id" : 360 + }, + { + "name" : "minecraft:budding_amethyst", + "id" : -328 + }, + { + "name" : "minecraft:cactus", + "id" : 81 + }, + { + "name" : "minecraft:cake", + "id" : 417 + }, + { + "name" : "minecraft:calcite", + "id" : -326 + }, + { + "name" : "minecraft:camera", + "id" : 592 + }, + { + "name" : "minecraft:campfire", + "id" : 588 + }, + { + "name" : "minecraft:candle", + "id" : -412 + }, + { + "name" : "minecraft:candle_cake", + "id" : -429 + }, + { + "name" : "minecraft:carpet", + "id" : 171 + }, + { + "name" : "minecraft:carrot", + "id" : 279 + }, + { + "name" : "minecraft:carrot_on_a_stick", + "id" : 517 + }, + { + "name" : "minecraft:carrots", + "id" : 141 + }, + { + "name" : "minecraft:cartography_table", + "id" : -200 + }, + { + "name" : "minecraft:carved_pumpkin", + "id" : -155 + }, + { + "name" : "minecraft:cat_spawn_egg", + "id" : 488 + }, + { + "name" : "minecraft:cauldron", + "id" : 432 + }, + { + "name" : "minecraft:cave_spider_spawn_egg", + "id" : 457 + }, + { + "name" : "minecraft:cave_vines", + "id" : -322 + }, + { + "name" : "minecraft:cave_vines_body_with_berries", + "id" : -375 + }, + { + "name" : "minecraft:cave_vines_head_with_berries", + "id" : -376 + }, + { + "name" : "minecraft:chain", + "id" : 618 + }, + { + "name" : "minecraft:chain_command_block", + "id" : 189 + }, + { + "name" : "minecraft:chainmail_boots", + "id" : 342 + }, + { + "name" : "minecraft:chainmail_chestplate", + "id" : 340 + }, + { + "name" : "minecraft:chainmail_helmet", + "id" : 339 + }, + { + "name" : "minecraft:chainmail_leggings", + "id" : 341 + }, + { + "name" : "minecraft:charcoal", + "id" : 303 + }, + { + "name" : "minecraft:chemical_heat", + "id" : 192 + }, + { + "name" : "minecraft:chemistry_table", + "id" : 238 + }, + { + "name" : "minecraft:chest", + "id" : 54 + }, + { + "name" : "minecraft:chest_minecart", + "id" : 389 + }, + { + "name" : "minecraft:chicken", + "id" : 275 + }, + { + "name" : "minecraft:chicken_spawn_egg", + "id" : 435 + }, + { + "name" : "minecraft:chiseled_deepslate", + "id" : -395 + }, + { + "name" : "minecraft:chiseled_nether_bricks", + "id" : -302 + }, + { + "name" : "minecraft:chiseled_polished_blackstone", + "id" : -279 + }, + { + "name" : "minecraft:chorus_flower", + "id" : 200 + }, + { + "name" : "minecraft:chorus_fruit", + "id" : 558 + }, + { + "name" : "minecraft:chorus_plant", + "id" : 240 + }, + { + "name" : "minecraft:clay", + "id" : 82 + }, + { + "name" : "minecraft:clay_ball", + "id" : 384 + }, + { + "name" : "minecraft:client_request_placeholder_block", + "id" : -465 + }, + { + "name" : "minecraft:clock", + "id" : 393 + }, + { + "name" : "minecraft:coal", + "id" : 302 + }, + { + "name" : "minecraft:coal_block", + "id" : 173 + }, + { + "name" : "minecraft:coal_ore", + "id" : 16 + }, + { + "name" : "minecraft:cobbled_deepslate", + "id" : -379 + }, + { + "name" : "minecraft:cobbled_deepslate_double_slab", + "id" : -396 + }, + { + "name" : "minecraft:cobbled_deepslate_slab", + "id" : -380 + }, + { + "name" : "minecraft:cobbled_deepslate_stairs", + "id" : -381 + }, + { + "name" : "minecraft:cobbled_deepslate_wall", + "id" : -382 + }, + { + "name" : "minecraft:cobblestone", + "id" : 4 + }, + { + "name" : "minecraft:cobblestone_wall", + "id" : 139 + }, + { + "name" : "minecraft:cocoa", + "id" : 127 + }, + { + "name" : "minecraft:cocoa_beans", + "id" : 412 + }, + { + "name" : "minecraft:cod", + "id" : 264 + }, + { + "name" : "minecraft:cod_bucket", + "id" : 364 + }, + { + "name" : "minecraft:cod_spawn_egg", + "id" : 480 + }, + { + "name" : "minecraft:colored_torch_bp", + "id" : 204 + }, + { + "name" : "minecraft:colored_torch_rg", + "id" : 202 + }, + { + "name" : "minecraft:command_block", + "id" : 137 + }, + { + "name" : "minecraft:command_block_minecart", + "id" : 563 + }, + { + "name" : "minecraft:comparator", + "id" : 522 + }, + { + "name" : "minecraft:compass", + "id" : 391 + }, + { + "name" : "minecraft:composter", + "id" : -213 + }, + { + "name" : "minecraft:compound", + "id" : 593 + }, + { + "name" : "minecraft:concrete", + "id" : 236 + }, + { + "name" : "minecraft:concrete_powder", + "id" : 237 + }, + { + "name" : "minecraft:conduit", + "id" : -157 + }, + { + "name" : "minecraft:cooked_beef", + "id" : 274 + }, + { + "name" : "minecraft:cooked_chicken", + "id" : 276 + }, + { + "name" : "minecraft:cooked_cod", + "id" : 268 + }, + { + "name" : "minecraft:cooked_mutton", + "id" : 551 + }, + { + "name" : "minecraft:cooked_porkchop", + "id" : 263 + }, + { + "name" : "minecraft:cooked_rabbit", + "id" : 289 + }, + { + "name" : "minecraft:cooked_salmon", + "id" : 269 + }, + { + "name" : "minecraft:cookie", + "id" : 271 + }, + { + "name" : "minecraft:copper_block", + "id" : -340 + }, + { + "name" : "minecraft:copper_ingot", + "id" : 504 + }, + { + "name" : "minecraft:copper_ore", + "id" : -311 + }, + { + "name" : "minecraft:coral", + "id" : -131 + }, + { + "name" : "minecraft:coral_block", + "id" : -132 + }, + { + "name" : "minecraft:coral_fan", + "id" : -133 + }, + { + "name" : "minecraft:coral_fan_dead", + "id" : -134 + }, + { + "name" : "minecraft:coral_fan_hang", + "id" : -135 + }, + { + "name" : "minecraft:coral_fan_hang2", + "id" : -136 + }, + { + "name" : "minecraft:coral_fan_hang3", + "id" : -137 + }, + { + "name" : "minecraft:cow_spawn_egg", + "id" : 436 + }, + { + "name" : "minecraft:cracked_deepslate_bricks", + "id" : -410 + }, + { + "name" : "minecraft:cracked_deepslate_tiles", + "id" : -409 + }, + { + "name" : "minecraft:cracked_nether_bricks", + "id" : -303 + }, + { + "name" : "minecraft:cracked_polished_blackstone_bricks", + "id" : -280 + }, + { + "name" : "minecraft:crafting_table", + "id" : 58 + }, + { + "name" : "minecraft:creeper_banner_pattern", + "id" : 582 + }, + { + "name" : "minecraft:creeper_spawn_egg", + "id" : 441 + }, + { + "name" : "minecraft:crimson_button", + "id" : -260 + }, + { + "name" : "minecraft:crimson_door", + "id" : 615 + }, + { + "name" : "minecraft:crimson_double_slab", + "id" : -266 + }, + { + "name" : "minecraft:crimson_fence", + "id" : -256 + }, + { + "name" : "minecraft:crimson_fence_gate", + "id" : -258 + }, + { + "name" : "minecraft:crimson_fungus", + "id" : -228 + }, + { + "name" : "minecraft:crimson_hyphae", + "id" : -299 + }, + { + "name" : "minecraft:crimson_nylium", + "id" : -232 + }, + { + "name" : "minecraft:crimson_planks", + "id" : -242 + }, + { + "name" : "minecraft:crimson_pressure_plate", + "id" : -262 + }, + { + "name" : "minecraft:crimson_roots", + "id" : -223 + }, + { + "name" : "minecraft:crimson_sign", + "id" : 613 + }, + { + "name" : "minecraft:crimson_slab", + "id" : -264 + }, + { + "name" : "minecraft:crimson_stairs", + "id" : -254 + }, + { + "name" : "minecraft:crimson_standing_sign", + "id" : -250 + }, + { + "name" : "minecraft:crimson_stem", + "id" : -225 + }, + { + "name" : "minecraft:crimson_trapdoor", + "id" : -246 + }, + { + "name" : "minecraft:crimson_wall_sign", + "id" : -252 + }, + { + "name" : "minecraft:crossbow", + "id" : 575 + }, + { + "name" : "minecraft:crying_obsidian", + "id" : -289 + }, + { + "name" : "minecraft:cut_copper", + "id" : -347 + }, + { + "name" : "minecraft:cut_copper_slab", + "id" : -361 + }, + { + "name" : "minecraft:cut_copper_stairs", + "id" : -354 + }, + { + "name" : "minecraft:cyan_candle", + "id" : -422 + }, + { + "name" : "minecraft:cyan_candle_cake", + "id" : -439 + }, + { + "name" : "minecraft:cyan_dye", + "id" : 401 + }, + { + "name" : "minecraft:cyan_glazed_terracotta", + "id" : 229 + }, + { + "name" : "minecraft:dark_oak_boat", + "id" : 380 + }, + { + "name" : "minecraft:dark_oak_button", + "id" : -142 + }, + { + "name" : "minecraft:dark_oak_door", + "id" : 557 + }, + { + "name" : "minecraft:dark_oak_fence_gate", + "id" : 186 + }, + { + "name" : "minecraft:dark_oak_pressure_plate", + "id" : -152 + }, + { + "name" : "minecraft:dark_oak_sign", + "id" : 580 + }, + { + "name" : "minecraft:dark_oak_stairs", + "id" : 164 + }, + { + "name" : "minecraft:dark_oak_trapdoor", + "id" : -147 + }, + { + "name" : "minecraft:dark_prismarine_stairs", + "id" : -3 + }, + { + "name" : "minecraft:darkoak_standing_sign", + "id" : -192 + }, + { + "name" : "minecraft:darkoak_wall_sign", + "id" : -193 + }, + { + "name" : "minecraft:daylight_detector", + "id" : 151 + }, + { + "name" : "minecraft:daylight_detector_inverted", + "id" : 178 + }, + { + "name" : "minecraft:deadbush", + "id" : 32 + }, + { + "name" : "minecraft:deepslate", + "id" : -378 + }, + { + "name" : "minecraft:deepslate_brick_double_slab", + "id" : -399 + }, + { + "name" : "minecraft:deepslate_brick_slab", + "id" : -392 + }, + { + "name" : "minecraft:deepslate_brick_stairs", + "id" : -393 + }, + { + "name" : "minecraft:deepslate_brick_wall", + "id" : -394 + }, + { + "name" : "minecraft:deepslate_bricks", + "id" : -391 + }, + { + "name" : "minecraft:deepslate_coal_ore", + "id" : -406 + }, + { + "name" : "minecraft:deepslate_copper_ore", + "id" : -408 + }, + { + "name" : "minecraft:deepslate_diamond_ore", + "id" : -405 + }, + { + "name" : "minecraft:deepslate_emerald_ore", + "id" : -407 + }, + { + "name" : "minecraft:deepslate_gold_ore", + "id" : -402 + }, + { + "name" : "minecraft:deepslate_iron_ore", + "id" : -401 + }, + { + "name" : "minecraft:deepslate_lapis_ore", + "id" : -400 + }, + { + "name" : "minecraft:deepslate_redstone_ore", + "id" : -403 + }, + { + "name" : "minecraft:deepslate_tile_double_slab", + "id" : -398 + }, + { + "name" : "minecraft:deepslate_tile_slab", + "id" : -388 + }, + { + "name" : "minecraft:deepslate_tile_stairs", + "id" : -389 + }, + { + "name" : "minecraft:deepslate_tile_wall", + "id" : -390 + }, + { + "name" : "minecraft:deepslate_tiles", + "id" : -387 + }, + { + "name" : "minecraft:deny", + "id" : 211 + }, + { + "name" : "minecraft:detector_rail", + "id" : 28 + }, + { + "name" : "minecraft:diamond", + "id" : 304 + }, + { + "name" : "minecraft:diamond_axe", + "id" : 319 + }, + { + "name" : "minecraft:diamond_block", + "id" : 57 + }, + { + "name" : "minecraft:diamond_boots", + "id" : 350 + }, + { + "name" : "minecraft:diamond_chestplate", + "id" : 348 + }, + { + "name" : "minecraft:diamond_helmet", + "id" : 347 + }, + { + "name" : "minecraft:diamond_hoe", + "id" : 332 + }, + { + "name" : "minecraft:diamond_horse_armor", + "id" : 533 + }, + { + "name" : "minecraft:diamond_leggings", + "id" : 349 + }, + { + "name" : "minecraft:diamond_ore", + "id" : 56 + }, + { + "name" : "minecraft:diamond_pickaxe", + "id" : 318 + }, + { + "name" : "minecraft:diamond_shovel", + "id" : 317 + }, + { + "name" : "minecraft:diamond_sword", + "id" : 316 + }, + { + "name" : "minecraft:diorite_stairs", + "id" : -170 + }, + { + "name" : "minecraft:dirt", + "id" : 3 + }, + { + "name" : "minecraft:dirt_with_roots", + "id" : -318 + }, + { + "name" : "minecraft:dispenser", + "id" : 23 + }, + { + "name" : "minecraft:dolphin_spawn_egg", + "id" : 484 + }, + { + "name" : "minecraft:donkey_spawn_egg", + "id" : 465 + }, + { + "name" : "minecraft:double_cut_copper_slab", + "id" : -368 + }, + { + "name" : "minecraft:double_plant", + "id" : 175 + }, + { + "name" : "minecraft:double_stone_slab", + "id" : 44 + }, + { + "name" : "minecraft:double_stone_slab2", + "id" : 182 + }, + { + "name" : "minecraft:double_stone_slab3", + "id" : -162 + }, + { + "name" : "minecraft:double_stone_slab4", + "id" : -166 + }, + { + "name" : "minecraft:double_wooden_slab", + "id" : 157 + }, + { + "name" : "minecraft:dragon_breath", + "id" : 560 + }, + { + "name" : "minecraft:dragon_egg", + "id" : 122 + }, + { + "name" : "minecraft:dried_kelp", + "id" : 270 + }, + { + "name" : "minecraft:dried_kelp_block", + "id" : -139 + }, + { + "name" : "minecraft:dripstone_block", + "id" : -317 + }, + { + "name" : "minecraft:dropper", + "id" : 125 + }, + { + "name" : "minecraft:drowned_spawn_egg", + "id" : 483 + }, + { + "name" : "minecraft:dye", + "id" : 628 + }, + { + "name" : "minecraft:egg", + "id" : 390 + }, + { + "name" : "minecraft:elder_guardian_spawn_egg", + "id" : 471 + }, + { + "name" : "minecraft:element_0", + "id" : 36 + }, + { + "name" : "minecraft:element_1", + "id" : -12 + }, + { + "name" : "minecraft:element_10", + "id" : -21 + }, + { + "name" : "minecraft:element_100", + "id" : -111 + }, + { + "name" : "minecraft:element_101", + "id" : -112 + }, + { + "name" : "minecraft:element_102", + "id" : -113 + }, + { + "name" : "minecraft:element_103", + "id" : -114 + }, + { + "name" : "minecraft:element_104", + "id" : -115 + }, + { + "name" : "minecraft:element_105", + "id" : -116 + }, + { + "name" : "minecraft:element_106", + "id" : -117 + }, + { + "name" : "minecraft:element_107", + "id" : -118 + }, + { + "name" : "minecraft:element_108", + "id" : -119 + }, + { + "name" : "minecraft:element_109", + "id" : -120 + }, + { + "name" : "minecraft:element_11", + "id" : -22 + }, + { + "name" : "minecraft:element_110", + "id" : -121 + }, + { + "name" : "minecraft:element_111", + "id" : -122 + }, + { + "name" : "minecraft:element_112", + "id" : -123 + }, + { + "name" : "minecraft:element_113", + "id" : -124 + }, + { + "name" : "minecraft:element_114", + "id" : -125 + }, + { + "name" : "minecraft:element_115", + "id" : -126 + }, + { + "name" : "minecraft:element_116", + "id" : -127 + }, + { + "name" : "minecraft:element_117", + "id" : -128 + }, + { + "name" : "minecraft:element_118", + "id" : -129 + }, + { + "name" : "minecraft:element_12", + "id" : -23 + }, + { + "name" : "minecraft:element_13", + "id" : -24 + }, + { + "name" : "minecraft:element_14", + "id" : -25 + }, + { + "name" : "minecraft:element_15", + "id" : -26 + }, + { + "name" : "minecraft:element_16", + "id" : -27 + }, + { + "name" : "minecraft:element_17", + "id" : -28 + }, + { + "name" : "minecraft:element_18", + "id" : -29 + }, + { + "name" : "minecraft:element_19", + "id" : -30 + }, + { + "name" : "minecraft:element_2", + "id" : -13 + }, + { + "name" : "minecraft:element_20", + "id" : -31 + }, + { + "name" : "minecraft:element_21", + "id" : -32 + }, + { + "name" : "minecraft:element_22", + "id" : -33 + }, + { + "name" : "minecraft:element_23", + "id" : -34 + }, + { + "name" : "minecraft:element_24", + "id" : -35 + }, + { + "name" : "minecraft:element_25", + "id" : -36 + }, + { + "name" : "minecraft:element_26", + "id" : -37 + }, + { + "name" : "minecraft:element_27", + "id" : -38 + }, + { + "name" : "minecraft:element_28", + "id" : -39 + }, + { + "name" : "minecraft:element_29", + "id" : -40 + }, + { + "name" : "minecraft:element_3", + "id" : -14 + }, + { + "name" : "minecraft:element_30", + "id" : -41 + }, + { + "name" : "minecraft:element_31", + "id" : -42 + }, + { + "name" : "minecraft:element_32", + "id" : -43 + }, + { + "name" : "minecraft:element_33", + "id" : -44 + }, + { + "name" : "minecraft:element_34", + "id" : -45 + }, + { + "name" : "minecraft:element_35", + "id" : -46 + }, + { + "name" : "minecraft:element_36", + "id" : -47 + }, + { + "name" : "minecraft:element_37", + "id" : -48 + }, + { + "name" : "minecraft:element_38", + "id" : -49 + }, + { + "name" : "minecraft:element_39", + "id" : -50 + }, + { + "name" : "minecraft:element_4", + "id" : -15 + }, + { + "name" : "minecraft:element_40", + "id" : -51 + }, + { + "name" : "minecraft:element_41", + "id" : -52 + }, + { + "name" : "minecraft:element_42", + "id" : -53 + }, + { + "name" : "minecraft:element_43", + "id" : -54 + }, + { + "name" : "minecraft:element_44", + "id" : -55 + }, + { + "name" : "minecraft:element_45", + "id" : -56 + }, + { + "name" : "minecraft:element_46", + "id" : -57 + }, + { + "name" : "minecraft:element_47", + "id" : -58 + }, + { + "name" : "minecraft:element_48", + "id" : -59 + }, + { + "name" : "minecraft:element_49", + "id" : -60 + }, + { + "name" : "minecraft:element_5", + "id" : -16 + }, + { + "name" : "minecraft:element_50", + "id" : -61 + }, + { + "name" : "minecraft:element_51", + "id" : -62 + }, + { + "name" : "minecraft:element_52", + "id" : -63 + }, + { + "name" : "minecraft:element_53", + "id" : -64 + }, + { + "name" : "minecraft:element_54", + "id" : -65 + }, + { + "name" : "minecraft:element_55", + "id" : -66 + }, + { + "name" : "minecraft:element_56", + "id" : -67 + }, + { + "name" : "minecraft:element_57", + "id" : -68 + }, + { + "name" : "minecraft:element_58", + "id" : -69 + }, + { + "name" : "minecraft:element_59", + "id" : -70 + }, + { + "name" : "minecraft:element_6", + "id" : -17 + }, + { + "name" : "minecraft:element_60", + "id" : -71 + }, + { + "name" : "minecraft:element_61", + "id" : -72 + }, + { + "name" : "minecraft:element_62", + "id" : -73 + }, + { + "name" : "minecraft:element_63", + "id" : -74 + }, + { + "name" : "minecraft:element_64", + "id" : -75 + }, + { + "name" : "minecraft:element_65", + "id" : -76 + }, + { + "name" : "minecraft:element_66", + "id" : -77 + }, + { + "name" : "minecraft:element_67", + "id" : -78 + }, + { + "name" : "minecraft:element_68", + "id" : -79 + }, + { + "name" : "minecraft:element_69", + "id" : -80 + }, + { + "name" : "minecraft:element_7", + "id" : -18 + }, + { + "name" : "minecraft:element_70", + "id" : -81 + }, + { + "name" : "minecraft:element_71", + "id" : -82 + }, + { + "name" : "minecraft:element_72", + "id" : -83 + }, + { + "name" : "minecraft:element_73", + "id" : -84 + }, + { + "name" : "minecraft:element_74", + "id" : -85 + }, + { + "name" : "minecraft:element_75", + "id" : -86 + }, + { + "name" : "minecraft:element_76", + "id" : -87 + }, + { + "name" : "minecraft:element_77", + "id" : -88 + }, + { + "name" : "minecraft:element_78", + "id" : -89 + }, + { + "name" : "minecraft:element_79", + "id" : -90 + }, + { + "name" : "minecraft:element_8", + "id" : -19 + }, + { + "name" : "minecraft:element_80", + "id" : -91 + }, + { + "name" : "minecraft:element_81", + "id" : -92 + }, + { + "name" : "minecraft:element_82", + "id" : -93 + }, + { + "name" : "minecraft:element_83", + "id" : -94 + }, + { + "name" : "minecraft:element_84", + "id" : -95 + }, + { + "name" : "minecraft:element_85", + "id" : -96 + }, + { + "name" : "minecraft:element_86", + "id" : -97 + }, + { + "name" : "minecraft:element_87", + "id" : -98 + }, + { + "name" : "minecraft:element_88", + "id" : -99 + }, + { + "name" : "minecraft:element_89", + "id" : -100 + }, + { + "name" : "minecraft:element_9", + "id" : -20 + }, + { + "name" : "minecraft:element_90", + "id" : -101 + }, + { + "name" : "minecraft:element_91", + "id" : -102 + }, + { + "name" : "minecraft:element_92", + "id" : -103 + }, + { + "name" : "minecraft:element_93", + "id" : -104 + }, + { + "name" : "minecraft:element_94", + "id" : -105 + }, + { + "name" : "minecraft:element_95", + "id" : -106 + }, + { + "name" : "minecraft:element_96", + "id" : -107 + }, + { + "name" : "minecraft:element_97", + "id" : -108 + }, + { + "name" : "minecraft:element_98", + "id" : -109 + }, + { + "name" : "minecraft:element_99", + "id" : -110 + }, + { + "name" : "minecraft:elytra", + "id" : 564 + }, + { + "name" : "minecraft:emerald", + "id" : 512 + }, + { + "name" : "minecraft:emerald_block", + "id" : 133 + }, + { + "name" : "minecraft:emerald_ore", + "id" : 129 + }, + { + "name" : "minecraft:empty_map", + "id" : 515 + }, + { + "name" : "minecraft:enchanted_book", + "id" : 521 + }, + { + "name" : "minecraft:enchanted_golden_apple", + "id" : 259 + }, + { + "name" : "minecraft:enchanting_table", + "id" : 116 + }, + { + "name" : "minecraft:end_brick_stairs", + "id" : -178 + }, + { + "name" : "minecraft:end_bricks", + "id" : 206 + }, + { + "name" : "minecraft:end_crystal", + "id" : 631 + }, + { + "name" : "minecraft:end_gateway", + "id" : 209 + }, + { + "name" : "minecraft:end_portal", + "id" : 119 + }, + { + "name" : "minecraft:end_portal_frame", + "id" : 120 + }, + { + "name" : "minecraft:end_rod", + "id" : 208 + }, + { + "name" : "minecraft:end_stone", + "id" : 121 + }, + { + "name" : "minecraft:ender_chest", + "id" : 130 + }, + { + "name" : "minecraft:ender_eye", + "id" : 433 + }, + { + "name" : "minecraft:ender_pearl", + "id" : 422 + }, + { + "name" : "minecraft:enderman_spawn_egg", + "id" : 442 + }, + { + "name" : "minecraft:endermite_spawn_egg", + "id" : 460 + }, + { + "name" : "minecraft:evoker_spawn_egg", + "id" : 475 + }, + { + "name" : "minecraft:experience_bottle", + "id" : 508 + }, + { + "name" : "minecraft:exposed_copper", + "id" : -341 + }, + { + "name" : "minecraft:exposed_cut_copper", + "id" : -348 + }, + { + "name" : "minecraft:exposed_cut_copper_slab", + "id" : -362 + }, + { + "name" : "minecraft:exposed_cut_copper_stairs", + "id" : -355 + }, + { + "name" : "minecraft:exposed_double_cut_copper_slab", + "id" : -369 + }, + { + "name" : "minecraft:farmland", + "id" : 60 + }, + { + "name" : "minecraft:feather", + "id" : 327 + }, + { + "name" : "minecraft:fence", + "id" : 85 + }, + { + "name" : "minecraft:fence_gate", + "id" : 107 + }, + { + "name" : "minecraft:fermented_spider_eye", + "id" : 428 + }, + { + "name" : "minecraft:field_masoned_banner_pattern", + "id" : 585 + }, + { + "name" : "minecraft:filled_map", + "id" : 420 + }, + { + "name" : "minecraft:fire", + "id" : 51 + }, + { + "name" : "minecraft:fire_charge", + "id" : 509 + }, + { + "name" : "minecraft:firework_rocket", + "id" : 519 + }, + { + "name" : "minecraft:firework_star", + "id" : 520 + }, + { + "name" : "minecraft:fishing_rod", + "id" : 392 + }, + { + "name" : "minecraft:fletching_table", + "id" : -201 + }, + { + "name" : "minecraft:flint", + "id" : 356 + }, + { + "name" : "minecraft:flint_and_steel", + "id" : 299 + }, + { + "name" : "minecraft:flower_banner_pattern", + "id" : 581 + }, + { + "name" : "minecraft:flower_pot", + "id" : 514 + }, + { + "name" : "minecraft:flowering_azalea", + "id" : -338 + }, + { + "name" : "minecraft:flowing_lava", + "id" : 10 + }, + { + "name" : "minecraft:flowing_water", + "id" : 8 + }, + { + "name" : "minecraft:fox_spawn_egg", + "id" : 490 + }, + { + "name" : "minecraft:frame", + "id" : 513 + }, + { + "name" : "minecraft:frosted_ice", + "id" : 207 + }, + { + "name" : "minecraft:furnace", + "id" : 61 + }, + { + "name" : "minecraft:ghast_spawn_egg", + "id" : 454 + }, + { + "name" : "minecraft:ghast_tear", + "id" : 424 + }, + { + "name" : "minecraft:gilded_blackstone", + "id" : -281 + }, + { + "name" : "minecraft:glass", + "id" : 20 + }, + { + "name" : "minecraft:glass_bottle", + "id" : 427 + }, + { + "name" : "minecraft:glass_pane", + "id" : 102 + }, + { + "name" : "minecraft:glistering_melon_slice", + "id" : 434 + }, + { + "name" : "minecraft:glow_berries", + "id" : 632 + }, + { + "name" : "minecraft:glow_frame", + "id" : 622 + }, + { + "name" : "minecraft:glow_ink_sac", + "id" : 503 + }, + { + "name" : "minecraft:glow_lichen", + "id" : -411 + }, + { + "name" : "minecraft:glow_squid_spawn_egg", + "id" : 502 + }, + { + "name" : "minecraft:glow_stick", + "id" : 600 + }, + { + "name" : "minecraft:glowingobsidian", + "id" : 246 + }, + { + "name" : "minecraft:glowstone", + "id" : 89 + }, + { + "name" : "minecraft:glowstone_dust", + "id" : 394 + }, + { + "name" : "minecraft:goat_horn", + "id" : 623 + }, + { + "name" : "minecraft:goat_spawn_egg", + "id" : 501 + }, + { + "name" : "minecraft:gold_block", + "id" : 41 + }, + { + "name" : "minecraft:gold_ingot", + "id" : 306 + }, + { + "name" : "minecraft:gold_nugget", + "id" : 425 + }, + { + "name" : "minecraft:gold_ore", + "id" : 14 + }, + { + "name" : "minecraft:golden_apple", + "id" : 258 + }, + { + "name" : "minecraft:golden_axe", + "id" : 325 + }, + { + "name" : "minecraft:golden_boots", + "id" : 354 + }, + { + "name" : "minecraft:golden_carrot", + "id" : 283 + }, + { + "name" : "minecraft:golden_chestplate", + "id" : 352 + }, + { + "name" : "minecraft:golden_helmet", + "id" : 351 + }, + { + "name" : "minecraft:golden_hoe", + "id" : 333 + }, + { + "name" : "minecraft:golden_horse_armor", + "id" : 532 + }, + { + "name" : "minecraft:golden_leggings", + "id" : 353 + }, + { + "name" : "minecraft:golden_pickaxe", + "id" : 324 + }, + { + "name" : "minecraft:golden_rail", + "id" : 27 + }, + { + "name" : "minecraft:golden_shovel", + "id" : 323 + }, + { + "name" : "minecraft:golden_sword", + "id" : 322 + }, + { + "name" : "minecraft:granite_stairs", + "id" : -169 + }, + { + "name" : "minecraft:grass", + "id" : 2 + }, + { + "name" : "minecraft:grass_path", + "id" : 198 + }, + { + "name" : "minecraft:gravel", + "id" : 13 + }, + { + "name" : "minecraft:gray_candle", + "id" : -420 + }, + { + "name" : "minecraft:gray_candle_cake", + "id" : -437 + }, + { + "name" : "minecraft:gray_dye", + "id" : 403 + }, + { + "name" : "minecraft:gray_glazed_terracotta", + "id" : 227 + }, + { + "name" : "minecraft:green_candle", + "id" : -426 + }, + { + "name" : "minecraft:green_candle_cake", + "id" : -443 + }, + { + "name" : "minecraft:green_dye", + "id" : 397 + }, + { + "name" : "minecraft:green_glazed_terracotta", + "id" : 233 + }, + { + "name" : "minecraft:grindstone", + "id" : -195 + }, + { + "name" : "minecraft:guardian_spawn_egg", + "id" : 461 + }, + { + "name" : "minecraft:gunpowder", + "id" : 328 + }, + { + "name" : "minecraft:hanging_roots", + "id" : -319 + }, + { + "name" : "minecraft:hard_glass", + "id" : 253 + }, + { + "name" : "minecraft:hard_glass_pane", + "id" : 190 + }, + { + "name" : "minecraft:hard_stained_glass", + "id" : 254 + }, + { + "name" : "minecraft:hard_stained_glass_pane", + "id" : 191 + }, + { + "name" : "minecraft:hardened_clay", + "id" : 172 + }, + { + "name" : "minecraft:hay_block", + "id" : 170 + }, + { + "name" : "minecraft:heart_of_the_sea", + "id" : 571 + }, + { + "name" : "minecraft:heavy_weighted_pressure_plate", + "id" : 148 + }, + { + "name" : "minecraft:hoglin_spawn_egg", + "id" : 496 + }, + { + "name" : "minecraft:honey_block", + "id" : -220 + }, + { + "name" : "minecraft:honey_bottle", + "id" : 591 + }, + { + "name" : "minecraft:honeycomb", + "id" : 590 + }, + { + "name" : "minecraft:honeycomb_block", + "id" : -221 + }, + { + "name" : "minecraft:hopper", + "id" : 527 + }, + { + "name" : "minecraft:hopper_minecart", + "id" : 526 + }, + { + "name" : "minecraft:horse_spawn_egg", + "id" : 458 + }, + { + "name" : "minecraft:husk_spawn_egg", + "id" : 463 + }, + { + "name" : "minecraft:ice", + "id" : 79 + }, + { + "name" : "minecraft:ice_bomb", + "id" : 594 + }, + { + "name" : "minecraft:infested_deepslate", + "id" : -454 + }, + { + "name" : "minecraft:info_update", + "id" : 248 + }, + { + "name" : "minecraft:info_update2", + "id" : 249 + }, + { + "name" : "minecraft:ink_sac", + "id" : 413 + }, + { + "name" : "minecraft:invisiblebedrock", + "id" : 95 + }, + { + "name" : "minecraft:iron_axe", + "id" : 298 + }, + { + "name" : "minecraft:iron_bars", + "id" : 101 + }, + { + "name" : "minecraft:iron_block", + "id" : 42 + }, + { + "name" : "minecraft:iron_boots", + "id" : 346 + }, + { + "name" : "minecraft:iron_chestplate", + "id" : 344 + }, + { + "name" : "minecraft:iron_door", + "id" : 372 + }, + { + "name" : "minecraft:iron_helmet", + "id" : 343 + }, + { + "name" : "minecraft:iron_hoe", + "id" : 331 + }, + { + "name" : "minecraft:iron_horse_armor", + "id" : 531 + }, + { + "name" : "minecraft:iron_ingot", + "id" : 305 + }, + { + "name" : "minecraft:iron_leggings", + "id" : 345 + }, + { + "name" : "minecraft:iron_nugget", + "id" : 569 + }, + { + "name" : "minecraft:iron_ore", + "id" : 15 + }, + { + "name" : "minecraft:iron_pickaxe", + "id" : 297 + }, + { + "name" : "minecraft:iron_shovel", + "id" : 296 + }, + { + "name" : "minecraft:iron_sword", + "id" : 307 + }, + { + "name" : "minecraft:iron_trapdoor", + "id" : 167 + }, + { + "name" : "minecraft:item.acacia_door", + "id" : 196 + }, + { + "name" : "minecraft:item.bed", + "id" : 26 + }, + { + "name" : "minecraft:item.beetroot", + "id" : 244 + }, + { + "name" : "minecraft:item.birch_door", + "id" : 194 + }, + { + "name" : "minecraft:item.cake", + "id" : 92 + }, + { + "name" : "minecraft:item.camera", + "id" : 242 + }, + { + "name" : "minecraft:item.campfire", + "id" : -209 + }, + { + "name" : "minecraft:item.cauldron", + "id" : 118 + }, + { + "name" : "minecraft:item.chain", + "id" : -286 + }, + { + "name" : "minecraft:item.crimson_door", + "id" : -244 + }, + { + "name" : "minecraft:item.dark_oak_door", + "id" : 197 + }, + { + "name" : "minecraft:item.flower_pot", + "id" : 140 + }, + { + "name" : "minecraft:item.frame", + "id" : 199 + }, + { + "name" : "minecraft:item.glow_frame", + "id" : -339 + }, + { + "name" : "minecraft:item.hopper", + "id" : 154 + }, + { + "name" : "minecraft:item.iron_door", + "id" : 71 + }, + { + "name" : "minecraft:item.jungle_door", + "id" : 195 + }, + { + "name" : "minecraft:item.kelp", + "id" : -138 + }, + { + "name" : "minecraft:item.nether_sprouts", + "id" : -238 + }, + { + "name" : "minecraft:item.nether_wart", + "id" : 115 + }, + { + "name" : "minecraft:item.reeds", + "id" : 83 + }, + { + "name" : "minecraft:item.skull", + "id" : 144 + }, + { + "name" : "minecraft:item.soul_campfire", + "id" : -290 + }, + { + "name" : "minecraft:item.spruce_door", + "id" : 193 + }, + { + "name" : "minecraft:item.warped_door", + "id" : -245 + }, + { + "name" : "minecraft:item.wheat", + "id" : 59 + }, + { + "name" : "minecraft:item.wooden_door", + "id" : 64 + }, + { + "name" : "minecraft:jigsaw", + "id" : -211 + }, + { + "name" : "minecraft:jukebox", + "id" : 84 + }, + { + "name" : "minecraft:jungle_boat", + "id" : 377 + }, + { + "name" : "minecraft:jungle_button", + "id" : -143 + }, + { + "name" : "minecraft:jungle_door", + "id" : 555 + }, + { + "name" : "minecraft:jungle_fence_gate", + "id" : 185 + }, + { + "name" : "minecraft:jungle_pressure_plate", + "id" : -153 + }, + { + "name" : "minecraft:jungle_sign", + "id" : 578 + }, + { + "name" : "minecraft:jungle_stairs", + "id" : 136 + }, + { + "name" : "minecraft:jungle_standing_sign", + "id" : -188 + }, + { + "name" : "minecraft:jungle_trapdoor", + "id" : -148 + }, + { + "name" : "minecraft:jungle_wall_sign", + "id" : -189 + }, + { + "name" : "minecraft:kelp", + "id" : 382 + }, + { + "name" : "minecraft:ladder", + "id" : 65 + }, + { + "name" : "minecraft:lantern", + "id" : -208 + }, + { + "name" : "minecraft:lapis_block", + "id" : 22 + }, + { + "name" : "minecraft:lapis_lazuli", + "id" : 414 + }, + { + "name" : "minecraft:lapis_ore", + "id" : 21 + }, + { + "name" : "minecraft:large_amethyst_bud", + "id" : -330 + }, + { + "name" : "minecraft:lava", + "id" : 11 + }, + { + "name" : "minecraft:lava_bucket", + "id" : 363 + }, + { + "name" : "minecraft:lava_cauldron", + "id" : -210 + }, + { + "name" : "minecraft:lead", + "id" : 547 + }, + { + "name" : "minecraft:leather", + "id" : 381 + }, + { + "name" : "minecraft:leather_boots", + "id" : 338 + }, + { + "name" : "minecraft:leather_chestplate", + "id" : 336 + }, + { + "name" : "minecraft:leather_helmet", + "id" : 335 + }, + { + "name" : "minecraft:leather_horse_armor", + "id" : 530 + }, + { + "name" : "minecraft:leather_leggings", + "id" : 337 + }, + { + "name" : "minecraft:leaves", + "id" : 18 + }, + { + "name" : "minecraft:leaves2", + "id" : 161 + }, + { + "name" : "minecraft:lectern", + "id" : -194 + }, + { + "name" : "minecraft:lever", + "id" : 69 + }, + { + "name" : "minecraft:light_block", + "id" : -215 + }, + { + "name" : "minecraft:light_blue_candle", + "id" : -416 + }, + { + "name" : "minecraft:light_blue_candle_cake", + "id" : -433 + }, + { + "name" : "minecraft:light_blue_dye", + "id" : 407 + }, + { + "name" : "minecraft:light_blue_glazed_terracotta", + "id" : 223 + }, + { + "name" : "minecraft:light_gray_candle", + "id" : -421 + }, + { + "name" : "minecraft:light_gray_candle_cake", + "id" : -438 + }, + { + "name" : "minecraft:light_gray_dye", + "id" : 402 + }, + { + "name" : "minecraft:light_weighted_pressure_plate", + "id" : 147 + }, + { + "name" : "minecraft:lightning_rod", + "id" : -312 + }, + { + "name" : "minecraft:lime_candle", + "id" : -418 + }, + { + "name" : "minecraft:lime_candle_cake", + "id" : -435 + }, + { + "name" : "minecraft:lime_dye", + "id" : 405 + }, + { + "name" : "minecraft:lime_glazed_terracotta", + "id" : 225 + }, + { + "name" : "minecraft:lingering_potion", + "id" : 562 + }, + { + "name" : "minecraft:lit_blast_furnace", + "id" : -214 + }, + { + "name" : "minecraft:lit_deepslate_redstone_ore", + "id" : -404 + }, + { + "name" : "minecraft:lit_furnace", + "id" : 62 + }, + { + "name" : "minecraft:lit_pumpkin", + "id" : 91 + }, + { + "name" : "minecraft:lit_redstone_lamp", + "id" : 124 + }, + { + "name" : "minecraft:lit_redstone_ore", + "id" : 74 + }, + { + "name" : "minecraft:lit_smoker", + "id" : -199 + }, + { + "name" : "minecraft:llama_spawn_egg", + "id" : 473 + }, + { + "name" : "minecraft:lodestone", + "id" : -222 + }, + { + "name" : "minecraft:lodestone_compass", + "id" : 601 + }, + { + "name" : "minecraft:log", + "id" : 17 + }, + { + "name" : "minecraft:log2", + "id" : 162 + }, + { + "name" : "minecraft:loom", + "id" : -204 + }, + { + "name" : "minecraft:magenta_candle", + "id" : -415 + }, + { + "name" : "minecraft:magenta_candle_cake", + "id" : -432 + }, + { + "name" : "minecraft:magenta_dye", + "id" : 408 + }, + { + "name" : "minecraft:magenta_glazed_terracotta", + "id" : 222 + }, + { + "name" : "minecraft:magma", + "id" : 213 + }, + { + "name" : "minecraft:magma_cream", + "id" : 430 + }, + { + "name" : "minecraft:magma_cube_spawn_egg", + "id" : 455 + }, + { + "name" : "minecraft:medicine", + "id" : 598 + }, + { + "name" : "minecraft:medium_amethyst_bud", + "id" : -331 + }, + { + "name" : "minecraft:melon_block", + "id" : 103 + }, + { + "name" : "minecraft:melon_seeds", + "id" : 293 + }, + { + "name" : "minecraft:melon_slice", + "id" : 272 + }, + { + "name" : "minecraft:melon_stem", + "id" : 105 + }, + { + "name" : "minecraft:milk_bucket", + "id" : 361 + }, + { + "name" : "minecraft:minecart", + "id" : 370 + }, + { + "name" : "minecraft:mob_spawner", + "id" : 52 + }, + { + "name" : "minecraft:mojang_banner_pattern", + "id" : 584 + }, + { + "name" : "minecraft:monster_egg", + "id" : 97 + }, + { + "name" : "minecraft:mooshroom_spawn_egg", + "id" : 440 + }, + { + "name" : "minecraft:moss_block", + "id" : -320 + }, + { + "name" : "minecraft:moss_carpet", + "id" : -335 + }, + { + "name" : "minecraft:mossy_cobblestone", + "id" : 48 + }, + { + "name" : "minecraft:mossy_cobblestone_stairs", + "id" : -179 + }, + { + "name" : "minecraft:mossy_stone_brick_stairs", + "id" : -175 + }, + { + "name" : "minecraft:movingblock", + "id" : 250 + }, + { + "name" : "minecraft:mule_spawn_egg", + "id" : 466 + }, + { + "name" : "minecraft:mushroom_stew", + "id" : 260 + }, + { + "name" : "minecraft:music_disc_11", + "id" : 544 + }, + { + "name" : "minecraft:music_disc_13", + "id" : 534 + }, + { + "name" : "minecraft:music_disc_blocks", + "id" : 536 + }, + { + "name" : "minecraft:music_disc_cat", + "id" : 535 + }, + { + "name" : "minecraft:music_disc_chirp", + "id" : 537 + }, + { + "name" : "minecraft:music_disc_far", + "id" : 538 + }, + { + "name" : "minecraft:music_disc_mall", + "id" : 539 + }, + { + "name" : "minecraft:music_disc_mellohi", + "id" : 540 + }, + { + "name" : "minecraft:music_disc_otherside", + "id" : 626 + }, + { + "name" : "minecraft:music_disc_pigstep", + "id" : 619 + }, + { + "name" : "minecraft:music_disc_stal", + "id" : 541 + }, + { + "name" : "minecraft:music_disc_strad", + "id" : 542 + }, + { + "name" : "minecraft:music_disc_wait", + "id" : 545 + }, + { + "name" : "minecraft:music_disc_ward", + "id" : 543 + }, + { + "name" : "minecraft:mutton", + "id" : 550 + }, + { + "name" : "minecraft:mycelium", + "id" : 110 + }, + { + "name" : "minecraft:mysterious_frame", + "id" : -466 + }, + { + "name" : "minecraft:mysterious_frame_slot", + "id" : -467 + }, + { + "name" : "minecraft:name_tag", + "id" : 548 + }, + { + "name" : "minecraft:nautilus_shell", + "id" : 570 + }, + { + "name" : "minecraft:nether_brick", + "id" : 112 + }, + { + "name" : "minecraft:nether_brick_fence", + "id" : 113 + }, + { + "name" : "minecraft:nether_brick_stairs", + "id" : 114 + }, + { + "name" : "minecraft:nether_gold_ore", + "id" : -288 + }, + { + "name" : "minecraft:nether_sprouts", + "id" : 620 + }, + { + "name" : "minecraft:nether_star", + "id" : 518 + }, + { + "name" : "minecraft:nether_wart", + "id" : 294 + }, + { + "name" : "minecraft:nether_wart_block", + "id" : 214 + }, + { + "name" : "minecraft:netherbrick", + "id" : 523 + }, + { + "name" : "minecraft:netherite_axe", + "id" : 606 + }, + { + "name" : "minecraft:netherite_block", + "id" : -270 + }, + { + "name" : "minecraft:netherite_boots", + "id" : 611 + }, + { + "name" : "minecraft:netherite_chestplate", + "id" : 609 + }, + { + "name" : "minecraft:netherite_helmet", + "id" : 608 + }, + { + "name" : "minecraft:netherite_hoe", + "id" : 607 + }, + { + "name" : "minecraft:netherite_ingot", + "id" : 602 + }, + { + "name" : "minecraft:netherite_leggings", + "id" : 610 + }, + { + "name" : "minecraft:netherite_pickaxe", + "id" : 605 + }, + { + "name" : "minecraft:netherite_scrap", + "id" : 612 + }, + { + "name" : "minecraft:netherite_shovel", + "id" : 604 + }, + { + "name" : "minecraft:netherite_sword", + "id" : 603 + }, + { + "name" : "minecraft:netherrack", + "id" : 87 + }, + { + "name" : "minecraft:netherreactor", + "id" : 247 + }, + { + "name" : "minecraft:normal_stone_stairs", + "id" : -180 + }, + { + "name" : "minecraft:noteblock", + "id" : 25 + }, + { + "name" : "minecraft:npc_spawn_egg", + "id" : 470 + }, + { + "name" : "minecraft:oak_boat", + "id" : 375 + }, + { + "name" : "minecraft:oak_sign", + "id" : 358 + }, + { + "name" : "minecraft:oak_stairs", + "id" : 53 + }, + { + "name" : "minecraft:observer", + "id" : 251 + }, + { + "name" : "minecraft:obsidian", + "id" : 49 + }, + { + "name" : "minecraft:ocelot_spawn_egg", + "id" : 451 + }, + { + "name" : "minecraft:orange_candle", + "id" : -414 + }, + { + "name" : "minecraft:orange_candle_cake", + "id" : -431 + }, + { + "name" : "minecraft:orange_dye", + "id" : 409 + }, + { + "name" : "minecraft:orange_glazed_terracotta", + "id" : 221 + }, + { + "name" : "minecraft:oxidized_copper", + "id" : -343 + }, + { + "name" : "minecraft:oxidized_cut_copper", + "id" : -350 + }, + { + "name" : "minecraft:oxidized_cut_copper_slab", + "id" : -364 + }, + { + "name" : "minecraft:oxidized_cut_copper_stairs", + "id" : -357 + }, + { + "name" : "minecraft:oxidized_double_cut_copper_slab", + "id" : -371 + }, + { + "name" : "minecraft:packed_ice", + "id" : 174 + }, + { + "name" : "minecraft:painting", + "id" : 357 + }, + { + "name" : "minecraft:panda_spawn_egg", + "id" : 489 + }, + { + "name" : "minecraft:paper", + "id" : 386 + }, + { + "name" : "minecraft:parrot_spawn_egg", + "id" : 478 + }, + { + "name" : "minecraft:phantom_membrane", + "id" : 574 + }, + { + "name" : "minecraft:phantom_spawn_egg", + "id" : 486 + }, + { + "name" : "minecraft:pig_spawn_egg", + "id" : 437 + }, + { + "name" : "minecraft:piglin_banner_pattern", + "id" : 587 + }, + { + "name" : "minecraft:piglin_brute_spawn_egg", + "id" : 499 + }, + { + "name" : "minecraft:piglin_spawn_egg", + "id" : 497 + }, + { + "name" : "minecraft:pillager_spawn_egg", + "id" : 491 + }, + { + "name" : "minecraft:pink_candle", + "id" : -419 + }, + { + "name" : "minecraft:pink_candle_cake", + "id" : -436 + }, + { + "name" : "minecraft:pink_dye", + "id" : 404 + }, + { + "name" : "minecraft:pink_glazed_terracotta", + "id" : 226 + }, + { + "name" : "minecraft:piston", + "id" : 33 + }, + { + "name" : "minecraft:pistonarmcollision", + "id" : 34 + }, + { + "name" : "minecraft:planks", + "id" : 5 + }, + { + "name" : "minecraft:podzol", + "id" : 243 + }, + { + "name" : "minecraft:pointed_dripstone", + "id" : -308 + }, + { + "name" : "minecraft:poisonous_potato", + "id" : 282 + }, + { + "name" : "minecraft:polar_bear_spawn_egg", + "id" : 472 + }, + { + "name" : "minecraft:polished_andesite_stairs", + "id" : -174 + }, + { + "name" : "minecraft:polished_basalt", + "id" : -235 + }, + { + "name" : "minecraft:polished_blackstone", + "id" : -291 + }, + { + "name" : "minecraft:polished_blackstone_brick_double_slab", + "id" : -285 + }, + { + "name" : "minecraft:polished_blackstone_brick_slab", + "id" : -284 + }, + { + "name" : "minecraft:polished_blackstone_brick_stairs", + "id" : -275 + }, + { + "name" : "minecraft:polished_blackstone_brick_wall", + "id" : -278 + }, + { + "name" : "minecraft:polished_blackstone_bricks", + "id" : -274 + }, + { + "name" : "minecraft:polished_blackstone_button", + "id" : -296 + }, + { + "name" : "minecraft:polished_blackstone_double_slab", + "id" : -294 + }, + { + "name" : "minecraft:polished_blackstone_pressure_plate", + "id" : -295 + }, + { + "name" : "minecraft:polished_blackstone_slab", + "id" : -293 + }, + { + "name" : "minecraft:polished_blackstone_stairs", + "id" : -292 + }, + { + "name" : "minecraft:polished_blackstone_wall", + "id" : -297 + }, + { + "name" : "minecraft:polished_deepslate", + "id" : -383 + }, + { + "name" : "minecraft:polished_deepslate_double_slab", + "id" : -397 + }, + { + "name" : "minecraft:polished_deepslate_slab", + "id" : -384 + }, + { + "name" : "minecraft:polished_deepslate_stairs", + "id" : -385 + }, + { + "name" : "minecraft:polished_deepslate_wall", + "id" : -386 + }, + { + "name" : "minecraft:polished_diorite_stairs", + "id" : -173 + }, + { + "name" : "minecraft:polished_granite_stairs", + "id" : -172 + }, + { + "name" : "minecraft:popped_chorus_fruit", + "id" : 559 + }, + { + "name" : "minecraft:porkchop", + "id" : 262 + }, + { + "name" : "minecraft:portal", + "id" : 90 + }, + { + "name" : "minecraft:potato", + "id" : 280 + }, + { + "name" : "minecraft:potatoes", + "id" : 142 + }, + { + "name" : "minecraft:potion", + "id" : 426 + }, + { + "name" : "minecraft:powder_snow", + "id" : -306 + }, + { + "name" : "minecraft:powder_snow_bucket", + "id" : 368 + }, + { + "name" : "minecraft:powered_comparator", + "id" : 150 + }, + { + "name" : "minecraft:powered_repeater", + "id" : 94 + }, + { + "name" : "minecraft:prismarine", + "id" : 168 + }, + { + "name" : "minecraft:prismarine_bricks_stairs", + "id" : -4 + }, + { + "name" : "minecraft:prismarine_crystals", + "id" : 549 + }, + { + "name" : "minecraft:prismarine_shard", + "id" : 565 + }, + { + "name" : "minecraft:prismarine_stairs", + "id" : -2 + }, + { + "name" : "minecraft:pufferfish", + "id" : 267 + }, + { + "name" : "minecraft:pufferfish_bucket", + "id" : 367 + }, + { + "name" : "minecraft:pufferfish_spawn_egg", + "id" : 481 + }, + { + "name" : "minecraft:pumpkin", + "id" : 86 + }, + { + "name" : "minecraft:pumpkin_pie", + "id" : 284 + }, + { + "name" : "minecraft:pumpkin_seeds", + "id" : 292 + }, + { + "name" : "minecraft:pumpkin_stem", + "id" : 104 + }, + { + "name" : "minecraft:purple_candle", + "id" : -423 + }, + { + "name" : "minecraft:purple_candle_cake", + "id" : -440 + }, + { + "name" : "minecraft:purple_dye", + "id" : 400 + }, + { + "name" : "minecraft:purple_glazed_terracotta", + "id" : 219 + }, + { + "name" : "minecraft:purpur_block", + "id" : 201 + }, + { + "name" : "minecraft:purpur_stairs", + "id" : 203 + }, + { + "name" : "minecraft:quartz", + "id" : 524 + }, + { + "name" : "minecraft:quartz_block", + "id" : 155 + }, + { + "name" : "minecraft:quartz_bricks", + "id" : -304 + }, + { + "name" : "minecraft:quartz_ore", + "id" : 153 + }, + { + "name" : "minecraft:quartz_stairs", + "id" : 156 + }, + { + "name" : "minecraft:rabbit", + "id" : 288 + }, + { + "name" : "minecraft:rabbit_foot", + "id" : 528 + }, + { + "name" : "minecraft:rabbit_hide", + "id" : 529 + }, + { + "name" : "minecraft:rabbit_spawn_egg", + "id" : 459 + }, + { + "name" : "minecraft:rabbit_stew", + "id" : 290 + }, + { + "name" : "minecraft:rail", + "id" : 66 + }, + { + "name" : "minecraft:rapid_fertilizer", + "id" : 596 + }, + { + "name" : "minecraft:ravager_spawn_egg", + "id" : 493 + }, + { + "name" : "minecraft:raw_copper", + "id" : 507 + }, + { + "name" : "minecraft:raw_copper_block", + "id" : -452 + }, + { + "name" : "minecraft:raw_gold", + "id" : 506 + }, + { + "name" : "minecraft:raw_gold_block", + "id" : -453 + }, + { + "name" : "minecraft:raw_iron", + "id" : 505 + }, + { + "name" : "minecraft:raw_iron_block", + "id" : -451 + }, + { + "name" : "minecraft:real_double_stone_slab", + "id" : 43 + }, + { + "name" : "minecraft:real_double_stone_slab2", + "id" : 181 + }, + { + "name" : "minecraft:real_double_stone_slab3", + "id" : -167 + }, + { + "name" : "minecraft:real_double_stone_slab4", + "id" : -168 + }, + { + "name" : "minecraft:red_candle", + "id" : -427 + }, + { + "name" : "minecraft:red_candle_cake", + "id" : -444 + }, + { + "name" : "minecraft:red_dye", + "id" : 396 + }, + { + "name" : "minecraft:red_flower", + "id" : 38 + }, + { + "name" : "minecraft:red_glazed_terracotta", + "id" : 234 + }, + { + "name" : "minecraft:red_mushroom", + "id" : 40 + }, + { + "name" : "minecraft:red_mushroom_block", + "id" : 100 + }, + { + "name" : "minecraft:red_nether_brick", + "id" : 215 + }, + { + "name" : "minecraft:red_nether_brick_stairs", + "id" : -184 + }, + { + "name" : "minecraft:red_sandstone", + "id" : 179 + }, + { + "name" : "minecraft:red_sandstone_stairs", + "id" : 180 + }, + { + "name" : "minecraft:redstone", + "id" : 373 + }, + { + "name" : "minecraft:redstone_block", + "id" : 152 + }, + { + "name" : "minecraft:redstone_lamp", + "id" : 123 + }, + { + "name" : "minecraft:redstone_ore", + "id" : 73 + }, + { + "name" : "minecraft:redstone_torch", + "id" : 76 + }, + { + "name" : "minecraft:redstone_wire", + "id" : 55 + }, + { + "name" : "minecraft:repeater", + "id" : 419 + }, + { + "name" : "minecraft:repeating_command_block", + "id" : 188 + }, + { + "name" : "minecraft:reserved6", + "id" : 255 + }, + { + "name" : "minecraft:respawn_anchor", + "id" : -272 + }, + { + "name" : "minecraft:rotten_flesh", + "id" : 277 + }, + { + "name" : "minecraft:saddle", + "id" : 371 + }, + { + "name" : "minecraft:salmon", + "id" : 265 + }, + { + "name" : "minecraft:salmon_bucket", + "id" : 365 + }, + { + "name" : "minecraft:salmon_spawn_egg", + "id" : 482 + }, + { + "name" : "minecraft:sand", + "id" : 12 + }, + { + "name" : "minecraft:sandstone", + "id" : 24 + }, + { + "name" : "minecraft:sandstone_stairs", + "id" : 128 + }, + { + "name" : "minecraft:sapling", + "id" : 6 + }, + { + "name" : "minecraft:scaffolding", + "id" : -165 + }, + { + "name" : "minecraft:sculk", + "id" : -458 + }, + { + "name" : "minecraft:sculk_catalyst", + "id" : -460 + }, + { + "name" : "minecraft:sculk_sensor", + "id" : -307 + }, + { + "name" : "minecraft:sculk_shrieker", + "id" : -461 + }, + { + "name" : "minecraft:sculk_vein", + "id" : -459 + }, + { + "name" : "minecraft:scute", + "id" : 572 + }, + { + "name" : "minecraft:sea_pickle", + "id" : -156 + }, + { + "name" : "minecraft:seagrass", + "id" : -130 + }, + { + "name" : "minecraft:sealantern", + "id" : 169 + }, + { + "name" : "minecraft:shears", + "id" : 421 + }, + { + "name" : "minecraft:sheep_spawn_egg", + "id" : 438 + }, + { + "name" : "minecraft:shield", + "id" : 355 + }, + { + "name" : "minecraft:shroomlight", + "id" : -230 + }, + { + "name" : "minecraft:shulker_box", + "id" : 218 + }, + { + "name" : "minecraft:shulker_shell", + "id" : 566 + }, + { + "name" : "minecraft:shulker_spawn_egg", + "id" : 469 + }, + { + "name" : "minecraft:silver_glazed_terracotta", + "id" : 228 + }, + { + "name" : "minecraft:silverfish_spawn_egg", + "id" : 443 + }, + { + "name" : "minecraft:skeleton_horse_spawn_egg", + "id" : 467 + }, + { + "name" : "minecraft:skeleton_spawn_egg", + "id" : 444 + }, + { + "name" : "minecraft:skull", + "id" : 516 + }, + { + "name" : "minecraft:skull_banner_pattern", + "id" : 583 + }, + { + "name" : "minecraft:slime", + "id" : 165 + }, + { + "name" : "minecraft:slime_ball", + "id" : 388 + }, + { + "name" : "minecraft:slime_spawn_egg", + "id" : 445 + }, + { + "name" : "minecraft:small_amethyst_bud", + "id" : -332 + }, + { + "name" : "minecraft:small_dripleaf_block", + "id" : -336 + }, + { + "name" : "minecraft:smithing_table", + "id" : -202 + }, + { + "name" : "minecraft:smoker", + "id" : -198 + }, + { + "name" : "minecraft:smooth_basalt", + "id" : -377 + }, + { + "name" : "minecraft:smooth_quartz_stairs", + "id" : -185 + }, + { + "name" : "minecraft:smooth_red_sandstone_stairs", + "id" : -176 + }, + { + "name" : "minecraft:smooth_sandstone_stairs", + "id" : -177 + }, + { + "name" : "minecraft:smooth_stone", + "id" : -183 + }, + { + "name" : "minecraft:snow", + "id" : 80 + }, + { + "name" : "minecraft:snow_layer", + "id" : 78 + }, + { + "name" : "minecraft:snowball", + "id" : 374 + }, + { + "name" : "minecraft:soul_campfire", + "id" : 621 + }, + { + "name" : "minecraft:soul_fire", + "id" : -237 + }, + { + "name" : "minecraft:soul_lantern", + "id" : -269 + }, + { + "name" : "minecraft:soul_sand", + "id" : 88 + }, + { + "name" : "minecraft:soul_soil", + "id" : -236 + }, + { + "name" : "minecraft:soul_torch", + "id" : -268 + }, + { + "name" : "minecraft:sparkler", + "id" : 599 + }, + { + "name" : "minecraft:spawn_egg", + "id" : 630 + }, + { + "name" : "minecraft:spider_eye", + "id" : 278 + }, + { + "name" : "minecraft:spider_spawn_egg", + "id" : 446 + }, + { + "name" : "minecraft:splash_potion", + "id" : 561 + }, + { + "name" : "minecraft:sponge", + "id" : 19 + }, + { + "name" : "minecraft:spore_blossom", + "id" : -321 + }, + { + "name" : "minecraft:spruce_boat", + "id" : 378 + }, + { + "name" : "minecraft:spruce_button", + "id" : -144 + }, + { + "name" : "minecraft:spruce_door", + "id" : 553 + }, + { + "name" : "minecraft:spruce_fence_gate", + "id" : 183 + }, + { + "name" : "minecraft:spruce_pressure_plate", + "id" : -154 + }, + { + "name" : "minecraft:spruce_sign", + "id" : 576 + }, + { + "name" : "minecraft:spruce_stairs", + "id" : 134 + }, + { + "name" : "minecraft:spruce_standing_sign", + "id" : -181 + }, + { + "name" : "minecraft:spruce_trapdoor", + "id" : -149 + }, + { + "name" : "minecraft:spruce_wall_sign", + "id" : -182 + }, + { + "name" : "minecraft:spyglass", + "id" : 625 + }, + { + "name" : "minecraft:squid_spawn_egg", + "id" : 450 + }, + { + "name" : "minecraft:stained_glass", + "id" : 241 + }, + { + "name" : "minecraft:stained_glass_pane", + "id" : 160 + }, + { + "name" : "minecraft:stained_hardened_clay", + "id" : 159 + }, + { + "name" : "minecraft:standing_banner", + "id" : 176 + }, + { + "name" : "minecraft:standing_sign", + "id" : 63 + }, + { + "name" : "minecraft:stick", + "id" : 320 + }, + { + "name" : "minecraft:sticky_piston", + "id" : 29 + }, + { + "name" : "minecraft:stickypistonarmcollision", + "id" : -217 + }, + { + "name" : "minecraft:stone", + "id" : 1 + }, + { + "name" : "minecraft:stone_axe", + "id" : 315 + }, + { + "name" : "minecraft:stone_brick_stairs", + "id" : 109 + }, + { + "name" : "minecraft:stone_button", + "id" : 77 + }, + { + "name" : "minecraft:stone_hoe", + "id" : 330 + }, + { + "name" : "minecraft:stone_pickaxe", + "id" : 314 + }, + { + "name" : "minecraft:stone_pressure_plate", + "id" : 70 + }, + { + "name" : "minecraft:stone_shovel", + "id" : 313 + }, + { + "name" : "minecraft:stone_stairs", + "id" : 67 + }, + { + "name" : "minecraft:stone_sword", + "id" : 312 + }, + { + "name" : "minecraft:stonebrick", + "id" : 98 + }, + { + "name" : "minecraft:stonecutter", + "id" : 245 + }, + { + "name" : "minecraft:stonecutter_block", + "id" : -197 + }, + { + "name" : "minecraft:stray_spawn_egg", + "id" : 462 + }, + { + "name" : "minecraft:strider_spawn_egg", + "id" : 495 + }, + { + "name" : "minecraft:string", + "id" : 326 + }, + { + "name" : "minecraft:stripped_acacia_log", + "id" : -8 + }, + { + "name" : "minecraft:stripped_birch_log", + "id" : -6 + }, + { + "name" : "minecraft:stripped_crimson_hyphae", + "id" : -300 + }, + { + "name" : "minecraft:stripped_crimson_stem", + "id" : -240 + }, + { + "name" : "minecraft:stripped_dark_oak_log", + "id" : -9 + }, + { + "name" : "minecraft:stripped_jungle_log", + "id" : -7 + }, + { + "name" : "minecraft:stripped_oak_log", + "id" : -10 + }, + { + "name" : "minecraft:stripped_spruce_log", + "id" : -5 + }, + { + "name" : "minecraft:stripped_warped_hyphae", + "id" : -301 + }, + { + "name" : "minecraft:stripped_warped_stem", + "id" : -241 + }, + { + "name" : "minecraft:structure_block", + "id" : 252 + }, + { + "name" : "minecraft:structure_void", + "id" : 217 + }, + { + "name" : "minecraft:sugar", + "id" : 416 + }, + { + "name" : "minecraft:sugar_cane", + "id" : 385 + }, + { + "name" : "minecraft:suspicious_stew", + "id" : 589 + }, + { + "name" : "minecraft:sweet_berries", + "id" : 287 + }, + { + "name" : "minecraft:sweet_berry_bush", + "id" : -207 + }, + { + "name" : "minecraft:tallgrass", + "id" : 31 + }, + { + "name" : "minecraft:target", + "id" : -239 + }, + { + "name" : "minecraft:tinted_glass", + "id" : -334 + }, + { + "name" : "minecraft:tnt", + "id" : 46 + }, + { + "name" : "minecraft:tnt_minecart", + "id" : 525 + }, + { + "name" : "minecraft:torch", + "id" : 50 + }, + { + "name" : "minecraft:totem_of_undying", + "id" : 568 + }, + { + "name" : "minecraft:trapdoor", + "id" : 96 + }, + { + "name" : "minecraft:trapped_chest", + "id" : 146 + }, + { + "name" : "minecraft:trident", + "id" : 546 + }, + { + "name" : "minecraft:tripwire", + "id" : 132 + }, + { + "name" : "minecraft:tripwire_hook", + "id" : 131 + }, + { + "name" : "minecraft:tropical_fish", + "id" : 266 + }, + { + "name" : "minecraft:tropical_fish_bucket", + "id" : 366 + }, + { + "name" : "minecraft:tropical_fish_spawn_egg", + "id" : 479 + }, + { + "name" : "minecraft:tuff", + "id" : -333 + }, + { + "name" : "minecraft:turtle_egg", + "id" : -159 + }, + { + "name" : "minecraft:turtle_helmet", + "id" : 573 + }, + { + "name" : "minecraft:turtle_spawn_egg", + "id" : 485 + }, + { + "name" : "minecraft:twisting_vines", + "id" : -287 + }, + { + "name" : "minecraft:underwater_torch", + "id" : 239 + }, + { + "name" : "minecraft:undyed_shulker_box", + "id" : 205 + }, + { + "name" : "minecraft:unknown", + "id" : -305 + }, + { + "name" : "minecraft:unlit_redstone_torch", + "id" : 75 + }, + { + "name" : "minecraft:unpowered_comparator", + "id" : 149 + }, + { + "name" : "minecraft:unpowered_repeater", + "id" : 93 + }, + { + "name" : "minecraft:vex_spawn_egg", + "id" : 476 + }, + { + "name" : "minecraft:villager_spawn_egg", + "id" : 449 + }, + { + "name" : "minecraft:vindicator_spawn_egg", + "id" : 474 + }, + { + "name" : "minecraft:vine", + "id" : 106 + }, + { + "name" : "minecraft:wall_banner", + "id" : 177 + }, + { + "name" : "minecraft:wall_sign", + "id" : 68 + }, + { + "name" : "minecraft:wandering_trader_spawn_egg", + "id" : 492 + }, + { + "name" : "minecraft:warped_button", + "id" : -261 + }, + { + "name" : "minecraft:warped_door", + "id" : 616 + }, + { + "name" : "minecraft:warped_double_slab", + "id" : -267 + }, + { + "name" : "minecraft:warped_fence", + "id" : -257 + }, + { + "name" : "minecraft:warped_fence_gate", + "id" : -259 + }, + { + "name" : "minecraft:warped_fungus", + "id" : -229 + }, + { + "name" : "minecraft:warped_fungus_on_a_stick", + "id" : 617 + }, + { + "name" : "minecraft:warped_hyphae", + "id" : -298 + }, + { + "name" : "minecraft:warped_nylium", + "id" : -233 + }, + { + "name" : "minecraft:warped_planks", + "id" : -243 + }, + { + "name" : "minecraft:warped_pressure_plate", + "id" : -263 + }, + { + "name" : "minecraft:warped_roots", + "id" : -224 + }, + { + "name" : "minecraft:warped_sign", + "id" : 614 + }, + { + "name" : "minecraft:warped_slab", + "id" : -265 + }, + { + "name" : "minecraft:warped_stairs", + "id" : -255 + }, + { + "name" : "minecraft:warped_standing_sign", + "id" : -251 + }, + { + "name" : "minecraft:warped_stem", + "id" : -226 + }, + { + "name" : "minecraft:warped_trapdoor", + "id" : -247 + }, + { + "name" : "minecraft:warped_wall_sign", + "id" : -253 + }, + { + "name" : "minecraft:warped_wart_block", + "id" : -227 + }, + { + "name" : "minecraft:water", + "id" : 9 + }, + { + "name" : "minecraft:water_bucket", + "id" : 362 + }, + { + "name" : "minecraft:waterlily", + "id" : 111 + }, + { + "name" : "minecraft:waxed_copper", + "id" : -344 + }, + { + "name" : "minecraft:waxed_cut_copper", + "id" : -351 + }, + { + "name" : "minecraft:waxed_cut_copper_slab", + "id" : -365 + }, + { + "name" : "minecraft:waxed_cut_copper_stairs", + "id" : -358 + }, + { + "name" : "minecraft:waxed_double_cut_copper_slab", + "id" : -372 + }, + { + "name" : "minecraft:waxed_exposed_copper", + "id" : -345 + }, + { + "name" : "minecraft:waxed_exposed_cut_copper", + "id" : -352 + }, + { + "name" : "minecraft:waxed_exposed_cut_copper_slab", + "id" : -366 + }, + { + "name" : "minecraft:waxed_exposed_cut_copper_stairs", + "id" : -359 + }, + { + "name" : "minecraft:waxed_exposed_double_cut_copper_slab", + "id" : -373 + }, + { + "name" : "minecraft:waxed_oxidized_copper", + "id" : -446 + }, + { + "name" : "minecraft:waxed_oxidized_cut_copper", + "id" : -447 + }, + { + "name" : "minecraft:waxed_oxidized_cut_copper_slab", + "id" : -449 + }, + { + "name" : "minecraft:waxed_oxidized_cut_copper_stairs", + "id" : -448 + }, + { + "name" : "minecraft:waxed_oxidized_double_cut_copper_slab", + "id" : -450 + }, + { + "name" : "minecraft:waxed_weathered_copper", + "id" : -346 + }, + { + "name" : "minecraft:waxed_weathered_cut_copper", + "id" : -353 + }, + { + "name" : "minecraft:waxed_weathered_cut_copper_slab", + "id" : -367 + }, + { + "name" : "minecraft:waxed_weathered_cut_copper_stairs", + "id" : -360 + }, + { + "name" : "minecraft:waxed_weathered_double_cut_copper_slab", + "id" : -374 + }, + { + "name" : "minecraft:weathered_copper", + "id" : -342 + }, + { + "name" : "minecraft:weathered_cut_copper", + "id" : -349 + }, + { + "name" : "minecraft:weathered_cut_copper_slab", + "id" : -363 + }, + { + "name" : "minecraft:weathered_cut_copper_stairs", + "id" : -356 + }, + { + "name" : "minecraft:weathered_double_cut_copper_slab", + "id" : -370 + }, + { + "name" : "minecraft:web", + "id" : 30 + }, + { + "name" : "minecraft:weeping_vines", + "id" : -231 + }, + { + "name" : "minecraft:wheat", + "id" : 334 + }, + { + "name" : "minecraft:wheat_seeds", + "id" : 291 + }, + { + "name" : "minecraft:white_candle", + "id" : -413 + }, + { + "name" : "minecraft:white_candle_cake", + "id" : -430 + }, + { + "name" : "minecraft:white_dye", + "id" : 410 + }, + { + "name" : "minecraft:white_glazed_terracotta", + "id" : 220 + }, + { + "name" : "minecraft:witch_spawn_egg", + "id" : 452 + }, + { + "name" : "minecraft:wither_rose", + "id" : -216 + }, + { + "name" : "minecraft:wither_skeleton_spawn_egg", + "id" : 464 + }, + { + "name" : "minecraft:wolf_spawn_egg", + "id" : 439 + }, + { + "name" : "minecraft:wood", + "id" : -212 + }, + { + "name" : "minecraft:wooden_axe", + "id" : 311 + }, + { + "name" : "minecraft:wooden_button", + "id" : 143 + }, + { + "name" : "minecraft:wooden_door", + "id" : 359 + }, + { + "name" : "minecraft:wooden_hoe", + "id" : 329 + }, + { + "name" : "minecraft:wooden_pickaxe", + "id" : 310 + }, + { + "name" : "minecraft:wooden_pressure_plate", + "id" : 72 + }, + { + "name" : "minecraft:wooden_shovel", + "id" : 309 + }, + { + "name" : "minecraft:wooden_slab", + "id" : 158 + }, + { + "name" : "minecraft:wooden_sword", + "id" : 308 + }, + { + "name" : "minecraft:wool", + "id" : 35 + }, + { + "name" : "minecraft:writable_book", + "id" : 510 + }, + { + "name" : "minecraft:written_book", + "id" : 511 + }, + { + "name" : "minecraft:yellow_candle", + "id" : -417 + }, + { + "name" : "minecraft:yellow_candle_cake", + "id" : -434 + }, + { + "name" : "minecraft:yellow_dye", + "id" : 406 + }, + { + "name" : "minecraft:yellow_flower", + "id" : 37 + }, + { + "name" : "minecraft:yellow_glazed_terracotta", + "id" : 224 + }, + { + "name" : "minecraft:zoglin_spawn_egg", + "id" : 498 + }, + { + "name" : "minecraft:zombie_horse_spawn_egg", + "id" : 468 + }, + { + "name" : "minecraft:zombie_pigman_spawn_egg", + "id" : 448 + }, + { + "name" : "minecraft:zombie_spawn_egg", + "id" : 447 + }, + { + "name" : "minecraft:zombie_villager_spawn_egg", + "id" : 477 + } +] \ No newline at end of file From daea2618c5a1c7835ec8bc91cb11516c9495a1ac Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 23 Nov 2021 10:55:20 -0500 Subject: [PATCH 706/766] Update for MCProtocolLib changes --- .../geyser/entity/type/LivingEntity.java | 23 +++++++++++-------- .../type/player/SessionPlayerEntity.java | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index 678741424..2aff7f9e1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -26,6 +26,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute; +import com.github.steveice10.mc.protocol.data.game.entity.attribute.AttributeType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; @@ -251,17 +252,19 @@ public class LivingEntity extends Entity { * Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute */ protected void updateAttribute(Attribute javaAttribute, List newAttributes) { - switch (javaAttribute.getType()) { - case GENERIC_MAX_HEALTH -> { - this.maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); - newAttributes.add(createHealthAttribute()); + if (javaAttribute.getType() instanceof AttributeType.Builtin type) { + switch (type) { + case GENERIC_MAX_HEALTH -> { + this.maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); + newAttributes.add(createHealthAttribute()); + } + case GENERIC_ATTACK_DAMAGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.ATTACK_DAMAGE)); + case GENERIC_FLYING_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FLYING_SPEED)); + case GENERIC_MOVEMENT_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.MOVEMENT_SPEED)); + case GENERIC_FOLLOW_RANGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FOLLOW_RANGE)); + case GENERIC_KNOCKBACK_RESISTANCE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.KNOCKBACK_RESISTANCE)); + case HORSE_JUMP_STRENGTH -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.HORSE_JUMP_STRENGTH)); } - case GENERIC_ATTACK_DAMAGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.ATTACK_DAMAGE)); - case GENERIC_FLYING_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FLYING_SPEED)); - case GENERIC_MOVEMENT_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.MOVEMENT_SPEED)); - case GENERIC_FOLLOW_RANGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FOLLOW_RANGE)); - case GENERIC_KNOCKBACK_RESISTANCE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.KNOCKBACK_RESISTANCE)); - case HORSE_JUMP_STRENGTH -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.HORSE_JUMP_STRENGTH)); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index c297bdb18..dff9fbfa2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -177,7 +177,7 @@ public class SessionPlayerEntity extends PlayerEntity { @Override protected void updateAttribute(Attribute javaAttribute, List newAttributes) { - if (javaAttribute.getType() == AttributeType.GENERIC_ATTACK_SPEED) { + if (javaAttribute.getType() == AttributeType.Builtin.GENERIC_ATTACK_SPEED) { session.setAttackSpeed(AttributeUtils.calculateValue(javaAttribute)); } else { super.updateAttribute(javaAttribute, newAttributes); @@ -188,7 +188,7 @@ public class SessionPlayerEntity extends PlayerEntity { protected AttributeData calculateAttribute(Attribute javaAttribute, GeyserAttributeType type) { AttributeData attributeData = super.calculateAttribute(javaAttribute, type); - if (javaAttribute.getType() == AttributeType.GENERIC_MOVEMENT_SPEED) { + if (javaAttribute.getType() == AttributeType.Builtin.GENERIC_MOVEMENT_SPEED) { session.setOriginalSpeedAttribute(attributeData.getValue()); AttributeData speedAttribute = session.adjustSpeed(); if (speedAttribute != null) { From e7ecda64f00d4b9d6a7ffc6201b142a84cc265be Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 23 Nov 2021 11:21:54 -0500 Subject: [PATCH 707/766] Use new 1.18 chunk encoding features --- .../JavaLevelChunkWithLightTranslator.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java index 4a749c6d3..127cae9ab 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java @@ -43,6 +43,7 @@ import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; import com.nukkitx.network.VarInts; import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket; +import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufOutputStream; @@ -325,9 +326,19 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator= Bedrock_v475.V475_CODEC.getProtocolVersion()) { + int remainingEmptyBiomes = 25 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + // A header that says to carry on the biome data from the previous chunk + // This notably fixes biomes in the End + byteBuf.writeByte((127 << 1) | 1); + } + } else { + int remainingEmptyBiomes = 32 - sectionCount; + for (int i = 0; i < remainingEmptyBiomes; i++) { + byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); + } } byteBuf.writeByte(0); // Border blocks - Edu edition only From c200e3e6fa78bdd577ea4830cbaf51a07d0e24d7 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 23 Nov 2021 14:22:44 -0500 Subject: [PATCH 708/766] Update mappings; remove unnecessary item workarounds --- .../geyser/registry/populator/ItemRegistryPopulator.java | 7 ++----- core/src/main/resources/mappings | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index e672a75aa..b0df6d051 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -225,10 +225,7 @@ public class ItemRegistryPopulator { // This items has a mapping specifically for this version of the game mappingItem = entry.getValue(); } - if (javaIdentifier.equals("minecraft:sculk_sensor")) { - // TODO fix in mappings - mappingItem.setBedrockIdentifier("minecraft:sculk_sensor"); - } else if (javaIdentifier.equals("minecraft:music_disc_otherside") && palette.getValue().protocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { + if (javaIdentifier.equals("minecraft:music_disc_otherside") && palette.getValue().protocolVersion() <= Bedrock_v471.V471_CODEC.getProtocolVersion()) { mappingItem.setBedrockIdentifier("minecraft:music_disc_pigstep"); } @@ -402,7 +399,7 @@ public class ItemRegistryPopulator { .count(1) .blockRuntimeId(mapping.getBedrockBlockId()) .build()); - } else if (javaIdentifier.startsWith("minecraft:music_disc_") && !javaIdentifier.equals("minecraft:music_disc_otherside")) { // TODO TEMPORARY + } else if (javaIdentifier.startsWith("minecraft:music_disc_")) { // The Java record level event uses the item ID as the "key" to play the record Registries.RECORDS.register(itemIndex, SoundEvent.valueOf("RECORD_" + javaIdentifier.replace("minecraft:music_disc_", "").toUpperCase(Locale.ENGLISH))); diff --git a/core/src/main/resources/mappings b/core/src/main/resources/mappings index 7ff1b6567..82ad7ba27 160000 --- a/core/src/main/resources/mappings +++ b/core/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 7ff1b6567b56c7b0b8e28786b9bbc30abfaededf +Subproject commit 82ad7ba279c68eb11a0b1a969c9efb3228c59227 From b2d12123597cbad0500ad2e2852555052f8ab02b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 10:14:27 -0500 Subject: [PATCH 709/766] Bump Geyser to version 2.0.0-SNAPSHOT --- ap/pom.xml | 4 ++-- api/base/pom.xml | 4 ++-- api/geyser/pom.xml | 6 +++--- api/pom.xml | 10 +++++----- bootstrap/bungeecord/pom.xml | 4 ++-- bootstrap/pom.xml | 4 ++-- bootstrap/spigot/pom.xml | 4 ++-- bootstrap/sponge/pom.xml | 4 ++-- bootstrap/standalone/pom.xml | 4 ++-- bootstrap/velocity/pom.xml | 4 ++-- common/pom.xml | 2 +- core/pom.xml | 12 ++++++------ pom.xml | 2 +- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/ap/pom.xml b/ap/pom.xml index 912c6731b..cc282dd55 100644 --- a/ap/pom.xml +++ b/ap/pom.xml @@ -6,9 +6,9 @@ org.geysermc geyser-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT ap - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT \ No newline at end of file diff --git a/api/base/pom.xml b/api/base/pom.xml index a3a67b7ec..0d7ed05da 100644 --- a/api/base/pom.xml +++ b/api/base/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - geyser-parent org.geysermc - 1.4.3-SNAPSHOT + api-parent + 2.0.0-SNAPSHOT 4.0.0 diff --git a/api/geyser/pom.xml b/api/geyser/pom.xml index df88b076f..89349e8ac 100644 --- a/api/geyser/pom.xml +++ b/api/geyser/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - geyser-parent org.geysermc - 1.4.3-SNAPSHOT + api-parent + 2.0.0-SNAPSHOT 4.0.0 @@ -26,7 +26,7 @@ org.geysermc base-api - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile diff --git a/api/pom.xml b/api/pom.xml index fcf12088b..b3d0262ea 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -2,12 +2,12 @@ - - geyser-parent - org.geysermc - 1.4.3-SNAPSHOT - 4.0.0 + + org.geysermc + geyser-parent + 2.0.0-SNAPSHOT + api-parent pom diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml index 0be4c54d5..9dcd0943e 100644 --- a/bootstrap/bungeecord/pom.xml +++ b/bootstrap/bungeecord/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT bootstrap-bungeecord @@ -14,7 +14,7 @@ org.geysermc core - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml index 38489fa25..3b0bdda55 100644 --- a/bootstrap/pom.xml +++ b/bootstrap/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT bootstrap-parent pom @@ -34,7 +34,7 @@ org.geysermc ap - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT provided diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index 045c44c71..f5b14e35a 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT bootstrap-spigot @@ -21,7 +21,7 @@ org.geysermc core - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml index 959f75248..fa7989b43 100644 --- a/bootstrap/sponge/pom.xml +++ b/bootstrap/sponge/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT bootstrap-sponge @@ -14,7 +14,7 @@ org.geysermc core - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index ac02d503b..df3fd5218 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT bootstrap-standalone @@ -14,7 +14,7 @@ org.geysermc core - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml index 0805d7eef..e1e3331ef 100644 --- a/bootstrap/velocity/pom.xml +++ b/bootstrap/velocity/pom.xml @@ -6,7 +6,7 @@ org.geysermc bootstrap-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT bootstrap-velocity @@ -14,7 +14,7 @@ org.geysermc core - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile diff --git a/common/pom.xml b/common/pom.xml index a76ded3cf..8e7be26f4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT common diff --git a/core/pom.xml b/core/pom.xml index fc4d84e3c..744109536 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -6,7 +6,7 @@ org.geysermc geyser-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT core @@ -21,19 +21,19 @@ org.geysermc ap - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT provided org.geysermc geyser-api - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile org.geysermc common - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT compile @@ -314,7 +314,7 @@ - ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserConnector.java + ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -338,7 +338,7 @@ - ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserConnector.java + ${project.basedir}/src/main/java/org/geysermc/geyser/GeyserImpl.java diff --git a/pom.xml b/pom.xml index 334fa8031..004d58666 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.geysermc geyser-parent - 1.4.3-SNAPSHOT + 2.0.0-SNAPSHOT pom Geyser Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers. From 822b1e698e2957621e078860231a6a17f35d83c9 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 10:26:40 -0500 Subject: [PATCH 710/766] Switch to a static MCProtocolLib commit --- core/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 744109536..679296b92 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -153,9 +153,9 @@ compile - com.github.steveice10 - mcprotocollib - 1.18-pre-SNAPSHOT + com.github.GeyserMC + MCProtocolLib + b71a7e2fa compile From 42aca7f00c9f51d600e5b1b93c0dd7efad99d75c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 10:48:55 -0500 Subject: [PATCH 711/766] Update to 1.18-pre8 --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 679296b92..5ec7b3c65 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - b71a7e2fa + 7eb2748a compile From 64799b11b41392713763ae4af5788967d3d35ce1 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 11:27:44 -0500 Subject: [PATCH 712/766] Update to latest PacketLib change --- .../java/org/geysermc/geyser/network/netty/LocalSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java index 7e2b18a51..5129a07b3 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java @@ -79,7 +79,7 @@ public final class LocalSession extends TcpSession { ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("encryption", new TcpPacketEncryptor(LocalSession.this)); pipeline.addLast("sizer", new TcpPacketSizer(LocalSession.this)); - pipeline.addLast("codec", new TcpPacketCodec(LocalSession.this)); + pipeline.addLast("codec", new TcpPacketCodec(LocalSession.this, true)); pipeline.addLast("manager", LocalSession.this); addHAProxySupport(pipeline); From e44b089e19f78c899c60e9fc4de0d6d79552f57e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 12:31:41 -0500 Subject: [PATCH 713/766] Update MCProtocolLib --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 5ec7b3c65..5867a34f4 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 7eb2748a + 1125e220 compile From d8254cb0b2736614d28978650fdb2eb64877f19a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 19:42:55 -0500 Subject: [PATCH 714/766] Update for PacketLib changes --- core/pom.xml | 2 +- .../org/geysermc/geyser/network/netty/LocalSession.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 5867a34f4..0d1c4897f 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 1125e220 + a581308c compile diff --git a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java index 5129a07b3..7fa28ebf2 100644 --- a/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java +++ b/core/src/main/java/org/geysermc/geyser/network/netty/LocalSession.java @@ -71,14 +71,14 @@ public final class LocalSession extends TcpSession { @Override public void initChannel(LocalChannelWithRemoteAddress channel) { channel.spoofedRemoteAddress(new InetSocketAddress(clientIp, 0)); - getPacketProtocol().newClientSession(LocalSession.this); + PacketProtocol protocol = getPacketProtocol(); + protocol.newClientSession(LocalSession.this); refreshReadTimeoutHandler(channel); refreshWriteTimeoutHandler(channel); ChannelPipeline pipeline = channel.pipeline(); - pipeline.addLast("encryption", new TcpPacketEncryptor(LocalSession.this)); - pipeline.addLast("sizer", new TcpPacketSizer(LocalSession.this)); + pipeline.addLast("sizer", new TcpPacketSizer(LocalSession.this, protocol.getPacketHeader().getLengthSize())); pipeline.addLast("codec", new TcpPacketCodec(LocalSession.this, true)); pipeline.addLast("manager", LocalSession.this); From cef803af36e68b7835d1e026d385c8e7b349a3a6 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Wed, 24 Nov 2021 23:38:21 -0500 Subject: [PATCH 715/766] Update for PacketLib changes --- core/pom.xml | 2 +- .../main/java/org/geysermc/geyser/session/GeyserSession.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 0d1c4897f..20604f37d 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - a581308c + 8eca1498 compile diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 24296874a..7f6e1f302 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -47,6 +47,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerAbilitiesPacket; import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; import com.github.steveice10.packetlib.BuiltinFlags; +import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.event.session.*; import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpClientSession; @@ -909,8 +910,7 @@ public class GeyserSession implements GeyserConnection, CommandSender { } @Override - public void packetReceived(PacketReceivedEvent event) { - Packet packet = event.getPacket(); + public void packetReceived(Session session, Packet packet) { Registries.JAVA_PACKET_TRANSLATORS.translate(packet.getClass(), packet, GeyserSession.this); } From 8f1acf17f9c1dba9b35b38899ce1e1324403425b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Thu, 25 Nov 2021 11:55:59 -0500 Subject: [PATCH 716/766] Update MCProtocolLib --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 20604f37d..37b6c7208 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 8eca1498 + 825804d1 compile From ec3451041705851ee5b852adbde07caab4b9fcd7 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Thu, 25 Nov 2021 11:59:25 -0500 Subject: [PATCH 717/766] Don't tie biome translation to Bedrock chunk section size This allows biomes to be translated even if the block count is empty. Fixes some biome glitching. --- .../java/level/JavaLevelChunkWithLightTranslator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java index 127cae9ab..96dcfed2c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java @@ -315,7 +315,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator> 4; - for (int i = 0; i < sectionCount; i++) { + for (int i = 0; i < chunkSize; i++) { int biomeYOffset = dimensionOffset + i; if (biomeYOffset < yOffset) { // Ignore this biome section since it goes above or below the height of the Java world @@ -328,14 +328,14 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator= Bedrock_v475.V475_CODEC.getProtocolVersion()) { - int remainingEmptyBiomes = 25 - sectionCount; + int remainingEmptyBiomes = 25 - chunkSize; for (int i = 0; i < remainingEmptyBiomes; i++) { // A header that says to carry on the biome data from the previous chunk // This notably fixes biomes in the End byteBuf.writeByte((127 << 1) | 1); } } else { - int remainingEmptyBiomes = 32 - sectionCount; + int remainingEmptyBiomes = 32 - chunkSize; for (int i = 0; i < remainingEmptyBiomes; i++) { byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); } From 720045a03ff621913aad0a1c4ba832a58c8c3f40 Mon Sep 17 00:00:00 2001 From: YHDiamond <47502993+YHDiamond@users.noreply.github.com> Date: Fri, 26 Nov 2021 10:49:28 -0500 Subject: [PATCH 718/766] Add Advanced Tooltips command (#2632) Co-authored-by: YHDiamond <47502993+yehudahrrs@users.noreply.github.com> --- .../spigot/src/main/resources/plugin.yml | 5 +- .../connector/command/CommandManager.java | 1 + .../defaults/AdvancedTooltipsCommand.java | 57 +++++++++++++++++++ .../network/session/GeyserSession.java | 6 ++ .../translators/item/ItemTranslator.java | 38 +++++++++++++ connector/src/main/resources/languages | 2 +- 6 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 connector/src/main/java/org/geysermc/connector/command/defaults/AdvancedTooltipsCommand.java diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index 7edd14520..adeda4420 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -19,6 +19,9 @@ permissions: geyser.command.advancements: description: Shows the advancements of the player on the server. default: true + geyser.command.tooltips: + description: Toggles showing advanced tooltips on your items. + default: true geyser.command.statistics: description: Shows the statistics of the player on the server. default: true @@ -36,4 +39,4 @@ permissions: default: false geyser.command.version: description: Shows the current Geyser version and checks for updates. - default: op \ No newline at end of file + default: op diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java index 53cdfb269..2da15c019 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java @@ -54,6 +54,7 @@ public abstract class CommandManager { registerCommand(new SettingsCommand(connector, "settings", "geyser.commands.settings.desc", "geyser.command.settings")); registerCommand(new StatisticsCommand(connector, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics")); registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements")); + registerCommand(new AdvancedTooltipsCommand("tooltips", "geyser.commands.advancedtooltips.desc", "geyser.command.tooltips")); if (GeyserConnector.getInstance().getPlatformType() == PlatformType.STANDALONE) { registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); } diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/AdvancedTooltipsCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/AdvancedTooltipsCommand.java new file mode 100644 index 000000000..3c50a3b65 --- /dev/null +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/AdvancedTooltipsCommand.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2019-2021 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.connector.command.defaults; + +import org.geysermc.connector.command.CommandSender; +import org.geysermc.connector.command.GeyserCommand; +import org.geysermc.connector.network.session.GeyserSession; +import org.geysermc.connector.utils.LocaleUtils; + +public class AdvancedTooltipsCommand extends GeyserCommand { + public AdvancedTooltipsCommand(String name, String description, String permission) { + super(name, description, permission); + } + + @Override + public void execute(GeyserSession session, CommandSender sender, String[] args) { + if (session != null) { + String onOrOff = session.isAdvancedTooltips() ? "off" : "on"; + session.setAdvancedTooltips(!session.isAdvancedTooltips()); + session.sendMessage("§l§e" + LocaleUtils.getLocaleString("debug.prefix", session.getLocale()) + " §r" + LocaleUtils.getLocaleString("debug.advanced_tooltips." + onOrOff, session.getLocale())); + session.getInventoryTranslator().updateInventory(session, session.getPlayerInventory()); + } + } + + @Override + public boolean isExecutableOnConsole() { + return false; + } + + @Override + public boolean isBedrockOnly() { + return true; + } +} diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 3937fa648..25ce005c8 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -450,6 +450,12 @@ public class GeyserSession implements CommandSender { private MinecraftProtocol protocol; + /** + * Whether advanced tooltips will be added to the player's items. + */ + @Setter + private boolean advancedTooltips = false; + public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession, EventLoop eventLoop) { this.connector = connector; this.upstream = new UpstreamSession(bedrockServerSession); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index 9fcf984cd..9d086151c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -155,6 +155,9 @@ public abstract class ItemTranslator { } nbt = translateDisplayProperties(session, nbt, bedrockItem); + if (session.isAdvancedTooltips()) { + nbt = addAdvancedTooltips(nbt, session.getItemMappings().getMapping(stack), session.getLocale()); + } ItemStack itemStack = new ItemStack(stack.getId(), stack.getAmount(), nbt); @@ -184,6 +187,41 @@ public abstract class ItemTranslator { return builder.build(); } + private static CompoundTag addAdvancedTooltips(CompoundTag nbt, ItemMapping mapping, String language) { + CompoundTag newNbt = nbt; + if (newNbt == null) { + newNbt = new CompoundTag("nbt"); + CompoundTag display = new CompoundTag("display"); + display.put(new ListTag("Lore")); + newNbt.put(display); + } + CompoundTag compoundTag = newNbt.get("display"); + if (compoundTag == null) { + compoundTag = new CompoundTag("display"); + } + ListTag listTag = compoundTag.get("Lore"); + + if (listTag == null) { + listTag = new ListTag("Lore"); + } + int maxDurability = mapping.getMaxDamage(); + + if (maxDurability != 0) { + int durability = maxDurability - ((IntTag) newNbt.get("Damage")).getValue(); + if (durability != maxDurability) { + listTag.add(new StringTag("", "§r§f" + String.format(MessageTranslator.convertMessage("item.durability", language), durability, maxDurability))); + } + } + + listTag.add(new StringTag("", "§r§8" + mapping.getJavaIdentifier())); + if (nbt != null) { + listTag.add(new StringTag("", "§r§8" + String.format(MessageTranslator.convertMessage("item.nbt_tags", language), nbt.size()))); + } + compoundTag.put(listTag); + newNbt.put(compoundTag); + return newNbt; + } + /** * Translates the Java NBT of canDestroy and canPlaceOn to its Bedrock counterparts. * In Java, this is treated as normal NBT, but in Bedrock, these arguments are extra parts of the item data itself. diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index d12420771..1a50238c1 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit d12420771ea5e13083b3556552298d164767aae9 +Subproject commit 1a50238c1c743579a1dbd93c57d02b5da3be14fa From 44083b80affbcd66c331ab89616ed6e548ef63e0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Fri, 26 Nov 2021 21:01:37 -0500 Subject: [PATCH 719/766] Update to 1.18-rc3 --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 37b6c7208..39ea986b2 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 825804d1 + 7f7808e2 compile From 0d7bf7b71a62abed27af6dc214ecdcf5d7d9d1f3 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Fri, 26 Nov 2021 21:05:14 -0500 Subject: [PATCH 720/766] Fix NPEs when loading in chunks with double chests --- .../level/block/entity/BlockEntityTranslator.java | 11 ----------- .../entity/DoubleChestBlockEntityTranslator.java | 9 ++++----- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java index 03e2bb3de..602ac140c 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/BlockEntityTranslator.java @@ -27,8 +27,6 @@ package org.geysermc.geyser.translator.level.block.entity; import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.IntTag; -import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMapBuilder; @@ -49,15 +47,6 @@ public abstract class BlockEntityTranslator { return tagBuilder.build(); } - protected CompoundTag getConstantJavaTag(String javaId, int x, int y, int z) { - CompoundTag tag = new CompoundTag(""); - tag.put(new IntTag("x", x)); - tag.put(new IntTag("y", y)); - tag.put(new IntTag("z", z)); - tag.put(new StringTag("id", javaId)); - return tag; - } - protected NbtMapBuilder getConstantBedrockTag(String bedrockId, int x, int y, int z) { return NbtMap.builder() .putInt("x", x) diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java index e41f9e492..b6a10dd8f 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/DoubleChestBlockEntityTranslator.java @@ -46,18 +46,17 @@ public class DoubleChestBlockEntityTranslator extends BlockEntityTranslator impl @Override public void updateBlock(GeyserSession session, int blockState, Vector3i position) { - CompoundTag javaTag = getConstantJavaTag("chest", position.getX(), position.getY(), position.getZ()); NbtMapBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(BlockEntityType.CHEST), position.getX(), position.getY(), position.getZ()); - translateTag(tagBuilder, javaTag, blockState); + translateTag(tagBuilder, null, blockState); BlockEntityUtils.updateBlockEntity(session, tagBuilder.build(), position); } @Override public void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState) { - DoubleChestValue chestValues = BlockStateValues.getDoubleChestValues().getOrDefault(blockState, null); + DoubleChestValue chestValues = BlockStateValues.getDoubleChestValues().get(blockState); if (chestValues != null) { - int x = (int) tag.getValue().get("x").getValue(); - int z = (int) tag.getValue().get("z").getValue(); + int x = (int) builder.get("x"); + int z = (int) builder.get("z"); translateChestValue(builder, chestValues, x, z); } } From a305c22665b830f60bfc054819796788f4474e84 Mon Sep 17 00:00:00 2001 From: David Choo Date: Fri, 26 Nov 2021 23:03:46 -0500 Subject: [PATCH 721/766] 1.18 entity name and metadata changes (#2651) * Fix amount & javaId being used before it is initialized Fixes invisible falling blocks and incorrectly sized exp orbs * Add missing item metadata to throwable items and fireballs Renamed ItemedFireballEntity -> FireballEntity * Renamed more EntityDefinitions to match MCProtocolLib * Add some missing metadata and add null check * Use entity type when possible in debug spawn message Fallback onto classes simple name Also don't register ENDER_DRAGON_PART * Remove redundant entity identifiers and fix END_CRYSTAL and FISHING_BOBBER identifiers minecraft:end_crystal -> minecraft:ender_crystal minecraft:fishing_book -> minecraft:fishing_hook * Cave spider should inherit metadata from spider * Keep entity definitions in roughly alphabetical order * Alphabetize entity definitions * ABCs? * Bump MCProtocolLib version --- core/pom.xml | 2 +- .../geyser/entity/EntityDefinitions.java | 151 +++++++++--------- .../geyser/entity/InteractiveTagManager.java | 6 +- .../geysermc/geyser/entity/type/Entity.java | 9 +- .../geyser/entity/type/ExpOrbEntity.java | 8 - .../entity/type/FallingBlockEntity.java | 6 - ...ireballEntity.java => FireballEntity.java} | 4 +- .../geyser/entity/type/ThrowableEntity.java | 18 +-- .../entity/type/ThrowableItemEntity.java | 5 + .../entity/type/ThrownPotionEntity.java | 37 +++-- .../geyser/entity/type/WitherSkullEntity.java | 2 +- .../BedrockEntityPickRequestTranslator.java | 4 +- .../entity/JavaEntityEventTranslator.java | 2 +- .../org/geysermc/geyser/util/EntityUtils.java | 8 +- 14 files changed, 135 insertions(+), 127 deletions(-) rename core/src/main/java/org/geysermc/geyser/entity/type/{ItemedFireballEntity.java => FireballEntity.java} (91%) diff --git a/core/pom.xml b/core/pom.xml index 39ea986b2..09d4dc978 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 7f7808e2 + f7f84e7 compile diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index c8f413e63..e1f2169ef 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -63,36 +63,43 @@ public final class EntityDefinitions { public static final EntityDefinition BLAZE; public static final EntityDefinition BOAT; public static final EntityDefinition CAT; - public static final EntityDefinition CAVE_SPIDER; + public static final EntityDefinition CAVE_SPIDER; + public static final EntityDefinition CHEST_MINECART; public static final EntityDefinition CHICKEN; - public static final EntityDefinition CREEPER; public static final EntityDefinition COD; + public static final EntityDefinition COMMAND_BLOCK_MINECART; public static final EntityDefinition COW; - public static final EntityDefinition DONKEY; + public static final EntityDefinition CREEPER; public static final EntityDefinition DOLPHIN; - public static final EntityDefinition DRAGON_FIREBALL; + public static final EntityDefinition DONKEY; + public static final EntityDefinition DRAGON_FIREBALL; public static final EntityDefinition DROWNED; + public static final EntityDefinition EGG; public static final EntityDefinition ELDER_GUARDIAN; public static final EntityDefinition ENDERMAN; public static final EntityDefinition ENDERMITE; public static final EntityDefinition ENDER_DRAGON; + public static final EntityDefinition ENDER_PEARL; public static final EntityDefinition END_CRYSTAL; public static final EntityDefinition EVOKER; public static final EntityDefinition EVOKER_FANGS; + public static final EntityDefinition EXPERIENCE_BOTTLE; public static final EntityDefinition EXPERIENCE_ORB; public static final EntityDefinition EYE_OF_ENDER; public static final EntityDefinition FALLING_BLOCK; - public static final EntityDefinition FIREBALL; - public static final EntityDefinition FISHING_BOBBER; + public static final EntityDefinition FIREBALL; public static final EntityDefinition FIREWORK_ROCKET; + public static final EntityDefinition FISHING_BOBBER; public static final EntityDefinition FOX; - public static final EntityDefinition GIANT; + public static final EntityDefinition FURNACE_MINECART; // Not present on Bedrock public static final EntityDefinition GHAST; + public static final EntityDefinition GIANT; public static final EntityDefinition GLOW_ITEM_FRAME; public static final EntityDefinition GLOW_SQUID; public static final EntityDefinition GOAT; public static final EntityDefinition GUARDIAN; public static final EntityDefinition HOGLIN; + public static final EntityDefinition HOPPER_MINECART; public static final EntityDefinition HORSE; public static final EntityDefinition HUSK; public static final EntityDefinition ILLUSIONER; // Not present on Bedrock @@ -105,12 +112,6 @@ public final class EntityDefinitions { public static final EntityDefinition LLAMA_SPIT; public static final EntityDefinition MAGMA_CUBE; public static final EntityDefinition MINECART; - public static final EntityDefinition MINECART_CHEST; - public static final EntityDefinition MINECART_COMMAND_BLOCK; - public static final EntityDefinition MINECART_HOPPER; - public static final EntityDefinition MINECART_FURNACE; // Not present on Bedrock - public static final EntityDefinition MINECART_SPAWNER; // Not present on Bedrock - public static final EntityDefinition MINECART_TNT; public static final EntityDefinition MOOSHROOM; public static final EntityDefinition MULE; public static final EntityDefinition OCELOT; @@ -124,7 +125,7 @@ public final class EntityDefinitions { public static final EntityDefinition PILLAGER; public static final EntityDefinition PLAYER; public static final EntityDefinition POLAR_BEAR; - public static final EntityDefinition PRIMED_TNT; + public static final EntityDefinition POTION; public static final EntityDefinition PUFFERFISH; public static final EntityDefinition RABBIT; public static final EntityDefinition RAVAGER; @@ -136,31 +137,30 @@ public final class EntityDefinitions { public static final EntityDefinition SKELETON; public static final EntityDefinition SKELETON_HORSE; public static final EntityDefinition SLIME; - public static final EntityDefinition SMALL_FIREBALL; + public static final EntityDefinition SMALL_FIREBALL; public static final EntityDefinition SNOWBALL; public static final EntityDefinition SNOW_GOLEM; + public static final EntityDefinition SPAWNER_MINECART; // Not present on Bedrock public static final EntityDefinition SPECTRAL_ARROW; public static final EntityDefinition SPIDER; public static final EntityDefinition SQUID; public static final EntityDefinition STRAY; public static final EntityDefinition STRIDER; - public static final EntityDefinition THROWN_EGG; - public static final EntityDefinition THROWN_ENDERPEARL; - public static final EntityDefinition THROWN_EXP_BOTTLE; - public static final EntityDefinition THROWN_POTION; - public static final EntityDefinition TROPICAL_FISH; - public static final EntityDefinition TURTLE; + public static final EntityDefinition TNT; + public static final EntityDefinition TNT_MINECART; public static final EntityDefinition TRADER_LLAMA; public static final EntityDefinition TRIDENT; + public static final EntityDefinition TROPICAL_FISH; + public static final EntityDefinition TURTLE; + public static final EntityDefinition VEX; + public static final EntityDefinition VILLAGER; + public static final EntityDefinition VINDICATOR; public static final EntityDefinition WANDERING_TRADER; public static final EntityDefinition WITCH; public static final EntityDefinition WITHER; public static final EntityDefinition WITHER_SKELETON; public static final EntityDefinition WITHER_SKULL; public static final EntityDefinition WOLF; - public static final EntityDefinition VILLAGER; - public static final EntityDefinition VINDICATOR; - public static final EntityDefinition VEX; public static final EntityDefinition ZOGLIN; public static final EntityDefinition ZOMBIE; public static final EntityDefinition ZOMBIE_HORSE; @@ -212,13 +212,14 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingRight) .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything .build(); - DRAGON_FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) + DRAGON_FIREBALL = EntityDefinition.inherited(FireballEntity::new, entityBase) .type(EntityType.DRAGON_FIREBALL) .heightAndWidth(1.0f) .build(); END_CRYSTAL = EntityDefinition.inherited(EnderCrystalEntity::new, entityBase) .type(EntityType.END_CRYSTAL) .heightAndWidth(2.0f) + .identifier("minecraft:ender_crystal") .addTranslator(MetadataType.OPTIONAL_POSITION, EnderCrystalEntity::setBlockTarget) .addTranslator(MetadataType.BOOLEAN, (enderCrystalEntity, entityMetadata) -> enderCrystalEntity.setFlag(EntityFlag.SHOW_BOTTOM, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) // There is a base located on the ender crystal @@ -236,16 +237,13 @@ public final class EntityDefinitions { .type(EntityType.EYE_OF_ENDER) .heightAndWidth(0.25f) .identifier("minecraft:eye_of_ender_signal") + .addTranslator(null) // Item .build(); FALLING_BLOCK = EntityDefinition.inherited(null, entityBase) .type(EntityType.FALLING_BLOCK) .heightAndWidth(0.98f) .addTranslator(null) // "start block position" .build(); - FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) - .type(EntityType.FIREBALL) - .heightAndWidth(1.0f) - .build(); FIREWORK_ROCKET = EntityDefinition.inherited(FireworkEntity::new, entityBase) .type(EntityType.FIREWORK_ROCKET) .heightAndWidth(0.25f) @@ -256,8 +254,9 @@ public final class EntityDefinitions { .build(); FISHING_BOBBER = EntityDefinition.inherited(null, entityBase) .type(EntityType.FISHING_BOBBER) - .identifier("minecraft:fishing_book") + .identifier("minecraft:fishing_hook") .addTranslator(MetadataType.INT, FishingHookEntity::setHookedEntity) + .addTranslator(null) // Biting TODO check .build(); ITEM = EntityDefinition.inherited(ItemEntity::new, entityBase) .type(EntityType.ITEM) @@ -279,44 +278,52 @@ public final class EntityDefinitions { PAINTING = EntityDefinition.inherited((PaintingEntityFactory) PaintingEntity::new, entityBase) .type(EntityType.PAINTING) .build(); - PRIMED_TNT = EntityDefinition.inherited(TNTEntity::new, entityBase) - .type(EntityType.PRIMED_TNT) - .heightAndWidth(0.98f) - .identifier("minecraft:tnt") - .addTranslator(MetadataType.INT, TNTEntity::setFuseLength) - .build(); SHULKER_BULLET = EntityDefinition.inherited(ThrowableEntity::new, entityBase) .type(EntityType.SHULKER_BULLET) .heightAndWidth(0.3125f) .build(); - SMALL_FIREBALL = EntityDefinition.inherited(ItemedFireballEntity::new, entityBase) + TNT = EntityDefinition.inherited(TNTEntity::new, entityBase) + .type(EntityType.TNT) + .heightAndWidth(0.98f) + .addTranslator(MetadataType.INT, TNTEntity::setFuseLength) + .build(); + + EntityDefinition fireballBase = EntityDefinition.inherited(FireballEntity::new, entityBase) + .addTranslator(null) // Item + .build(); + FIREBALL = EntityDefinition.inherited(FireballEntity::new, fireballBase) + .type(EntityType.FIREBALL) + .heightAndWidth(1.0f) + .build(); + SMALL_FIREBALL = EntityDefinition.inherited(FireballEntity::new, fireballBase) .type(EntityType.SMALL_FIREBALL) .heightAndWidth(0.3125f) .build(); - SNOWBALL = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) - .type(EntityType.SNOWBALL) + + EntityDefinition throwableItemBase = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) + .addTranslator(MetadataType.ITEM, ThrowableItemEntity::setItem) + .build(); + EGG = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + .type(EntityType.EGG) .heightAndWidth(0.25f) .build(); - THROWN_ENDERPEARL = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) - .type(EntityType.THROWN_ENDERPEARL) + ENDER_PEARL = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + .type(EntityType.ENDER_PEARL) .heightAndWidth(0.25f) - .identifier("minecraft:ender_pearl") .build(); - THROWN_EGG = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) - .type(EntityType.THROWN_EGG) - .heightAndWidth(0.25f) - .identifier("minecraft:egg") - .build(); - THROWN_EXP_BOTTLE = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) - .type(EntityType.THROWN_EXP_BOTTLE) + EXPERIENCE_BOTTLE = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + .type(EntityType.EXPERIENCE_BOTTLE) .heightAndWidth(0.25f) .identifier("minecraft:xp_bottle") .build(); - THROWN_POTION = EntityDefinition.inherited(ThrownPotionEntity::new, entityBase) - .type(EntityType.THROWN_POTION) + POTION = EntityDefinition.inherited(ThrownPotionEntity::new, throwableItemBase) + .type(EntityType.POTION) .heightAndWidth(0.25f) .identifier("minecraft:splash_potion") - .addTranslator(MetadataType.ITEM, ThrownPotionEntity::setPotion) + .build(); + SNOWBALL = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + .type(EntityType.SNOWBALL) + .heightAndWidth(0.25f) .build(); EntityDefinition abstractArrowBase = EntityDefinition.inherited(AbstractArrowEntity::new, entityBase) @@ -363,32 +370,28 @@ public final class EntityDefinitions { .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset) .addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock) .build(); - MINECART_CHEST = EntityDefinition.inherited(MINECART.factory(), MINECART) - .type(EntityType.MINECART_CHEST) - .identifier("minecraft:chest_minecart") + CHEST_MINECART = EntityDefinition.inherited(MINECART.factory(), MINECART) + .type(EntityType.CHEST_MINECART) .build(); - MINECART_COMMAND_BLOCK = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) - .type(EntityType.MINECART_COMMAND_BLOCK) - .identifier("minecraft:command_block_minecart") + COMMAND_BLOCK_MINECART = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) + .type(EntityType.COMMAND_BLOCK_MINECART) .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) .build(); - MINECART_FURNACE = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) - .type(EntityType.MINECART_FURNACE) + FURNACE_MINECART = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) + .type(EntityType.FURNACE_MINECART) .identifier("minecraft:minecart") .addTranslator(MetadataType.BOOLEAN, FurnaceMinecartEntity::setHasFuel) .build(); - MINECART_HOPPER = EntityDefinition.inherited(MINECART.factory(), MINECART) - .type(EntityType.MINECART_HOPPER) - .identifier("minecraft:hopper_minecart") + HOPPER_MINECART = EntityDefinition.inherited(MINECART.factory(), MINECART) + .type(EntityType.HOPPER_MINECART) .build(); - MINECART_SPAWNER = EntityDefinition.inherited(SpawnerMinecartEntity::new, MINECART) - .type(EntityType.MINECART_SPAWNER) + SPAWNER_MINECART = EntityDefinition.inherited(SpawnerMinecartEntity::new, MINECART) + .type(EntityType.SPAWNER_MINECART) .identifier("minecraft:minecart") .build(); - MINECART_TNT = EntityDefinition.inherited(MINECART.factory(), MINECART) - .type(EntityType.MINECART_TNT) - .identifier("minecraft:tnt_minecart") + TNT_MINECART = EntityDefinition.inherited(MINECART.factory(), MINECART) + .type(EntityType.TNT_MINECART) .build(); WITHER_SKULL = EntityDefinition.inherited(WitherSkullEntity::new, entityBase) @@ -451,10 +454,6 @@ public final class EntityDefinitions { .height(1.8f).width(0.6f) .addTranslator(MetadataType.BYTE, BlazeEntity::setBlazeFlags) .build(); - CAVE_SPIDER = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) - .type(EntityType.CAVE_SPIDER) - .height(0.5f).width(0.7f) - .build(); CREEPER = EntityDefinition.inherited(CreeperEntity::new, mobEntityBase) .type(EntityType.CREEPER) .height(1.7f).width(0.6f) @@ -536,6 +535,10 @@ public final class EntityDefinitions { .offset(1f) .addTranslator(MetadataType.BYTE, SpiderEntity::setSpiderFlags) .build(); + CAVE_SPIDER = EntityDefinition.inherited(SpiderEntity::new, SPIDER) + .type(EntityType.CAVE_SPIDER) + .height(0.5f).width(0.7f) + .build(); SQUID = EntityDefinition.inherited(SquidEntity::new, mobEntityBase) .type(EntityType.SQUID) .heightAndWidth(0.8f) @@ -732,6 +735,8 @@ public final class EntityDefinitions { .height(0.5f).width(1.25f) .addTranslator(MetadataType.INT, FoxEntity::setFoxVariant) .addTranslator(MetadataType.BYTE, FoxEntity::setFoxFlags) + .addTranslator(null) // Trusted player 1 + .addTranslator(null) // Trusted player 2 .build(); HOGLIN = EntityDefinition.inherited(HoglinEntity::new, ageableEntityBase) .type(EntityType.HOGLIN) @@ -891,7 +896,7 @@ public final class EntityDefinitions { // As of 1.18 these don't track entity data at all ENDER_DRAGON_PART = EntityDefinition.builder(null) .identifier("minecraft:armor_stand") // Emulated - .build(); + .build(false); // Never sent over the network Registries.JAVA_ENTITY_IDENTIFIERS.get().put("minecraft:marker", null); // We don't need an entity definition for this as it is never sent over the network } diff --git a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java index b51f83f2c..fe423dde5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java +++ b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java @@ -162,9 +162,9 @@ public class InteractiveTagManager { interactiveTag = InteractiveTag.RIDE_MINECART; } break; - case MINECART_CHEST: - case MINECART_COMMAND_BLOCK: - case MINECART_HOPPER: + case CHEST_MINECART: + case COMMAND_BLOCK_MINECART: + case HOPPER_MINECART: interactiveTag = InteractiveTag.OPEN_CONTAINER; break; case PIG: diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index 3b01c428f..1828f63e1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; @@ -159,7 +160,11 @@ public class Entity { flagsDirty = false; - session.getGeyser().getLogger().debug("Spawned entity " + getClass().getName() + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); + if (session.getGeyser().getConfig().isDebugMode()) { + EntityType type = definition.entityType(); + String name = type != null ? type.name() : getClass().getSimpleName(); + session.getGeyser().getLogger().debug("Spawned entity " + name + " at location " + position + " with id " + geyserId + " (java id " + entityId + ")"); + } } /** @@ -402,7 +407,7 @@ public class Entity { public float setFreezing(IntEntityMetadata entityMetadata) { // The value that Java edition gives us is in ticks, but Bedrock uses a float percentage of the strength 0.0 -> 1.0 // The Java client caps its freezing tick percentage at 140 - int freezingTicks = Math.min(((IntEntityMetadata) entityMetadata).getPrimitiveValue(), 140); + int freezingTicks = Math.min(entityMetadata.getPrimitiveValue(), 140); float freezingPercentage = freezingTicks / 140f; dirtyMetadata.put(EntityData.FREEZING_EFFECT_STRENGTH, freezingPercentage); return freezingPercentage; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java index 25135d0b5..8196d03ff 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ExpOrbEntity.java @@ -32,17 +32,9 @@ import org.geysermc.geyser.session.GeyserSession; public class ExpOrbEntity extends Entity { - private final int amount; - public ExpOrbEntity(GeyserSession session, int amount, long entityId, long geyserId, Vector3f position) { super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); - this.amount = amount; - } - - @Override - protected void initializeMetadata() { - super.initializeMetadata(); this.dirtyMetadata.put(EntityData.EXPERIENCE_VALUE, amount); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java index 346861f96..1f690036f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FallingBlockEntity.java @@ -35,16 +35,10 @@ import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class FallingBlockEntity extends Entity { - private final int javaId; public FallingBlockEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, int javaId) { super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, 0f); - this.javaId = javaId; - } - @Override - protected void initializeMetadata() { - super.initializeMetadata(); this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java similarity index 91% rename from core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java rename to core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java index 49548ec2a..52796d67b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemedFireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java @@ -31,7 +31,7 @@ import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; -public class ItemedFireballEntity extends ThrowableEntity { +public class FireballEntity extends ThrowableEntity { private final Vector3f acceleration; /** @@ -39,7 +39,7 @@ public class ItemedFireballEntity extends ThrowableEntity { */ protected int futureTicks = 3; - public ItemedFireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FireballEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw); float magnitude = motion.length(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java index 67aa09794..d68779c9f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java @@ -118,16 +118,16 @@ public class ThrowableEntity extends Entity implements Tickable { protected float getGravity() { if (getFlag(EntityFlag.HAS_GRAVITY)) { switch (definition.entityType()) { - case THROWN_POTION: + case POTION: return 0.05f; - case THROWN_EXP_BOTTLE: + case EXPERIENCE_BOTTLE: return 0.07f; case FIREBALL: case SHULKER_BULLET: return 0; case SNOWBALL: - case THROWN_EGG: - case THROWN_ENDERPEARL: + case EGG: + case ENDER_PEARL: return 0.03f; case LLAMA_SPIT: return 0.06f; @@ -144,11 +144,11 @@ public class ThrowableEntity extends Entity implements Tickable { return 0.8f; } else { switch (definition.entityType()) { - case THROWN_POTION: - case THROWN_EXP_BOTTLE: + case POTION: + case EXPERIENCE_BOTTLE: case SNOWBALL: - case THROWN_EGG: - case THROWN_ENDERPEARL: + case EGG: + case ENDER_PEARL: case LLAMA_SPIT: return 0.99f; case FIREBALL: @@ -172,7 +172,7 @@ public class ThrowableEntity extends Entity implements Tickable { @Override public boolean despawnEntity() { - if (definition.entityType() == EntityType.THROWN_ENDERPEARL) { + if (definition.entityType() == EntityType.ENDER_PEARL) { LevelEventPacket particlePacket = new LevelEventPacket(); particlePacket.setType(LevelEventType.PARTICLE_TELEPORT); particlePacket.setPosition(position); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java index 7abffd0bf..2cee252ec 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java @@ -25,6 +25,8 @@ package org.geysermc.geyser.entity.type; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; +import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.geysermc.geyser.entity.EntityDefinition; @@ -75,4 +77,7 @@ public class ThrowableItemEntity extends ThrowableEntity { protected void setInvisible(boolean value) { invisible = value; } + + public void setItem(EntityMetadata entityMetadata) { + } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java index c4cd5d54a..3b4d5674a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java @@ -48,24 +48,31 @@ public class ThrownPotionEntity extends ThrowableItemEntity { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } - public void setPotion(EntityMetadata entityMetadata) { + @Override + public void setItem(EntityMetadata entityMetadata) { ItemStack itemStack = entityMetadata.getValue(); - ItemMapping mapping = session.getItemMappings().getMapping(itemStack); - if (mapping.getJavaIdentifier().endsWith("potion") && itemStack.getNbt() != null) { - Tag potionTag = itemStack.getNbt().get("Potion"); - if (potionTag instanceof StringTag) { - Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); - if (potion != null) { - dirtyMetadata.put(EntityData.POTION_AUX_VALUE, potion.getBedrockId()); - setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); - } else { - dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); - GeyserImpl.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); + if (itemStack == null) { + dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); + setFlag(EntityFlag.ENCHANTED, false); + setFlag(EntityFlag.LINGERING, false); + } else { + ItemMapping mapping = session.getItemMappings().getMapping(itemStack); + if (mapping.getJavaIdentifier().endsWith("potion") && itemStack.getNbt() != null) { + Tag potionTag = itemStack.getNbt().get("Potion"); + if (potionTag instanceof StringTag) { + Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); + if (potion != null) { + dirtyMetadata.put(EntityData.POTION_AUX_VALUE, potion.getBedrockId()); + setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); + } else { + dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); + GeyserImpl.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); + } } - } - boolean isLingering = mapping.getJavaIdentifier().equals("minecraft:lingering_potion"); - setFlag(EntityFlag.LINGERING, isLingering); + boolean isLingering = mapping.getJavaIdentifier().equals("minecraft:lingering_potion"); + setFlag(EntityFlag.LINGERING, isLingering); + } } } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java index fbed041fe..f645fae34 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java @@ -33,7 +33,7 @@ import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; -public class WitherSkullEntity extends ItemedFireballEntity { +public class WitherSkullEntity extends FireballEntity { private boolean isCharged; public WitherSkullEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java index 732142573..580dccc88 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockEntityPickRequestTranslator.java @@ -66,11 +66,11 @@ public class BedrockEntityPickRequestTranslator extends PacketTranslator itemName = "lead"; - case MINECART_CHEST, MINECART_COMMAND_BLOCK, MINECART_FURNACE, MINECART_HOPPER, MINECART_TNT -> + case CHEST_MINECART, COMMAND_BLOCK_MINECART, FURNACE_MINECART, HOPPER_MINECART, TNT_MINECART -> // The Bedrock identifier matches the item name which moves MINECART to the end of the name // TODO test itemName = entity.getDefinition().identifier(); - case MINECART_SPAWNER -> itemName = "minecart"; // Turns into a normal minecart + case SPAWNER_MINECART -> itemName = "minecart"; // Turns into a normal minecart //case ITEM_FRAME -> Not an entity in Bedrock Edition //case GLOW_ITEM_FRAME -> case ARMOR_STAND, END_CRYSTAL, MINECART, PAINTING -> diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java index 1c3239d69..eb54ad942 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaEntityEventTranslator.java @@ -97,7 +97,7 @@ public class JavaEntityEventTranslator extends PacketTranslator mountedHeightOffset = height * 0.5f; case DONKEY, MULE -> mountedHeightOffset -= 0.25f; case LLAMA -> mountedHeightOffset = height * 0.67f; - case MINECART, MINECART_HOPPER, MINECART_TNT, MINECART_CHEST, MINECART_FURNACE, MINECART_SPAWNER, - MINECART_COMMAND_BLOCK -> mountedHeightOffset = 0; + case MINECART, HOPPER_MINECART, TNT_MINECART, CHEST_MINECART, FURNACE_MINECART, SPAWNER_MINECART, + COMMAND_BLOCK_MINECART -> mountedHeightOffset = 0; case BOAT -> mountedHeightOffset = -0.1f; case HOGLIN, ZOGLIN -> { boolean isBaby = mount.getFlag(EntityFlag.BABY); @@ -169,8 +169,8 @@ public final class EntityUtils { yOffset += EntityDefinitions.PLAYER.offset(); } switch (mount.getDefinition().entityType()) { - case MINECART, MINECART_HOPPER, MINECART_TNT, MINECART_CHEST, MINECART_FURNACE, MINECART_SPAWNER, - MINECART_COMMAND_BLOCK, BOAT -> yOffset -= mount.getDefinition().height() * 0.5f; + case MINECART, HOPPER_MINECART, TNT_MINECART, CHEST_MINECART, FURNACE_MINECART, SPAWNER_MINECART, + COMMAND_BLOCK_MINECART, BOAT -> yOffset -= mount.getDefinition().height() * 0.5f; } Vector3f offset = Vector3f.from(xOffset, yOffset, zOffset); passenger.setRiderSeatPosition(offset); From 9ba1efaa304f00829f87c01b932c0ef67970ab15 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Sun, 28 Nov 2021 11:03:45 -0500 Subject: [PATCH 722/766] 1.18 does not have its own block palette Our logic to finding block palettes was just borked. --- .../geysermc/geyser/registry/Registries.java | 2 +- .../geyser/registry/VersionedRegistry.java | 14 +++++++++----- .../populator/BlockRegistryPopulator.java | 6 ++---- .../resources/bedrock/block_palette.1_18_0.nbt | Bin 41760 -> 0 bytes 4 files changed, 12 insertions(+), 10 deletions(-) delete mode 100644 core/src/main/resources/bedrock/block_palette.1_18_0.nbt diff --git a/core/src/main/java/org/geysermc/geyser/registry/Registries.java b/core/src/main/java/org/geysermc/geyser/registry/Registries.java index 7473980cd..a81903e8e 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -65,7 +65,7 @@ import java.util.Set; /** * Holds all the common registries in Geyser. */ -public class Registries { +public final class Registries { /** * A registry holding a CompoundTag of the known entity identifiers. */ diff --git a/core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java index 797c2ea48..93387a770 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/VersionedRegistry.java @@ -55,17 +55,21 @@ public class VersionedRegistry extends AbstractMappedRegistry current = null; for (Int2ObjectMap.Entry entry : this.mappings.int2ObjectEntrySet()) { - if (version < entry.getIntKey()) { + int currentVersion = entry.getIntKey(); + if (version < currentVersion) { continue; } - if (version == entry.getIntKey()) { + if (version == currentVersion) { return entry.getValue(); } - value = entry.getValue(); + if (current == null || current.getIntKey() < currentVersion) { + // This version is newer and should be prioritized + current = entry; + } } - return value; + return current == null ? null : current.getValue(); } /** diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index 0f2d0c941..8df6f0a7f 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -30,7 +30,6 @@ import com.google.common.collect.ImmutableMap; import com.nukkitx.nbt.*; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; -import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.Object2IntMap; @@ -39,12 +38,12 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIntPair; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.level.block.BlockStateValues; +import org.geysermc.geyser.level.physics.PistonBehavior; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.BlockMapping; import org.geysermc.geyser.registry.type.BlockMappings; import org.geysermc.geyser.util.BlockUtils; import org.geysermc.geyser.util.FileUtils; -import org.geysermc.geyser.level.physics.PistonBehavior; import java.io.DataInputStream; import java.io.InputStream; @@ -65,8 +64,7 @@ public class BlockRegistryPopulator { static { ImmutableMap.Builder, BiFunction> stateMapperBuilder = ImmutableMap., BiFunction>builder() .put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER) - .put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER) - .put(ObjectIntPair.of("1_18_0", Bedrock_v475.V475_CODEC.getProtocolVersion()), EMPTY_MAPPER); + .put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER); BLOCK_MAPPERS = stateMapperBuilder.build(); } diff --git a/core/src/main/resources/bedrock/block_palette.1_18_0.nbt b/core/src/main/resources/bedrock/block_palette.1_18_0.nbt deleted file mode 100644 index 0415c135a3e1221c962da5a1ea3b831b4cab3d76..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41760 zcmeFZWn5Lk_b;r1fP_dlDhMil=q@OwR zzn}ZR_j&Pro;Sby=K5loy=Lw0nVGd_zU#YY@5eBVJOBP+uG9xdFH4tXzDA?9SIqpD zLszaIm1})GyVmCz6P>HnKV<5z_kQjpx)=?ut-n~2s8Z^PVIKhwDYh|0NSue#&?NxNKH{8uH>Rp@Jk^X#@L4WRQk7Rn3p)j-Z{?SP|n_Wlb zQj%ndKrmsYP~-Bevr*V|l74;FE~spKUGZ;MA0A_cfSTWuyMALz)!g{rliQ|;Uw~TR z8I?@U%|n7yw#JrLp`JZ9yXhl=l`9tncmUPmwSc_N-nRM=VO)aoi*wby{+8C`25@=co6wZ~T|)Gw=(w1i zcZ!|XAxh}*m&d)^rh)^<>BQ?sDZF2Om&#UTj?NWf{~BZn*KyJ9tQ&h~)y^Ets~&Gl zMfH!z+sD2gZ);=MF7wKnf2+1R%->kC_k8;@sUbQ42zKUO(r2@D@k@9p(kq|#LQ>`= zCv3-qzog&MD0#cHp^)~%H*5#XP5p=3%Uq}QJT;F%CrJMX6#LS~$~V%iHiv0(F{wDC z1COX@M?modS$K`~JugWBSox0#DNV&Pf&oU z7b)TdB8OfQ^r?6TZ6{Cls|AXK3mylZ?=5?CDl&fA*EH)t?UGA1RNq;Cb!XJ1jdDb*x-(s;Q&+C2F%gnlYi*tBZ<`t#dO zPQ1l0Z}uLsY?fhzO4h!cvc2-)lSE#tPdMXmYys|&{@tCHG1T;Yiu-)C1(ywQr3h z^&nED(j8q&qi>ygbXmtRmiQs#>{CU;`Zo0IvH)@ClQh%b2C)Q2Y_itsH9x<<&MXmP zMSKUldQbd$9fp|ZyOYUzBA=(r9PRMecFMf1?7q5*6LI`Rp4R6uCo|#}b`f;Km&G~` zTUxR&b>(PFo?_V*Hm#DY?GOGv^xL5!dA!3sVViqac)ePovY*d-c-O)EaiaRFY6EK0 z{-lD z7i>MhsXN|oY-mm^Xpnc!KMw9Fd3zZu;d)-<%;6T*?~!b&fr^8+xEUyA%g$L4cC>R| z$3zhlURqmuKN+s~`(~Nta(lDpZ$^U{Yj-W~kN~*v4!L5!{5{^=SIPSW{o~`ctmMnKSpFYUSxa)S`y&U8n=aDB)0vMKI%NkWn2&{<$_LQ3w!Hi* z(|xYl&K(nf5VsvJ{k?yB`MdEAkB!=ynUcw)#p3Awrsv*edaBc!1&67=Q|QSTJ9XJ6 zF$|9>o_o1g+&I+MX}n0ZN;p|upF72L66SexvEU#QYdSirvYoc0(y0C`m%+#M7v=o9 zoZg>9BBFYsHAeTer~HGDghn3;4L>5P514#@!8S;MGZ-AOkrS{HEBUA8B28*;Hn#4R zZ)_4e{14Bw6WgQfBFjm0FM{If`15|$%NVO^rL zo$*=Mq?pplifezj?Y0+KY-0~?)2QC3QKbl=_sQLh@=v;3<1oM>>hjPXjkl*ss{eGk`#-F(<5nZhfc*zeU+*gD2VW&qpzMLguk-7J?rgQ zf`4sH8dvws%afeFb=&@ML7i(zG)h1;8XU5<=q6>fyx8GyTG&kat3Yg&3nPx0SxLcD;3?RCiZByxhR`(H!@^RGLO6 zZ~MK1XN_cCQbI{+D{0iYDE5lsroO`KDkm75Zg1`a$vv;Wm!c!fkd%JD`$6u4sDJpf z?kI-Kd=y?Me6n?LXJ9?yo}`fV&8^nj{O#q{?PWW-#7w5=R@LNArl;0bS?yg@vUZ)l zCvLh<{78$m^5eedEb|l37fx7z`urTW$#OnA_{8GI-Gi+~?0QU^eC=f^JX$sRW8_u2 z*s)j{uxHf;gGpWNLmQtgKlMw%#xwH6KK#qBt@k3U6%Qp2PX^meoD!09#yeY&{yi3M zcsC`Mm-tRx0I2Y}+Slt^hK!1H;TAlZ;9te?`=K26WFjHxH&tH;>Po%D%g$eq#OT3- z;1T!++e}*W^kE|DfT!cU0O37RjzO=zcNlkieRt+k2~oAPKx4*}<^<0v3?&`;_0cyB z9W+Ay6=vUV)e_7JD+lce{ zdUJbMT;zoJO-Xnl)w9VC3Eb$N<;B3)6_;JqDJfN7ghV$gjBp>##afzKo<#|XPKbTk z^)beMz$eiW{K%*We3tV@VL;H4M(U;An`h3Y=50QLZqr7fB)Y=+Kv7-N8X|1jib|Y=wd!CQ$^HKa{ctg(s z*Qd!nq9{=0z0j+Pmia>JXO z2isn=4gnD+L7)(0|EL=H9fag%{dkehM*xOdi z0}5joHKVz|{68HxSO<3QemtEPYj)SK{G!h=8F-5#Xr`<5ZOOuuh`O)Bb%Z=aPy)zs z3D%4dY+ntU%T~~;QMK&-v4_7<7$Kr(Ug+_pDWG1gOEdQTVl$v``DFepbjc~5D3gvS zWIXgm&)(yJ>MLt!?bYGYCGTt!RbhRbE@STtxe(3m>EHD#PQrOdSbz0$`)p=Ba`+pe zdl_4oZ|Y-mkGNWa(1pMwN7nmzPG9xV-?o6PQ@f>JL6MQ@m8n?`Y;+q?9pL&di?kLr<-VakM?V6@vQZ& zJpNwv6td*n*Cxzg7cMWb{eB5INpaIc|FvZg)C&gfMOk41bzj@^KYQ& zKo+J^pg@lXMHaGRRMj~l-Qd$D8?u3=`%fo~ zzpyK!x#p1dcAj~wcv!pV9r8x*QT~g#XZl8^d7Js(xtg4f!ESXoUyrY~5}34DtXYd8 zN;{}8xy3?e6FCM+9u7GK;0cI@DDby7@Uy7hEN>-3JKRnOY`w!ogh#40j2c&tHt7p< zE!C{KHO)e|f8?LWCUO;4mXw|xt2vMToa;(ErFQPBoEK>%a-cfyEl%Hx-#Mw%i`$lR zp3{iy=UL6YF0~&%hZE+%sL^gv#y+>bR$7X)eg66Skeb5e3Hdr53}?B{8>Qv1cWO9} ze_!aH`o#oW+Ip9ZfpfT@jlUq7m)(UKFJnx1{lczI=$j);uhaAWuY)l%H|-_)+%dqT zb*<;GqL%Hf5A~PfGJEsap{msnUot&YNs1zob*gB{zlqf;AuNWPY&$C7RIYrwk!VgTifb!Yz3ioMo27UyErKc<5pCgI$FAtl$ZNn z0ZC(llEAN!5aU@gj!e0)-Bmm$@-Z~gPA--#x{=jA7lvJ*6vreYqQ1+M8cMZRy>{3P zff>)zab&_u$f1;UhBYrfJk1=hd0zQ7AE7el#clw86};A{*=SQy^R#p93lT|oorH-z zi6Nb2xz>YWDGe;KdNspeA+pA^6a@6J;)j0jKRkay^ZihIpX`kn=XAITF&*_G*mUD` z#_AykHH5`IwT2%yLwbzoA9K*dOQ;`m!!6ki;6!%WZY!yK`ih|4sM%3bttHju%Wej& zg!m!XH_Lqky~yqw^-OsL1H!ISK9)^^W!rmFuNmqe>(Z0(aydVwMd3MxJejdBrKRZP zg1?ZVDy6kJP~iQr^j@Ot1ixJq4?Rwq`|tb0K;v1y+mW%k9hvdlk?}A=j!a7vS~Lzl zyqM-8S1I^klZwFaE3;(P{WfZwU2W{KnU?<<1&3wcFW&u|dOG{w*RwAfL16ff=;Xq? z>SVa1^Q$yYsMrl^NEsL34|kmmf$>3~CUBp)P?KjknnSQ^!kui3gi?Rd!HO{-a%EWV z9q8hA*KmMeLLXyi(}Q4cc#N=x?1xpYATAxdke zNu8P(d5iCrf2|EkX<`LV5lqdb*O5m#CCek2q?ndjV%ap^RmOx$%8fwGvll@&+@|pW zJzlaRhNW4HcjQS)eTPefEbjziNwpDVtSL1hqL+?Qoal0gTJyA-@rZ8oe7+dcU8|qg&OeOkFFDo?p|#8+77-*FEA7~r!1{)OlIwxR9!}? z4&;Sd**Qn`JEhfCBzo14X96KD>?LJ0R_DLEpnwo`S&f0cD)$bF;#W*j3I^FoS#Sa@75jYeY9 zxyCbRDbE|FA>5Qv)$!P-O8vl6D5X@j@$P&RN7RdkDV~{amrVRN^|Ju?qrNee8uBmZ z9o^CNQuN*4G0Y0?uQF!~ayZ+JOLm<$@uk#H13b$6)Y2vx=HJ_lPP)H%p6Ah0|HhO- z!BN$wh-XtiBe-A3{zE-C~@+JG^Np&VZ5m{H&aE2U_{xOB+ z)VNme#@75hlt%x#tTfPGYZ<(h=Oux2MJ`9Eze-`TH9kdKL-WmiygP4E`5&-^z)=<@#t==#3~sPW$b`75Am%Ms~bQCPf~n4;y^2EUJCLL=?3#r!+} zrgr4`pv7UIT=bIbJ(~`TVNwW@&%9#MjQbN|S*t5&9@1?zvt2?LQt%sx`=KS1qGgm# z5pyVdok*Kx$*%pcAxZUPwCSMmvOs4Wws>ZCKsN_R8=ItkLjTRz;+nS=T}a^x4)@6iMn%skn{4J#E1{IUr?Jj; zmgY)EB|9#Yz>18fcH?A~b?B${VptR%ootE}^$mled7csq=j0y9>GBUfo028a9i_17 z8dr;>8L8_hf2HcJ%*2|>)op(rZ7z6zIp>2YAXznun@!4EzS*r?ZS2+Rw@Jq3sQ6w}#0Rr-XXu*E-N^OE&*++c<*_)B4!a z@6^RhN*~W`yW&poU+cpPda9H8GnOT2^WEcCd;Et@%D;^M46dHg*j%ndORcq4ygny>$So{#czsOdT#((+ z+;@LeeWE()98+Wn-#ee~Qc~`3PV~NqR&#&Zr{oV08Vl(zeWUlWf|X~JlJ}DEy4p_M zCtYP-`3p;6(;X&*FMIq96M615759;|@{Vb?-|ygOEML$tg%DG2=U0L@I#t{JQVYy5Ct_)!H1!-P z&7lG%1W<~^2TBr;Im7EMw6fNn9!!sZ-7WF9wyK4%;`ilgvMknRgUSbOP-z7fMqN-@ z5V4eHGC5ZCcDe+=w~to1#-(-3X;+^-`FK-EhM!uf-)C-wC)%pGp=Z4>VFi7E5d zn~cN9LJN6;?0WNeLc*e-s^neH9-V$2)Vwm&S4%IA@2*KYedMa5HhGv9-n_hho(ir0 z<^HO!@&yYEPkHdviMZQWR^n9!+|R>OcC+gQ2?Zgms>#c&xjPEU97Qa|$EjYzO*;w| zJ4X-HrY*`hoE~}<_?2p#&dDsKbsY)c`q69GY%=3_JO{5dZqDlc zeY)0%M^D_HRGBD}7jpm*`LUw&Zcer@V--}4PN_vJVQ#7{6yuvP{Ts`g7uUtiYsU&z z*SMobf9AHK#R!(eLiKL#C6iN0*|@G7-7j-P0}Y@eI<)I-Zh=xU1h{8 zigqLJf(&6=VKQxsc?a3N77%J8nICQGOW7HJEmh}s&_0iMA4-3as%R5s?x`TnKAt2- zDVLvyrl@_;#vVztf-UOQCUY8IetYYadsBXP=VbBsUCZ$UE#{I{lc~XCOeKecjwf8} zU09$}3@R2#N&FM89ZWmnALu!J0%l?seMwpoai!hF-`93(?*ow?5Y6cTkv0hs&EL_kd^!DH1}8@POzH6^NjBfye+UA_pQqbRarJiasMn zw8&>Y03yG8K$L?NF(IFY1w{BLK-7yAaYZz&A59x4^>QW8*BuM}A1V_2ZCJ_AV>AaX z*Mzi*U{Y!drOB{kvz-K2LdMG(?M0H9<~`~c@}{fD$JX637dDrnGOQ-6_If+?u#&by z3i#i;u<(Z~o-9)6_QEM?D16B(gT4vj`5U5rrsE5u%c*LKw2!<;`R*;M|F=qn!>HF7 z_BVZ!QmxE}$BvCB7j6D1Qk1*_u+isob?h z$f-P1qs{XxA`d3|G}^g4EalvAb9$G33p+DX#*{5|htHqS!MQ(rCDe;cFnLbUDZz9~ zxx)=#$m!jB$JxqC&ax-lc}|aN_!zMSUkK>#&c*%7$@6^~`Qk-SjiN*_{1; z8A7$yrIXP0&E0M2wnFvJ^|Mpz{Vt2zqz1ijJZ_`Bth%*jopjHpOPpWvlEmpWSGTX= z_pQ>!*cRl!#eHVosJ+=^eRWh@9%jp zrX0BD-qbo>G!C6iW7Rf3z2*xhTxibaBYg8`nZ7JX`8!91z%SOMfy_6!Zv-5&lj}-j zYpNWH?PYY>X_qxSsci<~a#`MuEth&py(3beIU@L$zL3TAiT-xQGEw2hx=yM6ep%z# zo58}6=sWY;0@Lo0^8nlE?K`!guUW55o1gAS_jbAxmvrdx8XjqOKDOJ0!%dqQ_oMr& z9MSB7ly;e{liF?)E@#@rjL~pDoqWe32ll}9i9?#rwV5(_#1oebZb+B zOrLn96jPRNDz9=xi1ZkRP5v=oirvR*ZR6lh{(Pwz)4%bNn7va+6m-@0Ve5TP_9WjO zAf50;JM7RA1mn5?FesI(c1$cB3?Q4bfXUaaVDQX{CaTh3U?vtxUAs+;1hFO!SrUrR zm{!889HrY!7f4*?Om+BCs(~~TjBR+8WqU^H0`U`V<==mq!{}dT8+9}nPdB28R zIU_z&r;|#toTm{aKKAMV;~k<17990A5fBz$2Qre#{Ljs;baY5R;tmw zqMv+CNm7Tv<7MIG_`EDGQ3@(Nk;{Jbtse_e{?K!peuZIBuT~=>#4=$RWNS4+2)hax z2KjPr(8tJj7zV{&UC=`67%Yfly*?<#cMTRqzTFV?bMXWgl-TMsY2$|1MDUk2Pl1)j z2<^tWa#sq~YR*T~+7r(}`HXe=2P=&==8bXHnUti$a$`?rW6(q@L14tL5#O}F;7(Dn z1T}P|^(hX-dMN^pjMwf}3w9ju_r=d|D2LuL%2N&%89sk#UgS#<$l22wEJ1Fz4|I9F zfo@`p-K34{LD95}j@q=YU@K}^w{5B9vcrtbpw~n>yWnoO8=@ZvQN-L) zHzDKavatAOpEe8c3@Om4=BWxDxY74?LtzGqp7|p@2&E5L)-x z%E5!C8Ynns32B$s>CRZD0B&<*ILA9|M#?)^ywZU9{-5#xZP zC;jw^wfcPUgyS!3ODG$)+0k{kBLy5izRPFQ+V8+t`7diXGaI!9`HgYo-S!ri`OpTO zU@IB?`PmI+Xw0s3GGVb9&-u5Y&$WYDpO|Jth3QOwS^s%?(B+c;Hh9VfG))LOr@wum zT|?m|+p`4j@;jLXTGsubD!y*3Q|xoYNC%9av2V{OLsEXB3VL;|F55FkrCv9GBO4s| z%TDU@s_8=6%!{%`ZfFUZ~(YlC)zzlFRCh2JB{F4glZ)RhL-uGH(=)s;Z^8KK*Z zFM*#E{Wyyv5Vkm!oiE*WnBUZv*=R(mV<(R=v;UV?VXP&)(p z)>jnmt)Zs|@_*jZwxfnQK;=h78QVXF9z*3u&lIK8 z_=af}d+kg-ZHTJs8N_Au;W=e8juYlakb~6P7f1 z>=xXS=wv+coh{f23M;;7z!UCBm=d@Z0qb^KC@u{aocRfK%~mXFaJgK8E~N<2eY4cK z!_yM9@Zd6LRE-pm-T$U!8iUr4d#{nHvMH!2=Q3uKo)nMg^9}pVJ=(O)1N}9M_mVr% zo6)(E^y#my!yoCSS?%BFK;)P-pgruk(WGSqpXj8SZ4H9)U{)H?nIvH*h^hgdK+Z-xo5lkm-H6JSVA%w2IceQ<~ zybT{^-PW*}+%VYSsH(W?M{(;ysx{mkhJRn6{S)qyp~}DuiFVXb2O}`7a_ygR4vpkH z-zm4F7A$lj_KPdv!IT@_h@!}Lcre9I4`Se83?7`+9*l%&-_X z)9;&PQkcju7|r!Kcf*4dTH`gX;~;hfZX6d@9Q5uxgtYy7^yJEL!9P_mrD;qi2x)OS zY(pZ^$@$tkB|_t%D^J_sKn`s`$U_bX{If{ientY_k%5=e)RupMZgn##1Ys1kX5a7z zIjSI~R_rt;m^>y`ucakHk7KPP@$4L`A=5bQG`0_UOsa*XKlLuR@9=a4Ev#P5Rze1? zESGBMy_EJ#u6_@T6Ysht6PDOEUH~hc1eSK#N14-cF zF{|99cwkFopGBoz%G}ov(0(sD!g<~8i2@JO{oOb<=R(kk@8V(tt$m|^5rtpd<3%UM z#IFAm5362Xwo_?43cs|~Eu)o@NAIQL#d!f(;Vso=CzQs4e8MpUb$7X1Y3Za)=Vht` zZ@~mk;kSuhfdby$f^R_&DAn^#{%dhpQ*gmk|J;&HL251VDL;KPe1 z$k<<5EU>Y+eelX?Q&?<-ay1Si`))U_Z(b~MMKU-?gNX(YqF(!nKqwN!gUHsK063(F z2a&Hd2L+{a!-KS&0`Ue7LrL*?2ZHewX@3ASnt#%t zZav)!Kp>>2LvB62vONg7OmoIZnDx*P{Y2V#gaNqj1j{xUQGjAN!4i)~DiHt5{|6-g z6$);W!uLgKfMP_!I&Ypm2y_=PK>@l9OCf7V0sh@n(d-KLvY16_Qd|JujB9Y({S{Ul zEqR(;t6pBltP+#rf~~A%{?4*N%%1doKx+kU@E*V`#oYj;glLojkkZ*V?NB384)Z^ha{%rVyVwC*mFuAT&(<4nfVX&c5Urm!D$&pbY~u~E zjmdTx;~Wy(^sZFVTmx(a04(Da5TJsIr?~-wjaMB~WrG-V_IOR{f+Pg&osM`878-Xd0Iu)7VC@cNrLklH<8Un13T7Oer!feuZ82vjBzOXjOYe4jxi5BEssH1q zz8aRdTh4VBZ`B>mTRC!Zol;J(uC&kIA4Oc!=}7mP$x-(;M9vDp5&Zcm!lD^hy3f1Y zbzl5Wi}b)6Uk~KaqbS1i@C#YYnPG3bHsI~hO3?m%U*9fH@AXrTzl9oBh2Oyd6uO2M z-Y)NB>Pj<&*Nj?6j4uJ0C91xPA`}?%3D&dXSQ0oug9lTu{>(;*5yOMY)|wD0cJ%OI z^5tekP$W0lNcR9-NtK2_pj>Z7Wc#YYA5d(!AvzaL;181803;8DAgw+R2SShB-zw?a zk^7sbbqEBxzYSY~eF0c~6{H=xzx7nMBNkFigZ+4x;QtrQ{9iEhf5FUu0?eF#_`p`P z_lN7f`CvCC0PZwc(Zr<#{>Z)4z+6#IM?n(Pdg@aO5`(sAqzwsnl@ z&4E+w4E71E>CI^591Pa^9O>eL+8hk-`yn*2RqGXWzb$>NPLsA#1WkJ!C{8J&AUT={saZTz$!k1}He>L_D3TiVz8Aa-wQKne?TOI8Fw~ z6uI;z=_yVI+oHGW&<+YN22biN=>h5VrFB~i6AE*ck!NpuZ5cyD;+t|}tuqxPOZm8_ zcfozcStiw~()asTMs_MkviFOR!X&lR%z6ay7nj$lVp9yj^}tUz85)a~I$At#i@8V) zGJ(BUs0EO{SD$c`T%OU$^aJ!z8w8SHi$vGHG;e%$6Fb5*usEU@*wooPx@gxO>< z?A%;T&Sm5+Osgc_TdVbu>UenRWEM2JhlA?9nBUpS#O1Ewt|BjIpf%$FstcMk8awkm zx7L2}|zCjW*H5AX0~&00A;w?L-O$heFFwaY85G)lsE4 z%bY=2%p#tq`vvf^Ggu_hr8l>`vNITcf0=%-qn4e)Gn+Y`rsE9wK?)>­vL!Lf=f zJuU0N{$gF zk&t6Zq**e-XJEMQAXp{fumDC*#?$r+6(<4MH<|(j9}hT1aMeGDC*|L8pOij+L?;q2Sd6AHJ}6H1kt4BKR?q+GgTM_+j*Q9wQj6R zGeK-q3FP2f7H#+~C;QOg$ctFOu>gBtan^wT!M0|Sm0*GZAV-`-2k!RbA^!0)nv^Go z0ya)8hn>(8+GYW#3jj!NsiGa(i1>FrZk4V$IOIq0p6I1I%*v;oUPZX-RwVA!0sZ(;| zv_Ioxtq~C4uWlUE%pCOg_%@!)zQxv6<)I?9kuOK8f zu}DvbhomNIq@KoeNy`tOS24+ zES=3)zrRAGkyK2X5nyRP0uJZ-=iPq<4mGH@G0y_R#_RyxrFgLew5rxY6+|wD6OBC4 zgn*<7Ir1>Ph3-fJl6l`dZU2Itc03;&rhiQ2E)XCC)<~oP*gJHp5Y^@n4jYYg^^Jwcyu!8YObJ~d^T}>-@z}L& zu8LcK1%hS0MLFyrJmrdE(_8vjB2H~@v2@PBb^0(2T}206h62Aa>&@)E%9z`pYbWo zQ76r1+LBb^KTo}i@`G8H^MJHNYR}hd= z-Hz!n^!O$_GHZteQIJ_XQedHWEMB(Qn=ZDZUox*A@*{C8XpNxD1c{>9ZCRM6S?!P? z@!x{7k8SOY%$9H0K_+U(J)@2Jj~>{0d)2i@sDCpu+lpL75rZ`@Wady73uIlS%-u6S zgHWBOynYBtOr>!(3?Z%kKuh1;P8me7y@h2+9&+XckUH;fq{=FT{O;1G1@Zw3^4on{ zXuBI5$Y?yEO+%|@qk(4Q&@QR%8%X}qpp`~_=m?b@dBrIG3FibVx#G$pjoj5Rra&vU zb&sV4JP0t)WY&PenRYSEjE73j=venSYr`?X>ZWN8#{)Y#>!fv^x$vSkb|V0y-u%PT~9Ac0k9x|A6Fg`~fFZ1y*#wH=A2VX%DlD|Qk`w0+;mGTyJ zA_e?Ic6e5tew8|s`!D+2K4G)#N_Mi1OSQsFbtMN#=cQ2LoO+TIuIo~$xaE41GrW6J zs5qSZk|P?YQm79r0jv1zy4$-Oh5@Er)5;wWkQ1!6Rv;M#5^eU&Fbu%Q#aeseff;9Q z>1CxsCfXXVq*@;)@~U{0_Ih8y0{`QtUJYK_v{JYi@`h=Wfsr z=*XVr_I(y62(%bS4n92` z2r^MT&|qJzL=EVO5@R%JMIebBe5M~xhX%Zzrm_V;9fWL(=t{i@9p!G8k$260n-`c)O zz_hXa1nOLmV+;HN2-YU8VEW$wN@aDm+}x=*ygD^0=nXBYG;TV%1+~s#$!^U zAl(Xrb8MbpL7>NwVP9*JolfEUYo(ByYI0jk!U0KAC7z+E9zra{wKMKjVlKI|Z>UA*Pqvu304A->BYqdT{Y z`}o%FAp%Rsj8DA_RcYnbN`5AGI+5`pKSfIwvogy~D@|Zi9kigB1baYcR1*|oPyh=e zGp!9ufi%D{NX_eliVpg~X&Q_ApenmLaEQjNAt<}}Hw=T)8XSBX!v;>rJdEdEc`6N1%%f$H zREqd_FeU|{7(H;-0H?ee6avoRbPNUZBn=#7p?uK*im_b=hzCHpn5zI1T#$1xE}w0a z0H-H*xNBVz;Gj_V4;E^G;EZbq+x$Vdu`8=xQ#2`K≥SYbNZ z>d;R7VZgliIAydkmFb#`VR@=+{e&(@5m#g#flQQj{m>Gzdtq5h#u_8D1@37SaaHn_ zEDTt?l(kz1GOL=#SwDpAdgK%UJRnRRB-b}bhN-SU3d@jTYW^C)Kp;%DzF=f_&c30U z(w1!ch&R|m3F6Z(KRn2?ASuXbe8N-o*CEA&j0E7>G5%$vanHx2y@$>Zp|SW*MB9w! z0im(4Bct_0dipMCMSA+vTTicSz4dej$gQU{-+DSv`>m%VvAQ$2;%*eL-xw*bpf&Q` z05?b~fpY`j4gTem(!qh4kH}oq#6PeDLQ-<;e+ei@0CvcQ0N5#D1IK7Uo&h7yKoEIk z#F7z?4&0l}`qP0Z=yB%sdqL!p5oZE;AV?x>TKgWn8wOb!95!lafKaSnSqgml`wyg8 z@|*)BN2ZjRW&nOM+615lA_uZh!RieFsf;urLCf!AP@Nb8i6|)X9)LDw{Xomk1Ni{{ zz~zuDfKQ6SDJeT-ehFk3iMBz)30m>HY6*FE2ANh}0$}H#xg!MwOks?NNCANEk`$o} z%)nl|93W5qZwuI^^a531e4B{X?Sg zM>Dp5H4zTpSr8`Qt(yX$9@$-npZMJQa?d-LAYtU0js;vm9XG>0Aumu#sBcsvhkAVr z)un)1_L%p7i2EFz3NM+ubX6z6jqcdHH@N44Hx25qY%2AW!5fh^H&}(Gn#Fa92H2r% zZJky$PxoE%#5uM2yGt`_Z?AYwFUSQ&Q@rTLaXBZyF{&UAY(Esx5jyskw}};0NApf_ zjT2+ktZCi5|D$>fTExHpn8C95e(M7*hikig<2s@#MO^ETF{;-%w-S6_Y{dDG^WA`Z z0t+3keW%7|OnceJ$0vV(h)Dck+3KpOUFlY=+(lfO=fUpo_9%TdmXxIVEFX@w=o!%d z*;ZJ4Sv+AYkQXI@bi43{48}@`{U_0a|6W-SIsdB{G&?ToHd<7aTzA#7`9F{SA3hjy zD2NgjT5rYx6+clS(=L?bfio}EF%Rr9kENlD?3~I3)iZhylf)dyDS{7k8TUIUS#+ zw%%yZ^-z3%rNJloiGM3FP)VKWAOe2`|8eU{$WrQvmb$0oR4y$1jdth(pTurd`#M4S zC`Izy5j`hQVLUUUa`h*VQ^)vMo{p%6*8QBa7z#Z7v^EVrQfqSR%<7d;%hTmJPtvrd zI{npTXB_21?Nqp@YTS!}MjCVOhuilR>tIolrG{_f zZ3FuK2?^{^TBfi_#PDE}>SBNG|%re|TAS zn3tnJ_6{cIZhYKJ{z}6=>bN&s~8Wt50@Xl&(6={D(+EZ z(S-+1L@X~#ggpyaasRdfst%hNIk9qgS4E$zal|}tSs%hv;)uD|<@+Yzgyny^d=aBx zCGMT)(t_GSXsjIRknNBc*DuVYU@JfBc~Wh~VBc(bQf=pFn7dZm|3f*FfV#B5mw-~4 zE7{9BIV9m4(g?G?!G=w;CSUOd@>k}bsZ{#}w5jxFbzPN;JQvLDy5eBUv=CPP4cZqW z;Ew@B^(e>wW~YA>ewHQO!w|2#dbBCnuf8osWz`tdUgLnj8E!=$4~=w@yIg#iR-G(U z`O}9IGrvm;yg}qrXgT6DFtMMly?f+gQOHwU$;Ul;mgd2*Jr~(_T%+@*zcQZxWSX`k zJ^aLnU03zYJ+WUxPoO0L&+F-s2>dAVktOMR9?b+>AJ3~Ig9O%S)PMsoDjW*5`XNt! zxt0L2LeBZ|VbH?3JKVx{RASjc_vcU3@(p_Jjc|QFZC(9ERGz2XX`{a7JWfZ&+$SNF zaKrn;!9=e3jJ6(O9mV$fq*X#4A->ZN`J@vU{LaKKyW6BhpeB9)q#;bvx4v-M0O$Y# zH9b(nbr1}55}|&vZxDu#>4{kOy;r&JI&g6y3LYT1apjuwb8fs??+5jZqEn}Q^*nUU z9WN@}ughY49Vp1>CHnffFzugsM!p?~?bI!{CEIkVUYQzS*c5*H70i86{nZ0}+-O$c z*n5}P);*F-??6Q7XMf15W23~8e}{%y%E3F|HvyQOWDM`*!V>Z@5@{_{qA3kf%2zNb zHpIf(C3I!n|EGdVA#J@VGoMm@n51u*=k%3(ZQX=>#nFk3UW2BtNpGk{(vOffn!L=( z{x)|`Vk;J!ujgdXk70o$hrMYNdVvXXqcqx>?%(Gr`RvCHC)Cc~Eb0B$S2?@pd6~Jr z1dT1Xem|}}UhV0=#jh)=`4_%4AKK&e6nAc@LtXmcScjZa)R?f16e&PKPi`jR%^?z#+>*aV2lOmnq z&EkLGOlnfbPK5+4?8oY3gf4Q_4UicMiV7pY>tWmaajgZfB{p1yGPF2hZ;i*hPiErOy*sU9qiqD)e1w3*Qj(FOd_|_PR(#e3x z6Dj(R6j=b#GC2_SAVpPF9@bMUd-*kgYccenuJhnEi1+P1Z4e}!Qkl$6Up`JLcD`A> zPr6kUm_@v0RQ2xbqPWwF?4Qykgw9h5rxi@HTw3+ccY!TZ{yOSisc!RS(q^c#3;Dk#1Gc9V}4q9XCtjDuniL{&_3JnOKn%m^sXRJm47jeJ$R3G=A1# z)vX>H(#{=RAQ2z$WWzIj6)>A9<7Ky#T~s)GnIYMo`xJbL00;RYfcX4MH^W$mIr2vWvSvz=TT zBt6uy`bi|WQM0)=2hI<()vm(x>WV|O-&X60kFd?ZM!t{jEHV=NU+-i8d5}|BH1(YL z_^-q#DTV7t28uBvk{X8_oc+0Z=CQgtb&C(fXeS--;&oJi`e~QIh)LN|{qv{Y!glYe zkc%zlU-u)gVJb@WhB?o9C-jcU%jUgl-j=%E-xOr0HMKTIGZ()bBJEh~43Bn>rbxK^ z<09?$z(qb8+38sA`7t&O?y;wPTGLV4bi zfX;jbQYe5F_9Bo%C{h@N6jH2d=;I3e24OFaPJVv-n8x4r*m3b|U?=!;&EGdvH2$yF z#OBck-76WMscm$tJ}nlXFTe~YI(Lr}Z+JFbp6w}S__@I#BZAc|f50XGd`(V3Z9`kl z>nMYY@sAMWXU`m6{i$Mc{qplQv3yn4{KC@Q3880ck537qIKSw~B&6HE$kTgt9C{I| z1Z8|-oky4Wtnr0P&bjz^lGs6QD=JLRIrsr_%nm*Q6Yw{>|5d^=Nk^}tQz9o{RAm%{ zcyITM1=6(iMHlMV_P;6qzSP^vldxOK+iZv%GJW+};n#-*P}_U!$w^n3d11lNcqG)z zgZ#u6N8)UlxOp%Xy6N&6bEg=6Lt^ z57nN8P_G`!i?Iluw7mkcV##{6c?~ajoD>a)v#sF|ciQaN@>bnvy>13y_~_4gKW0aM zRAkHX$Rz6Rk!5{O#ui2E|L1o_SfrkrJyoR$asKyR5tAvx$+Y!d8_h zdkd&Io^M?gNC<%h2?PivSa1mL4#9&53r=u%cM0wg+}(mpZ~_GP;2zv{a2R+szyJT- zd(V02zO~+2i{ACsSG%gKt9H%w6y1Br>fn}D)ruO1WpGH6XUn8fXr2!thay|9y`Fp7 z05|;^50Bn!%O%XvqUpLZmo718b?pv*+72&~&TSd61`RvOxpeWib89>Z9f_{)9{Q$X zAvk>IImc%b69s)ZeAclH5P*V=ej!EU^fy?XLO>5lyShi;nP-O&;;bM>LJEHMw)9dk z3S2uQ3%eLrAu?z)n(1wBh@t_@Uz9IWU_7pq*Xa_fcGtEe>ovs!!;X=^3>s?I@3;as zW;Mq+vRD2cc=Ph5^omrFF`BK&kec5UwUOR|YGq7mRimHGXQy#J8{vt}(Aj z3ar9DqhE-X2?KpLr!2i1AHbE35?D3@%UD6LOc-pi7>D#|d?4)tBWqaAxIgc~dA*iR1`S{rs!#VFOnfukpO1LhbZ*mt zg{ChnYLV_MLQ zjTzT?Is*jp8-@XXaa`qess8bH9;fs78rbIJt1It#S_ZcFWwee(QM~yJDyeZC(FP7( zp;5PTBP%80;{S5-Qw{yJpTDQMAucyvW;Pb|GS1$sDR(kctPIWk!M zU@fo)JaSSnl(?!@+?(m3h&4aH{V?gHMA;RPLiG(FJ&{(NDngU%qv^)LtAS+ND?{#U z-14PdGwt?)k8(Kj#X*nt@hqmHCRH_ocqnyAtbEK%OB?h$;mg9*KP);Yax zRMrbqCd*Kh)66@`FarZHlDTwoRWOsOlNU1zJA#t{HUQcHYz$D3sFUas4LgD-7S5!g z^TAg;Nb{xOr=yU0Mdvil_#_i2u0R~;u|Knh7ieX$O(WnX1A~!}0^Qgdg{F}+(|{UP zIH03dHDc<7xv`?&d*agFE)Oaw0_q1pzV_%@6v)KUIV}^%F|kh+1miq5X4Xo8eq_K* z@-4mF7BETBNi<-R;0)<7lS~Hcz$C#L2;rFV^(UWFRd4MZh9s=5qeANL(-uFgvZEg;}KSc#b<< z-%*%$JNRvi!(*H@hZiTQC<1HrDC~bSR=pMtCTCST=-@1ZT}%`c1^uAsS*W;l1z-jq z>;+6?z_svM*BXLrIUlOR`R7{TOtZtoaCpoC%dBzGQUyK`O~(1)46a1ua0DZOnK0Tj zQN)44<}puN!UdBV_2D5-z}OX3`p?ESo_WV5WuR0&%cV~jZ9A@K98t?FMsB}#@B(-4 zmM(sO3_T@?e#PMdI-26`t>}GJouZ<4dUQTTqoO)r| z^UzF_P&w9aIkxUm)^2o_uo@a-l^37yb?b;h?tg(W#rxDimqxw{=%z(;vE{N^yz0b! zYC6ZKQ;1As$>R?T=kkuwkUpKuC2`D!PAKgryDng<&CLBJ_FqQORgUm zHAtdvEnbRK$bGfzX*}Vn zRFUz|(Cj?&eIaX_rX!rdWv&{`6J5I?KVGZLRpFgHaN&8uvcCCXEhS}VQdzif!9_&& zXIDmTq|To=HGcbIh4AUlK?{wM>Ym7*z#FpZTyKjSGf0?I66_t^#^!Hv~pm)yVIZyZf_9*+{(3TVcM>3OP&m-%n)>#>N8Q9kK$^O$MGC!QSq zxoy{w6va?t!Nt04!^BfA5)r0jM{f4}umzLNuL)$oMA9mdD$T?f`8nU0jCDWhxo@M} zx@zaQ@i`795L#((#(}oY@4Y&C>9lhAet~T%i{rNZ{t%%vlm3<-KO%m<$%GYwP>Yqu zz%op1Gv`>Hl~Ble#dT}Y)O_?7_+LJ%IBb8L`h6}w=RWtMWPT(KBIxtncw3aMc~azh z^zckCJLH5a)v)HhV)%)H@t?vSr6@<$KVLk_BkKN@OsW2vwI=uc6Rco}yJ?rAqv;@f zM{Cm?!R(*49%*A5>ip6>baX`I z=LreGxuOoqNVD@JwqIOA6b8s}n%-RNK4QO5mL9^racomU6Hjv&g4&_7kdj?h!>V)ekk0hD~NPO$9_1I&VX%ZEC;;SnBOhEiI68Q zsP+O>0}5G+*Pejo2P_d_(E%Hj9szX!3oAsq9t2onpi5#R1jVS$@_Mc=FYqnB>p!!8 zl@Iu}S^xdvv<3R8^RGi`4C!72H1>ZzzO;d^ulV68$rrUF(fxlPL55r=LWrKe*ZQDE zCeS@FE?zG|_rSOif%8Ry5$FZ|gcVo0Te8;smqZm;i~e$wZzrUhLn|4V8A+@ev}l~G za|T;=osiiZuMCv-G{F}W>GWD>m*-k@ME>u><>^nzze^JeuEXTt)&w57GWTVS<|kt*)ED2h@1d0-Ad z@vm(^e*fCkJ71Jy4Kh7YHgw2=NmpI{R#yE~P z7W>4QOLP+sD~lW{3675I*Hf2h|EfzzAM}6wCMHLsnStjQltNP~f1=>i6GhNMUs7;R z*4(#12*(rkGHTbOcAxk2Sr*EH=NV1d62nMNFQZ~I6o@?S?gcY zOhlp^-s`?A|EPQ7>pt9a(znO=ZQ2{DbNMYD3qJ^czD^&UlP8VDFhU|oAC-0N#h5_0KS(l6}Aw|_TSu*v>jlXD}* zC6(6xy=Du5uq*&*Zl$;e^8l~{;6*V2)c{D90dNUGSQP-=cR=UDIOsD+oe1{lN`zXn z_E%I>vG>GTN>XS0-k<6E<)D&vWbONuQ+5euaCF8?C}Vaw#xY^ZP`OK9F<7Ea`;1y-7NxM3Dc(CR@- zbhM;$W}zf^@puj-Yd9+W(daSaD?Chm10ms${vIY0Cee7P$f$OC4cJGPWHz)Opx8fD zW7YrLGd1N!6e2R#zS_MR8xxag*lu`y!OQk|~sY@q~|_CWN?P9#vZ;g-$A2Yb19 ze>qV5b#)` z?m2L_e-LsN=UCr+*U!zf2{lNUfq;#X2Uh_#W7^itA2p@RKus5>R(BQWSxkDD9eE(m zT}`y#=aoZx_euOxkzfw^;}@8TfqoRflp>g`a4=|}j)A5}9vnLwJZ6#JMMNGD0hC92 zC&yjw4T>1Js~>?oe^^pNdS?xia?-o@oxX>l$O9PDzT5YpN-+0WKzfHuFlX&(&^{3Z z)fT@*BA9F6>wAz9zdYuy768Z@C~1jbK90pe1;7~?Kz212y4Ge<)j~Bo)7{dyEZK|( zy?)59K8@Z|oyvD9T#q7rM?SZ8Jq6W2+pHZ3bzaDh6hA(G@Z=t4pR=?!X1>*ZM2gKO z`_{0du_tdk?mU&fmSg=xxLb5ZBPcYitraIYicNJ8cndS*0^Y*tVBW$ufw!=_ci4#* z46X`>gTSx7v&_>Tn{oo(m)n>K0OUo#Y2zV5&<8im&D$i5;9i;GsQcs{LfNHoR_fqL zuJ$s|USW%S4Mg=S(uF16aPTH)j>a42xzh_nzuE*(=WHDRNu8{ZI@m2xbVFB`$zRl zb@6~`{0zE?XJ}^P7u5?0=01(Lww~4n!$z8<6C7qHOZXR6Kd#zo zO9?D$epb|E-N&Oj(jh5#i+IQZX7A*yAkKnF&fnw<-b-4qCQ3eVXzMU*8cli7xC>l_ z>5KPke}>+6WH%qHCERrVk`ptou~YcR^PS%MBF3`ffr8o;B~t$7HFtAS+~%Umvf@#z zsI6^dat1>^BiN_cQ&{$yl*R34+lxyt56!nX_S7j$ClyJra;z#cl+U!dq|nIWpEJ`a zTWk;id)Mz%dH`u%9e~#7?S4qZ?evNMa2}K;;2-3S6%&DvlpmI|BiP2wwvTHLU+vAqSQ|)v#Ry=Gf%N|GYf`Lq0q8;CXuQ# z-aw|GQ+=aHv|BuNb01G$v=MQjdq8wKjhNl6Gb;9wHh_;+o`sYDTYAjRE_j6;62Xu^Ua*UeOL@1=TF%=Z_~c5IXUYBj+>+G9D3@y zMYqbLhHol{FRs7sQMSJEwDd1+ zkKPS;`x2v5#x~gZ{YZ6b_SH_-9g||)(J5RUsN^72|yK2`(x$Y)T zosCD9Ox4&w%O_-_b?yXIr7gDxcm5*IF+tf|hI5)>=-!DC|0VCtBd=uo_67CBC2Q|x zG~#2gs(W@j^X{_{?nulFvQLwe--`}i3B>zLRVFW6%tS3mOI4JP_orNS6k4@O6k01( zB|sJ%bL!5GfVe^(5Hs*+CD<2?73)-2GbA~LTaLj+L9PVv&D^zvn%mJ{)$vtyE$IXW z?|HV;Os$gSxam}Ua&!qUTAta5b0s)>;1+>3k9U!aq(JU2?Q!`xNhZFGd%DY?&H1s; zSShWmt_Icy+-=MV%cIfF(=ZfBy5(m;F`>1Ux6F+}nE;w-Y_ zUP|RenVb;}kB>DCUyM1lpeeUwB|jcNjz4ULRQzwpy(M|>1$lS6e7~mW{+Bb~|KK=# z%iYS6l8!=Rk3=M|z`r4-C9gW%Y)1MoG|?HCu*jD{L2>L+vi#4})a=K`)`8K%OwSL; z-d2e}^`9;b7kK>C+Hg4^e~`Oemv7cVU$WlWtm#5v4c%ZW^M1W8iWKqQm9`$B-!!bD z_BL!EK>O3kbG@%W(j5pPWov!|u3sM$UFcosNgQgVelKJ`{4y z>Diu`1ckE@QjPQr+EP5}Htk1uAgJ9y!Y?Ej7~`b78E^6Gd7>p?W-I$Flm(AUR?3UD zf~f9a1tPW&HW*0N>5>9!`EvXB^RNIp?ziBpnqdokbGL_pZ|KF0yv!f=8nJ*pl(_BZ z{zbVUz((3lC5+&j3|^vnHsqPtN-&kzKKRBaY(vYE?G-reHm`X}P`tsNn++^3m1tGqGQ^ETdKhdZ`i|GSKtzjh6IorMl5!8VeG z&d(Da)B^!fy#AZM0e+UV8Dtzhc&2D=SkA>091Z0i*ceY61o5zt@hm2z&aLu|woC-} zqd9Za&8^C^kn=3=CW2DBm;;-_{TPBHR`%+y^kq?}hKYU@U^{5V9)uw z7mD_nx3XGsOYmR{n0@E#ZNPLox~#|l5@pYHww?;djBT;_07O0w5bV^LcFTz#0cp-f z=&2tEWwhB=%x*7`w9|_*3FwkpH4IAi4%;h^9~k?4By>2?OX$x`p+TvG9Q(uP9z5t; z#hxPR#`#f2_J~)n9Lu-(b4KEq#Fft8)%SUsJxE+ZL{FnEs}?-n>l$D4BRWe+WPIZx zBa`bQz>K9_LqqOYv<-SnOd4Cb4ltHo(6=aK)iKb1?pVjNF|S!J(Tl0#2(^oK$dTA5fcafU4uy zi07!ANiI*^jM&SueDPGP+0r*ls(}u}f&3?;AN@|f;F#kQPG4h7>NCDkuYptn^9QfS zq#2aC{oSo$8X}p212f)R-8w}z>$ADJ)#$MrTp0$Lp6J5^Xt!oxBb#SQYV_VeM@8rlp;wAm*UbP=`gzD zCJ|rW{gFup*|VbUd%x}%8;X^^7FMt(7xAELX=C-6HO_hS z*U9L^=yd9?Oxv=Aw$Wvbz!G(rC>#IoT+^Zz{c6czb!VwprIw6!Kp_p$tt(wc{d?_Y zdd_aSW9{+i7h9{LJ;7!kfBdl{6g(Spm<;cJJ{SO*}i9Hk{+46K#Q|?`UOgtP8hk2 zjd=k@jt;0H7zF_oB_E)aANS;~Qss>2?AlDM-k<#Q%md4V0m*`*coAnHZN@KbN}KLx z2-Tc^?=dd|?84*Fx~V~?C)eLR_rjAtX1k^ZIYIRneO=H`Vt&X$Kt=jCPTq04p3ZiJhTQf`F4 z|HgH7*|Qb(PS3dn#@l&cH}yL|7FF=~@ms%f-IP22QTE2w*s{Bi$DCGdSxtlKOx8Il z#<__vyk!FVbtByhgY?)T=#6Wk#_v9!B~r2FT?&{=NDS_<&9OsbvvG0BORqUfc{x`4 zoovb!l=Cqx)JNBy5TkqEbAy#Ct*bl24)M}`>KPzzrh({Z|Lf7;_BJ7%Ay{R`-s0Cy z?1A9;*qNJCyi{LCZiVj(;`#sE<9_nOif4S~zIiL`$7n(jeK27Pv(9eeuI4lF^a^cO zPyx#g0IrV^&tcb$is@$YyxoQE_x;Ud6-TA#njAuA)hNsEWlxLy-6C6O#G_LVOifs{ zEGtx11KgcZNJ)qFg2Gun37G$s-W}Fe_m!)r;|?Z9`jg|%Q(i@B=_IPIF6ey==E8dY zeoI<0IEh6K?6a7E5E*g}VY^DF+P*nt-qA!j=0I;U36JJ&Cpe~OSRU>cz~lQr-0$8O z6mBhH@TxlroT5Ee-kmzt9#lbYYerlTY2EKzE*~m;N6mHS^tUf?(;@S!m)EX`(63RM zs)YwgR|ctZJEPW=<12ed#>?F^zDiezK0KOpry=RIKdvZ`$_}o7x7u&t|7PAio4>P_ zacMCTPf1u8T^O%@cib}P{cv=>e*mJ8Rcq_4yAC*d#%)v2To`5)YR+7_e%&5veBC)h z@Tq)1thLg9`}&9^*3s%wu9%22_BGF1qYg+TjSIH8G&G7BpJ}JyWmyP z82xV(O0)eN5lgoJw>N7?`tI41ct89B~=Kbc4L+gN5LPQ7L_}9VP38jhq zoH^3_+SA?%Xj)$zlIvajYW1km=FQD}Rm_#gW7q>19o+&g^fUV$io+O0Gf2bbXN_jj zaz=^W+&X*K%}7NRPKI5W+0XVOJgb zkgXQgA`$y#fm>1g`_HYPm*0(lKidihK7PenU6=8v41D%cU&&-}h=3dhD4M==6Bbb% z&^U(C%>ABP4@v^U4|3yW*SS4kt&MKL(|68<5JO1P5~+xS)y%|kzNx z1fYEzjj=BNh-A056Xq|7+l;5wpNf=8^sY%;dDE%pi1%!&BZfomqWsS!QT_UMPCi0x zqPRLDSw%!GiiGwX)925j^Fq_1OVi_R`nY$(&S>?JqEWQSfttC3g9q;1#^^!t5TJDY zOG57GqG!YiA!cyzql;wS5%&}eU-_PJ{gb3|-8SHv#JTJ28y1{cJpGgC(Yh?Ib4Kn? z*5ziucD~I%>C1P#y;U5Pd#TO?b%i zYdWrGS#c`_btAYP0I`@+}5&n6$ED5*0?vp5^cX*v3y%KCUw+L6{XsY(Y`0JK0(M& zpLh$RCau4XsGuFl+_!5|Oph;(*L}C<+>5qkl^66_d~vet7L(4Aa0C9k*9863e9@mB zRAA5c&?t;`xcGeyb$GkwY5W>j#bDd1M|$RG-n#o6ZsB~Fk$dPuj0?ohy{#Gh@&hh3 zpZvk2E>oE1X<1E=>P)GgYrySe>Ox;Gomk9AFhMG;$)<80MRQDj4`=ZHT`cl8LFVj&nLcIX?Y55zU(cv5Z0YIWzr&Sbp1omL*FvxE zF0hq+@pJd(n4MJ?Ue@N~{F!raEzaD*r^{#a-j;m#R%@3>rA=8C5AyJ7FRpdS;r;mC ztPQt~ADm;DZv(UN+0aUB#)`xoao$NQt-K91Q`&5~T^3Zz<%ZCdJOw|k#*0>Tz`Z>; z?6ItevZ%DJIXA_yX>mS0PuFwn4})g*a}TQ1o0m&ET!h;ck8C3@=MRS~U*gRL8%cc+ zoPYX!%qU~n_b$lzB>G9Xk#}kGk?uliPY5l(|FS#jlW&BSDRm<9_u0OrgzA1BgZ0m7 zPVE+?68U{%0j%HqpMJ8?1hqC8DiuiRZeou9K=xzVQwNH^2ij2=^C6QdVok`iBW_aq z8qj=Bu_L=TWM?kOwLp0*ZSXs&ieJF z4izfKPssB#VaaYyfJO&0$>c5mxjf8GcJ8A5@B(=okhP;he!bY26j+@s(ikypN|j0d zdI5}S3yR)#f1C1nF6(!xq4T&K12aAR0SW`S0S{(uY8kHA56o}zCO)$(Qq@**(QUH$ zeg@fCfmMb&TWZuz=75hNE6krgAKGWYsgDa z{|6&B7ckXC@=wRcJmN0?)iD!XmG%G0cxhCtb5NRrX$irztp1m!{kG^g z{C``Sx*gfMD44lyX)wJo>mc{`jX>EQ+Q>wV-v8;7O|u{a9sNnOJ}!PIkX&8@KINfH z+^BKmAVSNJFWS=EqIHG%hY!{#(H+|~yc_)|B$Qo2yafCk$$EXKC$!VAKHGP5e>5xq zA}%qEz5l$pQICKmo%V8NUU+2i@Fu5C>O(a|Y;il)PWe%7&Z}^r;ZW1}ah%@Moxffg zDu7eBr*YB01H$-TfiP;CA8JGw0uaNQo(4hw!1vf_)Bbuh687Xxmn$2bJ}*9T&pNyw zFCKBv1iW4ghhVtzlix1Z_(2P#KA{A*IM!B=&RA>_DFNLlUF`R ziGnR&{Vb@w+k5XY(a+fv=FX|llKY6Zus_u7PIOI-F59>x{g%|xyBKlbKeI$-}5id=;#2FLE8$2k^dbLDIpQQ8=J0eF6 z8h1$wYJaUZC!0KxHb6h0j{T3$DU-uG$FfEg9A^Aqdseeb82rLSi5F`Q^w;)AdLydQ zMXbAKl>md3Kck&0`FUo@{Z}K8mz45YVtfG zSRoh=uU3!k1};1(`3ZBHpbTj9TQ~xqY}WhCR~#LhA4#9g_Yph4ijXlO4VpA$WzIrn z=+G2fhs_aSUz)u4pCo6c&qSq!pZhYgkNbM!7fTG^5OMU->RE+MX^K9s_ zULmENSEc^btEY$grtH3<9%746?2*BVN&Oc^S=qBA-hECS2h-{C)E*Da*n4llGG~Rn z{G2$};K82u)IeXRS?nX~sK_OwFu&78VINRQieMWqkV790_9mv!u)VR^0QMvHtTsky z3jsfIG|-)xK1<=hT2*puMbzJ6h)13Fq@Z<&rud`z!Z-+a!KX7x242aJ*$MDM2_Gkx;Wgamb8&Dvvx7q z(~+!;zZ@vL0#m61-lC`Sh;x=La&?++j=UO4ZoZUqJ+Z!RGA?iN@*_uX`Zd6RKjYET zulTzrns2B!cWPsIym;HH0oO8zjDbEQ)meqH_xHUnP2iRhSMR{m+>FH)!B_N&%H!AbT2dD5A!z-hZdj;BLj0;zZD-<{G zVghkA8eAw~aWqIFz;HkujWFX*1`tQ12n6c@?D`rA)&b&Zd@}B&Bc^cX^?pN+3eM3L zel#nSNdcl$2o*RV6o5tpb-;|pz!nu)@z21j1~ZmC`pq89nCq^XlwyiwE=w=7&uO(H3WQI zFgbuV0FguV!2&pyc0uYJN&NTxeKm3(`uF_t=%~wN5T>K{{?cGyUrX*Iv|kM$0_*2@ zJ_~&Ya{Dh0?%Y3WeFT6FGbVBWZOB5Cu5%PxO=DJ%Us5z}z1x$EyD$abS(~p3-%XWVuU^sBbLftK&%gWt99Pf`*bwlVnHUbvW2QD238T?Kb4tHJ z1+cB7#crAd6k^P%t>|)d32PdAf@nFH)p$QjtOFuaAvMrUX;{dhol_^*x*z`MIQWl? zI%~Lzzr|%jZpWCtovSHw!Q;-ZiUO}|KhT1}$;A?gX}gIioQgEqoQJeF)2e?JbbNd1 zeN|IgHf~AtCVazu+OvnC%^XF{k+M-?;;g-|8?Ir@U zgRfRd$nHrX>TalgDTv~W2~-dFr#TK1gT9t}#LrYMCZ~tnC_Ez!@exPC?nvM ztJ+3NZdcx}Ahft$6;41zxtg1xgx=>a8SNwWVW?j&9WseWrK& zcTQm}63&EYlu&TNRULjlWqV=n7UY}XgT0)tr&)&w`QJ>VuxGBm*n0lANhVeKF;@45 zXHG+#-0PXEkhNQW1G3f{IGEo|)9; z$1I?*prLIPw2=%76*X6kL7{YQn}E5QYN;qc>`8$4*1-bHkNs}7I@Vzcwyy;0K;W;Z zCG5T>OX(cjQ}_;(bo3b9|fuxj|*3^Z#}n+YX5pU|>@z@y_LnC__rT(=YDA93DMxz5Zvx6%4>-xb02j`Dw6vb{_{ z%OvRQYF=x=_(K^)NRoE-LG$@`D=qOiYutCZ2+1#2jyUMQ{U&(OPgPFUIX~*dglan* zNcx=cRExCs5;Ts^B`(^#!A^0)V;5Bu6?<$ie&l$m0N;7s$2Zcp5qV#Ff2g#m;W^`* z`R?5pm77PM#boHu2r}n149B@@x`i`7ZTHA@zPP1f5Pga=)8i~9sAcmNQS>*7a6!0^ zub&_@NW|30Wb#YOTFPUC;fTfU0<0y?V>`J6>Ls*=TyVOdbhWvqk%y#$sD1I^bjja5 zfh+iyM+ZxunuHl&VY*^0Whz*+H_ZsFXRsq8@XMh*_0W4A+{Xf6s6d5b)A z!$v(7fh*pJ*N>QJK001Nrsl)qqx!djwgoyKx%Fg?ekwUEgZ}9|Gf#||Dttk~xdepg zR14g2@P-;svjk|z(#JC6pAN8J$$6^~?|Bl1vhGJw=$6{!acmdOll~r#KfGosZKk=V z6ZuF`=*oAQ)?ewz8CjD5e1H6XStzqij^Hy@72EGO7et|dGc0UO3CSSx-(2cR%5fB^ zpLn#u8!7m4l?0mD?>f4WI+#ze%CX~$xG=0!wVh5#wQGKRNNjo)sJn9AGKj6AqHibk z^Vf!7E)NCnyA!6yzi*=ZyMN@eEgC9+IAhgP4|-2@H+YC@(36`OW=2@=MGzlQjCWd@ z6mN<2VK&(1OC{=Qr7qUm*AATDU4EJPydSPlI{+XBz_+uDf4U=MS2uGWYaQAP#-(F&4bxDhH=!rsK zEqZj+`Rk-{;6g8yHNTaSwuCsh@J_pR6CgmqCz?b z3@En*?h0eQvtfP@zqMbV69ARWN}%G`N;UgN`USUj_M))Mjnm_&RpiW9$Fo6%xRLQ1Y+a1dIh&l4`DHVmPS~vb$h*|64>56yj z-COUb=XQ|UU{S=kPy&J)XJiu;`?(e!!6daTZ3-1gI~i@d6Ma! z;19T5XwX?6WerodmWw|Ow%i2~rroDC7okvi`>big(!Q3pcg;nim0Csi`#Cg8(e0wq z-52|nhyum!xYIrS1blN3P7B!+aEpmMV!ZU#Eh&CHua~mKZ3H<$hdsjb~tya z7Q8r-5zxo?-vGRtU?7a%5 zqD=6oT%=Pf->#7DRr(Ps8*pomy>~@3xl$zW4f3D{$Osh4KNfw2zQx{KDUpB7`v|Q; zxnQ7~Y*);F$odFX2)Kb4%0F4tV7r}IlvG>|RJ>`H~Ynn-K)$9kPK>TN3 zI5HJZIT3v6J<1A!jRG>Id5b^L(?>dg@k+`RxY0~L!QT54Fz;1fglBSQAD>HDB;WgH zZ;)V*7d`ZjPM|Q?IO5Okdn+X3h)b6QmAD434o_r1pP)Hsu6ZL#LVq8*^BJ95 z5(JS&ZiU6F{BUBDkq9_%QufU?#V@?s>3cJbD#gVvp4_D;o6x~4{mCZrc>=@*8h$US zd1~&2)nnVVriZp}(%+USteC~inrBt3yTf&^NS$;2;vF8kC&NT49PiV}wnUlb_m`~_ zwF$YBR-Dt31w#-<14ZeDiqne_f9lx{^~PNGLm_g+BvSl1grQdvlJHx>J$Z2UBKn_w zxN?|~IKoP4A}xnI-lmfm3k*&SalR+j<0ClmMRWS$&o|jYxT|}mj$roWRV%r~S9FI; zeS(8*w97vDh49cH!gDGOZF+dWt8{ce;Btua{VFvoXLy758msI3%We@ya$%-ZseXCs z^Uut$Jpw%DgGSDZ2#*jG(`_Q6F5mUJI%d-T+DY9YW9%rQ!p!iZb0f<$x6RTCBShX+ z55F)UC-t4bXbd0dzLghY3^{x_cWpM9UtX6y&sM_tf=l!KJYET7hp3o%jPkQk(yUZ! zP4)vBmESBs)_Jj_JS}-b17`UPDXOn}kNrTfV#dE=!Z-Z>`rvmkh(`W&e)ldi)^10U zPH4DJM~IbDl{r*1-^Zr`qg&+}klca#~Ykdb@cfvE<^=@;p_PU-5|zMGj7< zq{w6p@Yd|887?A1fKB>Jq4&3h$mA;+#XBT+{(B*pa+#3t^l~TUr?^}TpWE8uIF@x3 zVF_P7CEOpH%fb%k=5VK+=_5Hge&mW&6I*4a51n`vzt~X@OnuR7f9cbmJh1eL5IDQ_ z=>3Hne|Wa+-9vn>hu(rz7a-k(ZCv7i^h)*Jc|gNj)_NCq?^9>i*GO9U<(xb1Hr*Ze zQw?i>;mtH{Px4sHIbF!`Rp0U6h0~%D+Vx-~$+4`5`u8TR9AHOXvGcp-#)(D`nfLml zeE%wzbqAH5{p65c8{hK|vSp1TNiJ%;iI0`TDJ;`3ubI6iLN%hKkNH})gc|;n`!Ju`5#Ku>$aYXzqze=e+}5;DZE9PUU#k(~ zbT0*Ao5Cw7A+p7OE!D;BI8kQ2`Fc&0RLkUnJsC=&9e{tPsU+GEq2QkuR`UEOli3%0 z1?p_hh|` z;*ft-nBaONVayvH*}#{ZWhPYwEgV9e#q-WCztpcTUu@!DqQ9`pSOrRKKxwX^ zxkN>RC?F<|_(wt0Cya#8TIA37i&T*JUg2^fOKQkR)$~bbq0KBylF8tgIu@E;)XzY8 z%Tf$lE(~vN)y3KO;L1qfIvPyJl-;y+z=y)U#kTw%gNmm7boQ@{s1GWdIsknzpaZ}g zF#rqzFo6M602;PDgS57UjFL;2Q(vukCJ$0OZZFq;M|-A-k6vI`N8`e$5LY`3i6 zCmbGR8b@cim*bfZ@&8dC_u2c8a`miav4FyNeuwYV6M62(e1Ccjo%1@i{D@v1Nt`Tn z5FmRoH;^hc&+J!Bk)^SHwRhJ0o%`{}I#&YmzDqRS5O>D6=e4p$nOu|Hga$9`Wq&1g zmSHg#`0Rfx)JJQSZ6Hz{bL@mBb(Lcsi5FZX30Gio_Wa#g&Q~dbJ0OCO%tQq5 zHb{tzd{b+A6=P&CDe|t9L7~*#Nme9fTv$Pkfwg3HrgwP5jB}q@jzq|cTyq4urE0w+ zFgdqFrsI4`0w-oTaDH%=Rx9Hv#U^4LB_`^E2OLXO~p! zbIE8jp7Gq>7xBCw%n|}35sh(xB{=y8AsW8{AOV2H_pV=Tuw#P|aftyqi~$S*0NnuK zz6Bs1#=LR;GFeVtWl8dm%8Vm&Rty8}b={q$#Xb^JXj(t^{6U9r&PTye%j3U-LMsEl zei`vk5TP_kC~nGVug{C$QSB&j$)^cK6sU4|;b0%m(ucp{e@ZwKw&u!-6uQ0YL75R` zpXx%m!_>aC4IRb5%Dg#i|HB!X((cU0MilYsem78z9Jq_h#q@5Rbs@p%` z4O)6GcHP9aSQ(v(V}5g#zac<$kf$aBLXDW3dr}{zlY8wloA3+9v{3%?><-n_)$gz2 z=}4&&Qba!+V5It38%e%8Avh%ah}up~{eGdTsDp!C)IbB5?YtoG`5xJ@y2!>~j<8T} zL(zhq5!IODqBvy(nmuXkw^6y_uUWgANIC#4<&irQ#sr|7pOrOYFRS`h)a2!21N=fY#TmJB;!LZ zQe-J?i!=gqFOdAT3DkAS%|N8ir_E;fl#*ZQQ;3aA>KHFjl;+vAE286e_Ob08ge#)4 zb`P=r9DUpa(j>eqqSsU15NU4z5*!C542ALGJqC?Wq@TCWK5XaIE+?yOreKcN@X{m* zX(ygTYEu|kyGJziYKX<}=&iaXBL9dUbTiY1zFk>G+*PWBPS%&`$(TF4t_C~Pjms{s z)QON=Xh|sz{i&OzDLAq$(~_z;ODHF&HQH5Yts;`q6Nnt?GRj5pJm1f`C}9|FE%+Pu zA!4SH4Z3i_AyYR&B4U*&$;Otk!dDOf+X^=~sCW!cFM*JJ-kpi>lhW9HuEyf>+8N%Xf_If|-GtCfq-*3@D16PB4d!_y5^1gAPa^-a>HpLdkaYZP+H zuJpF+pO0S}TfEBo)JpfUp1uHwWWn5$4xyc!uI*7$TBsfEdeiZAN!9^zkDrnWQHV$W ziamtd$7wbbqRG>uvhBWn=KnL5x@#~iQ~|lr_IGYwFLq1UZAGE#39488~!3+mBYu z{90}@OMg0v`_+L1`|&C1l4cz(#*bQXoXNiY*3|!fShjO1W^s3CYPq7`{hJZ|yMWLx zIzNWL$;@aRvQJL#f;#vz3S1F-&Ge$>ayFze#A!GPw2e*Cyq>i0lX^?$s=e^2x=TG2 zwtAqJB|v(0?Xghqg&mkLfDF0s$yDmjxnQ#69i32y)`h-|35U-{Ak`Nvvgvz+LGzsX z**6r=aCqMpcO{Gl?@Sbgp9eaN{sY93+c#FvryyH7?QNl{VmW7MsW0>@2N{vN;$yyw zA|Rc)F9&WyDr;p=Yqy>bQc?4)nq}L`X>7*2<5{26n7l{5Rc3wxQLfAg{j$x#S?Z~o zHu7;DIGsuON{+za@7!$Ul~u%Y_M^3b?jCH ze5sD9iggl`NFgS=F)BH~z}^7Hk>QKN?|Xs7t10U+u?Q1WVk0=Zi3v3U-@ch6yyeo6 zkZ36QVOtvz`^`KSUtEJqvY{Y9rY69lT|U-kSPestQlv9hE@czRyL;F5dokyP zk?AKDuk;Wd3i|#1yy-`U%XY`)X`3@i`GgLKD%7V6kGx@_#5&7RkA(bE#`e2YQw40t zx2cv4JLYcaS#!mdg1a{d2`5`kDTFO8b2Xnxhv71*)%kzYZoZf z7dbUsd%)%5pFBVj0!mmMPz^DFGRfmPYver(;62OdJ^M&_^NH|Ao$yAC@J5C3Mwak~ zu*$Zo&RWV02`9>GF}zzO_0sTkY>Q4^y59CDPL$<*!-Z{-$HYq~TxE}`gA=KWvP>w$ zeE!T~xB7-+v&6fy+}9Rhi-k?5&9BN8<*$s)_b3hyMfkR=;s3R|K2Pg7ZV6IHb}kDe6Y+jOxz7GJ&fY_&B41Ti%Q)Zj zr_DBz?1U0;EcKyYywO167MetJUnR$hUc*QwJp2Dta;D)> zw|g9yHHwg-WRFQS=RsrNJ(g^PGRBaQC7Bsd3kumr%2FYXEQydO+hE36#+I!JA^VK& zAw!mAX)2RC_jJy=&N*++b)6T#`}*A9|L?wE{IBc2?*I4u;@`e7M5ecHUhMQDB$@PG{7Or9aQ8%{C%~!NO(*hccaRm?zK-C3+ zBY@R&08RlYa{{oR-Qxh@{Ya8ZeITO50k1f@8Ci7B8UeSHay1a#K_cLTp1MOOd5h*; zdt+TP6+JFXflhql0S=(-LD_<`2KBlQH>RhUW{C$Urq2k`BET4t_vE=Qo>qz1eb$W< z3Gx|%4;QGkEn``S0mh_}DQ!89ot2+$?O4uU*MAR83~(pN z?SYQvhpftM(DryLny>m_E=Gc^74@gP{d_ZaYvN!icp0xsVe1-p#a~nf92+Wkd%tZ{ zQ=ct91s*2rubE>+o0XefAEXWzot8NR+=(3x%FjwzIkI-V6d0NpZ=Xgs#qOqLvrqd% zZ16$m&>A?`ysQAG>?6bt#xBW*K`>kntINj-h->iMnVCUjC#|SO@1Y>8?(pfEmunyy z4-8D>`)y3qg9@N)NA|vd^tB_aNOl%Oj?0K+wSaShg4{US1i(s12fo(;z>Oqec+PHC z%@I|A;knq=foD~KuiI_Np#vW~LDGyvgC?tF(1Z;!p4fuJ)}yGb&DEXH)*ZqZX5)j$ zaJq^60!=4yb1J42fnJ1s|Cx;R)EXYmFSSoV$nOv-+EYFmSY4OC_SwLp%(u4X-f29? zvFkFu1VN+FeYK2j-n(c{?3Hq*m%M!E0gM2+djY_Aw&D#y5egI^0CoWQ{5i2xq2ZQK z&nfUdLCalJL)+I$Rg|NGmB!z*2Ps!DIJ?e=a?XC84;6L3)}Nvjbi!0=9E|De*q zcsoC7jq1@%FRw3|+RhzYMaB(22kIl*>67d0dgr)5sPGFOE5s*CVP?F*5}UinFg z=%GGqUs`W(ywsf6IrI}b)Rz~ZrQ4_(8`~p>@ri-OyyUP)c*STz)l3RSkIXHp#_o$M zW`i<-P&Oz5uw;V*0C6_R0$_Nosn097RO{vDX0cYQ5>X>qIdTST@Fa>bLCX7!6tw-5 zXfntX<-=)H$sdp)=yv)OEMK0t$V@6; z+6@U=8`3Cs)~+Zm#iB|JU64HMyO$i1-AG&hn6ce(PcI1X;>Ba?M;9+eI(Efe43Vb7~og+s*foaWNE@;RKW5XvUba<&4(5D5Y& zcb!r_XPcn_(d0@8UR8Lic}{@4P6J4hfk}Wy2B{3i=vLy?)4@wQru;wvpaX2${*F1y_4>+u_3=R&iNRxQf;3sB@nd4f62dEA%c0`vwobs9`Wv-@xXW%Cre#q@&0n#k z8Nw^{;;6ZK z4`eiXzHdPfSS`To-ywC_;r|_~!msE*tUF!>WWaqsi%C*^!_*JlRE0mua;;mCQyV39 zus;%N7X=4vo8)O3+UE4FVA>dkI;)|&p8_K%*wIPO=EXR)xi2jPZC-)vVZq4wv-EeL z+%uAvYhaL8KXDO^d+Q6f>`2#0?yiB^T7X^)uqex7gqG0+c2cIm1Y7+|5)kyWo9_N1 z7M*ykBZAQ5VhWojAssPPEM&y&H+LS&ZZDAd7mzw78k6iRCS4`HLSgFFujz}+ zr2B6^m1wL}_5O2cV20SscTp;z5)q|#L~x^oob^-L@s#(-bqBp_S8)|H^fhoPUr+<&VLHv(0M&8|_QENiUU^L(6z^}~fA2X+` zN?O$U$)aV~=ZzMA=>3*A1i$GTUzS|O%WH$3ntSz>rU?*j;&q!CdHmvV6?!Q< z08Vd%O7@465-rKnxNG4-nUGuGuOBX$L}=?8YNs+q^3&dGJIUP+_Za*6jOX}_xR}0V mmsQ;8Vqx1!AtT8rjJd+L5+Nh%>1p-d=>980na6kzbNn5zQoU9H From af8c26a4a579596da669189fffc69e8dfc665aa0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 28 Nov 2021 17:18:37 -0500 Subject: [PATCH 723/766] Remove unnecessary version check for minecart furnace icon information All supported protocols are now 1.17.30 or later. --- .../geyser/registry/populator/ItemRegistryPopulator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index b0df6d051..340c6a45c 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -465,9 +465,7 @@ public class ItemRegistryPopulator { NbtMapBuilder componentBuilder = NbtMap.builder(); // Conveniently, as of 1.16.200, the furnace minecart has a texture AND translation string already. - // 1.17.30 moves the icon to the item properties section - (palette.getValue().protocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion() ? - itemProperties : componentBuilder).putCompound("minecraft:icon", NbtMap.builder() + itemProperties.putCompound("minecraft:icon", NbtMap.builder() .putString("texture", "minecart_furnace") .putString("frame", "0.000000") .putInt("frame_version", 1) From 2ae34b69af7d2f62c91e1d2e4d950f944ef934f2 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 29 Nov 2021 10:31:31 -0500 Subject: [PATCH 724/766] Some command framework cleanup Most notably, remove the synchronization on the commands map, which is unnecessary since it is not modified after startup. --- .../org/geysermc/geyser/command/CommandExecutor.java | 6 +++--- .../org/geysermc/geyser/command/CommandManager.java | 2 +- .../geysermc/geyser/command/defaults/HelpCommand.java | 10 ++++++---- .../org/geysermc/geyser/level/GeyserWorldManager.java | 6 ++++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java index a2f3441f4..de66c2fe3 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java @@ -80,8 +80,8 @@ public class CommandExecutor { Map commands = geyser.getCommandManager().getCommands(); // Only show commands they have permission to use - for (String name : commands.keySet()) { - GeyserCommand geyserCommand = commands.get(name); + for (Map.Entry entry : commands.entrySet()) { + GeyserCommand geyserCommand = entry.getValue(); if (sender.hasPermission(geyserCommand.getPermission())) { if (geyserCommand.isBedrockOnly()) { @@ -89,7 +89,7 @@ public class CommandExecutor { continue; } - availableCommands.add(name); + availableCommands.add(entry.getKey()); } } diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java index f66e8494c..5e4fe3dd5 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java @@ -38,7 +38,7 @@ import java.util.*; public abstract class CommandManager { @Getter - private final Map commands = Collections.synchronizedMap(new HashMap<>()); + private final Map commands = new HashMap<>(); private final GeyserImpl geyser; diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index 4d4a21319..633912300 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -25,6 +25,7 @@ package org.geysermc.geyser.command.defaults; +import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; @@ -60,16 +61,17 @@ public class HelpCommand extends GeyserCommand { sender.sendMessage(header); Map cmds = geyser.getCommandManager().getCommands(); - for (String cmdName : cmds.keySet()) { - GeyserCommand cmd = cmds.get(cmdName); + for (Map.Entry entry : cmds.entrySet()) { + GeyserCommand cmd = entry.getValue(); - if (sender.hasPermission(cmd.getPermission())) { + // Standalone hack-in since it doesn't have a concept of permissions + if (geyser.getPlatformType() == PlatformType.STANDALONE || sender.hasPermission(cmd.getPermission())) { // Only list commands the player can actually run if (cmd.isBedrockOnly() && session == null) { continue; } - sender.sendMessage(ChatColor.YELLOW + "/geyser " + cmdName + ChatColor.WHITE + ": " + + sender.sendMessage(ChatColor.YELLOW + "/geyser " + entry.getKey() + ChatColor.WHITE + ": " + GeyserLocale.getPlayerLocaleString(cmd.getDescription(), sender.getLocale())); } } diff --git a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java index d766c4b4c..ac7084980 100644 --- a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java @@ -37,6 +37,8 @@ import org.geysermc.geyser.session.cache.ChunkCache; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.block.BlockStateValues; +import java.util.Locale; + public class GeyserWorldManager extends WorldManager { private static final Object2ObjectMap gameruleCache = new Object2ObjectOpenHashMap<>(); @@ -107,12 +109,12 @@ public class GeyserWorldManager extends WorldManager { @Override public void setPlayerGameMode(GeyserSession session, GameMode gameMode) { - session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase(Locale.ROOT))); } @Override public void setDifficulty(GeyserSession session, Difficulty difficulty) { - session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase(Locale.ROOT))); } @Override From eb7d71017c3085dd92e3cc55edf86c9eb40fe5a9 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 29 Nov 2021 10:40:27 -0500 Subject: [PATCH 725/766] Remove some unnecessary skin checks --- .../geyser/skin/FakeHeadProvider.java | 8 +--- .../org/geysermc/geyser/skin/SkinManager.java | 42 +++++++++---------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java b/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java index e54b25b2a..90f19eb24 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FakeHeadProvider.java @@ -112,9 +112,7 @@ public class FakeHeadProvider { try { SkinProvider.SkinData mergedSkinData = MERGED_SKINS_LOADING_CACHE.get(new FakeHeadEntry(texturesProperty, fakeHeadSkinUrl, entity)); - if (session.getUpstream().isInitialized()) { - sendSkinPacket(session, entity, mergedSkinData); - } + sendSkinPacket(session, entity, mergedSkinData); } catch (ExecutionException e) { GeyserImpl.getInstance().getLogger().error("Couldn't merge skin of " + entity.getUsername() + " with head skin url " + fakeHeadSkinUrl, e); } @@ -136,9 +134,7 @@ public class FakeHeadProvider { return; } - if (session.getUpstream().isInitialized()) { - sendSkinPacket(session, entity, skinData); - } + sendSkinPacket(session, entity, skinData); }); } diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index 199d69238..02b4123e5 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -133,31 +133,29 @@ public class SkinManager { SkinProvider.Cape cape = skinData.cape(); SkinProvider.SkinGeometry geometry = skinData.geometry(); - if (session.getUpstream().isInitialized()) { - PlayerListPacket.Entry updatedEntry = buildEntryManually( - session, - entity.getUuid(), - entity.getUsername(), - entity.getGeyserId(), - skin.getTextureUrl(), - skin.getSkinData(), - cape.getCapeId(), - cape.getCapeData(), - geometry - ); + PlayerListPacket.Entry updatedEntry = buildEntryManually( + session, + entity.getUuid(), + entity.getUsername(), + entity.getGeyserId(), + skin.getTextureUrl(), + skin.getSkinData(), + cape.getCapeId(), + cape.getCapeData(), + geometry + ); - PlayerListPacket playerAddPacket = new PlayerListPacket(); - playerAddPacket.setAction(PlayerListPacket.Action.ADD); - playerAddPacket.getEntries().add(updatedEntry); - session.sendUpstreamPacket(playerAddPacket); + PlayerListPacket playerAddPacket = new PlayerListPacket(); + playerAddPacket.setAction(PlayerListPacket.Action.ADD); + playerAddPacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerAddPacket); - if (!entity.isPlayerList()) { - PlayerListPacket playerRemovePacket = new PlayerListPacket(); - playerRemovePacket.setAction(PlayerListPacket.Action.REMOVE); - playerRemovePacket.getEntries().add(updatedEntry); - session.sendUpstreamPacket(playerRemovePacket); - } + if (!entity.isPlayerList()) { + PlayerListPacket playerRemovePacket = new PlayerListPacket(); + playerRemovePacket.setAction(PlayerListPacket.Action.REMOVE); + playerRemovePacket.getEntries().add(updatedEntry); + session.sendUpstreamPacket(playerRemovePacket); } } From 840318bd8b76ae4d4a4169e17c3a396355394d81 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 29 Nov 2021 14:04:44 -0500 Subject: [PATCH 726/766] Optimize MessageTranslator to not use regex Regexes take up a performance penalty that we can circumvent by iterating over the legacy string once and applying the necessary workarounds. --- .../translator/text/MessageTranslator.java | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java index 68d79dc4f..abce22ff8 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/text/MessageTranslator.java @@ -34,13 +34,13 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.session.GeyserSession; -import org.geysermc.geyser.text.MinecraftTranslationRegistry; -import org.geysermc.geyser.text.GsonComponentSerializerWrapper; +import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.text.GsonComponentSerializerWrapper; +import org.geysermc.geyser.text.MinecraftTranslationRegistry; import java.util.EnumMap; import java.util.Map; -import java.util.regex.Pattern; public class MessageTranslator { // These are used for handling the translations of the messages @@ -59,11 +59,6 @@ public class MessageTranslator { // Reset character private static final String RESET = BASE + "r"; - /* Various regexes to fix formatting for Bedrock's specifications */ - private static final Pattern STRIKETHROUGH_UNDERLINE = Pattern.compile("\u00a7[mn]"); - private static final Pattern COLOR_CHARACTERS = Pattern.compile("\u00a7([0-9a-f])"); - private static final Pattern DOUBLE_RESET = Pattern.compile("\u00a7r\u00a7r"); - static { TEAM_COLORS.put(TeamColor.NONE, ""); @@ -111,15 +106,34 @@ public class MessageTranslator { String legacy = LegacyComponentSerializer.legacySection().serialize(message); - // Strip strikethrough and underline as they are not supported on bedrock - legacy = STRIKETHROUGH_UNDERLINE.matcher(legacy).replaceAll(""); + StringBuilder finalLegacy = new StringBuilder(); + char[] legacyChars = legacy.toCharArray(); + boolean lastFormatReset = false; + for (int i = 0; i < legacyChars.length; i++) { + char legacyChar = legacyChars[i]; + if (legacyChar != ChatColor.ESCAPE || i >= legacyChars.length - 1) { + // No special formatting for Bedrock needed + // Or, we're at the end of the string + finalLegacy.append(legacyChar); + lastFormatReset = false; + continue; + } - // Make color codes reset formatting like Java - // See https://minecraft.gamepedia.com/Formatting_codes#Usage - legacy = COLOR_CHARACTERS.matcher(legacy).replaceAll("\u00a7r\u00a7$1"); - legacy = DOUBLE_RESET.matcher(legacy).replaceAll("\u00a7r"); + char next = legacyChars[++i]; + if (next != 'm' && next != 'n') { + // Strikethrough and underline do not exist on Bedrock + if ((next >= '0' && next <= '9') || (next >= 'a' && next <= 'f')) { + // Append this color code, as well as a necessary reset code + if (!lastFormatReset) { + finalLegacy.append(RESET); + } + } + finalLegacy.append(BASE).append(next); + } + lastFormatReset = next == 'r'; + } - return legacy; + return finalLegacy.toString(); } catch (Exception e) { GeyserImpl.getInstance().getLogger().debug(GSON_SERIALIZER.serialize(message)); GeyserImpl.getInstance().getLogger().error("Failed to parse message", e); From c0d605dd77c9c99c688e4ada99220bf61c295533 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Tue, 30 Nov 2021 00:33:53 +0100 Subject: [PATCH 727/766] Initial changes --- .../geysermc/floodgate/crypto/AesCipher.java | 2 +- .../floodgate/crypto/FloodgateCipher.java | 19 ++++++------------- .../util/InvalidFormatException.java | 18 ------------------ 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java index f602f4be0..e5d89a09f 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java @@ -91,7 +91,7 @@ public final class AesCipher implements FloodgateCipher { if (topping != null) { int mark = buffer.position(); - // we need the first index, the second is for the optional RawSkin + // we need the first index, the second is for the actual data boolean found = false; while (buffer.hasRemaining() && !found) { if (buffer.get() == 0x21) { diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java index 69c8f9f6d..385559aee 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java @@ -130,25 +130,18 @@ public interface FloodgateCipher { final int identifierLength = IDENTIFIER.length; if (data.length <= HEADER_LENGTH) { - throw new InvalidFormatException("Data length is smaller then header." + - "Needed " + HEADER_LENGTH + ", got " + data.length, - true + throw new InvalidFormatException( + "Data length is smaller then header." + + "Needed " + HEADER_LENGTH + ", got " + data.length ); } for (int i = 0; i < identifierLength; i++) { if (IDENTIFIER[i] != data[i]) { - StringBuilder receivedIdentifier = new StringBuilder(); - for (byte b : IDENTIFIER) { - receivedIdentifier.append(b); - } - + String identifier = new String(IDENTIFIER, StandardCharsets.UTF_8); + String received = new String(data, 0, IDENTIFIER.length, StandardCharsets.UTF_8); throw new InvalidFormatException( - String.format("Expected identifier %s, got %s", - new String(IDENTIFIER, StandardCharsets.UTF_8), - receivedIdentifier.toString() - ), - true + "Expected identifier " + identifier + ", got " + received ); } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java b/common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java index 9ec5b1710..698e4522c 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java +++ b/common/src/main/java/org/geysermc/floodgate/util/InvalidFormatException.java @@ -26,26 +26,8 @@ package org.geysermc.floodgate.util; -import lombok.Getter; - -@Getter public class InvalidFormatException extends Exception { - private boolean header = false; - - public InvalidFormatException() { - super(); - } - public InvalidFormatException(String message) { super(message); } - - public InvalidFormatException(String message, boolean header) { - super(message); - this.header = header; - } - - public InvalidFormatException(String message, Throwable cause) { - super(message, cause); - } } From 51330b8cda48ffa85558a23115b196e8b24572f2 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 29 Nov 2021 22:04:02 -0500 Subject: [PATCH 728/766] Some changes for GeyserConnect --- .../main/java/org/geysermc/geyser/session/GeyserSession.java | 3 ++- .../java/org/geysermc/geyser/util/LoginEncryptionUtils.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 0940a6dd9..6116604e0 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -249,7 +249,8 @@ public class GeyserSession implements GeyserConnection, CommandSender { private Vector2i lastChunkPosition = null; private int renderDistance; - private boolean sentSpawnPacket; + // Exposed for GeyserConnect usage + protected boolean sentSpawnPacket; private boolean loggedIn; private boolean loggingIn; diff --git a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java index 213953bdd..e677798cd 100644 --- a/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java @@ -213,6 +213,11 @@ public class LoginEncryptionUtils { } public static void buildAndShowLoginWindow(GeyserSession session) { + if (session.isLoggedIn()) { + // Can happen if a window is cancelled during dimension switch + return; + } + // Set DoDaylightCycle to false so the time doesn't accelerate while we're here session.setDaylightCycle(false); From 2d79de4a6bf89c897d3b6d3aa47b2c6a8338e526 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 29 Nov 2021 22:32:09 -0500 Subject: [PATCH 729/766] Bump to 1.18 release (won't work until Tuesday) --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 09d4dc978..fd68c34a2 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - f7f84e7 + ed29b72 compile From 091664e00045590fffb065786fea9cbc699757e3 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Tue, 30 Nov 2021 16:32:44 +0100 Subject: [PATCH 730/766] Removed time checker and added a header version system --- .../geysermc/floodgate/crypto/AesCipher.java | 8 +- .../floodgate/crypto/AesKeyProducer.java | 4 +- .../floodgate/crypto/FloodgateCipher.java | 48 ++++------ .../floodgate/time/SntpClientUtils.java | 91 ------------------- .../geysermc/floodgate/time/TimeSyncer.java | 67 -------------- .../geysermc/floodgate/util/Base64Utils.java | 35 ------- .../geysermc/floodgate/util/BedrockData.java | 19 ++-- .../org/geysermc/floodgate/util/DeviceOs.java | 2 +- .../geysermc/floodgate/util/InputMode.java | 2 +- .../geysermc/floodgate/util/UiProfile.java | 2 +- .../floodgate/util/WebsocketEventType.java | 4 +- .../java/org/geysermc/geyser/GeyserImpl.java | 12 --- .../geyser/session/GeyserSession.java | 13 +-- .../geyser/skin/FloodgateSkinUploader.java | 2 +- 14 files changed, 42 insertions(+), 267 deletions(-) delete mode 100644 common/src/main/java/org/geysermc/floodgate/time/SntpClientUtils.java delete mode 100644 common/src/main/java/org/geysermc/floodgate/time/TimeSyncer.java delete mode 100644 common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java index e5d89a09f..619065836 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java @@ -70,8 +70,8 @@ public final class AesCipher implements FloodgateCipher { cipherText = topping.encode(cipherText); } - return ByteBuffer.allocate(iv.length + cipherText.length + HEADER_LENGTH + 1) - .put(IDENTIFIER) // header + return ByteBuffer.allocate(HEADER.length + iv.length + cipherText.length + 1) + .put(HEADER) .put(iv) .put((byte) 0x21) .put(cipherText) @@ -83,8 +83,8 @@ public final class AesCipher implements FloodgateCipher { Cipher cipher = Cipher.getInstance(CIPHER_NAME); - int bufferLength = cipherTextWithIv.length - HEADER_LENGTH; - ByteBuffer buffer = ByteBuffer.wrap(cipherTextWithIv, HEADER_LENGTH, bufferLength); + int bufferLength = cipherTextWithIv.length - HEADER.length; + ByteBuffer buffer = ByteBuffer.wrap(cipherTextWithIv, HEADER.length, bufferLength); int ivLength = IV_LENGTH; diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java index faec0ad10..54bfa0a4e 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesKeyProducer.java @@ -39,7 +39,7 @@ public final class AesKeyProducer implements KeyProducer { public SecretKey produce() { try { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); - keyGenerator.init(KEY_SIZE, getSecureRandom()); + keyGenerator.init(KEY_SIZE, secureRandom()); return keyGenerator.generateKey(); } catch (Exception exception) { throw new RuntimeException(exception); @@ -55,7 +55,7 @@ public final class AesKeyProducer implements KeyProducer { } } - private SecureRandom getSecureRandom() throws NoSuchAlgorithmException { + private SecureRandom secureRandom() throws NoSuchAlgorithmException { // use Windows-PRNG for windows (default impl is SHA1PRNG) if (System.getProperty("os.name").startsWith("Windows")) { return SecureRandom.getInstance("Windows-PRNG"); diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java index 385559aee..23497506a 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/FloodgateCipher.java @@ -26,33 +26,32 @@ package org.geysermc.floodgate.crypto; -import lombok.AllArgsConstructor; -import lombok.Data; import org.geysermc.floodgate.util.InvalidFormatException; -import java.nio.charset.StandardCharsets; import java.security.Key; +import static java.nio.charset.StandardCharsets.UTF_8; + /** * Responsible for both encrypting and decrypting data */ public interface FloodgateCipher { - // use invalid username characters at the beginning and the end of the identifier, - // to make sure that it doesn't get messed up with usernames - byte[] IDENTIFIER = "^Floodgate^".getBytes(StandardCharsets.UTF_8); - int HEADER_LENGTH = IDENTIFIER.length; + int VERSION = 0; + byte[] IDENTIFIER = "^Floodgate^".getBytes(UTF_8); + byte[] HEADER = (new String(IDENTIFIER, UTF_8) + (char) (VERSION + 0x3E)).getBytes(UTF_8); - static boolean hasHeader(String data) { - if (data.length() < IDENTIFIER.length) { - return false; + static int version(String data) { + if (data.length() <= HEADER.length) { + return -1; } for (int i = 0; i < IDENTIFIER.length; i++) { if (IDENTIFIER[i] != data.charAt(i)) { - return false; + return -1; } } - return true; + + return data.charAt(IDENTIFIER.length) - 0x3E; } /** @@ -79,7 +78,7 @@ public interface FloodgateCipher { * @throws Exception when the encryption failed */ default byte[] encryptFromString(String data) throws Exception { - return encrypt(data.getBytes(StandardCharsets.UTF_8)); + return encrypt(data.getBytes(UTF_8)); } /** @@ -104,7 +103,7 @@ public interface FloodgateCipher { if (decrypted == null) { return null; } - return new String(decrypted, StandardCharsets.UTF_8); + return new String(decrypted, UTF_8); } /** @@ -116,7 +115,7 @@ public interface FloodgateCipher { * @throws Exception when the decrypting failed */ default byte[] decryptFromString(String data) throws Exception { - return decrypt(data.getBytes(StandardCharsets.UTF_8)); + return decrypt(data.getBytes(UTF_8)); } /** @@ -127,30 +126,21 @@ public interface FloodgateCipher { * @throws InvalidFormatException when the header is invalid */ default void checkHeader(byte[] data) throws InvalidFormatException { - final int identifierLength = IDENTIFIER.length; - - if (data.length <= HEADER_LENGTH) { + if (data.length <= HEADER.length) { throw new InvalidFormatException( "Data length is smaller then header." + - "Needed " + HEADER_LENGTH + ", got " + data.length + "Needed " + HEADER.length + ", got " + data.length ); } - for (int i = 0; i < identifierLength; i++) { + for (int i = 0; i < IDENTIFIER.length; i++) { if (IDENTIFIER[i] != data[i]) { - String identifier = new String(IDENTIFIER, StandardCharsets.UTF_8); - String received = new String(data, 0, IDENTIFIER.length, StandardCharsets.UTF_8); + String identifier = new String(IDENTIFIER, UTF_8); + String received = new String(data, 0, IDENTIFIER.length, UTF_8); throw new InvalidFormatException( "Expected identifier " + identifier + ", got " + received ); } } } - - @Data - @AllArgsConstructor - class HeaderResult { - private int version; - private int startIndex; - } } diff --git a/common/src/main/java/org/geysermc/floodgate/time/SntpClientUtils.java b/common/src/main/java/org/geysermc/floodgate/time/SntpClientUtils.java deleted file mode 100644 index 9e7f2c1b0..000000000 --- a/common/src/main/java/org/geysermc/floodgate/time/SntpClientUtils.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.floodgate.time; - -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.InetAddress; -import java.nio.ByteBuffer; - -/* - * Thanks: - * https://datatracker.ietf.org/doc/html/rfc1769 - * https://github.com/jonsagara/SimpleNtpClient - * https://stackoverflow.com/a/29138806 - */ -public final class SntpClientUtils { - private static final int NTP_PORT = 123; - - private static final int NTP_PACKET_SIZE = 48; - private static final int NTP_MODE = 3; // client - private static final int NTP_VERSION = 3; - private static final int RECEIVE_TIME_POSITION = 32; - - private static final long NTP_TIME_OFFSET = ((365L * 70L) + 17L) * 24L * 60L * 60L; - - public static long requestTimeOffset(String host, int timeout) { - try (DatagramSocket socket = new DatagramSocket()) { - socket.setSoTimeout(timeout); - - InetAddress address = InetAddress.getByName(host); - - ByteBuffer buff = ByteBuffer.allocate(NTP_PACKET_SIZE); - - DatagramPacket request = new DatagramPacket( - buff.array(), NTP_PACKET_SIZE, address, NTP_PORT - ); - - // mode is in the least signification 3 bits - // version is in bits 3-5 - buff.put((byte) (NTP_MODE | (NTP_VERSION << 3))); - - long originateTime = System.currentTimeMillis(); - socket.send(request); - - DatagramPacket response = new DatagramPacket(buff.array(), NTP_PACKET_SIZE); - socket.receive(response); - - long responseTime = System.currentTimeMillis(); - - // everything before isn't important for us - buff.position(RECEIVE_TIME_POSITION); - - long receiveTime = readTimestamp(buff); - long transmitTime = readTimestamp(buff); - - return ((receiveTime - originateTime) + (transmitTime - responseTime)) / 2; - } catch (Exception ignored) { - } - return Long.MIN_VALUE; - } - - private static long readTimestamp(ByteBuffer buffer) { - //todo look into the ntp 2036 problem - long seconds = buffer.getInt() & 0xffffffffL; - long fraction = buffer.getInt() & 0xffffffffL; - return ((seconds - NTP_TIME_OFFSET) * 1000) + ((fraction * 1000) / 0x100000000L); - } -} diff --git a/common/src/main/java/org/geysermc/floodgate/time/TimeSyncer.java b/common/src/main/java/org/geysermc/floodgate/time/TimeSyncer.java deleted file mode 100644 index 3fe089e06..000000000 --- a/common/src/main/java/org/geysermc/floodgate/time/TimeSyncer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.floodgate.time; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -public final class TimeSyncer { - private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); - private long timeOffset = Long.MIN_VALUE; // value when it failed to get the offset - - public TimeSyncer(String timeServer) { - executorService.scheduleWithFixedDelay(() -> { - // 5 tries to get the time offset, since UDP doesn't guaranty a response - for (int i = 0; i < 5; i++) { - long offset = SntpClientUtils.requestTimeOffset(timeServer, 3000); - if (offset != Long.MIN_VALUE) { - timeOffset = offset; - return; - } - } - }, 0, 30, TimeUnit.MINUTES); - } - - public void shutdown() { - executorService.shutdown(); - } - - public long getTimeOffset() { - return timeOffset; - } - - public long getRealMillis() { - if (hasUsefulOffset()) { - return System.currentTimeMillis() + getTimeOffset(); - } - return System.currentTimeMillis(); - } - - public boolean hasUsefulOffset() { - return timeOffset != Long.MIN_VALUE; - } -} diff --git a/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java b/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java deleted file mode 100644 index 326fa2590..000000000 --- a/common/src/main/java/org/geysermc/floodgate/util/Base64Utils.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2019-2021 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.floodgate.util; - -public final class Base64Utils { - public static int getEncodedLength(int length) { - if (length <= 0) { - return -1; - } - return 4 * ((length + 2) / 3); - } -} diff --git a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java index 4f4325a9b..31696d97a 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java +++ b/common/src/main/java/org/geysermc/floodgate/util/BedrockData.java @@ -28,7 +28,6 @@ package org.geysermc.floodgate.util; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.geysermc.floodgate.time.TimeSyncer; /** * This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. This @@ -38,7 +37,7 @@ import org.geysermc.floodgate.time.TimeSyncer; @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public final class BedrockData implements Cloneable { - public static final int EXPECTED_LENGTH = 13; + public static final int EXPECTED_LENGTH = 12; private final String version; private final String username; @@ -54,25 +53,23 @@ public final class BedrockData implements Cloneable { private final int subscribeId; private final String verifyCode; - private final long timestamp; private final int dataLength; public static BedrockData of( String version, String username, String xuid, int deviceOs, String languageCode, int uiProfile, int inputMode, String ip, LinkedPlayer linkedPlayer, boolean fromProxy, int subscribeId, - String verifyCode, TimeSyncer timeSyncer) { + String verifyCode) { return new BedrockData(version, username, xuid, deviceOs, languageCode, inputMode, - uiProfile, ip, linkedPlayer, fromProxy, subscribeId, verifyCode, - timeSyncer.getRealMillis(), EXPECTED_LENGTH); + uiProfile, ip, linkedPlayer, fromProxy, subscribeId, verifyCode, EXPECTED_LENGTH); } public static BedrockData of( String version, String username, String xuid, int deviceOs, String languageCode, int uiProfile, int inputMode, String ip, - int subscribeId, String verifyCode, TimeSyncer timeSyncer) { + int subscribeId, String verifyCode) { return of(version, username, xuid, deviceOs, languageCode, uiProfile, inputMode, ip, null, - false, subscribeId, verifyCode, timeSyncer); + false, subscribeId, verifyCode); } public static BedrockData fromString(String data) { @@ -86,12 +83,12 @@ public final class BedrockData implements Cloneable { return new BedrockData( split[0], split[1], split[2], Integer.parseInt(split[3]), split[4], Integer.parseInt(split[5]), Integer.parseInt(split[6]), split[7], linkedPlayer, - "1".equals(split[9]), Integer.parseInt(split[10]), split[11], Long.parseLong(split[12]), split.length + "1".equals(split[9]), Integer.parseInt(split[10]), split[11], split.length ); } private static BedrockData emptyData(int dataLength) { - return new BedrockData(null, null, null, -1, null, -1, -1, null, null, false, -1, null, -1, + return new BedrockData(null, null, null, -1, null, -1, -1, null, null, false, -1, null, dataLength); } @@ -105,7 +102,7 @@ public final class BedrockData implements Cloneable { return version + '\0' + username + '\0' + xuid + '\0' + deviceOs + '\0' + languageCode + '\0' + uiProfile + '\0' + inputMode + '\0' + ip + '\0' + (linkedPlayer != null ? linkedPlayer.toString() : "null") + '\0' + - (fromProxy ? 1 : 0) + '\0' + subscribeId + '\0' + verifyCode + '\0' + timestamp; + (fromProxy ? 1 : 0) + '\0' + subscribeId + '\0' + verifyCode; } @Override diff --git a/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java b/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java index 714af6f1f..f56d3a8c0 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java +++ b/common/src/main/java/org/geysermc/floodgate/util/DeviceOs.java @@ -59,7 +59,7 @@ public enum DeviceOs { * @param id the DeviceOs identifier * @return The DeviceOs or {@link #UNKNOWN} if the DeviceOs wasn't found */ - public static DeviceOs getById(int id) { + public static DeviceOs fromId(int id) { return id < VALUES.length ? VALUES[id] : VALUES[0]; } diff --git a/common/src/main/java/org/geysermc/floodgate/util/InputMode.java b/common/src/main/java/org/geysermc/floodgate/util/InputMode.java index d49d2ea84..3ce51634d 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/InputMode.java +++ b/common/src/main/java/org/geysermc/floodgate/util/InputMode.java @@ -41,7 +41,7 @@ public enum InputMode { * @param id the InputMode identifier * @return The InputMode or {@link #UNKNOWN} if the DeviceOs wasn't found */ - public static InputMode getById(int id) { + public static InputMode fromId(int id) { return VALUES.length > id ? VALUES[id] : VALUES[0]; } } \ No newline at end of file diff --git a/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java b/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java index af1121f3c..298aaea83 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java +++ b/common/src/main/java/org/geysermc/floodgate/util/UiProfile.java @@ -38,7 +38,7 @@ public enum UiProfile { * @param id the UiProfile identifier * @return The UiProfile or {@link #CLASSIC} if the UiProfile wasn't found */ - public static UiProfile getById(int id) { + public static UiProfile fromId(int id) { return VALUES.length > id ? VALUES[id] : VALUES[0]; } } diff --git a/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java b/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java index f24dc8145..b570d7b3d 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java +++ b/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java @@ -81,11 +81,11 @@ public enum WebsocketEventType { this.id = id; } - public static WebsocketEventType getById(int id) { + public static WebsocketEventType fromId(int id) { return VALUES.length > id ? VALUES[id] : null; } - public int getId() { + public int id() { return id; } } diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index 02fc29887..bd7cca083 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -48,7 +48,6 @@ import org.geysermc.floodgate.crypto.AesKeyProducer; import org.geysermc.floodgate.crypto.Base64Topping; import org.geysermc.floodgate.crypto.FloodgateCipher; import org.geysermc.floodgate.news.NewsItemAction; -import org.geysermc.floodgate.time.TimeSyncer; import org.geysermc.geyser.api.GeyserApi; import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.configuration.GeyserConfiguration; @@ -110,7 +109,6 @@ public class GeyserImpl implements GeyserApi { @Setter private static boolean shouldStartListener = true; - private final TimeSyncer timeSyncer; private FloodgateCipher cipher; private FloodgateSkinUploader skinUploader; private final NewsHandler newsHandler; @@ -201,9 +199,7 @@ public class GeyserImpl implements GeyserApi { // Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false; - TimeSyncer timeSyncer = null; if (config.getRemote().getAuthType() == AuthType.FLOODGATE) { - timeSyncer = new TimeSyncer(Constants.NTP_SERVER); try { Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath()); cipher = new AesCipher(new Base64Topping()); @@ -214,7 +210,6 @@ public class GeyserImpl implements GeyserApi { logger.severe(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception); } } - this.timeSyncer = timeSyncer; String branch = "unknown"; int buildNumber = -1; @@ -441,9 +436,6 @@ public class GeyserImpl implements GeyserApi { scheduledThread.shutdown(); bedrockServer.close(); - if (timeSyncer != null) { - timeSyncer.shutdown(); - } if (skinUploader != null) { skinUploader.close(); } @@ -491,10 +483,6 @@ public class GeyserImpl implements GeyserApi { return bootstrap.getWorldManager(); } - public TimeSyncer getTimeSyncer() { - return timeSyncer; - } - public static GeyserImpl getInstance() { return instance; } diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 0940a6dd9..2c439a59a 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -786,6 +786,8 @@ public class GeyserSession implements GeyserConnection, CommandSender { FloodgateSkinUploader skinUploader = geyser.getSkinUploader(); FloodgateCipher cipher = geyser.getCipher(); + System.out.println(new String(FloodgateCipher.HEADER, StandardCharsets.UTF_8)); + encryptedData = cipher.encryptFromString(BedrockData.of( clientData.getGameVersion(), authData.name(), @@ -796,17 +798,8 @@ public class GeyserSession implements GeyserConnection, CommandSender { clientData.getCurrentInputMode().ordinal(), upstream.getAddress().getAddress().getHostAddress(), skinUploader.getId(), - skinUploader.getVerifyCode(), - geyser.getTimeSyncer() + skinUploader.getVerifyCode() ).toString()); - - if (!geyser.getTimeSyncer().hasUsefulOffset()) { - geyser.getLogger().warning( - "We couldn't make sure that your system clock is accurate. " + - "This can cause issues with logging in." - ); - } - } catch (Exception e) { geyser.getLogger().error(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.encrypt_fail"), e); disconnect(GeyserLocale.getPlayerLocaleString("geyser.auth.floodgate.encryption_fail", getClientData().getLanguageCode())); diff --git a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java index 5fc45c703..5beeed9b1 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java +++ b/core/src/main/java/org/geysermc/geyser/skin/FloodgateSkinUploader.java @@ -87,7 +87,7 @@ public final class FloodgateSkinUploader { } int typeId = node.get("event_id").asInt(); - WebsocketEventType type = WebsocketEventType.getById(typeId); + WebsocketEventType type = WebsocketEventType.fromId(typeId); if (type == null) { logger.warning(String.format( "Got (unknown) type %s. Ensure that Geyser is on the latest version and report this issue!", From d1f30322494c32c6a2d33386dfdd580a024ba617 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:20:48 -0500 Subject: [PATCH 731/766] Remove extra println --- .../main/java/org/geysermc/geyser/session/GeyserSession.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index afd4da343..e215017c0 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -787,8 +787,6 @@ public class GeyserSession implements GeyserConnection, CommandSender { FloodgateSkinUploader skinUploader = geyser.getSkinUploader(); FloodgateCipher cipher = geyser.getCipher(); - System.out.println(new String(FloodgateCipher.HEADER, StandardCharsets.UTF_8)); - encryptedData = cipher.encryptFromString(BedrockData.of( clientData.getGameVersion(), authData.name(), From 1ce3709c79e28a37fa5dbcc131f556a44f8ba596 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:27:39 -0500 Subject: [PATCH 732/766] Make this Javadoc checker happy --- .../org/geysermc/geyser/registry/AbstractMappedRegistry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java b/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java index acabef46f..ce64ee265 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/registry/AbstractMappedRegistry.java @@ -58,7 +58,7 @@ public abstract class AbstractMappedRegistry> extends } /** - * Returns & maps the value by the given key if present. + * Returns and maps the value by the given key if present. * * @param key the key * @param mapper the mapper From 295e71627b3c7b883251e2356d1d0611e34f2b6c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 30 Nov 2021 12:30:40 -0500 Subject: [PATCH 733/766] Update README for supported versions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94c42035c..1d8ed6efd 100644 --- a/README.md +++ b/README.md @@ -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.17.10 - 1.17.41 and Minecraft Java 1.17.1. +### Currently supporting Minecraft Bedrock 1.17.30 - 1.17.41 + 1.18 and Minecraft Java 1.18. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. From 75d1a6364c3c10c5408d91dc86429c25bf36708a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 30 Nov 2021 15:06:47 -0500 Subject: [PATCH 734/766] Gracefully handle invalid block entity types --- core/pom.xml | 2 +- .../CommandBlockBlockEntityTranslator.java | 2 +- .../level/JavaBlockEntityDataTranslator.java | 10 +++-- .../JavaLevelChunkWithLightTranslator.java | 38 +++++++++---------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index fd68c34a2..00c0931eb 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - ed29b72 + 6edba11 compile diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java index bb01e4d39..87221ab01 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/CommandBlockBlockEntityTranslator.java @@ -35,7 +35,7 @@ import org.geysermc.geyser.translator.text.MessageTranslator; public class CommandBlockBlockEntityTranslator extends BlockEntityTranslator implements RequiresBlockState { @Override public void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState) { - if (tag.size() < 5) { + if (tag == null || tag.size() < 5) { return; // These values aren't here } // Java infers from the block state, but Bedrock needs it in the tag diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java index 1c11b298e..4541ee6ba 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaBlockEntityDataTranslator.java @@ -46,7 +46,11 @@ public class JavaBlockEntityDataTranslator extends PacketTranslator= 2 && + if (type == BlockEntityType.COMMAND_BLOCK && session.getOpPermissionLevel() >= 2 && session.getGameMode() == GameMode.CREATIVE && packet.getNbt() != null && packet.getNbt().size() > 5) { ContainerOpenPacket openPacket = new ContainerOpenPacket(); openPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java index 96dcfed2c..966364bbc 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelChunkWithLightTranslator.java @@ -50,6 +50,7 @@ import io.netty.buffer.ByteBufOutputStream; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntLists; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; @@ -88,11 +89,12 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator bedrockOnlyBlockEntities = new ArrayList<>(); DataPalette[] javaChunks = new DataPalette[chunkSize]; DataPalette[] javaBiomes = new DataPalette[chunkSize]; + final BlockEntityInfo[] blockEntities = packet.getBlockEntities(); + final List bedrockBlockEntities = new ObjectArrayList<>(blockEntities.length); + BitSet waterloggedPaletteIds = new BitSet(); BitSet pistonOrFlowerPaletteIds = new BitSet(); @@ -140,7 +142,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator> 8) & 0xF), (packet.getZ() << 4) + ((yzx >> 4) & 0xF)), javaId )); @@ -192,7 +194,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator> 8) & 0xF), (packet.getZ() << 4) + ((yzx >> 4) & 0xF)), javaPalette.idToState(paletteId) )); @@ -240,15 +242,16 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator Date: Tue, 30 Nov 2021 21:28:32 -0500 Subject: [PATCH 735/766] Boss bar colors now work in Bedrock 1.18!! --- .../org/geysermc/geyser/session/cache/BossBar.java | 12 +++++++++++- ...BedrockSetLocalPlayerAsInitializedTranslator.java | 4 ++++ .../protocol/java/JavaBossEventTranslator.java | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java index 9595a3daf..ffb98c958 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java @@ -42,7 +42,7 @@ public class BossBar { private final long entityId; private Component title; private float health; - private final int color; + private int color; private final int overlay; private final int darkenSky; @@ -86,6 +86,16 @@ public class BossBar { session.sendUpstreamPacket(bossEventPacket); } + public void updateColor(int color) { + this.color = color; + BossEventPacket bossEventPacket = new BossEventPacket(); + bossEventPacket.setBossUniqueEntityId(entityId); + bossEventPacket.setAction(BossEventPacket.Action.UPDATE_STYLE); + bossEventPacket.setColor(color); + + session.sendUpstreamPacket(bossEventPacket); + } + public void removeBossBar() { BossEventPacket bossEventPacket = new BossEventPacket(); bossEventPacket.setBossUniqueEntityId(entityId); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index bc6d1f4e4..b30d9be81 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -46,6 +46,10 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat } // else we were able to log the user in } + if (session.isLoggedIn()) { + // Sigh + session.getEntityCache().updateBossBars(); + } } } } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java index 2c49baa56..c9512b87b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaBossEventTranslator.java @@ -41,7 +41,7 @@ public class JavaBossEventTranslator extends PacketTranslator Date: Wed, 1 Dec 2021 10:17:36 -0500 Subject: [PATCH 736/766] Fix potential IndexOutOfBounds error with BlockDestructionPacket --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 00c0931eb..49021cc0c 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 6edba11 + 6970991 compile From 6a77253ef22ed3e4ae27e8a8a31795174e6c473b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 1 Dec 2021 22:47:33 -0500 Subject: [PATCH 737/766] Fix Bedrock proxy protocol support --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 49021cc0c..e3189a1cb 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -137,7 +137,7 @@ com.nukkitx.network raknet - 1.6.27-20210506.111625-1 + 1.6.28-20211202.034102-5 compile From 0daa697a4cb1f87c7c77c28f9e22607ca5d1fe37 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 2 Dec 2021 10:15:59 -0500 Subject: [PATCH 738/766] Comment/import fixes --- core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java | 3 +-- .../main/java/org/geysermc/geyser/session/cache/BossBar.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java index 73b1cd0fa..df7a049c6 100644 --- a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java +++ b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java @@ -25,9 +25,8 @@ package org.geysermc.geyser; -import org.geysermc.geyser.GeyserLogger; -import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.text.GeyserLocale; import java.nio.file.Files; diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java index ffb98c958..3d1e11db9 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/BossBar.java @@ -59,7 +59,7 @@ public class BossBar { bossEventPacket.setAction(BossEventPacket.Action.CREATE); bossEventPacket.setTitle(MessageTranslator.convertMessage(title, session.getLocale())); bossEventPacket.setHealthPercentage(health); - bossEventPacket.setColor(color); //ignored by client + bossEventPacket.setColor(color); bossEventPacket.setOverlay(overlay); bossEventPacket.setDarkenSky(darkenSky); From c3f146370e32c1338b54d9873378cbdcaad8390c Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 2 Dec 2021 10:26:19 -0500 Subject: [PATCH 739/766] Add a check/warning for outdated Floodgate versions --- .../java/org/geysermc/geyser/GeyserImpl.java | 2 + .../geyser/util/VersionCheckUtils.java | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 core/src/main/java/org/geysermc/geyser/util/VersionCheckUtils.java diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index bd7cca083..eaadd15fa 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -386,6 +386,8 @@ public class GeyserImpl implements GeyserApi { if (platformType == PlatformType.STANDALONE) { logger.warning(GeyserLocale.getLocaleStringLog("geyser.core.movement_warn")); + } else if (config.getRemote().getAuthType() == AuthType.FLOODGATE) { + VersionCheckUtils.checkForOutdatedFloodgate(logger); } newsHandler.handleNews(null, NewsItemAction.ON_SERVER_STARTED); diff --git a/core/src/main/java/org/geysermc/geyser/util/VersionCheckUtils.java b/core/src/main/java/org/geysermc/geyser/util/VersionCheckUtils.java new file mode 100644 index 000000000..786d5fc6e --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/util/VersionCheckUtils.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019-2021 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.util; + +import org.geysermc.geyser.Constants; +import org.geysermc.geyser.GeyserLogger; +import org.geysermc.geyser.text.GeyserLocale; + +public final class VersionCheckUtils { + + public static void checkForOutdatedFloodgate(GeyserLogger logger) { + try { + // This class was removed in Floodgate 2.1.0-SNAPSHOT - if it still exists, Floodgate will not work + // with this version of Geyser + Class.forName("org.geysermc.floodgate.util.TimeSyncerHolder"); + logger.warning(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION)); + } catch (ClassNotFoundException ignored) { + // Nothing to worry about; we want this exception + } + } + + private VersionCheckUtils() { + } +} From 9084c59003bfe930616ef8711cbc7e9cf69e9533 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 2 Dec 2021 19:56:12 -0500 Subject: [PATCH 740/766] Fix regressions in player movement handling --- .../java/org/geysermc/geyser/entity/EntityDefinition.java | 7 ++++++- .../main/java/org/geysermc/geyser/entity/type/Entity.java | 4 ++-- .../geysermc/geyser/entity/type/living/AgeableEntity.java | 5 ++--- .../geyser/entity/type/living/monster/PhantomEntity.java | 4 ++-- .../java/org/geysermc/geyser/session/GeyserSession.java | 5 ++--- .../bedrock/entity/player/BedrockMovePlayerTranslator.java | 4 +--- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java index 1149a67fd..f66a0c56b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java @@ -91,7 +91,7 @@ public record EntityDefinition(EntityFactory factory, Entit private String identifier; private float width; private float height; - private float offset; + private float offset = 0.00001f; private final List> translators; private Builder(EntityFactory factory) { @@ -118,6 +118,11 @@ public record EntityDefinition(EntityFactory factory, Entit return this; } + public Builder offset(float offset) { + this.offset = offset + 0.00001f; + return this; + } + /** * Resets the identifier as well */ diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index 1828f63e1..479ec2e8c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -83,9 +83,9 @@ public class Entity { /* Metadata about this specific entity */ @Setter(AccessLevel.NONE) - protected float boundingBoxHeight; + private float boundingBoxHeight; @Setter(AccessLevel.NONE) - protected float boundingBoxWidth; + private float boundingBoxWidth; @Setter(AccessLevel.NONE) protected String nametag = ""; /* Metadata end */ diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java index b250f3e8e..b04247a7a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java @@ -45,9 +45,8 @@ public class AgeableEntity extends CreatureEntity { dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize()); setFlag(EntityFlag.BABY, isBaby); - // TODO save this? - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, definition.height() * (isBaby ? getBabySize() : getAdultSize())); - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, definition.width() * (isBaby ? getBabySize() : getAdultSize())); + setBoundingBoxHeight(definition.height() * (isBaby ? getBabySize() : getAdultSize())); + setBoundingBoxWidth(definition.width() * (isBaby ? getBabySize() : getAdultSize())); } /** diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java index 68f3e7d23..8d3ccc71f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java @@ -44,8 +44,8 @@ public class PhantomEntity extends FlyingEntity { float modelScale = 1f + 0.15f * size; float boundsScale = (1f + (0.2f * size) / definition.width()) / modelScale; - dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundsScale * definition.width()); - dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundsScale * definition.height()); + setBoundingBoxWidth(boundsScale * definition.width()); + setBoundingBoxHeight(boundsScale * definition.height()); dirtyMetadata.put(EntityData.SCALE, modelScale); } } diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index e215017c0..0011381cf 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -58,7 +58,6 @@ import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.BedrockServerSession; import com.nukkitx.protocol.bedrock.data.*; import com.nukkitx.protocol.bedrock.data.command.CommandPermission; -import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; @@ -1057,7 +1056,7 @@ public class GeyserSession implements GeyserConnection, CommandSender { private void setSneakingPose(boolean sneaking) { this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING; - playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, sneaking ? 1.5f : playerEntity.getDefinition().height()); + playerEntity.setBoundingBoxHeight(sneaking ? 1.5f : playerEntity.getDefinition().height()); playerEntity.setFlag(EntityFlag.SNEAKING, sneaking); collisionManager.updatePlayerBoundingBox(); @@ -1065,7 +1064,7 @@ public class GeyserSession implements GeyserConnection, CommandSender { public void setSwimming(boolean swimming) { this.pose = swimming ? Pose.SWIMMING : Pose.STANDING; - playerEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, swimming ? 0.6f : playerEntity.getDefinition().height()); + playerEntity.setBoundingBoxHeight(swimming ? 0.6f : playerEntity.getDefinition().height()); playerEntity.setFlag(EntityFlag.SWIMMING, swimming); playerEntity.updateBedrockMetadata(); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java index 76d7edc17..1555722d6 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockMovePlayerTranslator.java @@ -33,10 +33,10 @@ import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; -import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -71,8 +71,6 @@ public class BedrockMovePlayerTranslator extends PacketTranslator Date: Fri, 3 Dec 2021 11:01:06 -0500 Subject: [PATCH 741/766] Allow for implementations to provide a custom resource loader This will allow Geyser-Fabric to work without resource loading issues. This commit also ensures try-with-resources is used anywhere a resource is accessed. --- .../bungeecord/GeyserBungeePlugin.java | 8 +- .../platform/spigot/GeyserSpigotPlugin.java | 9 +- .../platform/sponge/GeyserSpongePlugin.java | 10 +- .../standalone/GeyserStandaloneBootstrap.java | 5 +- .../velocity/GeyserVelocityPlugin.java | 7 +- .../org/geysermc/geyser/GeyserBootstrap.java | 31 +++- .../java/org/geysermc/geyser/GeyserImpl.java | 7 +- .../command/defaults/VersionCommand.java | 8 +- .../org/geysermc/geyser/dump/DumpInfo.java | 5 +- .../loader/BiomeIdentifierRegistryLoader.java | 5 +- .../loader/CollisionRegistryLoader.java | 4 +- .../registry/loader/EffectRegistryLoader.java | 6 +- .../loader/EnchantmentRegistryLoader.java | 6 +- .../registry/loader/NbtRegistryLoader.java | 8 +- .../registry/loader/SoundRegistryLoader.java | 4 +- .../populator/BlockRegistryPopulator.java | 9 +- .../populator/ItemRegistryPopulator.java | 21 ++- .../populator/RecipeRegistryPopulator.java | 7 +- .../geysermc/geyser/skin/ProvidedSkin.java | 31 ++-- .../geysermc/geyser/skin/SkinProvider.java | 10 +- .../geysermc/geyser/text/GeyserLocale.java | 157 +++++++++--------- .../org/geysermc/geyser/util/FileUtils.java | 73 ++++---- 22 files changed, 220 insertions(+), 211 deletions(-) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java index 26f7520f6..36e6ffb1d 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/GeyserBungeePlugin.java @@ -63,17 +63,21 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap { @Override public void onEnable() { + GeyserLocale.init(this); + if (!getDataFolder().exists()) getDataFolder().mkdir(); try { if (!getDataFolder().exists()) getDataFolder().mkdir(); - File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); + File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), + "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()), this); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserBungeeConfiguration.class); } catch (IOException ex) { - getLogger().log(Level.WARNING, GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); + getLogger().log(Level.SEVERE, GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); ex.printStackTrace(); + return; } if (getProxy().getConfig().getListeners().size() == 1) { diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java index 0b89580bb..12a27190d 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java @@ -79,16 +79,21 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { @Override public void onEnable() { + GeyserLocale.init(this); + // This is manually done instead of using Bukkit methods to save the config because otherwise comments get removed try { if (!getDataFolder().exists()) { getDataFolder().mkdir(); } - File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); + File configFile = FileUtils.fileOrCopiedFromResource(new File(getDataFolder(), "config.yml"), "config.yml", + (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()), this); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserSpigotConfiguration.class); } catch (IOException ex) { - getLogger().log(Level.WARNING, GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); + getLogger().log(Level.SEVERE, GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); ex.printStackTrace(); + Bukkit.getPluginManager().disablePlugin(this); + return; } try { diff --git a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java index 33b71fb63..f20f94a79 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/geyser/platform/sponge/GeyserSpongePlugin.java @@ -71,15 +71,19 @@ public class GeyserSpongePlugin implements GeyserBootstrap { @Override public void onEnable() { + GeyserLocale.init(this); + if (!configDir.exists()) configDir.mkdirs(); - File configFile = null; + File configFile; try { - configFile = FileUtils.fileOrCopiedFromResource(new File(configDir, "config.yml"), "config.yml", (file) -> file.replaceAll("generateduuid", UUID.randomUUID().toString())); + configFile = FileUtils.fileOrCopiedFromResource(new File(configDir, "config.yml"), "config.yml", + (file) -> file.replaceAll("generateduuid", UUID.randomUUID().toString()), this); } catch (IOException ex) { - logger.warn(GeyserLocale.getLocaleStringLog("geyser.config.failed")); + logger.error(GeyserLocale.getLocaleStringLog("geyser.config.failed")); ex.printStackTrace(); + return; } try { diff --git a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java index da215a399..b599550e3 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/geyser/platform/standalone/GeyserStandaloneBootstrap.java @@ -90,6 +90,8 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { boolean useGuiOpts = bootstrap.useGui; String configFilenameOpt = bootstrap.configFilename; + GeyserLocale.init(bootstrap); + List availableProperties = getPOJOForClass(GeyserJacksonConfiguration.class); for (int i = 0; i < args.length; i++) { @@ -188,7 +190,8 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap { LoopbackUtil.checkLoopback(geyserLogger); try { - File configFile = FileUtils.fileOrCopiedFromResource(new File(configFilename), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); + File configFile = FileUtils.fileOrCopiedFromResource(new File(configFilename), "config.yml", + (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()), this); geyserConfig = FileUtils.loadConfig(configFile, GeyserStandaloneConfiguration.class); handleArgsConfigOptions(); diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java index 5666fff7f..b0e39352c 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java @@ -83,16 +83,19 @@ public class GeyserVelocityPlugin implements GeyserBootstrap { @Override public void onEnable() { + GeyserLocale.init(this); + try { if (!configFolder.toFile().exists()) //noinspection ResultOfMethodCallIgnored configFolder.toFile().mkdirs(); File configFile = FileUtils.fileOrCopiedFromResource(configFolder.resolve("config.yml").toFile(), - "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString())); + "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()), this); this.geyserConfig = FileUtils.loadConfig(configFile, GeyserVelocityConfiguration.class); } catch (IOException ex) { - logger.warn(GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); + logger.error(GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex); ex.printStackTrace(); + return; } InetSocketAddress javaAddr = proxyServer.getBoundAddress(); diff --git a/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java b/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java index b313af9bb..8797d972a 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserBootstrap.java @@ -25,16 +25,16 @@ package org.geysermc.geyser; -import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.configuration.GeyserConfiguration; -import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.command.CommandManager; +import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.level.GeyserWorldManager; import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.ping.IGeyserPingPassthrough; +import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.io.InputStream; import java.net.SocketAddress; import java.nio.file.Path; import java.nio.file.Paths; @@ -126,4 +126,29 @@ public interface GeyserBootstrap { default Path getLogsPath() { return Paths.get("logs/latest.log"); } + + /** + * Get an InputStream for the given resource path. + * Overridden on platforms that have different class loader properties. + * + * @param resource Resource to get + * @return InputStream of the given resource, or null if not found + */ + default @Nullable InputStream getResourceOrNull(String resource) { + return GeyserBootstrap.class.getClassLoader().getResourceAsStream(resource); + } + + /** + * Get an InputStream for the given resource path, throws AssertionError if resource is not found. + * + * @param resource Resource to get + * @return InputStream of the given resource + */ + default @Nonnull InputStream getResource(String resource) { + InputStream stream = getResourceOrNull(resource); + if (stream == null) { + throw new AssertionError("Unable to find resource: " + resource); + } + return stream; + } } diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index eaadd15fa..bac5e0735 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -70,6 +70,7 @@ import org.geysermc.geyser.util.*; import javax.naming.directory.Attribute; import javax.naming.directory.InitialDirContext; +import java.io.InputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.UnknownHostException; @@ -139,6 +140,8 @@ public class GeyserImpl implements GeyserApi { this.platformType = platformType; + GeyserLocale.finalizeDefaultLocale(this); + logger.info("******************************************"); logger.info(""); logger.info(GeyserLocale.getLocaleStringLog("geyser.core.load", NAME, VERSION)); @@ -214,9 +217,9 @@ public class GeyserImpl implements GeyserApi { String branch = "unknown"; int buildNumber = -1; if (this.productionEnvironment()) { - try { + try (InputStream stream = bootstrap.getResource("git.properties")) { Properties gitProperties = new Properties(); - gitProperties.load(FileUtils.getResource("git.properties")); + gitProperties.load(stream); branch = gitProperties.getProperty("git.branch"); String build = gitProperties.getProperty("git.build.number"); if (build != null) { diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index 706395d5d..dbec4d4f8 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -30,14 +30,14 @@ import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; -import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.network.MinecraftProtocol; import org.geysermc.geyser.session.GeyserSession; -import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.text.ChatColor; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.util.WebUtils; import java.io.IOException; +import java.io.InputStream; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.List; @@ -69,9 +69,9 @@ public class VersionCommand extends GeyserCommand { // Disable update checking in dev mode and for players in Geyser Standalone if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.checking", sender.getLocale())); - try { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("git.properties")) { Properties gitProp = new Properties(); - gitProp.load(FileUtils.getResource("git.properties")); + gitProp.load(stream); String buildXML = WebUtils.getBody("https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/" + URLEncoder.encode(gitProp.getProperty("git.branch"), StandardCharsets.UTF_8.toString()) + "/lastSuccessfulBuild/api/xml?xpath=//buildNumber"); diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index 5a77b84fb..da98d45b5 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -47,6 +47,7 @@ import org.geysermc.floodgate.util.FloodgateInfoHolder; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.lang.management.ManagementFactory; import java.net.InetAddress; import java.net.InetSocketAddress; @@ -78,9 +79,9 @@ public class DumpInfo { public DumpInfo(boolean addLog) { this.versionInfo = new VersionInfo(); - try { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("git.properties")) { this.gitInfo = new Properties(); - this.gitInfo.load(FileUtils.getResource("git.properties")); + this.gitInfo.load(stream); } catch (IOException ignored) { } diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java index f510b3592..e685c8760 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/BiomeIdentifierRegistryLoader.java @@ -30,7 +30,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.util.FileUtils; import java.io.IOException; import java.io.InputStream; @@ -45,10 +44,10 @@ public class BiomeIdentifierRegistryLoader implements RegistryLoader> biomeEntriesType = new TypeReference>() { }; + TypeReference> biomeEntriesType = new TypeReference<>() { }; Map biomeEntries; - try (InputStream stream = FileUtils.getResource("mappings/biomes.json")) { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("mappings/biomes.json")) { biomeEntries = GeyserImpl.JSON_MAPPER.readValue(stream, biomeEntriesType); } catch (IOException e) { throw new AssertionError("Unable to load Bedrock runtime biomes", e); diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java index 1587a5420..949c3ee96 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/CollisionRegistryLoader.java @@ -65,10 +65,8 @@ public class CollisionRegistryLoader extends MultiResourceRegistryLoader collisionList; - try { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(input.value())) { ArrayNode collisionNode = (ArrayNode) GeyserImpl.JSON_MAPPER.readTree(stream); collisionList = loadBoundingBoxes(collisionNode); } catch (Exception e) { diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java index 7da3a3b6c..8d46d2639 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/EffectRegistryLoader.java @@ -27,7 +27,6 @@ package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.databind.JsonNode; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.util.FileUtils; import java.io.InputStream; import java.util.Map; @@ -43,10 +42,9 @@ public abstract class EffectRegistryLoader implements RegistryLoader> { @Override public Map load(String input) { - InputStream enchantmentsStream = FileUtils.getResource(input); JsonNode enchantmentsNode; - try { + try (InputStream enchantmentsStream = GeyserImpl.getInstance().getBootstrap().getResource(input)) { enchantmentsNode = GeyserImpl.JSON_MAPPER.readTree(enchantmentsStream); } catch (Exception e) { throw new AssertionError("Unable to load enchantment data", e); diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java index 6134e8d98..e4006c0f2 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/NbtRegistryLoader.java @@ -28,9 +28,7 @@ package org.geysermc.geyser.registry.loader; import com.nukkitx.nbt.NBTInputStream; import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtUtils; -import org.geysermc.geyser.util.FileUtils; - -import java.io.InputStream; +import org.geysermc.geyser.GeyserImpl; /** * Loads NBT data from the given resource path. @@ -39,8 +37,8 @@ public class NbtRegistryLoader implements RegistryLoader { @Override public NbtMap load(String input) { - InputStream stream = FileUtils.getResource(input); - try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream, true, true)) { + try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(GeyserImpl.getInstance().getBootstrap().getResource(input), + true, true)) { return (NbtMap) nbtInputStream.readTag(); } catch (Exception e) { throw new AssertionError("Failed to load registrations for " + input, e); diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/SoundRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/SoundRegistryLoader.java index d87b2921b..0cdb4ea5d 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/SoundRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/SoundRegistryLoader.java @@ -28,7 +28,6 @@ package org.geysermc.geyser.registry.loader; import com.fasterxml.jackson.databind.JsonNode; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.registry.type.SoundMapping; -import org.geysermc.geyser.util.FileUtils; import java.io.IOException; import java.io.InputStream; @@ -43,9 +42,8 @@ public class SoundRegistryLoader implements RegistryLoader load(String input) { - InputStream stream = FileUtils.getResource(input); JsonNode soundsTree; - try { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(input)) { soundsTree = GeyserImpl.JSON_MAPPER.readTree(stream); } catch (IOException e) { throw new AssertionError("Unable to load sound mappings", e); diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index 8df6f0a7f..301dfa1da 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -43,7 +43,6 @@ import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.BlockMapping; import org.geysermc.geyser.registry.type.BlockMappings; import org.geysermc.geyser.util.BlockUtils; -import org.geysermc.geyser.util.FileUtils; import java.io.DataInputStream; import java.io.InputStream; @@ -83,9 +82,9 @@ public class BlockRegistryPopulator { private static void registerBedrockBlocks() { for (Map.Entry, BiFunction> palette : BLOCK_MAPPERS.entrySet()) { - InputStream stream = FileUtils.getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key())); NbtList blocksTag; - try (NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(String.format("bedrock/block_palette.%s.nbt", palette.getKey().key())); + NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) { NbtMap blockPalette = (NbtMap) nbtInputStream.readTag(); blocksTag = (NbtList) blockPalette.getList("blocks", NbtType.COMPOUND); } catch (Exception e) { @@ -208,10 +207,8 @@ public class BlockRegistryPopulator { } private static void registerJavaBlocks() { - InputStream stream = FileUtils.getResource("mappings/blocks.json"); - JsonNode blocksJson; - try { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("mappings/blocks.json")) { blocksJson = GeyserImpl.JSON_MAPPER.readTree(stream); } catch (Exception e) { throw new AssertionError("Unable to load Java block mappings", e); diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index 340c6a45c..6a730010e 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -38,14 +38,17 @@ import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.v465.Bedrock_v465; import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; -import it.unimi.dsi.fastutil.ints.*; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.objects.*; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.item.StoredItemMappings; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.*; -import org.geysermc.geyser.util.FileUtils; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -69,13 +72,13 @@ public class ItemRegistryPopulator { } public static void populate() { - // Load item mappings from Java Edition to Bedrock Edition - InputStream stream = FileUtils.getResource("mappings/items.json"); + GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap(); TypeReference> mappingItemsType = new TypeReference<>() { }; Map items; - try { + try (InputStream stream = bootstrap.getResource("mappings/items.json")) { + // Load item mappings from Java Edition to Bedrock Edition items = GeyserImpl.JSON_MAPPER.readValue(stream, mappingItemsType); } catch (Exception e) { throw new AssertionError("Unable to load Java runtime item IDs", e); @@ -83,8 +86,6 @@ public class ItemRegistryPopulator { /* Load item palette */ for (Map.Entry palette : PALETTE_VERSIONS.entrySet()) { - stream = FileUtils.getResource(String.format("bedrock/runtime_item_states.%s.json", palette.getKey())); - TypeReference> paletteEntriesType = new TypeReference<>() {}; // Used to get the Bedrock namespaced ID (in instances where there are small differences) @@ -94,7 +95,7 @@ public class ItemRegistryPopulator { List itemNames = new ArrayList<>(); List itemEntries; - try { + try (InputStream stream = bootstrap.getResource(String.format("bedrock/runtime_item_states.%s.json", palette.getKey()))) { itemEntries = GeyserImpl.JSON_MAPPER.readValue(stream, paletteEntriesType); } catch (Exception e) { throw new AssertionError("Unable to load Bedrock runtime item IDs", e); @@ -112,10 +113,8 @@ public class ItemRegistryPopulator { // Load creative items // We load this before item mappings to get overridden block runtime ID mappings - stream = FileUtils.getResource(String.format("bedrock/creative_items.%s.json", palette.getKey())); - JsonNode creativeItemEntries; - try { + try (InputStream stream = bootstrap.getResource(String.format("bedrock/creative_items.%s.json", palette.getKey()))) { creativeItemEntries = GeyserImpl.JSON_MAPPER.readTree(stream).get("items"); } catch (Exception e) { throw new AssertionError("Unable to load creative items", e); diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java index ecc3fbb29..7af45f74d 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/RecipeRegistryPopulator.java @@ -40,12 +40,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMappings; -import org.geysermc.geyser.util.FileUtils; import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -60,10 +59,8 @@ import static org.geysermc.geyser.util.InventoryUtils.LAST_RECIPE_NET_ID; public class RecipeRegistryPopulator { public static void populate() { - InputStream stream = FileUtils.getResource("mappings/recipes.json"); - JsonNode items; - try { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("mappings/recipes.json")) { items = GeyserImpl.JSON_MAPPER.readTree(stream); } catch (Exception e) { throw new AssertionError(GeyserLocale.getLocaleStringLog("geyser.toolbox.fail.runtime_java"), e); diff --git a/core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java b/core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java index e7b08ad3f..e51882036 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java +++ b/core/src/main/java/org/geysermc/geyser/skin/ProvidedSkin.java @@ -26,37 +26,36 @@ package org.geysermc.geyser.skin; import lombok.Getter; +import org.geysermc.geyser.GeyserImpl; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.InputStream; public class ProvidedSkin { @Getter private byte[] skin; public ProvidedSkin(String internalUrl) { try { - BufferedImage image = ImageIO.read(ProvidedSkin.class.getClassLoader().getResource(internalUrl)); + BufferedImage image; + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(internalUrl)) { + image = ImageIO.read(stream); + } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(image.getWidth() * 4 + image.getHeight() * 4); - try { - for (int y = 0; y < image.getHeight(); y++) { - for (int x = 0; x < image.getWidth(); x++) { - int rgba = image.getRGB(x, y); - outputStream.write((rgba >> 16) & 0xFF); // Red - outputStream.write((rgba >> 8) & 0xFF); // Green - outputStream.write(rgba & 0xFF); // Blue - outputStream.write((rgba >> 24) & 0xFF); // Alpha - } + for (int y = 0; y < image.getHeight(); y++) { + for (int x = 0; x < image.getWidth(); x++) { + int rgba = image.getRGB(x, y); + outputStream.write((rgba >> 16) & 0xFF); // Red + outputStream.write((rgba >> 8) & 0xFF); // Green + outputStream.write(rgba & 0xFF); // Blue + outputStream.write((rgba >> 24) & 0xFF); // Alpha } - image.flush(); - skin = outputStream.toByteArray(); - } finally { - try { - outputStream.close(); - } catch (IOException ignored) {} } + image.flush(); + skin = outputStream.toByteArray(); } catch (IOException e) { e.printStackTrace(); } diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java index e6807e3f7..91c555f3d 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java @@ -94,19 +94,19 @@ public class SkinProvider { static { /* Load in the normal ears geometry */ - EARS_GEOMETRY = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.ears.json")), StandardCharsets.UTF_8); + EARS_GEOMETRY = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.ears.json"), StandardCharsets.UTF_8); /* Load in the slim ears geometry */ - EARS_GEOMETRY_SLIM = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.earsSlim.json")), StandardCharsets.UTF_8); + EARS_GEOMETRY_SLIM = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.earsSlim.json"), StandardCharsets.UTF_8); /* Load in the custom skull geometry */ - String skullData = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.customskull.json")), StandardCharsets.UTF_8); + String skullData = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.customskull.json"), StandardCharsets.UTF_8); SKULL_GEOMETRY = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.customskull\"}}", skullData, false); /* Load in the player head skull geometry */ - String wearingCustomSkull = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.wearingCustomSkull.json")), StandardCharsets.UTF_8); + String wearingCustomSkull = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.wearingCustomSkull.json"), StandardCharsets.UTF_8); WEARING_CUSTOM_SKULL = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkull\"}}", wearingCustomSkull, false); - String wearingCustomSkullSlim = new String(FileUtils.readAllBytes(FileUtils.getResource("bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json")), StandardCharsets.UTF_8); + String wearingCustomSkullSlim = new String(FileUtils.readAllBytes("bedrock/skin/geometry.humanoid.wearingCustomSkullSlim.json"), StandardCharsets.UTF_8); WEARING_CUSTOM_SKULL_SLIM = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkullSlim\"}}", wearingCustomSkullSlim, false); // Schedule Daily Image Expiry if we are caching them diff --git a/core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java b/core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java index 36e5aaae1..8fc98402a 100644 --- a/core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java +++ b/core/src/main/java/org/geysermc/geyser/text/GeyserLocale.java @@ -25,9 +25,10 @@ package org.geysermc.geyser.text; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserImpl; -import org.geysermc.geyser.util.FileUtils; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; @@ -40,48 +41,106 @@ import java.util.Properties; public class GeyserLocale { /** - * If we determine the locale that the user wishes to use, use that locale + * If we determine the default locale that the user wishes to use, use that locale */ - private static String CACHED_LOCALE; + private static String DEFAULT_LOCALE; + /** + * Whether the system locale cannot be loaded by Geyser. + */ + private static boolean SYSTEM_LOCALE_INVALID; private static final Map LOCALE_MAPPINGS = new HashMap<>(); - static { - // Load it as a backup in case something goes really wrong - if (!"en_US".equals(formatLocale(getDefaultLocale()))) { // getDefaultLocale() loads the locale automatically - loadGeyserLocale("en_US"); + /** + * Loads the initial locale(s) with the help of the bootstrap. + */ + public static void init(GeyserBootstrap bootstrap) { + String defaultLocale = formatLocale(Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry()); + String loadedLocale = loadGeyserLocale(defaultLocale, bootstrap); + if (loadedLocale != null) { + DEFAULT_LOCALE = loadedLocale; + // Load English as a backup in case something goes really wrong + if (!"en_US".equals(loadedLocale)) { + loadGeyserLocale("en_US", bootstrap); + } + SYSTEM_LOCALE_INVALID = false; + } else { + DEFAULT_LOCALE = loadGeyserLocale("en_US", bootstrap); + if (DEFAULT_LOCALE == null) { + // en_US can't be loaded? + throw new IllegalStateException("English locale not found in Geyser. Did you clone the submodules? (git submodule update --init)"); + } + SYSTEM_LOCALE_INVALID = true; } } + /** + * Finalize the default locale, now that we know what the default locale should be. + */ + public static void finalizeDefaultLocale(GeyserImpl geyser) { + String newDefaultLocale = geyser.getConfig().getDefaultLocale(); + if (newDefaultLocale == null) { + // We want to use the system locale which is already loaded + return; + } + String loadedNewLocale = loadGeyserLocale(newDefaultLocale, geyser.getBootstrap()); + if (loadedNewLocale != null) { + // The config's locale is valid + DEFAULT_LOCALE = loadedNewLocale; + } else if (SYSTEM_LOCALE_INVALID) { + geyser.getLogger().warning(Locale.getDefault().toString() + " is not a valid Bedrock language."); + } + } + + public static String getDefaultLocale() { + return DEFAULT_LOCALE; + } + /** * Loads a Geyser locale from resources, if the file doesn't exist it just logs a warning * * @param locale Locale to load */ public static void loadGeyserLocale(String locale) { + GeyserImpl geyser = GeyserImpl.getInstance(); + if (geyser == null) { + throw new IllegalStateException("Geyser instance cannot be null when loading a locale!"); + } + loadGeyserLocale(locale, geyser.getBootstrap()); + } + + private static String loadGeyserLocale(String locale, GeyserBootstrap bootstrap) { locale = formatLocale(locale); // Don't load the locale if it's already loaded. if (LOCALE_MAPPINGS.containsKey(locale)) { - return; + return locale; } - InputStream localeStream = GeyserImpl.class.getClassLoader().getResourceAsStream("languages/texts/" + locale + ".properties"); + InputStream localeStream = bootstrap.getResourceOrNull("languages/texts/" + locale + ".properties"); // Load the locale if (localeStream != null) { - Properties localeProp = new Properties(); - try (InputStreamReader reader = new InputStreamReader(localeStream, StandardCharsets.UTF_8)) { - localeProp.load(reader); - } catch (Exception e) { - throw new AssertionError(getLocaleStringLog("geyser.language.load_failed", locale), e); - } + try { + Properties localeProp = new Properties(); + try (InputStreamReader reader = new InputStreamReader(localeStream, StandardCharsets.UTF_8)) { + localeProp.load(reader); + } catch (Exception e) { + throw new AssertionError(getLocaleStringLog("geyser.language.load_failed", locale), e); + } - // Insert the locale into the mappings - LOCALE_MAPPINGS.put(locale, localeProp); + // Insert the locale into the mappings + LOCALE_MAPPINGS.put(locale, localeProp); + return locale; + } finally { + try { + localeStream.close(); + } catch (IOException ignored) {} + } } else { - if (GeyserImpl.getInstance() != null && GeyserImpl.getInstance().getLogger() != null) { + if (GeyserImpl.getInstance() != null) { GeyserImpl.getInstance().getLogger().warning("Missing locale: " + locale); } + return null; } } @@ -157,66 +216,4 @@ public class GeyserLocale { String country = locale.substring(3); return language.toLowerCase(Locale.ENGLISH) + "_" + country.toUpperCase(Locale.ENGLISH); } - - /** - * Get the default locale that Geyser should use - * @return the current default locale - */ - public static String getDefaultLocale() { - if (CACHED_LOCALE != null) { - return CACHED_LOCALE; // We definitely know the locale the user is using - } - - String locale; - boolean isValid = true; - if (GeyserImpl.getInstance() != null && - GeyserImpl.getInstance().getConfig() != null && - GeyserImpl.getInstance().getConfig().getDefaultLocale() != null) { // If the config option for getDefaultLocale does not equal null, use that - locale = formatLocale(GeyserImpl.getInstance().getConfig().getDefaultLocale()); - if (isValidLanguage(locale)) { - CACHED_LOCALE = locale; - return locale; - } else { - isValid = false; - } - } - locale = formatLocale(Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry()); - if (!isValidLanguage(locale)) { // Bedrock does not support this language - locale = "en_US"; - loadGeyserLocale(locale); - } - if (GeyserImpl.getInstance() != null && - GeyserImpl.getInstance().getConfig() != null && (GeyserImpl.getInstance().getConfig().getDefaultLocale() == null || !isValid)) { // Means we should use the system locale for sure - CACHED_LOCALE = locale; - } - return locale; - } - - /** - * Ensures that the given locale is supported by Bedrock - * @param locale the locale to validate - * @return true if the given locale is supported by Bedrock and by extension Geyser - */ - private static boolean isValidLanguage(String locale) { - boolean result = true; - if (FileUtils.class.getResource("/languages/texts/" + locale + ".properties") == null) { - result = false; - if (GeyserImpl.getInstance() != null && GeyserImpl.getInstance().getLogger() != null) { // Could be too early for these to be initialized - if (locale.equals("en_US")) { - GeyserImpl.getInstance().getLogger().error("English locale not found in Geyser. Did you clone the submodules? (git submodule update --init)"); - } else { - GeyserImpl.getInstance().getLogger().warning(locale + " is not a valid Bedrock language."); // We can't translate this since we just loaded an invalid language - } - } - } else { - if (!LOCALE_MAPPINGS.containsKey(locale)) { - loadGeyserLocale(locale); - } - } - return result; - } - - public static void init() { - // no-op - } } diff --git a/core/src/main/java/org/geysermc/geyser/util/FileUtils.java b/core/src/main/java/org/geysermc/geyser/util/FileUtils.java index 0671c5df7..691ebff44 100644 --- a/core/src/main/java/org/geysermc/geyser/util/FileUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/FileUtils.java @@ -25,10 +25,9 @@ package org.geysermc.geyser.util; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserImpl; import java.io.*; @@ -58,28 +57,11 @@ public class FileUtils { return objectMapper.readValue(src, valueType); } - public static T loadYaml(InputStream src, Class valueType) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()).enable(JsonParser.Feature.IGNORE_UNDEFINED).disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - return objectMapper.readValue(src, valueType); - } - public static T loadJson(InputStream src, Class valueType) throws IOException { // Read specifically with UTF-8 to allow any non-UTF-encoded JSON to read return GeyserImpl.JSON_MAPPER.readValue(new InputStreamReader(src, StandardCharsets.UTF_8), valueType); } - /** - * Open the specified file or copy if from resources - * - * @param name File and resource name - * @param fallback Formatting callback - * @return File handle of the specified file - * @throws IOException if the file failed to copy from resource - */ - public static File fileOrCopiedFromResource(String name, Function fallback) throws IOException { - return fileOrCopiedFromResource(new File(name), name, fallback); - } - /** * Open the specified file or copy if from resources * @@ -89,12 +71,12 @@ public class FileUtils { * @return File handle of the specified file * @throws IOException if the file failed to copy from resource */ - public static File fileOrCopiedFromResource(File file, String name, Function format) throws IOException { + public static File fileOrCopiedFromResource(File file, String name, Function format, GeyserBootstrap bootstrap) throws IOException { if (!file.exists()) { //noinspection ResultOfMethodCallIgnored file.createNewFile(); try (FileOutputStream fos = new FileOutputStream(file)) { - try (InputStream input = GeyserImpl.class.getResourceAsStream("/" + name)) { // resources need leading "/" prefix + try (InputStream input = bootstrap.getResource(name)) { byte[] bytes = new byte[input.available()]; //noinspection ResultOfMethodCallIgnored @@ -144,20 +126,6 @@ public class FileUtils { writeFile(new File(name), data); } - /** - * Get an InputStream for the given resource path, throws AssertionError if resource is not found - * - * @param resource Resource to get - * @return InputStream of the given resource - */ - public static InputStream getResource(String resource) { - InputStream stream = FileUtils.class.getClassLoader().getResourceAsStream(resource); - if (stream == null) { - throw new AssertionError("Unable to find resource: " + resource); - } - return stream; - } - /** * Calculate the SHA256 hash of a file * @@ -208,6 +176,18 @@ public class FileUtils { } } + /** + * @param resource the internal resource to read off from + * @return the byte array of an InputStream + */ + public static byte[] readAllBytes(String resource) { + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource(resource)) { + return readAllBytes(stream); + } catch (IOException e) { + throw new RuntimeException("Error while trying to read internal input stream!", e); + } + } + /** * @param stream the InputStream to read off of * @return the byte array of an InputStream @@ -265,15 +245,18 @@ public class FileUtils { * @return a set of all the classes annotated by the given annotation */ public static Set> getGeneratedClassesForAnnotation(String input) { - InputStream annotatedClass = FileUtils.getResource(input); - BufferedReader reader = new BufferedReader(new InputStreamReader(annotatedClass)); - return reader.lines().map(className -> { - try { - return Class.forName(className); - } catch (ClassNotFoundException ex) { - GeyserImpl.getInstance().getLogger().error("Failed to find class " + className, ex); - throw new RuntimeException(ex); - } - }).collect(Collectors.toSet()); + try (InputStream annotatedClass = GeyserImpl.getInstance().getBootstrap().getResource(input); + BufferedReader reader = new BufferedReader(new InputStreamReader(annotatedClass))) { + return reader.lines().map(className -> { + try { + return Class.forName(className); + } catch (ClassNotFoundException ex) { + GeyserImpl.getInstance().getLogger().error("Failed to find class " + className, ex); + throw new RuntimeException(ex); + } + }).collect(Collectors.toSet()); + } catch (IOException e) { + throw new RuntimeException(e); + } } } From 4da3edd02cde710e86c21e60c40760d858c2c9e7 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 3 Dec 2021 11:32:09 -0500 Subject: [PATCH 742/766] Build Geyser-Fabric 1.18 branch on successful build --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e43447a7..481c02310 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -92,7 +92,7 @@ pipeline { success { script { if (env.BRANCH_NAME == 'master') { - build propagate: false, wait: false, job: 'GeyserMC/Geyser-Fabric/java-1.17', parameters: [booleanParam(name: 'SKIP_DISCORD', value: true)] + build propagate: false, wait: false, job: 'GeyserMC/Geyser-Fabric/java-1.18', parameters: [booleanParam(name: 'SKIP_DISCORD', value: true)] build propagate: false, wait: false, job: 'GeyserMC/GeyserConnect/master', parameters: [booleanParam(name: 'SKIP_DISCORD', value: true)] } } From 66819aee83b4106f7856f6debfb12ebabbe717a3 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 3 Dec 2021 19:24:22 -0500 Subject: [PATCH 743/766] Null check for player textures in GameProfile Fixes an issue with the ZNPCs plugin. --- .../org/geysermc/geyser/skin/SkinManager.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java index 02b4123e5..16833d634 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinManager.java @@ -240,7 +240,12 @@ public class SkinManager { // Likely offline mode return loadBedrockOrOfflineSkin(profile); } - return loadFromJson(skinProperty.getValue()); + GameProfileData data = loadFromJson(skinProperty.getValue()); + if (data != null) { + return data; + } else { + return loadBedrockOrOfflineSkin(profile); + } } catch (IOException exception) { GeyserImpl.getInstance().getLogger().debug("Something went wrong while processing skin for " + profile.getName()); if (GeyserImpl.getInstance().getConfig().isDebugMode()) { @@ -254,18 +259,21 @@ public class SkinManager { JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8)); JsonNode textures = skinObject.get("textures"); - JsonNode skinTexture = textures.get("SKIN"); - String skinUrl = skinTexture.get("url").asText().replace("http://", "https://"); + if (textures != null) { + JsonNode skinTexture = textures.get("SKIN"); + String skinUrl = skinTexture.get("url").asText().replace("http://", "https://"); - boolean isAlex = skinTexture.has("metadata"); + boolean isAlex = skinTexture.has("metadata"); - String capeUrl = null; - JsonNode capeTexture = textures.get("CAPE"); - if (capeTexture != null) { - capeUrl = capeTexture.get("url").asText().replace("http://", "https://"); + String capeUrl = null; + JsonNode capeTexture = textures.get("CAPE"); + if (capeTexture != null) { + capeUrl = capeTexture.get("url").asText().replace("http://", "https://"); + } + + return new GameProfileData(skinUrl, capeUrl, isAlex); } - - return new GameProfileData(skinUrl, capeUrl, isAlex); + return null; } /** From f0213d4b8e3ca458670fddc0c63de042d20970c9 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 3 Dec 2021 20:26:20 -0500 Subject: [PATCH 744/766] Minor fixes; add CPU count to dump --- .../geyser/platform/velocity/GeyserVelocityPlugin.java | 6 +++--- core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java | 3 +++ .../java/org/geysermc/geyser/network/MinecraftProtocol.java | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java index b0e39352c..8106192ac 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/geyser/platform/velocity/GeyserVelocityPlugin.java @@ -36,17 +36,17 @@ import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.proxy.ProxyServer; import lombok.Getter; import org.geysermc.common.PlatformType; -import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserBootstrap; -import org.geysermc.geyser.session.auth.AuthType; +import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.configuration.GeyserConfiguration; import org.geysermc.geyser.dump.BootstrapDumpInfo; import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough; import org.geysermc.geyser.ping.IGeyserPingPassthrough; import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandExecutor; import org.geysermc.geyser.platform.velocity.command.GeyserVelocityCommandManager; -import org.geysermc.geyser.util.FileUtils; +import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.text.GeyserLocale; +import org.geysermc.geyser.util.FileUtils; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index da98d45b5..8a21b6929 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -66,6 +66,7 @@ public class DumpInfo { private static final long MEGABYTE = 1024L * 1024L; private final DumpInfo.VersionInfo versionInfo; + private final int cpuCount; private Properties gitInfo; private final GeyserConfiguration config; private final Floodgate floodgate; @@ -79,6 +80,8 @@ public class DumpInfo { public DumpInfo(boolean addLog) { this.versionInfo = new VersionInfo(); + this.cpuCount = Runtime.getRuntime().availableProcessors(); + try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("git.properties")) { this.gitInfo = new Properties(); this.gitInfo.load(stream); diff --git a/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java index a9df533d5..6015bf229 100644 --- a/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java @@ -39,7 +39,7 @@ import java.util.StringJoiner; /** * Contains information about the supported protocols in Geyser. */ -public class MinecraftProtocol { +public final class MinecraftProtocol { /** * Default Bedrock codec that should act as a fallback. Should represent the latest available * release of the game that Geyser supports. @@ -114,4 +114,7 @@ public class MinecraftProtocol { return joiner.toString(); } + + private MinecraftProtocol() { + } } From 2e9ac9db7c6a74187f588252c87acc3eef25fc66 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 4 Dec 2021 14:17:26 -0600 Subject: [PATCH 745/766] Use EnumMap in InventoryTranslator for inventory translators --- .../geyser/translator/inventory/InventoryTranslator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index d6bc4b186..a35fdfbcb 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -65,7 +65,7 @@ import java.util.*; public abstract class InventoryTranslator { public static final InventoryTranslator PLAYER_INVENTORY_TRANSLATOR = new PlayerInventoryTranslator(); - public static final Map INVENTORY_TRANSLATORS = new HashMap<>() { + public static final Map INVENTORY_TRANSLATORS = new EnumMap<>(ContainerType.class) { { /* Player Inventory */ put(null, PLAYER_INVENTORY_TRANSLATOR); From 1d713cb34c20a94333b056632f18bfac7071a188 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 4 Dec 2021 14:35:01 -0600 Subject: [PATCH 746/766] Fix handling for null ContainerTypes EnumMap does not permit null values. --- .../inventory/InventoryTranslator.java | 22 +++++++++++++++---- .../inventory/JavaOpenScreenTranslator.java | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index a35fdfbcb..0e22fc0be 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -41,6 +41,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*; import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket; import it.unimi.dsi.fastutil.ints.*; import lombok.AllArgsConstructor; +import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.inventory.CartographyContainer; import org.geysermc.geyser.inventory.GeyserItemStack; @@ -65,11 +66,8 @@ import java.util.*; public abstract class InventoryTranslator { public static final InventoryTranslator PLAYER_INVENTORY_TRANSLATOR = new PlayerInventoryTranslator(); - public static final Map INVENTORY_TRANSLATORS = new EnumMap<>(ContainerType.class) { + private static final Map INVENTORY_TRANSLATORS = new EnumMap<>(ContainerType.class) { { - /* Player Inventory */ - put(null, PLAYER_INVENTORY_TRANSLATOR); - /* Chest UIs */ put(ContainerType.GENERIC_9X1, new SingleChestInventoryTranslator(9)); put(ContainerType.GENERIC_9X2, new SingleChestInventoryTranslator(18)); @@ -878,6 +876,22 @@ public abstract class InventoryTranslator { return slotInfoData.getContainer() == ContainerSlotType.CURSOR; } + /** + * Gets the {@link InventoryTranslator} for the given {@link ContainerType}. + * Returns {@link #PLAYER_INVENTORY_TRANSLATOR} if type is null. + * + * @param type the type + * @return the InventoryType for the given ContainerType. + */ + @Nullable + public static InventoryTranslator inventoryTranslator(@Nullable ContainerType type) { + if (type == null) { + return PLAYER_INVENTORY_TRANSLATOR; + } + + return INVENTORY_TRANSLATORS.get(type); + } + protected enum CraftState { START, RECIPE_ID, diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java index 69066eb39..dafe1fb2d 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/inventory/JavaOpenScreenTranslator.java @@ -45,7 +45,7 @@ public class JavaOpenScreenTranslator extends PacketTranslator Date: Sun, 5 Dec 2021 19:03:47 -0500 Subject: [PATCH 747/766] Prevent errors from simply being swallowed --- .../geyser/entity/type/LivingEntity.java | 9 +++-- .../network/ConnectorServerEventHandler.java | 33 +++++++++++++------ .../geyser/network/UpstreamPacketHandler.java | 5 +++ .../player/BedrockActionTranslator.java | 20 +++++------ 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index 2aff7f9e1..cd1a2ef3f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -255,8 +255,13 @@ public class LivingEntity extends Entity { if (javaAttribute.getType() instanceof AttributeType.Builtin type) { switch (type) { case GENERIC_MAX_HEALTH -> { - this.maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); - newAttributes.add(createHealthAttribute()); + float maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); + if (this.maxHealth != maxHealth) { + // Helps prnt respawn bugs where the player respawns twice + // Because we re-sent the health attribute as 0 + this.maxHealth = maxHealth; + newAttributes.add(createHealthAttribute()); + } } case GENERIC_ATTACK_DAMAGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.ATTACK_DAMAGE)); case GENERIC_FLYING_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FLYING_SPEED)); diff --git a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java index 2cd866365..97ed35785 100644 --- a/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/ConnectorServerEventHandler.java @@ -165,19 +165,32 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler { } @Override - public void onSessionCreation(BedrockServerSession bedrockServerSession) { - bedrockServerSession.setLogging(true); - bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel()); - bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next()))); - // Set the packet codec to default just in case we need to send disconnect packets. - bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC); + public void onSessionCreation(@Nonnull BedrockServerSession bedrockServerSession) { + try { + bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC); + bedrockServerSession.setLogging(true); + bedrockServerSession.setCompressionLevel(geyser.getConfig().getBedrock().getCompressionLevel()); + bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(geyser, new GeyserSession(geyser, bedrockServerSession, eventLoopGroup.next()))); + // Set the packet codec to default just in case we need to send disconnect packets. + } catch (Throwable e) { + // Error must be caught or it will be swallowed + geyser.getLogger().error("Error occurred while initializing player!", e); + bedrockServerSession.disconnect(e.getMessage()); + } } @Override - public void onUnhandledDatagram(@Nonnull ChannelHandlerContext ctx, DatagramPacket packet) { - ByteBuf content = packet.content(); - if (QueryPacketHandler.isQueryPacket(content)) { - new QueryPacketHandler(geyser, packet.sender(), content); + public void onUnhandledDatagram(@Nonnull ChannelHandlerContext ctx, @Nonnull DatagramPacket packet) { + try { + ByteBuf content = packet.content(); + if (QueryPacketHandler.isQueryPacket(content)) { + new QueryPacketHandler(geyser, packet.sender(), content); + } + } catch (Throwable e) { + // Error must be caught or it will be swallowed + if (geyser.getConfig().isDebugMode()) { + geyser.getLogger().error("Error occurred during unhandled datagram!", e); + } } } } \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index 4d22bd7ce..38673769b 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -91,6 +91,11 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { LoginEncryptionUtils.encryptPlayerConnection(session, loginPacket); + if (session.isClosed()) { + // Can happen if Xbox validation fails + return true; + } + PlayStatusPacket playStatus = new PlayStatusPacket(); playStatus.setStatus(PlayStatusPacket.Status.LOGIN_SUCCESS); session.sendUpstreamPacket(playStatus); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java index 711285948..8494daade 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockActionTranslator.java @@ -40,16 +40,14 @@ import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; import org.geysermc.geyser.entity.type.player.SessionPlayerEntity; import org.geysermc.geyser.inventory.PlayerInventory; -import org.geysermc.geyser.session.GeyserSession; -import org.geysermc.geyser.translator.protocol.PacketTranslator; -import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.ItemMapping; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.protocol.PacketTranslator; +import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.util.BlockUtils; -import java.util.ArrayList; - @Translator(packet = PlayerActionPacket.class) public class BedrockActionTranslator extends PacketTranslator { @@ -63,7 +61,6 @@ public class BedrockActionTranslator extends PacketTranslator(entity.getAttributes().values())); + attributesPacket.getAttributes().addAll(entity.getAttributes().values()); session.sendUpstreamPacket(attributesPacket); break; case START_SWIMMING: @@ -147,6 +144,7 @@ public class BedrockActionTranslator extends PacketTranslator(entity.getAttributes().values())); + attributesPacket.getAttributes().addAll(entity.getAttributes().values()); session.sendUpstreamPacket(attributesPacket); session.getEntityCache().updateBossBars(); From 70ec77b1e3a8c4a97a81692d8180f9b7c1ca92b5 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 5 Dec 2021 19:07:51 -0500 Subject: [PATCH 748/766] Revert this particular change since it wasn't quite ready yet --- .../org/geysermc/geyser/entity/type/LivingEntity.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index cd1a2ef3f..2aff7f9e1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -255,13 +255,8 @@ public class LivingEntity extends Entity { if (javaAttribute.getType() instanceof AttributeType.Builtin type) { switch (type) { case GENERIC_MAX_HEALTH -> { - float maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); - if (this.maxHealth != maxHealth) { - // Helps prnt respawn bugs where the player respawns twice - // Because we re-sent the health attribute as 0 - this.maxHealth = maxHealth; - newAttributes.add(createHealthAttribute()); - } + this.maxHealth = (float) AttributeUtils.calculateValue(javaAttribute); + newAttributes.add(createHealthAttribute()); } case GENERIC_ATTACK_DAMAGE -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.ATTACK_DAMAGE)); case GENERIC_FLYING_SPEED -> newAttributes.add(calculateAttribute(javaAttribute, GeyserAttributeType.FLYING_SPEED)); From 1840172c8dcd37587d7659abc9c2c41dbc9ac046 Mon Sep 17 00:00:00 2001 From: Kenox Date: Mon, 6 Dec 2021 16:43:36 +0100 Subject: [PATCH 749/766] Fix custom merchant inventory not opening (#2672) --- .../geyser/inventory/MerchantContainer.java | 2 ++ .../BedrockContainerCloseTranslator.java | 5 +++++ .../JavaMerchantOffersTranslator.java | 20 +++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java b/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java index 916fa775a..fecb79580 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/MerchantContainer.java @@ -27,6 +27,7 @@ package org.geysermc.geyser.inventory; import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade; import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundMerchantOffersPacket; import lombok.Getter; import lombok.Setter; import org.geysermc.geyser.entity.type.Entity; @@ -36,6 +37,7 @@ import org.geysermc.geyser.entity.type.Entity; public class MerchantContainer extends Container { private Entity villager; private VillagerTrade[] villagerTrades; + private ClientboundMerchantOffersPacket pendingOffersPacket; public MerchantContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) { super(title, id, size, containerType, playerInventory); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java index 4c1f55018..daf61acef 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockContainerCloseTranslator.java @@ -32,6 +32,7 @@ import org.geysermc.geyser.inventory.MerchantContainer; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.translator.protocol.java.inventory.JavaMerchantOffersTranslator; import org.geysermc.geyser.util.InventoryUtils; @Translator(packet = ContainerClosePacket.class) @@ -59,6 +60,10 @@ public class BedrockContainerCloseTranslator extends PacketTranslator no need of queuing the merchant inventory + if (!openInventory.isPending()) { + openMerchant(session, packet, merchantInventory); + return; + } + + // The inventory is declared as pending due to previous closing inventory -> leads to an incorrect order of execution + // Handled in BedrockContainerCloseTranslator + merchantInventory.setPendingOffersPacket(packet); + } + + public static void openMerchant(GeyserSession session, ClientboundMerchantOffersPacket packet, MerchantContainer merchantInventory) { // Retrieve the fake villager involved in the trade, and update its metadata to match with the window information merchantInventory.setVillagerTrades(packet.getTrades()); Entity villager = merchantInventory.getVillager(); @@ -70,7 +82,7 @@ public class JavaMerchantOffersTranslator extends PacketTranslator Date: Mon, 6 Dec 2021 15:06:53 -0500 Subject: [PATCH 750/766] Fix NPE when hovering over ender dragon --- .../org/geysermc/geyser/entity/InteractiveTagManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java index fe423dde5..f8e1f43aa 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java +++ b/core/src/main/java/org/geysermc/geyser/entity/InteractiveTagManager.java @@ -66,6 +66,10 @@ public class InteractiveTagManager { ItemMapping mapping = session.getPlayerInventory().getItemInHand().getMapping(session); String javaIdentifierStripped = mapping.getJavaIdentifier().replace("minecraft:", ""); EntityType entityType = interactEntity.getDefinition().entityType(); + if (entityType == null) { + // Likely a technical entity; we don't need to worry about this + return; + } InteractiveTag interactiveTag = InteractiveTag.NONE; @@ -90,7 +94,7 @@ public class InteractiveTagManager { // This animal can be fed interactiveTag = InteractiveTag.FEED; } else { - switch (interactEntity.getDefinition().entityType()) { + switch (entityType) { case BOAT: if (interactEntity.getPassengers().size() < 2) { interactiveTag = InteractiveTag.BOARD_BOAT; From b0baf1670d0a3b200e0aaaf3b094f4fad98c5a6b Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:51:58 -0500 Subject: [PATCH 751/766] Don't send inventories to the client before initialization Fixes #2677 --- .../BedrockSetLocalPlayerAsInitializedTranslator.java | 8 +++++++- .../java/org/geysermc/geyser/util/InventoryUtils.java | 7 ++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java index b30d9be81..a2c0806b0 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/BedrockSetLocalPlayerAsInitializedTranslator.java @@ -30,6 +30,7 @@ import org.geysermc.geyser.session.auth.AuthType; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; +import org.geysermc.geyser.util.InventoryUtils; import org.geysermc.geyser.util.LoginEncryptionUtils; @Translator(packet = SetLocalPlayerAsInitializedPacket.class) @@ -47,8 +48,13 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat // else we were able to log the user in } if (session.isLoggedIn()) { - // Sigh + // Sigh - as of Bedrock 1.18 session.getEntityCache().updateBossBars(); + + // Double sigh - https://github.com/GeyserMC/Geyser/issues/2677 - as of Bedrock 1.18 + if (session.getOpenInventory() != null && session.getOpenInventory().isPending()) { + InventoryUtils.openInventory(session, session.getOpenInventory()); + } } } } diff --git a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java index 1b671b2fe..6ab25a177 100644 --- a/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java @@ -66,9 +66,10 @@ public class InventoryUtils { public static void openInventory(GeyserSession session, Inventory inventory) { session.setOpenInventory(inventory); - if (session.isClosingInventory()) { - //Wait for close confirmation from client before opening the new inventory. - //Handled in BedrockContainerCloseTranslator + if (session.isClosingInventory() || !session.getUpstream().isInitialized()) { + // Wait for close confirmation from client before opening the new inventory. + // Handled in BedrockContainerCloseTranslator + // or - client hasn't yet loaded in; wait until inventory is shown inventory.setPending(true); return; } From ad5a98c85938632ed22b080c6c42d04f6fc83930 Mon Sep 17 00:00:00 2001 From: David Choo Date: Tue, 7 Dec 2021 20:05:44 -0500 Subject: [PATCH 752/766] Improve Statistics Form (#2667) * Improve statistics form Fix furnace minecart java identifier Use clean Java identifier in times mined Fix icons for statistic form Show all generic statistics by initializing them to zero Color every other line grey Format numbers like on Java Edition * Update for Java 16 and MCProtocolLib changes * Sort all statistics alphabetically and color them. * Update for MCProtocolLib changes * Re-add clean java identifiers registry and properly fix block break statistics Also translate before sorting >.> * Use toLowerCase(Locale.ROOT) * Use the format provided by MCProtocolLib * Simplify condition * Move statistics init and bump MCProtocolLib version --- core/pom.xml | 2 +- .../geyser/registry/BlockRegistries.java | 6 ++ .../geysermc/geyser/registry/Registries.java | 2 + .../populator/BlockRegistryPopulator.java | 11 +-- .../populator/ItemRegistryPopulator.java | 2 +- .../geyser/session/GeyserSession.java | 7 ++ .../geyser/util/StatisticFormatters.java | 81 ++++++++++++++++ .../geysermc/geyser/util/StatisticsUtils.java | 93 +++++++++++-------- 8 files changed, 159 insertions(+), 45 deletions(-) create mode 100644 core/src/main/java/org/geysermc/geyser/util/StatisticFormatters.java diff --git a/core/pom.xml b/core/pom.xml index e3189a1cb..ec41b6d72 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - 6970991 + a991afe compile diff --git a/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java index 870828f44..98d3aa341 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java @@ -61,6 +61,12 @@ public class BlockRegistries { */ public static final MappedRegistry> JAVA_IDENTIFIERS = MappedRegistry.create(RegistryLoaders.empty(Object2IntBiMap::new)); + /** + * A registry which stores unique Java IDs to its clean identifier + * This is used in the statistics form. + */ + public static final ArrayRegistry CLEAN_JAVA_IDENTIFIERS = ArrayRegistry.create(RegistryLoaders.empty(() -> new String[] {})); + /** * A registry containing all the waterlogged blockstates. */ diff --git a/core/src/main/java/org/geysermc/geyser/registry/Registries.java b/core/src/main/java/org/geysermc/geyser/registry/Registries.java index a81903e8e..ce63c2c5b 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -31,6 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent; import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType; +import com.github.steveice10.mc.protocol.data.game.statistic.CustomStatistic; import com.github.steveice10.packetlib.packet.Packet; import com.nukkitx.nbt.NbtMap; import com.nukkitx.protocol.bedrock.BedrockPacket; @@ -61,6 +62,7 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.IntFunction; /** * Holds all the common registries in Geyser. diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index 301dfa1da..fef5b32aa 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -46,10 +46,7 @@ import org.geysermc.geyser.util.BlockUtils; import java.io.DataInputStream; import java.io.InputStream; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.function.BiFunction; import java.util.zip.GZIPInputStream; @@ -216,7 +213,7 @@ public class BlockRegistryPopulator { BlockRegistries.JAVA_BLOCKS.set(new BlockMapping[blocksJson.size()]); // Set array size to number of blockstates - Set cleanIdentifiers = new HashSet<>(); + Deque cleanIdentifiers = new ArrayDeque<>(); int javaRuntimeId = -1; int bellBlockId = -1; @@ -281,7 +278,7 @@ public class BlockRegistryPopulator { String cleanJavaIdentifier = BlockUtils.getCleanIdentifier(entry.getKey()); String bedrockIdentifier = entry.getValue().get("bedrock_identifier").asText(); - if (!cleanIdentifiers.contains(cleanJavaIdentifier)) { + if (!cleanJavaIdentifier.equals(cleanIdentifiers.peekLast())) { uniqueJavaId++; cleanIdentifiers.add(cleanJavaIdentifier.intern()); } @@ -360,6 +357,8 @@ public class BlockRegistryPopulator { } BlockStateValues.JAVA_WATER_ID = waterRuntimeId; + BlockRegistries.CLEAN_JAVA_IDENTIFIERS.set(cleanIdentifiers.toArray(new String[0])); + BLOCKS_JSON = blocksJson; } diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java index 6a730010e..71036b792 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java @@ -442,7 +442,7 @@ public class ItemRegistryPopulator { entries.put("geysermc:furnace_minecart", new StartGamePacket.ItemEntry("geysermc:furnace_minecart", (short) furnaceMinecartId, true)); mappings.put(javaFurnaceMinecartId, ItemMapping.builder() - .javaIdentifier("geysermc:furnace_minecart") + .javaIdentifier("minecraft:furnace_minecart") .bedrockIdentifier("geysermc:furnace_minecart") .javaId(javaFurnaceMinecartId) .bedrockId(furnaceMinecartId) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 0011381cf..a58d57503 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -39,6 +39,7 @@ import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.recipe.Recipe; +import com.github.steveice10.mc.protocol.data.game.statistic.CustomStatistic; import com.github.steveice10.mc.protocol.data.game.statistic.Statistic; import com.github.steveice10.mc.protocol.packet.handshake.serverbound.ClientIntentionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket; @@ -1464,6 +1465,12 @@ public class GeyserSession implements GeyserConnection, CommandSender { * @param statistics Updated statistics values */ public void updateStatistics(@NonNull Map statistics) { + if (this.statistics.isEmpty()) { + // Initialize custom statistics to 0, so that they appear in the form + for (CustomStatistic customStatistic : CustomStatistic.values()) { + this.statistics.put(customStatistic, 0); + } + } this.statistics.putAll(statistics); } diff --git a/core/src/main/java/org/geysermc/geyser/util/StatisticFormatters.java b/core/src/main/java/org/geysermc/geyser/util/StatisticFormatters.java new file mode 100644 index 000000000..f8f12fe79 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/util/StatisticFormatters.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2019-2021 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.util; + +import com.github.steveice10.mc.protocol.data.game.statistic.StatisticFormat; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Locale; +import java.util.Map; +import java.util.function.IntFunction; + +public class StatisticFormatters { + + private static final Map> FORMATTERS = new Object2ObjectOpenHashMap<>(); + private static final DecimalFormat FORMAT = new DecimalFormat("###,###,##0.00"); + + public static final IntFunction INTEGER = NumberFormat.getIntegerInstance(Locale.US)::format; + + static { + FORMATTERS.put(StatisticFormat.INTEGER, INTEGER); + FORMATTERS.put(StatisticFormat.TENTHS, value -> FORMAT.format(value / 10d)); + FORMATTERS.put(StatisticFormat.DISTANCE, centimeter -> { + double meter = centimeter / 100d; + double kilometer = meter / 1000d; + if (kilometer > 0.5) { + return FORMAT.format(kilometer) + " km"; + } else if (meter > 0.5) { + return FORMAT.format(meter) + " m"; + } else { + return centimeter + " cm"; + } + }); + FORMATTERS.put(StatisticFormat.TIME, ticks -> { + double seconds = ticks / 20d; + double minutes = seconds / 60d; + double hours = minutes / 60d; + double days = hours / 24d; + double years = days / 365d; + if (years > 0.5) { + return FORMAT.format(years) + " y"; + } else if (days > 0.5) { + return FORMAT.format(days) + " d"; + } else if (hours > 0.5) { + return FORMAT.format(hours) + " h"; + } else if (minutes > 0.5) { + return FORMAT.format(minutes) + " m"; + } else { + return FORMAT.format(seconds) + " s"; + } + }); + } + + public static IntFunction get(StatisticFormat format) { + return FORMATTERS.getOrDefault(format, INTEGER); + } +} diff --git a/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java index aa5893462..6a03495db 100644 --- a/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/StatisticsUtils.java @@ -25,8 +25,6 @@ package org.geysermc.geyser.util; -import com.github.steveice10.mc.protocol.data.MagicValues; -import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.statistic.*; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.registry.BlockRegistries; @@ -37,7 +35,11 @@ import org.geysermc.cumulus.util.FormImage; import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.MinecraftLocale; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; import java.util.Map; +import java.util.function.IntFunction; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -59,12 +61,12 @@ public class StatisticsUtils { .title("gui.stats") .button("stat.generalButton", FormImage.Type.PATH, "textures/ui/World") .button("stat.itemsButton - stat_type.minecraft.mined", FormImage.Type.PATH, "textures/items/iron_pickaxe") - .button("stat.itemsButton - stat_type.minecraft.broken", FormImage.Type.PATH, "textures/item/record_11") + .button("stat.itemsButton - stat_type.minecraft.broken", FormImage.Type.PATH, "textures/items/record_11") .button("stat.itemsButton - stat_type.minecraft.crafted", FormImage.Type.PATH, "textures/blocks/crafting_table_side") .button("stat.itemsButton - stat_type.minecraft.used", FormImage.Type.PATH, "textures/ui/Wrenches1") .button("stat.itemsButton - stat_type.minecraft.picked_up", FormImage.Type.PATH, "textures/blocks/chest_front") .button("stat.itemsButton - stat_type.minecraft.dropped", FormImage.Type.PATH, "textures/ui/trash_default") - .button("stat.mobsButton - geyser.statistics.killed", FormImage.Type.PATH, "textures/items/diamon_sword") + .button("stat.mobsButton - geyser.statistics.killed", FormImage.Type.PATH, "textures/items/diamond_sword") .button("stat.mobsButton - geyser.statistics.killed_by", FormImage.Type.PATH, "textures/ui/wither_heart_flash") .responseHandler((form, responseData) -> { SimpleFormResponse response = form.parseResponse(responseData); @@ -76,7 +78,7 @@ public class StatisticsUtils { SimpleForm.builder() .translator(StatisticsUtils::translate, language); - StringBuilder content = new StringBuilder(); + List content = new ArrayList<>(); ItemMappings mappings = session.getItemMappings(); switch (response.getClickedButtonId()) { @@ -84,9 +86,10 @@ public class StatisticsUtils { builder.title("stat.generalButton"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof GenericStatistic) { - String statName = ((GenericStatistic) entry.getKey()).name().toLowerCase(); - content.append("stat.minecraft.").append(statName).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof CustomStatistic statistic) { + String statName = statistic.name().toLowerCase(Locale.ROOT); + IntFunction formatter = StatisticFormatters.get(statistic.getFormat()); + content.add("stat.minecraft." + statName + ": " + formatter.apply(entry.getValue())); } } break; @@ -94,10 +97,12 @@ public class StatisticsUtils { builder.title("stat.itemsButton - stat_type.minecraft.mined"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof BreakBlockStatistic) { - String block = BlockRegistries.JAVA_BLOCKS.get(((BreakBlockStatistic) entry.getKey()).getId()).getJavaIdentifier(); - block = block.replace("minecraft:", "block.minecraft."); - content.append(block).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof BreakBlockStatistic statistic) { + String identifier = BlockRegistries.CLEAN_JAVA_IDENTIFIERS.get(statistic.getId()); + if (identifier != null) { + String block = identifier.replace("minecraft:", "block.minecraft."); + content.add(block + ": " + entry.getValue()); + } } } break; @@ -105,9 +110,9 @@ public class StatisticsUtils { builder.title("stat.itemsButton - stat_type.minecraft.broken"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof BreakItemStatistic) { - String item = mappings.getMapping(((BreakItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof BreakItemStatistic statistic) { + String item = mappings.getMapping(statistic.getId()).getJavaIdentifier(); + content.add(getItemTranslateKey(item, language) + ": " + entry.getValue()); } } break; @@ -115,9 +120,9 @@ public class StatisticsUtils { builder.title("stat.itemsButton - stat_type.minecraft.crafted"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof CraftItemStatistic) { - String item = mappings.getMapping(((CraftItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof CraftItemStatistic statistic) { + String item = mappings.getMapping(statistic.getId()).getJavaIdentifier(); + content.add(getItemTranslateKey(item, language) + ": " + entry.getValue()); } } break; @@ -125,9 +130,9 @@ public class StatisticsUtils { builder.title("stat.itemsButton - stat_type.minecraft.used"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof UseItemStatistic) { - String item = mappings.getMapping(((UseItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof UseItemStatistic statistic) { + String item = mappings.getMapping(statistic.getId()).getJavaIdentifier(); + content.add(getItemTranslateKey(item, language) + ": " + entry.getValue()); } } break; @@ -135,9 +140,9 @@ public class StatisticsUtils { builder.title("stat.itemsButton - stat_type.minecraft.picked_up"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof PickupItemStatistic) { - String item = mappings.getMapping(((PickupItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof PickupItemStatistic statistic) { + String item = mappings.getMapping(statistic.getId()).getJavaIdentifier(); + content.add(getItemTranslateKey(item, language) + ": " + entry.getValue()); } } break; @@ -145,9 +150,9 @@ public class StatisticsUtils { builder.title("stat.itemsButton - stat_type.minecraft.dropped"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof DropItemStatistic) { - String item = mappings.getMapping(((DropItemStatistic) entry.getKey()).getId()).getJavaIdentifier(); - content.append(getItemTranslateKey(item, language)).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof DropItemStatistic statistic) { + String item = mappings.getMapping(statistic.getId()).getJavaIdentifier(); + content.add(getItemTranslateKey(item, language) + ": " + entry.getValue()); } } break; @@ -155,9 +160,9 @@ public class StatisticsUtils { builder.title("stat.mobsButton - geyser.statistics.killed"); for (Map.Entry entry : session.getStatistics().entrySet()) { - if (entry.getKey() instanceof KillEntityStatistic) { - String entityName = MagicValues.key(EntityType.class, ((KillEntityStatistic) entry.getKey()).getId()).name().toLowerCase(); - content.append("entity.minecraft.").append(entityName).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof KillEntityStatistic statistic) { + String entityName = statistic.getEntity().name().toLowerCase(Locale.ROOT); + content.add("entity.minecraft." + entityName + ": " + entry.getValue()); } } break; @@ -166,9 +171,9 @@ public class StatisticsUtils { for (Map.Entry entry : session .getStatistics().entrySet()) { - if (entry.getKey() instanceof KilledByEntityStatistic) { - String entityName = MagicValues.key(EntityType.class, ((KilledByEntityStatistic) entry.getKey()).getId()).name().toLowerCase(); - content.append("entity.minecraft.").append(entityName).append(": ").append(entry.getValue()).append("\n"); + if (entry.getKey() instanceof KilledByEntityStatistic statistic) { + String entityName = statistic.getEntity().name().toLowerCase(Locale.ROOT); + content.add("entity.minecraft." + entityName + ": " + entry.getValue()); } } break; @@ -176,12 +181,26 @@ public class StatisticsUtils { return; } - if (content.length() == 0) { - content = new StringBuilder("geyser.statistics.none"); + StringBuilder assembledContent = new StringBuilder(); + if (content.size() == 0) { + assembledContent.append("geyser.statistics.none"); + } else { + content.replaceAll(x -> translate(x, language)); + // Sort statistics alphabetically + content.sort(String::compareTo); + for (int i = 0; i < content.size(); i++) { + assembledContent.append(content.get(i)); + // Make every other line gray + if (i % 2 == 0) { + assembledContent.append("\u00a77\n"); + } else { + assembledContent.append("\u00a7r\n"); + } + } } session.sendForm( - builder.content(content.toString()) + builder.content(assembledContent.toString()) .button("gui.back", FormImage.Type.PATH, "textures/gui/newgui/undo") .responseHandler((form1, subFormResponseData) -> { SimpleFormResponse response1 = form.parseResponse(subFormResponseData); @@ -212,7 +231,7 @@ public class StatisticsUtils { private static String translate(String keys, String locale) { Matcher matcher = CONTENT_PATTERN.matcher(keys); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); while (matcher.find()) { String group = matcher.group(); matcher.appendReplacement(buffer, translateEntry(group.substring(0, group.length() - 1), locale) + ":"); From 046c93ffb0a0a031c41d8164749b3ae2699115ef Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 8 Dec 2021 09:23:23 -0500 Subject: [PATCH 753/766] Fix stonecutters for Bedrock 1.18 --- .../geyser/translator/inventory/InventoryTranslator.java | 1 + .../translator/inventory/StonecutterInventoryTranslator.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java index 0e22fc0be..66fd6959e 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/InventoryTranslator.java @@ -391,6 +391,7 @@ public abstract class InventoryTranslator { } break; } + case CRAFT_RECIPE: // Called by stonecutters 1.18+ case CRAFT_RECIPE_AUTO: // Called by villagers case CRAFT_NON_IMPLEMENTED_DEPRECATED: // Tends to be called for UI inventories case CRAFT_RESULTS_DEPRECATED: // Tends to be called for UI inventories diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java index ed1f38799..e7140f7b2 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java @@ -53,7 +53,8 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl @Override public boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) { - return action.getType() == StackRequestActionType.CRAFT_NON_IMPLEMENTED_DEPRECATED; + // First is pre-1.18. TODO remove after 1.17.40 support is dropped and refactor stonecutter support to use CraftRecipeStackRequestActionData's recipe ID + return action.getType() == StackRequestActionType.CRAFT_NON_IMPLEMENTED_DEPRECATED || action.getType() == StackRequestActionType.CRAFT_RECIPE; } @Override From 8c7a3d1822c3a926e395e3919836dad33503919b Mon Sep 17 00:00:00 2001 From: Luke <32024335+lukeeey@users.noreply.github.com> Date: Wed, 8 Dec 2021 18:23:05 +0000 Subject: [PATCH 754/766] Show the nether fog when using the nether height workaround (#2663) --- .../geyser/session/GeyserSession.java | 38 ++++++++++++++++++- .../geyser/session/cache/WorldBorder.java | 17 --------- .../protocol/java/JavaLoginTranslator.java | 3 ++ .../geysermc/geyser/util/DimensionUtils.java | 17 +++++++++ core/src/main/resources/config.yml | 7 ++-- 5 files changed, 59 insertions(+), 23 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index a58d57503..2e3368356 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -461,6 +461,8 @@ public class GeyserSession implements GeyserConnection, CommandSender { @Setter private boolean waitingForStatistics = false; + private final Set fogNameSpaces = new HashSet<>(); + private final Set emotes; /** @@ -1006,11 +1008,11 @@ public class GeyserSession implements GeyserConnection, CommandSender { // Set the mood if (!isInWorldBorderWarningArea) { isInWorldBorderWarningArea = true; - WorldBorder.sendFog(this, "minecraft:fog_crimson_forest"); + sendFog("minecraft:fog_crimson_forest"); } } else if (isInWorldBorderWarningArea) { // Clear fog as we are outside the world border now - WorldBorder.removeFog(this); + removeFog("minecraft:fog_crimson_forest"); isInWorldBorderWarningArea = false; } @@ -1490,4 +1492,36 @@ public class GeyserSession implements GeyserConnection, CommandSender { player.sendUpstreamPacket(emoteList); } } + + /** + * Send the following fog IDs, as well as the cached ones, to the client. + * + * Fog IDs can be found here: + * https://wiki.bedrock.dev/documentation/fog-ids.html + * + * @param fogNameSpaces the fog ids to add + */ + public void sendFog(String... fogNameSpaces) { + this.fogNameSpaces.addAll(Arrays.asList(fogNameSpaces)); + + PlayerFogPacket packet = new PlayerFogPacket(); + packet.getFogStack().addAll(this.fogNameSpaces); + sendUpstreamPacket(packet); + } + + /** + * Removes the following fog IDs from the client and the cache. + * + * @param fogNameSpaces the fog ids to remove + */ + public void removeFog(String... fogNameSpaces) { + if (fogNameSpaces.length == 0) { + this.fogNameSpaces.clear(); + } else { + this.fogNameSpaces.removeAll(Arrays.asList(fogNameSpaces)); + } + PlayerFogPacket packet = new PlayerFogPacket(); + packet.getFogStack().addAll(this.fogNameSpaces); + sendUpstreamPacket(packet); + } } diff --git a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java index 5c486af49..01c5949c7 100644 --- a/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java +++ b/core/src/main/java/org/geysermc/geyser/session/cache/WorldBorder.java @@ -296,21 +296,4 @@ public class WorldBorder { effectPacket.setType(WORLD_BORDER_PARTICLE); session.getUpstream().sendPacket(effectPacket); } - - /** - * Send the following fog IDs to the client - */ - public static void sendFog(GeyserSession session, String... fogNameSpaces) { - PlayerFogPacket packet = new PlayerFogPacket(); - Collections.addAll(packet.getFogStack(), fogNameSpaces); - session.sendUpstreamPacket(packet); - } - - /** - * Clear any additional fog sent to the client - */ - public static void removeFog(GeyserSession session) { - session.sendUpstreamPacket(new PlayerFogPacket()); - } - } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java index 855f5b144..76a867e30 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaLoginTranslator.java @@ -116,6 +116,9 @@ public class JavaLoginTranslator extends PacketTranslator Date: Thu, 9 Dec 2021 14:18:16 -0500 Subject: [PATCH 755/766] Bump Log4J version --- bootstrap/standalone/pom.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index df3fd5218..7bf37ec1f 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -10,6 +10,10 @@ bootstrap-standalone + + 2.15.0-20211206.182754-101 + + org.geysermc @@ -58,17 +62,17 @@ org.apache.logging.log4j log4j-api - 2.13.1 + ${log4j.version} org.apache.logging.log4j log4j-core - 2.13.2 + ${log4j.version} org.apache.logging.log4j log4j-slf4j18-impl - 2.13.1 + ${log4j.version} From 752d984dd7f1b06bcf92eee68b46be84bf1303df Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 9 Dec 2021 22:07:17 -0500 Subject: [PATCH 756/766] Standalone: bump Log4J to release 2.15.0 --- bootstrap/standalone/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index 7bf37ec1f..6ffbfd58d 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -11,7 +11,7 @@ bootstrap-standalone - 2.15.0-20211206.182754-101 + 2.15.0 From 1885a75d3cf3f262537b7cc93dbcc1838e0927fe Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Dec 2021 11:15:12 -0500 Subject: [PATCH 757/766] Update version strings to indicate 1.18.1 support Geyser 1.18 builds already support 1.18.1. --- .../java/org/geysermc/geyser/network/MinecraftProtocol.java | 2 +- .../src/main/java/org/geysermc/geyser/text/MinecraftLocale.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java index 6015bf229..8fd2ca700 100644 --- a/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java @@ -91,7 +91,7 @@ public final class MinecraftProtocol { * @return the supported Minecraft: Java Edition version name */ public static String getJavaVersion() { - return DEFAULT_JAVA_CODEC.getMinecraftVersion(); + return "1.18 - 1.18.1"; } /** diff --git a/core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java b/core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java index 2b42efc86..4f8680c73 100644 --- a/core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java +++ b/core/src/main/java/org/geysermc/geyser/text/MinecraftLocale.java @@ -71,7 +71,7 @@ public class MinecraftLocale { // Get the url for the latest version of the games manifest String latestInfoURL = ""; for (Version version : versionManifest.getVersions()) { - if (version.getId().equals(MinecraftProtocol.getJavaVersion())) { + if (version.getId().equals(MinecraftProtocol.getJavaCodec().getMinecraftVersion())) { latestInfoURL = version.getUrl(); break; } From 9d09a7e418d3e46ed9a8b3885ce439ff9556cc9a Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Fri, 10 Dec 2021 16:27:23 -0500 Subject: [PATCH 758/766] Display Java supported versions as list in dumps --- .../command/defaults/VersionCommand.java | 9 ++++++- .../org/geysermc/geyser/dump/DumpInfo.java | 4 +-- .../geyser/network/MinecraftProtocol.java | 25 ++++++++++++++----- .../geyser/network/UpstreamPacketHandler.java | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java index dbec4d4f8..4dd93ee74 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/VersionCommand.java @@ -62,9 +62,16 @@ public class VersionCommand extends GeyserCommand { } else { bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion(); } + String javaVersions; + List supportedJavaVersions = MinecraftProtocol.getJavaVersions(); + if (supportedJavaVersions.size() > 1) { + javaVersions = supportedJavaVersions.get(0) + " - " + supportedJavaVersions.get(supportedJavaVersions.size() - 1); + } else { + javaVersions = supportedJavaVersions.get(0); + } sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(), - GeyserImpl.NAME, GeyserImpl.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions)); + GeyserImpl.NAME, GeyserImpl.VERSION, javaVersions, bedrockVersions)); // Disable update checking in dev mode and for players in Geyser Standalone if (GeyserImpl.getInstance().productionEnvironment() && !(!sender.isConsole() && geyser.getPlatformType() == PlatformType.STANDALONE)) { diff --git a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java index 8a21b6929..7d4807050 100644 --- a/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java +++ b/core/src/main/java/org/geysermc/geyser/dump/DumpInfo.java @@ -207,14 +207,14 @@ public class DumpInfo { private final List bedrockVersions; private final List bedrockProtocols; private final int defaultBedrockProtocol; - private final String javaVersion; + private final List javaVersions; private final int javaProtocol; MCInfo() { this.bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList(); this.bedrockProtocols = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList(); this.defaultBedrockProtocol = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion(); - this.javaVersion = MinecraftProtocol.getJavaVersion(); + this.javaVersions = MinecraftProtocol.getJavaVersions(); this.javaProtocol = MinecraftProtocol.getJavaProtocolVersion(); } } diff --git a/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java index 8fd2ca700..868f87a5d 100644 --- a/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java +++ b/core/src/main/java/org/geysermc/geyser/network/MinecraftProtocol.java @@ -33,6 +33,7 @@ import com.nukkitx.protocol.bedrock.v471.Bedrock_v471; import com.nukkitx.protocol.bedrock.v475.Bedrock_v475; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.StringJoiner; @@ -86,12 +87,12 @@ public final class MinecraftProtocol { } /** - * Gets the supported Minecraft: Java Edition version name. + * Gets the supported Minecraft: Java Edition version names. * - * @return the supported Minecraft: Java Edition version name + * @return the supported Minecraft: Java Edition version names */ - public static String getJavaVersion() { - return "1.18 - 1.18.1"; + public static List getJavaVersions() { + return Arrays.asList("1.18", "1.18.1"); } /** @@ -104,9 +105,9 @@ public final class MinecraftProtocol { } /** - * @return a string showing all supported versions for this Geyser instance + * @return a string showing all supported Bedrock versions for this Geyser instance */ - public static String getAllSupportedVersions() { + public static String getAllSupportedBedrockVersions() { StringJoiner joiner = new StringJoiner(", "); for (BedrockPacketCodec packetCodec : SUPPORTED_BEDROCK_CODECS) { joiner.add(packetCodec.getMinecraftVersion()); @@ -115,6 +116,18 @@ public final class MinecraftProtocol { return joiner.toString(); } + /** + * @return a string showing all supported Java versions for this Geyser instance + */ + public static String getAllSupportedJavaVersions() { + StringJoiner joiner = new StringJoiner(", "); + for (String version : getJavaVersions()) { + joiner.add(version); + } + + return joiner.toString(); + } + private MinecraftProtocol() { } } diff --git a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java index 38673769b..781f58ef5 100644 --- a/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java @@ -70,7 +70,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler { BedrockPacketCodec packetCodec = MinecraftProtocol.getBedrockCodec(loginPacket.getProtocolVersion()); if (packetCodec == null) { - String supportedVersions = MinecraftProtocol.getAllSupportedVersions(); + String supportedVersions = MinecraftProtocol.getAllSupportedBedrockVersions(); if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) { // Too early to determine session locale session.getGeyser().getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.outdated.server", supportedVersions)); From 9ba6ef51ac29440c28c8a543135fba0146c671e7 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 11 Dec 2021 13:26:56 -0500 Subject: [PATCH 759/766] Update README for supported versions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d8ed6efd..d4b375a5c 100644 --- a/README.md +++ b/README.md @@ -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.17.30 - 1.17.41 + 1.18 and Minecraft Java 1.18. +### Currently supporting Minecraft Bedrock 1.17.30 - 1.17.41 + 1.18.0 - 1.18.2 and Minecraft Java 1.18/1.18.1. ## Setting Up Take a look [here](https://github.com/GeyserMC/Geyser/wiki/Setup) for how to set up Geyser. From 892855415b9bdde4d9484f100aee09c39da3d1de Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sat, 11 Dec 2021 16:05:12 -0500 Subject: [PATCH 760/766] Fix offset team colors Fixes #2674 --- core/pom.xml | 2 +- .../geyser/entity/type/player/PlayerEntity.java | 15 +++++---------- .../scoreboard/JavaSetPlayerTeamTranslator.java | 2 +- .../geyser/translator/text/MessageTranslator.java | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index ec41b6d72..de264f908 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -155,7 +155,7 @@ com.github.GeyserMC MCProtocolLib - a991afe + c247b1f compile diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 8737ef847..ac7d12717 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -47,17 +47,16 @@ import com.nukkitx.protocol.bedrock.packet.*; import lombok.Getter; import lombok.Setter; import net.kyori.adventure.text.Component; -import org.geysermc.geyser.text.ChatColor; -import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.entity.type.living.animal.tameable.ParrotEntity; -import org.geysermc.geyser.session.GeyserSession; -import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.scoreboard.Objective; import org.geysermc.geyser.scoreboard.Score; import org.geysermc.geyser.scoreboard.Team; import org.geysermc.geyser.scoreboard.UpdateType; +import org.geysermc.geyser.session.GeyserSession; +import org.geysermc.geyser.translator.text.MessageTranslator; import javax.annotation.Nullable; import java.util.Collections; @@ -352,16 +351,12 @@ public class PlayerEntity extends LivingEntity { if (team != null) { if (team.isVisibleFor(session.getPlayerEntity().getUsername())) { TeamColor color = team.getColor(); - String chatColor; - if (color == TeamColor.NONE) { - chatColor = ChatColor.RESET; - } else { - chatColor = MessageTranslator.toChatColor(color); - } + String chatColor = MessageTranslator.toChatColor(color);; // We have to emulate what modern Java text already does for us and add the color to each section String prefix = team.getCurrentData().getPrefix(); String suffix = team.getCurrentData().getSuffix(); newDisplayName = chatColor + prefix + chatColor + this.username + chatColor + suffix; + System.out.println(newDisplayName); } else { // The name is not visible to the session player; clear name newDisplayName = ""; diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java index 5eba38196..5a0773bbe 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/scoreboard/JavaSetPlayerTeamTranslator.java @@ -72,7 +72,7 @@ public class JavaSetPlayerTeamTranslator extends PacketTranslator Date: Sat, 11 Dec 2021 16:06:47 -0500 Subject: [PATCH 761/766] Remove debug code --- .../org/geysermc/geyser/entity/type/player/PlayerEntity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index ac7d12717..195872702 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -356,7 +356,6 @@ public class PlayerEntity extends LivingEntity { String prefix = team.getCurrentData().getPrefix(); String suffix = team.getCurrentData().getSuffix(); newDisplayName = chatColor + prefix + chatColor + this.username + chatColor + suffix; - System.out.println(newDisplayName); } else { // The name is not visible to the session player; clear name newDisplayName = ""; From 117ebdd9c1b8a0ebe52375e6e7f15e7522ee0cf9 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 13 Dec 2021 13:24:58 -0500 Subject: [PATCH 762/766] Remove extra semicolon --- .../org/geysermc/geyser/entity/type/player/PlayerEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 195872702..1d59b83db 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -351,7 +351,7 @@ public class PlayerEntity extends LivingEntity { if (team != null) { if (team.isVisibleFor(session.getPlayerEntity().getUsername())) { TeamColor color = team.getColor(); - String chatColor = MessageTranslator.toChatColor(color);; + String chatColor = MessageTranslator.toChatColor(color); // We have to emulate what modern Java text already does for us and add the color to each section String prefix = team.getCurrentData().getPrefix(); String suffix = team.getCurrentData().getSuffix(); From 25921e1d67d9b68469f8dafb6b4cbdd991fbc1f6 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 13 Dec 2021 13:25:51 -0500 Subject: [PATCH 763/766] Hide out-of-range entity metadata IDs The vanilla Java client gracefully ignores these. --- .../protocol/java/entity/JavaSetEntityDataTranslator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java index 987e5fcb2..440fcaea1 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/JavaSetEntityDataTranslator.java @@ -51,8 +51,9 @@ public class JavaSetEntityDataTranslator extends PacketTranslator definition = entity.getDefinition(); for (EntityMetadata metadata : packet.getMetadata()) { if (metadata.getId() >= definition.translators().size()) { - session.getGeyser().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + definition.translators().size() + " for entity type " + entity.getDefinition().entityType()); if (session.getGeyser().getConfig().isDebugMode()) { + // Minecraft client just ignores these + session.getGeyser().getLogger().warning("Metadata ID " + metadata.getId() + " is out of bounds of known entity metadata size " + definition.translators().size() + " for entity type " + entity.getDefinition().entityType()); session.getGeyser().getLogger().debug(metadata.toString()); } continue; From 7d5803bc37cd10e9f19c6c0365b9876e4db92c81 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 13 Dec 2021 13:35:11 -0500 Subject: [PATCH 764/766] Update Spigot adapters for 1.18 --- bootstrap/spigot/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml index f5b14e35a..5d17d2619 100644 --- a/bootstrap/spigot/pom.xml +++ b/bootstrap/spigot/pom.xml @@ -39,7 +39,7 @@ org.geysermc.geyser.adapters spigot-all - 1.2-SNAPSHOT + 1.3-SNAPSHOT From 967ee4f58d9f4515ea71844fea6b5033085542af Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 13 Dec 2021 22:25:08 -0500 Subject: [PATCH 765/766] Fix command descriptions merging --- .../protocol/java/JavaCommandsTranslator.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index d0ab68d8f..5e918d5d3 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -43,6 +43,7 @@ import lombok.Getter; import lombok.ToString; import net.kyori.adventure.text.format.NamedTextColor; import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.command.CommandManager; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.Translator; @@ -61,20 +62,22 @@ public class JavaCommandsTranslator extends PacketTranslator PARAM_STRATEGY = new Hash.Strategy<>() { + private static final Hash.Strategy PARAM_STRATEGY = new Hash.Strategy<>() { @Override - public int hashCode(CommandParamData[][] o) { - return Arrays.deepHashCode(o); + public int hashCode(BedrockCommandInfo o) { + int paramHash = Arrays.deepHashCode(o.paramData()); + return 31 * paramHash + o.description().hashCode(); } @Override - public boolean equals(CommandParamData[][] a, CommandParamData[][] b) { + public boolean equals(BedrockCommandInfo a, BedrockCommandInfo b) { if (a == b) return true; if (a == null || b == null) return false; - if (a.length != b.length) return false; - for (int i = 0; i < a.length; i++) { - CommandParamData[] a1 = a[i]; - CommandParamData[] b1 = b[i]; + if (!a.description().equals(b.description())) return false; + if (a.paramData().length != b.paramData().length) return false; + for (int i = 0; i < a.paramData().length; i++) { + CommandParamData[] a1 = a.paramData()[i]; + CommandParamData[] b1 = b.paramData()[i]; if (a1.length != b1.length) return false; for (int j = 0; j < a1.length; j++) { @@ -109,11 +112,12 @@ public class JavaCommandsTranslator extends PacketTranslator commandData = new ArrayList<>(); IntSet commandNodes = new IntOpenHashSet(); Set knownAliases = new HashSet<>(); - Map> commands = new Object2ObjectOpenCustomHashMap<>(PARAM_STRATEGY); + Map> commands = new Object2ObjectOpenCustomHashMap<>(PARAM_STRATEGY); Int2ObjectMap> commandArgs = new Int2ObjectOpenHashMap<>(); // Get the first node, it should be a root node @@ -137,7 +141,8 @@ public class JavaCommandsTranslator extends PacketTranslator new HashSet<>()).add(node.getName().toLowerCase()); + commands.computeIfAbsent(new BedrockCommandInfo(manager.getDescription(node.getName().toLowerCase(Locale.ROOT)), params), + index -> new HashSet<>()).add(node.getName().toLowerCase()); } // The command flags, not sure what these do apart from break things @@ -145,14 +150,14 @@ public class JavaCommandsTranslator extends PacketTranslator> entry : commands.entrySet()) { + for (Map.Entry> entry : commands.entrySet()) { String commandName = entry.getValue().iterator().next(); // We know this has a value // Create a basic alias CommandEnumData aliases = new CommandEnumData(commandName + "Aliases", entry.getValue().toArray(new String[0]), false); // Build the completed command and add it to the final list - CommandData data = new CommandData(commandName, session.getGeyser().getCommandManager().getDescription(commandName), flags, (byte) 0, aliases, entry.getKey()); + CommandData data = new CommandData(commandName, entry.getKey().description(), flags, (byte) 0, aliases, entry.getKey().paramData()); commandData.add(data); } @@ -228,6 +233,12 @@ public class JavaCommandsTranslator extends PacketTranslator Date: Tue, 14 Dec 2021 15:54:57 -0500 Subject: [PATCH 766/766] Bump log4j-api from 2.15.0 to 2.16.0 in /bootstrap/standalone (#2700) Bumps log4j-api from 2.15.0 to 2.16.0. --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-api dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- bootstrap/standalone/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml index 6ffbfd58d..e8653ee8e 100644 --- a/bootstrap/standalone/pom.xml +++ b/bootstrap/standalone/pom.xml @@ -11,7 +11,7 @@ bootstrap-standalone - 2.15.0 + 2.16.0