Fix: hanging sign recipe not showing up in the recipe book (#4814)

This commit is contained in:
chris 2024-07-12 20:55:40 +02:00 committed by GitHub
parent 2a6025f3fc
commit 93b0a61265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 16 deletions

View file

@ -49,8 +49,6 @@ import java.util.function.Consumer;
public class CreativeItemRegistryPopulator { public class CreativeItemRegistryPopulator {
private static final List<BiPredicate<String, Integer>> JAVA_ONLY_ITEM_FILTER = List.of( private static final List<BiPredicate<String, Integer>> JAVA_ONLY_ITEM_FILTER = List.of(
// Just shows an empty texture; either way it doesn't exist in the creative menu on Java
(identifier, data) -> identifier.equals("minecraft:debug_stick"),
// Bedrock-only as its own item // Bedrock-only as its own item
(identifier, data) -> identifier.equals("minecraft:empty_map") && data == 2, (identifier, data) -> identifier.equals("minecraft:empty_map") && data == 2,
// Bedrock-only banner patterns // Bedrock-only banner patterns
@ -103,16 +101,8 @@ public class CreativeItemRegistryPopulator {
} }
GeyserBedrockBlock blockDefinition = null; GeyserBedrockBlock blockDefinition = null;
JsonNode blockRuntimeIdNode = itemNode.get("blockRuntimeId");
JsonNode blockStateNode; JsonNode blockStateNode;
if (blockRuntimeIdNode != null) { if ((blockStateNode = itemNode.get("block_state_b64")) != null) {
bedrockBlockRuntimeId = blockRuntimeIdNode.asInt();
if (bedrockBlockRuntimeId == 0 && !identifier.equals("minecraft:blue_candle")) { // FIXME
bedrockBlockRuntimeId = -1;
}
blockDefinition = bedrockBlockRuntimeId == -1 ? null : blockMappings.getDefinition(bedrockBlockRuntimeId);
} else if ((blockStateNode = itemNode.get("block_state_b64")) != null) {
byte[] bytes = Base64.getDecoder().decode(blockStateNode.asText()); byte[] bytes = Base64.getDecoder().decode(blockStateNode.asText());
ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
try { try {

View file

@ -252,10 +252,7 @@ public class ItemRegistryPopulator {
} else { } else {
// Try to get an example block runtime ID from the creative contents packet, for Bedrock identifier obtaining // Try to get an example block runtime ID from the creative contents packet, for Bedrock identifier obtaining
int aValidBedrockBlockId = blacklistedIdentifiers.getOrDefault(bedrockIdentifier, customBlockItemOverride != null ? customBlockItemOverride.getRuntimeId() : -1); int aValidBedrockBlockId = blacklistedIdentifiers.getOrDefault(bedrockIdentifier, customBlockItemOverride != null ? customBlockItemOverride.getRuntimeId() : -1);
if (aValidBedrockBlockId == -1 && customBlockItemOverride == null) { if (aValidBedrockBlockId != -1 || customBlockItemOverride != null) {
// Fallback
bedrockBlock = blockMappings.getBedrockBlock(firstBlockRuntimeId);
} else {
// As of 1.16.220, every item requires a block runtime ID attached to it. // As of 1.16.220, every item requires a block runtime ID attached to it.
// This is mostly for identifying different blocks with the same item ID - wool, slabs, some walls. // This is mostly for identifying different blocks with the same item ID - wool, slabs, some walls.
// However, in order for some visuals and crafting to work, we need to send the first matching block state // However, in order for some visuals and crafting to work, we need to send the first matching block state
@ -266,7 +263,7 @@ public class ItemRegistryPopulator {
boolean firstPass = true; boolean firstPass = true;
// Block states are all grouped together. In the mappings, we store the first block runtime ID in order, // Block states are all grouped together. In the mappings, we store the first block runtime ID in order,
// and the last, if relevant. We then iterate over all those values and get their Bedrock equivalents // and the last, if relevant. We then iterate over all those values and get their Bedrock equivalents
Integer lastBlockRuntimeId = entry.getValue().getLastBlockRuntimeId() == null ? firstBlockRuntimeId : entry.getValue().getLastBlockRuntimeId(); int lastBlockRuntimeId = entry.getValue().getLastBlockRuntimeId() == null ? firstBlockRuntimeId : entry.getValue().getLastBlockRuntimeId();
for (int i = firstBlockRuntimeId; i <= lastBlockRuntimeId; i++) { for (int i = firstBlockRuntimeId; i <= lastBlockRuntimeId; i++) {
GeyserBedrockBlock bedrockBlockRuntimeId = blockMappings.getVanillaBedrockBlock(i); GeyserBedrockBlock bedrockBlockRuntimeId = blockMappings.getVanillaBedrockBlock(i);
NbtMap blockTag = bedrockBlockRuntimeId.getState(); NbtMap blockTag = bedrockBlockRuntimeId.getState();