Update to latest MCProtocolLib version

This commit is contained in:
RednedEpic 2019-10-13 15:28:03 -05:00 committed by RednedEpic
parent e815f58265
commit 5cf96ec5be
12 changed files with 20 additions and 20 deletions

View file

@ -105,7 +105,7 @@
<dependency> <dependency>
<groupId>com.github.steveice10</groupId> <groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId> <artifactId>mcprotocollib</artifactId>
<version>1.14.4-SNAPSHOT</version> <version>1.14.4-2-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>

View file

@ -65,7 +65,7 @@ public class ChunkCache {
Chunk chunk = column.getChunks()[position.getY() >> 4]; Chunk chunk = column.getChunks()[position.getY() >> 4];
Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ()); Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ());
if (chunk != null) { if (chunk != null) {
chunk.getBlocks().set(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ(), block); chunk.set(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ(), block);
} }
} }
@ -78,7 +78,7 @@ public class ChunkCache {
Chunk chunk = column.getChunks()[position.getY() >> 4]; Chunk chunk = column.getChunks()[position.getY() >> 4];
Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ()); Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ());
if (chunk != null) { if (chunk != null) {
BlockState blockState = chunk.getBlocks().get(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ()); BlockState blockState = chunk.get(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
return TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState); return TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState);
} }

View file

@ -68,10 +68,10 @@ public class ItemTranslator {
} }
ItemEntry bedrockItem = getItem(stack); ItemEntry bedrockItem = getItem(stack);
if (stack.getNBT() == null) { if (stack.getNbt() == null) {
return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount()); return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount());
} }
return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount(), translateToBedrockNBT(stack.getNBT())); return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount(), translateToBedrockNBT(stack.getNbt()));
} }
public ItemEntry getItem(ItemStack stack) { public ItemEntry getItem(ItemStack stack) {

View file

@ -14,11 +14,11 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
@Override @Override
public void translate(ServerBossBarPacket packet, GeyserSession session) { public void translate(ServerBossBarPacket packet, GeyserSession session) {
BossEventPacket bossEventPacket = new BossEventPacket(); BossEventPacket bossEventPacket = new BossEventPacket();
bossEventPacket.setBossUniqueEntityId(session.getEntityCache().getBossBar(packet.getUUID())); bossEventPacket.setBossUniqueEntityId(session.getEntityCache().getBossBar(packet.getUuid()));
switch (packet.getAction()) { switch (packet.getAction()) {
case ADD: case ADD:
long entityId = session.getEntityCache().addBossBar(packet.getUUID()); long entityId = session.getEntityCache().addBossBar(packet.getUuid());
addBossEntity(session, entityId); addBossEntity(session, entityId);
bossEventPacket.setType(BossEventPacket.Type.SHOW); bossEventPacket.setType(BossEventPacket.Type.SHOW);
@ -39,7 +39,7 @@ public class JavaBossBarTranslator extends PacketTranslator<ServerBossBarPacket>
break; break;
case REMOVE: case REMOVE:
bossEventPacket.setType(BossEventPacket.Type.HIDE); bossEventPacket.setType(BossEventPacket.Type.HIDE);
removeBossEntity(session, session.getEntityCache().removeBossBar(packet.getUUID())); removeBossEntity(session, session.getEntityCache().removeBossBar(packet.getUuid()));
break; break;
case UPDATE_STYLE: case UPDATE_STYLE:
case UPDATE_FLAGS: case UPDATE_FLAGS:

View file

@ -43,7 +43,7 @@ public class JavaTitleTranslator extends PacketTranslator<ServerTitlePacket> {
break; break;
case SUBTITLE: case SUBTITLE:
titlePacket.setType(SetTitlePacket.Type.SET_SUBTITLE); titlePacket.setType(SetTitlePacket.Type.SET_SUBTITLE);
titlePacket.setText(packet.getSubtitle().getFullText()); titlePacket.setText(packet.getTitle().getFullText());
break; break;
case CLEAR: case CLEAR:
case RESET: case RESET:
@ -52,7 +52,7 @@ public class JavaTitleTranslator extends PacketTranslator<ServerTitlePacket> {
break; break;
case ACTION_BAR: case ACTION_BAR:
titlePacket.setType(SetTitlePacket.Type.SET_ACTIONBAR_MESSAGE); titlePacket.setType(SetTitlePacket.Type.SET_ACTIONBAR_MESSAGE);
titlePacket.setText(packet.getActionBar().getFullText()); titlePacket.setText(packet.getTitle().getFullText());
break; break;
case TIMES: case TIMES:
titlePacket.setFadeInTime(packet.getFadeIn()); titlePacket.setFadeInTime(packet.getFadeIn());

View file

@ -41,7 +41,7 @@ public class JavaEntityPositionRotationTranslator extends PacketTranslator<Serve
} }
if (entity == null) return; if (entity == null) return;
entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), packet.getYaw(), packet.getPitch()); entity.moveRelative(packet.getMoveX(), packet.getMoveY(), packet.getMoveZ(), packet.getYaw(), packet.getPitch());
if (entity.isMovePending()) { if (entity.isMovePending()) {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();

View file

@ -41,7 +41,7 @@ public class JavaEntityPositionTranslator extends PacketTranslator<ServerEntityP
} }
if (entity == null) return; if (entity == null) return;
entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), entity.getRotation()); entity.moveRelative(packet.getMoveX(), packet.getMoveY(), packet.getMoveZ(), entity.getRotation());
if (entity.isMovePending()) { if (entity.isMovePending()) {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();

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.ServerEntityRotationPacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.ServerEntityRotationPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
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;
@ -41,7 +42,8 @@ public class JavaEntityRotationTranslator extends PacketTranslator<ServerEntityR
} }
if (entity == null) return; if (entity == null) return;
entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), packet.getYaw(), packet.getPitch()); // entity.moveRelative(packet.getMovementX(), packet.getMovementY(), packet.getMovementZ(), packet.getYaw(), packet.getPitch());
entity.setRotation(Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw()));
if (entity.isMovePending()) { if (entity.isMovePending()) {
MoveEntityAbsolutePacket moveEntityAbsolutePacket = new MoveEntityAbsolutePacket(); MoveEntityAbsolutePacket moveEntityAbsolutePacket = new MoveEntityAbsolutePacket();

View file

@ -39,7 +39,7 @@ public class JavaPlayerSetExperienceTranslator extends PacketTranslator<ServerPl
if (entity == null) if (entity == null)
return; return;
entity.getAttributes().put(AttributeType.EXPERIENCE, AttributeType.EXPERIENCE.getAttribute(packet.getSlot())); entity.getAttributes().put(AttributeType.EXPERIENCE, AttributeType.EXPERIENCE.getAttribute(packet.getExperience()));
entity.getAttributes().put(AttributeType.EXPERIENCE_LEVEL, AttributeType.EXPERIENCE_LEVEL.getAttribute(packet.getLevel())); entity.getAttributes().put(AttributeType.EXPERIENCE_LEVEL, AttributeType.EXPERIENCE_LEVEL.getAttribute(packet.getLevel()));
entity.updateBedrockAttributes(session); entity.updateBedrockAttributes(session);
} }

View file

@ -41,9 +41,9 @@ public class JavaSpawnPlayerTranslator extends PacketTranslator<ServerSpawnPlaye
Vector3f position = Vector3f.from(packet.getX(), packet.getY() - EntityType.PLAYER.getOffset(), packet.getZ()); Vector3f position = Vector3f.from(packet.getX(), packet.getY() - EntityType.PLAYER.getOffset(), packet.getZ());
Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw()); Vector3f rotation = Vector3f.from(packet.getYaw(), packet.getPitch(), packet.getYaw());
PlayerEntity entity = session.getEntityCache().getPlayerEntity(packet.getUUID()); PlayerEntity entity = session.getEntityCache().getPlayerEntity(packet.getUuid());
if (entity == null) { if (entity == null) {
Geyser.getLogger().error("Haven't received PlayerListEntry packet before spawning player! We ignore the player " + packet.getUUID()); Geyser.getLogger().error("Haven't received PlayerListEntry packet before spawning player! We ignore the player " + packet.getUuid());
return; return;
} }

View file

@ -34,7 +34,7 @@ public class JavaDisplayScoreboardTranslator extends PacketTranslator<ServerDisp
@Override @Override
public void translate(ServerDisplayScoreboardPacket packet, GeyserSession session) { public void translate(ServerDisplayScoreboardPacket packet, GeyserSession session) {
session.getScoreboardCache().getScoreboard().registerNewObjective( session.getScoreboardCache().getScoreboard().registerNewObjective(
packet.getScoreboardName(), packet.getPosition() packet.getName(), packet.getPosition()
); );
} }
} }

View file

@ -1,6 +1,5 @@
package org.geysermc.connector.utils; package org.geysermc.connector.utils;
import com.github.steveice10.mc.protocol.data.game.chunk.BlockStorage;
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk; import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
import com.github.steveice10.mc.protocol.data.game.chunk.Column; import com.github.steveice10.mc.protocol.data.game.chunk.Column;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState; import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
@ -26,13 +25,12 @@ public class ChunkUtils {
if (chunk == null || chunk.isEmpty()) if (chunk == null || chunk.isEmpty())
continue; continue;
BlockStorage storage = chunk.getBlocks();
ChunkSection section = chunkData.sections[chunkY]; ChunkSection section = chunkData.sections[chunkY];
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) { for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
BlockState blockState = storage.get(x, y, z); BlockState blockState = chunk.get(x, y, z);
BlockEntry block = TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState); BlockEntry block = TranslatorsInit.getBlockTranslator().getBedrockBlock(blockState);
section.getBlockStorageArray()[0].setFullBlock(ChunkSection.blockPosition(x, y, z), section.getBlockStorageArray()[0].setFullBlock(ChunkSection.blockPosition(x, y, z),