Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01: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:
Ursprung
ad596cdccb
Commit
0ac4789f2c
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
package org.geysermc.connector.network.translators.java.world;
|
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.math.vector.Vector3i;
|
||||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||||
import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket;
|
import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket;
|
||||||
@ -42,9 +43,13 @@ public class JavaBlockChangeTranslator extends PacketTranslator<ServerBlockChang
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerBlockChangePacket packet, GeyserSession session) {
|
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());
|
ChunkUtils.updateBlock(session, packet.getRecord().getBlock(), packet.getRecord().getPosition());
|
||||||
|
if (updatePlacement) {
|
||||||
|
this.checkPlace(session, packet);
|
||||||
|
}
|
||||||
this.checkInteract(session, packet);
|
this.checkInteract(session, packet);
|
||||||
this.checkPlace(session, packet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkPlace(GeyserSession session, ServerBlockChangePacket packet) {
|
private boolean checkPlace(GeyserSession session, ServerBlockChangePacket packet) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren