mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix: hanging sign recipe not showing up in the recipe book (#4814)
This commit is contained in:
parent
2a6025f3fc
commit
93b0a61265
2 changed files with 3 additions and 16 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue