From 434a2e15001c8b1bc8ce31912b30086fd87dea82 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+DoctorMacc@users.noreply.github.com> Date: Thu, 5 Nov 2020 14:59:01 -0500 Subject: [PATCH] Fix bell sound and visuals (#1502) * Fix bell sound and visuals The bell sound now correctly plays. Bells will also visually ring when rung by another player. * Compress elses * Add more whitespace to new code --- .../java/world/JavaBlockValueTranslator.java | 51 +++++++++++++++---- connector/src/main/resources/languages | 2 +- connector/src/main/resources/mappings | 2 +- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java index 3d3df51c..903cad0c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaBlockValueTranslator.java @@ -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.github.steveice10.mc.protocol.data.game.world.block.value.*; import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerBlockValuePacket; import com.nukkitx.math.vector.Vector3i; @@ -53,16 +54,12 @@ public class JavaBlockValueTranslator extends PacketTranslator 0 ? 1 : 0); session.sendUpstreamPacket(blockEventPacket); - } - if (packet.getValue() instanceof EndGatewayValue) { + } else if (packet.getValue() instanceof EndGatewayValue) { blockEventPacket.setEventType(1); session.sendUpstreamPacket(blockEventPacket); - } - if (packet.getValue() instanceof NoteBlockValue) { + } else if (packet.getValue() instanceof NoteBlockValue) { NoteblockBlockEntityTranslator.translate(session, packet.getPosition()); - return; - } - if (packet.getValue() instanceof PistonValue) { + } else if (packet.getValue() instanceof PistonValue) { PistonValueType type = (PistonValueType) packet.getType(); // Unlike everything else, pistons need a block entity packet to convey motion @@ -73,14 +70,46 @@ public class JavaBlockValueTranslator extends PacketTranslator