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>
<groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.14.4-SNAPSHOT</version>
<version>1.14.4-2-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>

View File

@ -65,7 +65,7 @@ public class ChunkCache {
Chunk chunk = column.getChunks()[position.getY() >> 4];
Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ());
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];
Position blockPosition = chunkPosition.getChunkBlock(position.getX(), position.getY(), position.getZ());
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);
}

View File

@ -68,10 +68,10 @@ public class ItemTranslator {
}
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(), translateToBedrockNBT(stack.getNBT()));
return ItemData.of(bedrockItem.getBedrockId(), (short) bedrockItem.getBedrockData(), stack.getAmount(), translateToBedrockNBT(stack.getNbt()));
}
public ItemEntry getItem(ItemStack stack) {

View File

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

View File

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

View File

@ -41,7 +41,7 @@ public class JavaEntityPositionRotationTranslator extends PacketTranslator<Serve
}
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()) {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();

View File

@ -41,7 +41,7 @@ public class JavaEntityPositionTranslator extends PacketTranslator<ServerEntityP
}
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()) {
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();

View File

@ -26,6 +26,7 @@
package org.geysermc.connector.network.translators.java.entity;
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 org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
@ -41,7 +42,8 @@ public class JavaEntityRotationTranslator extends PacketTranslator<ServerEntityR
}
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()) {
MoveEntityAbsolutePacket moveEntityAbsolutePacket = new MoveEntityAbsolutePacket();

View File

@ -39,7 +39,7 @@ public class JavaPlayerSetExperienceTranslator extends PacketTranslator<ServerPl
if (entity == null)
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.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 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) {
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;
}

View File

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

View File

@ -1,6 +1,5 @@
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.Column;
import com.github.steveice10.mc.protocol.data.game.world.block.BlockState;
@ -26,13 +25,12 @@ public class ChunkUtils {
if (chunk == null || chunk.isEmpty())
continue;
BlockStorage storage = chunk.getBlocks();
ChunkSection section = chunkData.sections[chunkY];
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
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);
section.getBlockStorageArray()[0].setFullBlock(ChunkSection.blockPosition(x, y, z),