Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Don't hardcode the bell block ID
Dieser Commit ist enthalten in:
Ursprung
f53c0cf73f
Commit
139167d090
@ -36,6 +36,7 @@ import com.nukkitx.protocol.bedrock.packet.BlockEventPacket;
|
|||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
import org.geysermc.connector.network.translators.Translator;
|
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 org.geysermc.connector.network.translators.world.block.entity.NoteblockBlockEntityTranslator;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -76,8 +77,7 @@ public class JavaBlockValueTranslator extends PacketTranslator<ServerBlockValueP
|
|||||||
} else if (packet.getValue() instanceof EndGatewayValue) {
|
} else if (packet.getValue() instanceof EndGatewayValue) {
|
||||||
blockEventPacket.setEventType(1);
|
blockEventPacket.setEventType(1);
|
||||||
session.sendUpstreamPacket(blockEventPacket);
|
session.sendUpstreamPacket(blockEventPacket);
|
||||||
} else if (packet.getValue() instanceof GenericBlockValue && packet.getBlockId() == 677) {
|
} else if (packet.getValue() instanceof GenericBlockValue && packet.getBlockId() == BlockTranslator.JAVA_BELL_BLOCK_ID) {
|
||||||
// TODO: Remove hardcode? Remove hardcodes for all of these? (EndGatewayValue for example still hardcodes the block)
|
|
||||||
// Bells - needed to show ring from other players
|
// Bells - needed to show ring from other players
|
||||||
GenericBlockValue bellValue = (GenericBlockValue) packet.getValue();
|
GenericBlockValue bellValue = (GenericBlockValue) packet.getValue();
|
||||||
Position position = packet.getPosition();
|
Position position = packet.getPosition();
|
||||||
|
@ -89,6 +89,7 @@ public abstract class BlockTranslator {
|
|||||||
private final EmptyChunkProvider emptyChunkProvider;
|
private final EmptyChunkProvider emptyChunkProvider;
|
||||||
|
|
||||||
public static final int JAVA_COBWEB_BLOCK_ID;
|
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_ID;
|
||||||
public static final int JAVA_RUNTIME_FURNACE_LIT_ID;
|
public static final int JAVA_RUNTIME_FURNACE_LIT_ID;
|
||||||
@ -115,6 +116,7 @@ public abstract class BlockTranslator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int javaRuntimeId = -1;
|
int javaRuntimeId = -1;
|
||||||
|
int bellBlockId = -1;
|
||||||
int cobwebBlockId = -1;
|
int cobwebBlockId = -1;
|
||||||
int furnaceRuntimeId = -1;
|
int furnaceRuntimeId = -1;
|
||||||
int furnaceLitRuntimeId = -1;
|
int furnaceLitRuntimeId = -1;
|
||||||
@ -181,7 +183,10 @@ public abstract class BlockTranslator {
|
|||||||
|
|
||||||
JAVA_RUNTIME_ID_TO_BLOCK_MAPPING.put(javaRuntimeId, builder.build());
|
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;
|
cobwebBlockId = uniqueJavaId;
|
||||||
|
|
||||||
} else if (javaId.startsWith("minecraft:furnace[facing=north")) {
|
} 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) {
|
if (cobwebBlockId == -1) {
|
||||||
throw new AssertionError("Unable to find cobwebs in palette");
|
throw new AssertionError("Unable to find cobwebs in palette");
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren