Bedrock 1.16 updating part 2 (Doesn't work)

This commit is contained in:
DoctorMacc 2020-06-22 21:21:42 -04:00
parent ea1a9e5427
commit 0471fa89f4
6 changed files with 10 additions and 9 deletions

View file

@ -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_v407.V392_CODEC; public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v407.V407_CODEC; // As of this time this is in a PR
public static final String NAME = "Geyser"; public static final String NAME = "Geyser";
public static final String VERSION = "1.0-SNAPSHOT (git-feature/1.16-56f9330)"; // A fallback for running in IDEs public static final String VERSION = "DEV"; // A fallback for running in IDEs
private final Map<InetSocketAddress, GeyserSession> players = new HashMap<>(); private final Map<InetSocketAddress, GeyserSession> players = new HashMap<>();

View file

@ -43,7 +43,7 @@ public class EndermanEntity extends MonsterEntity {
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
// Held block // Held block
if (entityMetadata.getId() == 15) { if (entityMetadata.getId() == 15) {
metadata.put(EntityData.ENDERMAN_HELD_ITEM_ID, BlockTranslator.getBedrockBlockId((int) entityMetadata.getValue())); metadata.put(EntityData.DISPLAY_ITEM, BlockTranslator.getBedrockBlockId((int) entityMetadata.getValue())); //TODO: Check
} }
// 'Angry' - mouth open // 'Angry' - mouth open
if (entityMetadata.getId() == 16) { if (entityMetadata.getId() == 16) {

View file

@ -28,6 +28,7 @@ package org.geysermc.connector.network.translators.bedrock;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerAbilitiesPacket;
import com.nukkitx.protocol.bedrock.data.AdventureSetting;
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket; import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
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;
@ -40,8 +41,8 @@ public class BedrockAdventureSettingsTranslator extends PacketTranslator<Adventu
public void translate(AdventureSettingsPacket packet, GeyserSession session) { public void translate(AdventureSettingsPacket packet, GeyserSession session) {
// Only canFly and flying are used by the server // Only canFly and flying are used by the server
// https://wiki.vg/Protocol#Player_Abilities_.28serverbound.29 // https://wiki.vg/Protocol#Player_Abilities_.28serverbound.29
boolean canFly = packet.getFlags().contains(AdventureSettingsPacket.Flag.MAY_FLY); boolean canFly = packet.getSettings().contains(AdventureSetting.MAY_FLY);
boolean flying = packet.getFlags().contains(AdventureSettingsPacket.Flag.FLYING); boolean flying = packet.getSettings().contains(AdventureSetting.FLYING);
boolean creative = session.getGameMode() == GameMode.CREATIVE; boolean creative = session.getGameMode() == GameMode.CREATIVE;
ClientPlayerAbilitiesPacket abilitiesPacket = new ClientPlayerAbilitiesPacket( ClientPlayerAbilitiesPacket abilitiesPacket = new ClientPlayerAbilitiesPacket(
false, canFly, flying, creative false, canFly, flying, creative

View file

@ -55,8 +55,8 @@ public class CraftingInventoryTranslator extends BaseInventoryTranslator {
@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.WORKBENCH.id()); containerOpenPacket.setType(ContainerType.WORKBENCH);
containerOpenPacket.setBlockPosition(inventory.getHolderPosition()); containerOpenPacket.setBlockPosition(inventory.getHolderPosition());
containerOpenPacket.setUniqueEntityId(inventory.getHolderId()); containerOpenPacket.setUniqueEntityId(inventory.getHolderId());
session.sendUpstreamPacket(containerOpenPacket); session.sendUpstreamPacket(containerOpenPacket);

View file

@ -50,7 +50,7 @@ public class JavaSpawnParticleTranslator extends PacketTranslator<ServerSpawnPar
LevelEventPacket particle = new LevelEventPacket(); LevelEventPacket particle = new LevelEventPacket();
switch (packet.getParticle().getType()) { switch (packet.getParticle().getType()) {
case BLOCK: case BLOCK:
particle.setType(LevelEventType.DESTROY); particle.setType(LevelEventType.PARTICLE_DESTROY_BLOCK);
particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ())); particle.setPosition(Vector3f.from(packet.getX(), packet.getY(), packet.getZ()));
particle.setData(BlockTranslator.getBedrockBlockId(((BlockParticleData) packet.getParticle().getData()).getBlockState())); particle.setData(BlockTranslator.getBedrockBlockId(((BlockParticleData) packet.getParticle().getData()).getBlockState()));
session.sendUpstreamPacket(particle); session.sendUpstreamPacket(particle);

View file

@ -50,7 +50,7 @@ public class FlowerPotBlockEntityTranslator implements BedrockOnlyBlockEntity, R
updateBlockPacket.setRuntimeId(BlockTranslator.getBedrockBlockId(blockState)); updateBlockPacket.setRuntimeId(BlockTranslator.getBedrockBlockId(blockState));
updateBlockPacket.setBlockPosition(position); updateBlockPacket.setBlockPosition(position);
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: Check
updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS); updateBlockPacket.getFlags().add(UpdateBlockPacket.Flag.NEIGHBORS);
session.sendUpstreamPacket(updateBlockPacket); session.sendUpstreamPacket(updateBlockPacket);
} }