From 9fd40395eb80a3723e925b4eed9be132aa9bb4dd Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 13 May 2024 10:46:08 +0200 Subject: [PATCH] Move occluding state ids to data file --- .../blockconnections/ConnectionData.java | 392 +----------------- .../viaversion/data/blockConnections.nbt | Bin 60634 -> 62165 bytes 2 files changed, 6 insertions(+), 386 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/blockconnections/ConnectionData.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/blockconnections/ConnectionData.java index 6f8c8dbe6..1e42bdcb2 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/blockconnections/ConnectionData.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/blockconnections/ConnectionData.java @@ -178,7 +178,8 @@ public final class ConnectionData { if (!Via.getConfig().isReduceBlockStorageMemory()) { blockConnectionData = new Int2ObjectOpenHashMap<>(2048); - ListTag blockConnectionMappings = MappingDataLoader.INSTANCE.loadNBT("blockConnections.nbt").getListTag("data", CompoundTag.class); + CompoundTag data = MappingDataLoader.INSTANCE.loadNBT("blockConnections.nbt"); + ListTag blockConnectionMappings = data.getListTag("data", CompoundTag.class); for (CompoundTag blockTag : blockConnectionMappings) { BlockData blockData = new BlockData(); for (Entry entry : blockTag.entrySet()) { @@ -208,10 +209,11 @@ public final class ConnectionData { } } } - } - for (String state : occludingBlockStates()) { - OCCLUDING_STATES.add(KEY_TO_ID.getInt(state)); + IntArrayTag occludingStatesArray = data.getIntArrayTag("occluding-states"); + for (final int blockStateId : occludingStatesArray.getValue()) { + OCCLUDING_STATES.add(blockStateId); + } } List initActions = new ArrayList<>(); @@ -268,388 +270,6 @@ public final class ConnectionData { return KEY_TO_ID.getOrDefault(Key.stripMinecraftNamespace(key), -1); } - private static String[] occludingBlockStates() { - return new String[]{ - "stone", - "granite", - "polished_granite", - "diorite", - "polished_diorite", - "andesite", - "polished_andesite", - "grass_block[snowy=false]", - "dirt", - "coarse_dirt", - "podzol[snowy=false]", - "cobblestone", - "oak_planks", - "spruce_planks", - "birch_planks", - "jungle_planks", - "acacia_planks", - "dark_oak_planks", - "bedrock", - "sand", - "red_sand", - "gravel", - "gold_ore", - "iron_ore", - "coal_ore", - "oak_log[axis=x]", - "oak_log[axis=y]", - "oak_log[axis=z]", - "spruce_log[axis=x]", - "spruce_log[axis=y]", - "spruce_log[axis=z]", - "birch_log[axis=x]", - "birch_log[axis=y]", - "birch_log[axis=z]", - "jungle_log[axis=x]", - "jungle_log[axis=y]", - "jungle_log[axis=z]", - "acacia_log[axis=x]", - "acacia_log[axis=y]", - "acacia_log[axis=z]", - "dark_oak_log[axis=x]", - "dark_oak_log[axis=y]", - "dark_oak_log[axis=z]", - "oak_wood[axis=y]", - "spruce_wood[axis=y]", - "birch_wood[axis=y]", - "jungle_wood[axis=y]", - "acacia_wood[axis=y]", - "dark_oak_wood[axis=y]", - "sponge", - "wet_sponge", - "lapis_ore", - "lapis_block", - "dispenser[facing=north,triggered=true]", - "dispenser[facing=north,triggered=false]", - "dispenser[facing=east,triggered=true]", - "dispenser[facing=east,triggered=false]", - "dispenser[facing=south,triggered=true]", - "dispenser[facing=south,triggered=false]", - "dispenser[facing=west,triggered=true]", - "dispenser[facing=west,triggered=false]", - "dispenser[facing=up,triggered=true]", - "dispenser[facing=up,triggered=false]", - "dispenser[facing=down,triggered=true]", - "dispenser[facing=down,triggered=false]", - "sandstone", - "chiseled_sandstone", - "cut_sandstone", - "note_block[instrument=harp,note=0,powered=false]", - "white_wool", - "orange_wool", - "magenta_wool", - "light_blue_wool", - "yellow_wool", - "lime_wool", - "pink_wool", - "gray_wool", - "light_gray_wool", - "cyan_wool", - "purple_wool", - "blue_wool", - "brown_wool", - "green_wool", - "red_wool", - "black_wool", - "gold_block", - "iron_block", - "bricks", - "bookshelf", - "mossy_cobblestone", - "obsidian", - "spawner", - "diamond_ore", - "diamond_block", - "crafting_table", - "furnace[facing=north,lit=true]", - "furnace[facing=north,lit=false]", - "furnace[facing=south,lit=true]", - "furnace[facing=south,lit=false]", - "furnace[facing=west,lit=true]", - "furnace[facing=west,lit=false]", - "furnace[facing=east,lit=true]", - "furnace[facing=east,lit=false]", - "redstone_ore[lit=true]", - "redstone_ore[lit=false]", - "snow_block", - "clay", - "jukebox[has_record=true]", - "jukebox[has_record=false]", - "netherrack", - "soul_sand", - "carved_pumpkin[facing=north]", - "carved_pumpkin[facing=south]", - "carved_pumpkin[facing=west]", - "carved_pumpkin[facing=east]", - "jack_o_lantern[facing=north]", - "jack_o_lantern[facing=south]", - "jack_o_lantern[facing=west]", - "jack_o_lantern[facing=east]", - "infested_stone", - "infested_cobblestone", - "infested_stone_bricks", - "infested_mossy_stone_bricks", - "infested_cracked_stone_bricks", - "infested_chiseled_stone_bricks", - "stone_bricks", - "mossy_stone_bricks", - "cracked_stone_bricks", - "chiseled_stone_bricks", - "brown_mushroom_block[down=true,east=true,north=true,south=true,up=true,west=true]", - "brown_mushroom_block[down=false,east=true,north=true,south=false,up=true,west=false]", - "brown_mushroom_block[down=false,east=true,north=false,south=true,up=true,west=false]", - "brown_mushroom_block[down=false,east=true,north=false,south=false,up=true,west=false]", - "brown_mushroom_block[down=false,east=false,north=true,south=false,up=true,west=true]", - "brown_mushroom_block[down=false,east=false,north=true,south=false,up=true,west=false]", - "brown_mushroom_block[down=false,east=false,north=false,south=true,up=true,west=true]", - "brown_mushroom_block[down=false,east=false,north=false,south=true,up=true,west=false]", - "brown_mushroom_block[down=false,east=false,north=false,south=false,up=true,west=true]", - "brown_mushroom_block[down=false,east=false,north=false,south=false,up=true,west=false]", - "brown_mushroom_block[down=false,east=false,north=false,south=false,up=false,west=false]", - "red_mushroom_block[down=true,east=true,north=true,south=true,up=true,west=true]", - "red_mushroom_block[down=false,east=true,north=true,south=false,up=true,west=false]", - "red_mushroom_block[down=false,east=true,north=false,south=true,up=true,west=false]", - "red_mushroom_block[down=false,east=true,north=false,south=false,up=true,west=false]", - "red_mushroom_block[down=false,east=false,north=true,south=false,up=true,west=true]", - "red_mushroom_block[down=false,east=false,north=true,south=false,up=true,west=false]", - "red_mushroom_block[down=false,east=false,north=false,south=true,up=true,west=true]", - "red_mushroom_block[down=false,east=false,north=false,south=true,up=true,west=false]", - "red_mushroom_block[down=false,east=false,north=false,south=false,up=true,west=true]", - "red_mushroom_block[down=false,east=false,north=false,south=false,up=true,west=false]", - "red_mushroom_block[down=false,east=false,north=false,south=false,up=false,west=false]", - "mushroom_stem[down=true,east=true,north=true,south=true,up=true,west=true]", - "mushroom_stem[down=false,east=true,north=true,south=true,up=false,west=true]", - "melon", - "mycelium[snowy=false]", - "nether_bricks", - "end_stone", - "redstone_lamp[lit=true]", - "redstone_lamp[lit=false]", - "emerald_ore", - "emerald_block", - "command_block[conditional=true,facing=north]", - "command_block[conditional=true,facing=east]", - "command_block[conditional=true,facing=south]", - "command_block[conditional=true,facing=west]", - "command_block[conditional=true,facing=up]", - "command_block[conditional=true,facing=down]", - "command_block[conditional=false,facing=north]", - "command_block[conditional=false,facing=east]", - "command_block[conditional=false,facing=south]", - "command_block[conditional=false,facing=west]", - "command_block[conditional=false,facing=up]", - "command_block[conditional=false,facing=down]", - "nether_quartz_ore", - "quartz_block", - "chiseled_quartz_block", - "quartz_pillar[axis=x]", - "quartz_pillar[axis=y]", - "quartz_pillar[axis=z]", - "dropper[facing=north,triggered=true]", - "dropper[facing=north,triggered=false]", - "dropper[facing=east,triggered=true]", - "dropper[facing=east,triggered=false]", - "dropper[facing=south,triggered=true]", - "dropper[facing=south,triggered=false]", - "dropper[facing=west,triggered=true]", - "dropper[facing=west,triggered=false]", - "dropper[facing=up,triggered=true]", - "dropper[facing=up,triggered=false]", - "dropper[facing=down,triggered=true]", - "dropper[facing=down,triggered=false]", - "white_terracotta", - "orange_terracotta", - "magenta_terracotta", - "light_blue_terracotta", - "yellow_terracotta", - "lime_terracotta", - "pink_terracotta", - "gray_terracotta", - "light_gray_terracotta", - "cyan_terracotta", - "purple_terracotta", - "blue_terracotta", - "brown_terracotta", - "green_terracotta", - "red_terracotta", - "black_terracotta", - "slime_block", - "barrier", - "prismarine", - "prismarine_bricks", - "dark_prismarine", - "hay_block[axis=x]", - "hay_block[axis=y]", - "hay_block[axis=z]", - "terracotta", - "coal_block", - "packed_ice", - "red_sandstone", - "chiseled_red_sandstone", - "cut_red_sandstone", - "oak_slab[type=double,waterlogged=false]", - "spruce_slab[type=double,waterlogged=false]", - "birch_slab[type=double,waterlogged=false]", - "jungle_slab[type=double,waterlogged=false]", - "acacia_slab[type=double,waterlogged=false]", - "dark_oak_slab[type=double,waterlogged=false]", - "stone_slab[type=double,waterlogged=false]", - "sandstone_slab[type=double,waterlogged=false]", - "petrified_oak_slab[type=double,waterlogged=false]", - "cobblestone_slab[type=double,waterlogged=false]", - "brick_slab[type=double,waterlogged=false]", - "stone_brick_slab[type=double,waterlogged=false]", - "nether_brick_slab[type=double,waterlogged=false]", - "quartz_slab[type=double,waterlogged=false]", - "red_sandstone_slab[type=double,waterlogged=false]", - "purpur_slab[type=double,waterlogged=false]", - "smooth_stone", - "smooth_sandstone", - "smooth_quartz", - "smooth_red_sandstone", - "purpur_block", - "purpur_pillar[axis=x]", - "purpur_pillar[axis=y]", - "purpur_pillar[axis=z]", - "end_stone_bricks", - "repeating_command_block[conditional=true,facing=north]", - "repeating_command_block[conditional=true,facing=east]", - "repeating_command_block[conditional=true,facing=south]", - "repeating_command_block[conditional=true,facing=west]", - "repeating_command_block[conditional=true,facing=up]", - "repeating_command_block[conditional=true,facing=down]", - "repeating_command_block[conditional=false,facing=north]", - "repeating_command_block[conditional=false,facing=east]", - "repeating_command_block[conditional=false,facing=south]", - "repeating_command_block[conditional=false,facing=west]", - "repeating_command_block[conditional=false,facing=up]", - "repeating_command_block[conditional=false,facing=down]", - "chain_command_block[conditional=true,facing=north]", - "chain_command_block[conditional=true,facing=east]", - "chain_command_block[conditional=true,facing=south]", - "chain_command_block[conditional=true,facing=west]", - "chain_command_block[conditional=true,facing=up]", - "chain_command_block[conditional=true,facing=down]", - "chain_command_block[conditional=false,facing=north]", - "chain_command_block[conditional=false,facing=east]", - "chain_command_block[conditional=false,facing=south]", - "chain_command_block[conditional=false,facing=west]", - "chain_command_block[conditional=false,facing=up]", - "chain_command_block[conditional=false,facing=down]", - "magma_block", - "nether_wart_block", - "red_nether_bricks", - "bone_block[axis=x]", - "bone_block[axis=y]", - "bone_block[axis=z]", - "white_glazed_terracotta[facing=north]", - "white_glazed_terracotta[facing=south]", - "white_glazed_terracotta[facing=west]", - "white_glazed_terracotta[facing=east]", - "orange_glazed_terracotta[facing=north]", - "orange_glazed_terracotta[facing=south]", - "orange_glazed_terracotta[facing=west]", - "orange_glazed_terracotta[facing=east]", - "magenta_glazed_terracotta[facing=north]", - "magenta_glazed_terracotta[facing=south]", - "magenta_glazed_terracotta[facing=west]", - "magenta_glazed_terracotta[facing=east]", - "light_blue_glazed_terracotta[facing=north]", - "light_blue_glazed_terracotta[facing=south]", - "light_blue_glazed_terracotta[facing=west]", - "light_blue_glazed_terracotta[facing=east]", - "yellow_glazed_terracotta[facing=north]", - "yellow_glazed_terracotta[facing=south]", - "yellow_glazed_terracotta[facing=west]", - "yellow_glazed_terracotta[facing=east]", - "lime_glazed_terracotta[facing=north]", - "lime_glazed_terracotta[facing=south]", - "lime_glazed_terracotta[facing=west]", - "lime_glazed_terracotta[facing=east]", - "pink_glazed_terracotta[facing=north]", - "pink_glazed_terracotta[facing=south]", - "pink_glazed_terracotta[facing=west]", - "pink_glazed_terracotta[facing=east]", - "gray_glazed_terracotta[facing=north]", - "gray_glazed_terracotta[facing=south]", - "gray_glazed_terracotta[facing=west]", - "gray_glazed_terracotta[facing=east]", - "light_gray_glazed_terracotta[facing=north]", - "light_gray_glazed_terracotta[facing=south]", - "light_gray_glazed_terracotta[facing=west]", - "light_gray_glazed_terracotta[facing=east]", - "cyan_glazed_terracotta[facing=north]", - "cyan_glazed_terracotta[facing=south]", - "cyan_glazed_terracotta[facing=west]", - "cyan_glazed_terracotta[facing=east]", - "purple_glazed_terracotta[facing=north]", - "purple_glazed_terracotta[facing=south]", - "purple_glazed_terracotta[facing=west]", - "purple_glazed_terracotta[facing=east]", - "blue_glazed_terracotta[facing=north]", - "blue_glazed_terracotta[facing=south]", - "blue_glazed_terracotta[facing=west]", - "blue_glazed_terracotta[facing=east]", - "brown_glazed_terracotta[facing=north]", - "brown_glazed_terracotta[facing=south]", - "brown_glazed_terracotta[facing=west]", - "brown_glazed_terracotta[facing=east]", - "green_glazed_terracotta[facing=north]", - "green_glazed_terracotta[facing=south]", - "green_glazed_terracotta[facing=west]", - "green_glazed_terracotta[facing=east]", - "red_glazed_terracotta[facing=north]", - "red_glazed_terracotta[facing=south]", - "red_glazed_terracotta[facing=west]", - "red_glazed_terracotta[facing=east]", - "black_glazed_terracotta[facing=north]", - "black_glazed_terracotta[facing=south]", - "black_glazed_terracotta[facing=west]", - "black_glazed_terracotta[facing=east]", - "white_concrete", - "orange_concrete", - "magenta_concrete", - "light_blue_concrete", - "yellow_concrete", - "lime_concrete", - "pink_concrete", - "gray_concrete", - "light_gray_concrete", - "cyan_concrete", - "purple_concrete", - "blue_concrete", - "brown_concrete", - "green_concrete", - "red_concrete", - "black_concrete", - "white_concrete_powder", - "orange_concrete_powder", - "magenta_concrete_powder", - "light_blue_concrete_powder", - "yellow_concrete_powder", - "lime_concrete_powder", - "pink_concrete_powder", - "gray_concrete_powder", - "light_gray_concrete_powder", - "cyan_concrete_powder", - "purple_concrete_powder", - "blue_concrete_powder", - "brown_concrete_powder", - "green_concrete_powder", - "red_concrete_powder", - "black_concrete_powder", - "structure_block[mode=save]", - "structure_block[mode=load]", - "structure_block[mode=corner]", - "structure_block[mode=data]", - "glowstone" - }; - } - @FunctionalInterface interface ConnectorInitAction { diff --git a/common/src/main/resources/assets/viaversion/data/blockConnections.nbt b/common/src/main/resources/assets/viaversion/data/blockConnections.nbt index de3adb767a836b968c60ae6c215a3146eff4e45d..2e6c5f1bcaa4738bd7f7f668ab230c700bb941aa 100644 GIT binary patch delta 1554 zcmWmE=Z{on6bIl}_EKk;on0n3adOR^{R8}@ezJhruq$Fq&}bHd7@7f1z}2x}15^YX zb`b;tW$g_WumFOBASxz)W2G$}RP4`wcy4YoJMVkW`JLIHw>50-YUte7T`#5b#P;@a zw~iV+Va$n>r`$MY^yHL|o0>f6MFSbV=|f-oGk_9J45XPdEwnO-3T+JKEY9W}&gDFY z)jiJV0xsktF6I(0Q&mbeZWg(`7acO=gwlevLgxQBaL$g3=2Da&}BH&{+5 zZ%XSSW~6#*p6O*45Az6*GMmSk!(2XK1uI#@TGq3Hjcj5wTlfQomla#?OFv4ezTAut z%B>9I6#183(BkqI7q?a^IDu()$RAZQdea97RvcLA&j1`;ad4%Hfw&+ym0T?O5X6#; zB^OKn5-&5KS6D#ZxN_sl7qOVvFuHsx%P_j!=|iIm*v%fg*~>ombAW>!;xI?> z>!|s4)ciVXa<3iZPb_aFENk?lfebOmRHkt|9rBMmxRajuySN*jhHZ}N+{gVqfbK&# zp_|Z6=qBt=m`K>4n2p7aIn2eB;t8JQDV}B?CKu0Af6n81WE3(A;|xm@mLx1mEI?ji z#9>EbF?J-DU`N8(!;XX<2|E&YB}sm*ws7N!3I DKxz9X delta 11 Tcmccml=;?8<_$OBFfsrDD5?eO