mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Don't hardcode the bell block ID
This commit is contained in:
parent
f53c0cf73f
commit
139167d090
2 changed files with 13 additions and 3 deletions
|
@ -36,6 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.BlockEventPacket;
|
|||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
|
||||
import org.geysermc.connector.network.translators.world.block.entity.NoteblockBlockEntityTranslator;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -76,8 +77,7 @@ public class JavaBlockValueTranslator extends PacketTranslator<ServerBlockValueP
|
|||
} else if (packet.getValue() instanceof EndGatewayValue) {
|
||||
blockEventPacket.setEventType(1);
|
||||
session.sendUpstreamPacket(blockEventPacket);
|
||||
} else if (packet.getValue() instanceof GenericBlockValue && packet.getBlockId() == 677) {
|
||||
// TODO: Remove hardcode? Remove hardcodes for all of these? (EndGatewayValue for example still hardcodes the block)
|
||||
} else if (packet.getValue() instanceof GenericBlockValue && packet.getBlockId() == BlockTranslator.JAVA_BELL_BLOCK_ID) {
|
||||
// Bells - needed to show ring from other players
|
||||
GenericBlockValue bellValue = (GenericBlockValue) packet.getValue();
|
||||
Position position = packet.getPosition();
|
||||
|
|
|
@ -89,6 +89,7 @@ public abstract class BlockTranslator {
|
|||
private final EmptyChunkProvider emptyChunkProvider;
|
||||
|
||||
public static final int JAVA_COBWEB_BLOCK_ID;
|
||||
public static final int JAVA_BELL_BLOCK_ID;
|
||||
|
||||
public static final int JAVA_RUNTIME_FURNACE_ID;
|
||||
public static final int JAVA_RUNTIME_FURNACE_LIT_ID;
|
||||
|
@ -115,6 +116,7 @@ public abstract class BlockTranslator {
|
|||
}
|
||||
|
||||
int javaRuntimeId = -1;
|
||||
int bellBlockId = -1;
|
||||
int cobwebBlockId = -1;
|
||||
int furnaceRuntimeId = -1;
|
||||
int furnaceLitRuntimeId = -1;
|
||||
|
@ -181,7 +183,10 @@ public abstract class BlockTranslator {
|
|||
|
||||
JAVA_RUNTIME_ID_TO_BLOCK_MAPPING.put(javaRuntimeId, builder.build());
|
||||
|
||||
if (javaId.contains("cobweb")) {
|
||||
if (javaId.startsWith("minecraft:bell[")) {
|
||||
bellBlockId = uniqueJavaId;
|
||||
|
||||
} else if (javaId.contains("cobweb")) {
|
||||
cobwebBlockId = uniqueJavaId;
|
||||
|
||||
} else if (javaId.startsWith("minecraft:furnace[facing=north")) {
|
||||
|
@ -199,6 +204,11 @@ public abstract class BlockTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
if (bellBlockId == -1) {
|
||||
throw new AssertionError("Unable to find bell in palette");
|
||||
}
|
||||
JAVA_BELL_BLOCK_ID = bellBlockId;
|
||||
|
||||
if (cobwebBlockId == -1) {
|
||||
throw new AssertionError("Unable to find cobwebs in palette");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue