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

Update to NukkitX Protocol Lib 2.5.0 release

Dieser Commit ist enthalten in:
RednedEpic 2020-02-14 17:39:26 -06:00
Ursprung bf90b803ca
Commit 4186715083
9 geänderte Dateien mit 32 neuen und 34 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -36,11 +36,11 @@ public class BedrockRespawnTranslator extends PacketTranslator<RespawnPacket> {
@Override
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.setRuntimeEntityId(0);
respawnPacket.setPosition(Vector3f.ZERO);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_SEARCHING);
respawnPacket.setState(RespawnPacket.State.SERVER_SEARCHING);
session.getUpstream().sendPacket(respawnPacket);
ClientRequestPacket javaRespawnPacket = new ClientRequestPacket(ClientRequest.RESPAWN);

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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.server.entity.player.ServerPlayerPositionRotationPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.EntityEventType;
import com.nukkitx.protocol.bedrock.packet.*;
import org.geysermc.connector.console.GeyserLogger;
import org.geysermc.connector.entity.Entity;
@ -53,12 +54,12 @@ public class JavaPlayerPositionRotationTranslator extends PacketTranslator<Serve
RespawnPacket respawnPacket = new RespawnPacket();
respawnPacket.setRuntimeEntityId(0);
respawnPacket.setPosition(pos);
respawnPacket.setSpawnState(RespawnPacket.State.SERVER_READY);
respawnPacket.setState(RespawnPacket.State.SERVER_READY);
session.getUpstream().sendPacket(respawnPacket);
EntityEventPacket eventPacket = new EntityEventPacket();
eventPacket.setRuntimeEntityId(entity.getGeyserId());
eventPacket.setEvent(EntityEventPacket.Event.RESPAWN);
eventPacket.setType(EntityEventType.RESPAWN);
eventPacket.setData(0);
session.getUpstream().sendPacket(eventPacket);

Datei anzeigen

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

Datei anzeigen

@ -123,10 +123,10 @@ public class Toolbox {
bedrockLoop:
for (CompoundTag bedrockEntry : BLOCKS.getValue()) {
bedrockIndex++;
CompoundTag blockTag = bedrockEntry.getAsCompound("block");
if (blockTag.getAsString("name").equals(wantedIdentifier)) {
CompoundTag blockTag = bedrockEntry.getCompound("block");
if (blockTag.getString("name").equals(wantedIdentifier)) {
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()) {
Tag<?> bedrockStateTag = bedrockStates.get(stateEntry.getKey());
if (bedrockStateTag == null)