diff --git a/core/pom.xml b/core/pom.xml
index 8af2aa907..c9047ee4b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -153,9 +153,9 @@
compile
- com.github.GeyserMC
- MCProtocolLib
- 0771504
+ com.github.steveice10
+ mcprotocollib
+ 1.19-SNAPSHOT
compile
diff --git a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java
index 6d47c38c6..0aa1d39c3 100644
--- a/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java
+++ b/core/src/main/java/org/geysermc/geyser/FloodgateKeyLoader.java
@@ -43,7 +43,7 @@ public class FloodgateKeyLoader {
if (floodgateDataFolder != null) {
Path autoKey = floodgateDataFolder.resolve("key.pem");
if (Files.exists(autoKey)) {
- logger.info(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded"));
+ logger.debug(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.auto_loaded"));
return autoKey;
} else {
logger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.missing_key"));
@@ -52,7 +52,7 @@ public class FloodgateKeyLoader {
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");
+ logger.debug("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());
diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java
index f3ebfa4a3..c84e62121 100644
--- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java
+++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java
@@ -66,6 +66,7 @@ import org.geysermc.geyser.session.SessionManager;
import org.geysermc.geyser.session.auth.AuthType;
import org.geysermc.geyser.skin.FloodgateSkinUploader;
import org.geysermc.geyser.skin.SkinProvider;
+import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.text.MinecraftLocale;
import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
@@ -249,18 +250,6 @@ 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;
- if (config.getRemote().getAuthType() == AuthType.FLOODGATE) {
- try {
- Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
- cipher = new AesCipher(new Base64Topping());
- cipher.init(key);
- logger.info(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.loaded_key"));
- skinUploader = new FloodgateSkinUploader(this).start();
- } catch (Exception exception) {
- logger.severe(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception);
- }
- }
-
String branch = "unknown";
int buildNumber = -1;
if (this.productionEnvironment()) {
@@ -321,14 +310,34 @@ public class GeyserImpl implements GeyserApi {
if (shouldStartListener) {
bedrockServer.bind().whenComplete((avoid, throwable) -> {
if (throwable == null) {
- logger.info(GeyserLocale.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(GeyserLocale.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
- throwable.printStackTrace();
+ String address = config.getBedrock().getAddress();
+ int port = config.getBedrock().getPort();
+ logger.severe(GeyserLocale.getLocaleStringLog("geyser.core.fail", address, String.valueOf(port)));
+ if (!"0.0.0.0".equals(address)) {
+ logger.info(ChatColor.GREEN + "Suggestion: try setting `address` under `bedrock` in the Geyser config back to 0.0.0.0");
+ logger.info(ChatColor.GREEN + "Then, restart this server.");
+ }
}
}).join();
}
+ if (config.getRemote().getAuthType() == AuthType.FLOODGATE) {
+ try {
+ Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
+ cipher = new AesCipher(new Base64Topping());
+ cipher.init(key);
+ logger.debug(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.loaded_key"));
+ // Note: this is positioned after the bind so the skin uploader doesn't try to run if Geyser fails
+ // to load successfully. Spigot complains about class loader if the plugin is disabled.
+ skinUploader = new FloodgateSkinUploader(this).start();
+ } catch (Exception exception) {
+ logger.severe(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.bad_key"), exception);
+ }
+ }
+
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));
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 ceb3ea15c..3e64cfcea 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
@@ -36,8 +36,8 @@ import java.util.UUID;
public class FallingBlockEntity extends Entity {
- public FallingBlockEntity(GeyserSession session, int 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);
+ public FallingBlockEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, int javaId) {
+ super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, headYaw);
this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId));
}
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 52ad82370..57b597781 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
@@ -56,7 +56,7 @@ public class FishingHookEntity extends ThrowableEntity {
private final BoundingBox boundingBox;
- public FishingHookEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, PlayerEntity owner) {
+ public FishingHookEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, 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);
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 9cfa22a1f..bc7736e9b 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
@@ -79,8 +79,8 @@ public class ItemFrameEntity extends Entity {
*/
private boolean changed = true;
- public ItemFrameEntity(GeyserSession session, int 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);
+ public ItemFrameEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, Direction direction) {
+ super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
NbtMapBuilder blockBuilder = NbtMap.builder()
.putString("name", this.definition.entityType() == EntityType.GLOW_ITEM_FRAME ? "minecraft:glow_frame" : "minecraft:frame")
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 70b5d52ba..9a2bbd5a4 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
@@ -33,6 +33,7 @@ import org.geysermc.geyser.level.PaintingType;
import java.util.UUID;
+// TODO 1.19
public class PaintingEntity extends Entity {
private static final double OFFSET = -0.46875;
private final PaintingType paintingName;
diff --git a/core/src/main/java/org/geysermc/geyser/level/JavaDimension.java b/core/src/main/java/org/geysermc/geyser/level/JavaDimension.java
new file mode 100644
index 000000000..b297739a9
--- /dev/null
+++ b/core/src/main/java/org/geysermc/geyser/level/JavaDimension.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019-2022 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.level;
+
+import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
+
+/**
+ * Represents the information we store from the current Java dimension
+ * @param piglinSafe Whether piglins and hoglins are safe from conversion in this dimension.
+ * This controls if they have the shaking effect applied in the dimension.
+ */
+public record JavaDimension(int minY, int maxY, boolean piglinSafe) {
+
+ public static JavaDimension load(CompoundTag tag) {
+// int minY = ((IntTag) dimensionTag.get("min_y")).getValue();
+// int maxY = ((IntTag) dimensionTag.get("height")).getValue();
+ return new JavaDimension(0, 0, false);
+ }
+}
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 0daa43da8..607c9f84d 100644
--- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java
+++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java
@@ -101,6 +101,7 @@ import org.geysermc.geyser.inventory.Inventory;
import org.geysermc.geyser.inventory.PlayerInventory;
import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
import org.geysermc.geyser.inventory.recipe.GeyserStonecutterData;
+import org.geysermc.geyser.level.JavaDimension;
import org.geysermc.geyser.level.WorldManager;
import org.geysermc.geyser.level.physics.CollisionManager;
import org.geysermc.geyser.network.netty.LocalSession;
@@ -319,11 +320,9 @@ public class GeyserSession implements GeyserConnection, CommandSender {
@Setter
private String dimension = DimensionUtils.OVERWORLD;
/**
- * Whether piglins and hoglins are safe from conversion in this dimension.
- * This controls if they have the shaking effect applied in the dimension.
+ * All dimensions that the client could possibly connect to.
*/
- @Setter
- private boolean dimensionPiglinSafe;
+ private final Map dimensions = new Object2ObjectOpenHashMap<>(3);
@Setter
private int breakingBlock;
@@ -1261,9 +1260,9 @@ public class GeyserSession implements GeyserConnection, CommandSender {
ServerboundUseItemPacket useItemPacket;
if (playerInventory.getItemInHand().getJavaId() == shield.getJavaId()) {
- useItemPacket = new ServerboundUseItemPacket(Hand.MAIN_HAND);
+ useItemPacket = new ServerboundUseItemPacket(Hand.MAIN_HAND, 0); //TODO
} else if (playerInventory.getOffhand().getJavaId() == shield.getJavaId()) {
- useItemPacket = new ServerboundUseItemPacket(Hand.OFF_HAND);
+ useItemPacket = new ServerboundUseItemPacket(Hand.OFF_HAND, 0);
} else {
// No blocking
return false;
@@ -1292,7 +1291,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
private boolean disableBlocking() {
if (playerEntity.getFlag(EntityFlag.BLOCKING)) {
ServerboundPlayerActionPacket releaseItemPacket = new ServerboundPlayerActionPacket(PlayerAction.RELEASE_USE_ITEM,
- BlockUtils.POSITION_ZERO, Direction.DOWN);
+ BlockUtils.POSITION_ZERO, Direction.DOWN, 0); //TODO
sendDownstreamPacket(releaseItemPacket);
playerEntity.setFlag(EntityFlag.BLOCKING, false);
return true;
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 b68c0996d..c7165083d 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
@@ -34,15 +34,16 @@ import com.nukkitx.protocol.bedrock.packet.GameRulesChangedPacket;
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
import org.geysermc.geyser.entity.type.player.PlayerEntity;
+import org.geysermc.geyser.level.JavaDimension;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.auth.AuthType;
import org.geysermc.geyser.translator.level.BiomeTranslator;
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.DimensionUtils;
import org.geysermc.geyser.util.PluginMessageUtils;
+import java.util.Map;
+
@Translator(packet = ClientboundLoginPacket.class)
public class JavaLoginTranslator extends PacketTranslator {
@@ -51,12 +52,15 @@ public class JavaLoginTranslator extends PacketTranslator dimensions = session.getDimensions();
+ dimensions.clear();
+
// If the player is already initialized and a join game packet is sent, they
// are swapping servers
- String newDimension = DimensionUtils.getNewDimension(packet.getDimension());
+ //String newDimension = DimensionUtils.getNewDimension(packet.getDimension());
if (session.isSpawned()) {
- String fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), newDimension);
- DimensionUtils.switchDimension(session, fakeDim);
+ //String fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), newDimension);
+ //DimensionUtils.switchDimension(session, fakeDim);
session.getWorldCache().removeScoreboard();
}
@@ -70,7 +74,7 @@ public class JavaLoginTranslator extends PacketTranslator {
+@Translator(packet = ClientboundSystemChatPacket.class)
+public class JavaSystemChatTranslator extends PacketTranslator {
@Override
- public void translate(GeyserSession session, ClientboundChatPacket packet) {
+ public void translate(GeyserSession session, ClientboundSystemChatPacket packet) {
TextPacket textPacket = new TextPacket();
textPacket.setPlatformChatId("");
textPacket.setSourceName("");
textPacket.setXuid(session.getAuthData().xuid());
+ // TODO new types
textPacket.setType(switch (packet.getType()) {
case CHAT -> TextPacket.Type.CHAT;
case SYSTEM -> TextPacket.Type.SYSTEM;
- case NOTIFICATION -> TextPacket.Type.TIP;
+ case GAME_INFO -> TextPacket.Type.TIP;
default -> TextPacket.Type.RAW;
});
textPacket.setNeedsTranslation(false);
- textPacket.setMessage(MessageTranslator.convertMessage(packet.getMessage(), session.getLocale()));
+ textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.getLocale()));
session.sendUpstreamPacket(textPacket);
}
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 634d4d424..714603997 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
@@ -25,30 +25,16 @@
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 com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundBlockChangedAckPacket;
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 {
+@Translator(packet = ClientboundBlockChangedAckPacket.class)
+public class JavaBlockBreakAckTranslator extends PacketTranslator {
@Override
- 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();
- stopBreak.setType(LevelEventType.BLOCK_STOP_BREAK);
- stopBreak.setPosition(Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()));
- stopBreak.setData(0);
- session.setBreakingBlock(BlockStateValues.JAVA_AIR_ID);
- session.sendUpstreamPacket(stopBreak);
- }
+ public void translate(GeyserSession session, ClientboundBlockChangedAckPacket packet) {
+ // TODO
}
}
\ No newline at end of file
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 33a347658..9d2a383f5 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
@@ -52,6 +52,7 @@ public class JavaAddEntityTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType());
if (definition == null) {
@@ -62,11 +63,11 @@ public class JavaAddEntityTranslator extends PacketTranslator {
-
- @Override
- 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());
-
- EntityDefinition> definition = Registries.ENTITY_DEFINITIONS.get(packet.getType());
- if (definition == null) {
- session.getGeyser().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.entity.type_null", packet.getType()));
- return;
- }
-
- Entity entity = 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/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
deleted file mode 100644
index 6f11640c7..000000000
--- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/spawn/JavaAddPaintingTranslator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2019-2022 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.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.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 {
-
- @Override
- 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(),
- session.getEntityCache().getNextEntityId().incrementAndGet(), packet.getUuid(),
- position, PaintingType.getByPaintingType(packet.getPaintingType()), packet.getDirection().getHorizontalIndex());
-
- session.getEntityCache().spawnEntity(entity);
- }
-}