Update to NukkitX Protocol Lib 2.5.0 release

This commit is contained in:
RednedEpic 2020-02-14 17:39:26 -06:00
parent bf90b803ca
commit 4186715083
9 changed files with 32 additions and 34 deletions

View file

@ -67,7 +67,7 @@
<dependency> <dependency>
<groupId>com.nukkitx.protocol</groupId> <groupId>com.nukkitx.protocol</groupId>
<artifactId>bedrock-v389</artifactId> <artifactId>bedrock-v389</artifactId>
<version>2.4.6-SNAPSHOT</version> <version>2.5.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View file

@ -192,11 +192,6 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
return defaultHandler(packet); return defaultHandler(packet);
} }
@Override
public boolean handle(LevelSoundEvent3Packet packet) {
return defaultHandler(packet);
}
@Override @Override
public boolean handle(MapInfoRequestPacket packet) { public boolean handle(MapInfoRequestPacket packet) {
return defaultHandler(packet); return defaultHandler(packet);

View file

@ -44,7 +44,7 @@ import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.nbt.tag.CompoundTag; import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.protocol.bedrock.BedrockServerSession; import com.nukkitx.protocol.bedrock.BedrockServerSession;
import com.nukkitx.protocol.bedrock.data.GamePublishSetting; import com.nukkitx.protocol.bedrock.data.GamePublishSetting;
import com.nukkitx.protocol.bedrock.data.GameRule; import com.nukkitx.protocol.bedrock.data.GameRuleData;
import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.data.PlayerPermission;
import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.packet.*;
import lombok.Getter; import lombok.Getter;
@ -297,7 +297,7 @@ public class GeyserSession implements Player {
startGamePacket.setLightningLevel(0); startGamePacket.setLightningLevel(0);
startGamePacket.setMultiplayerGame(true); startGamePacket.setMultiplayerGame(true);
startGamePacket.setBroadcastingToLan(true); startGamePacket.setBroadcastingToLan(true);
startGamePacket.getGamerules().add(new GameRule<>("showcoordinates", true)); startGamePacket.getGamerules().add(new GameRuleData<>("showcoordinates", true));
startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC); startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC); startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setCommandsEnabled(true); startGamePacket.setCommandsEnabled(true);

View file

@ -36,11 +36,11 @@ public class BedrockRespawnTranslator extends PacketTranslator<RespawnPacket> {
@Override @Override
public void translate(RespawnPacket packet, GeyserSession session) { public void translate(RespawnPacket packet, GeyserSession session) {
if (packet.getSpawnState() == RespawnPacket.State.CLIENT_READY) { if (packet.getState() == RespawnPacket.State.CLIENT_READY) {
RespawnPacket respawnPacket = new RespawnPacket(); RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(0); respawnPacket.setRuntimeEntityId(0);
respawnPacket.setPosition(Vector3f.ZERO); respawnPacket.setPosition(Vector3f.ZERO);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_SEARCHING); respawnPacket.setState(RespawnPacket.State.SERVER_SEARCHING);
session.getUpstream().sendPacket(respawnPacket); session.getUpstream().sendPacket(respawnPacket);
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN); ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);

View file

@ -67,8 +67,8 @@ public class GenericInventoryTranslator extends InventoryTranslator {
public void updateSlot(GeyserSession session, Inventory inventory, int slot) { public void updateSlot(GeyserSession session, Inventory inventory, int slot) {
InventorySlotPacket slotPacket = new InventorySlotPacket(); InventorySlotPacket slotPacket = new InventorySlotPacket();
slotPacket.setContainerId(inventory.getId()); slotPacket.setContainerId(inventory.getId());
slotPacket.setSlot(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItems()[slot])); slotPacket.setItem(TranslatorsInit.getItemTranslator().translateToBedrock(inventory.getItems()[slot]));
slotPacket.setInventorySlot(slot); slotPacket.setSlot(slot);
session.getUpstream().sendPacket(slotPacket); session.getUpstream().sendPacket(slotPacket);
} }
} }

View file

@ -26,6 +26,7 @@
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.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityStatusPacket;
import com.nukkitx.protocol.bedrock.data.EntityEventType;
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;
@ -47,48 +48,48 @@ public class JavaEntityStatusTranslator extends PacketTranslator<ServerEntitySta
switch (packet.getStatus()) { switch (packet.getStatus()) {
case LIVING_HURT: case LIVING_HURT:
case LIVING_HURT_SWEET_BERRY_BUSH: case LIVING_HURT_SWEET_BERRY_BUSH:
entityEventPacket.setEvent(EntityEventPacket.Event.HURT_ANIMATION); entityEventPacket.setType(EntityEventType.HURT_ANIMATION);
break; break;
case LIVING_DEATH: case LIVING_DEATH:
entityEventPacket.setEvent(EntityEventPacket.Event.DEATH_ANIMATION); entityEventPacket.setType(EntityEventType.DEATH_ANIMATION);
break; break;
case WOLF_SHAKE_WATER: case WOLF_SHAKE_WATER:
entityEventPacket.setEvent(EntityEventPacket.Event.SHAKE_WET); entityEventPacket.setType(EntityEventType.SHAKE_WET);
break; break;
case PLAYER_FINISH_USING_ITEM: case PLAYER_FINISH_USING_ITEM:
entityEventPacket.setEvent(EntityEventPacket.Event.USE_ITEM); entityEventPacket.setType(EntityEventType.USE_ITEM);
break; break;
case FISHING_HOOK_PULL_PLAYER: case FISHING_HOOK_PULL_PLAYER:
entityEventPacket.setEvent(EntityEventPacket.Event.FISH_HOOK_LURED); entityEventPacket.setType(EntityEventType.FISH_HOOK_LURED);
break; break;
case TAMEABLE_TAMING_FAILED: case TAMEABLE_TAMING_FAILED:
entityEventPacket.setEvent(EntityEventPacket.Event.TAME_FAIL); entityEventPacket.setType(EntityEventType.TAME_FAIL);
break; break;
case TAMEABLE_TAMING_SUCCEEDED: case TAMEABLE_TAMING_SUCCEEDED:
entityEventPacket.setEvent(EntityEventPacket.Event.TAME_SUCCESS); entityEventPacket.setType(EntityEventType.TAME_SUCCESS);
case ZOMBIE_VILLAGER_CURE: case ZOMBIE_VILLAGER_CURE:
entityEventPacket.setEvent(EntityEventPacket.Event.ZOMBIE_VILLAGER_CURE); entityEventPacket.setType(EntityEventType.ZOMBIE_VILLAGER_CURE);
break; break;
case ANIMAL_EMIT_HEARTS: case ANIMAL_EMIT_HEARTS:
entityEventPacket.setEvent(EntityEventPacket.Event.LOVE_PARTICLES); entityEventPacket.setType(EntityEventType.LOVE_PARTICLES);
break; break;
case FIREWORK_EXPLODE: case FIREWORK_EXPLODE:
entityEventPacket.setEvent(EntityEventPacket.Event.FIREWORK_PARTICLES); entityEventPacket.setType(EntityEventType.FIREWORK_PARTICLES);
break; break;
case WITCH_EMIT_PARTICLES: case WITCH_EMIT_PARTICLES:
entityEventPacket.setEvent(EntityEventPacket.Event.WITCH_SPELL_PARTICLES); entityEventPacket.setType(EntityEventType.WITCH_SPELL_PARTICLES);
break; break;
case TOTEM_OF_UNDYING_MAKE_SOUND: case TOTEM_OF_UNDYING_MAKE_SOUND:
entityEventPacket.setEvent(EntityEventPacket.Event.CONSUME_TOTEM); entityEventPacket.setType(EntityEventType.CONSUME_TOTEM);
break; break;
case SHEEP_GRAZE_OR_TNT_CART_EXPLODE: case SHEEP_GRAZE_OR_TNT_CART_EXPLODE:
entityEventPacket.setEvent(EntityEventPacket.Event.MINECART_TNT_PRIME_FUSE); entityEventPacket.setType(EntityEventType.MINECART_TNT_PRIME_FUSE);
break; break;
case IRON_GOLEM_HOLD_POPPY: case IRON_GOLEM_HOLD_POPPY:
entityEventPacket.setEvent(EntityEventPacket.Event.IRON_GOLEM_OFFER_FLOWER); entityEventPacket.setType(EntityEventType.IRON_GOLEM_OFFER_FLOWER);
break; break;
case IRON_GOLEM_EMPTY_HAND: case IRON_GOLEM_EMPTY_HAND:
entityEventPacket.setEvent(EntityEventPacket.Event.IRON_GOLEM_WITHDRAW_FLOWER); entityEventPacket.setType(EntityEventType.IRON_GOLEM_WITHDRAW_FLOWER);
break; break;
} }

View file

@ -28,6 +28,7 @@ package org.geysermc.connector.network.translators.java.entity.player;
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityEventType;
import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.packet.*;
import org.geysermc.connector.console.GeyserLogger; import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
@ -53,12 +54,12 @@ public class JavaPlayerPositionRotationTranslator extends PacketTranslator<Serve
RespawnPacket respawnPacket = new RespawnPacket(); RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(0); respawnPacket.setRuntimeEntityId(0);
respawnPacket.setPosition(pos); respawnPacket.setPosition(pos);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_READY); respawnPacket.setState(RespawnPacket.State.SERVER_READY);
session.getUpstream().sendPacket(respawnPacket); session.getUpstream().sendPacket(respawnPacket);
EntityEventPacket eventPacket = new EntityEventPacket(); EntityEventPacket eventPacket = new EntityEventPacket();
eventPacket.setRuntimeEntityId(entity.getGeyserId()); eventPacket.setRuntimeEntityId(entity.getGeyserId());
eventPacket.setEvent(EntityEventPacket.Event.RESPAWN); eventPacket.setType(EntityEventType.RESPAWN);
eventPacket.setData(0); eventPacket.setData(0);
session.getUpstream().sendPacket(eventPacket); session.getUpstream().sendPacket(eventPacket);

View file

@ -33,6 +33,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotify
import com.nukkitx.math.vector.Vector3f; import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityDataMap; import com.nukkitx.protocol.bedrock.data.EntityDataMap;
import com.nukkitx.protocol.bedrock.data.EntityFlag; import com.nukkitx.protocol.bedrock.data.EntityFlag;
import com.nukkitx.protocol.bedrock.data.LevelEventType;
import com.nukkitx.protocol.bedrock.data.PlayerPermission; import com.nukkitx.protocol.bedrock.data.PlayerPermission;
import com.nukkitx.protocol.bedrock.packet.*; import com.nukkitx.protocol.bedrock.packet.*;
import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.Entity;
@ -54,14 +55,14 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
switch (packet.getNotification()) { switch (packet.getNotification()) {
case START_RAIN: case START_RAIN:
LevelEventPacket startRainPacket = new LevelEventPacket(); LevelEventPacket startRainPacket = new LevelEventPacket();
startRainPacket.setEvent(LevelEventPacket.Event.START_RAIN); startRainPacket.setType(LevelEventType.START_RAIN);
startRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000); startRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000);
startRainPacket.setPosition(Vector3f.ZERO); startRainPacket.setPosition(Vector3f.ZERO);
session.getUpstream().sendPacket(startRainPacket); session.getUpstream().sendPacket(startRainPacket);
break; break;
case STOP_RAIN: case STOP_RAIN:
LevelEventPacket stopRainPacket = new LevelEventPacket(); LevelEventPacket stopRainPacket = new LevelEventPacket();
stopRainPacket.setEvent(LevelEventPacket.Event.STOP_RAIN); stopRainPacket.setType(LevelEventType.STOP_RAIN);
stopRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000); stopRainPacket.setData(ThreadLocalRandom.current().nextInt(50000) + 10000);
stopRainPacket.setPosition(Vector3f.ZERO); stopRainPacket.setPosition(Vector3f.ZERO);
session.getUpstream().sendPacket(stopRainPacket); session.getUpstream().sendPacket(stopRainPacket);

View file

@ -123,10 +123,10 @@ public class Toolbox {
bedrockLoop: bedrockLoop:
for (CompoundTag bedrockEntry : BLOCKS.getValue()) { for (CompoundTag bedrockEntry : BLOCKS.getValue()) {
bedrockIndex++; bedrockIndex++;
CompoundTag blockTag = bedrockEntry.getAsCompound("block"); CompoundTag blockTag = bedrockEntry.getCompound("block");
if (blockTag.getAsString("name").equals(wantedIdentifier)) { if (blockTag.getString("name").equals(wantedIdentifier)) {
if (wantedStates != null) { if (wantedStates != null) {
Map<String, Tag<?>> bedrockStates = blockTag.getAsCompound("states").getValue(); Map<String, Tag<?>> bedrockStates = blockTag.getCompound("states").getValue();
for (Map.Entry<String, Object> stateEntry : wantedStates.entrySet()) { for (Map.Entry<String, Object> stateEntry : wantedStates.entrySet()) {
Tag<?> bedrockStateTag = bedrockStates.get(stateEntry.getKey()); Tag<?> bedrockStateTag = bedrockStates.get(stateEntry.getKey());
if (bedrockStateTag == null) if (bedrockStateTag == null)