mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix block break particles not displaying in survival
This commit is contained in:
parent
1fbb755d26
commit
364aac7e1a
2 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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(),
|
||||||
|
|
Loading…
Reference in a new issue