3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-03 14:50:19 +01:00

Add requested changes

Dieser Commit ist enthalten in:
William Johnstone 2020-03-28 16:03:09 +00:00
Ursprung 20e6c7fcbf
Commit eb707a71df
2 geänderte Dateien mit 3 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -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);

Datei anzeigen

@ -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(),
@ -84,7 +81,6 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
levelEvent.setData(0); levelEvent.setData(0);
session.getUpstream().sendPacket(levelEvent); session.getUpstream().sendPacket(levelEvent);
break; break;
}
} }
} }
} }