3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

Bedrock 1.16 updating part 1

Dieser Commit ist enthalten in:
DoctorMacc 2020-06-22 20:11:09 -04:00
Ursprung 56f9330a2d
Commit ea1a9e5427
114 geänderte Dateien mit 660 neuen und 594 gelöschten Zeilen

Datei anzeigen

@ -32,8 +32,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.nukkitx.protocol</groupId> <groupId>com.nukkitx.protocol</groupId>
<artifactId>bedrock-v390</artifactId> <artifactId>bedrock-v407</artifactId>
<version>2.5.6-SNAPSHOT</version> <version>2.6.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

Datei anzeigen

@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.BedrockServer; import com.nukkitx.protocol.bedrock.BedrockServer;
import com.nukkitx.protocol.bedrock.v390.Bedrock_v390; import com.nukkitx.protocol.bedrock.v407.Bedrock_v407;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.common.AuthType; import org.geysermc.common.AuthType;
@ -70,10 +70,10 @@ public class GeyserConnector {
public static final ObjectMapper JSON_MAPPER = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES); public static final ObjectMapper JSON_MAPPER = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v390.V390_CODEC; public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v407.V392_CODEC;
public static final String NAME = "Geyser"; public static final String NAME = "Geyser";
public static final String VERSION = "DEV"; // A fallback for running in IDEs public static final String VERSION = "1.0-SNAPSHOT (git-feature/1.16-56f9330)"; // A fallback for running in IDEs
private final Map<InetSocketAddress, GeyserSession> players = new HashMap<>(); private final Map<InetSocketAddress, GeyserSession> players = new HashMap<>();

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.world.particle.Particle; import com.github.steveice10.mc.protocol.data.game.world.particle.Particle;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.effect.EffectRegistry; import org.geysermc.connector.network.translators.effect.EffectRegistry;
@ -42,19 +42,19 @@ public class AreaEffectCloudEntity extends Entity {
metadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, 600); metadata.put(EntityData.AREA_EFFECT_CLOUD_DURATION, 600);
// This disabled client side shrink of the cloud // This disabled client side shrink of the cloud
metadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS_PER_TICK, 0.0f); metadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, 0.0f);
} }
@Override @Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 7) { if (entityMetadata.getId() == 7) {
metadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, (float) entityMetadata.getValue()); metadata.put(EntityData.AREA_EFFECT_CLOUD_RADIUS, entityMetadata.getValue());
metadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * (float) entityMetadata.getValue()); metadata.put(EntityData.BOUNDING_BOX_WIDTH, 2.0f * (float) entityMetadata.getValue());
} else if (entityMetadata.getId() == 10) { } else if (entityMetadata.getId() == 10) {
Particle particle = (Particle) entityMetadata.getValue(); Particle particle = (Particle) entityMetadata.getValue();
metadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, EffectRegistry.getParticleString(particle.getType())); metadata.put(EntityData.AREA_EFFECT_CLOUD_PARTICLE_ID, EffectRegistry.getParticleString(particle.getType()));
} else if (entityMetadata.getId() == 8) { } else if (entityMetadata.getId() == 8) {
metadata.put(EntityData.POTION_COLOR, entityMetadata.getValue()); metadata.put(EntityData.POTION_AUX_VALUE, entityMetadata.getValue());
} }
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
} }

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -92,7 +92,7 @@ public class BoatEntity extends Entity {
} else if (entityMetadata.getId() == 11) { } else if (entityMetadata.getId() == 11) {
isPaddlingLeft = (boolean) entityMetadata.getValue(); isPaddlingLeft = (boolean) entityMetadata.getValue();
if (!isPaddlingLeft) { if (!isPaddlingLeft) {
metadata.put(EntityData.PADDLE_TIME_LEFT, 0f); metadata.put(EntityData.ROW_TIME_LEFT, 0f);
} }
else { else {
// Java sends simply "true" and "false" (is_paddling_left), Bedrock keeps sending packets as you're rowing // Java sends simply "true" and "false" (is_paddling_left), Bedrock keeps sending packets as you're rowing
@ -106,7 +106,7 @@ public class BoatEntity extends Entity {
else if (entityMetadata.getId() == 12) { else if (entityMetadata.getId() == 12) {
isPaddlingRight = (boolean) entityMetadata.getValue(); isPaddlingRight = (boolean) entityMetadata.getValue();
if (!isPaddlingRight) { if (!isPaddlingRight) {
metadata.put(EntityData.PADDLE_TIME_RIGHT, 0f); metadata.put(EntityData.ROW_TIME_RIGHT, 0f);
} else { } else {
paddleTimeRight = 0f; paddleTimeRight = 0f;
session.getConnector().getGeneralThreadPool().execute(() -> session.getConnector().getGeneralThreadPool().execute(() ->
@ -124,7 +124,7 @@ public class BoatEntity extends Entity {
public void updateLeftPaddle(GeyserSession session, EntityMetadata entityMetadata) { public void updateLeftPaddle(GeyserSession session, EntityMetadata entityMetadata) {
if (isPaddlingLeft) { if (isPaddlingLeft) {
paddleTimeLeft += ROWING_SPEED; paddleTimeLeft += ROWING_SPEED;
metadata.put(EntityData.PADDLE_TIME_LEFT, paddleTimeLeft); metadata.put(EntityData.ROW_TIME_LEFT, paddleTimeLeft);
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
session.getConnector().getGeneralThreadPool().schedule(() -> session.getConnector().getGeneralThreadPool().schedule(() ->
updateLeftPaddle(session, entityMetadata), updateLeftPaddle(session, entityMetadata),
@ -136,7 +136,7 @@ public class BoatEntity extends Entity {
public void updateRightPaddle(GeyserSession session, EntityMetadata entityMetadata) { public void updateRightPaddle(GeyserSession session, EntityMetadata entityMetadata) {
if (isPaddlingRight) { if (isPaddlingRight) {
paddleTimeRight += ROWING_SPEED; paddleTimeRight += ROWING_SPEED;
metadata.put(EntityData.PADDLE_TIME_RIGHT, paddleTimeRight); metadata.put(EntityData.ROW_TIME_RIGHT, paddleTimeRight);
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
session.getConnector().getGeneralThreadPool().schedule(() -> session.getConnector().getGeneralThreadPool().schedule(() ->
updateRightPaddle(session, entityMetadata), updateRightPaddle(session, entityMetadata),

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;
@ -45,7 +45,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity {
super(entityId, geyserId, entityType, position, motion, rotation); super(entityId, geyserId, entityType, position, motion, rotation);
updateDefaultBlockMetadata(); updateDefaultBlockMetadata();
metadata.put(EntityData.HAS_DISPLAY, (byte) 1); metadata.put(EntityData.CUSTOM_DISPLAY, (byte) 1);
} }
@Override @Override

Datei anzeigen

@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -38,10 +38,11 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerUseItemPacket;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.AttributeData;
import com.nukkitx.protocol.bedrock.data.EntityDataMap; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap;
import com.nukkitx.protocol.bedrock.data.EntityFlags; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlags;
import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.packet.*;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import lombok.Getter; import lombok.Getter;
@ -106,9 +107,9 @@ public class Entity {
metadata.put(EntityData.SCALE, 1f); metadata.put(EntityData.SCALE, 1f);
metadata.put(EntityData.COLOR, 0); metadata.put(EntityData.COLOR, 0);
metadata.put(EntityData.MAX_AIR, (short) 300); metadata.put(EntityData.MAX_AIR_SUPPLY, (short) 300);
metadata.put(EntityData.AIR, (short) 0); metadata.put(EntityData.AIR_SUPPLY, (short) 0);
metadata.put(EntityData.LEAD_HOLDER_EID, -1L); metadata.put(EntityData.LEASH_HOLDER_EID, -1L);
metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight()); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, entityType.getHeight());
metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth()); metadata.put(EntityData.BOUNDING_BOX_WIDTH, entityType.getWidth());
EntityFlags flags = new EntityFlags(); EntityFlags flags = new EntityFlags();
@ -240,7 +241,7 @@ public class Entity {
public void updateBedrockAttributes(GeyserSession session) { public void updateBedrockAttributes(GeyserSession session) {
if (!valid) return; if (!valid) return;
List<com.nukkitx.protocol.bedrock.data.Attribute> attributes = new ArrayList<>(); List<AttributeData> attributes = new ArrayList<>();
for (Map.Entry<AttributeType, Attribute> entry : this.attributes.entrySet()) { for (Map.Entry<AttributeType, Attribute> entry : this.attributes.entrySet()) {
if (!entry.getValue().getType().isBedrockAttribute()) if (!entry.getValue().getType().isBedrockAttribute())
continue; continue;
@ -291,7 +292,7 @@ public class Entity {
} }
} else if (session.getPlayerEntity().getEntityId() == entityId && !metadata.getFlags().getFlag(EntityFlag.SNEAKING) && metadata.getFlags().getFlag(EntityFlag.BLOCKING)) { } else if (session.getPlayerEntity().getEntityId() == entityId && !metadata.getFlags().getFlag(EntityFlag.SNEAKING) && metadata.getFlags().getFlag(EntityFlag.BLOCKING)) {
metadata.getFlags().setFlag(EntityFlag.BLOCKING, false); metadata.getFlags().setFlag(EntityFlag.BLOCKING, false);
metadata.getFlags().setFlag(EntityFlag.DISABLE_BLOCKING, true); metadata.getFlags().setFlag(EntityFlag.IS_AVOIDING_BLOCK, true); //TODO: CHECK
ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.RELEASE_USE_ITEM, new Position(0, 0, 0), BlockFace.DOWN); ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.RELEASE_USE_ITEM, new Position(0, 0, 0), BlockFace.DOWN);
session.sendDownstreamPacket(releaseItemPacket); session.sendDownstreamPacket(releaseItemPacket);
} }
@ -299,9 +300,9 @@ public class Entity {
break; break;
case 1: // Air/bubbles case 1: // Air/bubbles
if ((int) entityMetadata.getValue() == 300) { if ((int) entityMetadata.getValue() == 300) {
metadata.put(EntityData.AIR, (short) 0); // Otherwise the bubble counter remains in the UI metadata.put(EntityData.AIR_SUPPLY, (short) 0); // Otherwise the bubble counter remains in the UI
} else { } else {
metadata.put(EntityData.AIR, (short) (int) entityMetadata.getValue()); metadata.put(EntityData.AIR_SUPPLY, (short) (int) entityMetadata.getValue());
} }
break; break;
case 2: // custom name case 2: // custom name
@ -317,7 +318,7 @@ public class Entity {
break; break;
case 3: // is custom name visible case 3: // is custom name visible
if (!this.is(PlayerEntity.class)) if (!this.is(PlayerEntity.class))
metadata.put(EntityData.ALWAYS_SHOW_NAMETAG, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); metadata.put(EntityData.NAMETAG_ALWAYS_SHOW, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0));
break; break;
case 4: // silent case 4: // silent
metadata.getFlags().setFlag(EntityFlag.SILENT, (boolean) entityMetadata.getValue()); metadata.getFlags().setFlag(EntityFlag.SILENT, (boolean) entityMetadata.getValue());
@ -329,10 +330,10 @@ public class Entity {
if (entityMetadata.getValue().equals(Pose.SLEEPING)) { if (entityMetadata.getValue().equals(Pose.SLEEPING)) {
metadata.getFlags().setFlag(EntityFlag.SLEEPING, true); metadata.getFlags().setFlag(EntityFlag.SLEEPING, true);
// Has to be a byte or it does not work // Has to be a byte or it does not work
metadata.put(EntityData.CAN_START_SLEEP, (byte) 2); metadata.put(EntityData.PLAYER_FLAGS, (byte) 2); //TODO: CHECK
if (entityId == session.getPlayerEntity().getEntityId()) { if (entityId == session.getPlayerEntity().getEntityId()) {
Vector3i lastInteractionPos = session.getLastInteractionPosition(); Vector3i lastInteractionPos = session.getLastInteractionPosition();
metadata.put(EntityData.BED_RESPAWN_POS, lastInteractionPos); metadata.put(EntityData.BED_POSITION, lastInteractionPos);
if (session.getConnector().getConfig().isCacheChunks()) { if (session.getConnector().getConfig().isCacheChunks()) {
int bed = session.getConnector().getWorldManager().getBlockAt(session, lastInteractionPos.getX(), int bed = session.getConnector().getWorldManager().getBlockAt(session, lastInteractionPos.getX(),
lastInteractionPos.getY(), lastInteractionPos.getZ()); lastInteractionPos.getY(), lastInteractionPos.getZ());
@ -340,7 +341,7 @@ public class Entity {
ChunkUtils.updateBlock(session, bed, lastInteractionPos); ChunkUtils.updateBlock(session, bed, lastInteractionPos);
} }
} else { } else {
metadata.put(EntityData.BED_RESPAWN_POS, Vector3i.from(position.getFloorX(), position.getFloorY() - 2, position.getFloorZ())); metadata.put(EntityData.BED_POSITION, Vector3i.from(position.getFloorX(), position.getFloorY() - 2, position.getFloorZ()));
} }
metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.2f); metadata.put(EntityData.BOUNDING_BOX_WIDTH, 0.2f);
metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.2f); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, 0.2f);
@ -348,7 +349,7 @@ public class Entity {
metadata.getFlags().setFlag(EntityFlag.SLEEPING, false); metadata.getFlags().setFlag(EntityFlag.SLEEPING, false);
metadata.put(EntityData.BOUNDING_BOX_WIDTH, getEntityType().getWidth()); metadata.put(EntityData.BOUNDING_BOX_WIDTH, getEntityType().getWidth());
metadata.put(EntityData.BOUNDING_BOX_HEIGHT, getEntityType().getHeight()); metadata.put(EntityData.BOUNDING_BOX_HEIGHT, getEntityType().getHeight());
metadata.put(EntityData.CAN_START_SLEEP, (byte) 0); metadata.put(EntityData.PLAYER_FLAGS, (byte) 0);
} }
break; break;
case 7: // blocking case 7: // blocking

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity; package org.geysermc.connector.entity;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity; package org.geysermc.connector.entity;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;

Datei anzeigen

@ -32,7 +32,7 @@ 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 com.nukkitx.math.vector.Vector3f;
import com.nukkitx.nbt.CompoundTagBuilder; import com.nukkitx.nbt.CompoundTagBuilder;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityMotionPacket;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData; import com.github.steveice10.mc.protocol.data.game.entity.object.ProjectileData;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;

Datei anzeigen

@ -32,7 +32,7 @@ import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.nbt.CompoundTagBuilder; import com.nukkitx.nbt.CompoundTagBuilder;
import com.nukkitx.nbt.tag.CompoundTag; import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
@ -150,7 +150,7 @@ public class ItemFrameEntity extends Entity {
updateBlockPacket.setBlockPosition(bedrockPosition); updateBlockPacket.setBlockPosition(bedrockPosition);
updateBlockPacket.setRuntimeId(0); updateBlockPacket.setRuntimeId(0);
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY);
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NONE); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NO_GRAPHIC); //TODO: Used to be NONE
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS);
session.sendUpstreamPacket(updateBlockPacket); session.sendUpstreamPacket(updateBlockPacket);
session.getItemFrameCache().remove(position, entityId); session.getItemFrameCache().remove(position, entityId);
@ -178,7 +178,7 @@ public class ItemFrameEntity extends Entity {
updateBlockPacket.setBlockPosition(bedrockPosition); updateBlockPacket.setBlockPosition(bedrockPosition);
updateBlockPacket.setRuntimeId(bedrockRuntimeId); updateBlockPacket.setRuntimeId(bedrockRuntimeId);
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.PRIORITY);
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NONE); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NO_GRAPHIC); //TODO Same
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS);
session.sendUpstreamPacket(updateBlockPacket); session.sendUpstreamPacket(updateBlockPacket);

Datei anzeigen

@ -27,15 +27,13 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket;
import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -58,13 +56,13 @@ public class LivingEntity extends Entity {
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
switch (entityMetadata.getId()) { switch (entityMetadata.getId()) {
case 8: case 8:
metadata.put(EntityData.HEALTH, (float) entityMetadata.getValue()); metadata.put(EntityData.HEALTH, entityMetadata.getValue());
break; break;
case 9: case 9:
metadata.put(EntityData.POTION_COLOR, (int) entityMetadata.getValue()); metadata.put(EntityData.POTION_AUX_VALUE, entityMetadata.getValue()); //TODO: CHECK THIS AND THE BOTTOM ONE
break; break;
case 10: case 10:
metadata.put(EntityData.POTION_AMBIENT, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); metadata.put(EntityData.EFFECT_AMBIENT, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0));
break; break;
} }

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;
@ -69,7 +69,7 @@ public class MinecartEntity extends Entity {
// If the custom block should be enabled // If the custom block should be enabled
if (entityMetadata.getId() == 12) { if (entityMetadata.getId() == 12) {
// Needs a byte based off of Java's boolean // Needs a byte based off of Java's boolean
metadata.put(EntityData.HAS_DISPLAY, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0)); metadata.put(EntityData.CUSTOM_DISPLAY, (byte) ((boolean) entityMetadata.getValue() ? 1 : 0));
} }
} }

Datei anzeigen

@ -52,7 +52,7 @@ public class PaintingEntity extends Entity {
AddPaintingPacket addPaintingPacket = new AddPaintingPacket(); AddPaintingPacket addPaintingPacket = new AddPaintingPacket();
addPaintingPacket.setUniqueEntityId(geyserId); addPaintingPacket.setUniqueEntityId(geyserId);
addPaintingPacket.setRuntimeEntityId(geyserId); addPaintingPacket.setRuntimeEntityId(geyserId);
addPaintingPacket.setName(paintingName.getBedrockName()); addPaintingPacket.setMotive(paintingName.getBedrockName()); //TODO: This is what it's called now?
addPaintingPacket.setPosition(fixOffset(true)); addPaintingPacket.setPosition(fixOffset(true));
addPaintingPacket.setDirection(direction); addPaintingPacket.setDirection(direction);
session.sendUpstreamPacket(addPaintingPacket); session.sendUpstreamPacket(addPaintingPacket);

Datei anzeigen

@ -26,23 +26,24 @@
package org.geysermc.connector.entity; package org.geysermc.connector.entity;
import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.data.GameProfile;
import com.github.steveice10.mc.protocol.data.game.entity.Effect;
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.message.TextMessage; import com.github.steveice10.mc.protocol.data.message.TextMessage;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.*; import com.nukkitx.protocol.bedrock.data.AttributeData;
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
import com.nukkitx.protocol.bedrock.data.command.CommandPermission;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData;
import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.packet.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.session.cache.EntityEffectCache;
import org.geysermc.connector.scoreboard.Team; import org.geysermc.connector.scoreboard.Team;
import org.geysermc.connector.utils.MessageUtils; import org.geysermc.connector.utils.MessageUtils;
import org.geysermc.connector.network.session.cache.EntityEffectCache;
import org.geysermc.connector.utils.SkinUtils; import org.geysermc.connector.utils.SkinUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -99,7 +100,7 @@ public class PlayerEntity extends LivingEntity {
long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId); long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId);
if (linkedEntityId != -1) { if (linkedEntityId != -1) {
addPlayerPacket.getEntityLinks().add(new EntityLink(session.getEntityCache().getEntityByJavaId(linkedEntityId).getGeyserId(), geyserId, EntityLink.Type.RIDER, false)); addPlayerPacket.getEntityLinks().add(new EntityLinkData(session.getEntityCache().getEntityByJavaId(linkedEntityId).getGeyserId(), geyserId, EntityLinkData.Type.RIDER, false));
} }
valid = true; valid = true;
@ -194,7 +195,7 @@ public class PlayerEntity extends LivingEntity {
movePlayerPacket.setRuntimeEntityId(geyserId); movePlayerPacket.setRuntimeEntityId(geyserId);
movePlayerPacket.setPosition(position); movePlayerPacket.setPosition(position);
movePlayerPacket.setRotation(getBedrockRotation()); movePlayerPacket.setRotation(getBedrockRotation());
movePlayerPacket.setMode(MovePlayerPacket.Mode.ROTATION); movePlayerPacket.setMode(MovePlayerPacket.Mode.HEAD_ROTATION);
session.sendUpstreamPacket(movePlayerPacket); session.sendUpstreamPacket(movePlayerPacket);
} }
@ -212,7 +213,7 @@ public class PlayerEntity extends LivingEntity {
movePlayerPacket.setPosition(position); movePlayerPacket.setPosition(position);
movePlayerPacket.setRotation(getBedrockRotation()); movePlayerPacket.setRotation(getBedrockRotation());
movePlayerPacket.setOnGround(isOnGround); movePlayerPacket.setOnGround(isOnGround);
movePlayerPacket.setMode(MovePlayerPacket.Mode.ROTATION); movePlayerPacket.setMode(MovePlayerPacket.Mode.HEAD_ROTATION);
session.sendUpstreamPacket(movePlayerPacket); session.sendUpstreamPacket(movePlayerPacket);
} }
@ -247,9 +248,9 @@ public class PlayerEntity extends LivingEntity {
if (entityMetadata.getId() == 14) { if (entityMetadata.getId() == 14) {
UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket();
attributesPacket.setRuntimeEntityId(geyserId); attributesPacket.setRuntimeEntityId(geyserId);
List<Attribute> attributes = new ArrayList<>(); List<AttributeData> attributes = new ArrayList<>();
// Setting to a higher maximum since plugins/datapacks can probably extend the Bedrock soft limit // Setting to a higher maximum since plugins/datapacks can probably extend the Bedrock soft limit
attributes.add(new Attribute("minecraft:absorption", 0.0f, 1024f, (float) entityMetadata.getValue(), 0.0f)); attributes.add(new AttributeData("minecraft:absorption", 0.0f, 1024f, (float) entityMetadata.getValue(), 0.0f));
attributesPacket.setAttributes(attributes); attributesPacket.setAttributes(attributes);
session.sendUpstreamPacket(attributesPacket); session.sendUpstreamPacket(attributesPacket);
} }
@ -269,8 +270,8 @@ public class PlayerEntity extends LivingEntity {
parrot.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, 1); parrot.getMetadata().put(EntityData.RIDER_ROTATION_LOCKED, 1);
parrot.updateBedrockMetadata(session); parrot.updateBedrockMetadata(session);
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
EntityLink.Type type = (entityMetadata.getId() == 18) ? EntityLink.Type.RIDER : EntityLink.Type.PASSENGER; EntityLinkData.Type type = (entityMetadata.getId() == 18) ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER;
linkPacket.setEntityLink(new EntityLink(geyserId, parrot.getGeyserId(), type, false)); linkPacket.setEntityLink(new EntityLinkData(geyserId, parrot.getGeyserId(), type, false));
// Delay, or else spawned-in players won't get the link // Delay, or else spawned-in players won't get the link
// TODO: Find a better solution. This problem also exists with item frames // TODO: Find a better solution. This problem also exists with item frames
session.getConnector().getGeneralThreadPool().schedule(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS); session.getConnector().getGeneralThreadPool().schedule(() -> session.sendUpstreamPacket(linkPacket), 500, TimeUnit.MILLISECONDS);

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity; package org.geysermc.connector.entity;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;

Datei anzeigen

@ -28,8 +28,8 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity.living; package org.geysermc.connector.entity.living;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
public class AbstractFishEntity extends WaterEntity { public class AbstractFishEntity extends WaterEntity {

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.entity.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.entity.LivingEntity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.entity.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType; import com.github.steveice10.mc.protocol.data.game.entity.metadata.MetadataType;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.LivingEntity; import org.geysermc.connector.entity.LivingEntity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.entity.living;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity.living; package org.geysermc.connector.entity.living;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
public class WaterEntity extends CreatureEntity { public class WaterEntity extends CreatureEntity {
@ -34,6 +34,6 @@ public class WaterEntity extends CreatureEntity {
public WaterEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) { public WaterEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, entityType, position, motion, rotation); super(entityId, geyserId, entityType, position, motion, rotation);
metadata.put(EntityData.AIR, (short) 400); metadata.put(EntityData.AIR_SUPPLY, (short) 400);
} }
} }

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.Attribute; import com.nukkitx.protocol.bedrock.data.AttributeData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket;
import org.geysermc.connector.entity.attribute.AttributeType; import org.geysermc.connector.entity.attribute.AttributeType;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
@ -67,14 +67,14 @@ public class PigEntity extends AnimalEntity {
float maxHealth = attributes.containsKey(AttributeType.MAX_HEALTH) ? attributes.get(AttributeType.MAX_HEALTH).getValue() : 20f; float maxHealth = attributes.containsKey(AttributeType.MAX_HEALTH) ? attributes.get(AttributeType.MAX_HEALTH).getValue() : 20f;
List<Attribute> attributesLocal = new ArrayList<>(); List<AttributeData> attributesLocal = new ArrayList<>();
for (Map.Entry<AttributeType, org.geysermc.connector.entity.attribute.Attribute> entry : this.attributes.entrySet()) { for (Map.Entry<AttributeType, org.geysermc.connector.entity.attribute.Attribute> entry : this.attributes.entrySet()) {
if (!entry.getValue().getType().isBedrockAttribute()) if (!entry.getValue().getType().isBedrockAttribute())
continue; continue;
attributesLocal.add(AttributeUtils.getBedrockAttribute(entry.getValue())); attributesLocal.add(AttributeUtils.getBedrockAttribute(entry.getValue()));
} }
attributesLocal.add(new Attribute("minecraft:health", 0.0f, maxHealth, health, maxHealth)); attributesLocal.add(new AttributeData("minecraft:health", 0.0f, maxHealth, health, maxHealth));
UpdateAttributesPacket updateAttributesPacket = new UpdateAttributesPacket(); UpdateAttributesPacket updateAttributesPacket = new UpdateAttributesPacket();
updateAttributesPacket.setRuntimeEntityId(geyserId); updateAttributesPacket.setRuntimeEntityId(geyserId);

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.living.AbstractFishEntity; import org.geysermc.connector.entity.living.AbstractFishEntity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.entity.living.AbstractFishEntity; import org.geysermc.connector.entity.living.AbstractFishEntity;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.Attribute; import com.nukkitx.protocol.bedrock.data.AttributeData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket; import com.nukkitx.protocol.bedrock.packet.UpdateAttributesPacket;
import org.geysermc.connector.entity.attribute.AttributeType; import org.geysermc.connector.entity.attribute.AttributeType;
import org.geysermc.connector.entity.living.animal.AnimalEntity; import org.geysermc.connector.entity.living.animal.AnimalEntity;
@ -78,14 +78,14 @@ public class AbstractHorseEntity extends AnimalEntity {
float maxHealth = attributes.containsKey(AttributeType.MAX_HEALTH) ? attributes.get(AttributeType.MAX_HEALTH).getValue() : 20f; float maxHealth = attributes.containsKey(AttributeType.MAX_HEALTH) ? attributes.get(AttributeType.MAX_HEALTH).getValue() : 20f;
List<com.nukkitx.protocol.bedrock.data.Attribute> attributesLocal = new ArrayList<>(); List<AttributeData> attributesLocal = new ArrayList<>();
for (Map.Entry<AttributeType, org.geysermc.connector.entity.attribute.Attribute> entry : this.attributes.entrySet()) { for (Map.Entry<AttributeType, org.geysermc.connector.entity.attribute.Attribute> entry : this.attributes.entrySet()) {
if (!entry.getValue().getType().isBedrockAttribute()) if (!entry.getValue().getType().isBedrockAttribute())
continue; continue;
attributesLocal.add(AttributeUtils.getBedrockAttribute(entry.getValue())); attributesLocal.add(AttributeUtils.getBedrockAttribute(entry.getValue()));
} }
attributesLocal.add(new Attribute("minecraft:health", 0.0f, maxHealth, health, maxHealth)); attributesLocal.add(new AttributeData("minecraft:health", 0.0f, maxHealth, health, maxHealth));
UpdateAttributesPacket updateAttributesPacket = new UpdateAttributesPacket(); UpdateAttributesPacket updateAttributesPacket = new UpdateAttributesPacket();
updateAttributesPacket.setRuntimeEntityId(geyserId); updateAttributesPacket.setRuntimeEntityId(geyserId);

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal.horse;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket; import com.nukkitx.protocol.bedrock.packet.MobArmorEquipmentPacket;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity.living.animal.horse; package org.geysermc.connector.entity.living.animal.horse;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal.tameable;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.animal.tameable;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal.tameable;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.living.animal.AnimalEntity; import org.geysermc.connector.entity.living.animal.AnimalEntity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.animal.tameable;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.entity.living.merchant;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.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 com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@
package org.geysermc.connector.entity.living.monster; package org.geysermc.connector.entity.living.monster;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
public class ElderGuardianEntity extends GuardianEntity { public class ElderGuardianEntity extends GuardianEntity {

Datei anzeigen

@ -27,9 +27,9 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.Attribute; import com.nukkitx.protocol.bedrock.data.AttributeData;
import com.nukkitx.protocol.bedrock.data.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.AddEntityPacket; import com.nukkitx.protocol.bedrock.packet.AddEntityPacket;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.connector.entity.living.InsentientEntity; import org.geysermc.connector.entity.living.InsentientEntity;
@ -76,7 +76,7 @@ public class EnderDragonEntity extends InsentientEntity {
addEntityPacket.getMetadata().putAll(metadata); addEntityPacket.getMetadata().putAll(metadata);
// Otherwise dragon is always 'dying' // Otherwise dragon is always 'dying'
addEntityPacket.getAttributes().add(new Attribute("minecraft:health", 0.0f, 200f, 200f, 200f)); addEntityPacket.getAttributes().add(new AttributeData("minecraft:health", 0.0f, 200f, 200f, 200f));
valid = true; valid = true;
session.sendUpstreamPacket(addEntityPacket); session.sendUpstreamPacket(addEntityPacket);

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.entity.living.monster; package org.geysermc.connector.entity.living.monster;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
public class GiantEntity extends MonsterEntity { public class GiantEntity extends MonsterEntity {

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.living.GolemEntity; import org.geysermc.connector.entity.living.GolemEntity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -27,8 +27,8 @@ package org.geysermc.connector.entity.living.monster;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata; import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -628,12 +628,12 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
} }
@Override @Override
public boolean handle(StructureTemplateDataExportRequestPacket packet) { public boolean handle(StructureTemplateDataRequestPacket packet) {
return defaultHandler(packet); return defaultHandler(packet);
} }
@Override @Override
public boolean handle(StructureTemplateDataExportResponsePacket packet) { public boolean handle(StructureTemplateDataResponsePacket packet) {
return defaultHandler(packet); return defaultHandler(packet);
} }
@ -756,4 +756,74 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
public boolean handle(MultiplayerSettingsPacket packet) { public boolean handle(MultiplayerSettingsPacket packet) {
return defaultHandler(packet); return defaultHandler(packet);
} }
// 1.16 new packets
@Override
public boolean handle(DebugInfoPacket packet) {
return defaultHandler(packet);
}
// I question if God exists because of this packet - God does not exist if I find out there's a built-in dab
// TODO for the future: redirect this as a /me command
// TODO for the far future: should we have a client mod that handles skins, handle these too
@Override
public boolean handle(EmoteListPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(CodeBuilderPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(CreativeContentPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(ItemStackRequestPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(LevelSoundEvent1Packet packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(ItemStackResponsePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PlayerArmorDamagePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PlayerEnchantOptionsPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(UpdatePlayerGameTypePacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PacketViolationWarningPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PositionTrackingDBClientRequestPacket packet) {
return defaultHandler(packet);
}
@Override
public boolean handle(PositionTrackingDBServerBroadcastPacket packet) {
return defaultHandler(packet);
}
} }

Datei anzeigen

@ -45,6 +45,7 @@ import com.nukkitx.math.vector.*;
import com.nukkitx.protocol.bedrock.BedrockPacket; import com.nukkitx.protocol.bedrock.BedrockPacket;
import com.nukkitx.protocol.bedrock.BedrockServerSession; import com.nukkitx.protocol.bedrock.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.*; import com.nukkitx.protocol.bedrock.data.*;
import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.packet.*;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@ -225,7 +226,7 @@ public class GeyserSession implements CommandSender {
upstream.sendPacket(entityPacket); upstream.sendPacket(entityPacket);
InventoryContentPacket creativePacket = new InventoryContentPacket(); InventoryContentPacket creativePacket = new InventoryContentPacket();
creativePacket.setContainerId(ContainerId.CREATIVE); creativePacket.setContainerId(ContainerId.CREATIVE); //TODO: Why is this deprecated?
creativePacket.setContents(ItemRegistry.CREATIVE_ITEMS); creativePacket.setContents(ItemRegistry.CREATIVE_ITEMS);
upstream.sendPacket(creativePacket); upstream.sendPacket(creativePacket);
@ -235,10 +236,10 @@ public class GeyserSession implements CommandSender {
UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket(); UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket();
attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId()); attributesPacket.setRuntimeEntityId(getPlayerEntity().getGeyserId());
List<Attribute> attributes = new ArrayList<>(); List<AttributeData> attributes = new ArrayList<>();
// Default move speed // Default move speed
// Bedrock clients move very fast by default until they get an attribute packet correcting the speed // Bedrock clients move very fast by default until they get an attribute packet correcting the speed
attributes.add(new Attribute("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f)); attributes.add(new AttributeData("minecraft:movement", 0.0f, 1024f, 0.1f, 0.1f));
attributesPacket.setAttributes(attributes); attributesPacket.setAttributes(attributes);
upstream.sendPacket(attributesPacket); upstream.sendPacket(attributesPacket);
} }
@ -495,18 +496,18 @@ public class GeyserSession implements CommandSender {
StartGamePacket startGamePacket = new StartGamePacket(); StartGamePacket startGamePacket = new StartGamePacket();
startGamePacket.setUniqueEntityId(playerEntity.getGeyserId()); startGamePacket.setUniqueEntityId(playerEntity.getGeyserId());
startGamePacket.setRuntimeEntityId(playerEntity.getGeyserId()); startGamePacket.setRuntimeEntityId(playerEntity.getGeyserId());
startGamePacket.setPlayerGamemode(0); startGamePacket.setPlayerGameType(GameType.SURVIVAL);
startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0)); startGamePacket.setPlayerPosition(Vector3f.from(0, 69, 0));
startGamePacket.setRotation(Vector2f.from(1, 1)); startGamePacket.setRotation(Vector2f.from(1, 1));
startGamePacket.setSeed(-1); startGamePacket.setSeed(-1);
startGamePacket.setDimensionId(DimensionUtils.javaToBedrock(playerEntity.getDimension())); startGamePacket.setDimensionId(DimensionUtils.javaToBedrock(playerEntity.getDimension()));
startGamePacket.setGeneratorId(1); startGamePacket.setGeneratorId(1);
startGamePacket.setLevelGamemode(0); startGamePacket.setLevelGameType(GameType.SURVIVAL);
startGamePacket.setDifficulty(1); startGamePacket.setDifficulty(1);
startGamePacket.setDefaultSpawn(Vector3i.ZERO); startGamePacket.setDefaultSpawn(Vector3i.ZERO);
startGamePacket.setAchievementsDisabled(true); startGamePacket.setAchievementsDisabled(true);
startGamePacket.setTime(-1); startGamePacket.setCurrentTick(-1);
startGamePacket.setEduEditionOffers(0); startGamePacket.setEduEditionOffers(0);
startGamePacket.setEduFeaturesEnabled(false); startGamePacket.setEduFeaturesEnabled(false);
startGamePacket.setRainLevel(0); startGamePacket.setRainLevel(0);
@ -531,7 +532,7 @@ public class GeyserSession implements CommandSender {
startGamePacket.setWorldTemplateOptionLocked(false); startGamePacket.setWorldTemplateOptionLocked(false);
startGamePacket.setLevelId("world"); startGamePacket.setLevelId("world");
startGamePacket.setWorldName("world"); startGamePacket.setLevelName("world");
startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000"); startGamePacket.setPremiumWorldTemplateId("00000000-0000-0000-0000-000000000000");
// startGamePacket.setCurrentTick(0); // startGamePacket.setCurrentTick(0);
startGamePacket.setEnchantmentSeed(0); startGamePacket.setEnchantmentSeed(0);

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.connector.network.session.cache;
import com.github.steveice10.mc.protocol.data.message.Message; import com.github.steveice10.mc.protocol.data.message.Message;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.packet.AddEntityPacket; import com.nukkitx.protocol.bedrock.packet.AddEntityPacket;
import com.nukkitx.protocol.bedrock.packet.BossEventPacket; import com.nukkitx.protocol.bedrock.packet.BossEventPacket;
import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket; import com.nukkitx.protocol.bedrock.packet.RemoveEntityPacket;
@ -52,10 +52,12 @@ public class BossBar {
updateBossBar(); updateBossBar();
} }
//TODO: There is a player unique entity ID - if this didn't exist before, we may be able to get rid of our hack
public void updateBossBar() { public void updateBossBar() {
BossEventPacket bossEventPacket = new BossEventPacket(); BossEventPacket bossEventPacket = new BossEventPacket();
bossEventPacket.setBossUniqueEntityId(entityId); bossEventPacket.setBossUniqueEntityId(entityId);
bossEventPacket.setAction(BossEventPacket.Action.SHOW); bossEventPacket.setAction(BossEventPacket.Action.CREATE);
bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(title, session.getClientData().getLanguageCode())); bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(title, session.getClientData().getLanguageCode()));
bossEventPacket.setHealthPercentage(health); bossEventPacket.setHealthPercentage(health);
bossEventPacket.setColor(color); //ignored by client bossEventPacket.setColor(color); //ignored by client
@ -69,7 +71,7 @@ public class BossBar {
this.title = title; this.title = title;
BossEventPacket bossEventPacket = new BossEventPacket(); BossEventPacket bossEventPacket = new BossEventPacket();
bossEventPacket.setBossUniqueEntityId(entityId); bossEventPacket.setBossUniqueEntityId(entityId);
bossEventPacket.setAction(BossEventPacket.Action.TITLE); bossEventPacket.setAction(BossEventPacket.Action.UPDATE_NAME);
bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(title, session.getClientData().getLanguageCode())); bossEventPacket.setTitle(MessageUtils.getTranslatedBedrockMessage(title, session.getClientData().getLanguageCode()));
session.sendUpstreamPacket(bossEventPacket); session.sendUpstreamPacket(bossEventPacket);
@ -79,7 +81,7 @@ public class BossBar {
this.health = health; this.health = health;
BossEventPacket bossEventPacket = new BossEventPacket(); BossEventPacket bossEventPacket = new BossEventPacket();
bossEventPacket.setBossUniqueEntityId(entityId); bossEventPacket.setBossUniqueEntityId(entityId);
bossEventPacket.setAction(BossEventPacket.Action.HEALTH_PERCENTAGE); bossEventPacket.setAction(BossEventPacket.Action.UPDATE_PERCENTAGE);
bossEventPacket.setHealthPercentage(health); bossEventPacket.setHealthPercentage(health);
session.sendUpstreamPacket(bossEventPacket); session.sendUpstreamPacket(bossEventPacket);
@ -88,7 +90,7 @@ public class BossBar {
public void removeBossBar() { public void removeBossBar() {
BossEventPacket bossEventPacket = new BossEventPacket(); BossEventPacket bossEventPacket = new BossEventPacket();
bossEventPacket.setBossUniqueEntityId(entityId); bossEventPacket.setBossUniqueEntityId(entityId);
bossEventPacket.setAction(BossEventPacket.Action.HIDE); bossEventPacket.setAction(BossEventPacket.Action.REMOVE);
session.sendUpstreamPacket(bossEventPacket); session.sendUpstreamPacket(bossEventPacket);
removeBossEntity(); removeBossEntity();

Datei anzeigen

@ -25,15 +25,6 @@
package org.geysermc.connector.network.translators.bedrock; package org.geysermc.connector.network.translators.bedrock;
import java.util.concurrent.TimeUnit;
import com.nukkitx.protocol.bedrock.data.LevelEventType;
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState; import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerState;
@ -41,10 +32,18 @@ import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerStatePacket;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.LevelEventType;
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket; import com.nukkitx.protocol.bedrock.packet.PlayStatusPacket;
import com.nukkitx.protocol.bedrock.packet.PlayerActionPacket; import com.nukkitx.protocol.bedrock.packet.PlayerActionPacket;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;
import java.util.concurrent.TimeUnit;
@Translator(packet = PlayerActionPacket.class) @Translator(packet = PlayerActionPacket.class)
public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> { public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> {
@ -113,7 +112,7 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
break; break;
case CONTINUE_BREAK: case CONTINUE_BREAK:
LevelEventPacket continueBreakPacket = new LevelEventPacket(); LevelEventPacket continueBreakPacket = new LevelEventPacket();
continueBreakPacket.setType(LevelEventType.PUNCH_BLOCK); continueBreakPacket.setType(LevelEventType.BLOCK_UPDATE_BREAK); //TODO: There are now level event types for all breaks. Important?
continueBreakPacket.setData(BlockTranslator.getBedrockBlockId(session.getBreakingBlock())); continueBreakPacket.setData(BlockTranslator.getBedrockBlockId(session.getBreakingBlock()));
continueBreakPacket.setPosition(packet.getBlockPosition().toFloat()); continueBreakPacket.setPosition(packet.getBlockPosition().toFloat());
session.sendUpstreamPacket(continueBreakPacket); session.sendUpstreamPacket(continueBreakPacket);

Datei anzeigen

@ -39,7 +39,7 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
@Override @Override
public void translate(ContainerClosePacket packet, GeyserSession session) { public void translate(ContainerClosePacket packet, GeyserSession session) {
session.setLastWindowCloseTime(0); session.setLastWindowCloseTime(0);
byte windowId = packet.getWindowId(); byte windowId = packet.getId();
Inventory openInventory = session.getInventoryCache().getOpenInventory(); Inventory openInventory = session.getInventoryCache().getOpenInventory();
if (windowId == -1) { //player inventory or crafting table if (windowId == -1) { //player inventory or crafting table
if (openInventory != null) { if (openInventory != null) {

Datei anzeigen

@ -29,7 +29,7 @@ package org.geysermc.connector.network.translators.bedrock;
import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade; import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade;
import com.github.steveice10.mc.protocol.data.game.window.WindowType; import com.github.steveice10.mc.protocol.data.game.window.WindowType;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSelectTradePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientSelectTradePacket;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;

Datei anzeigen

@ -25,9 +25,9 @@
package org.geysermc.connector.network.translators.bedrock; package org.geysermc.connector.network.translators.bedrock;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityDataMap; import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.PacketTranslator;

Datei anzeigen

@ -92,7 +92,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
ClientPlayerPlaceBlockPacket blockPacket = new ClientPlayerPlaceBlockPacket( ClientPlayerPlaceBlockPacket blockPacket = new ClientPlayerPlaceBlockPacket(
new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()), new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()),
BlockFace.values()[packet.getFace()], BlockFace.values()[packet.getBlockFace()],
Hand.MAIN_HAND, Hand.MAIN_HAND,
packet.getClickPosition().getX(), packet.getClickPosition().getY(), packet.getClickPosition().getZ(), packet.getClickPosition().getX(), packet.getClickPosition().getY(), packet.getClickPosition().getZ(),
false); false);
@ -106,7 +106,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
Vector3i blockPos = packet.getBlockPosition(); Vector3i blockPos = packet.getBlockPosition();
// TODO: Find a better way to do this? // TODO: Find a better way to do this?
switch (packet.getFace()) { switch (packet.getBlockFace()) {
case 0: case 0:
blockPos = blockPos.sub(0, 1, 0); blockPos = blockPos.sub(0, 1, 0);
break; break;
@ -152,7 +152,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
session.setLastBlockPlacePosition(null); session.setLastBlockPlacePosition(null);
LevelEventPacket blockBreakPacket = new LevelEventPacket(); LevelEventPacket blockBreakPacket = new LevelEventPacket();
blockBreakPacket.setType(LevelEventType.DESTROY); blockBreakPacket.setType(LevelEventType.BLOCK_STOP_BREAK); //TODO: Make sure this is the right new enum
blockBreakPacket.setPosition(packet.getBlockPosition().toFloat()); blockBreakPacket.setPosition(packet.getBlockPosition().toFloat());
blockBreakPacket.setData(BlockTranslator.getBedrockBlockId(blockState)); blockBreakPacket.setData(BlockTranslator.getBedrockBlockId(blockState));
session.sendUpstreamPacket(blockBreakPacket); session.sendUpstreamPacket(blockBreakPacket);
@ -168,7 +168,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
PlayerAction action = session.getGameMode() == GameMode.CREATIVE ? PlayerAction.START_DIGGING : PlayerAction.FINISH_DIGGING; PlayerAction action = session.getGameMode() == GameMode.CREATIVE ? PlayerAction.START_DIGGING : PlayerAction.FINISH_DIGGING;
Position pos = new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()); Position pos = new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ());
ClientPlayerActionPacket breakPacket = new ClientPlayerActionPacket(action, pos, BlockFace.values()[packet.getFace()]); ClientPlayerActionPacket breakPacket = new ClientPlayerActionPacket(action, pos, BlockFace.values()[packet.getBlockFace()]);
session.sendDownstreamPacket(breakPacket); session.sendDownstreamPacket(breakPacket);
break; break;
} }

Datei anzeigen

@ -30,7 +30,7 @@ import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.Translator;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket; import com.nukkitx.protocol.bedrock.packet.MobEquipmentPacket;
import org.geysermc.connector.utils.CooldownUtils; import org.geysermc.connector.utils.CooldownUtils;

Datei anzeigen

@ -137,7 +137,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
movePlayerPacket.setRuntimeEntityId(entity.getGeyserId()); movePlayerPacket.setRuntimeEntityId(entity.getGeyserId());
movePlayerPacket.setPosition(entity.getPosition()); movePlayerPacket.setPosition(entity.getPosition());
movePlayerPacket.setRotation(entity.getBedrockRotation()); movePlayerPacket.setRotation(entity.getBedrockRotation());
movePlayerPacket.setMode(MovePlayerPacket.Mode.RESET); movePlayerPacket.setMode(MovePlayerPacket.Mode.RESPAWN);
session.sendUpstreamPacket(movePlayerPacket); session.sendUpstreamPacket(movePlayerPacket);
} }
} }

Datei anzeigen

@ -30,10 +30,10 @@ import com.github.steveice10.mc.protocol.data.message.MessageSerializer;
import com.github.steveice10.mc.protocol.data.message.TextMessage; import com.github.steveice10.mc.protocol.data.message.TextMessage;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater;
@ -47,7 +47,7 @@ public class AnvilInventoryTranslator extends BlockInventoryTranslator {
@Override @Override
public int bedrockSlotToJava(InventoryActionData action) { public int bedrockSlotToJava(InventoryActionData action) {
if (action.getSource().getContainerId() == ContainerId.CURSOR) { if (action.getSource().getContainerId() == ContainerId.UI) {
switch (action.getSlot()) { switch (action.getSlot()) {
case 1: case 1:
return 0; return 0;

Datei anzeigen

@ -25,8 +25,8 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.action.InventoryActionDataTranslator; import org.geysermc.connector.network.translators.inventory.action.InventoryActionDataTranslator;

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.BlockTranslator;

Datei anzeigen

@ -25,8 +25,8 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.updater.ChestInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.ChestInventoryUpdater;

Datei anzeigen

@ -26,10 +26,10 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.data.InventorySource; import com.nukkitx.protocol.bedrock.data.inventory.InventorySource;
import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -79,7 +79,7 @@ public class CraftingInventoryTranslator extends BaseInventoryTranslator {
@Override @Override
public int bedrockSlotToJava(InventoryActionData action) { public int bedrockSlotToJava(InventoryActionData action) {
if (action.getSource().getContainerId() == ContainerId.CURSOR) { if (action.getSource().getContainerId() == ContainerId.UI) {
int slotnum = action.getSlot(); int slotnum = action.getSlot();
if (slotnum >= 32 && 42 >= slotnum) { if (slotnum >= 32 && 42 >= slotnum) {
return slotnum - 31; return slotnum - 31;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.inventory;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.nbt.tag.CompoundTag; import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
@ -96,8 +96,8 @@ public class DoubleChestInventoryTranslator extends ChestInventoryTranslator {
@Override @Override
public void openInventory(GeyserSession session, Inventory inventory) { public void openInventory(GeyserSession session, Inventory inventory) {
ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket();
containerOpenPacket.setWindowId((byte) inventory.getId()); containerOpenPacket.setId((byte) inventory.getId());
containerOpenPacket.setType((byte) ContainerType.CONTAINER.id()); containerOpenPacket.setType(ContainerType.CONTAINER);
containerOpenPacket.setBlockPosition(inventory.getHolderPosition()); containerOpenPacket.setBlockPosition(inventory.getHolderPosition());
containerOpenPacket.setUniqueEntityId(inventory.getHolderId()); containerOpenPacket.setUniqueEntityId(inventory.getHolderId());
session.sendUpstreamPacket(containerOpenPacket); session.sendUpstreamPacket(containerOpenPacket);

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater;

Datei anzeigen

@ -26,7 +26,7 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.github.steveice10.mc.protocol.data.game.window.WindowType; import com.github.steveice10.mc.protocol.data.game.window.WindowType;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket; import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -25,8 +25,8 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater;
public class GrindstoneInventoryTranslator extends BlockInventoryTranslator { public class GrindstoneInventoryTranslator extends BlockInventoryTranslator {

Datei anzeigen

@ -26,8 +26,8 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.github.steveice10.mc.protocol.data.game.window.WindowType; import com.github.steveice10.mc.protocol.data.game.window.WindowType;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;

Datei anzeigen

@ -26,9 +26,9 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.data.InventorySource; import com.nukkitx.protocol.bedrock.data.inventory.InventorySource;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.CursorInventoryUpdater;
@ -60,7 +60,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
@Override @Override
public int bedrockSlotToJava(InventoryActionData action) { public int bedrockSlotToJava(InventoryActionData action) {
if (action.getSource().getContainerId() == ContainerId.CURSOR) { if (action.getSource().getContainerId() == ContainerId.UI) {
switch (action.getSlot()) { switch (action.getSlot()) {
case 4: case 4:
return 0; return 0;

Datei anzeigen

@ -28,10 +28,10 @@ package org.geysermc.connector.network.translators.inventory;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreativeInventoryActionPacket;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.data.InventorySource; import com.nukkitx.protocol.bedrock.data.inventory.InventorySource;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
@ -94,7 +94,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
// Crafting grid // Crafting grid
for (int i = 1; i < 5; i++) { for (int i = 1; i < 5; i++) {
InventorySlotPacket slotPacket = new InventorySlotPacket(); InventorySlotPacket slotPacket = new InventorySlotPacket();
slotPacket.setContainerId(ContainerId.CURSOR); slotPacket.setContainerId(ContainerId.UI);
slotPacket.setSlot(i + 27); slotPacket.setSlot(i + 27);
if (session.getGameMode() == GameMode.CREATIVE) { if (session.getGameMode() == GameMode.CREATIVE) {
@ -122,7 +122,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
slotPacket.setContainerId(ContainerId.ARMOR); slotPacket.setContainerId(ContainerId.ARMOR);
slotPacket.setSlot(slot - 5); slotPacket.setSlot(slot - 5);
} else { } else {
slotPacket.setContainerId(ContainerId.CURSOR); slotPacket.setContainerId(ContainerId.UI);
slotPacket.setSlot(slot + 27); slotPacket.setSlot(slot + 27);
} }
slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(slot))); slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(slot)));
@ -156,7 +156,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
break; break;
case ContainerId.OFFHAND: case ContainerId.OFFHAND:
return 45; return 45;
case ContainerId.CURSOR: case ContainerId.UI:
if (slotnum >= 28 && 31 >= slotnum) { if (slotnum >= 28 && 31 >= slotnum) {
return slotnum - 27; return slotnum - 27;
} else if (slotnum == 50) { } else if (slotnum == 50) {
@ -184,7 +184,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
if (session.getGameMode() == GameMode.CREATIVE) { if (session.getGameMode() == GameMode.CREATIVE) {
//crafting grid is not visible in creative mode in java edition //crafting grid is not visible in creative mode in java edition
for (InventoryActionData action : actions) { for (InventoryActionData action : actions) {
if (action.getSource().getContainerId() == ContainerId.CURSOR && (action.getSlot() >= 28 && 31 >= action.getSlot())) { if (action.getSource().getContainerId() == ContainerId.UI && (action.getSlot() >= 28 && 31 >= action.getSlot())) {
updateInventory(session, inventory); updateInventory(session, inventory);
InventoryUtils.updateCursor(session); InventoryUtils.updateCursor(session);
return; return;
@ -207,7 +207,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
session.sendDownstreamPacket(creativePacket); session.sendDownstreamPacket(creativePacket);
inventory.setItem(javaSlot, javaItem); inventory.setItem(javaSlot, javaItem);
break; break;
case ContainerId.CURSOR: case ContainerId.UI:
if (action.getSlot() == 0) { if (action.getSlot() == 0) {
session.getInventory().setCursor(ItemTranslator.translateToJava(action.getToItem())); session.getInventory().setCursor(ItemTranslator.translateToJava(action.getToItem()));
} }

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory; package org.geysermc.connector.network.translators.inventory;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder; import org.geysermc.connector.network.translators.inventory.holder.BlockInventoryHolder;

Datei anzeigen

@ -32,10 +32,10 @@ import com.github.steveice10.mc.protocol.data.game.window.*;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientWindowActionPacket;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.InventoryActionData; import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData;
import com.nukkitx.protocol.bedrock.data.InventorySource; import com.nukkitx.protocol.bedrock.data.inventory.InventorySource;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
@ -59,7 +59,7 @@ public class InventoryActionDataTranslator {
return; return;
} else if (action.getSource().getType() == InventorySource.Type.WORLD_INTERACTION) { } else if (action.getSource().getType() == InventorySource.Type.WORLD_INTERACTION) {
worldAction = action; worldAction = action;
} else if (action.getSource().getContainerId() == ContainerId.CURSOR && action.getSlot() == 0) { } else if (action.getSource().getContainerId() == ContainerId.UI && action.getSlot() == 0) {
cursorAction = action; cursorAction = action;
ItemData translatedCursor = ItemTranslator.translateToBedrock(session, session.getInventory().getCursor()); ItemData translatedCursor = ItemTranslator.translateToBedrock(session, session.getInventory().getCursor());
if (!translatedCursor.equals(action.getFromItem())) { if (!translatedCursor.equals(action.getFromItem())) {

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.inventory.holder;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position; import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.nukkitx.math.vector.Vector3i; import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.nbt.tag.CompoundTag; import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.protocol.bedrock.data.ContainerType; import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket; import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
@ -70,8 +70,8 @@ public class BlockInventoryHolder extends InventoryHolder {
@Override @Override
public void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { public void openInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) {
ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket(); ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket();
containerOpenPacket.setWindowId((byte) inventory.getId()); containerOpenPacket.setId((byte) inventory.getId());
containerOpenPacket.setType((byte) containerType.id()); containerOpenPacket.setType(containerType);
containerOpenPacket.setBlockPosition(inventory.getHolderPosition()); containerOpenPacket.setBlockPosition(inventory.getHolderPosition());
containerOpenPacket.setUniqueEntityId(inventory.getHolderId()); containerOpenPacket.setUniqueEntityId(inventory.getHolderId());
session.sendUpstreamPacket(containerOpenPacket); session.sendUpstreamPacket(containerOpenPacket);

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory.updater; package org.geysermc.connector.network.translators.inventory.updater;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory.updater; package org.geysermc.connector.network.translators.inventory.updater;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;

Datei anzeigen

@ -25,7 +25,7 @@
package org.geysermc.connector.network.translators.inventory.updater; package org.geysermc.connector.network.translators.inventory.updater;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -33,6 +33,8 @@ import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator;
public class CursorInventoryUpdater extends InventoryUpdater { public class CursorInventoryUpdater extends InventoryUpdater {
//TODO: Consider renaming this? Since the Protocol enum updated
@Override @Override
public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) { public void updateInventory(InventoryTranslator translator, GeyserSession session, Inventory inventory) {
super.updateInventory(translator, session, inventory); super.updateInventory(translator, session, inventory);
@ -42,7 +44,7 @@ public class CursorInventoryUpdater extends InventoryUpdater {
if (bedrockSlot == 50) if (bedrockSlot == 50)
continue; continue;
InventorySlotPacket slotPacket = new InventorySlotPacket(); InventorySlotPacket slotPacket = new InventorySlotPacket();
slotPacket.setContainerId(ContainerId.CURSOR); slotPacket.setContainerId(ContainerId.UI);
slotPacket.setSlot(bedrockSlot); slotPacket.setSlot(bedrockSlot);
slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(i))); slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(i)));
session.sendUpstreamPacket(slotPacket); session.sendUpstreamPacket(slotPacket);
@ -55,7 +57,7 @@ public class CursorInventoryUpdater extends InventoryUpdater {
return true; return true;
InventorySlotPacket slotPacket = new InventorySlotPacket(); InventorySlotPacket slotPacket = new InventorySlotPacket();
slotPacket.setContainerId(ContainerId.CURSOR); slotPacket.setContainerId(ContainerId.UI);
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot)); slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(javaSlot))); slotPacket.setItem(ItemTranslator.translateToBedrock(session, inventory.getItem(javaSlot)));
session.sendUpstreamPacket(slotPacket); session.sendUpstreamPacket(slotPacket);

Datei anzeigen

@ -25,8 +25,8 @@
package org.geysermc.connector.network.translators.inventory.updater; package org.geysermc.connector.network.translators.inventory.updater;
import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket; import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket; import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;

Datei anzeigen

@ -30,7 +30,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
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.nbt.NbtUtils; import com.nukkitx.nbt.NbtUtils;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.StartGamePacket; import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

Datei anzeigen

@ -32,7 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.*;
import com.nukkitx.nbt.CompoundTagBuilder; import com.nukkitx.nbt.CompoundTagBuilder;
import com.nukkitx.nbt.tag.CompoundTag; import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.nbt.tag.Tag; import com.nukkitx.nbt.tag.Tag;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;

Datei anzeigen

@ -32,7 +32,7 @@ import com.github.steveice10.opennbt.tag.builtin.ListTag;
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.nbt.CompoundTagBuilder; import com.nukkitx.nbt.CompoundTagBuilder;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.network.translators.ItemRemapper;
import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.network.translators.item.ItemRegistry;
import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator;

Datei anzeigen

@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.item.translators;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.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.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.translators.item.ItemRegistry; import org.geysermc.connector.network.translators.item.ItemRegistry;
import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator;

Datei anzeigen

@ -25,293 +25,281 @@
package org.geysermc.connector.network.translators.java; package org.geysermc.connector.network.translators.java;
import com.github.steveice10.mc.protocol.data.game.command.CommandNode;
import com.github.steveice10.mc.protocol.data.game.command.CommandParser;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket;
import com.nukkitx.protocol.bedrock.data.CommandData;
import com.nukkitx.protocol.bedrock.data.CommandEnumData;
import com.nukkitx.protocol.bedrock.data.CommandParamData;
import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import lombok.Getter;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.Translator;
import java.util.*;
@Translator(packet = ServerDeclareCommandsPacket.class) @Translator(packet = ServerDeclareCommandsPacket.class)
public class JavaDeclareCommandsTranslator extends PacketTranslator<ServerDeclareCommandsPacket> { public class JavaDeclareCommandsTranslator extends PacketTranslator<ServerDeclareCommandsPacket> {
@Override @Override
public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) { public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) {
// Don't send command suggestions if they are disabled // Don't send command suggestions if they are disabled
if (!session.getConnector().getConfig().isCommandSuggestions()) { // if (!session.getConnector().getConfig().isCommandSuggestions()) {
session.getConnector().getLogger().debug("Not sending command suggestions as they are disabled."); // session.getConnector().getLogger().debug("Not sending command suggestions as they are disabled.");
return; // return;
} // }
List<CommandData> commandData = new ArrayList<>(); // List<CommandData> commandData = new ArrayList<>();
Int2ObjectMap<String> commands = new Int2ObjectOpenHashMap<>(); // Int2ObjectMap<String> commands = new Int2ObjectOpenHashMap<>();
Int2ObjectMap<List<CommandNode>> commandArgs = new Int2ObjectOpenHashMap<>(); // Int2ObjectMap<List<CommandNode>> commandArgs = new Int2ObjectOpenHashMap<>();
//
// Get the first node, it should be a root node // // Get the first node, it should be a root node
CommandNode rootNode = packet.getNodes()[packet.getFirstNodeIndex()]; // CommandNode rootNode = packet.getNodes()[packet.getFirstNodeIndex()];
//
// Loop through the root nodes to get all commands // // Loop through the root nodes to get all commands
for (int nodeIndex : rootNode.getChildIndices()) { // for (int nodeIndex : rootNode.getChildIndices()) {
CommandNode node = packet.getNodes()[nodeIndex]; // CommandNode node = packet.getNodes()[nodeIndex];
//
// Make sure we don't have duplicated commands (happens if there is more than 1 root node) // // Make sure we don't have duplicated commands (happens if there is more than 1 root node)
if (commands.containsKey(nodeIndex)) { continue; } // if (commands.containsKey(nodeIndex)) { continue; }
if (commands.containsValue(node.getName())) { continue; } // if (commands.containsValue(node.getName())) { continue; }
//
// Get and update the commandArgs list with the found arguments // // Get and update the commandArgs list with the found arguments
if (node.getChildIndices().length >= 1) { // if (node.getChildIndices().length >= 1) {
for (int childIndex : node.getChildIndices()) { // for (int childIndex : node.getChildIndices()) {
commandArgs.putIfAbsent(nodeIndex, new ArrayList<>()); // commandArgs.putIfAbsent(nodeIndex, new ArrayList<>());
commandArgs.get(nodeIndex).add(packet.getNodes()[childIndex]); // commandArgs.get(nodeIndex).add(packet.getNodes()[childIndex]);
} // }
} // }
//
// Insert the command name into the list // // Insert the command name into the list
commands.put(nodeIndex, node.getName()); // commands.put(nodeIndex, node.getName());
} // }
//
// The command flags, not sure what these do apart from break things // // The command flags, not sure what these do apart from break things
List<CommandData.Flag> flags = new ArrayList<>(); // List<CommandData.Flag> flags = new ArrayList<>();
//
// Loop through all the found commands // // Loop through all the found commands
for (int commandID : commands.keySet()) { // for (int commandID : commands.keySet()) {
String commandName = commands.get(commandID); // String commandName = commands.get(commandID);
//
// Create a basic alias // // Create a basic alias
CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[] { commandName.toLowerCase() }, false); // CommandEnumData aliases = new CommandEnumData( commandName + "Aliases", new String[] { commandName.toLowerCase() }, false);
//
// Get and parse all params // // Get and parse all params
CommandParamData[][] params = getParams(packet.getNodes()[commandID], packet.getNodes()); // CommandParamData[][] params = getParams(packet.getNodes()[commandID], packet.getNodes());
//
// Build the completed command and add it to the final list // // Build the completed command and add it to the final list
CommandData data = new CommandData(commandName, session.getConnector().getCommandManager().getDescription(commandName), flags, (byte) 0, aliases, params); // CommandData data = new CommandData(commandName, session.getConnector().getCommandManager().getDescription(commandName), flags, (byte) 0, aliases, params);
commandData.add(data); // commandData.add(data);
} // }
//
// Add our commands to the AvailableCommandsPacket for the bedrock client // // Add our commands to the AvailableCommandsPacket for the bedrock client
AvailableCommandsPacket availableCommandsPacket = new AvailableCommandsPacket(); // AvailableCommandsPacket availableCommandsPacket = new AvailableCommandsPacket();
for (CommandData data : commandData) { // for (CommandData data : commandData) {
availableCommandsPacket.getCommands().add(data); // availableCommandsPacket.getCommands().add(data);
} // }
//
GeyserConnector.getInstance().getLogger().debug("Sending command packet of " + commandData.size() + " commands"); // GeyserConnector.getInstance().getLogger().debug("Sending command packet of " + commandData.size() + " commands");
//
// Finally, send the commands to the client // // Finally, send the commands to the client
session.sendUpstreamPacket(availableCommandsPacket); // session.sendUpstreamPacket(availableCommandsPacket);
} // }
//
/** // /**
* Build the command parameter array for the given command // * Build the command parameter array for the given command
* // *
* @param commandNode The command to build the parameters for // * @param commandNode The command to build the parameters for
* @param allNodes Every command node // * @param allNodes Every command node
* // *
* @return An array of parameter option arrays // * @return An array of parameter option arrays
*/ // */
private CommandParamData[][] getParams(CommandNode commandNode, CommandNode[] allNodes) { // private CommandParamData[][] getParams(CommandNode commandNode, CommandNode[] allNodes) {
// Check if the command is an alias and redirect it // // Check if the command is an alias and redirect it
if (commandNode.getRedirectIndex() != -1) { // if (commandNode.getRedirectIndex() != -1) {
GeyserConnector.getInstance().getLogger().debug("Redirecting command " + commandNode.getName() + " to " + allNodes[commandNode.getRedirectIndex()].getName()); // GeyserConnector.getInstance().getLogger().debug("Redirecting command " + commandNode.getName() + " to " + allNodes[commandNode.getRedirectIndex()].getName());
commandNode = allNodes[commandNode.getRedirectIndex()]; // commandNode = allNodes[commandNode.getRedirectIndex()];
} // }
//
if (commandNode.getChildIndices().length >= 1) { // if (commandNode.getChildIndices().length >= 1) {
// Create the root param node and build all the children // // Create the root param node and build all the children
ParamInfo rootParam = new ParamInfo(commandNode, null); // ParamInfo rootParam = new ParamInfo(commandNode, null);
rootParam.buildChildren(allNodes); // rootParam.buildChildren(allNodes);
//
List<CommandParamData[]> treeData = rootParam.getTree(); // List<CommandParamData[]> treeData = rootParam.getTree();
CommandParamData[][] params = new CommandParamData[treeData.size()][]; // CommandParamData[][] params = new CommandParamData[treeData.size()][];
//
// Fill the nested params array // // Fill the nested params array
int i = 0; // int i = 0;
for (CommandParamData[] tree : treeData) { // for (CommandParamData[] tree : treeData) {
params[i] = tree; // params[i] = tree;
i++; // i++;
} // }
//
return params; // return params;
} // }
//
return new CommandParamData[0][0]; // return new CommandParamData[0][0];
} // }
//
/** // /**
* Convert Java edition command types to Bedrock edition // * Convert Java edition command types to Bedrock edition
* // *
* @param parser Command type to convert // * @param parser Command type to convert
* // *
* @return Bedrock parameter data type // * @return Bedrock parameter data type
*/ // */
private CommandParamData.Type mapCommandType(CommandParser parser) { // private CommandParamData.Type mapCommandType(CommandParser parser) {
if (parser == null) { return CommandParamData.Type.STRING; } // if (parser == null) { return CommandParamData.Type.STRING; } //TODO: this
//
switch (parser) { // switch (parser) {
case FLOAT: // case FLOAT:
return CommandParamData.Type.FLOAT; // return CommandParamData.Type.FLOAT;
//
case INTEGER: // case INTEGER:
return CommandParamData.Type.INT; // return CommandParamData.Type.INT;
//
case ENTITY: // case ENTITY:
case GAME_PROFILE: // case GAME_PROFILE:
return CommandParamData.Type.TARGET; // return CommandParamData.Type.TARGET;
//
case BLOCK_POS: // case BLOCK_POS:
return CommandParamData.Type.BLOCK_POSITION; // return CommandParamData.Type.BLOCK_POSITION;
//
case COLUMN_POS: // case COLUMN_POS:
case VEC3: // case VEC3:
return CommandParamData.Type.POSITION; // return CommandParamData.Type.POSITION;
//
case MESSAGE: // case MESSAGE:
return CommandParamData.Type.MESSAGE; // return CommandParamData.Type.MESSAGE;
//
case NBT: // case NBT:
case NBT_COMPOUND_TAG: // case NBT_COMPOUND_TAG:
case NBT_TAG: // case NBT_TAG:
case NBT_PATH: // case NBT_PATH:
return CommandParamData.Type.JSON; // return CommandParamData.Type.JSON;
//
case RESOURCE_LOCATION: // case RESOURCE_LOCATION:
return CommandParamData.Type.FILE_PATH; // return CommandParamData.Type.FILE_PATH;
//
case INT_RANGE: // case INT_RANGE:
return CommandParamData.Type.INT_RANGE; // return CommandParamData.Type.INT_RANGE;
//
case BOOL: // case BOOL:
case DOUBLE: // case DOUBLE:
case STRING: // case STRING:
case VEC2: // case VEC2:
case BLOCK_STATE: // case BLOCK_STATE:
case BLOCK_PREDICATE: // case BLOCK_PREDICATE:
case ITEM_STACK: // case ITEM_STACK:
case ITEM_PREDICATE: // case ITEM_PREDICATE:
case COLOR: // case COLOR:
case COMPONENT: // case COMPONENT:
case OBJECTIVE: // case OBJECTIVE:
case OBJECTIVE_CRITERIA: // case OBJECTIVE_CRITERIA:
case OPERATION: // Possibly OPERATOR // case OPERATION: // Possibly OPERATOR
case PARTICLE: // case PARTICLE:
case ROTATION: // case ROTATION:
case SCOREBOARD_SLOT: // case SCOREBOARD_SLOT:
case SCORE_HOLDER: // case SCORE_HOLDER:
case SWIZZLE: // case SWIZZLE:
case TEAM: // case TEAM:
case ITEM_SLOT: // case ITEM_SLOT:
case MOB_EFFECT: // case MOB_EFFECT:
case FUNCTION: // case FUNCTION:
case ENTITY_ANCHOR: // case ENTITY_ANCHOR:
case RANGE: // case RANGE:
case FLOAT_RANGE: // case FLOAT_RANGE:
case ITEM_ENCHANTMENT: // case ITEM_ENCHANTMENT:
case ENTITY_SUMMON: // case ENTITY_SUMMON:
case DIMENSION: // case DIMENSION:
case TIME: // case TIME:
default: // default:
return CommandParamData.Type.STRING; // return CommandParamData.Type.STRING;
} // }
} // }
//
@Getter // @Getter
private class ParamInfo { // private class ParamInfo {
private CommandNode paramNode; // private CommandNode paramNode;
private CommandParamData paramData; // private CommandParamData paramData;
private List<ParamInfo> children; // private List<ParamInfo> children;
//
/** // /**
* Create a new parameter info object // * Create a new parameter info object
* // *
* @param paramNode CommandNode the parameter is for // * @param paramNode CommandNode the parameter is for
* @param paramData The existing parameters for the command // * @param paramData The existing parameters for the command
*/ // */
public ParamInfo(CommandNode paramNode, CommandParamData paramData) { // public ParamInfo(CommandNode paramNode, CommandParamData paramData) {
this.paramNode = paramNode; // this.paramNode = paramNode;
this.paramData = paramData; // this.paramData = paramData;
this.children = new ArrayList<>(); // this.children = new ArrayList<>();
} // }
//
/** // /**
* Build the array of all the child parameters (recursive) // * Build the array of all the child parameters (recursive)
* // *
* @param allNodes Every command node // * @param allNodes Every command node
*/ // */
public void buildChildren(CommandNode[] allNodes) { // public void buildChildren(CommandNode[] allNodes) {
int enumIndex = -1; // int enumIndex = -1;
//
for (int paramID : paramNode.getChildIndices()) { // for (int paramID : paramNode.getChildIndices()) {
CommandNode paramNode = allNodes[paramID]; // CommandNode paramNode = allNodes[paramID];
//
if (paramNode.getParser() == null) { // if (paramNode.getParser() == null) {
if (enumIndex == -1) { // if (enumIndex == -1) {
enumIndex = children.size(); // enumIndex = children.size();
//
// Create the new enum command // // Create the new enum command
CommandEnumData enumData = new CommandEnumData(paramNode.getName(), new String[] { paramNode.getName() }, false); // CommandEnumData enumData = new CommandEnumData(paramNode.getName(), new String[] { paramNode.getName() }, false);
children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), false, enumData, mapCommandType(paramNode.getParser()), null, Collections.emptyList()))); // children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), false, enumData, mapCommandType(paramNode.getParser()), null, Collections.emptyList())));
} else { // } else {
// Get the existing enum // // Get the existing enum
ParamInfo enumParamInfo = children.get(enumIndex); // ParamInfo enumParamInfo = children.get(enumIndex);
//
// Extend the current list of enum values // // Extend the current list of enum values
String[] enumOptions = Arrays.copyOf(enumParamInfo.getParamData().getEnumData().getValues(), enumParamInfo.getParamData().getEnumData().getValues().length + 1); // String[] enumOptions = Arrays.copyOf(enumParamInfo.getParamData().getEnumData().getValues(), enumParamInfo.getParamData().getEnumData().getValues().length + 1);
enumOptions[enumOptions.length - 1] = paramNode.getName(); // enumOptions[enumOptions.length - 1] = paramNode.getName();
//
// Re-create the command using the updated values // // Re-create the command using the updated values
CommandEnumData enumData = new CommandEnumData(enumParamInfo.getParamData().getEnumData().getName(), enumOptions, false); // CommandEnumData enumData = new CommandEnumData(enumParamInfo.getParamData().getEnumData().getName(), enumOptions, false);
children.set(enumIndex, new ParamInfo(enumParamInfo.getParamNode(), new CommandParamData(enumParamInfo.getParamData().getName(), false, enumData, enumParamInfo.getParamData().getType(), null, Collections.emptyList()))); // children.set(enumIndex, new ParamInfo(enumParamInfo.getParamNode(), new CommandParamData(enumParamInfo.getParamData().getName(), false, enumData, enumParamInfo.getParamData().getType(), null, Collections.emptyList())));
} // }
}else{ // }else{
// Put the non-enum param into the list // // Put the non-enum param into the list
children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList()))); // children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), false, null, mapCommandType(paramNode.getParser()), null, Collections.emptyList())));
} // }
} // }
//
// Recursively build all child options // // Recursively build all child options
for (ParamInfo child : children) { // for (ParamInfo child : children) {
child.buildChildren(allNodes); // child.buildChildren(allNodes);
} // }
} // }
//
/** // /**
* Get the tree of every parameter node (recursive) // * Get the tree of every parameter node (recursive)
* // *
* @return List of parameter options arrays for the command // * @return List of parameter options arrays for the command
*/ // */
public List<CommandParamData[]> getTree() { // public List<CommandParamData[]> getTree() {
List<CommandParamData[]> treeParamData = new ArrayList<>(); // List<CommandParamData[]> treeParamData = new ArrayList<>();
//
for (ParamInfo child : children) { // for (ParamInfo child : children) {
// Get the tree from the child // // Get the tree from the child
List<CommandParamData[]> childTree = child.getTree(); // List<CommandParamData[]> childTree = child.getTree();
//
// Un-pack the tree append the child node to it and push into the list // // Un-pack the tree append the child node to it and push into the list
for (CommandParamData[] subchild : childTree) { // for (CommandParamData[] subchild : childTree) {
CommandParamData[] tmpTree = new ArrayList<CommandParamData>() { // CommandParamData[] tmpTree = new ArrayList<CommandParamData>() {
{ // {
add(child.getParamData()); // add(child.getParamData());
addAll(Arrays.asList(subchild)); // addAll(Arrays.asList(subchild));
} // }
}.toArray(new CommandParamData[0]); // }.toArray(new CommandParamData[0]);
//
treeParamData.add(tmpTree); // treeParamData.add(tmpTree);
} // }
//
// If we have no more child parameters just the child // // If we have no more child parameters just the child
if (childTree.size() == 0) { // if (childTree.size() == 0) {
treeParamData.add(new CommandParamData[] { child.getParamData() }); // treeParamData.add(new CommandParamData[] { child.getParamData() });
} // }
} // }
//
return treeParamData; // return treeParamData;
} // }
} }
} }

Datei anzeigen

@ -31,9 +31,9 @@ import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData;
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData; import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareRecipesPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareRecipesPacket;
import com.nukkitx.nbt.tag.CompoundTag; import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.protocol.bedrock.data.CraftingData; import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.data.PotionMixData; import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket; import com.nukkitx.protocol.bedrock.packet.CraftingDataPacket;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.ints.IntSet;

Datei anzeigen

@ -61,7 +61,7 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
session.setGameMode(packet.getGamemode()); session.setGameMode(packet.getGamemode());
LevelEventPacket stopRainPacket = new LevelEventPacket(); LevelEventPacket stopRainPacket = new LevelEventPacket();
stopRainPacket.setType(LevelEventType.STOP_RAIN); stopRainPacket.setType(LevelEventType.STOP_RAINING);
stopRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000); stopRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000);
stopRainPacket.setPosition(Vector3f.ZERO); stopRainPacket.setPosition(Vector3f.ZERO);
session.sendUpstreamPacket(stopRainPacket); session.sendUpstreamPacket(stopRainPacket);

Datei anzeigen

@ -42,20 +42,20 @@ public class JavaTitleTranslator extends PacketTranslator<ServerTitlePacket> {
switch (packet.getAction()) { switch (packet.getAction()) {
case TITLE: case TITLE:
titlePacket.setType(SetTitlePacket.Type.SET_TITLE); titlePacket.setType(SetTitlePacket.Type.TITLE);
titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle())); titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle()));
break; break;
case SUBTITLE: case SUBTITLE:
titlePacket.setType(SetTitlePacket.Type.SET_SUBTITLE); titlePacket.setType(SetTitlePacket.Type.SUBTITLE);
titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle())); titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle()));
break; break;
case CLEAR: case CLEAR:
case RESET: case RESET:
titlePacket.setType(SetTitlePacket.Type.RESET_TITLE); titlePacket.setType(SetTitlePacket.Type.CLEAR);
titlePacket.setText(""); titlePacket.setText("");
break; break;
case ACTION_BAR: case ACTION_BAR:
titlePacket.setType(SetTitlePacket.Type.SET_ACTIONBAR_MESSAGE); titlePacket.setType(SetTitlePacket.Type.ACTIONBAR);
titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle())); titlePacket.setText(MessageUtils.getBedrockMessage(packet.getTitle()));
break; break;
case TIMES: case TIMES:

Datei anzeigen

@ -27,9 +27,9 @@
package org.geysermc.connector.network.translators.java.entity; package org.geysermc.connector.network.translators.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityAttachPacket;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityEventType; import com.nukkitx.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket; import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -63,7 +63,7 @@ public class JavaEntityAttachTranslator extends PacketTranslator<ServerEntityAtt
if ((attachedToId == null || packet.getAttachedToId() == 0)) { if ((attachedToId == null || packet.getAttachedToId() == 0)) {
// Is not being leashed // Is not being leashed
holderId.getMetadata().getFlags().setFlag(EntityFlag.LEASHED, false); holderId.getMetadata().getFlags().setFlag(EntityFlag.LEASHED, false);
holderId.getMetadata().put(EntityData.LEAD_HOLDER_EID, 0); holderId.getMetadata().put(EntityData.LEASH_HOLDER_EID, 0);
holderId.updateBedrockMetadata(session); holderId.updateBedrockMetadata(session);
EntityEventPacket eventPacket = new EntityEventPacket(); EntityEventPacket eventPacket = new EntityEventPacket();
eventPacket.setRuntimeEntityId(holderId.getGeyserId()); eventPacket.setRuntimeEntityId(holderId.getGeyserId());
@ -75,7 +75,7 @@ public class JavaEntityAttachTranslator extends PacketTranslator<ServerEntityAtt
} }
holderId.getMetadata().getFlags().setFlag(EntityFlag.LEASHED, true); holderId.getMetadata().getFlags().setFlag(EntityFlag.LEASHED, true);
holderId.getMetadata().put(EntityData.LEAD_HOLDER_EID, attachedToId.getGeyserId()); holderId.getMetadata().put(EntityData.LEASH_HOLDER_EID, attachedToId.getGeyserId());
holderId.updateBedrockMetadata(session); holderId.updateBedrockMetadata(session);
} }
} }

Datei anzeigen

@ -32,7 +32,7 @@ import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.Translator;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityEquipmentPacket;
import com.nukkitx.protocol.bedrock.data.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.connector.network.translators.item.ItemTranslator; import org.geysermc.connector.network.translators.item.ItemTranslator;
@Translator(packet = ServerEntityEquipmentPacket.class) @Translator(packet = ServerEntityEquipmentPacket.class)

Datei anzeigen

@ -27,9 +27,9 @@ package org.geysermc.connector.network.translators.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntitySetPassengersPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntitySetPassengersPacket;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityData; import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import com.nukkitx.protocol.bedrock.data.EntityLink; import com.nukkitx.protocol.bedrock.data.entity.EntityLinkData;
import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket; import com.nukkitx.protocol.bedrock.packet.SetEntityLinkPacket;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
@ -64,9 +64,9 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
continue; continue;
} }
EntityLink.Type type = rider ? EntityLink.Type.RIDER : EntityLink.Type.PASSENGER; EntityLinkData.Type type = rider ? EntityLinkData.Type.RIDER : EntityLinkData.Type.PASSENGER;
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
linkPacket.setEntityLink(new EntityLink(entity.getGeyserId(), passenger.getGeyserId(), type, false)); linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), type, false));
session.sendUpstreamPacket(linkPacket); session.sendUpstreamPacket(linkPacket);
passengers.add(passengerId); passengers.add(passengerId);
@ -95,7 +95,7 @@ public class JavaEntitySetPassengersTranslator extends PacketTranslator<ServerEn
} }
if (Arrays.stream(packet.getPassengerIds()).noneMatch(id -> id == passengerId)) { if (Arrays.stream(packet.getPassengerIds()).noneMatch(id -> id == passengerId)) {
SetEntityLinkPacket linkPacket = new SetEntityLinkPacket(); SetEntityLinkPacket linkPacket = new SetEntityLinkPacket();
linkPacket.setEntityLink(new EntityLink(entity.getGeyserId(), passenger.getGeyserId(), EntityLink.Type.REMOVE, false)); linkPacket.setEntityLink(new EntityLinkData(entity.getGeyserId(), passenger.getGeyserId(), EntityLinkData.Type.REMOVE, false));
session.sendUpstreamPacket(linkPacket); session.sendUpstreamPacket(linkPacket);
passengers.remove(passenger.getEntityId()); passengers.remove(passenger.getEntityId());

Datei anzeigen

@ -25,15 +25,14 @@
package org.geysermc.connector.network.translators.java.entity; package org.geysermc.connector.network.translators.java.entity;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
import com.nukkitx.protocol.bedrock.data.entity.EntityEventType;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.PacketTranslator;
import org.geysermc.connector.network.translators.Translator; import org.geysermc.connector.network.translators.Translator;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
import com.nukkitx.protocol.bedrock.data.EntityEventType;
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
@Translator(packet = ServerEntityStatusPacket.class) @Translator(packet = ServerEntityStatusPacket.class)
public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> { public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntityStatusPacket> {
@ -53,25 +52,25 @@ public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntitySta
entityEventPacket.setData(9); entityEventPacket.setData(9);
case LIVING_HURT: case LIVING_HURT:
case LIVING_HURT_SWEET_BERRY_BUSH: case LIVING_HURT_SWEET_BERRY_BUSH:
entityEventPacket.setType(EntityEventType.HURT_ANIMATION); entityEventPacket.setType(EntityEventType.HURT);
break; break;
case LIVING_DEATH: case LIVING_DEATH:
entityEventPacket.setType(EntityEventType.DEATH_ANIMATION); entityEventPacket.setType(EntityEventType.DEATH);
break; break;
case WOLF_SHAKE_WATER: case WOLF_SHAKE_WATER:
entityEventPacket.setType(EntityEventType.SHAKE_WET); entityEventPacket.setType(EntityEventType.SHAKE_WETNESS);
break; break;
case PLAYER_FINISH_USING_ITEM: case PLAYER_FINISH_USING_ITEM:
entityEventPacket.setType(EntityEventType.USE_ITEM); entityEventPacket.setType(EntityEventType.USE_ITEM);
break; break;
case FISHING_HOOK_PULL_PLAYER: case FISHING_HOOK_PULL_PLAYER:
entityEventPacket.setType(EntityEventType.FISH_HOOK_LURED); entityEventPacket.setType(EntityEventType.FISH_HOOK_TEASE); //TODO: CHECK
break; break;
case TAMEABLE_TAMING_FAILED: case TAMEABLE_TAMING_FAILED:
entityEventPacket.setType(EntityEventType.TAME_FAIL); entityEventPacket.setType(EntityEventType.TAME_FAILED);
break; break;
case TAMEABLE_TAMING_SUCCEEDED: case TAMEABLE_TAMING_SUCCEEDED:
entityEventPacket.setType(EntityEventType.TAME_SUCCESS); entityEventPacket.setType(EntityEventType.TAME_SUCCEEDED);
break; break;
case ZOMBIE_VILLAGER_CURE: case ZOMBIE_VILLAGER_CURE:
entityEventPacket.setType(EntityEventType.ZOMBIE_VILLAGER_CURE); entityEventPacket.setType(EntityEventType.ZOMBIE_VILLAGER_CURE);
@ -80,22 +79,22 @@ public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntitySta
entityEventPacket.setType(EntityEventType.LOVE_PARTICLES); entityEventPacket.setType(EntityEventType.LOVE_PARTICLES);
break; break;
case FIREWORK_EXPLODE: case FIREWORK_EXPLODE:
entityEventPacket.setType(EntityEventType.FIREWORK_PARTICLES); entityEventPacket.setType(EntityEventType.FIREWORK_EXPLODE);
break; break;
case WITCH_EMIT_PARTICLES: case WITCH_EMIT_PARTICLES:
entityEventPacket.setType(EntityEventType.WITCH_SPELL_PARTICLES); entityEventPacket.setType(EntityEventType.WITCH_HAT_MAGIC); //TODO: CHECK
break; break;
case TOTEM_OF_UNDYING_MAKE_SOUND: case TOTEM_OF_UNDYING_MAKE_SOUND:
entityEventPacket.setType(EntityEventType.CONSUME_TOTEM); entityEventPacket.setType(EntityEventType.CONSUME_TOTEM);
break; break;
case SHEEP_GRAZE_OR_TNT_CART_EXPLODE: case SHEEP_GRAZE_OR_TNT_CART_EXPLODE:
entityEventPacket.setType(EntityEventType.MINECART_TNT_PRIME_FUSE); entityEventPacket.setType(EntityEventType.PRIME_TNT_MINECART);
break; break;
case IRON_GOLEM_HOLD_POPPY: case IRON_GOLEM_HOLD_POPPY:
entityEventPacket.setType(EntityEventType.IRON_GOLEM_OFFER_FLOWER); entityEventPacket.setType(EntityEventType.GOLEM_FLOWER_OFFER);
break; break;
case IRON_GOLEM_EMPTY_HAND: case IRON_GOLEM_EMPTY_HAND:
entityEventPacket.setType(EntityEventType.IRON_GOLEM_WITHDRAW_FLOWER); entityEventPacket.setType(EntityEventType.GOLEM_FLOWER_WITHDRAW);
break; break;
} }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen