Some formatting fixes and creative menu fix

This commit is contained in:
Camotoy 2023-09-09 13:23:19 -04:00
parent 806ec35a84
commit c67d50c13e
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
6 changed files with 65 additions and 57 deletions

1
.gitignore vendored
View file

@ -251,3 +251,4 @@ locales/
/saved-refresh-tokens.json /saved-refresh-tokens.json
/custom_mappings/ /custom_mappings/
/languages/ /languages/
/custom-skulls.yml

View file

@ -34,7 +34,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.fastutil.objects.*;
import org.cloudburstmc.nbt.*; import org.cloudburstmc.nbt.*;
import org.cloudburstmc.protocol.bedrock.codec.v582.Bedrock_v582;
import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData; import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData;
import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589; import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594; import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
@ -74,10 +73,9 @@ public final class BlockRegistryPopulator {
public static void populate(Stage stage) { public static void populate(Stage stage) {
switch (stage) { switch (stage) {
case PRE_INIT -> { nullifyBlocksNode(); } case PRE_INIT, POST_INIT -> { nullifyBlocksNode(); }
case INIT_JAVA -> { registerJavaBlocks(); } case INIT_JAVA -> { registerJavaBlocks(); }
case INIT_BEDROCK -> { registerBedrockBlocks(); } case INIT_BEDROCK -> { registerBedrockBlocks(); }
case POST_INIT -> { nullifyBlocksNode(); }
default -> { throw new IllegalArgumentException("Unknown stage: " + stage); } default -> { throw new IllegalArgumentException("Unknown stage: " + stage); }
} }
} }
@ -86,9 +84,8 @@ public final class BlockRegistryPopulator {
* Stores the raw blocks JSON until it is no longer needed. * Stores the raw blocks JSON until it is no longer needed.
*/ */
private static JsonNode BLOCKS_JSON; private static JsonNode BLOCKS_JSON;
private static int minCustomRuntimeID = -1; private static int MIN_CUSTOM_RUNTIME_ID = -1;
private static int maxCustomRuntimeID = -1; private static int JAVA_BLOCKS_SIZE = -1;
private static int javaBlocksSize = -1;
private static void nullifyBlocksNode() { private static void nullifyBlocksNode() {
BLOCKS_JSON = null; BLOCKS_JSON = null;
@ -224,8 +221,8 @@ public final class BlockRegistryPopulator {
BiFunction<String, NbtMapBuilder, String> stateMapper = blockMappers.getOrDefault(palette.getKey(), emptyMapper); BiFunction<String, NbtMapBuilder, String> stateMapper = blockMappers.getOrDefault(palette.getKey(), emptyMapper);
GeyserBedrockBlock[] javaToBedrockBlocks = new GeyserBedrockBlock[javaBlocksSize]; GeyserBedrockBlock[] javaToBedrockBlocks = new GeyserBedrockBlock[JAVA_BLOCKS_SIZE];
GeyserBedrockBlock[] javaToVanillaBedrockBlocks = new GeyserBedrockBlock[javaBlocksSize]; GeyserBedrockBlock[] javaToVanillaBedrockBlocks = new GeyserBedrockBlock[JAVA_BLOCKS_SIZE];
Map<String, NbtMap> flowerPotBlocks = new Object2ObjectOpenHashMap<>(); Map<String, NbtMap> flowerPotBlocks = new Object2ObjectOpenHashMap<>();
Map<NbtMap, BlockDefinition> itemFrames = new Object2ObjectOpenHashMap<>(); Map<NbtMap, BlockDefinition> itemFrames = new Object2ObjectOpenHashMap<>();
@ -309,8 +306,8 @@ public final class BlockRegistryPopulator {
Map<JavaBlockState, CustomBlockState> nonVanillaStateOverrides = BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get(); Map<JavaBlockState, CustomBlockState> nonVanillaStateOverrides = BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get();
if (nonVanillaStateOverrides.size() > 0) { if (nonVanillaStateOverrides.size() > 0) {
// First ensure all non vanilla runtime IDs at minimum are air in case they aren't consecutive // First ensure all non vanilla runtime IDs at minimum are air in case they aren't consecutive
Arrays.fill(javaToVanillaBedrockBlocks, minCustomRuntimeID, javaToVanillaBedrockBlocks.length, airDefinition); Arrays.fill(javaToVanillaBedrockBlocks, MIN_CUSTOM_RUNTIME_ID, javaToVanillaBedrockBlocks.length, airDefinition);
Arrays.fill(javaToBedrockBlocks, minCustomRuntimeID, javaToBedrockBlocks.length, airDefinition); Arrays.fill(javaToBedrockBlocks, MIN_CUSTOM_RUNTIME_ID, javaToBedrockBlocks.length, airDefinition);
for (Map.Entry<JavaBlockState, CustomBlockState> entry : nonVanillaStateOverrides.entrySet()) { for (Map.Entry<JavaBlockState, CustomBlockState> entry : nonVanillaStateOverrides.entrySet()) {
GeyserBedrockBlock bedrockDefinition = customBlockStateDefinitions.get(entry.getValue()); GeyserBedrockBlock bedrockDefinition = customBlockStateDefinitions.get(entry.getValue());
@ -364,20 +361,20 @@ public final class BlockRegistryPopulator {
throw new AssertionError("Unable to load Java block mappings", e); throw new AssertionError("Unable to load Java block mappings", e);
} }
javaBlocksSize = blocksJson.size(); JAVA_BLOCKS_SIZE = blocksJson.size();
if (BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get().size() > 0) { if (BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get().size() > 0) {
minCustomRuntimeID = BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get().keySet().stream().min(Comparator.comparing(JavaBlockState::javaId)).get().javaId(); MIN_CUSTOM_RUNTIME_ID = BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get().keySet().stream().min(Comparator.comparing(JavaBlockState::javaId)).get().javaId();
maxCustomRuntimeID = BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get().keySet().stream().max(Comparator.comparing(JavaBlockState::javaId)).get().javaId(); int maxCustomRuntimeID = BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.get().keySet().stream().max(Comparator.comparing(JavaBlockState::javaId)).get().javaId();
if (minCustomRuntimeID < blocksJson.size()) { if (MIN_CUSTOM_RUNTIME_ID < blocksJson.size()) {
throw new RuntimeException("Non vanilla custom block state overrides runtime ID must start after the last vanilla block state (" + javaBlocksSize + ")"); throw new RuntimeException("Non vanilla custom block state overrides runtime ID must start after the last vanilla block state (" + JAVA_BLOCKS_SIZE + ")");
} }
javaBlocksSize = maxCustomRuntimeID + 1; // Runtime ids start at 0, so we need to add 1 JAVA_BLOCKS_SIZE = maxCustomRuntimeID + 1; // Runtime ids start at 0, so we need to add 1
} }
BlockRegistries.JAVA_BLOCKS.set(new BlockMapping[javaBlocksSize]); // Set array size to number of blockstates BlockRegistries.JAVA_BLOCKS.set(new BlockMapping[JAVA_BLOCKS_SIZE]); // Set array size to number of blockstates
Deque<String> cleanIdentifiers = new ArrayDeque<>(); Deque<String> cleanIdentifiers = new ArrayDeque<>();

View file

@ -26,8 +26,6 @@
package org.geysermc.geyser.registry.populator; package org.geysermc.geyser.registry.populator;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.nbt.NbtMapBuilder;
import org.cloudburstmc.nbt.NbtUtils; import org.cloudburstmc.nbt.NbtUtils;
@ -124,6 +122,7 @@ public class CreativeItemRegistryPopulator {
NbtMapBuilder builder = stateTag.toBuilder(); NbtMapBuilder builder = stateTag.toBuilder();
builder.remove("name_hash"); builder.remove("name_hash");
builder.remove("network_id"); builder.remove("network_id");
builder.remove("version");
blockDefinition = blockMappings.getDefinition(builder.build()); blockDefinition = blockMappings.getDefinition(builder.build());
} catch (IOException e) { } catch (IOException e) {

View file

@ -70,21 +70,21 @@ public class CustomBlockRegistryPopulator {
} }
} }
private static Set<CustomBlockData> customBlocks; private static Set<CustomBlockData> CUSTOM_BLOCKS;
private static Set<String> customBlockNames; private static Set<String> CUSTOM_BLOCK_NAMES;
private static Int2ObjectMap<CustomBlockState> blockStateOverrides; private static Int2ObjectMap<CustomBlockState> BLOCK_STATE_OVERRIDES;
private static Map<String, CustomBlockData> customBlockItemOverrides; private static Map<String, CustomBlockData> CUSTOM_BLOCK_ITEM_OVERRIDES;
private static Map<JavaBlockState, CustomBlockState> nonVanillaBlockStateOverrides; private static Map<JavaBlockState, CustomBlockState> NON_VANILLA_BLOCK_STATE_OVERRIDES;
/** /**
* Initializes custom blocks defined by API * Initializes custom blocks defined by API
*/ */
private static void populateBedrock() { private static void populateBedrock() {
customBlocks = new ObjectOpenHashSet<>(); CUSTOM_BLOCKS = new ObjectOpenHashSet<>();
customBlockNames = new ObjectOpenHashSet<>(); CUSTOM_BLOCK_NAMES = new ObjectOpenHashSet<>();
blockStateOverrides = new Int2ObjectOpenHashMap<>(); BLOCK_STATE_OVERRIDES = new Int2ObjectOpenHashMap<>();
customBlockItemOverrides = new HashMap<>(); CUSTOM_BLOCK_ITEM_OVERRIDES = new HashMap<>();
nonVanillaBlockStateOverrides = new HashMap<>(); NON_VANILLA_BLOCK_STATE_OVERRIDES = new HashMap<>();
GeyserImpl.getInstance().getEventBus().fire(new GeyserDefineCustomBlocksEvent() { GeyserImpl.getInstance().getEventBus().fire(new GeyserDefineCustomBlocksEvent() {
@Override @Override
@ -92,13 +92,13 @@ public class CustomBlockRegistryPopulator {
if (customBlockData.name().length() == 0) { if (customBlockData.name().length() == 0) {
throw new IllegalArgumentException("Custom block name must have at least 1 character."); throw new IllegalArgumentException("Custom block name must have at least 1 character.");
} }
if (!customBlockNames.add(customBlockData.name())) { if (!CUSTOM_BLOCK_NAMES.add(customBlockData.name())) {
throw new IllegalArgumentException("Another custom block was already registered under the name: " + customBlockData.name()); throw new IllegalArgumentException("Another custom block was already registered under the name: " + customBlockData.name());
} }
if (Character.isDigit(customBlockData.name().charAt(0))) { if (Character.isDigit(customBlockData.name().charAt(0))) {
throw new IllegalArgumentException("Custom block can not start with a digit. Name: " + customBlockData.name()); throw new IllegalArgumentException("Custom block can not start with a digit. Name: " + customBlockData.name());
} }
customBlocks.add(customBlockData); CUSTOM_BLOCKS.add(customBlockData);
} }
@Override @Override
@ -107,10 +107,10 @@ public class CustomBlockRegistryPopulator {
if (id == -1) { if (id == -1) {
throw new IllegalArgumentException("Unknown Java block state. Identifier: " + javaIdentifier); throw new IllegalArgumentException("Unknown Java block state. Identifier: " + javaIdentifier);
} }
if (!customBlocks.contains(customBlockState.block())) { if (!CUSTOM_BLOCKS.contains(customBlockState.block())) {
throw new IllegalArgumentException("Custom block is unregistered. Name: " + customBlockState.name()); throw new IllegalArgumentException("Custom block is unregistered. Name: " + customBlockState.name());
} }
CustomBlockState oldBlockState = blockStateOverrides.put(id, customBlockState); CustomBlockState oldBlockState = BLOCK_STATE_OVERRIDES.put(id, customBlockState);
if (oldBlockState != null) { if (oldBlockState != null) {
GeyserImpl.getInstance().getLogger().debug("Duplicate block state override for Java Identifier: " + GeyserImpl.getInstance().getLogger().debug("Duplicate block state override for Java Identifier: " +
javaIdentifier + " Old override: " + oldBlockState.name() + " New override: " + customBlockState.name()); javaIdentifier + " Old override: " + oldBlockState.name() + " New override: " + customBlockState.name());
@ -119,18 +119,18 @@ public class CustomBlockRegistryPopulator {
@Override @Override
public void registerItemOverride(@NonNull String javaIdentifier, @NonNull CustomBlockData customBlockData) { public void registerItemOverride(@NonNull String javaIdentifier, @NonNull CustomBlockData customBlockData) {
if (!customBlocks.contains(customBlockData)) { if (!CUSTOM_BLOCKS.contains(customBlockData)) {
throw new IllegalArgumentException("Custom block is unregistered. Name: " + customBlockData.name()); throw new IllegalArgumentException("Custom block is unregistered. Name: " + customBlockData.name());
} }
customBlockItemOverrides.put(javaIdentifier, customBlockData); CUSTOM_BLOCK_ITEM_OVERRIDES.put(javaIdentifier, customBlockData);
} }
@Override @Override
public void registerOverride(@NonNull JavaBlockState javaBlockState, @NonNull CustomBlockState customBlockState) { public void registerOverride(@NonNull JavaBlockState javaBlockState, @NonNull CustomBlockState customBlockState) {
if (!customBlocks.contains(customBlockState.block())) { if (!CUSTOM_BLOCKS.contains(customBlockState.block())) {
throw new IllegalArgumentException("Custom block is unregistered. Name: " + customBlockState.name()); throw new IllegalArgumentException("Custom block is unregistered. Name: " + customBlockState.name());
} }
nonVanillaBlockStateOverrides.put(javaBlockState, customBlockState); NON_VANILLA_BLOCK_STATE_OVERRIDES.put(javaBlockState, customBlockState);
} }
}); });
} }
@ -140,25 +140,25 @@ public class CustomBlockRegistryPopulator {
*/ */
private static void populateVanilla() { private static void populateVanilla() {
for (CustomSkull customSkull : BlockRegistries.CUSTOM_SKULLS.get().values()) { for (CustomSkull customSkull : BlockRegistries.CUSTOM_SKULLS.get().values()) {
customBlocks.add(customSkull.getCustomBlockData()); CUSTOM_BLOCKS.add(customSkull.getCustomBlockData());
} }
Map<CustomBlockData, Set<Integer>> extendedCollisionBoxes = new HashMap<>(); Map<CustomBlockData, Set<Integer>> extendedCollisionBoxes = new HashMap<>();
Map<BoxComponent, CustomBlockData> extendedCollisionBoxSet = new HashMap<>(); Map<BoxComponent, CustomBlockData> extendedCollisionBoxSet = new HashMap<>();
MappingsConfigReader mappingsConfigReader = new MappingsConfigReader(); MappingsConfigReader mappingsConfigReader = new MappingsConfigReader();
mappingsConfigReader.loadBlockMappingsFromJson((key, block) -> { mappingsConfigReader.loadBlockMappingsFromJson((key, block) -> {
customBlocks.add(block.data()); CUSTOM_BLOCKS.add(block.data());
if (block.overrideItem()) { if (block.overrideItem()) {
customBlockItemOverrides.put(block.javaIdentifier(), block.data()); CUSTOM_BLOCK_ITEM_OVERRIDES.put(block.javaIdentifier(), block.data());
} }
block.states().forEach((javaIdentifier, customBlockState) -> { block.states().forEach((javaIdentifier, customBlockState) -> {
int id = BlockRegistries.JAVA_IDENTIFIER_TO_ID.getOrDefault(javaIdentifier, -1); int id = BlockRegistries.JAVA_IDENTIFIER_TO_ID.getOrDefault(javaIdentifier, -1);
blockStateOverrides.put(id, customBlockState.state()); BLOCK_STATE_OVERRIDES.put(id, customBlockState.state());
BoxComponent extendedCollisionBox = customBlockState.extendedCollisionBox(); BoxComponent extendedCollisionBox = customBlockState.extendedCollisionBox();
if (extendedCollisionBox != null) { if (extendedCollisionBox != null) {
CustomBlockData extendedCollisionBlock = extendedCollisionBoxSet.computeIfAbsent(extendedCollisionBox, box -> { CustomBlockData extendedCollisionBlock = extendedCollisionBoxSet.computeIfAbsent(extendedCollisionBox, box -> {
CustomBlockData collisionBlock = createExtendedCollisionBlock(box, extendedCollisionBoxSet.size()); CustomBlockData collisionBlock = createExtendedCollisionBlock(box, extendedCollisionBoxSet.size());
customBlocks.add(collisionBlock); CUSTOM_BLOCKS.add(collisionBlock);
return collisionBlock; return collisionBlock;
}); });
extendedCollisionBoxes.computeIfAbsent(extendedCollisionBlock, k -> new HashSet<>()) extendedCollisionBoxes.computeIfAbsent(extendedCollisionBlock, k -> new HashSet<>())
@ -167,30 +167,40 @@ public class CustomBlockRegistryPopulator {
}); });
}); });
BlockRegistries.CUSTOM_BLOCK_STATE_OVERRIDES.set(blockStateOverrides); BlockRegistries.CUSTOM_BLOCK_STATE_OVERRIDES.set(BLOCK_STATE_OVERRIDES);
GeyserImpl.getInstance().getLogger().info("Registered " + blockStateOverrides.size() + " custom block overrides."); if (BLOCK_STATE_OVERRIDES.size() != 0) {
GeyserImpl.getInstance().getLogger().info("Registered " + BLOCK_STATE_OVERRIDES.size() + " custom block overrides.");
}
BlockRegistries.CUSTOM_BLOCK_ITEM_OVERRIDES.set(customBlockItemOverrides); BlockRegistries.CUSTOM_BLOCK_ITEM_OVERRIDES.set(CUSTOM_BLOCK_ITEM_OVERRIDES);
GeyserImpl.getInstance().getLogger().info("Registered " + customBlockItemOverrides.size() + " custom block item overrides."); if (CUSTOM_BLOCK_ITEM_OVERRIDES.size() != 0) {
GeyserImpl.getInstance().getLogger().info("Registered " + CUSTOM_BLOCK_ITEM_OVERRIDES.size() + " custom block item overrides.");
}
BlockRegistries.EXTENDED_COLLISION_BOXES.set(extendedCollisionBoxes); BlockRegistries.EXTENDED_COLLISION_BOXES.set(extendedCollisionBoxes);
GeyserImpl.getInstance().getLogger().info("Registered " + extendedCollisionBoxes.size() + " custom block extended collision boxes."); if (extendedCollisionBoxes.size() != 0) {
GeyserImpl.getInstance().getLogger().info("Registered " + extendedCollisionBoxes.size() + " custom block extended collision boxes.");
}
} }
/** /**
* Registers all non-vanilla custom blocks defined by API * Registers all non-vanilla custom blocks defined by API
*/ */
private static void populateNonVanilla() { private static void populateNonVanilla() {
BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.set(nonVanillaBlockStateOverrides); BlockRegistries.NON_VANILLA_BLOCK_STATE_OVERRIDES.set(NON_VANILLA_BLOCK_STATE_OVERRIDES);
GeyserImpl.getInstance().getLogger().info("Registered " + nonVanillaBlockStateOverrides.size() + " non-vanilla block overrides."); if (NON_VANILLA_BLOCK_STATE_OVERRIDES.size() != 0) {
GeyserImpl.getInstance().getLogger().info("Registered " + NON_VANILLA_BLOCK_STATE_OVERRIDES.size() + " non-vanilla block overrides.");
}
} }
/** /**
* Registers all bedrock custom blocks defined in previous stages * Registers all bedrock custom blocks defined in previous stages
*/ */
private static void registration() { private static void registration() {
BlockRegistries.CUSTOM_BLOCKS.set(customBlocks.toArray(new CustomBlockData[0])); BlockRegistries.CUSTOM_BLOCKS.set(CUSTOM_BLOCKS.toArray(new CustomBlockData[0]));
GeyserImpl.getInstance().getLogger().info("Registered " + customBlocks.size() + " custom blocks."); if (CUSTOM_BLOCKS.size() != 0) {
GeyserImpl.getInstance().getLogger().info("Registered " + CUSTOM_BLOCKS.size() + " custom blocks.");
}
} }
/** /**

View file

@ -129,7 +129,9 @@ public class CustomSkullRegistryPopulator {
} }
}); });
GeyserImpl.getInstance().getLogger().info("Registered " + BlockRegistries.CUSTOM_SKULLS.get().size() + " custom skulls as custom blocks."); if (BlockRegistries.CUSTOM_SKULLS.get().size() != 0) {
GeyserImpl.getInstance().getLogger().info("Registered " + BlockRegistries.CUSTOM_SKULLS.get().size() + " custom skulls as custom blocks.");
}
} }
/** /**

View file

@ -34,12 +34,10 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.fastutil.objects.*;
import org.geysermc.geyser.Constants;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.nbt.NbtMapBuilder;
import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.nbt.NbtType;
import org.cloudburstmc.protocol.bedrock.codec.v582.Bedrock_v582;
import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589; import org.cloudburstmc.protocol.bedrock.codec.v589.Bedrock_v589;
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594; import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
@ -48,6 +46,7 @@ import org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition;
import org.cloudburstmc.protocol.bedrock.data.definitions.SimpleItemDefinition; import org.cloudburstmc.protocol.bedrock.data.definitions.SimpleItemDefinition;
import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ComponentItemData;
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
import org.geysermc.geyser.Constants;
import org.geysermc.geyser.GeyserBootstrap; import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.block.custom.CustomBlockData; import org.geysermc.geyser.api.block.custom.CustomBlockData;
@ -58,10 +57,10 @@ import org.geysermc.geyser.api.item.custom.CustomItemOptions;
import org.geysermc.geyser.api.item.custom.NonVanillaCustomItemData; import org.geysermc.geyser.api.item.custom.NonVanillaCustomItemData;
import org.geysermc.geyser.inventory.item.StoredItemMappings; import org.geysermc.geyser.inventory.item.StoredItemMappings;
import org.geysermc.geyser.item.GeyserCustomMappingData; import org.geysermc.geyser.item.GeyserCustomMappingData;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.Items;
import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.registry.type.*; import org.geysermc.geyser.registry.type.*;
import java.io.InputStream; import java.io.InputStream;
@ -356,7 +355,7 @@ public class ItemRegistryPopulator {
boolean valid = true; boolean valid = true;
for (Map.Entry<String, Object> nbtEntry : requiredBlockStates.entrySet()) { for (Map.Entry<String, Object> nbtEntry : requiredBlockStates.entrySet()) {
if (states.getOrDefault(nbtEntry.getKey(), null) == null || !states.get(nbtEntry.getKey()).equals(nbtEntry.getValue())) { if (!Objects.equals(states.get(nbtEntry.getKey()), nbtEntry.getValue())) {
// A required block state doesn't match - this one is not valid // A required block state doesn't match - this one is not valid
valid = false; valid = false;
break; break;