Start on update to Protocol 3.0

This commit is contained in:
RednedEpic 2022-10-29 19:23:21 -05:00
parent 675880cc86
commit 18e7db8c30
353 changed files with 1957 additions and 1656 deletions

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.platform.fabric.world; package org.geysermc.geyser.platform.fabric.world;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMap;
import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.nbt.NbtType; import com.nukkitx.nbt.NbtType;

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.platform.spigot.world; package org.geysermc.geyser.platform.spigot.world;
import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType; import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValueType;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;

View file

@ -25,9 +25,9 @@
package org.geysermc.geyser.platform.spigot.world; package org.geysermc.geyser.platform.spigot.world;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket; import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.platform.spigot.world.manager; package org.geysermc.geyser.platform.spigot.world.manager;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMap;
import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.nbt.NbtType; import com.nukkitx.nbt.NbtType;

View file

@ -20,9 +20,7 @@ dependencies {
// Network libraries // Network libraries
implementation(libs.websocket) implementation(libs.websocket)
api(libs.protocol) { api(libs.bundles.protocol)
exclude("com.nukkitx.network", "raknet")
}
api(libs.mcauthlib) api(libs.mcauthlib)
api(libs.mcprotocollib) { api(libs.mcprotocollib) {

View file

@ -25,7 +25,6 @@
package org.geysermc.connector; package org.geysermc.connector;
import com.nukkitx.protocol.bedrock.BedrockServer;
import org.geysermc.api.Geyser; import org.geysermc.api.Geyser;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -52,10 +51,6 @@ public class GeyserConnector {
return INSTANCE; return INSTANCE;
} }
public BedrockServer getBedrockServer() {
return GeyserImpl.getInstance().getBedrockServer();
}
public boolean isShuttingDown() { public boolean isShuttingDown() {
return GeyserImpl.getInstance().isShuttingDown(); return GeyserImpl.getInstance().isShuttingDown();
} }

View file

@ -26,7 +26,7 @@
package org.geysermc.connector.network.session; package org.geysermc.connector.network.session;
import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.packet.Packet;
import com.nukkitx.protocol.bedrock.BedrockPacket; import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket;
import org.geysermc.connector.network.session.auth.AuthData; import org.geysermc.connector.network.session.auth.AuthData;
/** /**

View file

@ -32,7 +32,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.steveice10.packetlib.tcp.TcpSession; import com.github.steveice10.packetlib.tcp.TcpSession;
import com.nukkitx.network.raknet.RakNetConstants; import com.nukkitx.network.raknet.RakNetConstants;
import com.nukkitx.network.util.EventLoops; import com.nukkitx.network.util.EventLoops;
import com.nukkitx.protocol.bedrock.BedrockServer;
import io.netty.channel.epoll.Epoll; import io.netty.channel.epoll.Epoll;
import io.netty.channel.kqueue.KQueue; import io.netty.channel.kqueue.KQueue;
import io.netty.util.NettyRuntime; import io.netty.util.NettyRuntime;
@ -70,7 +69,7 @@ import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.event.GeyserEventBus; import org.geysermc.geyser.event.GeyserEventBus;
import org.geysermc.geyser.extension.GeyserExtensionManager; import org.geysermc.geyser.extension.GeyserExtensionManager;
import org.geysermc.geyser.level.WorldManager; import org.geysermc.geyser.level.WorldManager;
import org.geysermc.geyser.network.ConnectorServerEventHandler; import org.geysermc.geyser.network.netty.GeyserServer;
import org.geysermc.geyser.pack.ResourcePack; import org.geysermc.geyser.pack.ResourcePack;
import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.Registries;
@ -84,7 +83,12 @@ import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.text.MinecraftLocale; import org.geysermc.geyser.text.MinecraftLocale;
import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.translator.inventory.item.ItemTranslator;
import org.geysermc.geyser.translator.text.MessageTranslator; import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.geyser.util.*; import org.geysermc.geyser.util.CooldownUtils;
import org.geysermc.geyser.util.DimensionUtils;
import org.geysermc.geyser.util.Metrics;
import org.geysermc.geyser.util.NewsHandler;
import org.geysermc.geyser.util.VersionCheckUtils;
import org.geysermc.geyser.util.WebUtils;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -94,7 +98,12 @@ import java.net.InetSocketAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.security.Key; import java.security.Key;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
@ -142,7 +151,7 @@ public class GeyserImpl implements GeyserApi {
private ScheduledExecutorService scheduledThread; private ScheduledExecutorService scheduledThread;
private BedrockServer bedrockServer; private GeyserServer geyserServer;
private final PlatformType platformType; private final PlatformType platformType;
private final GeyserBootstrap bootstrap; private final GeyserBootstrap bootstrap;
@ -286,13 +295,6 @@ public class GeyserImpl implements GeyserApi {
} }
boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol(); boolean enableProxyProtocol = config.getBedrock().isEnableProxyProtocol();
bedrockServer = new BedrockServer(
new InetSocketAddress(config.getBedrock().address(), config.getBedrock().port()),
bedrockThreadCount,
EventLoops.commonGroup(),
enableProxyProtocol
);
if (config.isDebugMode()) { if (config.isDebugMode()) {
logger.debug("EventLoop type: " + EventLoops.getChannelType()); logger.debug("EventLoop type: " + EventLoops.getChannelType());
if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) { if (EventLoops.getChannelType() == EventLoops.ChannelType.NIO) {
@ -305,23 +307,23 @@ public class GeyserImpl implements GeyserApi {
} }
} }
bedrockServer.setHandler(new ConnectorServerEventHandler(this));
if (shouldStartListener) { if (shouldStartListener) {
bedrockServer.bind().whenComplete((avoid, throwable) -> { try {
if (throwable == null) { this.geyserServer = new GeyserServer(this, bedrockThreadCount);
logger.info(GeyserLocale.getLocaleStringLog("geyser.core.start", config.getBedrock().address(), this.geyserServer.bind(new InetSocketAddress(config.getBedrock().address(), config.getBedrock().port()))
String.valueOf(config.getBedrock().port()))); .syncUninterruptibly();
} else {
String address = config.getBedrock().address(); logger.info(GeyserLocale.getLocaleStringLog("geyser.core.start", config.getBedrock().address(),
int port = config.getBedrock().port(); String.valueOf(config.getBedrock().port())));
logger.severe(GeyserLocale.getLocaleStringLog("geyser.core.fail", address, String.valueOf(port))); } catch (Throwable t) {
if (!"0.0.0.0".equals(address)) { String address = config.getBedrock().address();
logger.info(Component.text("Suggestion: try setting `address` under `bedrock` in the Geyser config back to 0.0.0.0", NamedTextColor.GREEN)); int port = config.getBedrock().port();
logger.info(Component.text("Then, restart this server.", NamedTextColor.GREEN)); logger.severe(GeyserLocale.getLocaleStringLog("geyser.core.fail", address, String.valueOf(port)));
} if (!"0.0.0.0".equals(address)) {
logger.info(Component.text("Suggestion: try setting `address` under `bedrock` in the Geyser config back to 0.0.0.0", NamedTextColor.GREEN));
logger.info(Component.text("Then, restart this server.", NamedTextColor.GREEN));
} }
}).join(); }
} }
if (config.getRemote().authType() == AuthType.FLOODGATE) { if (config.getRemote().authType() == AuthType.FLOODGATE) {
@ -542,7 +544,7 @@ public class GeyserImpl implements GeyserApi {
} }
scheduledThread.shutdown(); scheduledThread.shutdown();
bedrockServer.close(); geyserServer.shutdown();
if (skinUploader != null) { if (skinUploader != null) {
skinUploader.close(); skinUploader.close();
} }

View file

@ -28,7 +28,7 @@ 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.object.Direction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource; import org.geysermc.geyser.command.GeyserCommandSource;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.command.defaults; package org.geysermc.geyser.command.defaults;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import org.cloudburstmc.protocol.bedrock.packet.BedrockPacketCodec;
import org.geysermc.common.PlatformType; import org.geysermc.common.PlatformType;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.GeyserCommand; import org.geysermc.geyser.command.GeyserCommand;

View file

@ -31,7 +31,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.hash.Hashing; import com.google.common.hash.Hashing;
import com.google.common.io.ByteSource; import com.google.common.io.ByteSource;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import org.cloudburstmc.protocol.bedrock.packet.BedrockPacketCodec;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View file

@ -29,8 +29,8 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; 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.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.type.*; import org.geysermc.geyser.entity.type.*;
import org.geysermc.geyser.entity.type.living.*; import org.geysermc.geyser.entity.type.living.*;
import org.geysermc.geyser.entity.type.living.animal.*; import org.geysermc.geyser.entity.type.living.animal.*;
@ -196,7 +196,7 @@ public final class EntityDefinitions {
.type(EntityType.AREA_EFFECT_CLOUD) .type(EntityType.AREA_EFFECT_CLOUD)
.height(0.5f).width(1.0f) .height(0.5f).width(1.0f)
.addTranslator(MetadataType.FLOAT, AreaEffectCloudEntity::setRadius) .addTranslator(MetadataType.FLOAT, AreaEffectCloudEntity::setRadius)
.addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.EFFECT_COLOR, entityMetadata.getValue()))
.addTranslator(null) // Waiting .addTranslator(null) // Waiting
.addTranslator(MetadataType.PARTICLE, AreaEffectCloudEntity::setParticle) .addTranslator(MetadataType.PARTICLE, AreaEffectCloudEntity::setParticle)
.build(); .build();
@ -204,15 +204,15 @@ public final class EntityDefinitions {
.type(EntityType.BOAT) .type(EntityType.BOAT)
.height(0.6f).width(1.6f) .height(0.6f).width(1.6f)
.offset(0.35f) .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(EntityDataTypes.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.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityDataTypes.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 // 'Health' in Bedrock, damage taken in Java - it makes motion in Bedrock
boatEntity.getDirtyMetadata().put(EntityData.HEALTH, 40 - ((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue()))) boatEntity.getDirtyMetadata().put(EntityDataTypes.HEALTH, 40 - ((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue())))
.addTranslator(MetadataType.INT, BoatEntity::setVariant) .addTranslator(MetadataType.INT, BoatEntity::setVariant)
.addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingLeft) .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingLeft)
.addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingRight) .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingRight)
.addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityData.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityDataTypes.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything
.build(); .build();
CHEST_BOAT = EntityDefinition.inherited(ChestBoatEntity::new, BOAT) CHEST_BOAT = EntityDefinition.inherited(ChestBoatEntity::new, BOAT)
.type(EntityType.CHEST_BOAT) .type(EntityType.CHEST_BOAT)
@ -367,11 +367,11 @@ public final class EntityDefinitions {
.type(EntityType.MINECART) .type(EntityType.MINECART)
.height(0.7f).width(0.98f) .height(0.7f).width(0.98f)
.offset(0.35f) .offset(0.35f)
.addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityData.HEALTH, entityMetadata.getValue())) .addTranslator(MetadataType.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityDataTypes.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.INT, (minecartEntity, entityMetadata) -> minecartEntity.getDirtyMetadata().put(EntityDataTypes.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 // Power in Java, time in Bedrock
minecartEntity.getDirtyMetadata().put(EntityData.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15))) minecartEntity.getDirtyMetadata().put(EntityDataTypes.HURT_TIME, Math.min((int) ((FloatEntityMetadata) entityMetadata).getPrimitiveValue(), 15)))
.addTranslator(MetadataType.INT, MinecartEntity::setCustomBlock) .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlock)
.addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset) .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset)
.addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock) .addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock)
@ -381,8 +381,8 @@ public final class EntityDefinitions {
.build(); .build();
COMMAND_BLOCK_MINECART = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) COMMAND_BLOCK_MINECART = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART)
.type(EntityType.COMMAND_BLOCK_MINECART) .type(EntityType.COMMAND_BLOCK_MINECART)
.addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.COMMAND_BLOCK_COMMAND, entityMetadata.getValue())) .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.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(EntityDataTypes.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue())))
.build(); .build();
FURNACE_MINECART = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) FURNACE_MINECART = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART)
.type(EntityType.FURNACE_MINECART) .type(EntityType.FURNACE_MINECART)
@ -413,9 +413,9 @@ public final class EntityDefinitions {
.addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags) .addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags)
.addTranslator(MetadataType.FLOAT, LivingEntity::setHealth) .addTranslator(MetadataType.FLOAT, LivingEntity::setHealth)
.addTranslator(MetadataType.INT, .addTranslator(MetadataType.INT,
(livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_COLOR, entityMetadata.getValue())) (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityDataTypes.EFFECT_COLOR, entityMetadata.getValue()))
.addTranslator(MetadataType.BOOLEAN, .addTranslator(MetadataType.BOOLEAN,
(livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityData.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0))) (livingEntity, entityMetadata) -> livingEntity.getDirtyMetadata().put(EntityDataTypes.EFFECT_AMBIENT, (byte) (((BooleanEntityMetadata) entityMetadata).getPrimitiveValue() ? 1 : 0)))
.addTranslator(null) // Arrow count .addTranslator(null) // Arrow count
.addTranslator(null) // Stinger count .addTranslator(null) // Stinger count
.addTranslator(MetadataType.OPTIONAL_POSITION, LivingEntity::setBedPosition) .addTranslator(MetadataType.OPTIONAL_POSITION, LivingEntity::setBedPosition)
@ -886,9 +886,9 @@ public final class EntityDefinitions {
LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase)
.type(EntityType.LLAMA) .type(EntityType.LLAMA)
.height(1.87f).width(0.9f) .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(EntityDataTypes.STRENGTH, entityMetadata.getValue()))
.addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor) .addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor)
.addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.VARIANT, entityMetadata.getValue()))
.build(); .build();
TRADER_LLAMA = EntityDefinition.inherited(TraderLlamaEntity::new, LLAMA) TRADER_LLAMA = EntityDefinition.inherited(TraderLlamaEntity::new, LLAMA)
.type(EntityType.TRADER_LLAMA) .type(EntityType.TRADER_LLAMA)
@ -911,7 +911,7 @@ public final class EntityDefinitions {
PARROT = EntityDefinition.inherited(ParrotEntity::new, tameableEntityBase) PARROT = EntityDefinition.inherited(ParrotEntity::new, tameableEntityBase)
.type(EntityType.PARROT) .type(EntityType.PARROT)
.height(0.9f).width(0.5f) .height(0.9f).width(0.5f)
.addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityData.VARIANT, entityMetadata.getValue())) // Parrot color .addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityDataTypes.VARIANT, entityMetadata.getValue())) // Parrot color
.build(); .build();
WOLF = EntityDefinition.inherited(WolfEntity::new, tameableEntityBase) WOLF = EntityDefinition.inherited(WolfEntity::new, tameableEntityBase)
.type(EntityType.WOLF) .type(EntityType.WOLF)

View file

@ -25,9 +25,9 @@
package org.geysermc.geyser.entity; package org.geysermc.geyser.entity;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataMap;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataType;
import java.util.Map; import java.util.Map;
@ -35,9 +35,9 @@ import java.util.Map;
* A write-only wrapper for temporarily storing entity metadata that will be sent to Bedrock. * A write-only wrapper for temporarily storing entity metadata that will be sent to Bedrock.
*/ */
public final class GeyserDirtyMetadata { public final class GeyserDirtyMetadata {
private final Map<EntityData, Object> metadata = new Object2ObjectLinkedOpenHashMap<>(); private final Map<EntityDataType<?>, Object> metadata = new Object2ObjectLinkedOpenHashMap<>();
public void put(EntityData entityData, Object value) { public void put(EntityDataType<?> entityData, Object value) {
metadata.put(entityData, value); metadata.put(entityData, value);
} }

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.attribute; package org.geysermc.geyser.entity.attribute;
import com.nukkitx.protocol.bedrock.data.AttributeData; import org.cloudburstmc.protocol.bedrock.data.AttributeData;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.factory; package org.geysermc.geyser.entity.factory;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -27,8 +27,8 @@ 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.metadata.type.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -28,9 +28,9 @@ 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.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata; 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.github.steveice10.mc.protocol.data.game.level.particle.Particle;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -47,12 +47,12 @@ public class AreaEffectCloudEntity extends Entity {
protected void initializeMetadata() { protected void initializeMetadata() {
super.initializeMetadata(); super.initializeMetadata();
// Without this the cloud doesn't appear, // Without this the cloud doesn't appear,
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, Integer.MAX_VALUE); dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_DURATION, Integer.MAX_VALUE);
// This disabled client side shrink of the cloud // This disabled client side shrink of the cloud
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f); dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_RADIUS, 0.0f);
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_RATE, Float.MIN_VALUE); dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_CHANGE_RATE, Float.MIN_VALUE);
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, Float.MIN_VALUE); dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_CHANGE_ON_PICKUP, Float.MIN_VALUE);
setFlag(EntityFlag.FIRE_IMMUNE, true); setFlag(EntityFlag.FIRE_IMMUNE, true);
} }
@ -60,15 +60,15 @@ public class AreaEffectCloudEntity extends Entity {
public void setRadius(FloatEntityMetadata entityMetadata) { public void setRadius(FloatEntityMetadata entityMetadata) {
// Anything less than 0.5 will cause the cloud to despawn // Anything less than 0.5 will cause the cloud to despawn
float value = Math.max(entityMetadata.getPrimitiveValue(), 0.5f); float value = Math.max(entityMetadata.getPrimitiveValue(), 0.5f);
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, value); dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_RADIUS, value);
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * value); dirtyMetadata.put(EntityDataTypes.BOUNDING_BOX_WIDTH, 2.0f * value);
} }
public void setParticle(EntityMetadata<Particle, ?> entityMetadata) { public void setParticle(EntityMetadata<Particle, ?> entityMetadata) {
Particle particle = entityMetadata.getValue(); Particle particle = entityMetadata.getValue();
int particleId = Registries.PARTICLES.map(particle.getType(), mapping -> mapping.getParticleId(this.session)).orElse(-1); int particleId = Registries.PARTICLES.map(particle.getType(), mapping -> mapping.getParticleId(this.session)).orElse(-1);
if (particleId != -1) { if (particleId != -1) {
dirtyMetadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId); dirtyMetadata.put(EntityDataTypes.AREA_EFFECT_CLOUD_PARTICLE_ID, particleId);
} }
} }
} }

View file

@ -28,10 +28,10 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.packet.AnimatePacket; import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import lombok.Getter; import lombok.Getter;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
@ -73,8 +73,8 @@ public class BoatEntity extends Entity {
super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); 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+ // Required to be able to move on land 1.16.200+ or apply gravity not in the water 1.16.100+
dirtyMetadata.put(EntityData.IS_BUOYANT, (byte) 1); dirtyMetadata.put(EntityDataTypes.IS_BUOYANT, (byte) 1);
dirtyMetadata.put(EntityData.BUOYANCY_DATA, BUOYANCY_DATA); dirtyMetadata.put(EntityDataTypes.BUOYANCY_DATA, BUOYANCY_DATA);
} }
@Override @Override
@ -124,7 +124,7 @@ public class BoatEntity extends Entity {
public void setVariant(IntEntityMetadata entityMetadata) { public void setVariant(IntEntityMetadata entityMetadata) {
variant = entityMetadata.getPrimitiveValue(); variant = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.VARIANT, variant); dirtyMetadata.put(EntityDataTypes.VARIANT, variant);
} }
public void setPaddlingLeft(BooleanEntityMetadata entityMetadata) { public void setPaddlingLeft(BooleanEntityMetadata entityMetadata) {
@ -142,7 +142,7 @@ public class BoatEntity extends Entity {
} }
} else { } else {
// Indicate that the row position should be reset // Indicate that the row position should be reset
dirtyMetadata.put(EntityData.ROW_TIME_LEFT, 0.0f); dirtyMetadata.put(EntityDataTypes.ROW_TIME_LEFT, 0.0f);
} }
} }
@ -157,7 +157,7 @@ public class BoatEntity extends Entity {
} }
} }
} else { } else {
dirtyMetadata.put(EntityData.ROW_TIME_RIGHT, 0.0f); dirtyMetadata.put(EntityDataTypes.ROW_TIME_RIGHT, 0.0f);
} }
} }

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractionResult;

View file

@ -26,11 +26,11 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractionResult;
@ -47,10 +47,10 @@ public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity {
@Override @Override
protected void initializeMetadata() { protected void initializeMetadata() {
// Required, or else the GUI will not open // Required, or else the GUI will not open
dirtyMetadata.put(EntityData.CONTAINER_TYPE, (byte) 16); dirtyMetadata.put(EntityDataTypes.CONTAINER_TYPE, (byte) 16);
dirtyMetadata.put(EntityData.CONTAINER_BASE_SIZE, 1); dirtyMetadata.put(EntityDataTypes.CONTAINER_SIZE, 1);
// Required, or else the client does not bother to send a packet back with the new information // 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); dirtyMetadata.put(EntityDataTypes.COMMAND_BLOCK_ENABLED, (byte) 1);
} }
/** /**
@ -58,8 +58,8 @@ public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity {
*/ */
@Override @Override
public void updateDefaultBlockMetadata() { public void updateDefaultBlockMetadata() {
dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getCommandBlockRuntimeId()); dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getCommandBlock());
dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, 6);
} }
@Override @Override

View file

@ -27,8 +27,8 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -46,7 +46,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
public DefaultBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public DefaultBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1); dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) 1);
} }
@Override @Override
@ -60,7 +60,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
customBlock = entityMetadata.getPrimitiveValue(); customBlock = entityMetadata.getPrimitiveValue();
if (showCustomBlock) { if (showCustomBlock) {
dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(customBlock));
} }
} }
@ -69,7 +69,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
customBlockOffset = entityMetadata.getPrimitiveValue(); customBlockOffset = entityMetadata.getPrimitiveValue();
if (showCustomBlock) { if (showCustomBlock) {
dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, customBlockOffset);
} }
} }
@ -77,8 +77,8 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) { public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) {
if (entityMetadata.getPrimitiveValue()) { if (entityMetadata.getPrimitiveValue()) {
showCustomBlock = true; showCustomBlock = true;
dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(customBlock)); dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(customBlock));
dirtyMetadata.put(EntityData.DISPLAY_OFFSET, customBlockOffset); dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, customBlockOffset);
} else { } else {
showCustomBlock = false; showCustomBlock = false;
updateDefaultBlockMetadata(); updateDefaultBlockMetadata();

View file

@ -26,10 +26,10 @@
package org.geysermc.geyser.entity.type; 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.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -54,9 +54,9 @@ public class EnderCrystalEntity extends Entity {
// Usually performed client-side on Bedrock except for Ender Dragon respawn event // Usually performed client-side on Bedrock except for Ender Dragon respawn event
Optional<Vector3i> optionalPos = entityMetadata.getValue(); Optional<Vector3i> optionalPos = entityMetadata.getValue();
if (optionalPos.isPresent()) { if (optionalPos.isPresent()) {
dirtyMetadata.put(EntityData.BLOCK_TARGET, optionalPos.get()); dirtyMetadata.put(EntityDataTypes.BLOCK_TARGET, optionalPos.get());
} else { } else {
dirtyMetadata.put(EntityData.BLOCK_TARGET, Vector3i.ZERO); dirtyMetadata.put(EntityDataTypes.BLOCK_TARGET, Vector3i.ZERO);
} }
} }
} }

View file

@ -32,16 +32,20 @@ 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.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; 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.EntityEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlags;
import com.nukkitx.protocol.bedrock.packet.*;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.cloudburstmc.math.vector.Vector3f;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.cloudburstmc.protocol.bedrock.packet.AddEntityPacket;
import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket;
import org.cloudburstmc.protocol.bedrock.packet.RemoveEntityPacket;
import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.GeyserDirtyMetadata; import org.geysermc.geyser.entity.GeyserDirtyMetadata;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -52,6 +56,7 @@ import org.geysermc.geyser.util.InteractiveTag;
import org.geysermc.geyser.util.MathUtils; import org.geysermc.geyser.util.MathUtils;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
@ -110,7 +115,7 @@ public class Entity {
* think they are set to false. * think they are set to false.
*/ */
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
protected final EntityFlags flags = new EntityFlags(); protected final EnumSet<EntityFlag> flags = EnumSet.noneOf(EntityFlag.class);
/** /**
* Indicates if flags have been updated and need to be sent to the client. * Indicates if flags have been updated and need to be sent to the client.
*/ */
@ -142,9 +147,9 @@ public class Entity {
* Called on entity spawn. Used to populate the entity metadata and flags with default values. * Called on entity spawn. Used to populate the entity metadata and flags with default values.
*/ */
protected void initializeMetadata() { protected void initializeMetadata() {
dirtyMetadata.put(EntityData.SCALE, 1f); dirtyMetadata.put(EntityDataTypes.SCALE, 1f);
dirtyMetadata.put(EntityData.COLOR, (byte) 0); dirtyMetadata.put(EntityDataTypes.COLOR, (byte) 0);
dirtyMetadata.put(EntityData.MAX_AIR_SUPPLY, getMaxAir()); dirtyMetadata.put(EntityDataTypes.AIR_SUPPLY_MAX, getMaxAir());
setDimensions(Pose.STANDING); setDimensions(Pose.STANDING);
setFlag(EntityFlag.HAS_GRAVITY, true); setFlag(EntityFlag.HAS_GRAVITY, true);
setFlag(EntityFlag.HAS_COLLISION, true); setFlag(EntityFlag.HAS_COLLISION, true);
@ -165,7 +170,7 @@ public class Entity {
addEntityPacket.setUniqueEntityId(geyserId); addEntityPacket.setUniqueEntityId(geyserId);
addEntityPacket.setPosition(position); addEntityPacket.setPosition(position);
addEntityPacket.setMotion(motion); addEntityPacket.setMotion(motion);
addEntityPacket.setRotation(getBedrockRotation()); addEntityPacket.setRotation(getBedrockRotation().toVector2(false)); // TODO: Check this
addEntityPacket.getMetadata().putFlags(flags); addEntityPacket.getMetadata().putFlags(flags);
dirtyMetadata.apply(addEntityPacket.getMetadata()); dirtyMetadata.apply(addEntityPacket.getMetadata());
addAdditionalSpawnData(addEntityPacket); addAdditionalSpawnData(addEntityPacket);
@ -320,14 +325,14 @@ public class Entity {
} }
public final boolean getFlag(EntityFlag flag) { public final boolean getFlag(EntityFlag flag) {
return flags.getFlag(flag); return this.flags.contains(flag);
} }
/** /**
* Updates a flag value and determines if the flags would need synced with the Bedrock client. * Updates a flag value and determines if the flags would need synced with the Bedrock client.
*/ */
public final void setFlag(EntityFlag flag, boolean value) { public final void setFlag(EntityFlag flag, boolean value) {
flagsDirty |= flags.setFlag(flag, value); flagsDirty |= value ? this.flags.add(flag) : this.flags.remove(flag);
} }
/** /**
@ -378,7 +383,7 @@ public class Entity {
} }
protected void setAirSupply(int amount) { protected void setAirSupply(int amount) {
dirtyMetadata.put(EntityData.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir())); dirtyMetadata.put(EntityDataTypes.AIR_SUPPLY, (short) MathUtils.constrain(amount, 0, getMaxAir()));
} }
protected short getMaxAir() { protected short getMaxAir() {
@ -389,15 +394,15 @@ public class Entity {
Optional<Component> name = entityMetadata.getValue(); Optional<Component> name = entityMetadata.getValue();
if (name.isPresent()) { if (name.isPresent()) {
nametag = MessageTranslator.convertMessage(name.get(), session.locale()); nametag = MessageTranslator.convertMessage(name.get(), session.locale());
dirtyMetadata.put(EntityData.NAMETAG, nametag); dirtyMetadata.put(EntityDataTypes.NAME, nametag);
} else if (!nametag.isEmpty()) { } else if (!nametag.isEmpty()) {
// Clear nametag // Clear nametag
dirtyMetadata.put(EntityData.NAMETAG, ""); dirtyMetadata.put(EntityDataTypes.NAME, "");
} }
} }
public void setDisplayNameVisible(BooleanEntityMetadata entityMetadata) { public void setDisplayNameVisible(BooleanEntityMetadata entityMetadata) {
dirtyMetadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); dirtyMetadata.put(EntityDataTypes.NAMETAG_ALWAYS_SHOW, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0));
} }
public final void setSilent(BooleanEntityMetadata entityMetadata) { public final void setSilent(BooleanEntityMetadata entityMetadata) {
@ -430,7 +435,7 @@ public class Entity {
public boolean setBoundingBoxHeight(float height) { public boolean setBoundingBoxHeight(float height) {
if (height != boundingBoxHeight) { if (height != boundingBoxHeight) {
boundingBoxHeight = height; boundingBoxHeight = height;
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, boundingBoxHeight); dirtyMetadata.put(EntityDataTypes.HEIGHT, boundingBoxHeight);
updatePassengerOffsets(); updatePassengerOffsets();
return true; return true;
@ -441,7 +446,7 @@ public class Entity {
public void setBoundingBoxWidth(float width) { public void setBoundingBoxWidth(float width) {
if (width != boundingBoxWidth) { if (width != boundingBoxWidth) {
boundingBoxWidth = width; boundingBoxWidth = width;
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, boundingBoxWidth); dirtyMetadata.put(EntityDataTypes.WIDTH, boundingBoxWidth);
} }
} }
@ -453,12 +458,12 @@ public class Entity {
// The Java client caps its freezing tick percentage at 140 // The Java client caps its freezing tick percentage at 140
int freezingTicks = Math.min(entityMetadata.getPrimitiveValue(), 140); int freezingTicks = Math.min(entityMetadata.getPrimitiveValue(), 140);
float freezingPercentage = freezingTicks / 140f; float freezingPercentage = freezingTicks / 140f;
dirtyMetadata.put(EntityData.FREEZING_EFFECT_STRENGTH, freezingPercentage); dirtyMetadata.put(EntityDataTypes.FREEZING_EFFECT_STRENGTH, freezingPercentage);
return freezingPercentage; return freezingPercentage;
} }
public void setRiderSeatPosition(Vector3f position) { public void setRiderSeatPosition(Vector3f position) {
dirtyMetadata.put(EntityData.RIDER_SEAT_POSITION, position); dirtyMetadata.put(EntityDataTypes.SEAT_OFFSET, position);
} }
/** /**
@ -518,7 +523,7 @@ public class Entity {
break; break;
} }
} }
session.getPlayerEntity().getDirtyMetadata().put(EntityData.INTERACTIVE_TAG, tag.getValue()); session.getPlayerEntity().getDirtyMetadata().put(EntityDataTypes.INTERACT_TEXT, tag.getValue());
session.getPlayerEntity().updateBedrockMetadata(); session.getPlayerEntity().updateBedrockMetadata();
} }

View file

@ -25,9 +25,9 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -42,14 +42,14 @@ public class EvokerFangsEntity extends Entity implements Tickable {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
// As of 1.18.2 Bedrock, this line is required for the entity to be visible // As of 1.18.2 Bedrock, this line is required for the entity to be visible
// 22 is the starting number on Java Edition // 22 is the starting number on Java Edition
dirtyMetadata.put(EntityData.LIMITED_LIFE, this.limitedLife); dirtyMetadata.put(EntityDataTypes.LIMITED_LIFE, this.limitedLife);
} }
@Override @Override
public void tick() { public void tick() {
if (attackStarted) { if (attackStarted) {
if (--this.limitedLife > 0 && this.limitedLife % 2 == 0) { // Matches Bedrock behavior if (--this.limitedLife > 0 && this.limitedLife % 2 == 0) { // Matches Bedrock behavior
dirtyMetadata.put(EntityData.LIMITED_LIFE, this.limitedLife); dirtyMetadata.put(EntityDataTypes.LIMITED_LIFE, this.limitedLife);
updateBedrockMetadata(); updateBedrockMetadata();
} }
} }

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -35,6 +35,6 @@ public class ExpOrbEntity extends Entity {
public ExpOrbEntity(GeyserSession session, int amount, int entityId, long geyserId, Vector3f position) { public ExpOrbEntity(GeyserSession session, int amount, int entityId, long geyserId, Vector3f position) {
super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0); super(session, entityId, geyserId, null, EntityDefinitions.EXPERIENCE_ORB, position, Vector3f.ZERO, 0, 0, 0);
this.dirtyMetadata.put(EntityData.EXPERIENCE_VALUE, amount); this.dirtyMetadata.put(EntityDataTypes.EXPERIENCE_VALUE, amount);
} }
} }

View file

@ -26,9 +26,9 @@
package org.geysermc.geyser.entity.type; 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.BooleanEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -39,7 +39,7 @@ public class FallingBlockEntity extends Entity {
public FallingBlockEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, int javaId) { 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); super(session, entityId, geyserId, uuid, EntityDefinitions.FALLING_BLOCK, position, motion, yaw, pitch, headYaw);
this.dirtyMetadata.put(EntityData.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId)); this.dirtyMetadata.put(EntityDataTypes.VARIANT, session.getBlockMappings().getBedrockBlockId(javaId));
} }
@Override @Override

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -30,12 +30,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.Tag; import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMap;
import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.nbt.NbtType; import com.nukkitx.nbt.NbtType;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket;
import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.DeviceOs;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.entity.type.player.PlayerEntity;
@ -133,7 +133,7 @@ public class FireworkEntity extends Entity {
NbtMapBuilder builder = NbtMap.builder(); NbtMapBuilder builder = NbtMap.builder();
builder.put("Fireworks", fireworksBuilder.build()); builder.put("Fireworks", fireworksBuilder.build());
dirtyMetadata.put(EntityData.DISPLAY_ITEM, builder.build()); dirtyMetadata.put(EntityDataTypes.DISPLAY_FIREWORK, builder.build());
} }
public void setPlayerGliding(EntityMetadata<OptionalInt, ?> entityMetadata) { public void setPlayerGliding(EntityMetadata<OptionalInt, ?> entityMetadata) {

View file

@ -26,9 +26,9 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket;
import lombok.Getter; import lombok.Getter;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.entity.type.player.PlayerEntity;
@ -66,7 +66,7 @@ public class FishingHookEntity extends ThrowableEntity {
setBoundingBoxHeight(128); setBoundingBoxHeight(128);
this.bedrockOwnerId = owner.getGeyserId(); this.bedrockOwnerId = owner.getGeyserId();
this.dirtyMetadata.put(EntityData.OWNER_EID, this.bedrockOwnerId); this.dirtyMetadata.put(EntityDataTypes.OWNER_EID, this.bedrockOwnerId);
} }
public void setHookedEntity(IntEntityMetadata entityMetadata) { public void setHookedEntity(IntEntityMetadata entityMetadata) {
@ -74,7 +74,7 @@ public class FishingHookEntity extends ThrowableEntity {
Entity entity = session.getEntityCache().getEntityByJavaId(hookedEntityId); Entity entity = session.getEntityCache().getEntityByJavaId(hookedEntityId);
if (entity != null) { if (entity != null) {
bedrockTargetId = entity.getGeyserId(); bedrockTargetId = entity.getGeyserId();
dirtyMetadata.put(EntityData.TARGET_EID, bedrockTargetId); dirtyMetadata.put(EntityDataTypes.TARGET_EID, bedrockTargetId);
hooked = true; hooked = true;
} else { } else {
hooked = false; hooked = false;

View file

@ -27,8 +27,8 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -51,8 +51,8 @@ public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity {
@Override @Override
public void updateDefaultBlockMetadata() { public void updateDefaultBlockMetadata() {
dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(hasFuel ? BlockStateValues.JAVA_FURNACE_LIT_ID : BlockStateValues.JAVA_FURNACE_ID)); dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(hasFuel ? BlockStateValues.JAVA_FURNACE_LIT_ID : BlockStateValues.JAVA_FURNACE_ID));
dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, 6);
} }
@Override @Override

View file

@ -27,13 +27,13 @@ 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.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.AddItemEntityPacket; import org.cloudburstmc.protocol.bedrock.packet.AddItemEntityPacket;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -31,13 +31,13 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.nbt.NbtMap; import com.nukkitx.nbt.NbtMap;
import com.nukkitx.nbt.NbtMapBuilder; import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket;
import lombok.Getter; import lombok.Getter;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -114,7 +114,7 @@ public class ItemFrameEntity extends Entity {
this.heldItem = entityMetadata.getValue(); this.heldItem = entityMetadata.getValue();
ItemData itemData = ItemTranslator.translateToBedrock(session, heldItem); ItemData itemData = ItemTranslator.translateToBedrock(session, heldItem);
String customIdentifier = session.getItemMappings().getCustomIdMappings().get(itemData.getId()); String customIdentifier = session.getItemMappings().getCustomIdMappings().get(itemData.getDefinition().getRuntimeId());
NbtMapBuilder builder = NbtMap.builder(); NbtMapBuilder builder = NbtMap.builder();
@ -152,7 +152,7 @@ public class ItemFrameEntity extends Entity {
UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket(); UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket();
updateBlockPacket.setDataLayer(0); updateBlockPacket.setDataLayer(0);
updateBlockPacket.setBlockPosition(bedrockPosition); updateBlockPacket.setBlockPosition(bedrockPosition);
updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockAirId()); //TODO maybe set this to the world block or another item frame? updateBlockPacket.setRuntimeId(session.getBlockMappings().getBedrockAir().getRuntimeId()); //TODO maybe set this to the world block or another item frame?
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY);
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NETWORK);
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS);

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractionResult;

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -35,16 +35,16 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.AttributeData; import org.cloudburstmc.protocol.bedrock.data.AttributeData;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.inventory.ContainerId; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket;
import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.MobEquipmentPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -88,7 +88,7 @@ public class LivingEntity extends Entity {
protected void initializeMetadata() { protected void initializeMetadata() {
super.initializeMetadata(); super.initializeMetadata();
// Matches Bedrock behavior; is always set to this // Matches Bedrock behavior; is always set to this
dirtyMetadata.put(EntityData.HEALTH, 1); dirtyMetadata.put(EntityDataTypes.HEALTH, 1);
} }
public void setLivingEntityFlags(ByteEntityMetadata entityMetadata) { public void setLivingEntityFlags(ByteEntityMetadata entityMetadata) {
@ -125,27 +125,27 @@ public class LivingEntity extends Entity {
Optional<Vector3i> optionalPos = entityMetadata.getValue(); Optional<Vector3i> optionalPos = entityMetadata.getValue();
if (optionalPos.isPresent()) { if (optionalPos.isPresent()) {
Vector3i bedPosition = optionalPos.get(); Vector3i bedPosition = optionalPos.get();
dirtyMetadata.put(EntityData.BED_POSITION, bedPosition); dirtyMetadata.put(EntityDataTypes.BED_POSITION, bedPosition);
int bed = session.getGeyser().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 // Bed has to be updated, or else player is floating in the air
ChunkUtils.updateBlock(session, bed, bedPosition); ChunkUtils.updateBlock(session, bed, bedPosition);
// Indicate that the player should enter the sleep cycle // Indicate that the player should enter the sleep cycle
// Has to be a byte or it does not work // Has to be a byte or it does not work
// (Bed position is what actually triggers sleep - "pose" is only optional) // (Bed position is what actually triggers sleep - "pose" is only optional)
dirtyMetadata.put(EntityData.PLAYER_FLAGS, (byte) 2); dirtyMetadata.put(EntityDataTypes.PLAYER_FLAGS, (byte) 2);
return bedPosition; return bedPosition;
} else { } else {
// Player is no longer sleeping // Player is no longer sleeping
dirtyMetadata.put(EntityData.PLAYER_FLAGS, (byte) 0); dirtyMetadata.put(EntityDataTypes.PLAYER_FLAGS, (byte) 0);
return null; return null;
} }
} }
protected boolean hasShield(boolean offhand, ItemMapping shieldMapping) { protected boolean hasShield(boolean offhand, ItemMapping shieldMapping) {
if (offhand) { if (offhand) {
return offHand.getId() == shieldMapping.getBedrockId(); return offHand.getId() == shieldMapping.getBedrockDefinition();
} else { } else {
return hand.getId() == shieldMapping.getBedrockId(); return hand.getId() == shieldMapping.getBedrockDefinition();
} }
} }
@ -219,10 +219,10 @@ public class LivingEntity extends Entity {
// If an entity has a banner on them, it will be in the helmet slot in Java but the chestplate spot in Bedrock // If an entity has a banner on them, it will be in the helmet slot in Java but the chestplate spot in Bedrock
// But don't overwrite the chestplate if it isn't empty // But don't overwrite the chestplate if it isn't empty
ItemMapping banner = session.getItemMappings().getStoredItems().banner(); ItemMapping banner = session.getItemMappings().getStoredItems().banner();
if (chestplate.getId() == ItemData.AIR.getId() && helmet.getId() == banner.getBedrockId()) { if (chestplate.getId() == ItemData.AIR.getId() && helmet.getId() == banner.getBedrockDefinition()) {
chestplate = this.helmet; chestplate = this.helmet;
helmet = ItemData.AIR; helmet = ItemData.AIR;
} else if (chestplate.getId() == banner.getBedrockId()) { } else if (chestplate.getId() == banner.getBedrockDefinition()) {
// Prevent chestplate banners from showing erroneously // Prevent chestplate banners from showing erroneously
chestplate = ItemData.AIR; chestplate = ItemData.AIR;
} }

View file

@ -28,8 +28,8 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -45,17 +45,17 @@ public class MinecartEntity extends Entity {
} }
public void setCustomBlock(IntEntityMetadata entityMetadata) { public void setCustomBlock(IntEntityMetadata entityMetadata) {
dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue())); dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(entityMetadata.getPrimitiveValue()));
} }
public void setCustomBlockOffset(IntEntityMetadata entityMetadata) { public void setCustomBlockOffset(IntEntityMetadata entityMetadata) {
dirtyMetadata.put(EntityData.DISPLAY_OFFSET, entityMetadata.getPrimitiveValue()); dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, entityMetadata.getPrimitiveValue());
} }
public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) { public void setShowCustomBlock(BooleanEntityMetadata entityMetadata) {
// If the custom block should be enabled // If the custom block should be enabled
// Needs a byte based off of Java's boolean // Needs a byte based off of Java's boolean
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0)); dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) (entityMetadata.getPrimitiveValue() ? 1 : 0));
} }
@Override @Override

View file

@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.AddPaintingPacket; import org.cloudburstmc.protocol.bedrock.packet.AddPaintingPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.level.PaintingType; import org.geysermc.geyser.level.PaintingType;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -41,7 +41,7 @@ public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity {
@Override @Override
public void updateDefaultBlockMetadata() { public void updateDefaultBlockMetadata() {
dirtyMetadata.put(EntityData.DISPLAY_ITEM, session.getBlockMappings().getBedrockBlockId(BlockStateValues.JAVA_SPAWNER_ID)); dirtyMetadata.put(EntityDataTypes.DISPLAY_BLOCK_STATE, session.getBlockMappings().getBedrockBlockId(BlockStateValues.JAVA_SPAWNER_ID));
dirtyMetadata.put(EntityData.DISPLAY_OFFSET, 6); dirtyMetadata.put(EntityDataTypes.DISPLAY_OFFSET, 6);
} }
} }

View file

@ -26,10 +26,10 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket; import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -45,7 +45,7 @@ public class TNTEntity extends Entity implements Tickable {
public void setFuseLength(IntEntityMetadata entityMetadata) { public void setFuseLength(IntEntityMetadata entityMetadata) {
currentTick = ((IntEntityMetadata) entityMetadata).getPrimitiveValue(); currentTick = ((IntEntityMetadata) entityMetadata).getPrimitiveValue();
setFlag(EntityFlag.IGNITED, true); setFlag(EntityFlag.IGNITED, true);
dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); dirtyMetadata.put(EntityDataTypes.FUSE_TIME, currentTick);
} }
@Override @Override
@ -56,11 +56,11 @@ public class TNTEntity extends Entity implements Tickable {
} }
if (currentTick % 5 == 0) { if (currentTick % 5 == 0) {
dirtyMetadata.put(EntityData.FUSE_LENGTH, currentTick); dirtyMetadata.put(EntityDataTypes.FUSE_TIME, currentTick);
SetEntityDataPacket packet = new SetEntityDataPacket(); SetEntityDataPacket packet = new SetEntityDataPacket();
packet.setRuntimeEntityId(geyserId); packet.setRuntimeEntityId(geyserId);
packet.getMetadata().put(EntityData.FUSE_LENGTH, currentTick); packet.getMetadata().put(EntityDataTypes.FUSE_TIME, currentTick);
session.sendUpstreamPacket(packet); session.sendUpstreamPacket(packet);
} }
currentTick--; currentTick--;

View file

@ -26,11 +26,11 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.LevelEventType; import org.cloudburstmc.protocol.bedrock.data.LevelEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket; import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket;
import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -27,8 +27,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.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; 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.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag; import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.inventory.item.Potion;
@ -52,7 +52,7 @@ public class ThrownPotionEntity extends ThrowableItemEntity {
public void setItem(EntityMetadata<ItemStack, ?> entityMetadata) { public void setItem(EntityMetadata<ItemStack, ?> entityMetadata) {
ItemStack itemStack = entityMetadata.getValue(); ItemStack itemStack = entityMetadata.getValue();
if (itemStack == null) { if (itemStack == null) {
dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); dirtyMetadata.put(EntityDataTypes.POTION_AUX_VALUE, 0);
setFlag(EntityFlag.ENCHANTED, false); setFlag(EntityFlag.ENCHANTED, false);
setFlag(EntityFlag.LINGERING, false); setFlag(EntityFlag.LINGERING, false);
} else { } else {
@ -62,10 +62,10 @@ public class ThrownPotionEntity extends ThrowableItemEntity {
if (potionTag instanceof StringTag) { if (potionTag instanceof StringTag) {
Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue()); Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue());
if (potion != null) { if (potion != null) {
dirtyMetadata.put(EntityData.POTION_AUX_VALUE, potion.getBedrockId()); dirtyMetadata.put(EntityDataTypes.POTION_AUX_VALUE, potion.getBedrockId());
setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion)); setFlag(EntityFlag.ENCHANTED, !NON_ENCHANTED_POTIONS.contains(potion));
} else { } else {
dirtyMetadata.put(EntityData.POTION_AUX_VALUE, 0); dirtyMetadata.put(EntityDataTypes.POTION_AUX_VALUE, 0);
GeyserImpl.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue()); GeyserImpl.getInstance().getLogger().debug("Unknown java potion: " + potionTag.getValue());
} }
} }

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.item.TippedArrowPotion; import org.geysermc.geyser.inventory.item.TippedArrowPotion;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -47,13 +47,13 @@ public class TippedArrowEntity extends AbstractArrowEntity {
int potionColor = entityMetadata.getPrimitiveValue(); int potionColor = entityMetadata.getPrimitiveValue();
// -1 means no color // -1 means no color
if (potionColor == -1) { if (potionColor == -1) {
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, 0);
} else { } else {
TippedArrowPotion potion = TippedArrowPotion.getByJavaColor(potionColor); TippedArrowPotion potion = TippedArrowPotion.getByJavaColor(potionColor);
if (potion != null && potion.getJavaColor() != -1) { if (potion != null && potion.getJavaColor() != -1) {
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, (byte) potion.getBedrockId()); dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) potion.getBedrockId());
} else { } else {
dirtyMetadata.put(EntityData.CUSTOM_DISPLAY, 0); dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, 0);
} }
} }
} }

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type; package org.geysermc.geyser.entity.type;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type; 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.BooleanEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,9 +26,9 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -42,7 +42,7 @@ public class AgeableEntity extends CreatureEntity {
public void setBaby(BooleanEntityMetadata entityMetadata) { public void setBaby(BooleanEntityMetadata entityMetadata) {
boolean isBaby = entityMetadata.getPrimitiveValue(); boolean isBaby = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize()); dirtyMetadata.put(EntityDataTypes.SCALE, isBaby ? getBabySize() : getAdultSize());
setFlag(EntityFlag.BABY, isBaby); setFlag(EntityFlag.BABY, isBaby);
setBoundingBoxHeight(definition.height() * (isBaby ? getBabySize() : getAdultSize())); setBoundingBoxHeight(definition.height() * (isBaby ? getBabySize() : getAdultSize()));

View file

@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -29,10 +29,10 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; 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.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import lombok.Getter; import lombok.Getter;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
@ -171,27 +171,27 @@ public class ArmorStandEntity extends LivingEntity {
} }
public void setHeadRotation(EntityMetadata<Vector3f, ?> entityMetadata) { public void setHeadRotation(EntityMetadata<Vector3f, ?> entityMetadata) {
onRotationUpdate(EntityData.MARK_VARIANT, EntityFlag.INTERESTED, EntityFlag.CHARGED, EntityFlag.POWERED, entityMetadata.getValue()); onRotationUpdate(EntityDataTypes.MARK_VARIANT, EntityFlag.INTERESTED, EntityFlag.CHARGED, EntityFlag.POWERED, entityMetadata.getValue());
} }
public void setBodyRotation(EntityMetadata<Vector3f, ?> entityMetadata) { public void setBodyRotation(EntityMetadata<Vector3f, ?> entityMetadata) {
onRotationUpdate(EntityData.VARIANT, EntityFlag.IN_LOVE, EntityFlag.CELEBRATING, EntityFlag.CELEBRATING_SPECIAL, entityMetadata.getValue()); onRotationUpdate(EntityDataTypes.VARIANT, EntityFlag.IN_LOVE, EntityFlag.CELEBRATING, EntityFlag.CELEBRATING_SPECIAL, entityMetadata.getValue());
} }
public void setLeftArmRotation(EntityMetadata<Vector3f, ?> entityMetadata) { public void setLeftArmRotation(EntityMetadata<Vector3f, ?> entityMetadata) {
onRotationUpdate(EntityData.TRADE_TIER, EntityFlag.CHARGING, EntityFlag.CRITICAL, EntityFlag.DANCING, entityMetadata.getValue()); onRotationUpdate(EntityDataTypes.TRADE_TIER, EntityFlag.CHARGING, EntityFlag.CRITICAL, EntityFlag.DANCING, entityMetadata.getValue());
} }
public void setRightArmRotation(EntityMetadata<Vector3f, ?> entityMetadata) { public void setRightArmRotation(EntityMetadata<Vector3f, ?> entityMetadata) {
onRotationUpdate(EntityData.MAX_TRADE_TIER, EntityFlag.ELDER, EntityFlag.EMOTING, EntityFlag.IDLING, entityMetadata.getValue()); onRotationUpdate(EntityDataTypes.MAX_TRADE_TIER, EntityFlag.ELDER, EntityFlag.EMOTING, EntityFlag.IDLING, entityMetadata.getValue());
} }
public void setLeftLegRotation(EntityMetadata<Vector3f, ?> entityMetadata) { public void setLeftLegRotation(EntityMetadata<Vector3f, ?> entityMetadata) {
onRotationUpdate(EntityData.SKIN_ID, EntityFlag.IS_ILLAGER_CAPTAIN, EntityFlag.IS_IN_UI, EntityFlag.LINGERING, entityMetadata.getValue()); onRotationUpdate(EntityDataTypes.SKIN_ID, EntityFlag.IS_ILLAGER_CAPTAIN, EntityFlag.IS_IN_UI, EntityFlag.LINGERING, entityMetadata.getValue());
} }
public void setRightLegRotation(EntityMetadata<Vector3f, ?> entityMetadata) { public void setRightLegRotation(EntityMetadata<Vector3f, ?> entityMetadata) {
onRotationUpdate(EntityData.HURT_DIRECTION, EntityFlag.IS_PREGNANT, EntityFlag.SHEARED, EntityFlag.STALKING, entityMetadata.getValue()); onRotationUpdate(EntityDataTypes.HURT_DIRECTION, EntityFlag.IS_PREGNANT, EntityFlag.SHEARED, EntityFlag.STALKING, entityMetadata.getValue());
} }
/** /**
@ -308,7 +308,7 @@ public class ArmorStandEntity extends LivingEntity {
if (!isInvisible) { if (!isInvisible) {
// The armor stand isn't invisible. We good. // The armor stand isn't invisible. We good.
setFlag(EntityFlag.INVISIBLE, false); setFlag(EntityFlag.INVISIBLE, false);
dirtyMetadata.put(EntityData.SCALE, getScale()); dirtyMetadata.put(EntityDataTypes.SCALE, getScale());
updateOffsetRequirement(false); updateOffsetRequirement(false);
if (secondEntity != null) { if (secondEntity != null) {
@ -324,7 +324,7 @@ public class ArmorStandEntity extends LivingEntity {
if (!isNametagEmpty && (!helmet.equals(ItemData.AIR) || !chestplate.equals(ItemData.AIR) || !leggings.equals(ItemData.AIR) 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))) { || !boots.equals(ItemData.AIR) || !hand.equals(ItemData.AIR) || !offHand.equals(ItemData.AIR))) {
// Reset scale of the proper armor stand // Reset scale of the proper armor stand
this.dirtyMetadata.put(EntityData.SCALE, getScale()); this.dirtyMetadata.put(EntityDataTypes.SCALE, getScale());
// Set the proper armor stand to invisible to show armor // Set the proper armor stand to invisible to show armor
setFlag(EntityFlag.INVISIBLE, true); setFlag(EntityFlag.INVISIBLE, true);
// Update the position of the armor stand // Update the position of the armor stand
@ -341,23 +341,23 @@ public class ArmorStandEntity extends LivingEntity {
secondEntity.isSmall = isSmall; secondEntity.isSmall = isSmall;
secondEntity.isMarker = isMarker; secondEntity.isMarker = isMarker;
secondEntity.positionRequiresOffset = true; // Offset should always be applied secondEntity.positionRequiresOffset = true; // Offset should always be applied
secondEntity.getDirtyMetadata().put(EntityData.NAMETAG, nametag); secondEntity.getDirtyMetadata().put(EntityDataTypes.NAMETAG, nametag);
secondEntity.getDirtyMetadata().put(EntityData.NAMETAG_ALWAYS_SHOW, isNameTagVisible ? (byte) 1 : (byte) 0); secondEntity.getDirtyMetadata().put(EntityDataTypes.NAMETAG_ALWAYS_SHOW, isNameTagVisible ? (byte) 1 : (byte) 0);
secondEntity.flags.merge(this.flags); secondEntity.flags.merge(this.flags);
// Guarantee this copy is NOT invisible // Guarantee this copy is NOT invisible
secondEntity.setFlag(EntityFlag.INVISIBLE, false); secondEntity.setFlag(EntityFlag.INVISIBLE, false);
// Scale to 0 to show nametag // Scale to 0 to show nametag
secondEntity.getDirtyMetadata().put(EntityData.SCALE, 0.0f); secondEntity.getDirtyMetadata().put(EntityDataTypes.SCALE, 0.0f);
// No bounding box as we don't want to interact with this entity // No bounding box as we don't want to interact with this entity
secondEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_WIDTH, 0.0f); secondEntity.getDirtyMetadata().put(EntityDataTypes.BOUNDING_BOX_WIDTH, 0.0f);
secondEntity.getDirtyMetadata().put(EntityData.BOUNDING_BOX_HEIGHT, 0.0f); secondEntity.getDirtyMetadata().put(EntityDataTypes.BOUNDING_BOX_HEIGHT, 0.0f);
if (!secondEntity.valid) { // Spawn the entity once if (!secondEntity.valid) { // Spawn the entity once
secondEntity.spawnEntity(); secondEntity.spawnEntity();
} }
} else if (isNametagEmpty) { } else if (isNametagEmpty) {
// We can just make an invisible entity // We can just make an invisible entity
// Reset scale of the proper armor stand // Reset scale of the proper armor stand
dirtyMetadata.put(EntityData.SCALE, getScale()); dirtyMetadata.put(EntityDataTypes.SCALE, getScale());
// Set the proper armor stand to invisible to show armor // Set the proper armor stand to invisible to show armor
setFlag(EntityFlag.INVISIBLE, true); setFlag(EntityFlag.INVISIBLE, true);
// Update offset // Update offset
@ -371,7 +371,7 @@ public class ArmorStandEntity extends LivingEntity {
// Nametag is not empty and there is no armor // Nametag is not empty and there is no armor
// We don't need to make a new entity // We don't need to make a new entity
setFlag(EntityFlag.INVISIBLE, false); setFlag(EntityFlag.INVISIBLE, false);
dirtyMetadata.put(EntityData.SCALE, 0.0f); dirtyMetadata.put(EntityDataTypes.SCALE, 0.0f);
// As the above is applied, we need an offset // As the above is applied, we need an offset
updateOffsetRequirement(!isMarker); updateOffsetRequirement(!isMarker);

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,9 +26,9 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -44,7 +44,7 @@ public class IronGolemEntity extends GolemEntity {
// Indicate that we should show cracks through a resource pack // Indicate that we should show cracks through a resource pack
setFlag(EntityFlag.BRIBED, true); setFlag(EntityFlag.BRIBED, true);
// Required, or else the overlay is black // Required, or else the overlay is black
dirtyMetadata.put(EntityData.COLOR_2, (byte) 0); dirtyMetadata.put(EntityDataTypes.COLOR_2, (byte) 0);
// Default max health. Ensures correct cracked texture is used // Default max health. Ensures correct cracked texture is used
// Bug reproducible in 1.19.0 JE vanilla/fabric when spawning a new iron golem // Bug reproducible in 1.19.0 JE vanilla/fabric when spawning a new iron golem
maxHealth = 100f; maxHealth = 100f;

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -53,7 +53,7 @@ public class MagmaCubeEntity extends SlimeEntity {
public void updateJump(boolean newOnGround) { public void updateJump(boolean newOnGround) {
if (newOnGround != onGround) { if (newOnGround != onGround) {
// Add the jumping effect to the magma cube // Add the jumping effect to the magma cube
dirtyMetadata.put(EntityData.CLIENT_EVENT, (byte) (newOnGround ? 1 : 2)); dirtyMetadata.put(EntityDataTypes.CLIENT_EVENT, (byte) (newOnGround ? 1 : 2));
updateBedrockMetadata(); updateBedrockMetadata();
} }
} }

View file

@ -27,9 +27,9 @@ package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import lombok.Getter; import lombok.Getter;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.entity.type.LivingEntity;
@ -67,7 +67,7 @@ public class MobEntity extends LivingEntity {
public void setLeashHolderBedrockId(long bedrockId) { public void setLeashHolderBedrockId(long bedrockId) {
this.leashHolderBedrockId = bedrockId; this.leashHolderBedrockId = bedrockId;
dirtyMetadata.put(EntityData.LEASH_HOLDER_EID, bedrockId); dirtyMetadata.put(EntityDataTypes.LEASH_HOLDER_EID, bedrockId);
} }
@Override @Override

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -40,7 +40,7 @@ public class SlimeEntity extends MobEntity {
} }
public void setScale(IntEntityMetadata entityMetadata) { public void setScale(IntEntityMetadata entityMetadata) {
dirtyMetadata.put(EntityData.SCALE, 0.10f + entityMetadata.getPrimitiveValue()); dirtyMetadata.put(EntityDataTypes.SCALE, 0.10f + entityMetadata.getPrimitiveValue());
} }
@Override @Override

View file

@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,9 +25,9 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.type.Tickable;
import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.level.block.BlockStateValues;

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living; package org.geysermc.geyser.entity.type.living;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,9 +26,9 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.living.AgeableEntity; import org.geysermc.geyser.entity.type.living.AgeableEntity;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;

View file

@ -28,9 +28,9 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
@ -52,7 +52,7 @@ public class AxolotlEntity extends AnimalEntity {
case 1 -> variant = 3; // Java - "Wild" (brown) case 1 -> variant = 3; // Java - "Wild" (brown)
case 3 -> variant = 1; // Java - cyan case 3 -> variant = 1; // Java - cyan
} }
dirtyMetadata.put(EntityData.VARIANT, variant); dirtyMetadata.put(EntityDataTypes.VARIANT, variant);
} }
public void setPlayingDead(BooleanEntityMetadata entityMetadata) { public void setPlayingDead(BooleanEntityMetadata entityMetadata) {

View file

@ -27,11 +27,11 @@ 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.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -55,7 +55,7 @@ public class BeeEntity extends AnimalEntity {
session.sendUpstreamPacket(packet); session.sendUpstreamPacket(packet);
} }
// If the bee has stung // If the bee has stung
dirtyMetadata.put(EntityData.MARK_VARIANT, (xd & 0x04) == 0x04 ? 1 : 0); dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, (xd & 0x04) == 0x04 ? 1 : 0);
// If the bee has nectar or not // If the bee has nectar or not
setFlag(EntityFlag.POWERED, (xd & 0x08) == 0x08); setFlag(EntityFlag.POWERED, (xd & 0x08) == 0x08);
} }

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,9 +26,9 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -27,9 +27,9 @@ 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.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -43,7 +43,7 @@ public class FoxEntity extends AnimalEntity {
} }
public void setFoxVariant(IntEntityMetadata entityMetadata) { public void setFoxVariant(IntEntityMetadata entityMetadata) {
dirtyMetadata.put(EntityData.VARIANT, entityMetadata.getPrimitiveValue()); dirtyMetadata.put(EntityDataTypes.VARIANT, entityMetadata.getPrimitiveValue());
} }
public void setFoxFlags(ByteEntityMetadata entityMetadata) { public void setFoxFlags(ByteEntityMetadata entityMetadata) {

View file

@ -28,9 +28,9 @@ 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.Pose;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
@ -55,7 +55,7 @@ public class FrogEntity extends AnimalEntity {
public void setFrogVariant(IntEntityMetadata entityMetadata) { public void setFrogVariant(IntEntityMetadata entityMetadata) {
int variant = entityMetadata.getPrimitiveValue(); int variant = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.VARIANT, switch (variant) { dirtyMetadata.put(EntityDataTypes.VARIANT, switch (variant) {
case 1 -> 2; // White case 1 -> 2; // White
case 2 -> 1; // Green case 2 -> 1; // Green
default -> variant; default -> variant;
@ -67,10 +67,10 @@ public class FrogEntity extends AnimalEntity {
if (entityId.isPresent()) { if (entityId.isPresent()) {
Entity entity = session.getEntityCache().getEntityByJavaId(entityId.getAsInt()); Entity entity = session.getEntityCache().getEntityByJavaId(entityId.getAsInt());
if (entity != null) { if (entity != null) {
dirtyMetadata.put(EntityData.TARGET_EID, entity.getGeyserId()); dirtyMetadata.put(EntityDataTypes.TARGET_EID, entity.getGeyserId());
} }
} else { } else {
dirtyMetadata.put(EntityData.TARGET_EID, 0L); dirtyMetadata.put(EntityDataTypes.TARGET_EID, 0L);
} }
} }

View file

@ -28,10 +28,10 @@ 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.Pose;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -89,6 +89,6 @@ public class GoatEntity extends AnimalEntity {
} }
private void setHornCount() { private void setHornCount() {
dirtyMetadata.put(EntityData.GOAT_HORN_COUNT, (hasLeftHorn ? 1 : 0) + (hasRightHorn ? 1 : 0)); dirtyMetadata.put(EntityDataTypes.GOAT_HORN_COUNT, (hasLeftHorn ? 1 : 0) + (hasRightHorn ? 1 : 0));
} }
} }

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.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.BooleanEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.inventory.item.StoredItemMappings; import org.geysermc.geyser.inventory.item.StoredItemMappings;
@ -48,7 +48,7 @@ public class MooshroomEntity extends AnimalEntity {
public void setVariant(ObjectEntityMetadata<String> entityMetadata) { public void setVariant(ObjectEntityMetadata<String> entityMetadata) {
isBrown = entityMetadata.getValue().equals("brown"); isBrown = entityMetadata.getValue().equals("brown");
dirtyMetadata.put(EntityData.VARIANT, isBrown ? 1 : 0); dirtyMetadata.put(EntityDataTypes.VARIANT, isBrown ? 1 : 0);
} }
@Nonnull @Nonnull

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;

View file

@ -28,11 +28,11 @@ 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.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
@ -55,13 +55,13 @@ public class PandaEntity extends AnimalEntity {
public void setEatingCounter(IntEntityMetadata entityMetadata) { public void setEatingCounter(IntEntityMetadata entityMetadata) {
int count = entityMetadata.getPrimitiveValue(); int count = entityMetadata.getPrimitiveValue();
setFlag(EntityFlag.EATING, count > 0); setFlag(EntityFlag.EATING, count > 0);
dirtyMetadata.put(EntityData.EATING_COUNTER, count); dirtyMetadata.put(EntityDataTypes.EATING_COUNTER, count);
if (count != 0) { if (count != 0) {
// Particles and sound // Particles and sound
EntityEventPacket packet = new EntityEventPacket(); EntityEventPacket packet = new EntityEventPacket();
packet.setRuntimeEntityId(geyserId); packet.setRuntimeEntityId(geyserId);
packet.setType(EntityEventType.EATING_ITEM); packet.setType(EntityEventType.EATING_ITEM);
packet.setData(session.getItemMappings().getStoredItems().bamboo().getBedrockId() << 16); packet.setData(session.getItemMappings().getStoredItems().bamboo().getBedrockDefinition() << 16);
session.sendUpstreamPacket(packet); session.sendUpstreamPacket(packet);
} }
} }
@ -82,8 +82,8 @@ public class PandaEntity extends AnimalEntity {
setFlag(EntityFlag.ROLLING, (xd & 0x04) == 0x04); setFlag(EntityFlag.ROLLING, (xd & 0x04) == 0x04);
setFlag(EntityFlag.SITTING, (xd & 0x08) == 0x08); setFlag(EntityFlag.SITTING, (xd & 0x08) == 0x08);
// Required to put these both for sitting to actually show // Required to put these both for sitting to actually show
dirtyMetadata.put(EntityData.SITTING_AMOUNT, (xd & 0x08) == 0x08 ? 1f : 0f); dirtyMetadata.put(EntityDataTypes.SITTING_AMOUNT, (xd & 0x08) == 0x08 ? 1f : 0f);
dirtyMetadata.put(EntityData.SITTING_AMOUNT_PREVIOUS, (xd & 0x08) == 0x08 ? 1f : 0f); dirtyMetadata.put(EntityDataTypes.SITTING_AMOUNT_PREVIOUS, (xd & 0x08) == 0x08 ? 1f : 0f);
setFlag(EntityFlag.LAYING_DOWN, (xd & 0x10) == 0x10); setFlag(EntityFlag.LAYING_DOWN, (xd & 0x10) == 0x10);
} }
@ -133,14 +133,14 @@ public class PandaEntity extends AnimalEntity {
if (mainGene.isRecessive) { if (mainGene.isRecessive) {
if (mainGene == hiddenGene) { if (mainGene == hiddenGene) {
// Main and hidden genes match; this is what the panda looks like. // Main and hidden genes match; this is what the panda looks like.
dirtyMetadata.put(EntityData.VARIANT, mainGene.ordinal()); dirtyMetadata.put(EntityDataTypes.VARIANT, mainGene.ordinal());
} else { } else {
// Genes have no effect on appearance // Genes have no effect on appearance
dirtyMetadata.put(EntityData.VARIANT, Gene.NORMAL.ordinal()); dirtyMetadata.put(EntityDataTypes.VARIANT, Gene.NORMAL.ordinal());
} }
} else { } else {
// No need to worry about hidden gene // No need to worry about hidden gene
dirtyMetadata.put(EntityData.VARIANT, mainGene.ordinal()); dirtyMetadata.put(EntityDataTypes.VARIANT, mainGene.ordinal());
} }
} }

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;

View file

@ -25,7 +25,7 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.animal; package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.living.AbstractFishEntity; import org.geysermc.geyser.entity.type.living.AbstractFishEntity;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -42,7 +42,7 @@ public class PufferFishEntity extends AbstractFishEntity {
public void setPufferfishSize(IntEntityMetadata entityMetadata) { public void setPufferfishSize(IntEntityMetadata entityMetadata) {
int puffsize = entityMetadata.getPrimitiveValue(); int puffsize = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.PUFFERFISH_SIZE, (byte) puffsize); dirtyMetadata.put(EntityDataTypes.PUFFERFISH_SIZE, (byte) puffsize);
dirtyMetadata.put(EntityData.VARIANT, puffsize); dirtyMetadata.put(EntityDataTypes.VARIANT, puffsize);
} }
} }

View file

@ -27,9 +27,9 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -58,7 +58,7 @@ public class RabbitEntity extends AnimalEntity {
// Allow the resource pack to adjust to the killer bunny // Allow the resource pack to adjust to the killer bunny
setFlag(EntityFlag.BRIBED, isKillerBunny); setFlag(EntityFlag.BRIBED, isKillerBunny);
dirtyMetadata.put(EntityData.VARIANT, variant); dirtyMetadata.put(EntityDataTypes.VARIANT, variant);
} }
@Override @Override

View file

@ -27,9 +27,9 @@ 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.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -51,7 +51,7 @@ public class SheepEntity extends AnimalEntity {
byte xd = entityMetadata.getPrimitiveValue(); byte xd = entityMetadata.getPrimitiveValue();
setFlag(EntityFlag.SHEARED, (xd & 0x10) == 0x10); setFlag(EntityFlag.SHEARED, (xd & 0x10) == 0x10);
color = xd & 15; color = xd & 15;
dirtyMetadata.put(EntityData.COLOR, (byte) color); dirtyMetadata.put(EntityDataTypes.COLOR, (byte) color);
} }
@Nonnull @Nonnull

View file

@ -27,8 +27,8 @@ 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.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;

View file

@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.living.AbstractFishEntity; import org.geysermc.geyser.entity.type.living.AbstractFishEntity;
@ -55,10 +55,10 @@ public class TropicalFishEntity extends AbstractFishEntity {
public void setFishVariant(IntEntityMetadata entityMetadata) { public void setFishVariant(IntEntityMetadata entityMetadata) {
int varNumber = entityMetadata.getPrimitiveValue(); int varNumber = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.VARIANT, getShape(varNumber)); // Shape 0-1 dirtyMetadata.put(EntityDataTypes.VARIANT, getShape(varNumber)); // Shape 0-1
dirtyMetadata.put(EntityData.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5 dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, getPattern(varNumber)); // Pattern 0-5
dirtyMetadata.put(EntityData.COLOR, getBaseColor(varNumber)); // Base color 0-15 dirtyMetadata.put(EntityDataTypes.COLOR, getBaseColor(varNumber)); // Base color 0-15
dirtyMetadata.put(EntityData.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15 dirtyMetadata.put(EntityDataTypes.COLOR_2, getPatternColor(varNumber)); // Pattern color 0-15
} }
public static int getShape(int variant) { public static int getShape(int variant) {

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.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.BooleanEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -28,13 +28,13 @@ package org.geysermc.geyser.entity.type.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity;
@ -60,7 +60,7 @@ public class AbstractHorseEntity extends AnimalEntity {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 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. // Specifies the size of the entity's inventory. Required to place slots in the entity.
dirtyMetadata.put(EntityData.CONTAINER_BASE_SIZE, getContainerBaseSize()); dirtyMetadata.put(EntityDataTypes.CONTAINER_SIZE, getContainerBaseSize());
setFlag(EntityFlag.WASD_CONTROLLED, true); setFlag(EntityFlag.WASD_CONTROLLED, true);
} }
@ -102,8 +102,8 @@ public class AbstractHorseEntity extends AnimalEntity {
// Only set eating when we don't have mouth open so a player interaction doesn't trigger the eating animation // 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; horseFlags = (xd & 0x10) == 0x10 && (xd & 0x40) != 0x40 ? horseFlags | 0x20 : horseFlags;
// Set the flags into the display item // Set the flags into the horse flags
dirtyMetadata.put(EntityData.DISPLAY_ITEM, horseFlags); dirtyMetadata.put(EntityDataTypes.HORSE_FLAGS, horseFlags);
// Send the eating particles // Send the eating particles
// We use the wheat metadata as static particles since Java // We use the wheat metadata as static particles since Java
@ -112,12 +112,12 @@ public class AbstractHorseEntity extends AnimalEntity {
EntityEventPacket entityEventPacket = new EntityEventPacket(); EntityEventPacket entityEventPacket = new EntityEventPacket();
entityEventPacket.setRuntimeEntityId(geyserId); entityEventPacket.setRuntimeEntityId(geyserId);
entityEventPacket.setType(EntityEventType.EATING_ITEM); entityEventPacket.setType(EntityEventType.EATING_ITEM);
entityEventPacket.setData(session.getItemMappings().getStoredItems().wheat().getBedrockId() << 16); entityEventPacket.setData(session.getItemMappings().getStoredItems().wheat().getBedrockDefinition().getRuntimeId() << 16);
session.sendUpstreamPacket(entityEventPacket); session.sendUpstreamPacket(entityEventPacket);
} }
// Set container type if tamed // Set container type if tamed
dirtyMetadata.put(EntityData.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0); dirtyMetadata.put(EntityDataTypes.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0);
// Shows the jump meter // Shows the jump meter
setFlag(EntityFlag.CAN_POWER_JUMP, saddled); setFlag(EntityFlag.CAN_POWER_JUMP, saddled);

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.entity.type.living.animal.horse; package org.geysermc.geyser.entity.type.living.animal.horse;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.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.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -41,7 +41,7 @@ public class HorseEntity extends AbstractHorseEntity {
public void setHorseVariant(IntEntityMetadata entityMetadata) { public void setHorseVariant(IntEntityMetadata entityMetadata) {
int value = entityMetadata.getPrimitiveValue(); int value = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.VARIANT, value & 255); dirtyMetadata.put(EntityDataTypes.VARIANT, value & 255);
dirtyMetadata.put(EntityData.MARK_VARIANT, (value >> 8) % 5); dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, (value >> 8) % 5);
} }
} }

View file

@ -26,10 +26,10 @@
package org.geysermc.geyser.entity.type.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.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -41,7 +41,7 @@ public class LlamaEntity extends ChestedHorseEntity {
public LlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { public LlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, 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 dirtyMetadata.put(EntityDataTypes.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength
} }
/** /**

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type.living.animal.horse; package org.geysermc.geyser.entity.type.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -25,8 +25,8 @@
package org.geysermc.geyser.entity.type.living.animal.horse; package org.geysermc.geyser.entity.type.living.animal.horse;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -41,6 +41,6 @@ public class TraderLlamaEntity extends LlamaEntity {
@Override @Override
protected void initializeMetadata() { protected void initializeMetadata() {
super.initializeMetadata(); super.initializeMetadata();
this.dirtyMetadata.put(EntityData.MARK_VARIANT, 1); this.dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, 1);
} }
} }

View file

@ -26,7 +26,7 @@
package org.geysermc.geyser.entity.type.living.animal.horse; package org.geysermc.geyser.entity.type.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -29,9 +29,9 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; 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.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
@ -70,7 +70,7 @@ public class CatEntity extends TameableEntity {
super.setTameableFlags(entityMetadata); super.setTameableFlags(entityMetadata);
// Update collar color if tamed // Update collar color if tamed
if (getFlag(EntityFlag.TAMED)) { if (getFlag(EntityFlag.TAMED)) {
dirtyMetadata.put(EntityData.COLOR, collarColor); dirtyMetadata.put(EntityDataTypes.COLOR, collarColor);
} }
} }
@ -84,7 +84,7 @@ public class CatEntity extends TameableEntity {
case 10 -> 9; case 10 -> 9;
default -> metadataValue; default -> metadataValue;
}; };
dirtyMetadata.put(EntityData.VARIANT, variantColor); dirtyMetadata.put(EntityDataTypes.VARIANT, variantColor);
} }
public void setResting(BooleanEntityMetadata entityMetadata) { public void setResting(BooleanEntityMetadata entityMetadata) {
@ -95,7 +95,7 @@ public class CatEntity extends TameableEntity {
collarColor = (byte) entityMetadata.getPrimitiveValue(); collarColor = (byte) entityMetadata.getPrimitiveValue();
// Needed or else wild cats are a red color // Needed or else wild cats are a red color
if (getFlag(EntityFlag.TAMED)) { if (getFlag(EntityFlag.TAMED)) {
dirtyMetadata.put(EntityData.COLOR, collarColor); dirtyMetadata.put(EntityDataTypes.COLOR, collarColor);
} }
} }

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.animal.tameable; package org.geysermc.geyser.entity.type.living.animal.tameable;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;

View file

@ -27,9 +27,9 @@ 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.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import lombok.Getter; import lombok.Getter;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.Entity;
@ -80,7 +80,7 @@ public class TameableEntity extends AnimalEntity {
// Reset // Reset
ownerBedrockId = 0L; ownerBedrockId = 0L;
} }
dirtyMetadata.put(EntityData.OWNER_EID, ownerBedrockId); dirtyMetadata.put(EntityDataTypes.OWNER_EID, ownerBedrockId);
} }
@Override @Override

View file

@ -29,9 +29,9 @@ 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.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
@ -66,7 +66,7 @@ public class WolfEntity extends TameableEntity {
byte xd = entityMetadata.getPrimitiveValue(); byte xd = entityMetadata.getPrimitiveValue();
boolean angry = (xd & 0x02) == 0x02; boolean angry = (xd & 0x02) == 0x02;
if (angry) { if (angry) {
dirtyMetadata.put(EntityData.COLOR, (byte) 0); dirtyMetadata.put(EntityDataTypes.COLOR, (byte) 0);
} }
} }
@ -76,11 +76,11 @@ public class WolfEntity extends TameableEntity {
return; return;
} }
dirtyMetadata.put(EntityData.COLOR, collarColor); dirtyMetadata.put(EntityDataTypes.COLOR, collarColor);
if (ownerBedrockId == 0) { if (ownerBedrockId == 0) {
// If a color is set and there is no owner entity ID, set one. // 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 // 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()); dirtyMetadata.put(EntityDataTypes.OWNER_EID, session.getPlayerEntity().getGeyserId());
} }
} }
@ -88,7 +88,7 @@ public class WolfEntity extends TameableEntity {
public void setWolfAngerTime(IntEntityMetadata entityMetadata) { public void setWolfAngerTime(IntEntityMetadata entityMetadata) {
int time = entityMetadata.getPrimitiveValue(); int time = entityMetadata.getPrimitiveValue();
setFlag(EntityFlag.ANGRY, time != 0); setFlag(EntityFlag.ANGRY, time != 0);
dirtyMetadata.put(EntityData.COLOR, time != 0 ? (byte) 0 : collarColor); dirtyMetadata.put(EntityDataTypes.COLOR, time != 0 ? (byte) 0 : collarColor);
} }
@Override @Override

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.merchant; package org.geysermc.geyser.entity.type.living.merchant;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.entity.type.living.AgeableEntity; import org.geysermc.geyser.entity.type.living.AgeableEntity;

View file

@ -27,11 +27,11 @@ 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.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData; import com.github.steveice10.mc.protocol.data.game.entity.metadata.VillagerData;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import org.cloudburstmc.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import lombok.Getter; import lombok.Getter;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.BlockRegistries;
@ -93,12 +93,12 @@ public class VillagerEntity extends AbstractMerchantEntity {
// Profession // Profession
int profession = getBedrockProfession(villagerData.getProfession()); int profession = getBedrockProfession(villagerData.getProfession());
canTradeWith = profession != 14 && profession != 0; // Not a notwit and not professionless canTradeWith = profession != 14 && profession != 0; // Not a notwit and not professionless
dirtyMetadata.put(EntityData.VARIANT, profession); dirtyMetadata.put(EntityDataTypes.VARIANT, profession);
//metadata.put(EntityData.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason? //metadata.put(EntityDataTypes.SKIN_ID, villagerData.getType()); Looks like this is modified but for any reason?
// Region // Region
dirtyMetadata.put(EntityData.MARK_VARIANT, getBedrockRegion(villagerData.getType())); dirtyMetadata.put(EntityDataTypes.MARK_VARIANT, getBedrockRegion(villagerData.getType()));
// Trade tier - different indexing in Bedrock // Trade tier - different indexing in Bedrock
dirtyMetadata.put(EntityData.TRADE_TIER, villagerData.getLevel() - 1); dirtyMetadata.put(EntityDataTypes.TRADE_TIER, villagerData.getLevel() - 1);
} }
@Override @Override

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.monster; package org.geysermc.geyser.entity.type.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
@ -44,6 +44,6 @@ public class AbstractSkeletonEntity extends MonsterEntity {
super.setMobFlags(entityMetadata); super.setMobFlags(entityMetadata);
byte xd = entityMetadata.getPrimitiveValue(); byte xd = entityMetadata.getPrimitiveValue();
// A bit of a loophole so the hands get raised - set the target ID to its own ID // 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); dirtyMetadata.put(EntityDataTypes.TARGET_EID, ((xd & 4) == 4) ? geyserId : 0);
} }
} }

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.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.BooleanEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

View file

@ -26,8 +26,8 @@
package org.geysermc.geyser.entity.type.living.monster; package org.geysermc.geyser.entity.type.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
import com.nukkitx.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.geyser.entity.EntityDefinition; import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;

Some files were not shown because too many files have changed in this diff Show more