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 final EntityEffectCache effectCache;
public PlayerEntity(GameProfile gameProfile, long entityId, long geyserId, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, EntityType.PLAYER, position, motion, rotation);

View file

@ -44,13 +44,13 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
@Override
public void translate(ServerPlayerActionAckPacket packet, GeyserSession session) {
LevelEventPacket levelEvent = new LevelEventPacket();
switch (packet.getAction()) {
case FINISH_DIGGING:
ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition());
break;
case START_DIGGING: {
LevelEventPacket levelEvent = new LevelEventPacket();
case START_DIGGING:
levelEvent.setType(LevelEventType.BLOCK_START_BREAK);
levelEvent.setPosition(Vector3f.from(
packet.getPosition().getX(),
@ -67,14 +67,11 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
nbtData = item.getNbt();
}
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));
session.getUpstream().sendPacket(levelEvent);
break;
}
case CANCEL_DIGGING: {
LevelEventPacket levelEvent = new LevelEventPacket();
case CANCEL_DIGGING:
levelEvent.setType(LevelEventType.BLOCK_STOP_BREAK);
levelEvent.setPosition(Vector3f.from(
packet.getPosition().getX(),
@ -87,6 +84,5 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
}
}
}
}