Fix block break particles not displaying in survival

This commit is contained in:
RednedEpic 2020-04-29 15:47:29 -05:00
parent 1fbb755d26
commit 364aac7e1a
2 changed files with 3 additions and 2 deletions

View file

@ -118,7 +118,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
case 2:
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());
if (session.getGameMode() == GameMode.CREATIVE || blockHardness == 0) {
if (session.getGameMode() == GameMode.CREATIVE || (session.getConnector().getConfig().isCacheChunks() && blockHardness == 0)) {
session.setLastBlockPlacedId(null);
session.setLastBlockPlacePosition(null);

View file

@ -48,9 +48,9 @@ public class JavaPlayerActionAckTranslator extends PacketTranslator<ServerPlayer
@Override
public void translate(ServerPlayerActionAckPacket packet, GeyserSession session) {
LevelEventPacket levelEvent = new LevelEventPacket();
double blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(packet.getNewState().getId());
switch (packet.getAction()) {
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) {
levelEvent.setType(LevelEventType.DESTROY);
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());
break;
case START_DIGGING:
blockHardness = BlockTranslator.JAVA_RUNTIME_ID_TO_HARDNESS.get(packet.getNewState().getId());
levelEvent.setType(LevelEventType.BLOCK_START_BREAK);
levelEvent.setPosition(Vector3f.from(
packet.getPosition().getX(),