From 4d78503b7c193df2d523aab31e4da545151b32ce Mon Sep 17 00:00:00 2001 From: davchoo <4722249+davchoo@users.noreply.github.com> Date: Mon, 16 Jan 2023 14:48:48 -0500 Subject: [PATCH] Remove redundant populate method and remove BLOCKS_JSON after last use --- .../geysermc/geyser/registry/BlockRegistries.java | 2 +- .../registry/populator/BlockRegistryPopulator.java | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java index 4beeff34f..67963ce26 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/BlockRegistries.java @@ -118,7 +118,7 @@ public class BlockRegistries { static { CustomSkullRegistryPopulator.populate(); - BlockRegistryPopulator.populate(); + BlockRegistryPopulator.registerJavaBlocks(); COLLISIONS = IntMappedRegistry.create(Pair.of("org.geysermc.geyser.translator.collision.CollisionRemapper", "mappings/collision.json"), CollisionRegistryLoader::new); CustomBlockRegistryPopulator.registerCustomBedrockBlocks(); BlockRegistryPopulator.registerBedrockBlocks(); diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index da8511a7f..c7e751904 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -74,14 +74,6 @@ public final class BlockRegistryPopulator { */ private static JsonNode BLOCKS_JSON; - public static void populate() { - registerJavaBlocks(); - // CustomBlockRegistryPopulator.registerCustomBedrockBlocks() and registerBedrockBlocks() moved to BlockRegistries to ensure correct load order - - // Needs to be placed somewhere at some point - //BLOCKS_JSON = null; - } - public static void registerBedrockBlocks() { BiFunction emptyMapper = (bedrockIdentifier, statesBuilder) -> null; ImmutableMap, BiFunction> blockMappers = ImmutableMap., BiFunction>builder() @@ -262,9 +254,11 @@ public final class BlockRegistryPopulator { .customBlockStateIds(customBlockStateIds) .build()); } + + BLOCKS_JSON = null; } - private static void registerJavaBlocks() { + public static void registerJavaBlocks() { JsonNode blocksJson; try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResource("mappings/blocks.json")) { blocksJson = GeyserImpl.JSON_MAPPER.readTree(stream);