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

Fix block break particles not displaying in survival

Dieser Commit ist enthalten in:
RednedEpic 2020-04-29 15:47:29 -05:00
Ursprung 1fbb755d26
Commit 364aac7e1a
2 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -118,7 +118,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
case 2: case 2:
BlockState blockState = session.getChunkCache().getBlockAt(new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ())); BlockState blockState = session.getChunkCache().getBlockAt(new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()));
double blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(blockState.getId()); double blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(blockState.getId());
if (session.getGameMode() == GameMode.CREATIVE || blockHardness == 0) { if (session.getGameMode() == GameMode.CREATIVE || (session.getConnector().getConfig().isCacheChunks() && blockHardness == 0)) {
session.setLastBlockPlacedId(null); session.setLastBlockPlacedId(null);
session.setLastBlockPlacePosition(null); session.setLastBlockPlacePosition(null);

Datei anzeigen

@ -48,9 +48,9 @@ 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(); LevelEventPacket levelEvent = new LevelEventPacket();
double blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(packet.getNewState().getId());
switch (packet.getAction()) { switch (packet.getAction()) {
case FINISH_DIGGING: case FINISH_DIGGING:
double blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(session.getBreakingBlock() == null ? 0 : session.getBreakingBlock().getId());
if (session.getGameMode() != GameMode.CREATIVE && blockHardness != 0) { if (session.getGameMode() != GameMode.CREATIVE && blockHardness != 0) {
levelEvent.setType(LevelEventType.DESTROY); levelEvent.setType(LevelEventType.DESTROY);
levelEvent.setPosition(Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ())); levelEvent.setPosition(Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()));
@ -61,6 +61,7 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition()); ChunkUtils.updateBlock(session, packet.getNewState(), packet.getPosition());
break; break;
case START_DIGGING: case START_DIGGING:
blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(packet.getNewState().getId());
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(),