Add requested changes

This commit is contained in:
William Johnstone 2020-03-28 16:03:09 +00:00
parent 20e6c7fcbf
commit eb707a71df
2 changed files with 3 additions and 8 deletions

View file

@ -53,7 +53,6 @@ public class PlayerEntity extends LivingEntity {
private boolean playerList = true; private boolean playerList = true;
private final EntityEffectCache effectCache; private final EntityEffectCache effectCache;
public PlayerEntity(GameProfile gameProfile, long entityId, long geyserId, Vector3f position, Vector3f motion, Vector3f rotation) { public PlayerEntity(GameProfile gameProfile, long entityId, long geyserId, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation); super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation);

View file

@ -44,13 +44,13 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
@Override @Override
public void translate(ServerPlayerActionAckPacket packet, GeyserSession session) { public void translate(ServerPlayerActionAckPacket packet, GeyserSession session) {
LevelEventPacket levelEvent = new LevelEventPacket();
switch (packet.getAction()) { switch (packet.getAction()) {
case FINISH_DIGGING: case FINISH_DIGGING:
ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition());
break; break;
case START_DIGGING: { case START_DIGGING:
LevelEventPacket levelEvent = new LevelEventPacket();
levelEvent.setType(LevelEventType.BLOCK_START_BREAK); levelEvent.setType(LevelEventType.BLOCK_START_BREAK);
levelEvent.setPosition(Vector3f.from( levelEvent.setPosition(Vector3f.from(
packet.getPosition().getX(), packet.getPosition().getX(),
@ -67,14 +67,11 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
nbtData = item.getNbt(); nbtData = item.getNbt();
} }
double breakTime = Math.ceil(BlockUtils.getBreakTime(blockHardness, packet.getNewState().getId(), itemEntry, nbtData, session.getPlayerEntity()) * 20); double breakTime = Math.ceil(BlockUtils.getBreakTime(blockHardness, packet.getNewState().getId(), itemEntry, nbtData, session.getPlayerEntity()) * 20);
int data = (int) (65535 / breakTime);
levelEvent.setData((int) (65535 / breakTime)); levelEvent.setData((int) (65535 / breakTime));
session.getUpstream().sendPacket(levelEvent); session.getUpstream().sendPacket(levelEvent);
break; break;
}
case CANCEL_DIGGING: { case CANCEL_DIGGING:
LevelEventPacket levelEvent = new LevelEventPacket();
levelEvent.setType(LevelEventType.BLOCK_STOP_BREAK); levelEvent.setType(LevelEventType.BLOCK_STOP_BREAK);
levelEvent.setPosition(Vector3f.from( levelEvent.setPosition(Vector3f.from(
packet.getPosition().getX(), packet.getPosition().getX(),
@ -87,6 +84,5 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
} }
} }
} }
}