3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-07-30 00:58:13 +02:00

Don't send sound updates if block of the same type already exists in placing position

This prevents the block place sound (most notably buttons or blocks that don't occupy one whole block) from spamming the client if they have their place button held down.
Dieser Commit ist enthalten in:
RednedEpic 2020-04-30 00:45:27 -05:00
Ursprung ad596cdccb
Commit 0ac4789f2c

Datei anzeigen

@ -25,6 +25,7 @@
package org.geysermc.connector.network.translators.java.world;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.nukkitx.math.vector.Vector3i;
import com.nukkitx.protocol.bedrock.data.SoundEvent;
import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket;
@ -42,9 +43,13 @@ public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChang
@Override
public void translate(ServerBlockChangePacket packet, GeyserSession session) {
Position pos = packet.getRecord().getPosition();
boolean updatePlacement = !(session.getConnector().getConfig().isCacheChunks() && session.getConnector().getWorldManager().getBlockAt(session, pos.getX(), pos.getY(), pos.getZ()).getId() == packet.getRecord().getBlock().getId());
ChunkUtils.updateBlock(session, packet.getRecord().getBlock(), packet.getRecord().getPosition());
if (updatePlacement) {
this.checkPlace(session, packet);
}
this.checkInteract(session, packet);
this.checkPlace(session, packet);
}
private boolean checkPlace(GeyserSession session, ServerBlockChangePacket packet) {