From add619b9df8f04e22101a94517c98295f6bb50a9 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Mon, 12 Aug 2024 15:52:11 +0200 Subject: [PATCH] 1.21 port --- build.gradle | 105 ++++++++----- gradle.properties | 22 +-- gradle/wrapper/gradle-wrapper.properties | 4 +- .../misc/advanced_compacting_upgrade.json | 4 +- .../misc/advanced_deposit_upgrade.json | 4 +- .../misc/advanced_feeding_upgrade.json | 4 +- .../recipes/misc/advanced_filter_upgrade.json | 4 +- .../recipes/misc/advanced_magnet_upgrade.json | 4 +- .../advanced_magnet_upgrade_from_basic.json | 4 +- .../recipes/misc/advanced_pickup_upgrade.json | 4 +- .../recipes/misc/advanced_pump_upgrade.json | 4 +- .../recipes/misc/advanced_refill_upgrade.json | 4 +- .../misc/advanced_restock_upgrade.json | 4 +- .../misc/advanced_tool_swapper_upgrade.json | 4 +- .../recipes/misc/advanced_void_upgrade.json | 4 +- .../recipes/misc/anvil_upgrade.json | 4 +- .../recipes/misc/auto_blasting_upgrade.json | 4 +- ...ng_upgrade_from_auto_smelting_upgrade.json | 4 +- .../recipes/misc/auto_smelting_upgrade.json | 4 +- .../recipes/misc/auto_smoking_upgrade.json | 4 +- ...ng_upgrade_from_auto_smelting_upgrade.json | 4 +- .../recipes/misc/backpack.json | 2 +- .../recipes/misc/battery_upgrade.json | 4 +- .../recipes/misc/blasting_upgrade.json | 4 +- ...lasting_upgrade_from_smelting_upgrade.json | 4 +- .../misc/chipped/alchemy_bench_upgrade.json | 4 +- .../chipped/botanist_workbench_upgrade.json | 4 +- .../chipped/carpenters_table_upgrade.json | 4 +- .../misc/chipped/glassblower_upgrade.json | 4 +- .../misc/chipped/loom_table_upgrade.json | 4 +- .../misc/chipped/mason_table_upgrade.json | 4 +- .../misc/chipped/tinkering_table_upgrade.json | 4 +- .../recipes/misc/compacting_upgrade.json | 4 +- .../recipes/misc/copper_backpack.json | 4 +- .../recipes/misc/crafting_upgrade.json | 4 +- .../recipes/misc/deposit_upgrade.json | 4 +- .../recipes/misc/diamond_backpack.json | 4 +- .../recipes/misc/everlasting_upgrade.json | 4 +- .../recipes/misc/feeding_upgrade.json | 4 +- .../recipes/misc/filter_upgrade.json | 4 +- .../recipes/misc/gold_backpack.json | 4 +- .../recipes/misc/inception_upgrade.json | 4 +- .../recipes/misc/iron_backpack.json | 4 +- .../misc/iron_backpack_from_copper.json | 4 +- .../recipes/misc/jukebox_upgrade.json | 4 +- .../recipes/misc/magnet_upgrade.json | 4 +- .../recipes/misc/netherite_backpack.json | 4 +- .../recipes/misc/pickup_upgrade.json | 4 +- .../recipes/misc/pump_upgrade.json | 4 +- .../recipes/misc/refill_upgrade.json | 4 +- .../recipes/misc/restock_upgrade.json | 4 +- .../recipes/misc/smelting_upgrade.json | 4 +- .../recipes/misc/smoking_upgrade.json | 4 +- ...smoking_upgrade_from_smelting_upgrade.json | 4 +- .../misc/stack_upgrade_starter_tier.json | 4 +- .../recipes/misc/stack_upgrade_tier_1.json | 4 +- .../stack_upgrade_tier_1_from_starter.json | 4 +- .../recipes/misc/stack_upgrade_tier_2.json | 4 +- .../recipes/misc/stack_upgrade_tier_3.json | 4 +- .../recipes/misc/stack_upgrade_tier_4.json | 4 +- .../recipes/misc/stonecutter_upgrade.json | 4 +- .../recipes/misc/tank_upgrade.json | 4 +- .../recipes/misc/tool_swapper_upgrade.json | 4 +- .../recipes/misc/upgrade_base.json | 2 +- .../recipes/misc/void_upgrade.json | 4 +- .../recipes/misc/xp_pump_upgrade.json | 4 +- .../blocks/backpack.json | 0 .../blocks/copper_backpack.json | 0 .../blocks/diamond_backpack.json | 0 .../blocks/gold_backpack.json | 0 .../blocks/iron_backpack.json | 0 .../blocks/netherite_backpack.json | 0 .../inject/chests/abandoned_mineshaft.json | 0 .../inject/chests/bastion_treasure.json | 0 .../inject/chests/desert_pyramid.json | 0 .../inject/chests/end_city_treasure.json | 0 .../inject/chests/nether_bridge.json | 0 .../inject/chests/shipwreck_treasure.json | 0 .../inject/chests/simple_dungeon.json | 0 .../inject/chests/woodland_mansion.json | 0 .../advanced_compacting_upgrade.json | 9 +- .../advanced_deposit_upgrade.json | 9 +- .../advanced_feeding_upgrade.json | 9 +- .../advanced_filter_upgrade.json | 7 +- .../advanced_magnet_upgrade.json | 11 +- .../advanced_magnet_upgrade_from_basic.json | 9 +- .../advanced_pickup_upgrade.json | 9 +- .../advanced_pump_upgrade.json | 9 +- .../advanced_refill_upgrade.json | 9 +- .../advanced_restock_upgrade.json | 9 +- .../advanced_tool_swapper_upgrade.json | 9 +- .../advanced_void_upgrade.json | 9 +- .../{recipes => recipe}/anvil_upgrade.json | 9 +- .../auto_blasting_upgrade.json | 9 +- ...ng_upgrade_from_auto_smelting_upgrade.json | 5 +- .../auto_smelting_upgrade.json | 9 +- .../auto_smoking_upgrade.json | 9 +- ...ng_upgrade_from_auto_smelting_upgrade.json | 3 +- .../{recipes => recipe}/backpack.json | 9 +- .../{recipes => recipe}/backpack_dye.json | 0 .../{recipes => recipe}/battery_upgrade.json | 7 +- .../{recipes => recipe}/blasting_upgrade.json | 7 +- ...lasting_upgrade_from_smelting_upgrade.json | 5 +- .../chipped/alchemy_bench_upgrade.json | 7 +- .../chipped/botanist_workbench_upgrade.json | 7 +- .../chipped/carpenters_table_upgrade.json | 7 +- .../chipped/glassblower_upgrade.json | 7 +- .../chipped/loom_table_upgrade.json | 7 +- .../chipped/mason_table_upgrade.json | 7 +- .../chipped/tinkering_table_upgrade.json | 7 +- .../compacting_upgrade.json | 7 +- .../{recipes => recipe}/copper_backpack.json | 5 +- .../{recipes => recipe}/crafting_upgrade.json | 7 +- .../{recipes => recipe}/deposit_upgrade.json | 9 +- .../{recipes => recipe}/diamond_backpack.json | 5 +- .../everlasting_upgrade.json | 5 +- .../{recipes => recipe}/feeding_upgrade.json | 5 +- .../{recipes => recipe}/filter_upgrade.json | 7 +- .../{recipes => recipe}/gold_backpack.json | 5 +- .../inception_upgrade.json | 7 +- .../{recipes => recipe}/iron_backpack.json | 5 +- .../iron_backpack_from_copper.json | 5 +- .../{recipes => recipe}/jukebox_upgrade.json | 7 +- .../{recipes => recipe}/magnet_upgrade.json | 11 +- .../netherite_backpack.json | 3 +- .../{recipes => recipe}/pickup_upgrade.json | 7 +- .../{recipes => recipe}/pump_upgrade.json | 5 +- .../{recipes => recipe}/refill_upgrade.json | 11 +- .../{recipes => recipe}/restock_upgrade.json | 9 +- .../{recipes => recipe}/smelting_upgrade.json | 7 +- .../{recipes => recipe}/smoking_upgrade.json | 7 +- ...smoking_upgrade_from_smelting_upgrade.json | 3 +- .../stack_upgrade_starter_tier.json | 5 +- .../stack_upgrade_tier_1.json | 5 +- .../stack_upgrade_tier_1_from_starter.json | 5 +- .../stack_upgrade_tier_2.json | 5 +- .../stack_upgrade_tier_3.json | 5 +- .../stack_upgrade_tier_4.json | 5 +- .../stonecutter_upgrade.json | 7 +- .../{recipes => recipe}/tank_upgrade.json | 5 +- .../tool_swapper_upgrade.json | 7 +- .../{recipes => recipe}/upgrade_base.json | 9 +- .../{recipes => recipe}/void_upgrade.json | 9 +- .../{recipes => recipe}/xp_pump_upgrade.json | 5 +- .../sophisticatedbackpacks/Config.java | 18 ++- .../SophisticatedBackpacks.java | 13 +- .../backpack/AccessLogRecord.java | 2 +- .../backpack/BackpackBlock.java | 43 +++-- .../backpack/BackpackBlockEntity.java | 29 ++-- .../backpack/BackpackItem.java | 47 +++--- .../backpack/BackpackStorage.java | 5 +- .../backpack/UUIDDeduplicator.java | 6 +- .../wrapper/BackpackFluidHandler.java | 11 +- .../wrapper/BackpackInventoryHandler.java | 2 +- .../backpack/wrapper/BackpackRenderInfo.java | 7 +- .../backpack/wrapper/BackpackWrapper.java | 147 +++++++++--------- .../client/ClientEventHandler.java | 26 +++- .../client/KeybindHandler.java | 18 +-- .../client/gui/BackpackScreen.java | 4 +- .../client/gui/BackpackSettingsScreen.java | 4 +- .../client/init/ModBlockColors.java | 2 +- .../client/init/ModItemColors.java | 2 +- .../client/render/BackpackDynamicModel.java | 23 ++- .../render/BackpackItemStackRenderer.java | 2 +- .../client/render/BackpackLayerRenderer.java | 2 +- .../client/render/BackpackModel.java | 48 +++--- .../render/ClientBackpackContentsTooltip.java | 6 +- .../command/GiveCommand.java | 5 +- .../common/CommonEventHandler.java | 59 +++---- .../common/EntityBackpackAdditionHandler.java | 80 +++++----- .../common/gui/BackpackContainer.java | 8 +- .../common/gui/BackpackContext.java | 14 +- .../gui/BackpackSettingsContainerMenu.java | 8 +- .../compat/curios/CuriosCompat.java | 7 +- .../compat/jei/DyeRecipesMaker.java | 8 +- .../compat/jei/SBPPlugin.java | 2 +- .../crafting/BackpackDyeRecipe.java | 6 +- .../crafting/BackpackUpgradeRecipe.java | 16 +- .../crafting/BasicBackpackRecipe.java | 10 +- .../SmithingBackpackUpgradeRecipe.java | 12 +- .../data/CopyBackpackDataFunction.java | 3 +- .../data/DataGenerators.java | 10 +- .../data/SBInjectLootSubProvider.java | 31 ++-- .../data/SBLootEnabledCondition.java | 1 - .../data/SBLootModifierProvider.java | 39 +++-- .../data/SBLootTableProvider.java | 6 +- .../data/SBPBlockLootProvider.java | 0 .../data/SBPBlockLootSubProvider.java | 5 +- .../data/SBPRecipeProvider.java | 18 ++- .../init/ModBlocks.java | 2 - .../init/ModDataComponents.java | 51 ++++++ .../sophisticatedbackpacks/init/ModItems.java | 35 +++-- .../init/ModPackets.java | 27 ---- .../init/ModPayloads.java | 27 ++++ ... => AnotherPlayerBackpackOpenPayload.java} | 46 ++---- .../network/BackpackClosePacket.java | 34 ---- .../network/BackpackClosePayload.java | 27 ++++ .../network/BackpackContentsPacket.java | 54 ------- .../network/BackpackContentsPayload.java | 40 +++++ ...enPacket.java => BackpackOpenPayload.java} | 78 ++++------ ...kPickPacket.java => BlockPickPayload.java} | 43 ++--- ...pPacket.java => BlockToolSwapPayload.java} | 44 ++---- ...Packet.java => EntityToolSwapPayload.java} | 44 ++---- .../network/InventoryInteractionPacket.java | 51 ------ .../network/InventoryInteractionPayload.java | 37 +++++ ...equestBackpackInventoryContentsPacket.java | 58 ------- ...questBackpackInventoryContentsPayload.java | 47 ++++++ .../network/RequestPlayerSettingsPacket.java | 36 ----- .../network/RequestPlayerSettingsPayload.java | 32 ++++ .../network/SyncClientInfoPacket.java | 59 ------- .../network/SyncClientInfoPayload.java | 46 ++++++ ...ePacket.java => UpgradeTogglePayload.java} | 46 ++---- .../registry/tool/Matchers.java | 8 +- .../registry/tool/SwordRegistry.java | 2 +- .../registry/tool/ToolRegistry.java | 4 +- .../settings/BackToBackpackTab.java | 4 +- .../upgrades/anvil/AnvilUpgradeTab.java | 3 +- .../upgrades/anvil/AnvilUpgradeWrapper.java | 32 ++-- .../upgrades/deposit/DepositFilterLogic.java | 13 +- .../deposit/DepositUpgradeWrapper.java | 3 +- .../inception/InceptionFluidHandler.java | 8 +- .../inception/InceptionInventoryHandler.java | 2 +- .../inception/InceptionUpgradeItem.java | 14 +- .../inception/InceptionUpgradeWrapper.java | 6 +- .../upgrades/inception/InventoryOrder.java | 8 + .../inception/SubBackpacksHandler.java | 4 +- .../refill/RefillUpgradeContainer.java | 1 - .../upgrades/refill/RefillUpgradeWrapper.java | 37 +++-- .../restock/RestockUpgradeWrapper.java | 5 +- .../upgrades/toolswapper/ToolSwapMode.java | 7 + .../ToolSwapperUpgradeWrapper.java | 62 ++++---- .../util/InventoryInteractionHelper.java | 2 +- .../resources/META-INF/accesstransformer.cfg | 1 + .../curios/tags/{items => item}/back.json | 0 .../compat/resourcefulbees/entity_tools.json | 2 +- .../META-INF/neoforge.mods.toml | 0 236 files changed, 1377 insertions(+), 1452 deletions(-) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_compacting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_deposit_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_feeding_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_filter_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_magnet_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_magnet_upgrade_from_basic.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_pickup_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_pump_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_refill_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_restock_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_tool_swapper_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/advanced_void_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/anvil_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/auto_blasting_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/auto_smelting_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/auto_smoking_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/backpack.json (95%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/battery_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/blasting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/blasting_upgrade_from_smelting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/alchemy_bench_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/botanist_workbench_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/carpenters_table_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/glassblower_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/loom_table_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/mason_table_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/chipped/tinkering_table_upgrade.json (90%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/compacting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/copper_backpack.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/crafting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/deposit_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/diamond_backpack.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/everlasting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/feeding_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/filter_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/gold_backpack.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/inception_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/iron_backpack.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/iron_backpack_from_copper.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/jukebox_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/magnet_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/netherite_backpack.json (86%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/pickup_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/pump_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/refill_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/restock_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/smelting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/smoking_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/smoking_upgrade_from_smelting_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stack_upgrade_starter_tier.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stack_upgrade_tier_1.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stack_upgrade_tier_1_from_starter.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stack_upgrade_tier_2.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stack_upgrade_tier_3.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stack_upgrade_tier_4.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/stonecutter_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/tank_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/tool_swapper_upgrade.json (89%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/upgrade_base.json (95%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/void_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{advancements => advancement}/recipes/misc/xp_pump_upgrade.json (88%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/blocks/backpack.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/blocks/copper_backpack.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/blocks/diamond_backpack.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/blocks/gold_backpack.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/blocks/iron_backpack.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/blocks/netherite_backpack.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/abandoned_mineshaft.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/bastion_treasure.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/desert_pyramid.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/end_city_treasure.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/nether_bridge.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/shipwreck_treasure.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/simple_dungeon.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{loot_tables => loot_table}/inject/chests/woodland_mansion.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_compacting_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_deposit_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_feeding_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_filter_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_magnet_upgrade.json (70%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_magnet_upgrade_from_basic.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_pickup_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_pump_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_refill_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_restock_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_tool_swapper_upgrade.json (72%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/advanced_void_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/anvil_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/auto_blasting_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/auto_blasting_upgrade_from_auto_smelting_upgrade.json (82%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/auto_smelting_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/auto_smoking_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/auto_smoking_upgrade_from_auto_smelting_upgrade.json (85%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/backpack.json (72%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/backpack_dye.json (100%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/battery_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/blasting_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/blasting_upgrade_from_smelting_upgrade.json (82%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/alchemy_bench_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/botanist_workbench_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/carpenters_table_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/glassblower_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/loom_table_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/mason_table_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/chipped/tinkering_table_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/compacting_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/copper_backpack.json (80%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/crafting_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/deposit_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/diamond_backpack.json (80%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/everlasting_upgrade.json (81%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/feeding_upgrade.json (85%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/filter_upgrade.json (77%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/gold_backpack.json (81%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/inception_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/iron_backpack.json (81%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/iron_backpack_from_copper.json (81%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/jukebox_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/magnet_upgrade.json (71%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/netherite_backpack.json (80%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/pickup_upgrade.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/pump_upgrade.json (85%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/refill_upgrade.json (70%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/restock_upgrade.json (75%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/smelting_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/smoking_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/smoking_upgrade_from_smelting_upgrade.json (86%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stack_upgrade_starter_tier.json (77%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stack_upgrade_tier_1.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stack_upgrade_tier_1_from_starter.json (79%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stack_upgrade_tier_2.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stack_upgrade_tier_3.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stack_upgrade_tier_4.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/stonecutter_upgrade.json (78%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/tank_upgrade.json (81%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/tool_swapper_upgrade.json (82%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/upgrade_base.json (71%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/void_upgrade.json (73%) rename src/generated/resources/data/sophisticatedbackpacks/{recipes => recipe}/xp_pump_upgrade.json (84%) delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootProvider.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModDataComponents.java delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPackets.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPayloads.java rename src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/{AnotherPlayerBackpackOpenPacket.java => AnotherPlayerBackpackOpenPayload.java} (62%) delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePacket.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePayload.java delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPacket.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPayload.java rename src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/{BackpackOpenPacket.java => BackpackOpenPayload.java} (58%) rename src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/{BlockPickPacket.java => BlockPickPayload.java} (52%) rename src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/{BlockToolSwapPacket.java => BlockToolSwapPayload.java} (58%) rename src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/{EntityToolSwapPacket.java => EntityToolSwapPayload.java} (66%) delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPacket.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPayload.java delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPacket.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPayload.java delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPacket.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPayload.java delete mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPacket.java create mode 100644 src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPayload.java rename src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/{UpgradeTogglePacket.java => UpgradeTogglePayload.java} (55%) rename src/main/resources/data/curios/tags/{items => item}/back.json (100%) rename src/main/{resources => templates}/META-INF/neoforge.mods.toml (100%) diff --git a/build.gradle b/build.gradle index 0047f71a..35e9ee81 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' id 'idea' id 'maven-publish' - id 'net.neoforged.gradle.userdev' version '7.0.142' + id 'net.neoforged.moddev' version '1.0.14' id "org.sonarqube" version "5.0.0.4638" } @@ -18,7 +18,6 @@ group = mod_group_id repositories { mavenCentral() - maven { url "https://maven.theillusivec4.top/" } maven { url "https://maven.tterrag.com/" } maven { url = "https://modmaven.dev/" } maven { url "https://minecraft.curseforge.com/api/maven/" } @@ -48,42 +47,54 @@ base { java.toolchain.languageVersion = JavaLanguageVersion.of(21) -minecraft { - accessTransformers { - file('src/main/resources/META-INF/accesstransformer.cfg') - //entry('public net.minecraft.world.item.crafting.ShapelessRecipe result #result') - } -} +neoForge { + version = project.neo_version -runs { - configureEach { - systemProperty 'forge.logging.markers', 'REGISTRIES' - systemProperty 'forge.logging.console.level', 'debug' - systemProperty 'mixin.env.disableRefMap', 'true' - modSource project.sourceSets.main + parchment { + mappingsVersion = project.parchment_mappings_version + minecraftVersion = project.parchment_minecraft_version } - client { - } + accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg') - client2 { - configure ("client") + runs { + configureEach { + systemProperty 'forge.logging.markers', 'REGISTRIES' + systemProperty 'forge.logging.console.level', 'debug' + systemProperty 'mixin.env.disableRefMap', 'true' + } - programArguments.addAll '--username', 'Dev2' - } + client { + client() + } - server { - programArgument '--nogui' - } + client2 { + client() - data { - programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + programArguments.addAll '--username', 'Dev2' + } -/* - if (findProject(':SophisticatedCore') != null) { - modSource project(':SophisticatedCore').sourceSets.main + server { + server() + programArgument '--nogui' + } + + data { + data() + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + + /* + if (findProject(':SophisticatedCore') != null) { + modSource project(':SophisticatedCore').sourceSets.main + } + */ + } + } + + mods { + "${mod_id}" { + sourceSet(sourceSets.main) } -*/ } } @@ -91,9 +102,11 @@ sourceSets.main.resources { srcDir 'src/generated/resources' } -dependencies { - implementation "net.neoforged:neoforge:${neo_version}" +configurations { + runtimeClasspath.extendsFrom localRuntime +} +dependencies { if (findProject(':SophisticatedCore') != null) { dependencies.implementation project(':SophisticatedCore') } else { @@ -108,19 +121,19 @@ dependencies { // implementation files('/libs/sophisticatedcore-1.20.4-0.6.18.-SNAPSHOT.jar') compileOnly "mezz.jei:jei-${jei_mc_version}:${jei_version}" - runtimeOnly "mezz.jei:jei-${jei_mc_version}:${jei_version}" - compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api" - runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}" + localRuntime "mezz.jei:jei-${jei_mc_version}:${jei_version}" + compileOnly "curse.maven:curios-1037991:${curios_cf_file_id}" + localRuntime "curse.maven:curios-1037991:${curios_cf_file_id}" compileOnly "curse.maven:balm-531761:${balm_cf_file_id}" - runtimeOnly "curse.maven:balm-531761:${balm_cf_file_id}" + localRuntime "curse.maven:balm-531761:${balm_cf_file_id}" compileOnly "curse.maven:craftingtweaks-233071:${crafting_tweaks_cf_file_id}" - runtimeOnly "curse.maven:craftingtweaks-233071:${crafting_tweaks_cf_file_id}" + localRuntime "curse.maven:craftingtweaks-233071:${crafting_tweaks_cf_file_id}" compileOnly "curse.maven:chipped-456956:${chipped_cf_file_id}" - runtimeOnly "curse.maven:chipped-456956:${chipped_cf_file_id}" + localRuntime "curse.maven:chipped-456956:${chipped_cf_file_id}" compileOnly "curse.maven:athena-841890:${athena_cf_file_id}" - runtimeOnly "curse.maven:athena-841890:${athena_cf_file_id}" + localRuntime "curse.maven:athena-841890:${athena_cf_file_id}" compileOnly "curse.maven:resourcefullib-570073:${resourcefullib_cf_file_id}" - runtimeOnly "curse.maven:resourcefullib-570073:${resourcefullib_cf_file_id}" + localRuntime "curse.maven:resourcefullib-570073:${resourcefullib_cf_file_id}" /* compileOnly "vazkii.botania:Botania:${botania_version}:api") runtimeOnly "vazkii.botania:Botania:${botania_version}") @@ -129,7 +142,7 @@ dependencies { */ } -tasks.withType(ProcessResources).configureEach { +var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { var replaceProperties = [ minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, neo_version : neo_version, neo_version_range: neo_version_range, @@ -142,11 +155,17 @@ tasks.withType(ProcessResources).configureEach { ] inputs.properties replaceProperties - filesMatching(['META-INF/mods.toml']) { - expand replaceProperties + [project: project] - } + expand replaceProperties + from "src/main/templates" + into "build/generated/sources/modMetadata" } +// Include the output of "generateModMetadata" as an input directory for the build +// this works with both building through Gradle and the IDE. +sourceSets.main.resources.srcDir generateModMetadata +// To avoid having to run "generateModMetadata" manually, make it run on every project reload +neoForge.ideSyncTask generateModMetadata + test { useJUnitPlatform() testLogging { diff --git a/gradle.properties b/gradle.properties index 70887a10..24338424 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,11 +2,11 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false org.gradle.debug=false -neogradle.subsystems.parchment.minecraftVersion=1.20.6 -neogradle.subsystems.parchment.mappingsVersion=2024.05.01 +parchment_minecraft_version=1.21 +parchment_mappings_version=2024.07.07 minecraft_version=1.21 minecraft_version_range=[1.21,1.21.1) -neo_version=21.0.0-beta +neo_version=21.0.143 neo_version_range=[21.0.0-beta,) loader_version_range=[4,) @@ -25,13 +25,13 @@ sonar_project_key=sophisticatedbackpacks:SophisticatedBackpacks github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedBackpacks jei_mc_version=1.21-neoforge -jei_version=19.0.0.1 -curios_version=8.0.0+1.20.6 +jei_version=19.8.0.97 #botania_version=1.19.2-439-FORGE-SNAPSHOT #patchouli_version=1.19.2-78-SNAPSHOT -balm_cf_file_id=5139962 -crafting_tweaks_cf_file_id=5140232 -chipped_cf_file_id=5081543 -resourcefullib_cf_file_id=5180841 -athena_cf_file_id=5176890 -sc_version=[1.20.4-0.6.17,1.21) \ No newline at end of file +balm_cf_file_id=5525369 +crafting_tweaks_cf_file_id=5426925 +chipped_cf_file_id=5506938 +resourcefullib_cf_file_id=5483169 +athena_cf_file_id=5431579 +curios_cf_file_id=5546342 +sc_version=[1.21,1.22) \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a..e4a5f610 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_compacting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_compacting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_compacting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_compacting_upgrade.json index 4b63bf64..1d3ac0a6 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_compacting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_compacting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:compacting_upgrade" - ] + "items": "sophisticatedbackpacks:compacting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_deposit_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_deposit_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_deposit_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_deposit_upgrade.json index 350d9dfc..9493e0b4 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_deposit_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_deposit_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:deposit_upgrade" - ] + "items": "sophisticatedbackpacks:deposit_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_feeding_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_feeding_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_feeding_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_feeding_upgrade.json index 7432c163..117e082c 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_feeding_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_feeding_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:feeding_upgrade" - ] + "items": "sophisticatedbackpacks:feeding_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_filter_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_filter_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_filter_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_filter_upgrade.json index 543eeb60..4a7c88e3 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_filter_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_filter_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:filter_upgrade" - ] + "items": "sophisticatedbackpacks:filter_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_magnet_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_magnet_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_magnet_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_magnet_upgrade.json index 516f3ece..438fb9a1 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_magnet_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_magnet_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:advanced_pickup_upgrade" - ] + "items": "sophisticatedbackpacks:advanced_pickup_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_magnet_upgrade_from_basic.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_magnet_upgrade_from_basic.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_magnet_upgrade_from_basic.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_magnet_upgrade_from_basic.json index 4b66b818..0f114acd 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_magnet_upgrade_from_basic.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_magnet_upgrade_from_basic.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:magnet_upgrade" - ] + "items": "sophisticatedbackpacks:magnet_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_pickup_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_pickup_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_pickup_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_pickup_upgrade.json index f7ad1b81..eec61800 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_pickup_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_pickup_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:pickup_upgrade" - ] + "items": "sophisticatedbackpacks:pickup_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_pump_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_pump_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_pump_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_pump_upgrade.json index 80746164..959f6bb1 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_pump_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_pump_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:pump_upgrade" - ] + "items": "sophisticatedbackpacks:pump_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_refill_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_refill_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_refill_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_refill_upgrade.json index 8fc933a1..5a03faf7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_refill_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_refill_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:refill_upgrade" - ] + "items": "sophisticatedbackpacks:refill_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_restock_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_restock_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_restock_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_restock_upgrade.json index 43bb5351..670b7d9e 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_restock_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_restock_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:restock_upgrade" - ] + "items": "sophisticatedbackpacks:restock_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_tool_swapper_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_tool_swapper_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_tool_swapper_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_tool_swapper_upgrade.json index 290ca864..50f1493a 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_tool_swapper_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_tool_swapper_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:tool_swapper_upgrade" - ] + "items": "sophisticatedbackpacks:tool_swapper_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_void_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_void_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_void_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_void_upgrade.json index d826c220..43d1c1db 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/advanced_void_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/advanced_void_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:void_upgrade" - ] + "items": "sophisticatedbackpacks:void_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/anvil_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/anvil_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/anvil_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/anvil_upgrade.json index b4007fc8..930e7231 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/anvil_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/anvil_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_blasting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_blasting_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_blasting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_blasting_upgrade.json index 0bf880a1..0adf3e14 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_blasting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_blasting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:blasting_upgrade" - ] + "items": "sophisticatedbackpacks:blasting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json index 3457cbcd..f89c6c27 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_blasting_upgrade_from_auto_smelting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:auto_smelting_upgrade" - ] + "items": "sophisticatedbackpacks:auto_smelting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smelting_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smelting_upgrade.json index 3d2928d0..1e0938f1 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smelting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:smelting_upgrade" - ] + "items": "sophisticatedbackpacks:smelting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smoking_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smoking_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smoking_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smoking_upgrade.json index b7fe1cdd..11b1faa4 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smoking_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smoking_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:smoking_upgrade" - ] + "items": "sophisticatedbackpacks:smoking_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json index dd2556e5..15d74c9b 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/auto_smoking_upgrade_from_auto_smelting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:auto_smelting_upgrade" - ] + "items": "sophisticatedbackpacks:auto_smelting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/backpack.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/backpack.json similarity index 95% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/backpack.json index ec0af2ce..8ed21366 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/backpack.json @@ -11,7 +11,7 @@ "conditions": { "items": [ { - "tag": "forge:leather" + "items": "#c:leathers" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/battery_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/battery_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/battery_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/battery_upgrade.json index f12cea15..3d8bb230 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/battery_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/battery_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/blasting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/blasting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/blasting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/blasting_upgrade.json index 8dad4124..c7473a5e 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/blasting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/blasting_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/blasting_upgrade_from_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/blasting_upgrade_from_smelting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/blasting_upgrade_from_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/blasting_upgrade_from_smelting_upgrade.json index 241cb465..dcfe5986 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/blasting_upgrade_from_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/blasting_upgrade_from_smelting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:smelting_upgrade" - ] + "items": "sophisticatedbackpacks:smelting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/alchemy_bench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/alchemy_bench_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/alchemy_bench_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/alchemy_bench_upgrade.json index d9067253..61196513 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/alchemy_bench_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/alchemy_bench_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/botanist_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/botanist_workbench_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/botanist_workbench_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/botanist_workbench_upgrade.json index 05820b0e..7f6e2a40 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/botanist_workbench_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/botanist_workbench_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/carpenters_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/carpenters_table_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/carpenters_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/carpenters_table_upgrade.json index e363829c..c94de835 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/carpenters_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/carpenters_table_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/glassblower_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/glassblower_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/glassblower_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/glassblower_upgrade.json index 505f2fab..04a336da 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/glassblower_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/glassblower_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/loom_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/loom_table_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/loom_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/loom_table_upgrade.json index 8798a693..40a97325 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/loom_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/loom_table_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/mason_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/mason_table_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/mason_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/mason_table_upgrade.json index dc93e6dd..1dcf36d6 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/mason_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/mason_table_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/tinkering_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/tinkering_table_upgrade.json similarity index 90% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/tinkering_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/tinkering_table_upgrade.json index 2fce4117..986229bf 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/chipped/tinkering_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/chipped/tinkering_table_upgrade.json @@ -21,9 +21,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/compacting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/compacting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/compacting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/compacting_upgrade.json index 172f18e3..fc592fa6 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/compacting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/compacting_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/copper_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/copper_backpack.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/copper_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/copper_backpack.json index aec83469..9360dbf3 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/copper_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/copper_backpack.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:backpack" - ] + "items": "sophisticatedbackpacks:backpack" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/crafting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/crafting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/crafting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/crafting_upgrade.json index 865714bb..e811d90a 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/crafting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/crafting_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/deposit_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/deposit_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/deposit_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/deposit_upgrade.json index 9f6e9647..722dc110 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/deposit_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/deposit_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/diamond_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/diamond_backpack.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/diamond_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/diamond_backpack.json index 4a7c6361..3308841d 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/diamond_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/diamond_backpack.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:gold_backpack" - ] + "items": "sophisticatedbackpacks:gold_backpack" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/everlasting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/everlasting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/everlasting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/everlasting_upgrade.json index 510cf8a6..5abedaf3 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/everlasting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/everlasting_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/feeding_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/feeding_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/feeding_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/feeding_upgrade.json index 33db1930..45bffce5 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/feeding_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/feeding_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/filter_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/filter_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/filter_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/filter_upgrade.json index 3d01ceba..64ccaa2c 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/filter_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/filter_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/gold_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/gold_backpack.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/gold_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/gold_backpack.json index ffba367c..cea8bf3a 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/gold_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/gold_backpack.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:iron_backpack" - ] + "items": "sophisticatedbackpacks:iron_backpack" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/inception_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/inception_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/inception_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/inception_upgrade.json index 82ab65f8..de0a0be7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/inception_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/inception_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/iron_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/iron_backpack.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/iron_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/iron_backpack.json index be336ed9..77db67d7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/iron_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/iron_backpack.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:backpack" - ] + "items": "sophisticatedbackpacks:backpack" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/iron_backpack_from_copper.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/iron_backpack_from_copper.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/iron_backpack_from_copper.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/iron_backpack_from_copper.json index 554a46c1..5d605195 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/iron_backpack_from_copper.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/iron_backpack_from_copper.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:copper_backpack" - ] + "items": "sophisticatedbackpacks:copper_backpack" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/jukebox_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/jukebox_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/jukebox_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/jukebox_upgrade.json index 5059294a..e7a465cb 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/jukebox_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/jukebox_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/magnet_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/magnet_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/magnet_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/magnet_upgrade.json index 7bcd9d63..4f5642e5 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/magnet_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/magnet_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:pickup_upgrade" - ] + "items": "sophisticatedbackpacks:pickup_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/netherite_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/netherite_backpack.json similarity index 86% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/netherite_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/netherite_backpack.json index 9ecf4d88..dba53f19 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/netherite_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/netherite_backpack.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:diamond_backpack" - ] + "items": "sophisticatedbackpacks:diamond_backpack" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/pickup_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/pickup_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/pickup_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/pickup_upgrade.json index c81baf7c..fba339c7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/pickup_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/pickup_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/pump_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/pump_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/pump_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/pump_upgrade.json index f17b70a9..8760da85 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/pump_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/pump_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/refill_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/refill_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/refill_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/refill_upgrade.json index 062e2ee6..137cc087 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/refill_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/refill_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/restock_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/restock_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/restock_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/restock_upgrade.json index b1d36c3c..e1eec1a7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/restock_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/restock_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smelting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smelting_upgrade.json index ff1b431d..86331004 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smelting_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smoking_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smoking_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smoking_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smoking_upgrade.json index f7792985..b8b2b75b 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smoking_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smoking_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smoking_upgrade_from_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smoking_upgrade_from_smelting_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smoking_upgrade_from_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smoking_upgrade_from_smelting_upgrade.json index 38770c72..ef29c17b 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/smoking_upgrade_from_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/smoking_upgrade_from_smelting_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:smelting_upgrade" - ] + "items": "sophisticatedbackpacks:smelting_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_starter_tier.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_starter_tier.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_starter_tier.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_starter_tier.json index f991b730..8017767e 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_starter_tier.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_starter_tier.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_1.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_1.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_1.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_1.json index 62640257..8267b75d 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_1.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_1.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_1_from_starter.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_1_from_starter.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_1_from_starter.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_1_from_starter.json index b75b1826..201ce643 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_1_from_starter.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_1_from_starter.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_2.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_2.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_2.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_2.json index 78a52520..f454b799 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_2.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_2.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:stack_upgrade_tier_1" - ] + "items": "sophisticatedbackpacks:stack_upgrade_tier_1" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_3.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_3.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_3.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_3.json index fec24355..b692551c 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_3.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_3.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:stack_upgrade_tier_2" - ] + "items": "sophisticatedbackpacks:stack_upgrade_tier_2" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_4.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_4.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_4.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_4.json index 9c66f911..8472776f 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stack_upgrade_tier_4.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stack_upgrade_tier_4.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:stack_upgrade_tier_3" - ] + "items": "sophisticatedbackpacks:stack_upgrade_tier_3" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stonecutter_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stonecutter_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stonecutter_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stonecutter_upgrade.json index 3ecd335d..407ccb4d 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/stonecutter_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/stonecutter_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/tank_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/tank_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/tank_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/tank_upgrade.json index 0e1bc149..e0c75c9f 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/tank_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/tank_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/tool_swapper_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/tool_swapper_upgrade.json similarity index 89% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/tool_swapper_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/tool_swapper_upgrade.json index dea1a839..e7f545eb 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/tool_swapper_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/tool_swapper_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/upgrade_base.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/upgrade_base.json similarity index 95% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/upgrade_base.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/upgrade_base.json index a5eee8cc..7b160e64 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/upgrade_base.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/upgrade_base.json @@ -11,7 +11,7 @@ "conditions": { "items": [ { - "tag": "forge:leather" + "items": "#c:leathers" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/void_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/void_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/void_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/void_upgrade.json index 2a244a93..a6e9cc07 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/void_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/void_upgrade.json @@ -17,9 +17,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:upgrade_base" - ] + "items": "sophisticatedbackpacks:upgrade_base" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/xp_pump_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/xp_pump_upgrade.json similarity index 88% rename from src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/xp_pump_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/xp_pump_upgrade.json index 3b33c4e9..d753cc10 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/advancements/recipes/misc/xp_pump_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/advancement/recipes/misc/xp_pump_upgrade.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "sophisticatedbackpacks:advanced_pump_upgrade" - ] + "items": "sophisticatedbackpacks:advanced_pump_upgrade" } ] }, diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/backpack.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/backpack.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/backpack.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/copper_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/copper_backpack.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/copper_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/copper_backpack.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/diamond_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/diamond_backpack.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/diamond_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/diamond_backpack.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/gold_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/gold_backpack.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/gold_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/gold_backpack.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/iron_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/iron_backpack.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/iron_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/iron_backpack.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/netherite_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/netherite_backpack.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/blocks/netherite_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/blocks/netherite_backpack.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/abandoned_mineshaft.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/abandoned_mineshaft.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/abandoned_mineshaft.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/abandoned_mineshaft.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/bastion_treasure.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/bastion_treasure.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/bastion_treasure.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/bastion_treasure.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/desert_pyramid.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/desert_pyramid.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/desert_pyramid.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/desert_pyramid.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/end_city_treasure.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/end_city_treasure.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/end_city_treasure.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/end_city_treasure.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/nether_bridge.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/nether_bridge.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/nether_bridge.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/nether_bridge.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/shipwreck_treasure.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/shipwreck_treasure.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/shipwreck_treasure.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/shipwreck_treasure.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/simple_dungeon.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/simple_dungeon.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/simple_dungeon.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/simple_dungeon.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/woodland_mansion.json b/src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/woodland_mansion.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/loot_tables/inject/chests/woodland_mansion.json rename to src/generated/resources/data/sophisticatedbackpacks/loot_table/inject/chests/woodland_mansion.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_compacting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_compacting_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_compacting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_compacting_upgrade.json index d759c747..ffb66274 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_compacting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_compacting_upgrade.json @@ -12,13 +12,13 @@ "item": "sophisticatedbackpacks:compacting_upgrade" }, "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_compacting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_compacting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_deposit_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_deposit_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_deposit_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_deposit_upgrade.json index 83af4d0f..49bb166e 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_deposit_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_deposit_upgrade.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "V": { "item": "sophisticatedbackpacks:deposit_upgrade" @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_deposit_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_deposit_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_feeding_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_feeding_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_feeding_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_feeding_upgrade.json index 6638e9cd..3021b4b1 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_feeding_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_feeding_upgrade.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "V": { "item": "sophisticatedbackpacks:feeding_upgrade" @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_feeding_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_feeding_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_filter_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_filter_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_filter_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_filter_upgrade.json index 90eb66ea..c6038c07 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_filter_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_filter_upgrade.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "P": { "item": "sophisticatedbackpacks:filter_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -23,6 +23,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_filter_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_filter_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_magnet_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_magnet_upgrade.json similarity index 70% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_magnet_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_magnet_upgrade.json index 2e86006b..256f1eb3 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_magnet_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_magnet_upgrade.json @@ -9,19 +9,19 @@ "category": "misc", "key": { "E": { - "tag": "forge:ender_pearls" + "tag": "c:ender_pearls" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "L": { - "tag": "forge:gems/lapis" + "tag": "c:gems/lapis" }, "P": { "item": "sophisticatedbackpacks:advanced_pickup_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -30,6 +30,7 @@ "R L" ], "result": { - "item": "sophisticatedbackpacks:advanced_magnet_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_magnet_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_magnet_upgrade_from_basic.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_magnet_upgrade_from_basic.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_magnet_upgrade_from_basic.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_magnet_upgrade_from_basic.json index f083675c..305ae004 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_magnet_upgrade_from_basic.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_magnet_upgrade_from_basic.json @@ -9,16 +9,16 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "M": { "item": "sophisticatedbackpacks:magnet_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_magnet_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_magnet_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_pickup_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_pickup_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_pickup_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_pickup_upgrade.json index e50e8020..952e1051 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_pickup_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_pickup_upgrade.json @@ -9,16 +9,16 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "P": { "item": "sophisticatedbackpacks:pickup_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_pickup_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_pickup_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_pump_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_pump_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_pump_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_pump_upgrade.json index dcaadcb1..54a2a4e1 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_pump_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_pump_upgrade.json @@ -9,10 +9,10 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "I": { "item": "minecraft:dispenser" @@ -21,7 +21,7 @@ "item": "sophisticatedbackpacks:pump_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -30,6 +30,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_pump_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_pump_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_refill_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_refill_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_refill_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_refill_upgrade.json index 5116668a..da98861d 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_refill_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_refill_upgrade.json @@ -9,16 +9,16 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "F": { "item": "sophisticatedbackpacks:refill_upgrade" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_refill_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_refill_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_restock_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_restock_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_restock_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_restock_upgrade.json index f15acac6..c0a26a83 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_restock_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_restock_upgrade.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "V": { "item": "sophisticatedbackpacks:restock_upgrade" @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_restock_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_restock_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_tool_swapper_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_tool_swapper_upgrade.json similarity index 72% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_tool_swapper_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_tool_swapper_upgrade.json index 134430e3..1b8441df 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_tool_swapper_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_tool_swapper_upgrade.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "V": { "item": "sophisticatedbackpacks:tool_swapper_upgrade" @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_tool_swapper_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_tool_swapper_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_void_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_void_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_void_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_void_upgrade.json index ab522e65..a4b23a33 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/advanced_void_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/advanced_void_upgrade.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "V": { "item": "sophisticatedbackpacks:void_upgrade" @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:advanced_void_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:advanced_void_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/anvil_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/anvil_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/anvil_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/anvil_upgrade.json index 914efde9..d5c70c92 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/anvil_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/anvil_upgrade.json @@ -15,13 +15,13 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -30,6 +30,7 @@ " C " ], "result": { - "item": "sophisticatedbackpacks:anvil_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:anvil_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_blasting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_blasting_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/auto_blasting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/auto_blasting_upgrade.json index 741dc6ca..7ac30893 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_blasting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_blasting_upgrade.json @@ -9,16 +9,16 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "H": { "item": "minecraft:hopper" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { "item": "sophisticatedbackpacks:blasting_upgrade" @@ -30,6 +30,7 @@ "GHG" ], "result": { - "item": "sophisticatedbackpacks:auto_blasting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:auto_blasting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_blasting_upgrade_from_auto_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_blasting_upgrade_from_auto_smelting_upgrade.json similarity index 82% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/auto_blasting_upgrade_from_auto_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/auto_blasting_upgrade_from_auto_smelting_upgrade.json index b858acfb..e68f127c 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_blasting_upgrade_from_auto_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_blasting_upgrade_from_auto_smelting_upgrade.json @@ -9,7 +9,7 @@ "category": "misc", "key": { "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "S": { "item": "sophisticatedbackpacks:auto_smelting_upgrade" @@ -24,6 +24,7 @@ "TTT" ], "result": { - "item": "sophisticatedbackpacks:auto_blasting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:auto_blasting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smelting_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smelting_upgrade.json index 93e97924..b1d0b441 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smelting_upgrade.json @@ -9,16 +9,16 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "H": { "item": "minecraft:hopper" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { "item": "sophisticatedbackpacks:smelting_upgrade" @@ -30,6 +30,7 @@ "GHG" ], "result": { - "item": "sophisticatedbackpacks:auto_smelting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:auto_smelting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smoking_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smoking_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smoking_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smoking_upgrade.json index fb89be83..a1e4031a 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smoking_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smoking_upgrade.json @@ -9,16 +9,16 @@ "category": "misc", "key": { "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "H": { "item": "minecraft:hopper" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { "item": "sophisticatedbackpacks:smoking_upgrade" @@ -30,6 +30,7 @@ "GHG" ], "result": { - "item": "sophisticatedbackpacks:auto_smoking_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:auto_smoking_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smoking_upgrade_from_auto_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smoking_upgrade_from_auto_smelting_upgrade.json similarity index 85% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smoking_upgrade_from_auto_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smoking_upgrade_from_auto_smelting_upgrade.json index e275d65c..e49f2265 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/auto_smoking_upgrade_from_auto_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/auto_smoking_upgrade_from_auto_smelting_upgrade.json @@ -21,6 +21,7 @@ " L " ], "result": { - "item": "sophisticatedbackpacks:auto_smoking_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:auto_smoking_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/backpack.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/backpack.json similarity index 72% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/backpack.json index 172e9ef9..9e2fc9b4 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/backpack.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "L": { - "tag": "forge:leather" + "tag": "c:leathers" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -24,6 +24,7 @@ "LLL" ], "result": { - "item": "sophisticatedbackpacks:backpack" + "count": 1, + "id": "sophisticatedbackpacks:backpack" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/backpack_dye.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/backpack_dye.json similarity index 100% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/backpack_dye.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/backpack_dye.json diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/battery_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/battery_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/battery_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/battery_upgrade.json index 655c8e2f..7a87d45c 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/battery_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/battery_upgrade.json @@ -12,10 +12,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "R": { - "tag": "forge:storage_blocks/redstone" + "tag": "c:storage_blocks/redstone" } }, "pattern": [ @@ -24,6 +24,7 @@ "GRG" ], "result": { - "item": "sophisticatedbackpacks:battery_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:battery_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/blasting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/blasting_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/blasting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/blasting_upgrade.json index 96d3bf9f..7f7af021 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/blasting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/blasting_upgrade.json @@ -15,10 +15,10 @@ "item": "minecraft:blast_furnace" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RFR" ], "result": { - "item": "sophisticatedbackpacks:blasting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:blasting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/blasting_upgrade_from_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/blasting_upgrade_from_smelting_upgrade.json similarity index 82% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/blasting_upgrade_from_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/blasting_upgrade_from_smelting_upgrade.json index b004b9f9..5539884f 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/blasting_upgrade_from_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/blasting_upgrade_from_smelting_upgrade.json @@ -9,7 +9,7 @@ "category": "misc", "key": { "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "S": { "item": "sophisticatedbackpacks:smelting_upgrade" @@ -24,6 +24,7 @@ "TTT" ], "result": { - "item": "sophisticatedbackpacks:blasting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:blasting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/alchemy_bench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/alchemy_bench_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/alchemy_bench_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/alchemy_bench_upgrade.json index 2c032abe..07e85d58 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/alchemy_bench_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/alchemy_bench_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:alchemy_bench" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/alchemy_bench_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/alchemy_bench_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/botanist_workbench_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/botanist_workbench_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/botanist_workbench_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/botanist_workbench_upgrade.json index 74c53070..e48ba6ed 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/botanist_workbench_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/botanist_workbench_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:botanist_workbench" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/botanist_workbench_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/botanist_workbench_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/carpenters_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/carpenters_table_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/carpenters_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/carpenters_table_upgrade.json index 86d96a5d..73c0a537 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/carpenters_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/carpenters_table_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:carpenters_table" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/carpenters_table_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/carpenters_table_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/glassblower_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/glassblower_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/glassblower_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/glassblower_upgrade.json index baa5af0e..d72ddd59 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/glassblower_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/glassblower_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:glassblower" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/glassblower_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/glassblower_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/loom_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/loom_table_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/loom_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/loom_table_upgrade.json index 4280cfdf..31adb376 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/loom_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/loom_table_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:loom_table" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/loom_table_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/loom_table_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/mason_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/mason_table_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/mason_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/mason_table_upgrade.json index 26c5372e..49db61cc 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/mason_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/mason_table_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:mason_table" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/mason_table_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/mason_table_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/tinkering_table_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/tinkering_table_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/tinkering_table_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/tinkering_table_upgrade.json index 23b06a3a..319bbfe5 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/chipped/tinkering_table_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/chipped/tinkering_table_upgrade.json @@ -16,10 +16,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "W": { "item": "chipped:tinkering_table" @@ -31,6 +31,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:chipped/tinkering_table_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:chipped/tinkering_table_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/compacting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/compacting_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/compacting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/compacting_upgrade.json index 6bbf18ae..4979fedc 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/compacting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/compacting_upgrade.json @@ -12,13 +12,13 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "P": { "item": "minecraft:piston" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RPR" ], "result": { - "item": "sophisticatedbackpacks:compacting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:compacting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/copper_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/copper_backpack.json similarity index 80% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/copper_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/copper_backpack.json index f0603020..f67b6dcd 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/copper_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/copper_backpack.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:backpack" }, "C": { - "tag": "forge:ingots/copper" + "tag": "c:ingots/copper" } }, "pattern": [ @@ -21,6 +21,7 @@ "CCC" ], "result": { - "item": "sophisticatedbackpacks:copper_backpack" + "count": 1, + "id": "sophisticatedbackpacks:copper_backpack" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/crafting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/crafting_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/crafting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/crafting_upgrade.json index 68f3b8ee..838a166a 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/crafting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/crafting_upgrade.json @@ -12,10 +12,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "C": { - "tag": "forge:chests" + "tag": "c:chests" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "T": { "item": "minecraft:crafting_table" @@ -27,6 +27,7 @@ " C " ], "result": { - "item": "sophisticatedbackpacks:crafting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:crafting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/deposit_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/deposit_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/deposit_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/deposit_upgrade.json index 851f058c..0bc13f93 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/deposit_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/deposit_upgrade.json @@ -12,16 +12,16 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "P": { "item": "minecraft:piston" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -30,6 +30,7 @@ "RCR" ], "result": { - "item": "sophisticatedbackpacks:deposit_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:deposit_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/diamond_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/diamond_backpack.json similarity index 80% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/diamond_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/diamond_backpack.json index 03d32594..8ecde44a 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/diamond_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/diamond_backpack.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:gold_backpack" }, "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } }, "pattern": [ @@ -21,6 +21,7 @@ "DDD" ], "result": { - "item": "sophisticatedbackpacks:diamond_backpack" + "count": 1, + "id": "sophisticatedbackpacks:diamond_backpack" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/everlasting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/everlasting_upgrade.json similarity index 81% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/everlasting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/everlasting_upgrade.json index 5ff3ace7..241301f1 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/everlasting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/everlasting_upgrade.json @@ -15,7 +15,7 @@ "item": "minecraft:end_crystal" }, "S": { - "tag": "forge:nether_stars" + "tag": "c:nether_stars" } }, "pattern": [ @@ -24,6 +24,7 @@ "CSC" ], "result": { - "item": "sophisticatedbackpacks:everlasting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:everlasting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/feeding_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/feeding_upgrade.json similarity index 85% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/feeding_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/feeding_upgrade.json index 3f97fb40..fedb3f46 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/feeding_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/feeding_upgrade.json @@ -18,7 +18,7 @@ "item": "minecraft:golden_carrot" }, "E": { - "tag": "forge:ender_pearls" + "tag": "c:ender_pearls" }, "M": { "item": "minecraft:glistering_melon_slice" @@ -30,6 +30,7 @@ " E " ], "result": { - "item": "sophisticatedbackpacks:feeding_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:feeding_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/filter_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/filter_upgrade.json similarity index 77% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/filter_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/filter_upgrade.json index 8cda3b14..f56e71ef 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/filter_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/filter_upgrade.json @@ -12,10 +12,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -24,6 +24,7 @@ "RSR" ], "result": { - "item": "sophisticatedbackpacks:filter_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:filter_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/gold_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/gold_backpack.json similarity index 81% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/gold_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/gold_backpack.json index 88b28e18..309d67f9 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/gold_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/gold_backpack.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:iron_backpack" }, "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" } }, "pattern": [ @@ -21,6 +21,7 @@ "GGG" ], "result": { - "item": "sophisticatedbackpacks:gold_backpack" + "count": 1, + "id": "sophisticatedbackpacks:gold_backpack" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/inception_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/inception_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/inception_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/inception_upgrade.json index 314c1df5..dbf92387 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/inception_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/inception_upgrade.json @@ -12,13 +12,13 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "D": { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, "E": { "item": "minecraft:ender_eye" }, "S": { - "tag": "forge:nether_stars" + "tag": "c:nether_stars" } }, "pattern": [ @@ -27,6 +27,7 @@ "EDE" ], "result": { - "item": "sophisticatedbackpacks:inception_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:inception_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/iron_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/iron_backpack.json similarity index 81% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/iron_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/iron_backpack.json index 84399376..7e7bc7ed 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/iron_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/iron_backpack.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:backpack" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -21,6 +21,7 @@ "III" ], "result": { - "item": "sophisticatedbackpacks:iron_backpack" + "count": 1, + "id": "sophisticatedbackpacks:iron_backpack" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/iron_backpack_from_copper.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/iron_backpack_from_copper.json similarity index 81% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/iron_backpack_from_copper.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/iron_backpack_from_copper.json index 77c3f9e9..45b07f26 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/iron_backpack_from_copper.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/iron_backpack_from_copper.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:copper_backpack" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -21,6 +21,7 @@ " I " ], "result": { - "item": "sophisticatedbackpacks:iron_backpack" + "count": 1, + "id": "sophisticatedbackpacks:iron_backpack" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/jukebox_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/jukebox_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/jukebox_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/jukebox_upgrade.json index e0da65c6..4fa9c79b 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/jukebox_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/jukebox_upgrade.json @@ -12,13 +12,13 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "J": { "item": "minecraft:jukebox" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:jukebox_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:jukebox_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/magnet_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/magnet_upgrade.json similarity index 71% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/magnet_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/magnet_upgrade.json index 92306df5..b95a01ef 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/magnet_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/magnet_upgrade.json @@ -9,19 +9,19 @@ "category": "misc", "key": { "E": { - "tag": "forge:ender_pearls" + "tag": "c:ender_pearls" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "L": { - "tag": "forge:gems/lapis" + "tag": "c:gems/lapis" }, "P": { "item": "sophisticatedbackpacks:pickup_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -30,6 +30,7 @@ "R L" ], "result": { - "item": "sophisticatedbackpacks:magnet_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:magnet_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/netherite_backpack.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/netherite_backpack.json similarity index 80% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/netherite_backpack.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/netherite_backpack.json index 150e0512..53e27536 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/netherite_backpack.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/netherite_backpack.json @@ -7,7 +7,8 @@ "item": "sophisticatedbackpacks:diamond_backpack" }, "result": { - "item": "sophisticatedbackpacks:netherite_backpack" + "count": 1, + "id": "sophisticatedbackpacks:netherite_backpack" }, "template": { "item": "minecraft:netherite_upgrade_smithing_template" diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/pickup_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/pickup_upgrade.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/pickup_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/pickup_upgrade.json index b30be96c..a8eb572f 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/pickup_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/pickup_upgrade.json @@ -15,10 +15,10 @@ "item": "minecraft:sticky_piston" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -27,6 +27,7 @@ "RRR" ], "result": { - "item": "sophisticatedbackpacks:pickup_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:pickup_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/pump_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/pump_upgrade.json similarity index 85% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/pump_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/pump_upgrade.json index a7e2e435..636f6bb9 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/pump_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/pump_upgrade.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "G": { - "tag": "forge:glass" + "tag": "c:glass_blocks" }, "P": { "item": "minecraft:piston" @@ -30,6 +30,7 @@ "GUG" ], "result": { - "item": "sophisticatedbackpacks:pump_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:pump_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/refill_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/refill_upgrade.json similarity index 70% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/refill_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/refill_upgrade.json index a5696dca..e63c4cf2 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/refill_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/refill_upgrade.json @@ -12,16 +12,16 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "E": { - "tag": "forge:ender_pearls" + "tag": "c:ender_pearls" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -30,6 +30,7 @@ "RCR" ], "result": { - "item": "sophisticatedbackpacks:refill_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:refill_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/restock_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/restock_upgrade.json similarity index 75% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/restock_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/restock_upgrade.json index 068522f8..1085badb 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/restock_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/restock_upgrade.json @@ -12,16 +12,16 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "C": { - "tag": "forge:chests/wooden" + "tag": "c:chests/wooden" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "P": { "item": "minecraft:sticky_piston" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -30,6 +30,7 @@ "RCR" ], "result": { - "item": "sophisticatedbackpacks:restock_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:restock_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/smelting_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/smelting_upgrade.json index 823e0e26..1ef6ebe9 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/smelting_upgrade.json @@ -15,10 +15,10 @@ "item": "minecraft:furnace" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RFR" ], "result": { - "item": "sophisticatedbackpacks:smelting_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:smelting_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/smoking_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/smoking_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/smoking_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/smoking_upgrade.json index ad01cfff..48eed598 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/smoking_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/smoking_upgrade.json @@ -12,10 +12,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { "item": "minecraft:smoker" @@ -27,6 +27,7 @@ "RSR" ], "result": { - "item": "sophisticatedbackpacks:smoking_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:smoking_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/smoking_upgrade_from_smelting_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/smoking_upgrade_from_smelting_upgrade.json similarity index 86% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/smoking_upgrade_from_smelting_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/smoking_upgrade_from_smelting_upgrade.json index b50e4508..881c9fae 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/smoking_upgrade_from_smelting_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/smoking_upgrade_from_smelting_upgrade.json @@ -21,6 +21,7 @@ " L " ], "result": { - "item": "sophisticatedbackpacks:smoking_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:smoking_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_starter_tier.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_starter_tier.json similarity index 77% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_starter_tier.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_starter_tier.json index df7b9d9a..7ee9d62f 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_starter_tier.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_starter_tier.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "C": { - "tag": "forge:storage_blocks/copper" + "tag": "c:storage_blocks/copper" } }, "pattern": [ @@ -21,6 +21,7 @@ "CCC" ], "result": { - "item": "sophisticatedbackpacks:stack_upgrade_starter_tier" + "count": 1, + "id": "sophisticatedbackpacks:stack_upgrade_starter_tier" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_1.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_1.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_1.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_1.json index 6d05600a..50ae4558 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_1.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_1.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:storage_blocks/iron" + "tag": "c:storage_blocks/iron" } }, "pattern": [ @@ -21,6 +21,7 @@ "III" ], "result": { - "item": "sophisticatedbackpacks:stack_upgrade_tier_1" + "count": 1, + "id": "sophisticatedbackpacks:stack_upgrade_tier_1" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_1_from_starter.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_1_from_starter.json similarity index 79% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_1_from_starter.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_1_from_starter.json index e6f7e4ef..0c90b9fe 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_1_from_starter.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_1_from_starter.json @@ -9,7 +9,7 @@ "category": "misc", "key": { "I": { - "tag": "forge:storage_blocks/iron" + "tag": "c:storage_blocks/iron" }, "S": { "item": "sophisticatedbackpacks:stack_upgrade_starter_tier" @@ -21,6 +21,7 @@ " I " ], "result": { - "item": "sophisticatedbackpacks:stack_upgrade_tier_1" + "count": 1, + "id": "sophisticatedbackpacks:stack_upgrade_tier_1" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_2.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_2.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_2.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_2.json index 1c69a18b..826bc954 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_2.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_2.json @@ -9,7 +9,7 @@ "category": "misc", "key": { "G": { - "tag": "forge:storage_blocks/gold" + "tag": "c:storage_blocks/gold" }, "S": { "item": "sophisticatedbackpacks:stack_upgrade_tier_1" @@ -21,6 +21,7 @@ "GGG" ], "result": { - "item": "sophisticatedbackpacks:stack_upgrade_tier_2" + "count": 1, + "id": "sophisticatedbackpacks:stack_upgrade_tier_2" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_3.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_3.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_3.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_3.json index e5462a17..4a370f82 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_3.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_3.json @@ -9,7 +9,7 @@ "category": "misc", "key": { "D": { - "tag": "forge:storage_blocks/diamond" + "tag": "c:storage_blocks/diamond" }, "S": { "item": "sophisticatedbackpacks:stack_upgrade_tier_2" @@ -21,6 +21,7 @@ "DDD" ], "result": { - "item": "sophisticatedbackpacks:stack_upgrade_tier_3" + "count": 1, + "id": "sophisticatedbackpacks:stack_upgrade_tier_3" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_4.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_4.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_4.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_4.json index 5081f6b0..7f087248 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stack_upgrade_tier_4.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stack_upgrade_tier_4.json @@ -9,7 +9,7 @@ "category": "misc", "key": { "N": { - "tag": "forge:storage_blocks/netherite" + "tag": "c:storage_blocks/netherite" }, "S": { "item": "sophisticatedbackpacks:stack_upgrade_tier_3" @@ -21,6 +21,7 @@ "NNN" ], "result": { - "item": "sophisticatedbackpacks:stack_upgrade_tier_4" + "count": 1, + "id": "sophisticatedbackpacks:stack_upgrade_tier_4" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/stonecutter_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/stonecutter_upgrade.json similarity index 78% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/stonecutter_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/stonecutter_upgrade.json index 54abce00..68ea62f7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/stonecutter_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/stonecutter_upgrade.json @@ -12,10 +12,10 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { "item": "minecraft:stonecutter" @@ -27,6 +27,7 @@ " R " ], "result": { - "item": "sophisticatedbackpacks:stonecutter_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:stonecutter_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/tank_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/tank_upgrade.json similarity index 81% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/tank_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/tank_upgrade.json index f2fadae3..517399e7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/tank_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/tank_upgrade.json @@ -12,7 +12,7 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "G": { - "tag": "forge:glass" + "tag": "c:glass_blocks" } }, "pattern": [ @@ -21,6 +21,7 @@ "GGG" ], "result": { - "item": "sophisticatedbackpacks:tank_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:tank_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/tool_swapper_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/tool_swapper_upgrade.json similarity index 82% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/tool_swapper_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/tool_swapper_upgrade.json index 134e0a73..dd730453 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/tool_swapper_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/tool_swapper_upgrade.json @@ -15,13 +15,13 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "P": { "item": "minecraft:wooden_pickaxe" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" }, "S": { "item": "minecraft:wooden_shovel" @@ -36,6 +36,7 @@ "ISI" ], "result": { - "item": "sophisticatedbackpacks:tool_swapper_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:tool_swapper_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/upgrade_base.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/upgrade_base.json similarity index 71% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/upgrade_base.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/upgrade_base.json index 79539688..28d365d7 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/upgrade_base.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/upgrade_base.json @@ -9,13 +9,13 @@ "category": "misc", "key": { "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "L": { - "tag": "forge:leather" + "tag": "c:leathers" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -24,6 +24,7 @@ "SIS" ], "result": { - "item": "sophisticatedbackpacks:upgrade_base" + "count": 1, + "id": "sophisticatedbackpacks:upgrade_base" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/void_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/void_upgrade.json similarity index 73% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/void_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/void_upgrade.json index 590125bf..38b729ab 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/void_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/void_upgrade.json @@ -12,13 +12,13 @@ "item": "sophisticatedbackpacks:upgrade_base" }, "E": { - "tag": "forge:ender_pearls" + "tag": "c:ender_pearls" }, "O": { - "tag": "forge:obsidian" + "tag": "c:obsidians" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "ROR" ], "result": { - "item": "sophisticatedbackpacks:void_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:void_upgrade" } } \ No newline at end of file diff --git a/src/generated/resources/data/sophisticatedbackpacks/recipes/xp_pump_upgrade.json b/src/generated/resources/data/sophisticatedbackpacks/recipe/xp_pump_upgrade.json similarity index 84% rename from src/generated/resources/data/sophisticatedbackpacks/recipes/xp_pump_upgrade.json rename to src/generated/resources/data/sophisticatedbackpacks/recipe/xp_pump_upgrade.json index d62aab7f..b18e4658 100644 --- a/src/generated/resources/data/sophisticatedbackpacks/recipes/xp_pump_upgrade.json +++ b/src/generated/resources/data/sophisticatedbackpacks/recipe/xp_pump_upgrade.json @@ -18,7 +18,7 @@ "item": "sophisticatedbackpacks:advanced_pump_upgrade" }, "R": { - "tag": "forge:dusts/redstone" + "tag": "c:dusts/redstone" } }, "pattern": [ @@ -27,6 +27,7 @@ "RER" ], "result": { - "item": "sophisticatedbackpacks:xp_pump_upgrade" + "count": 1, + "id": "sophisticatedbackpacks:xp_pump_upgrade" } } \ No newline at end of file diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java index b034ba4b..04511e34 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/Config.java @@ -1,11 +1,13 @@ package net.p3pp3rf1y.sophisticatedbackpacks; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.LootTable; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.event.config.ModConfigEvent; import net.neoforged.neoforge.common.ModConfigSpec; @@ -272,8 +274,8 @@ private void initEntityLootTables() { String entityRegistryName = entityLoot[0]; String lootTableName = entityLoot[1]; - BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.fromNamespaceAndPath(entityRegistryName)) - .ifPresent(entityType -> entityLootTables.put(entityType, lootTableName.equals("null") ? null : ResourceLocation.fromNamespaceAndPath(lootTableName))); + BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.parse(entityRegistryName)) + .ifPresent(entityType -> entityLootTables.put(entityType, lootTableName.equals("null") ? null : ResourceLocation.parse(lootTableName))); } } @@ -285,11 +287,11 @@ private List getDefaultDiscBlockList() { } private List getDefaultEntityLootTableList() { - return getDefaultEntityLootMapping().entrySet().stream().map(e -> BuiltInRegistries.ENTITY_TYPE.getKey(e.getKey()) + "|" + e.getValue()).collect(Collectors.toList()); + return getDefaultEntityLootMapping().entrySet().stream().map(e -> BuiltInRegistries.ENTITY_TYPE.getKey(e.getKey()) + "|" + e.getValue().location()).collect(Collectors.toList()); } - private Map, ResourceLocation> getDefaultEntityLootMapping() { - Map, ResourceLocation> mapping = new LinkedHashMap<>(); + private Map, ResourceKey> getDefaultEntityLootMapping() { + Map, ResourceKey> mapping = new LinkedHashMap<>(); mapping.put(EntityType.CREEPER, BuiltInLootTables.DESERT_PYRAMID); mapping.put(EntityType.DROWNED, BuiltInLootTables.SHIPWRECK_TREASURE); mapping.put(EntityType.ENDERMAN, BuiltInLootTables.END_CITY_TREASURE); @@ -361,7 +363,7 @@ private void loadDisallowedSet() { noInteractionBlocksSet = new HashSet<>(); for (String disallowedItemName : noInteractionBlocksList.get()) { - ResourceLocation registryName = ResourceLocation.fromNamespaceAndPath(disallowedItemName); + ResourceLocation registryName = ResourceLocation.parse(disallowedItemName); if (BuiltInRegistries.BLOCK.containsKey(registryName)) { noInteractionBlocksSet.add(BuiltInRegistries.BLOCK.get(registryName)); } @@ -394,7 +396,7 @@ private void loadDisallowedSet() { noConnnectionBlocksSet = new HashSet<>(); for (String disallowedItemName : noConnectionBlocksList.get()) { - ResourceLocation registryName = ResourceLocation.fromNamespaceAndPath(disallowedItemName); + ResourceLocation registryName = ResourceLocation.parse(disallowedItemName); if (BuiltInRegistries.BLOCK.containsKey(registryName)) { noConnnectionBlocksSet.add(BuiltInRegistries.BLOCK.get(registryName)); } @@ -435,7 +437,7 @@ private void loadDisallowedSet() { disallowedItemsSet = new HashSet<>(); for (String disallowedItemName : disallowedItemsList.get()) { - ResourceLocation registryName = ResourceLocation.fromNamespaceAndPath(disallowedItemName); + ResourceLocation registryName = ResourceLocation.parse(disallowedItemName); BuiltInRegistries.ITEM.getOptional(registryName).ifPresent(disallowedItemsSet::add); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java index d3ed408d..5c24f32d 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/SophisticatedBackpacks.java @@ -3,12 +3,11 @@ import net.minecraft.resources.ResourceLocation; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.IEventBus; -import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.fml.config.ModConfig; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.fml.loading.FMLEnvironment; import net.neoforged.neoforge.client.event.RegisterClientTooltipComponentFactoriesEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.AddReloadListenerEvent; @@ -34,12 +33,12 @@ public class SophisticatedBackpacks { public final CommonEventHandler commonEventHandler = new CommonEventHandler(); @SuppressWarnings("java:S1118") //needs to be public for mod to work - public SophisticatedBackpacks(IEventBus modBus) { - ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.SERVER_SPEC); - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.COMMON_SPEC); + public SophisticatedBackpacks(IEventBus modBus, Dist dist, ModContainer container) { + container.registerConfig(ModConfig.Type.SERVER, Config.SERVER_SPEC); + container.registerConfig(ModConfig.Type.COMMON, Config.COMMON_SPEC); commonEventHandler.registerHandlers(modBus); ModCompat.register(); - if (FMLEnvironment.dist == Dist.CLIENT) { + if (dist == Dist.CLIENT) { ClientEventHandler.registerHandlers(modBus); modBus.addListener(KeybindHandler::registerKeyMappings); modBus.addListener(SophisticatedBackpacks::registerTooltipComponent); @@ -73,7 +72,7 @@ private void onAddReloadListener(AddReloadListenerEvent event) { } public static ResourceLocation getRL(String regName) { - return ResourceLocation.fromNamespaceAndPath(getRegistryName(regName)); + return ResourceLocation.fromNamespaceAndPath(MOD_ID, regName); } public static String getRegistryName(String regName) { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/AccessLogRecord.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/AccessLogRecord.java index 7330f2dc..5160a68c 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/AccessLogRecord.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/AccessLogRecord.java @@ -73,7 +73,7 @@ public CompoundTag serializeToNBT() { public static AccessLogRecord deserializeFromNBT(CompoundTag nbt) { return new AccessLogRecord( - ResourceLocation.fromNamespaceAndPath(nbt.getString("backpackItemRegistryName")), + ResourceLocation.parse(nbt.getString("backpackItemRegistryName")), nbt.getUUID("backpackUuid"), nbt.getString("playerName"), nbt.getString("backpackName"), diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlock.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlock.java index 6b7d5825..2e95273b 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlock.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlock.java @@ -9,6 +9,7 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.SimpleMenuProvider; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; @@ -84,25 +85,21 @@ public BackpackBlock(float explosionResistance) { registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false).setValue(LEFT_TANK, false).setValue(RIGHT_TANK, false)); } - @SuppressWarnings("deprecation") @Override public boolean hasAnalogOutputSignal(BlockState state) { return true; } - @SuppressWarnings("deprecation") @Override public int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos pos) { return WorldHelper.getBlockEntity(level, pos, BackpackBlockEntity.class).map(t -> InventoryHelper.getAnalogOutputSignal(t.getBackpackWrapper().getInventoryForInputOutput())).orElse(0); } - @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return Boolean.TRUE.equals(state.getValue(WATERLOGGED)) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - @SuppressWarnings("deprecation") @Override public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { if (Boolean.TRUE.equals(stateIn.getValue(WATERLOGGED))) { @@ -129,7 +126,6 @@ private boolean hasEverlastingUpgrade(BlockGetter world, BlockPos pos) { return WorldHelper.getBlockEntity(world, pos, BackpackBlockEntity.class).map(be -> !be.getBackpackWrapper().getUpgradeHandler().getTypeWrappers(EverlastingUpgradeItem.TYPE).isEmpty()).orElse(false); } - @SuppressWarnings("deprecation") @Override public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return BackpackShapes.getShape(this, state.getValue(FACING), state.getValue(LEFT_TANK), state.getValue(RIGHT_TANK), state.getValue(BATTERY)); @@ -141,40 +137,43 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BackpackBlockEntity(pos, state); } - @SuppressWarnings("deprecation") @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hit) { if (level.isClientSide) { return InteractionResult.SUCCESS; } - ItemStack heldItem = player.getItemInHand(hand); + ItemStack heldItem = player.getMainHandItem(); if (player.isShiftKeyDown() && heldItem.isEmpty()) { - putInPlayersHandAndRemove(state, level, pos, player, hand); + putInPlayersHandAndRemove(state, level, pos, player, InteractionHand.MAIN_HAND); return InteractionResult.SUCCESS; } - if (!heldItem.isEmpty() && heldItem.getCapability(Capabilities.FluidHandler.ITEM) instanceof IFluidHandlerItem) { + BackpackContext.Block backpackContext = new BackpackContext.Block(pos); + + player.openMenu(new SimpleMenuProvider((w, p, pl) -> new BackpackContainer(w, pl, backpackContext), getBackpackDisplayName(level, pos)), backpackContext::toBuffer); + return InteractionResult.SUCCESS; + } + + @Override + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { + if (!stack.isEmpty() && stack.getCapability(Capabilities.FluidHandler.ITEM) instanceof IFluidHandlerItem) { WorldHelper.getBlockEntity(level, pos, BackpackBlockEntity.class) .flatMap(be -> be.getBackpackWrapper().getFluidHandler()).ifPresent(backpackFluidHandler -> CapabilityHelper.runOnItemHandler(player, playerInventory -> { - FluidActionResult resultOfEmptying = FluidUtil.tryEmptyContainerAndStow(heldItem, backpackFluidHandler, playerInventory, FluidType.BUCKET_VOLUME, player, true); + FluidActionResult resultOfEmptying = FluidUtil.tryEmptyContainerAndStow(stack, backpackFluidHandler, playerInventory, FluidType.BUCKET_VOLUME, player, true); if (resultOfEmptying.isSuccess()) { - player.setItemInHand(hand, resultOfEmptying.getResult()); + player.setItemInHand(InteractionHand.MAIN_HAND, resultOfEmptying.getResult()); } else { - FluidActionResult resultOfFilling = FluidUtil.tryFillContainerAndStow(heldItem, backpackFluidHandler, playerInventory, FluidType.BUCKET_VOLUME, player, true); + FluidActionResult resultOfFilling = FluidUtil.tryFillContainerAndStow(stack, backpackFluidHandler, playerInventory, FluidType.BUCKET_VOLUME, player, true); if (resultOfFilling.isSuccess()) { - player.setItemInHand(hand, resultOfFilling.getResult()); + player.setItemInHand(InteractionHand.MAIN_HAND, resultOfFilling.getResult()); } } })); - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } - - BackpackContext.Block backpackContext = new BackpackContext.Block(pos); - - player.openMenu(new SimpleMenuProvider((w, p, pl) -> new BackpackContainer(w, pl, backpackContext), getBackpackDisplayName(level, pos)), backpackContext::toBuffer); - return InteractionResult.SUCCESS; + return super.useItemOn(stack, state, level, pos, player, hand, hitResult); } private Component getBackpackDisplayName(Level level, BlockPos pos) { @@ -194,7 +193,6 @@ private static void putInPlayersHandAndRemove(BlockState state, Level level, Blo level.playSound(null, pos, soundType.getBreakSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); } - @SuppressWarnings("deprecation") @Override public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) { if (!state.is(newState.getBlock())) { @@ -212,7 +210,7 @@ public BlockState playerWillDestroy(Level level, BlockPos pos, BlockState state, } private static void stopBackpackSounds(ItemStack backpack, Level level, BlockPos pos) { - BackpackWrapper.fromData(backpack).getContentsUuid().ifPresent(uuid -> + BackpackWrapper.fromStack(backpack).getContentsUuid().ifPresent(uuid -> ServerStorageSoundHandler.stopPlayingDisc(level, Vec3.atCenterOf(pos), uuid)); } @@ -250,7 +248,6 @@ private static boolean hasEmptyMainHandAndSomethingInOffhand(Player player) { return player.getMainHandItem().isEmpty() && !player.getOffhandItem().isEmpty(); } - @SuppressWarnings("deprecation") @Override public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { super.entityInside(state, level, pos, entity); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java index fcea3124..fe2241d7 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackBlockEntity.java @@ -2,6 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; @@ -24,6 +25,7 @@ import net.p3pp3rf1y.sophisticatedcore.renderdata.RenderInfo; import net.p3pp3rf1y.sophisticatedcore.renderdata.TankPosition; import net.p3pp3rf1y.sophisticatedcore.upgrades.ITickableUpgrade; +import net.p3pp3rf1y.sophisticatedcore.util.RegistryHelper; import net.p3pp3rf1y.sophisticatedcore.util.WorldHelper; import javax.annotation.Nullable; @@ -53,7 +55,7 @@ public BackpackBlockEntity(BlockPos pos, BlockState state) { } public void setBackpack(ItemStack backpack) { - backpackWrapper = BackpackWrapper.fromData(backpack); + backpackWrapper = BackpackWrapper.fromStack(backpack); backpackWrapper.setSaveHandler(() -> { setChanged(); updateBlockRender = false; @@ -64,8 +66,8 @@ public void setBackpack(ItemStack backpack) { } @Override - public void load(CompoundTag tag) { - super.load(tag); + public void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); setBackpackFromNbt(tag); loadControllerPos(tag); @@ -84,26 +86,25 @@ public void onLoad() { } private void setBackpackFromNbt(CompoundTag nbt) { - setBackpack(ItemStack.of(nbt.getCompound("backpackData"))); + RegistryHelper.getRegistryAccess().ifPresent(registryAccess -> setBackpack(ItemStack.parseOptional(registryAccess, nbt.getCompound("backpackData")))); } @Override - protected void saveAdditional(CompoundTag tag) { - super.saveAdditional(tag); - writeBackpack(tag); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + writeBackpack(tag, registries); saveControllerPos(tag); } - private void writeBackpack(CompoundTag ret) { + private void writeBackpack(CompoundTag ret, HolderLookup.Provider registries) { ItemStack backpackCopy = backpackWrapper.getBackpack().copy(); - backpackCopy.setTag(backpackCopy.getTag()); - ret.put("backpackData", backpackCopy.save(new CompoundTag())); + ret.put("backpackData", backpackCopy.save(registries)); } @Override - public CompoundTag getUpdateTag() { - CompoundTag ret = super.getUpdateTag(); - writeBackpack(ret); + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { + CompoundTag ret = super.getUpdateTag(registries); + writeBackpack(ret, registries); ret.putBoolean("updateBlockRender", updateBlockRender); updateBlockRender = true; return ret; @@ -116,7 +117,7 @@ public ClientboundBlockEntityDataPacket getUpdatePacket() { } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt, HolderLookup.Provider registries) { CompoundTag tag = pkt.getTag(); if (tag == null) { return; diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java index 5850cdbd..4caa88a9 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackItem.java @@ -1,11 +1,10 @@ package net.p3pp3rf1y.sophisticatedbackpacks.backpack; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; @@ -35,12 +34,9 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.neoforged.fml.loading.FMLEnvironment; -import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; -import net.neoforged.neoforge.common.util.Lazy; import net.p3pp3rf1y.sophisticatedbackpacks.Config; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackWrapper; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; -import net.p3pp3rf1y.sophisticatedbackpacks.client.render.BackpackItemStackRenderer; import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContainer; import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContext; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; @@ -50,6 +46,7 @@ import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; import net.p3pp3rf1y.sophisticatedcore.api.IStashStorageItem; import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.TranslationHelper; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.settings.memory.MemorySettingsCategory; import net.p3pp3rf1y.sophisticatedcore.upgrades.ITickableUpgrade; import net.p3pp3rf1y.sophisticatedcore.upgrades.jukebox.ServerStorageSoundHandler; @@ -83,16 +80,9 @@ public BackpackItem(IntSupplier numberOfSlots, IntSupplier numberOfUpgradeSlots, this.blockSupplier = blockSupplier; } - @Override - public void initializeClient(Consumer consumer) { - consumer.accept(new IClientItemExtensions() { - private final Lazy ister = Lazy.of(() -> new BackpackItemStackRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels())); - - @Override - public BlockEntityWithoutLevelRenderer getCustomRenderer() { - return ister.get(); - } - }); + public static void setColors(ItemStack backpackStack, int mainColor, int accentColor) { + backpackStack.set(ModCoreDataComponents.MAIN_COLOR, mainColor); + backpackStack.set(ModCoreDataComponents.ACCENT_COLOR, accentColor); } @Override @@ -105,19 +95,19 @@ public void addCreativeTabItems(Consumer itemConsumer) { for (DyeColor color : DyeColor.values()) { ItemStack stack = new ItemStack(this); - new BackpackWrapper().setBackpackStack(stack).setColors(ColorHelper.getColor(color.getTextureDiffuseColors()), ColorHelper.getColor(color.getTextureDiffuseColors())); + setColors(stack, color.getTextureDiffuseColor(), color.getTextureDiffuseColor()); itemConsumer.accept(stack); } - int clothColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_CLOTH_COLOR, BackpackWrapper.DEFAULT_CLOTH_COLOR, List.of( - DyeColor.BLUE, DyeColor.YELLOW, DyeColor.LIME + int mainColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_MAIN_COLOR, BackpackWrapper.DEFAULT_MAIN_COLOR, List.of( + DyeColor.YELLOW, DyeColor.LIME )); - int trimColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_BORDER_COLOR, BackpackWrapper.DEFAULT_BORDER_COLOR, List.of( + int accentColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_ACCENT_COLOR, BackpackWrapper.DEFAULT_ACCENT_COLOR, List.of( DyeColor.BLUE, DyeColor.BLACK )); ItemStack stack = new ItemStack(this); - new BackpackWrapper().setBackpackStack(stack).setColors(clothColor, trimColor); + setColors(stack, mainColor, accentColor); itemConsumer.accept(stack); } @@ -125,7 +115,7 @@ public void addCreativeTabItems(Consumer itemConsumer) { public void appendHoverText(ItemStack stack, Item.TooltipContext context, List tooltip, TooltipFlag flagIn) { super.appendHoverText(stack, context, tooltip, flagIn); if (flagIn == TooltipFlag.ADVANCED) { - BackpackWrapper.fromData(stack).getContentsUuid() + BackpackWrapper.fromStack(stack).getContentsUuid() .ifPresent(uuid -> tooltip.add(Component.literal("UUID: " + uuid).withStyle(ChatFormatting.DARK_GRAY))); } if (!Screen.hasShiftDown()) { @@ -150,7 +140,7 @@ public boolean hasCustomEntity(ItemStack stack) { } private boolean hasEverlastingUpgrade(ItemStack stack) { - return !BackpackWrapper.fromData(stack).getUpgradeHandler().getTypeWrappers(EverlastingUpgradeItem.TYPE).isEmpty(); + return !BackpackWrapper.fromStack(stack).getUpgradeHandler().getTypeWrappers(EverlastingUpgradeItem.TYPE).isEmpty(); } @Nullable @@ -237,7 +227,7 @@ public InteractionResult tryPlace(@Nullable Player player, Direction direction, } private static void stopBackpackSounds(ItemStack backpack, Level level, BlockPos pos) { - BackpackWrapper.fromData(backpack) + BackpackWrapper.fromStack(backpack) .getContentsUuid() .ifPresent(uuid -> ServerStorageSoundHandler.stopPlayingDisc(level, Vec3.atCenterOf(pos), uuid)); } @@ -246,7 +236,7 @@ private ItemStack getBackpackCopy(@Nullable Player player, ItemStack backpack) { if (player == null || !player.isCreative()) { return backpack.copy(); } - return BackpackWrapper.fromData(backpack).cloneBackpack(); + return BackpackWrapper.fromStack(backpack).cloneBackpack(); } protected boolean canPlace(BlockPlaceContext context, BlockState state) { @@ -273,7 +263,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemS if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || player.isDeadOrDying() || (Config.SERVER.nerfsConfig.onlyWornBackpackTriggersUpgrades.get() && itemSlot > -1)) { return; } - BackpackWrapper.fromData(stack).getUpgradeHandler().getWrappersThatImplement(ITickableUpgrade.class) + BackpackWrapper.fromStack(stack).getUpgradeHandler().getWrappersThatImplement(ITickableUpgrade.class) .forEach(upgrade -> upgrade.tick(player, player.level(), player.blockPosition()) ); super.inventoryTick(stack, level, entity, itemSlot, isSelected); @@ -313,14 +303,13 @@ public Optional getInventoryTooltip(ItemStack stack) { return Optional.of(new BackpackContentsTooltip(stack)); } - @Override public ItemStack stash(ItemStack storageStack, ItemStack stack) { - return BackpackWrapper.fromData(storageStack).getInventoryForUpgradeProcessing().insertItem(stack, false); + return BackpackWrapper.fromStack(storageStack).getInventoryForUpgradeProcessing().insertItem(stack, false); } @Override - public StashResult getItemStashable(ItemStack storageStack, ItemStack stack) { - IBackpackWrapper wrapper = BackpackWrapper.fromData(storageStack); + public StashResult getItemStashable(HolderLookup.Provider registries, ItemStack storageStack, ItemStack stack) { + IBackpackWrapper wrapper = BackpackWrapper.fromStack(storageStack); if (wrapper.getInventoryForUpgradeProcessing().insertItem(stack, true).getCount() == stack.getCount()) { return StashResult.NO_SPACE; } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java index 67680884..d4bdefa2 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java @@ -1,5 +1,6 @@ package net.p3pp3rf1y.sophisticatedbackpacks.backpack; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtUtils; @@ -40,7 +41,7 @@ public static BackpackStorage get() { return clientStorageCopy; } - public static BackpackStorage load(CompoundTag nbt) { + public static BackpackStorage load(CompoundTag nbt, HolderLookup.Provider registries) { BackpackStorage storage = new BackpackStorage(); readBackpackContents(nbt, storage); readAccessLogs(nbt, storage); @@ -64,7 +65,7 @@ private static void readBackpackContents(CompoundTag nbt, BackpackStorage storag } @Override - public CompoundTag save(CompoundTag compound) { + public CompoundTag save(CompoundTag compound, HolderLookup.Provider registries) { CompoundTag ret = new CompoundTag(); writeBackpackContents(ret); writeAccessLogs(ret); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/UUIDDeduplicator.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/UUIDDeduplicator.java index 742625aa..b7ddc7c1 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/UUIDDeduplicator.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/UUIDDeduplicator.java @@ -22,7 +22,7 @@ private UUIDDeduplicator() { public static void checkForDuplicateBackpacksAndRemoveTheirUUID(Player player, UUID backpackUuid, ItemStack backpack) { PlayerInventoryProvider.get().runOnBackpacks(player, (otherBackpack, inventoryHandlerName, identifier, slot) -> { if (otherBackpack != backpack) { - IBackpackWrapper wrapper = BackpackWrapper.fromData(otherBackpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(otherBackpack); wrapper.getContentsUuid().ifPresent(uuid -> { if (uuid.equals(backpackUuid)) { wrapper.removeContentsUUIDTag(); @@ -35,7 +35,7 @@ public static void checkForDuplicateBackpacksAndRemoveTheirUUID(Player player, U } public static void dedupeBackpackItemEntityInArea(ItemEntity newBackpackItemEntity) { - IBackpackWrapper newBackpackWrapper = BackpackWrapper.fromData(newBackpackItemEntity.getItem()); + IBackpackWrapper newBackpackWrapper = BackpackWrapper.fromStack(newBackpackItemEntity.getItem()); newBackpackWrapper.getContentsUuid().ifPresent(backpackId -> dedupeBackpackItemEntityInArea(newBackpackWrapper, newBackpackItemEntity, backpackId)); } @@ -48,7 +48,7 @@ private static void dedupeBackpackItemEntityInArea(IBackpackWrapper newBackpackW } private static boolean checkEntityBackpackIdMatchAndRemoveIfItDoes(IBackpackWrapper newBackpackWrapper, UUID newBackpackId, ItemEntity entity) { - return BackpackWrapper.fromData(entity.getItem()).getContentsUuid().map(backpackId -> { + return BackpackWrapper.fromStack(entity.getItem()).getContentsUuid().map(backpackId -> { if (backpackId.equals(newBackpackId)) { newBackpackWrapper.removeContentsUUIDTag(); newBackpackWrapper.onContentsNbtUpdated(); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackFluidHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackFluidHandler.java index e08a3fe9..8c72da85 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackFluidHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackFluidHandler.java @@ -46,7 +46,7 @@ public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { } FluidStack contents = getAllTanks().get(tank).getContents(); - return contents.isEmpty() || contents.isFluidEqual(stack); + return contents.isEmpty() || FluidStack.isSameFluidSameComponents(contents, stack); } @Override @@ -58,7 +58,7 @@ public int fill(FluidStack resource, FluidAction action, boolean ignoreInOutLimi if (filled == resource.getAmount()) { return resource.getAmount(); } - toFill = new FluidStack(toFill, resource.getAmount() - filled); + toFill = new FluidStack(toFill.getFluid(), resource.getAmount() - filled); } return filled; @@ -75,8 +75,7 @@ public FluidStack drain(TagKey resourceTag, int maxDrain, FluidAction act FluidStack drained = FluidStack.EMPTY; int toDrain = maxDrain; for (TankUpgradeWrapper tank : getAllTanks()) { - Fluid tankFluid = tank.getContents().getFluid(); - if ((drained.isEmpty() && tankFluid.is(resourceTag)) || tank.getContents().isFluidEqual(drained)) { + if ((drained.isEmpty() && tank.getContents().is(resourceTag)) || FluidStack.isSameFluidSameComponents(tank.getContents(), drained)) { if (drained.isEmpty()) { drained = tank.drain(toDrain, action, ignoreInOutLimit); } else { @@ -99,7 +98,7 @@ public FluidStack drain(FluidStack resource, FluidAction action, boolean ignoreI int drained = 0; int toDrain = resource.getAmount(); for (TankUpgradeWrapper tank : getAllTanks()) { - if (tank.getContents().isFluidEqual(resource)) { + if (FluidStack.isSameFluidSameComponents(tank.getContents(), resource)) { drained += tank.drain(toDrain, action, ignoreInOutLimit).getAmount(); if (drained == resource.getAmount()) { return resource; @@ -108,7 +107,7 @@ public FluidStack drain(FluidStack resource, FluidAction action, boolean ignoreI } } - return drained == 0 ? FluidStack.EMPTY : new FluidStack(resource, drained); + return drained == 0 ? FluidStack.EMPTY : new FluidStack(resource.getFluid(), drained); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackInventoryHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackInventoryHandler.java index 717b1d2f..10211b99 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackInventoryHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackInventoryHandler.java @@ -24,6 +24,6 @@ private boolean hasInceptionUpgrade() { } private boolean isBackpackWithoutInceptionUpgrade(ItemStack stack) { - return (stack.getItem() instanceof BackpackItem) && !BackpackWrapper.fromData(stack).getUpgradeHandler().hasUpgrade(InceptionUpgradeItem.TYPE); + return (stack.getItem() instanceof BackpackItem) && !BackpackWrapper.fromStack(stack).getUpgradeHandler().hasUpgrade(InceptionUpgradeItem.TYPE); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackRenderInfo.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackRenderInfo.java index ebe4a248..b11c9586 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackRenderInfo.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackRenderInfo.java @@ -2,14 +2,13 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.renderdata.RenderInfo; -import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; import java.util.Optional; import java.util.function.Supplier; public class BackpackRenderInfo extends RenderInfo { - private static final String RENDER_INFO_TAG = "renderInfo"; private final ItemStack backpack; public BackpackRenderInfo(ItemStack backpack, Supplier getSaveHandler) { @@ -20,11 +19,11 @@ public BackpackRenderInfo(ItemStack backpack, Supplier getSaveHandler) @Override protected void serializeRenderInfo(CompoundTag renderInfo) { - NBTHelper.setCompoundNBT(backpack, RENDER_INFO_TAG, renderInfo); + backpack.set(ModCoreDataComponents.RENDER_INFO_TAG, renderInfo); } @Override protected Optional getRenderInfoTag() { - return NBTHelper.getCompound(backpack, RENDER_INFO_TAG); + return Optional.ofNullable(backpack.get(ModCoreDataComponents.RENDER_INFO_TAG)); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackWrapper.java index ca895785..8bf8e811 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/wrapper/BackpackWrapper.java @@ -2,9 +2,6 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.FloatTag; -import net.minecraft.nbt.IntTag; -import net.minecraft.nbt.StringTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -20,39 +17,31 @@ import net.p3pp3rf1y.sophisticatedbackpacks.api.IFluidHandlerWrapperUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModDataComponents; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; import net.p3pp3rf1y.sophisticatedcore.api.IStorageFluidHandler; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; import net.p3pp3rf1y.sophisticatedcore.common.gui.SortBy; -import net.p3pp3rf1y.sophisticatedcore.inventory.ITrackedContentsItemHandler; -import net.p3pp3rf1y.sophisticatedcore.inventory.InventoryHandler; -import net.p3pp3rf1y.sophisticatedcore.inventory.InventoryIOHandler; -import net.p3pp3rf1y.sophisticatedcore.inventory.ItemStackKey; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; +import net.p3pp3rf1y.sophisticatedcore.inventory.*; import net.p3pp3rf1y.sophisticatedcore.settings.itemdisplay.ItemDisplaySettingsCategory; import net.p3pp3rf1y.sophisticatedcore.settings.memory.MemorySettingsCategory; import net.p3pp3rf1y.sophisticatedcore.settings.nosort.NoSortSettingsCategory; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeHandler; import net.p3pp3rf1y.sophisticatedcore.upgrades.stack.StackUpgradeItem; import net.p3pp3rf1y.sophisticatedcore.upgrades.tank.TankUpgradeItem; -import net.p3pp3rf1y.sophisticatedcore.util.*; +import net.p3pp3rf1y.sophisticatedcore.util.InventoryHelper; +import net.p3pp3rf1y.sophisticatedcore.util.InventorySorter; +import net.p3pp3rf1y.sophisticatedcore.util.LootHelper; +import net.p3pp3rf1y.sophisticatedcore.util.RandHelper; import javax.annotation.Nullable; import java.util.*; import java.util.function.IntConsumer; public class BackpackWrapper implements IBackpackWrapper { - public static final int DEFAULT_CLOTH_COLOR = 13394234; - public static final int DEFAULT_BORDER_COLOR = 6434330; - private static final String CLOTH_COLOR_TAG = "clothColor"; - private static final String BORDER_COLOR_TAG = "borderColor"; - private static final String OPEN_TAB_ID_TAG = "openTabId"; - private static final String SORT_BY_TAG = "sortBy"; - private static final String CONTENTS_UUID_TAG = "contentsUuid"; - private static final String INVENTORY_SLOTS_TAG = "inventorySlots"; - private static final String UPGRADE_SLOTS_TAG = "upgradeSlots"; - private static final String LOOT_TABLE_NAME_TAG = "lootTableName"; - private static final String LOOT_PERCENTAGE_TAG = "lootPercentage"; - private static final String COLUMNS_TAKEN_TAG = "columnsTaken"; + public static final int DEFAULT_MAIN_COLOR = 0xFF_CC613A; + public static final int DEFAULT_ACCENT_COLOR = 0xFF_622E1A; @Nullable private ItemStack backpack; @@ -88,13 +77,28 @@ public class BackpackWrapper implements IBackpackWrapper { }; private Runnable upgradeCachesInvalidatedHandler = () -> { }; - - public static IBackpackWrapper fromData(ItemStack stack) { - return stack.getData(ModItems.BACKPACK_WRAPPER).setBackpackStack(stack); + public BackpackWrapper(ItemStack backpackStack) { + setBackpackStack(backpackStack); + } + + public static IBackpackWrapper fromStack(ItemStack stack) { + return StorageWrapperRepository.getStorageWrapper(stack, IBackpackWrapper.class, BackpackWrapper::new); + /* TODO try to add uuid based caching in the future + UUID uuid = stack.get(ModCoreDataComponents.STORAGE_UUID); + if (uuid == null) { + return StorageWrapperRepository.getStorageWrapper(stack, IBackpackWrapper.class, BackpackWrapper::new); + } else { + return StorageWrapperRepository.getStorageWrapper(uuid, IBackpackWrapper.class, BackpackWrapper::new); + } +*/ } public static Optional fromExistingData(ItemStack stack) { - return stack.getExistingData(ModItems.BACKPACK_WRAPPER).map(wrapper -> wrapper.setBackpackStack(stack)); + if (stack.getItem() instanceof BackpackItem) { + return StorageWrapperRepository.getExistingStorageWrapper(stack, IBackpackWrapper.class); + } + + return Optional.empty(); } @Override @@ -130,10 +134,10 @@ this, getBackpackContentsNbt(), () -> { } private int getNumberOfInventorySlots() { - Optional inventorySlots = NBTHelper.getInt(getBackpackStack(), INVENTORY_SLOTS_TAG); + Integer inventorySlots = getBackpackStack().get(ModCoreDataComponents.NUMBER_OF_INVENTORY_SLOTS); - if (inventorySlots.isPresent()) { - return inventorySlots.get(); + if (inventorySlots != null) { + return inventorySlots; } int itemInventorySlots = ((BackpackItem) getBackpackStack().getItem()).getNumberOfSlots(); @@ -148,7 +152,7 @@ public int getNumberOfSlotRows() { } private void setNumberOfInventorySlots(int itemInventorySlots) { - NBTHelper.setInteger(getBackpackStack(), INVENTORY_SLOTS_TAG, itemInventorySlots); + getBackpackStack().set(ModCoreDataComponents.NUMBER_OF_INVENTORY_SLOTS, itemInventorySlots); } private CompoundTag getBackpackContentsNbt() { @@ -270,10 +274,10 @@ public void setUpgradeCachesInvalidatedHandler(Runnable handler) { } private int getNumberOfUpgradeSlots() { - Optional upgradeSlots = NBTHelper.getInt(getBackpackStack(), UPGRADE_SLOTS_TAG); + Integer upgradeSlots = getBackpackStack().get(ModCoreDataComponents.NUMBER_OF_UPGRADE_SLOTS); - if (upgradeSlots.isPresent()) { - return upgradeSlots.get(); + if (upgradeSlots != null) { + return upgradeSlots; } int itemUpgradeSlots = ((BackpackItem) getBackpackStack().getItem()).getNumberOfUpgradeSlots(); @@ -283,7 +287,7 @@ private int getNumberOfUpgradeSlots() { @Override public Optional getContentsUuid() { - return NBTHelper.getUniqueId(getBackpackStack(), CONTENTS_UUID_TAG); + return Optional.ofNullable(getBackpackStack().get(ModCoreDataComponents.STORAGE_UUID)); } private UUID getOrCreateContentsUuid() { @@ -294,7 +298,6 @@ private UUID getOrCreateContentsUuid() { clearDummyHandlers(); UUID newUuid = UUID.randomUUID(); setContentsUuid(newUuid); - migrateBackpackContents(newUuid); return newUuid; } @@ -307,63 +310,49 @@ private void clearDummyHandlers() { } } - private void migrateBackpackContents(UUID newUuid) { - migrateNbtTag(newUuid, InventoryHandler.INVENTORY_TAG); - migrateNbtTag(newUuid, UpgradeHandler.UPGRADE_INVENTORY_TAG); - } - - private void migrateNbtTag(UUID newUuid, String key) { - NBTHelper.getCompound(getBackpackStack(), key) - .ifPresent(nbt -> { - BackpackStorage.get().getOrCreateBackpackContents(newUuid).put(key, nbt); - markBackpackContentsDirty(); - NBTHelper.removeTag(getBackpackStack(), key); - }); - } - @Override public int getMainColor() { - return NBTHelper.getInt(getBackpackStack(), CLOTH_COLOR_TAG).orElse(DEFAULT_CLOTH_COLOR); + return getBackpackStack().getOrDefault(ModCoreDataComponents.MAIN_COLOR, DEFAULT_MAIN_COLOR); } @Override public int getAccentColor() { - return NBTHelper.getInt(getBackpackStack(), BORDER_COLOR_TAG).orElse(DEFAULT_BORDER_COLOR); + return getBackpackStack().getOrDefault(ModCoreDataComponents.ACCENT_COLOR, DEFAULT_ACCENT_COLOR); } @Override public Optional getOpenTabId() { - return NBTHelper.getInt(getBackpackStack(), OPEN_TAB_ID_TAG); + return Optional.ofNullable(getBackpackStack().get(ModCoreDataComponents.OPEN_TAB_ID)); } @Override public void setOpenTabId(int openTabId) { - NBTHelper.setInteger(getBackpackStack(), OPEN_TAB_ID_TAG, openTabId); + getBackpackStack().set(ModCoreDataComponents.OPEN_TAB_ID, openTabId); backpackSaveHandler.run(); } @Override public void removeOpenTabId() { - getBackpackStack().getOrCreateTag().remove(OPEN_TAB_ID_TAG); + getBackpackStack().remove(ModCoreDataComponents.OPEN_TAB_ID); backpackSaveHandler.run(); } @Override public void setColors(int mainColor, int accentColor) { - getBackpackStack().addTagElement(CLOTH_COLOR_TAG, IntTag.valueOf(mainColor)); - getBackpackStack().addTagElement(BORDER_COLOR_TAG, IntTag.valueOf(accentColor)); + ItemStack backpackStack = getBackpackStack(); + BackpackItem.setColors(backpackStack, mainColor, accentColor); backpackSaveHandler.run(); } @Override public void setSortBy(SortBy sortBy) { - getBackpackStack().addTagElement(SORT_BY_TAG, StringTag.valueOf(sortBy.getSerializedName())); + getBackpackStack().set(ModCoreDataComponents.SORT_BY, sortBy); backpackSaveHandler.run(); } @Override public SortBy getSortBy() { - return NBTHelper.getEnumConstant(getBackpackStack(), SORT_BY_TAG, SortBy::fromName).orElse(SortBy.NAME); + return getBackpackStack().getOrDefault(ModCoreDataComponents.SORT_BY, SortBy.NAME); } @Override @@ -390,7 +379,7 @@ public ItemStack getBackpack() { @Override public ItemStack cloneBackpack() { ItemStack clonedBackpack = cloneBackpack(this); - cloneSubbackpacks(BackpackWrapper.fromData(clonedBackpack)); + cloneSubbackpacks(BackpackWrapper.fromStack(clonedBackpack)); return clonedBackpack; } @@ -400,14 +389,14 @@ private void cloneSubbackpacks(IStorageWrapper wrapperCloned) { if (!(stack.getItem() instanceof BackpackItem)) { return; } - inventoryHandler.setStackInSlot(slot, cloneBackpack(BackpackWrapper.fromData(stack))); + inventoryHandler.setStackInSlot(slot, cloneBackpack(BackpackWrapper.fromStack(stack))); }); } private ItemStack cloneBackpack(IBackpackWrapper originalWrapper) { ItemStack backpackCopy = originalWrapper.getBackpack().copy(); - backpackCopy.removeTagKey(CONTENTS_UUID_TAG); - IBackpackWrapper wrapperCopy = BackpackWrapper.fromData(backpackCopy); + backpackCopy.remove(ModCoreDataComponents.STORAGE_UUID); + IBackpackWrapper wrapperCopy = BackpackWrapper.fromStack(backpackCopy); originalWrapper.copyDataTo(wrapperCopy); return wrapperCopy.getBackpack(); } @@ -431,9 +420,9 @@ public void setSlotNumbers(int numberOfInventorySlots, int numberOfUpgradeSlots) } @Override - public void setLoot(ResourceLocation lootTableName, float lootPercentage) { - getBackpackStack().addTagElement(LOOT_TABLE_NAME_TAG, StringTag.valueOf(lootTableName.toString())); - getBackpackStack().addTagElement(LOOT_PERCENTAGE_TAG, FloatTag.valueOf(lootPercentage)); + public void setLoot(ResourceLocation lootTableName, float lootFactor) { + getBackpackStack().set(ModDataComponents.LOOT_TABLE, lootTableName); + getBackpackStack().set(ModDataComponents.LOOT_FACTOR, lootFactor); backpackSaveHandler.run(); } @@ -442,12 +431,19 @@ public void fillWithLoot(Player playerEntity) { if (playerEntity.level().isClientSide) { return; } - NBTHelper.getString(getBackpackStack(), LOOT_TABLE_NAME_TAG).ifPresent(ltName -> fillWithLootFromTable(playerEntity, ltName)); + ResourceLocation lootTable = getBackpackStack().get(ModDataComponents.LOOT_TABLE); + if (lootTable == null) { + return; + } + fillWithLootFromTable(playerEntity, lootTable); } @Override public void setContentsUuid(UUID storageUuid) { - NBTHelper.setUniqueId(getBackpackStack(), CONTENTS_UUID_TAG, storageUuid); + getBackpackStack().set(ModCoreDataComponents.STORAGE_UUID, storageUuid); +/* TODO add in the future + StorageWrapperRepository.migrateToUuid(this, backpack, storageUuid); +*/ } @Override @@ -458,7 +454,7 @@ public void removeContentsUuid() { @Override public void removeContentsUUIDTag() { - NBTHelper.removeTag(getBackpackStack(), CONTENTS_UUID_TAG); + getBackpackStack().remove(ModCoreDataComponents.STORAGE_UUID); } private ItemStack getBackpackStack() { @@ -476,7 +472,7 @@ public BackpackRenderInfo getRenderInfo() { @Override public void setColumnsTaken(int columnsTaken, boolean hasChanged) { int originalColumnsTaken = getColumnsTaken(); - NBTHelper.setInteger(getBackpackStack(), COLUMNS_TAKEN_TAG, columnsTaken); + getBackpackStack().set(ModDataComponents.COLUMNS_TAKEN, columnsTaken); if (hasChanged) { int diff = (columnsTaken - originalColumnsTaken) * getNumberOfSlotRows(); onSlotsChange.accept(diff); @@ -497,29 +493,28 @@ public void unregisterOnSlotsChangeListener() { @Override public int getColumnsTaken() { - return NBTHelper.getInt(getBackpackStack(), COLUMNS_TAKEN_TAG).orElse(0); + return getBackpackStack().getOrDefault(ModDataComponents.COLUMNS_TAKEN, 0); } - private void fillWithLootFromTable(Player playerEntity, String lootName) { + private void fillWithLootFromTable(Player playerEntity, ResourceLocation lootTable) { MinecraftServer server = playerEntity.level().getServer(); if (server == null || !(playerEntity.level() instanceof ServerLevel serverLevel)) { return; } - ResourceLocation lootTableName = ResourceLocation.fromNamespaceAndPath(lootName); - float lootPercentage = NBTHelper.getFloat(getBackpackStack(), LOOT_PERCENTAGE_TAG).orElse(0f); + float lootFactor = getBackpackStack().getOrDefault(ModDataComponents.LOOT_FACTOR, 0f); - getBackpackStack().removeTagKey(LOOT_TABLE_NAME_TAG); - getBackpackStack().removeTagKey(LOOT_PERCENTAGE_TAG); + getBackpackStack().remove(ModDataComponents.LOOT_TABLE); + getBackpackStack().remove(ModDataComponents.LOOT_FACTOR); - List loot = LootHelper.getLoot(lootTableName, server, serverLevel, playerEntity); + List loot = LootHelper.getLoot(lootTable, server, serverLevel, playerEntity); loot.removeIf(stack -> stack.getItem() instanceof BackpackItem); - loot = RandHelper.getNRandomElements(loot, (int) (loot.size() * lootPercentage)); + loot = RandHelper.getNRandomElements(loot, (int) (loot.size() * lootFactor)); LootHelper.fillWithLoot(serverLevel.random, loot, getInventoryHandler()); } private void setNumberOfUpgradeSlots(int numberOfUpgradeSlots) { - NBTHelper.setInteger(getBackpackStack(), UPGRADE_SLOTS_TAG, numberOfUpgradeSlots); + getBackpackStack().set(ModCoreDataComponents.NUMBER_OF_UPGRADE_SLOTS, numberOfUpgradeSlots); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/ClientEventHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/ClientEventHandler.java index 9b8b2eff..291b8282 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/ClientEventHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/ClientEventHandler.java @@ -3,6 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.ItemEntityRenderer; @@ -19,15 +20,19 @@ import net.minecraft.world.phys.HitResult; import net.neoforged.bus.api.IEventBus; import net.neoforged.neoforge.client.event.*; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.util.Lazy; import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; import net.p3pp3rf1y.sophisticatedbackpacks.client.init.ModBlockColors; import net.p3pp3rf1y.sophisticatedbackpacks.client.init.ModItemColors; import net.p3pp3rf1y.sophisticatedbackpacks.client.render.*; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModBlocks; -import net.p3pp3rf1y.sophisticatedbackpacks.network.BlockPickPacket; -import net.p3pp3rf1y.sophisticatedbackpacks.network.RequestPlayerSettingsPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; +import net.p3pp3rf1y.sophisticatedbackpacks.network.BlockPickPayload; +import net.p3pp3rf1y.sophisticatedbackpacks.network.RequestPlayerSettingsPayload; import java.util.Map; @@ -47,6 +52,7 @@ public static void registerHandlers(IEventBus modBus) { modBus.addListener(ClientEventHandler::registerReloadListener); modBus.addListener(ModItemColors::registerItemColorHandlers); modBus.addListener(ModBlockColors::registerBlockColorHandlers); + modBus.addListener(ClientEventHandler::registerBackpackClientExtension); IEventBus eventBus = NeoForge.EVENT_BUS; eventBus.addListener(ClientBackpackContentsTooltip::onWorldLoad); eventBus.addListener(ClientEventHandler::handleBlockPick); @@ -54,7 +60,7 @@ public static void registerHandlers(IEventBus modBus) { } private static void onPlayerLoggingIn(ClientPlayerNetworkEvent.LoggingIn event) { - PacketDistributor.SERVER.noArg().send(new RequestPlayerSettingsPacket()); + PacketDistributor.sendToServer(new RequestPlayerSettingsPayload()); } private static void onModelRegistry(ModelEvent.RegisterGeometryLoaders event) { @@ -84,6 +90,7 @@ private static void registerBackpackLayer() { livingEntityRenderer.addLayer(new BackpackLayerRenderer(livingEntityRenderer)); } } + renderManager.renderers.forEach((e, r) -> { if (r instanceof LivingEntityRenderer livingEntityRenderer) { //noinspection rawtypes ,unchecked - this is not going to fail as the LivingRenderer makes sure the types are right, but there doesn't seem to be a way to us inference here @@ -113,6 +120,17 @@ public static void handleBlockPick(InputEvent.InteractionKeyMappingTriggered eve return; } - PacketDistributor.SERVER.noArg().send(new BlockPickPacket(result)); + PacketDistributor.sendToServer(new BlockPickPayload(result)); + } + + private static void registerBackpackClientExtension(RegisterClientExtensionsEvent event) { + event.registerItem(new IClientItemExtensions() { + private final Lazy ister = Lazy.of(() -> new BackpackItemStackRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels())); + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return ister.get(); + } + }, ModItems.BACKPACK.get(), ModItems.COPPER_BACKPACK.get(), ModItems.IRON_BACKPACK.get(), ModItems.GOLD_BACKPACK.get(), ModItems.DIAMOND_BACKPACK.get(), ModItems.NETHERITE_BACKPACK.get()); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java index cc246c71..21a4c5b8 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/KeybindHandler.java @@ -16,13 +16,13 @@ import net.minecraft.world.phys.HitResult; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; import net.neoforged.neoforge.client.event.ScreenEvent; import net.neoforged.neoforge.client.settings.IKeyConflictContext; import net.neoforged.neoforge.client.settings.KeyConflictContext; import net.neoforged.neoforge.client.settings.KeyModifier; import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.TickEvent; import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; import net.p3pp3rf1y.sophisticatedbackpacks.client.gui.BackpackScreen; @@ -106,7 +106,7 @@ public static void handleGuiMouseKeyPress(ScreenEvent.MouseButtonPressed.Pre eve } } - public static void handleKeyInputEvent(TickEvent.ClientTickEvent event) { + public static void handleKeyInputEvent(ClientTickEvent.Post event) { if (BACKPACK_OPEN_KEYBIND.consumeClick()) { sendBackpackOpenOrCloseMessage(); } else if (INVENTORY_INTERACTION_KEYBIND.consumeClick()) { @@ -116,7 +116,7 @@ public static void handleKeyInputEvent(TickEvent.ClientTickEvent event) { } else { for (Map.Entry slotKeybind : UPGRADE_SLOT_TOGGLE_KEYBINDS.entrySet()) { if (slotKeybind.getValue().consumeClick()) { - PacketDistributor.SERVER.noArg().send(new UpgradeTogglePacket(slotKeybind.getKey())); + PacketDistributor.sendToServer(new UpgradeTogglePayload(slotKeybind.getKey())); } } } @@ -151,10 +151,10 @@ private static void sendToolSwapMessage() { if (rayTrace.getType() == HitResult.Type.BLOCK) { BlockHitResult blockRayTraceResult = (BlockHitResult) rayTrace; BlockPos pos = blockRayTraceResult.getBlockPos(); - PacketDistributor.SERVER.noArg().send(new BlockToolSwapPacket(pos)); + PacketDistributor.sendToServer(new BlockToolSwapPayload(pos)); } else if (rayTrace.getType() == HitResult.Type.ENTITY) { EntityHitResult entityRayTraceResult = (EntityHitResult) rayTrace; - PacketDistributor.SERVER.noArg().send(new EntityToolSwapPacket(entityRayTraceResult.getEntity().getId())); + PacketDistributor.sendToServer(new EntityToolSwapPayload(entityRayTraceResult.getEntity().getId())); } } @@ -171,13 +171,13 @@ private static void sendInteractWithInventoryMessage() { return; } - PacketDistributor.SERVER.noArg().send(new InventoryInteractionPacket(pos, blockraytraceresult.getDirection())); + PacketDistributor.sendToServer(new InventoryInteractionPayload(pos, blockraytraceresult.getDirection())); } @SuppressWarnings({"java:S2440"}) private static boolean sendBackpackOpenOrCloseMessage() { if (!GUI.isActive()) { - PacketDistributor.SERVER.noArg().send(new BackpackOpenPacket()); + PacketDistributor.sendToServer(new BackpackOpenPayload()); return false; } @@ -189,12 +189,12 @@ private static boolean sendBackpackOpenOrCloseMessage() { Optional handlerName = getPlayerInventoryHandlerName(slot.getSlotIndex()); if (handlerName.isPresent() && slot.getItem().getItem() instanceof BackpackItem) { - PacketDistributor.SERVER.noArg().send(new BackpackOpenPacket(slot.getSlotIndex(), "", handlerName.get())); + PacketDistributor.sendToServer(new BackpackOpenPayload(slot.getSlotIndex(), "", handlerName.get())); return true; } } if (screen instanceof BackpackScreen && slot != null && slot.getItem().getItem() instanceof BackpackItem && slot.getItem().getCount() == 1) { - PacketDistributor.SERVER.noArg().send(new BackpackOpenPacket(slot.index)); + PacketDistributor.sendToServer(new BackpackOpenPayload(slot.index)); return true; } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java index 69b7fcdd..1d55bccf 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackScreen.java @@ -9,7 +9,7 @@ import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; import net.p3pp3rf1y.sophisticatedbackpacks.client.KeybindHandler; import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContainer; -import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackOpenPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackOpenPayload; import net.p3pp3rf1y.sophisticatedcore.client.gui.StorageScreenBase; public class BackpackScreen extends StorageScreenBase { @@ -33,7 +33,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { } return true; } else if (!getMenu().isFirstLevelStorage()) { - PacketDistributor.SERVER.noArg().send(new BackpackOpenPacket()); + PacketDistributor.sendToServer(new BackpackOpenPayload()); return true; } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackSettingsScreen.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackSettingsScreen.java index a9b72b4e..3c1a3e22 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackSettingsScreen.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/gui/BackpackSettingsScreen.java @@ -3,7 +3,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Inventory; import net.neoforged.neoforge.network.PacketDistributor; -import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackOpenPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackOpenPayload; import net.p3pp3rf1y.sophisticatedbackpacks.settings.BackpackSettingsTabControl; import net.p3pp3rf1y.sophisticatedcore.client.gui.SettingsScreen; import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.Position; @@ -26,6 +26,6 @@ public static BackpackSettingsScreen constructScreen(SettingsContainerMenu se @Override protected void sendStorageInventoryScreenOpenMessage() { - PacketDistributor.SERVER.noArg().send(new BackpackOpenPacket()); + PacketDistributor.sendToServer(new BackpackOpenPayload()); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModBlockColors.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModBlockColors.java index a95929f3..34607d0f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModBlockColors.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModBlockColors.java @@ -22,6 +22,6 @@ public static void registerBlockColorHandlers(RegisterColorHandlersEvent.Block e } private static int getDefaultColor(int tintIndex) { - return tintIndex == 0 ? BackpackWrapper.DEFAULT_CLOTH_COLOR : BackpackWrapper.DEFAULT_BORDER_COLOR; + return tintIndex == 0 ? BackpackWrapper.DEFAULT_MAIN_COLOR : BackpackWrapper.DEFAULT_ACCENT_COLOR; } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModItemColors.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModItemColors.java index a350bdd4..a283f472 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModItemColors.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/init/ModItemColors.java @@ -16,7 +16,7 @@ public static void registerItemColorHandlers(RegisterColorHandlersEvent.Item eve if (layer > 1 || !(backpack.getItem() instanceof BackpackItem)) { return -1; } - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(backpack); if (layer == 0) { return backpackWrapper.getMainColor(); } else if (layer == 1) { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackDynamicModel.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackDynamicModel.java index be669c36..3684b060 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackDynamicModel.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackDynamicModel.java @@ -53,15 +53,15 @@ public class BackpackDynamicModel implements IUnbakedGeometry { private final Map modelParts; - public BackpackDynamicModel(Map modelParts) { + private BackpackDynamicModel(Map modelParts) { this.modelParts = modelParts; } @Override - public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, Function spriteGetter, ModelState modelTransform, ItemOverrides overrides, ResourceLocation modelLocation) { + public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, Function spriteGetter, ModelState modelTransform, ItemOverrides overrides) { ImmutableMap.Builder builder = ImmutableMap.builder(); modelParts.forEach((part, model) -> { - BakedModel bakedModel = model.bake(baker, spriteGetter, modelTransform, modelLocation); + BakedModel bakedModel = model.bake(baker, spriteGetter, modelTransform); if (bakedModel != null) { builder.put(part, bakedModel); } @@ -82,7 +82,7 @@ public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull Ran public static final Vector3f DEFAULT_ROTATION = new Vector3f(0.0F, 0.0F, 0.0F); private static final ItemTransforms ITEM_TRANSFORMS = createItemTransforms(); - private static final ResourceLocation BACKPACK_MODULES_TEXTURE = ResourceLocation.fromNamespaceAndPath("sophisticatedbackpacks:block/backpack_modules"); + private static final ResourceLocation BACKPACK_MODULES_TEXTURE = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "block/backpack_modules"); @SuppressWarnings("java:S4738") //ItemTransforms require Guava ImmutableMap to be passed in so no way to change that to java Map @@ -295,8 +295,7 @@ public ItemTransforms getTransforms() { } private BakedQuad createQuad(List vecs, float[] colors, TextureAtlasSprite sprite, Direction face, float u1, float u2, float v1, float v2) { - var bakedQuad = new BakedQuad[1]; - QuadBakingVertexConsumer quadBaker = new QuadBakingVertexConsumer(q -> bakedQuad[0] = q); + QuadBakingVertexConsumer quadBaker = new QuadBakingVertexConsumer(); quadBaker.setSprite(sprite); Vec3i dirVec = face.getNormal(); quadBaker.setDirection(face); @@ -308,11 +307,11 @@ private BakedQuad createQuad(List vecs, float[] colors, TextureAtlasSp v1 = sprite.getV0() + v1 / 4f * sprite.uvShrinkRatio(); v2 = sprite.getV0() + v2 / 4f * sprite.uvShrinkRatio(); - quadBaker.vertex(vecs.get(0).x(), vecs.get(0).y(), vecs.get(0).z()).color(colors[1], colors[2], colors[3], colors[0]).uv(u1, v1).normal(dirVec.getX(), dirVec.getY(), dirVec.getZ()).endVertex(); - quadBaker.vertex(vecs.get(1).x(), vecs.get(1).y(), vecs.get(1).z()).color(colors[1], colors[2], colors[3], colors[0]).uv(u1, v2).normal(dirVec.getX(), dirVec.getY(), dirVec.getZ()).endVertex(); - quadBaker.vertex(vecs.get(2).x(), vecs.get(2).y(), vecs.get(2).z()).color(colors[1], colors[2], colors[3], colors[0]).uv(u2, v2).normal(dirVec.getX(), dirVec.getY(), dirVec.getZ()).endVertex(); - quadBaker.vertex(vecs.get(3).x(), vecs.get(3).y(), vecs.get(3).z()).color(colors[1], colors[2], colors[3], colors[0]).uv(u2, v1).normal(dirVec.getX(), dirVec.getY(), dirVec.getZ()).endVertex(); - return bakedQuad[0]; + quadBaker.addVertex(vecs.get(0).x(), vecs.get(0).y(), vecs.get(0).z()).setColor(colors[1], colors[2], colors[3], colors[0]).setUv(u1, v1).setNormal(dirVec.getX(), dirVec.getY(), dirVec.getZ()); + quadBaker.addVertex(vecs.get(1).x(), vecs.get(1).y(), vecs.get(1).z()).setColor(colors[1], colors[2], colors[3], colors[0]).setUv(u1, v2).setNormal(dirVec.getX(), dirVec.getY(), dirVec.getZ()); + quadBaker.addVertex(vecs.get(2).x(), vecs.get(2).y(), vecs.get(2).z()).setColor(colors[1], colors[2], colors[3], colors[0]).setUv(u2, v2).setNormal(dirVec.getX(), dirVec.getY(), dirVec.getZ()); + quadBaker.addVertex(vecs.get(3).x(), vecs.get(3).y(), vecs.get(3).z()).setColor(colors[1], colors[2], colors[3], colors[0]).setUv(u2, v1).setNormal(dirVec.getX(), dirVec.getY(), dirVec.getZ()); + return quadBaker.bakeQuad(); } private void rotate(Vector3f posIn, Matrix4f transform) { @@ -335,7 +334,7 @@ public BakedModel resolve(BakedModel model, ItemStack stack, @Nullable ClientLev backpackModel.tankRight = false; backpackModel.tankLeft = false; backpackModel.battery = false; - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(stack); + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(stack); RenderInfo renderInfo = backpackWrapper.getRenderInfo(); Map tankRenderInfos = renderInfo.getTankRenderInfos(); tankRenderInfos.forEach((pos, info) -> { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackItemStackRenderer.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackItemStackRenderer.java index 428d34ad..95790bd0 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackItemStackRenderer.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackItemStackRenderer.java @@ -38,7 +38,7 @@ public void renderByItem(ItemStack stack, ItemDisplayContext transformType, Pose model.getRenderPasses(stack, true).forEach(bakedModel -> bakedModel.getRenderTypes(stack, true).forEach(renderType -> { VertexConsumer ivertexbuilder = ItemRenderer.getFoilBufferDirect(buffer, renderType, true, stack.hasFoil()); itemRenderer.renderModelLists(bakedModel, stack, combinedLight, combinedOverlay, matrixStack, ivertexbuilder); - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(stack); + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(stack); backpackWrapper.getRenderInfo().getItemDisplayRenderInfo().getDisplayItem().ifPresent(displayItem -> { matrixStack.translate(0.5, 0.6, 0.25); matrixStack.scale(0.5f, 0.5f, 0.5f); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackLayerRenderer.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackLayerRenderer.java index 5da22a92..73dea0d9 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackLayerRenderer.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackLayerRenderer.java @@ -56,7 +56,7 @@ public void render(PoseStack matrixStack, MultiBufferSource buffer, int packedLi public static > void renderBackpack(M parentModel, LivingEntity livingEntity, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, ItemStack backpack, boolean wearsArmor, IBackpackModel model) { model.translateRotateAndScale(parentModel, livingEntity, matrixStack, wearsArmor); - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); int clothColor = wrapper.getMainColor(); int borderColor = wrapper.getAccentColor(); model.render(parentModel, livingEntity, matrixStack, buffer, packedLight, clothColor, borderColor, backpack.getItem(), wrapper.getRenderInfo()); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackModel.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackModel.java index a58b773d..5f7d501b 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackModel.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/BackpackModel.java @@ -334,67 +334,66 @@ public > void render(M parentMo boolean showRightTank = tankPositions.contains(TankPosition.RIGHT); Optional batteryRenderInfo = renderInfo.getBatteryRenderInfo(); - float borderRed = (borderColor >> 16 & 255) / 255.0F; - float borderGreen = (borderColor >> 8 & 255) / 255.0F; - float borderBlue = (borderColor & 255) / 255.0F; - float clothRed = (clothColor >> 16 & 255) / 255.0F; - float clothGreen = (clothColor >> 8 & 255) / 255.0F; - float clothBlue = (clothColor & 255) / 255.0F; - if (showLeftTank) { leftTank.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - leftTankBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + leftTankBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); } else { fabricLeft.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); clipsLeftPouches.get(backpackItem).render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - leftPouches.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothRed, clothGreen, clothBlue, 1); - leftPouchesBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + leftPouches.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothColor); + leftPouchesBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); } if (showRightTank) { rightTank.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - rightTankBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + rightTankBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); } else { fabricRight.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); clipsRightPouches.get(backpackItem).render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - rightPouches.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothRed, clothGreen, clothBlue, 1); - rightPouchesBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + rightPouches.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothColor); + rightPouchesBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); } if (batteryRenderInfo.isPresent()) { battery.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - batteryBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + batteryBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); clipsBattery.get(backpackItem).render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - batteryRenderInfo.ifPresent(info -> renderBatteryCharge(poseStack, buffer, packedLight, info.getChargeRatio())); } else { fabricFront.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); clipsFrontPouch.get(backpackItem).render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - frontPouch.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothRed, clothGreen, clothBlue, 1); - frontPouchBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + frontPouch.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothColor); + frontPouchBorder.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); } fabric.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); clipsBody.get(backpackItem).render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - cloth.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothRed, clothGreen, clothBlue, 1); + cloth.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, clothColor); - border.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderRed, borderGreen, borderBlue, 1); + border.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, borderColor); poseStack.pushPose(); poseStack.scale(1 / 2f, 6 / 10f, 1 / 2f); if (showLeftTank) { vertexBuilder = buffer.getBuffer(RenderType.entityCutoutNoCull(TANK_GLASS_TEXTURE)); leftTankGlass.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); - IRenderedTankUpgrade.TankRenderInfo tankRenderInfo = renderInfo.getTankRenderInfos().get(TankPosition.LEFT); - tankRenderInfo.getFluid().ifPresent(f -> renderFluid(poseStack, buffer, packedLight, f, tankRenderInfo.getFillRatio(), true)); } if (showRightTank) { vertexBuilder = buffer.getBuffer(RenderType.entityCutoutNoCull(TANK_GLASS_TEXTURE)); rightTankGlass.render(poseStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY); + } + if (showLeftTank) { + IRenderedTankUpgrade.TankRenderInfo tankRenderInfo = renderInfo.getTankRenderInfos().get(TankPosition.LEFT); + tankRenderInfo.getFluid().ifPresent(f -> renderFluid(poseStack, buffer, packedLight, f, tankRenderInfo.getFillRatio(), true)); + } + if (showRightTank) { IRenderedTankUpgrade.TankRenderInfo tankRenderInfo = renderInfo.getTankRenderInfos().get(TankPosition.RIGHT); tankRenderInfo.getFluid().ifPresent(f -> renderFluid(poseStack, buffer, packedLight, f, tankRenderInfo.getFillRatio(), false)); } poseStack.popPose(); + if (batteryRenderInfo.isPresent()) { + batteryRenderInfo.ifPresent(info -> renderBatteryCharge(poseStack, buffer, packedLight, info.getChargeRatio())); + } } @Override @@ -419,10 +418,7 @@ public void renderFluid(PoseStack matrixStack, MultiBufferSource buffer, int pac VertexConsumer vertexBuilder = buffer.getBuffer(RenderType.entityTranslucent(InventoryMenu.BLOCK_ATLAS)); ModelPart fluidBox = getFluidBar(still, (int) (fill * 10), left); int color = renderProperties.getTintColor(fluidStack); - float red = (color >> 16 & 255) / 255.0F; - float green = (color >> 8 & 255) / 255.0F; - float blue = (color & 255) / 255.0F; - fluidBox.render(matrixStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, red, green, blue, 1); + fluidBox.render(matrixStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, color); } private ModelPart getFluidBar(TextureAtlasSprite still, int fill, boolean left) { @@ -546,7 +542,7 @@ private static void addBatteryClips(PartDefinition partDefinition, Item backpack } @Override - public void renderToBuffer(PoseStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + public void renderToBuffer(PoseStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { //noop } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/ClientBackpackContentsTooltip.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/ClientBackpackContentsTooltip.java index f8af9896..06f3e3b9 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/ClientBackpackContentsTooltip.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/client/render/ClientBackpackContentsTooltip.java @@ -7,7 +7,7 @@ import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackWrapper; -import net.p3pp3rf1y.sophisticatedbackpacks.network.RequestBackpackInventoryContentsPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.RequestBackpackInventoryContentsPayload; import net.p3pp3rf1y.sophisticatedcore.client.render.ClientStorageContentsTooltipBase; import java.util.UUID; @@ -24,7 +24,7 @@ public static void onWorldLoad(LevelEvent.Load event) { @Override public void renderImage(Font font, int leftX, int topY, GuiGraphics guiGraphics) { - renderTooltip(BackpackWrapper.fromData(backpack), font, leftX, topY, guiGraphics); + renderTooltip(BackpackWrapper.fromStack(backpack), font, leftX, topY, guiGraphics); } public ClientBackpackContentsTooltip(BackpackItem.BackpackContentsTooltip tooltip) { @@ -33,6 +33,6 @@ public ClientBackpackContentsTooltip(BackpackItem.BackpackContentsTooltip toolti @Override protected void sendInventorySyncRequest(UUID uuid) { - PacketDistributor.SERVER.noArg().send(new RequestBackpackInventoryContentsPacket(uuid)); + PacketDistributor.sendToServer(new RequestBackpackInventoryContentsPayload(uuid)); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/command/GiveCommand.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/command/GiveCommand.java index f53e1b45..875fc1a4 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/command/GiveCommand.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/command/GiveCommand.java @@ -4,6 +4,7 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; @@ -39,9 +40,9 @@ private static int giveBackpack(CommandSourceStack source, UUID backpackUuid, Co Item item = BuiltInRegistries.ITEM.get(alr.getBackpackItemRegistryName()); ItemStack backpack = new ItemStack(item); if (!backpack.getHoverName().getString().equals(alr.getBackpackName())) { - backpack.setHoverName(Component.literal(alr.getBackpackName())); + backpack.set(DataComponents.CUSTOM_NAME, Component.literal(alr.getBackpackName())); } - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(backpack); backpackWrapper.setColors(alr.getClothColor(), alr.getTrimColor()); backpackWrapper.setColumnsTaken(alr.getColumnsTaken(), false); backpackWrapper.setContentsUuid(backpackUuid); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/CommonEventHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/CommonEventHandler.java index db35f5f9..f6faeb32 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/CommonEventHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/CommonEventHandler.java @@ -18,15 +18,16 @@ import net.minecraft.world.phys.Vec3; import net.neoforged.bus.api.IEventBus; import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.TickEvent; +import net.neoforged.neoforge.common.util.TriState; import net.neoforged.neoforge.event.entity.EntityLeaveLevelEvent; import net.neoforged.neoforge.event.entity.EntityMobGriefingEvent; +import net.neoforged.neoforge.event.entity.living.FinalizeSpawnEvent; import net.neoforged.neoforge.event.entity.living.LivingDropsEvent; -import net.neoforged.neoforge.event.entity.living.MobSpawnEvent; import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; -import net.neoforged.neoforge.event.entity.player.EntityItemPickupEvent; +import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent; import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; +import net.neoforged.neoforge.event.tick.LevelTickEvent; import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.Config; import net.p3pp3rf1y.sophisticatedbackpacks.api.IAttackEntityResponseUpgrade; @@ -35,12 +36,11 @@ import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModBlocks; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; -import net.p3pp3rf1y.sophisticatedbackpacks.init.ModPackets; -import net.p3pp3rf1y.sophisticatedbackpacks.network.AnotherPlayerBackpackOpenPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModPayloads; +import net.p3pp3rf1y.sophisticatedbackpacks.network.AnotherPlayerBackpackOpenPayload; import net.p3pp3rf1y.sophisticatedbackpacks.settings.BackpackMainSettingsCategory; import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; -import net.p3pp3rf1y.sophisticatedcore.network.PacketHelper; -import net.p3pp3rf1y.sophisticatedcore.network.SyncPlayerSettingsPacket; +import net.p3pp3rf1y.sophisticatedcore.network.SyncPlayerSettingsPayload; import net.p3pp3rf1y.sophisticatedcore.settings.SettingsManager; import net.p3pp3rf1y.sophisticatedcore.upgrades.jukebox.ServerStorageSoundHandler; import net.p3pp3rf1y.sophisticatedcore.util.InventoryHelper; @@ -53,7 +53,7 @@ public class CommonEventHandler { public void registerHandlers(IEventBus modBus) { ModItems.registerHandlers(modBus); ModBlocks.registerHandlers(modBus); - modBus.addListener(ModPackets::registerPackets); + modBus.addListener(ModPayloads::registerPackets); IEventBus eventBus = NeoForge.EVENT_BUS; eventBus.addListener(this::onItemPickup); eventBus.addListener(this::onLivingSpecialSpawn); @@ -91,31 +91,30 @@ private void interactWithEntity(PlayerInteractEvent.EntityInteractSpecific event } if (targetPlayer.level().isClientSide) { event.setCancellationResult(InteractionResult.SUCCESS); - PacketDistributor.SERVER.noArg().send(new AnotherPlayerBackpackOpenPacket(targetPlayer.getId())); + PacketDistributor.sendToServer(new AnotherPlayerBackpackOpenPayload(targetPlayer.getId())); } } - private void onWorldTick(TickEvent.LevelTickEvent event) { - ResourceLocation dimensionKey = event.level.dimension().location(); + private void onWorldTick(LevelTickEvent.Post event) { + ResourceLocation dimensionKey = event.getLevel().dimension().location(); boolean runSlownessLogic = Boolean.TRUE.equals(Config.SERVER.nerfsConfig.tooManyBackpacksSlowness.get()); boolean runDedupeLogic = Boolean.FALSE.equals(Config.SERVER.tickDedupeLogicDisabled.get()); - if (event.phase != TickEvent.Phase.END - || (!runSlownessLogic && !runDedupeLogic) - || nextBackpackCheckTime.getOrDefault(dimensionKey, 0L) > event.level.getGameTime()) { + if ((!runSlownessLogic && !runDedupeLogic) + || nextBackpackCheckTime.getOrDefault(dimensionKey, 0L) > event.getLevel().getGameTime()) { return; } - nextBackpackCheckTime.put(dimensionKey, event.level.getGameTime() + BACKPACK_CHECK_COOLDOWN); + nextBackpackCheckTime.put(dimensionKey, event.getLevel().getGameTime() + BACKPACK_CHECK_COOLDOWN); Set backpackIds = new HashSet<>(); - event.level.players().forEach(player -> { + event.getLevel().players().forEach(player -> { AtomicInteger numberOfBackpacks = new AtomicInteger(0); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, handlerName, identifier, slot) -> { if (runSlownessLogic) { numberOfBackpacks.incrementAndGet(); } if (runDedupeLogic) { - addBackpackIdIfUniqueOrDedupe(backpackIds, BackpackWrapper.fromData(backpack)); + addBackpackIdIfUniqueOrDedupe(backpackIds, BackpackWrapper.fromStack(backpack)); } return false; }); @@ -145,8 +144,10 @@ private void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEvent ev } private void sendPlayerSettingsToClient(Player player) { - String playerTagName = BackpackMainSettingsCategory.SOPHISTICATED_BACKPACK_SETTINGS_PLAYER_TAG; - PacketHelper.sendToPlayer(new SyncPlayerSettingsPacket(playerTagName, SettingsManager.getPlayerSettingsTag(player, playerTagName)), (ServerPlayer) player); + if (player instanceof ServerPlayer serverPlayer) { + String playerTagName = BackpackMainSettingsCategory.SOPHISTICATED_BACKPACK_SETTINGS_PLAYER_TAG; + PacketDistributor.sendToPlayer(serverPlayer, new SyncPlayerSettingsPayload(playerTagName, SettingsManager.getPlayerSettingsTag(player, playerTagName))); + } } private void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) { @@ -160,7 +161,7 @@ private void onBlockClick(PlayerInteractEvent.LeftClickBlock event) { Player player = event.getEntity(); BlockPos pos = event.getPos(); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryHandlerName, identifier, slot) -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); for (IBlockClickResponseUpgrade upgrade : wrapper.getUpgradeHandler().getWrappersThatImplement(IBlockClickResponseUpgrade.class)) { if (upgrade.onBlockClick(player, pos)) { return true; @@ -176,7 +177,7 @@ private void onAttackEntity(AttackEntityEvent event) { return; } PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryHandlerName, identifier, slot) -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); for (IAttackEntityResponseUpgrade upgrade : wrapper.getUpgradeHandler().getWrappersThatImplement(IAttackEntityResponseUpgrade.class)) { if (upgrade.onAttackEntity(player)) { return true; @@ -186,7 +187,7 @@ private void onAttackEntity(AttackEntityEvent event) { }); } - private void onLivingSpecialSpawn(MobSpawnEvent.FinalizeSpawn event) { + private void onLivingSpecialSpawn(FinalizeSpawnEvent event) { Entity entity = event.getEntity(); if (entity instanceof Monster monster && monster.getItemBySlot(EquipmentSlot.CHEST).isEmpty()) { EntityBackpackAdditionHandler.addBackpack(monster, event.getLevel()); @@ -210,17 +211,17 @@ private void onEntityLeaveWorld(EntityLeaveLevelEvent event) { EntityBackpackAdditionHandler.removeBackpackUuid((Monster) event.getEntity(), event.getLevel()); } - private void onItemPickup(EntityItemPickupEvent event) { - ItemEntity itemEntity = event.getItem(); - if (itemEntity.getItem().isEmpty()) { + private void onItemPickup(ItemEntityPickupEvent.Pre event) { + ItemEntity itemEntity = event.getItemEntity(); + if (itemEntity.getItem().isEmpty() || itemEntity.pickupDelay > 0) { return; } AtomicReference remainingStackSimulated = new AtomicReference<>(itemEntity.getItem().copy()); - Player player = event.getEntity(); + Player player = event.getPlayer(); Level level = player.getCommandSenderWorld(); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryHandlerName, identifier, slot) -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); remainingStackSimulated.set(InventoryHelper.runPickupOnPickupResponseUpgrades(level, wrapper.getUpgradeHandler(), remainingStackSimulated.get(), true)); return remainingStackSimulated.get().isEmpty(); }, Config.SERVER.nerfsConfig.onlyWornBackpackTriggersUpgrades.get() @@ -229,14 +230,14 @@ private void onItemPickup(EntityItemPickupEvent event) { if (remainingStackSimulated.get().getCount() != itemEntity.getItem().getCount()) { AtomicReference remainingStack = new AtomicReference<>(itemEntity.getItem().copy()); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryHandlerName, identifier, slot) -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); remainingStack.set(InventoryHelper.runPickupOnPickupResponseUpgrades(level, player, wrapper.getUpgradeHandler(), remainingStack.get(), false)); return remainingStack.get().isEmpty(); } , Config.SERVER.nerfsConfig.onlyWornBackpackTriggersUpgrades.get() ); itemEntity.setItem(remainingStack.get()); - event.setCanceled(true); //cancelling even when the stack isn't empty at this point to prevent full stack from before pickup to be picked up by player + event.setCanPickup(TriState.FALSE); //cancelling even when the stack isn't empty at this point to prevent full stack from before pickup to be picked up by player } } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java index 8897f361..bde515f4 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java @@ -1,9 +1,12 @@ package net.p3pp3rf1y.sophisticatedbackpacks.common; import com.google.common.primitives.Ints; +import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.server.MinecraftServer; -import net.minecraft.sounds.SoundEvent; +import net.minecraft.tags.EnchantmentTags; +import net.minecraft.tags.ItemTags; import net.minecraft.util.RandomSource; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; @@ -20,13 +23,17 @@ import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.raid.Raider; -import net.minecraft.world.item.*; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.SpawnEggItem; import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.neoforged.neoforge.common.util.FakePlayer; import net.neoforged.neoforge.event.entity.living.LivingDropsEvent; -import net.neoforged.neoforge.event.entity.living.LivingEvent; +import net.neoforged.neoforge.event.tick.EntityTickEvent; import net.p3pp3rf1y.sophisticatedbackpacks.Config; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; @@ -38,7 +45,10 @@ import net.p3pp3rf1y.sophisticatedcore.util.RandHelper; import net.p3pp3rf1y.sophisticatedcore.util.WeightedElement; -import java.util.*; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; public class EntityBackpackAdditionHandler { private static final int MAX_DIFFICULTY = 3; @@ -135,7 +145,8 @@ private static void equipArmorPiece(Monster monster, RandomSource rnd, int minDi if (rnd.nextInt(6 - minDifficulty) == 0) { float additionalDifficulty = level.getCurrentDifficultyAt(monster.blockPosition()).getSpecialMultiplier(); int enchantmentLevel = (int) (5F + additionalDifficulty * 18F + minDifficulty * 6); - EnchantmentHelper.enchantItem(rnd, armorStack, enchantmentLevel, true); + EnchantmentHelper.enchantItem(rnd, armorStack, enchantmentLevel, level.registryAccess(), + level.registryAccess().registryOrThrow(Registries.ENCHANTMENT).getTag(EnchantmentTags.ON_MOB_SPAWN_EQUIPMENT)); } monster.setItemSlot(slot, armorStack); } @@ -144,8 +155,8 @@ private static void equipArmorPiece(Monster monster, RandomSource rnd, int minDi private static void equipBackpack(Monster monster, ItemStack backpack, int difficulty, boolean playMusicDisc, LevelAccessor level, RandomSource rnd) { getSpawnEgg(monster.getType()).ifPresent(egg -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); - wrapper.setColors(egg.getColor(0), egg.getColor(1)); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); + wrapper.setColors(egg.getColor(0) | 0xFF_000000, egg.getColor(1) | 0xFF_000000); setLoot(monster, wrapper, difficulty, level); if (playMusicDisc) { wrapper.getInventoryHandler(); //just to assign uuid and real upgrade handler @@ -164,28 +175,10 @@ private static void addJukeboxUpgradeAndRandomDisc(IStorageWrapper w, RandomSour Iterator it = w.getUpgradeHandler().getTypeWrappers(JukeboxUpgradeItem.TYPE).iterator(); if (it.hasNext()) { JukeboxUpgradeItem.Wrapper wrapper = it.next(); - List musicDiscs = getMusicDiscs(); - wrapper.setDisc(new ItemStack(musicDiscs.get(rnd.nextInt(musicDiscs.size())))); + BuiltInRegistries.ITEM.getRandomElementOf(ItemTags.CREEPER_DROP_MUSIC_DISCS, rnd).ifPresent(disc -> wrapper.setDisc(new ItemStack(disc))); } } - private static List musicDiscs = null; - - private static List getMusicDiscs() { - if (musicDiscs == null) { - Map records = RecordItem.BY_NAME; - Set blockedDiscs = new HashSet<>(Config.SERVER.entityBackpackAdditions.discBlockList.get()); - musicDiscs = new ArrayList<>(); - records.forEach((sound, musicDisc) -> { - if (!blockedDiscs.contains(BuiltInRegistries.ITEM.getKey(musicDisc).toString())) { - musicDiscs.add(musicDisc); - } - }); - } - - return musicDiscs; - } - private static void raiseHealth(Monster monster, int minDifficulty) { if (Boolean.FALSE.equals(Config.SERVER.entityBackpackAdditions.buffHealth.get())) { return; @@ -194,7 +187,7 @@ private static void raiseHealth(Monster monster, int minDifficulty) { if (maxHealth != null) { double healthAddition = maxHealth.getBaseValue() * minDifficulty; if (healthAddition > 0.1D) { - maxHealth.addPermanentModifier(new AttributeModifier("Backpack bearer health bonus", healthAddition, AttributeModifier.Operation.ADDITION)); + maxHealth.addPermanentModifier(new AttributeModifier(SophisticatedBackpacks.getRL("backpack_bearer_health_bonus"), healthAddition, AttributeModifier.Operation.ADD_VALUE)); } monster.setHealth(monster.getMaxHealth()); } @@ -236,8 +229,8 @@ private static void applyPotions(Monster monster, int difficulty, int minDifficu private static void addLoot(Monster monster, IBackpackWrapper backpackWrapper, int difficulty) { if (difficulty != 0) { Config.SERVER.entityBackpackAdditions.getLootTableName(monster.getType()).ifPresent(lootTableName -> { - float lootPercentage = (float) difficulty / MAX_DIFFICULTY; - backpackWrapper.setLoot(lootTableName, lootPercentage); + float lootFactor = (float) difficulty / MAX_DIFFICULTY; + backpackWrapper.setLoot(lootTableName, lootFactor); }); } } @@ -259,19 +252,20 @@ static void handleBackpackDrop(LivingDropsEvent event) { } private static boolean shouldDropBackpack(LivingDropsEvent event, Config.Server.EntityBackpackAdditionsConfig additionsConfig, LivingEntity mob, ItemStack backpack) { - if (!(event.getSource().getEntity() instanceof Player)) { + if (!(event.getSource().getEntity() instanceof Player player)) { return false; } if (!Boolean.TRUE.equals(additionsConfig.dropToFakePlayers.get()) && event.getSource().getEntity() instanceof FakePlayer) { return false; } float lootingChanceMultiplier = dropChanceMultiplier.getOrDefault(backpack.getItem(), 1F); - return mob.level().random.nextFloat() < (additionsConfig.backpackDropChance.get() + event.getLootingLevel() * additionsConfig.lootingChanceIncreasePerLevel.get()) * lootingChanceMultiplier; + int lootingLevel = player.level().registryAccess().registry(Registries.ENCHANTMENT).map(registry -> player.getMainHandItem().getEnchantmentLevel(registry.getHolderOrThrow(Enchantments.LOOTING))).orElse(0); + return mob.level().random.nextFloat() < (additionsConfig.backpackDropChance.get() + lootingLevel * additionsConfig.lootingChanceIncreasePerLevel.get()) * lootingChanceMultiplier; } public static void removeBeneficialEffects(Creeper creeper) { if (creeper.getTags().contains(SPAWNED_WITH_BACKPACK)) { - creeper.getActiveEffects().removeIf(e -> e.getEffect().isBeneficial()); + creeper.getActiveEffects().removeIf(e -> e.getEffect().value().isBeneficial()); } } @@ -285,20 +279,20 @@ public static void removeBackpackUuid(Monster entity, Level level) { } private static void removeContentsUuid(ItemStack stack) { - BackpackWrapper.fromData(stack).getContentsUuid().ifPresent(uuid -> BackpackStorage.get().removeBackpackContents(uuid)); + BackpackWrapper.fromStack(stack).getContentsUuid().ifPresent(uuid -> BackpackStorage.get().removeBackpackContents(uuid)); } - public static void onLivingUpdate(LivingEvent.LivingTickEvent event) { - LivingEntity entity = event.getEntity(); - if (!entity.getTags().contains(SPAWNED_WITH_JUKEBOX_UPGRADE)) { + public static void onLivingUpdate(EntityTickEvent.Post event) { + Entity entity = event.getEntity(); + if (!(entity instanceof LivingEntity livingEntity) || !entity.getTags().contains(SPAWNED_WITH_JUKEBOX_UPGRADE)) { return; } - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(entity.getItemBySlot(EquipmentSlot.CHEST)); + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(livingEntity.getItemBySlot(EquipmentSlot.CHEST)); backpackWrapper.getUpgradeHandler().getTypeWrappers(JukeboxUpgradeItem.TYPE).forEach(wrapper -> { if (wrapper.isPlaying()) { - wrapper.tick(entity, entity.level(), entity.blockPosition()); + wrapper.tick(livingEntity, entity.level(), entity.blockPosition()); } else { - wrapper.play(entity); + wrapper.play(livingEntity); } }); } @@ -329,20 +323,20 @@ public int getMinDifficulty() { } private static class ApplicableEffect { - private final List effects; + private final List> effects; private final int maxAmplifier; - private ApplicableEffect(MobEffect effect) { + private ApplicableEffect(Holder effect) { this(List.of(effect), Integer.MAX_VALUE); } - private ApplicableEffect(List effects, int maxAmplifier) { + private ApplicableEffect(List> effects, int maxAmplifier) { this.effects = effects; this.maxAmplifier = maxAmplifier; } - public MobEffect getRandomEffect(RandomSource random) { + public Holder getRandomEffect(RandomSource random) { return effects.get(random.nextInt(effects.size())); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContainer.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContainer.java index 5fb51e3f..7d646d8c 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContainer.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContainer.java @@ -10,6 +10,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackAccessLogger; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; @@ -17,10 +18,9 @@ import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackSettingsHandler; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; import net.p3pp3rf1y.sophisticatedbackpacks.client.gui.SBPTranslationHelper; -import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackContentsPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackContentsPayload; import net.p3pp3rf1y.sophisticatedcore.common.gui.ISyncedContainer; import net.p3pp3rf1y.sophisticatedcore.common.gui.StorageContainerMenuBase; -import net.p3pp3rf1y.sophisticatedcore.network.PacketHelper; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeHandler; import net.p3pp3rf1y.sophisticatedcore.util.NoopStorageWrapper; @@ -67,7 +67,9 @@ protected void sendStorageSettingsToClient() { CompoundTag settingsNbt = storageWrapper.getSettingsHandler().getNbt(); if (!settingsNbt.isEmpty()) { settingsContents.put(BackpackSettingsHandler.SETTINGS_TAG, settingsNbt); - PacketHelper.sendToPlayer(new BackpackContentsPacket(uuid, settingsContents), (ServerPlayer) player); + if (player instanceof ServerPlayer serverPlayer) { + PacketDistributor.sendToPlayer(serverPlayer, new BackpackContentsPayload(uuid, settingsContents)); + } } }); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContext.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContext.java index 90293dc9..9d11be2f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContext.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackContext.java @@ -9,16 +9,16 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackBlockEntity; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackWrapper; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; -import net.p3pp3rf1y.sophisticatedbackpacks.network.SyncClientInfoPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.SyncClientInfoPayload; import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryHandler; import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; -import net.p3pp3rf1y.sophisticatedcore.network.PacketHelper; import net.p3pp3rf1y.sophisticatedcore.util.WorldHelper; import javax.annotation.Nullable; @@ -155,7 +155,7 @@ public IBackpackWrapper getBackpackWrapper(Player player) { SophisticatedBackpacks.LOGGER.error("Error getting backpack wrapper - Unable to find inventory handler for \"{}\"", handlerName); return IBackpackWrapper.Noop.INSTANCE; } - return BackpackWrapper.fromData(inventoryHandler.get().getStackInSlot(player, identifier, backpackSlotIndex)); + return BackpackWrapper.fromStack(inventoryHandler.get().getStackInSlot(player, identifier, backpackSlotIndex)); } @Override @@ -166,7 +166,9 @@ public void onUpgradeChanged(Player player) { // which resulted in issues where client would happily modify nbt instance which is used on server as well and follow up updates on client would also mess up // as they are free to clear state which caused the new cleared state write into the already existing nbt and server nbt as all were the same instanced CompoundTag modificationSafeRenderInfoNbt = backpackWrapper.getRenderInfo().getNbt().copy(); - PacketHelper.sendToPlayer(new SyncClientInfoPacket(backpackSlotIndex, modificationSafeRenderInfoNbt, backpackWrapper.getColumnsTaken()), (ServerPlayer) player); + if (player instanceof ServerPlayer serverPlayer) { + PacketDistributor.sendToPlayer(serverPlayer, new SyncClientInfoPayload(backpackSlotIndex, modificationSafeRenderInfoNbt, backpackWrapper.getColumnsTaken())); + } } } @@ -234,7 +236,7 @@ public IBackpackWrapper getBackpackWrapper(Player player) { if (!(stackInSlot.getItem() instanceof BackpackItem)) { return IBackpackWrapper.Noop.INSTANCE; } - return BackpackWrapper.fromData(stackInSlot); + return BackpackWrapper.fromStack(stackInSlot); }).orElse(IBackpackWrapper.Noop.INSTANCE); } @@ -365,7 +367,7 @@ public IBackpackWrapper getBackpackWrapper(Player player) { if (!(stackInSlot.getItem() instanceof BackpackItem)) { return IBackpackWrapper.Noop.INSTANCE; } - return BackpackWrapper.fromData(stackInSlot); + return BackpackWrapper.fromStack(stackInSlot); }).orElse(IBackpackWrapper.Noop.INSTANCE); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackSettingsContainerMenu.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackSettingsContainerMenu.java index d145bb90..8c8257dc 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackSettingsContainerMenu.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/gui/BackpackSettingsContainerMenu.java @@ -5,14 +5,14 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; +import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackSettingsHandler; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; -import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackContentsPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackContentsPayload; import net.p3pp3rf1y.sophisticatedbackpacks.settings.BackpackMainSettingsCategory; import net.p3pp3rf1y.sophisticatedbackpacks.settings.BackpackMainSettingsContainer; import net.p3pp3rf1y.sophisticatedcore.common.gui.SettingsContainerMenu; -import net.p3pp3rf1y.sophisticatedcore.network.PacketHelper; import static net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems.SETTINGS_CONTAINER_TYPE; @@ -66,7 +66,9 @@ private void sendBackpackSettingsToClient() { CompoundTag settingsNbt = storageWrapper.getSettingsHandler().getNbt(); if (!settingsNbt.isEmpty()) { settingsContents.put(BackpackSettingsHandler.SETTINGS_TAG, settingsNbt); - PacketHelper.sendToPlayer(new BackpackContentsPacket(uuid, settingsContents), (ServerPlayer) player); + if (player instanceof ServerPlayer serverPlayer) { + PacketDistributor.sendToPlayer(serverPlayer, new BackpackContentsPayload(uuid, settingsContents)); + } } }); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java index 4cad94e8..58409083 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/curios/CuriosCompat.java @@ -2,13 +2,14 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; +import net.neoforged.api.distmarker.Dist; import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLLoader; import net.p3pp3rf1y.sophisticatedbackpacks.compat.CompatModIds; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; import net.p3pp3rf1y.sophisticatedcore.compat.ICompat; import top.theillusivec4.curios.api.CuriosApi; -import top.theillusivec4.curios.api.SlotTypePreset; import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; import java.util.HashSet; @@ -31,8 +32,8 @@ private void addPlayerInventoryHandlers() { private Set getCurioTags(long gameTime) { if (lastTagsRefresh + TAGS_REFRESH_COOLDOWN < gameTime) { lastTagsRefresh = gameTime; - backpackCurioIdentifiers = new HashSet<>(CuriosApi.getItemStackSlots(ModItems.BACKPACK.get().getDefaultInstance()).keySet()); - backpackCurioIdentifiers.add(SlotTypePreset.CURIO.getIdentifier()); + backpackCurioIdentifiers = new HashSet<>( CuriosApi.getItemStackSlots(ModItems.BACKPACK.get().getDefaultInstance(), FMLLoader.getDist() == Dist.CLIENT).keySet()); + backpackCurioIdentifiers.add("curio"); } return backpackCurioIdentifiers; } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/DyeRecipesMaker.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/DyeRecipesMaker.java index 343933fc..869fca0e 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/DyeRecipesMaker.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/DyeRecipesMaker.java @@ -36,14 +36,14 @@ private static void addMultipleColorsRecipe(List> r ingredients.add(Ingredient.of(DyeColor.BLACK.getTag())); ItemStack backpackOutput = new ItemStack(ModItems.BACKPACK.get()); - int clothColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_CLOTH_COLOR, BackpackWrapper.DEFAULT_CLOTH_COLOR, List.of( + int clothColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_MAIN_COLOR, BackpackWrapper.DEFAULT_MAIN_COLOR, List.of( DyeColor.BLUE, DyeColor.YELLOW, DyeColor.LIME )); - int trimColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_BORDER_COLOR, BackpackWrapper.DEFAULT_BORDER_COLOR, List.of( + int trimColor = ColorHelper.calculateColor(BackpackWrapper.DEFAULT_ACCENT_COLOR, BackpackWrapper.DEFAULT_ACCENT_COLOR, List.of( DyeColor.BLUE, DyeColor.BLACK )); - BackpackWrapper.fromData(backpackOutput).setColors(clothColor, trimColor); + BackpackWrapper.fromStack(backpackOutput).setColors(clothColor, trimColor); ShapedRecipePattern pattern = new ShapedRecipePattern(3, 1, ingredients, Optional.empty()); ResourceLocation id = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "multiple_colors"); @@ -53,7 +53,7 @@ private static void addMultipleColorsRecipe(List> r private static void addSingleColorRecipes(List> recipes) { for (DyeColor color : DyeColor.values()) { ItemStack backpackOutput = new ItemStack(ModItems.BACKPACK.get()); - BackpackWrapper.fromData(backpackOutput).setColors(ColorHelper.getColor(color.getTextureDiffuseColors()), ColorHelper.getColor(color.getTextureDiffuseColors())); + BackpackWrapper.fromStack(backpackOutput).setColors(color.getTextureDiffuseColor(), color.getTextureDiffuseColor()); NonNullList ingredients = NonNullList.create(); ingredients.add(Ingredient.of(ModItems.BACKPACK.get())); ingredients.add(Ingredient.of(color.getTag())); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/SBPPlugin.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/SBPPlugin.java index 75b19b32..5a820ed7 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/SBPPlugin.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/jei/SBPPlugin.java @@ -47,7 +47,7 @@ public ResourceLocation getPluginUid() { @Override public void registerItemSubtypes(ISubtypeRegistration registration) { IIngredientSubtypeInterpreter backpackNbtInterpreter = (itemStack, context) -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(itemStack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(itemStack); return "{clothColor:" + wrapper.getMainColor() + ",borderColor:" + wrapper.getAccentColor() + "}"; }; registration.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, ModItems.BACKPACK.get(), backpackNbtInterpreter); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackDyeRecipe.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackDyeRecipe.java index ff1f9ed9..3f9e2dc2 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackDyeRecipe.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackDyeRecipe.java @@ -30,9 +30,9 @@ protected boolean isDyeableStorageItem(ItemStack stack) { @Override protected void applyColors(ItemStack coloredStorage, List mainDyes, List trimDyes) { - IBackpackWrapper coloredWrapper = BackpackWrapper.fromData(coloredStorage); - coloredWrapper.setColors(ColorHelper.calculateColor(coloredWrapper.getMainColor(), BackpackWrapper.DEFAULT_CLOTH_COLOR, mainDyes), - ColorHelper.calculateColor(coloredWrapper.getAccentColor(), BackpackWrapper.DEFAULT_BORDER_COLOR, trimDyes) + IBackpackWrapper coloredWrapper = BackpackWrapper.fromStack(coloredStorage); + coloredWrapper.setColors(ColorHelper.calculateColor(coloredWrapper.getMainColor(), BackpackWrapper.DEFAULT_MAIN_COLOR, mainDyes), + ColorHelper.calculateColor(coloredWrapper.getAccentColor(), BackpackWrapper.DEFAULT_ACCENT_COLOR, trimDyes) ); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackUpgradeRecipe.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackUpgradeRecipe.java index 9bda424e..f924004d 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackUpgradeRecipe.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BackpackUpgradeRecipe.java @@ -1,8 +1,8 @@ package net.p3pp3rf1y.sophisticatedbackpacks.crafting; -import net.minecraft.core.RegistryAccess; -import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.core.HolderLookup; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapedRecipe; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; @@ -33,10 +33,10 @@ public boolean isSpecial() { } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { - ItemStack upgradedBackpack = super.assemble(inv, registryAccess); - getBackpack(inv).flatMap(backpack -> Optional.ofNullable(backpack.getTag())).ifPresent(tag -> upgradedBackpack.setTag(tag.copy())); - IBackpackWrapper wrapper = BackpackWrapper.fromData(upgradedBackpack); + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { + ItemStack upgradedBackpack = super.assemble(inv, registries); + getBackpack(inv).map(ItemStack::getComponents).ifPresent(upgradedBackpack::applyComponents); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(upgradedBackpack); BackpackItem backpackItem = ((BackpackItem) upgradedBackpack.getItem()); wrapper.setSlotNumbers(backpackItem.getNumberOfSlots(), backpackItem.getNumberOfUpgradeSlots()); @@ -44,8 +44,8 @@ public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) return upgradedBackpack; } - private Optional getBackpack(CraftingContainer inv) { - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + private Optional getBackpack(CraftingInput inv) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack slotStack = inv.getItem(slot); if (slotStack.getItem() instanceof BackpackItem) { return Optional.of(slotStack); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BasicBackpackRecipe.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BasicBackpackRecipe.java index 1b3b7da3..e72742f7 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BasicBackpackRecipe.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/BasicBackpackRecipe.java @@ -1,8 +1,8 @@ package net.p3pp3rf1y.sophisticatedbackpacks.crafting; -import net.minecraft.core.RegistryAccess; -import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.core.HolderLookup; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapedRecipe; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackWrapper; @@ -24,14 +24,14 @@ public ShapedRecipe getCompose() { } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { - ItemStack result = super.assemble(inv, registryAccess); + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { + ItemStack result = super.assemble(inv, registries); removeUuid(result); return result; } private void removeUuid(ItemStack backpack) { - BackpackWrapper.fromData(backpack).removeContentsUuid(); + BackpackWrapper.fromStack(backpack).removeContentsUuid(); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/SmithingBackpackUpgradeRecipe.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/SmithingBackpackUpgradeRecipe.java index 8e9b9045..87b20352 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/SmithingBackpackUpgradeRecipe.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/crafting/SmithingBackpackUpgradeRecipe.java @@ -1,9 +1,9 @@ package net.p3pp3rf1y.sophisticatedbackpacks.crafting; -import net.minecraft.core.RegistryAccess; -import net.minecraft.world.Container; +import net.minecraft.core.HolderLookup; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.SmithingRecipeInput; import net.minecraft.world.item.crafting.SmithingTransformRecipe; import net.neoforged.fml.util.thread.SidedThreadGroups; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; @@ -29,18 +29,18 @@ public boolean isSpecial() { } @Override - public ItemStack assemble(Container inv, RegistryAccess registryAccess) { + public ItemStack assemble(SmithingRecipeInput inv, HolderLookup.Provider registryAccess) { ItemStack upgradedBackpack = result.copy(); if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER) { - getBackpack(inv).flatMap(backpack -> Optional.ofNullable(backpack.getTag())).ifPresent(tag -> upgradedBackpack.setTag(tag.copy())); - IBackpackWrapper wrapper = BackpackWrapper.fromData(upgradedBackpack); + getBackpack(inv).map(ItemStack::getComponents).ifPresent(upgradedBackpack::applyComponents); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(upgradedBackpack); BackpackItem backpackItem = ((BackpackItem) upgradedBackpack.getItem()); wrapper.setSlotNumbers(backpackItem.getNumberOfSlots(), backpackItem.getNumberOfUpgradeSlots()); } return upgradedBackpack; } - private Optional getBackpack(Container inv) { + private Optional getBackpack(SmithingRecipeInput inv) { ItemStack slotStack = inv.getItem(1); if (slotStack.getItem() instanceof BackpackItem) { return Optional.of(slotStack); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/CopyBackpackDataFunction.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/CopyBackpackDataFunction.java index dcbbf72e..6a233ab8 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/CopyBackpackDataFunction.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/CopyBackpackDataFunction.java @@ -1,6 +1,5 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntity; @@ -27,7 +26,7 @@ public ItemStack apply(ItemStack stack, LootContext lootContext) { } @Override - public LootItemFunctionType getType() { + public LootItemFunctionType getType() { return ModItems.COPY_BACKPACK_DATA.get(); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/DataGenerators.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/DataGenerators.java index b2fc3399..8b2fca33 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/DataGenerators.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/DataGenerators.java @@ -1,17 +1,21 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; +import net.minecraft.core.HolderLookup; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; import net.neoforged.neoforge.data.event.GatherDataEvent; +import java.util.concurrent.CompletableFuture; + public class DataGenerators { private DataGenerators() {} public static void gatherData(GatherDataEvent evt) { DataGenerator generator = evt.getGenerator(); PackOutput packOutput = generator.getPackOutput(); - generator.addProvider(evt.includeServer(), new SBLootTableProvider(packOutput)); - generator.addProvider(evt.includeServer(), new SBLootModifierProvider(packOutput)); - generator.addProvider(evt.includeServer(), new SBPRecipeProvider(packOutput)); + CompletableFuture registries = evt.getLookupProvider(); + generator.addProvider(evt.includeServer(), new SBLootTableProvider(packOutput, registries)); + generator.addProvider(evt.includeServer(), new SBLootModifierProvider(packOutput, registries)); + generator.addProvider(evt.includeServer(), new SBPRecipeProvider(packOutput, registries)); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBInjectLootSubProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBInjectLootSubProvider.java index af054aeb..43729f27 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBInjectLootSubProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBInjectLootSubProvider.java @@ -1,6 +1,9 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.loot.LootTableSubProvider; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -18,18 +21,26 @@ public class SBInjectLootSubProvider implements LootTableSubProvider { private static final String INJECT_FOLDER = "inject/"; - public static final ResourceLocation ABANDONED_MINESHAFT = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.ABANDONED_MINESHAFT.getPath()); - public static final ResourceLocation BASTION_TREASURE = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.BASTION_TREASURE.getPath()); - public static final ResourceLocation DESERT_PYRAMID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.DESERT_PYRAMID.getPath()); - public static final ResourceLocation END_CITY_TREASURE = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.END_CITY_TREASURE.getPath()); - public static final ResourceLocation NETHER_BRIDGE = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.NETHER_BRIDGE.getPath()); - public static final ResourceLocation SHIPWRECK_TREASURE = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.SHIPWRECK_TREASURE.getPath()); - public static final ResourceLocation SIMPLE_DUNGEON = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.SIMPLE_DUNGEON.getPath()); - public static final ResourceLocation WOODLAND_MANSION = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + BuiltInLootTables.WOODLAND_MANSION.getPath()); - public static final Set ALL_TABLES = Set.of(ABANDONED_MINESHAFT, BASTION_TREASURE, DESERT_PYRAMID, END_CITY_TREASURE, NETHER_BRIDGE, SHIPWRECK_TREASURE, SIMPLE_DUNGEON, WOODLAND_MANSION); + public static final ResourceKey ABANDONED_MINESHAFT = createInjectLootTableRegistryKey(BuiltInLootTables.ABANDONED_MINESHAFT); + public static final ResourceKey BASTION_TREASURE = createInjectLootTableRegistryKey(BuiltInLootTables.BASTION_TREASURE); + public static final ResourceKey DESERT_PYRAMID = createInjectLootTableRegistryKey(BuiltInLootTables.DESERT_PYRAMID); + public static final ResourceKey END_CITY_TREASURE = createInjectLootTableRegistryKey(BuiltInLootTables.END_CITY_TREASURE); + public static final ResourceKey NETHER_BRIDGE = createInjectLootTableRegistryKey(BuiltInLootTables.NETHER_BRIDGE); + public static final ResourceKey SHIPWRECK_TREASURE = createInjectLootTableRegistryKey(BuiltInLootTables.SHIPWRECK_TREASURE); + public static final ResourceKey SIMPLE_DUNGEON = createInjectLootTableRegistryKey(BuiltInLootTables.SIMPLE_DUNGEON); + public static final ResourceKey WOODLAND_MANSION = createInjectLootTableRegistryKey(BuiltInLootTables.WOODLAND_MANSION); + public static final Set> ALL_TABLES = Set.of(ABANDONED_MINESHAFT, BASTION_TREASURE, DESERT_PYRAMID, END_CITY_TREASURE, NETHER_BRIDGE, SHIPWRECK_TREASURE, SIMPLE_DUNGEON, WOODLAND_MANSION); + + private static ResourceKey createInjectLootTableRegistryKey(ResourceKey vanillaLootTable) { + ResourceLocation location = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, INJECT_FOLDER + vanillaLootTable.location().getPath()); + return ResourceKey.create(Registries.LOOT_TABLE, location); + } + + public SBInjectLootSubProvider(HolderLookup.Provider registries) { + } @Override - public void generate(BiConsumer tables) { + public void generate(BiConsumer, LootTable.Builder> tables) { tables.accept(SIMPLE_DUNGEON, getLootTable(90, getItemLootEntry(ModItems.BACKPACK.get(), 5), getItemLootEntry(ModItems.COPPER_BACKPACK.get(), 3), diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootEnabledCondition.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootEnabledCondition.java index a5465f56..74451863 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootEnabledCondition.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootEnabledCondition.java @@ -1,6 +1,5 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java index 5b5e86f7..1febc536 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootModifierProvider.java @@ -1,10 +1,12 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootContext; @@ -17,10 +19,12 @@ import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; import net.p3pp3rf1y.sophisticatedbackpacks.init.ModItems; +import java.util.concurrent.CompletableFuture; + public class SBLootModifierProvider extends GlobalLootModifierProvider { - SBLootModifierProvider(PackOutput packOutput) { - super(packOutput, SophisticatedBackpacks.MOD_ID); + SBLootModifierProvider(PackOutput packOutput, CompletableFuture registries) { + super(packOutput, registries, SophisticatedBackpacks.MOD_ID); } @Override @@ -35,41 +39,42 @@ protected void start() { addInjectLootTableModifier(SBInjectLootSubProvider.NETHER_BRIDGE, BuiltInLootTables.NETHER_BRIDGE); } - private void addInjectLootTableModifier(ResourceLocation lootTable, ResourceLocation lootTableToInjectInto) { - add(lootTableToInjectInto.getPath(), new InjectLootModifier(lootTable, lootTableToInjectInto)); + private void addInjectLootTableModifier(ResourceKey lootTable, ResourceKey lootTableToInjectInto) { + add(lootTableToInjectInto.location().getPath(), new InjectLootModifier(lootTable, lootTableToInjectInto)); } public static class InjectLootModifier extends LootModifier { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> LootModifier.codecStart(inst).and( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> LootModifier.codecStart(inst).and( inst.group( - ResourceLocation.CODEC.fieldOf("loot_table").forGetter(m -> m.lootTable), - ResourceLocation.CODEC.fieldOf("loot_table_to_inject_into").forGetter(m -> m.lootTableToInjectInto) + ResourceKey.codec(Registries.LOOT_TABLE).fieldOf("loot_table").forGetter(m -> m.lootTable), + ResourceKey.codec(Registries.LOOT_TABLE).fieldOf("loot_table_to_inject_into").forGetter(m -> m.lootTableToInjectInto) ) ).apply(inst, InjectLootModifier::new)); - private final ResourceLocation lootTable; - private final ResourceLocation lootTableToInjectInto; + private final ResourceKey lootTable; + private final ResourceKey lootTableToInjectInto; - protected InjectLootModifier(LootItemCondition[] conditions, ResourceLocation lootTable, ResourceLocation lootTableToInjectInto) { + protected InjectLootModifier(LootItemCondition[] conditions, ResourceKey lootTable, ResourceKey lootTableToInjectInto) { super(conditions); this.lootTable = lootTable; this.lootTableToInjectInto = lootTableToInjectInto; } - protected InjectLootModifier(ResourceLocation lootTable, ResourceLocation lootTableToInjectInto) { + protected InjectLootModifier(ResourceKey lootTable, ResourceKeylootTableToInjectInto) { this(new LootItemCondition[] {SBLootEnabledCondition.builder().build(), - LootTableIdCondition.builder(lootTableToInjectInto).build()}, lootTable, lootTableToInjectInto); + LootTableIdCondition.builder(lootTableToInjectInto.location()).build()}, lootTable, lootTableToInjectInto); } @SuppressWarnings({"deprecation", "java:S1874"}) // Need to call getRandomItemsRaw to skip neo calling modifyLoot event and causing infinite loop @Override protected ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { - LootTable table = context.getResolver().getLootTable(lootTable); - table.getRandomItemsRaw(context, generatedLoot::add); + context.getResolver().get(Registries.LOOT_TABLE, lootTable).ifPresent(extraTable -> { + extraTable.value().getRandomItemsRaw(context, LootTable.createStackSplitter(context.getLevel(), generatedLoot::add)); + }); return generatedLoot; } @Override - public Codec codec() { + public MapCodec codec() { return ModItems.INJECT_LOOT.get(); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootTableProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootTableProvider.java index 49cfa4b1..be0e516d 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootTableProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBLootTableProvider.java @@ -1,18 +1,20 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; +import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.loot.LootTableProvider; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import java.util.List; +import java.util.concurrent.CompletableFuture; public class SBLootTableProvider extends LootTableProvider { - SBLootTableProvider(PackOutput packOutput) { + SBLootTableProvider(PackOutput packOutput, CompletableFuture registries) { super(packOutput, SBInjectLootSubProvider.ALL_TABLES, List.of( new SubProviderEntry(SBPBlockLootSubProvider::new, LootContextParamSets.BLOCK), new SubProviderEntry(SBInjectLootSubProvider::new, LootContextParamSets.CHEST) - ) + ), registries ); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootProvider.java deleted file mode 100644 index e69de29b..00000000 diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootSubProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootSubProvider.java index a0872d53..ca07603f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootSubProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPBlockLootSubProvider.java @@ -1,5 +1,6 @@ package net.p3pp3rf1y.sophisticatedbackpacks.data; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.loot.BlockLootSubProvider; import net.minecraft.world.flag.FeatureFlags; @@ -18,8 +19,8 @@ import java.util.Set; public class SBPBlockLootSubProvider extends BlockLootSubProvider { - protected SBPBlockLootSubProvider() { - super(Set.of(), FeatureFlags.REGISTRY.allFlags()); + protected SBPBlockLootSubProvider(HolderLookup.Provider registries) { + super(Set.of(), FeatureFlags.REGISTRY.allFlags(), registries); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java index 56fe7d54..0463dd6c 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/data/SBPRecipeProvider.java @@ -2,11 +2,11 @@ import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.data.recipes.RecipeProvider; import net.minecraft.data.recipes.SpecialRecipeBuilder; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; @@ -24,12 +24,14 @@ import net.p3pp3rf1y.sophisticatedcore.crafting.UpgradeNextTierRecipe; import net.p3pp3rf1y.sophisticatedcore.util.RegistryHelper; +import java.util.concurrent.CompletableFuture; + public class SBPRecipeProvider extends RecipeProvider { private static final String HAS_UPGRADE_BASE = "has_upgrade_base"; private static final String HAS_SMELTING_UPGRADE = "has_smelting_upgrade"; - public SBPRecipeProvider(PackOutput packOutput) { - super(packOutput); + public SBPRecipeProvider(PackOutput packOutput, CompletableFuture registries) { + super(packOutput, registries); } @Override @@ -80,7 +82,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) { .define('I', Tags.Items.INGOTS_IRON) .define('B', ModItems.COPPER_BACKPACK.get()) .unlockedBy("has_copper_backpack", has(ModItems.COPPER_BACKPACK.get())) - .save(recipeOutput, ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.getRegistryName("iron_backpack_from_copper"))); + .save(recipeOutput, SophisticatedBackpacks.getRL("iron_backpack_from_copper")); ShapeBasedRecipeBuilder.shaped(ModItems.COPPER_BACKPACK.get(), BackpackUpgradeRecipe::new) .pattern("CCC") @@ -177,7 +179,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) { .define('R', Tags.Items.DUSTS_REDSTONE) .define('M', ModItems.MAGNET_UPGRADE.get()) .unlockedBy("has_magnet_upgrade", has(ModItems.MAGNET_UPGRADE.get())) - .save(recipeOutput, ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.getRegistryName("advanced_magnet_upgrade_from_basic"))); + .save(recipeOutput, SophisticatedBackpacks.getRL("advanced_magnet_upgrade_from_basic")); ShapeBasedRecipeBuilder.shaped(ModItems.FEEDING_UPGRADE.get()) .pattern(" C ") @@ -395,7 +397,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) { .define('S', ModItems.STACK_UPGRADE_STARTER_TIER.get()) .define('I', Tags.Items.STORAGE_BLOCKS_IRON) .unlockedBy(HAS_UPGRADE_BASE, has(ModItems.UPGRADE_BASE.get())) - .save(recipeOutput, ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.getRegistryName("stack_upgrade_tier_1_from_starter"))); + .save(recipeOutput, SophisticatedBackpacks.getRL("stack_upgrade_tier_1_from_starter")); ShapeBasedRecipeBuilder.shaped(ModItems.STACK_UPGRADE_TIER_2.get()) .pattern("GGG") @@ -464,7 +466,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) { .pattern("GGG") .pattern("GBG") .pattern("GGG") - .define('G', Tags.Items.GLASS) + .define('G', Tags.Items.GLASS_BLOCKS) .define('B', ModItems.UPGRADE_BASE.get()) .unlockedBy(HAS_UPGRADE_BASE, has(ModItems.UPGRADE_BASE.get())) .save(recipeOutput); @@ -495,7 +497,7 @@ protected void buildRecipes(RecipeOutput recipeOutput) { .pattern("PBS") .pattern("GUG") .define('U', Items.BUCKET) - .define('G', Tags.Items.GLASS) + .define('G', Tags.Items.GLASS_BLOCKS) .define('P', Items.PISTON) .define('S', Items.STICKY_PISTON) .define('B', ModItems.UPGRADE_BASE.get()) diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModBlocks.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModBlocks.java index a84d7780..c786dc02 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModBlocks.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModBlocks.java @@ -1,7 +1,6 @@ package net.p3pp3rf1y.sophisticatedbackpacks.init; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.bus.api.EventPriority; @@ -10,7 +9,6 @@ import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.registries.DeferredRegister; -import net.p3pp3rf1y.sophisticatedbackpacks.Config; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackBlock; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackBlockEntity; diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModDataComponents.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModDataComponents.java new file mode 100644 index 00000000..d5707697 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModDataComponents.java @@ -0,0 +1,51 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.init; + +import com.mojang.serialization.Codec; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredRegister; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.upgrades.inception.InventoryOrder; +import net.p3pp3rf1y.sophisticatedbackpacks.upgrades.refill.RefillUpgradeWrapper; +import net.p3pp3rf1y.sophisticatedbackpacks.upgrades.toolswapper.ToolSwapMode; + +import java.util.Map; +import java.util.function.Supplier; + +public class ModDataComponents { + private static final DeferredRegister> DATA_COMPONENT_TYPES = DeferredRegister.create(BuiltInRegistries.DATA_COMPONENT_TYPE, SophisticatedBackpacks.MOD_ID); + + public static final Supplier> LOOT_TABLE = DATA_COMPONENT_TYPES.register("loot_table", + () -> new DataComponentType.Builder().persistent(ResourceLocation.CODEC).networkSynchronized(ResourceLocation.STREAM_CODEC).build()); + + public static final Supplier> LOOT_FACTOR = DATA_COMPONENT_TYPES.register("loot_factor", + () -> new DataComponentType.Builder().persistent(Codec.FLOAT).networkSynchronized(ByteBufCodecs.FLOAT).build()); + + public static final Supplier> COLUMNS_TAKEN = DATA_COMPONENT_TYPES.register("columns_taken", + () -> new DataComponentType.Builder().persistent(Codec.INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> ITEM_NAME = DATA_COMPONENT_TYPES.register("item_name", + () -> new DataComponentType.Builder().persistent(Codec.STRING).networkSynchronized(ByteBufCodecs.STRING_UTF8).build()); + + public static final Supplier> FILTER_BY_INVENTORY = DATA_COMPONENT_TYPES.register("filter_by_inventory", + () -> new DataComponentType.Builder().persistent(Codec.BOOL).networkSynchronized(ByteBufCodecs.BOOL).build()); + + public static final Supplier> INVENTORY_ORDER = DATA_COMPONENT_TYPES.register("inventory_order", + () -> new DataComponentType.Builder().persistent(InventoryOrder.CODEC).networkSynchronized(InventoryOrder.STREAM_CODEC).build()); + + public static final Supplier>> TARGET_SLOTS = DATA_COMPONENT_TYPES.register("target_slots", + () -> new DataComponentType.Builder>().persistent(RefillUpgradeWrapper.TARGET_SLOTS_CODEC).networkSynchronized(RefillUpgradeWrapper.TARGET_SLOTS_STREAM_CODEC).build()); + + public static final Supplier> SHOULD_SWAP_WEAPON = DATA_COMPONENT_TYPES.register("should_swap_weapon", + () -> new DataComponentType.Builder().persistent(Codec.BOOL).networkSynchronized(ByteBufCodecs.BOOL).build()); + + public static final Supplier> TOOL_SWAP_MODE = DATA_COMPONENT_TYPES.register("tool_swap_mode", + () -> new DataComponentType.Builder().persistent(ToolSwapMode.CODEC).networkSynchronized(ToolSwapMode.STREAM_CODEC).build()); + + public static void register(IEventBus modBus) { + DATA_COMPONENT_TYPES.register(modBus); + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java index 71478c8e..70de5dbb 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModItems.java @@ -1,6 +1,6 @@ package net.p3pp3rf1y.sophisticatedbackpacks.init; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.cauldron.CauldronInteraction; @@ -12,7 +12,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.player.Player; @@ -24,6 +24,7 @@ import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.block.LayeredCauldronBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; @@ -123,9 +124,9 @@ private ModItems() { public static final DeferredRegister ITEMS = DeferredRegister.create(BuiltInRegistries.ITEM, SophisticatedBackpacks.MOD_ID); public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB.location(), SophisticatedBackpacks.MOD_ID); - public static final DeferredRegister LOOT_FUNCTION_TYPES = DeferredRegister.create(Registries.LOOT_FUNCTION_TYPE.location(), SophisticatedBackpacks.MOD_ID); + public static final DeferredRegister> LOOT_FUNCTION_TYPES = DeferredRegister.create(Registries.LOOT_FUNCTION_TYPE.location(), SophisticatedBackpacks.MOD_ID); public static final DeferredRegister LOOT_CONDITION_TYPES = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE.location(), SophisticatedBackpacks.MOD_ID); - public static final DeferredRegister> LOOT_MODIFIERS = DeferredRegister.create(NeoForgeRegistries.GLOBAL_LOOT_MODIFIER_SERIALIZERS, SophisticatedBackpacks.MOD_ID); + public static final DeferredRegister> LOOT_MODIFIERS = DeferredRegister.create(NeoForgeRegistries.GLOBAL_LOOT_MODIFIER_SERIALIZERS, SophisticatedBackpacks.MOD_ID); private static final DeferredRegister> MENU_TYPES = DeferredRegister.create(BuiltInRegistries.MENU, SophisticatedBackpacks.MOD_ID); private static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(BuiltInRegistries.ENTITY_TYPE, SophisticatedBackpacks.MOD_ID); @@ -218,7 +219,7 @@ private ModItems() { () -> new ToolSwapperUpgradeItem(true, true)); public static final DeferredHolder TANK_UPGRADE = ITEMS.register("tank_upgrade", () -> new TankUpgradeItem(Config.SERVER.tankUpgrade, Config.SERVER.maxUpgradesPerStorage)); public static final DeferredHolder BATTERY_UPGRADE = ITEMS.register("battery_upgrade", () -> new BatteryUpgradeItem(Config.SERVER.batteryUpgrade, Config.SERVER.maxUpgradesPerStorage)); - public static final DeferredHolder PUMP_UPGRADE = ITEMS.register("pump_upgrade", () -> new PumpUpgradeItem(false, false, Config.SERVER.pumpUpgrade, Config.SERVER.maxUpgradesPerStorage)); + public static final DeferredHolder PUMP_UPGRADE = ITEMS.register("pump_upgrade", () -> new PumpUpgradeItem(false, true, Config.SERVER.pumpUpgrade, Config.SERVER.maxUpgradesPerStorage)); public static final DeferredHolder ADVANCED_PUMP_UPGRADE = ITEMS.register("advanced_pump_upgrade", () -> new PumpUpgradeItem(true, true, Config.SERVER.pumpUpgrade, Config.SERVER.maxUpgradesPerStorage)); public static final DeferredHolder XP_PUMP_UPGRADE = ITEMS.register("xp_pump_upgrade", () -> new XpPumpUpgradeItem(Config.SERVER.xpPumpUpgrade, Config.SERVER.maxUpgradesPerStorage)); public static final DeferredHolder ANVIL_UPGRADE = ITEMS.register("anvil_upgrade", AnvilUpgradeItem::new); @@ -251,14 +252,13 @@ private ModItems() { public static final Supplier> COPY_BACKPACK_DATA = LOOT_FUNCTION_TYPES.register("copy_backpack_data", () -> new LootItemFunctionType<>(CopyBackpackDataFunction.CODEC)); public static final Supplier LOOT_ENABLED_CONDITION = LOOT_CONDITION_TYPES.register("loot_enabled", () -> new LootItemConditionType(SBLootEnabledCondition.CODEC)); - public static final Supplier> INJECT_LOOT = LOOT_MODIFIERS.register("inject_loot", () -> SBLootModifierProvider.InjectLootModifier.CODEC); + public static final Supplier> INJECT_LOOT = LOOT_MODIFIERS.register("inject_loot", () -> SBLootModifierProvider.InjectLootModifier.CODEC); private static final DeferredRegister> ATTACHMENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, SophisticatedBackpacks.MOD_ID); - public static final Supplier> BACKPACK_WRAPPER = ATTACHMENT_TYPES.register( - "backpack_wrapper", () -> AttachmentType.builder(BackpackWrapper::new).build()); public static void registerHandlers(IEventBus modBus) { ITEMS.register(modBus); + ModDataComponents.register(modBus); CREATIVE_MODE_TABS.register(modBus); MENU_TYPES.register(modBus); ENTITY_TYPES.register(modBus); @@ -369,36 +369,37 @@ public static void registerCauldronInteractions() { } private static void registerCapabilities(RegisterCapabilitiesEvent event) { - event.registerItem(Capabilities.ItemHandler.ITEM, (stack, v) -> BackpackWrapper.fromData(stack).getInventoryForInputOutput(), + event.registerItem(Capabilities.ItemHandler.ITEM, (stack, v) -> BackpackWrapper.fromStack(stack).getInventoryForInputOutput(), BACKPACK.get(), COPPER_BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get()); event.registerItem(Capabilities.FluidHandler.ITEM, (stack, v) -> { if (Boolean.FALSE.equals(Config.SERVER.itemFluidHandlerEnabled.get())) { return null; } - return BackpackWrapper.fromData(stack).getItemFluidHandler().orElse(null); + return BackpackWrapper.fromStack(stack).getItemFluidHandler().orElse(null); }, BACKPACK.get(), COPPER_BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get()); - event.registerItem(Capabilities.EnergyStorage.ITEM, (stack, v) -> BackpackWrapper.fromData(stack).getEnergyStorage().orElse(null), + event.registerItem(Capabilities.EnergyStorage.ITEM, (stack, v) -> BackpackWrapper.fromStack(stack).getEnergyStorage().orElse(null), BACKPACK.get(), COPPER_BACKPACK.get(), IRON_BACKPACK.get(), GOLD_BACKPACK.get(), DIAMOND_BACKPACK.get(), NETHERITE_BACKPACK.get()); } private static class BackpackCauldronInteraction implements CauldronInteraction { private static boolean hasDefaultColor(IStorageWrapper wrapper) { - return wrapper.getAccentColor() == BackpackWrapper.DEFAULT_BORDER_COLOR && wrapper.getMainColor() == BackpackWrapper.DEFAULT_CLOTH_COLOR; + return wrapper.getAccentColor() == BackpackWrapper.DEFAULT_ACCENT_COLOR && wrapper.getMainColor() == BackpackWrapper.DEFAULT_MAIN_COLOR; } @Override - public InteractionResult interact(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(stack); + public ItemInteractionResult interact(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, ItemStack stack) { + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(stack); if (hasDefaultColor(backpackWrapper)) { - return InteractionResult.PASS; + return ItemInteractionResult.FAIL; } if (!level.isClientSide) { - backpackWrapper.setColors(BackpackWrapper.DEFAULT_CLOTH_COLOR, BackpackWrapper.DEFAULT_BORDER_COLOR); + backpackWrapper.setColors(BackpackWrapper.DEFAULT_MAIN_COLOR, BackpackWrapper.DEFAULT_ACCENT_COLOR); + LayeredCauldronBlock.lowerFillLevel(state, level, pos); } - return InteractionResult.sidedSuccess(level.isClientSide); + return ItemInteractionResult.sidedSuccess(level.isClientSide); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPackets.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPackets.java deleted file mode 100644 index a4f8c913..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPackets.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.init; - -import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent; -import net.neoforged.neoforge.network.registration.IPayloadRegistrar; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.network.*; - -public class ModPackets { - private ModPackets() { - } - - public static void registerPackets(final RegisterPayloadHandlerEvent event) { - final IPayloadRegistrar registrar = event.registrar(SophisticatedBackpacks.MOD_ID).versioned("1.0"); - registrar.play(BackpackOpenPacket.ID, BackpackOpenPacket::new, play -> play.server(BackpackOpenPacket::handle)); - registrar.play(UpgradeTogglePacket.ID, UpgradeTogglePacket::new, play -> play.server(UpgradeTogglePacket::handle)); - registrar.play(RequestBackpackInventoryContentsPacket.ID, RequestBackpackInventoryContentsPacket::new, play -> play.server(RequestBackpackInventoryContentsPacket::handle)); - registrar.play(BackpackContentsPacket.ID, BackpackContentsPacket::new, play -> play.client(BackpackContentsPacket::handle)); - registrar.play(InventoryInteractionPacket.ID, InventoryInteractionPacket::new, play -> play.server(InventoryInteractionPacket::handle)); - registrar.play(BlockToolSwapPacket.ID, BlockToolSwapPacket::new, play -> play.server(BlockToolSwapPacket::handle)); - registrar.play(EntityToolSwapPacket.ID, EntityToolSwapPacket::new, play -> play.server(EntityToolSwapPacket::handle)); - registrar.play(BackpackClosePacket.ID, buffer -> new BackpackClosePacket(), play -> play.server(BackpackClosePacket::handle)); - registrar.play(SyncClientInfoPacket.ID, SyncClientInfoPacket::new, play -> play.client(SyncClientInfoPacket::handle)); - registrar.play(AnotherPlayerBackpackOpenPacket.ID, AnotherPlayerBackpackOpenPacket::new, play -> play.server(AnotherPlayerBackpackOpenPacket::handle)); - registrar.play(BlockPickPacket.ID, BlockPickPacket::new, play -> play.server(BlockPickPacket::handle)); - registrar.play(RequestPlayerSettingsPacket.ID, buf -> new RequestPlayerSettingsPacket(), play -> play.server(RequestPlayerSettingsPacket::handle)); - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPayloads.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPayloads.java new file mode 100644 index 00000000..704ad7b0 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/init/ModPayloads.java @@ -0,0 +1,27 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.init; + +import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; +import net.neoforged.neoforge.network.registration.PayloadRegistrar; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.network.*; + +public class ModPayloads { + private ModPayloads() { + } + + public static void registerPackets(final RegisterPayloadHandlersEvent event) { + final PayloadRegistrar registrar = event.registrar(SophisticatedBackpacks.MOD_ID).versioned("1.0"); + registrar.playToServer(BackpackOpenPayload.TYPE, BackpackOpenPayload.STREAM_CODEC, BackpackOpenPayload::handlePayload); + registrar.playToServer(UpgradeTogglePayload.TYPE, UpgradeTogglePayload.STREAM_CODEC, UpgradeTogglePayload::handlePayload); + registrar.playToServer(RequestBackpackInventoryContentsPayload.TYPE, RequestBackpackInventoryContentsPayload.STREAM_CODEC, RequestBackpackInventoryContentsPayload::handlePayload); + registrar.playToClient(BackpackContentsPayload.TYPE, BackpackContentsPayload.STREAM_CODEC, BackpackContentsPayload::handlePayload); + registrar.playToServer(InventoryInteractionPayload.TYPE, InventoryInteractionPayload.STREAM_CODEC, InventoryInteractionPayload::handlePayload); + registrar.playToServer(BlockToolSwapPayload.TYPE, BlockToolSwapPayload.STREAM_CODEC, BlockToolSwapPayload::handlePayload); + registrar.playToServer(EntityToolSwapPayload.TYPE, EntityToolSwapPayload.STREAM_CODEC, EntityToolSwapPayload::handlePayload); + registrar.playToServer(BackpackClosePayload.TYPE, BackpackClosePayload.STREAM_CODEC, BackpackClosePayload::handlePayload); + registrar.playToClient(SyncClientInfoPayload.TYPE, SyncClientInfoPayload.STREAM_CODEC, SyncClientInfoPayload::handlePayload); + registrar.playToServer(AnotherPlayerBackpackOpenPayload.TYPE, AnotherPlayerBackpackOpenPayload.STREAM_CODEC, AnotherPlayerBackpackOpenPayload::handlePayload); + registrar.playToServer(BlockPickPayload.TYPE, BlockPickPayload.STREAM_CODEC, BlockPickPayload::handlePayload); + registrar.playToServer(RequestPlayerSettingsPayload.TYPE, RequestPlayerSettingsPayload.STREAM_CODEC, RequestPlayerSettingsPayload::handlePayload); + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/AnotherPlayerBackpackOpenPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/AnotherPlayerBackpackOpenPayload.java similarity index 62% rename from src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/AnotherPlayerBackpackOpenPacket.java rename to src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/AnotherPlayerBackpackOpenPayload.java index 1b32dde9..7a3be329 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/AnotherPlayerBackpackOpenPacket.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/AnotherPlayerBackpackOpenPayload.java @@ -1,9 +1,10 @@ package net.p3pp3rf1y.sophisticatedbackpacks.network; -import net.minecraft.network.FriendlyByteBuf; +import io.netty.buffer.ByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.SimpleMenuProvider; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -18,28 +19,25 @@ import net.p3pp3rf1y.sophisticatedcore.settings.SettingsManager; import net.p3pp3rf1y.sophisticatedcore.settings.main.MainSettingsCategory; -public class AnotherPlayerBackpackOpenPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "another_player_backpack_open"); - private final int anotherPlayerId; +public record AnotherPlayerBackpackOpenPayload(int anotherPlayerId) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("another_player_backpack_open")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + AnotherPlayerBackpackOpenPayload::anotherPlayerId, + AnotherPlayerBackpackOpenPayload::new); - public AnotherPlayerBackpackOpenPacket(int anotherPlayerId) { - this.anotherPlayerId = anotherPlayerId; - } - - public AnotherPlayerBackpackOpenPacket(FriendlyByteBuf buffer) { - this.anotherPlayerId = buffer.readInt(); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); + @Override + public Type type() { + return TYPE; } - private void handlePacket(Player player) { + public static void handlePayload(AnotherPlayerBackpackOpenPayload payload, IPayloadContext context) { + Player player = context.player(); if (Boolean.FALSE.equals(Config.SERVER.allowOpeningOtherPlayerBackpacks.get())) { return; } - if (player.level().getEntity(anotherPlayerId) instanceof Player anotherPlayer) { + if (player.level().getEntity(payload.anotherPlayerId) instanceof Player anotherPlayer) { PlayerInventoryProvider.get().runOnBackpacks(anotherPlayer, (backpack, inventoryName, identifier, slot) -> { if (canAnotherPlayerOpenBackpack(anotherPlayer, backpack)) { @@ -53,18 +51,8 @@ private void handlePacket(Player player) { } } - private boolean canAnotherPlayerOpenBackpack(Player anotherPlayer, ItemStack backpack) { - MainSettingsCategory category = BackpackWrapper.fromData(backpack).getSettingsHandler().getGlobalSettingsCategory(); + private static boolean canAnotherPlayerOpenBackpack(Player anotherPlayer, ItemStack backpack) { + MainSettingsCategory category = BackpackWrapper.fromStack(backpack).getSettingsHandler().getGlobalSettingsCategory(); return SettingsManager.getSettingValue(anotherPlayer, category.getPlayerSettingsTagName(), category, BackpackMainSettingsCategory.ANOTHER_PLAYER_CAN_OPEN); } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeInt(anotherPlayerId); - } - - @Override - public ResourceLocation id() { - return ID; - } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePacket.java deleted file mode 100644 index cdcba857..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePacket.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.network; - -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContainer; - -@SuppressWarnings("java:S1118") -public class BackpackClosePacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "backpack_close"); - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); - } - - private void handlePacket(Player player) { - if (player.containerMenu instanceof BackpackContainer) { - player.closeContainer(); - } - } - - @Override - public void write(FriendlyByteBuf buffer) { - //noop - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePayload.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePayload.java new file mode 100644 index 00000000..bbedb291 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackClosePayload.java @@ -0,0 +1,27 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.network; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.entity.player.Player; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContainer; +import net.p3pp3rf1y.sophisticatedcore.util.StreamCodecHelper; + +public record BackpackClosePayload() implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("backpack_close")); + public static final StreamCodec STREAM_CODEC = StreamCodecHelper.singleton(BackpackClosePayload::new); + + @Override + public Type type() { + return TYPE; + } + + public static void handlePayload(BackpackClosePayload payload, IPayloadContext context) { + Player player = context.player(); + if (player.containerMenu instanceof BackpackContainer) { + player.closeContainer(); + } + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPacket.java deleted file mode 100644 index 0f97d061..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPacket.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.network; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; -import net.p3pp3rf1y.sophisticatedcore.client.render.ClientStorageContentsTooltipBase; - -import javax.annotation.Nullable; -import java.util.UUID; - -public class BackpackContentsPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "backpack_contents"); - private final UUID backpackUuid; - @Nullable - private final CompoundTag backpackContents; - - public BackpackContentsPacket(UUID backpackUuid, @Nullable CompoundTag backpackContents) { - this.backpackUuid = backpackUuid; - this.backpackContents = backpackContents; - } - - public BackpackContentsPacket(FriendlyByteBuf buffer) { - this(buffer.readUUID(), buffer.readNbt()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); - } - - private void handlePacket(Player player) { - if (backpackContents == null) { - return; - } - - BackpackStorage.get().setBackpackContents(backpackUuid, backpackContents); - ClientStorageContentsTooltipBase.refreshContents(); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeUUID(backpackUuid); - buffer.writeNbt(backpackContents); - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPayload.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPayload.java new file mode 100644 index 00000000..ea9a15c3 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackContentsPayload.java @@ -0,0 +1,40 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.network; + +import io.netty.buffer.ByteBuf; +import net.minecraft.core.UUIDUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; +import net.p3pp3rf1y.sophisticatedcore.client.render.ClientStorageContentsTooltipBase; +import net.p3pp3rf1y.sophisticatedcore.util.StreamCodecHelper; + +import javax.annotation.Nullable; +import java.util.UUID; + +public record BackpackContentsPayload(UUID backpackUuid, @Nullable CompoundTag backpackContents) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("backpack_contents")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + UUIDUtil.STREAM_CODEC, + BackpackContentsPayload::backpackUuid, + StreamCodecHelper.ofNullable(ByteBufCodecs.COMPOUND_TAG), + BackpackContentsPayload::backpackContents, + BackpackContentsPayload::new); + + @Override + public Type type() { + return TYPE; + } + + public static void handlePayload(BackpackContentsPayload payload, IPayloadContext context) { + if (payload.backpackContents == null) { + return; + } + + BackpackStorage.get().setBackpackContents(payload.backpackUuid, payload.backpackContents); + ClientStorageContentsTooltipBase.refreshContents(); + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackOpenPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackOpenPayload.java similarity index 58% rename from src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackOpenPacket.java rename to src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackOpenPayload.java index aec5b010..cca0973f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackOpenPacket.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BackpackOpenPayload.java @@ -1,8 +1,9 @@ package net.p3pp3rf1y.sophisticatedbackpacks.network; -import net.minecraft.network.FriendlyByteBuf; +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.SimpleMenuProvider; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.InventoryMenu; @@ -13,63 +14,56 @@ import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.IContextAwareContainer; import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; -import javax.annotation.Nullable; - -public class BackpackOpenPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "backpack_open"); +public record BackpackOpenPayload(int slotIndex, String identifier, String handlerName) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("backpack_open")); private static final int CHEST_SLOT = 38; private static final int OFFHAND_SLOT = 40; - private final int slotIndex; - private final String identifier; - private final String handlerName; - public BackpackOpenPacket() { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + BackpackOpenPayload::slotIndex, + ByteBufCodecs.STRING_UTF8, + BackpackOpenPayload::identifier, + ByteBufCodecs.STRING_UTF8, + BackpackOpenPayload::handlerName, + BackpackOpenPayload::new); + + public BackpackOpenPayload() { this(-1); } - public BackpackOpenPacket(int backpackSlot) { + public BackpackOpenPayload(int backpackSlot) { this(backpackSlot, ""); } - public BackpackOpenPacket(int backpackSlot, String identifier, String handlerName) { - slotIndex = backpackSlot; - this.identifier = identifier; - this.handlerName = handlerName; - } - - public BackpackOpenPacket(int backpackSlot, String identifier) { + public BackpackOpenPayload(int backpackSlot, String identifier) { this(backpackSlot, identifier, ""); } - public BackpackOpenPacket(FriendlyByteBuf buffer) { - this(buffer.readInt(), buffer.readUtf(), buffer.readUtf()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); + @Override + public Type type() { + return TYPE; } - private void handlePacket(@Nullable Player player) { - if (player == null) { - return; - } + public static void handlePayload(BackpackOpenPayload payload, IPayloadContext context) { + Player player = context.player(); - if (!handlerName.isEmpty()) { - int adjustedSlotIndex = slotIndex; + if (!payload.handlerName.isEmpty()) { + int adjustedSlotIndex = payload.slotIndex; if (adjustedSlotIndex == CHEST_SLOT) { adjustedSlotIndex -= 36; } else if (adjustedSlotIndex == OFFHAND_SLOT) { adjustedSlotIndex = 0; } - BackpackContext.Item backpackContext = new BackpackContext.Item(handlerName, identifier, adjustedSlotIndex, + BackpackContext.Item backpackContext = new BackpackContext.Item(payload.handlerName, payload.identifier, adjustedSlotIndex, player.containerMenu instanceof InventoryMenu || (player.containerMenu instanceof BackpackContainer backpackContainer && backpackContainer.getBackpackContext().wasOpenFromInventory())); openBackpack(player, backpackContext); } else if (player.containerMenu instanceof BackpackContainer backpackContainer) { BackpackContext backpackContext = backpackContainer.getBackpackContext(); - if (slotIndex == -1) { + if (payload.slotIndex == -1) { openBackpack(player, backpackContext.getParentBackpackContext()); - } else if (backpackContainer.isStorageInventorySlot(slotIndex)) { - openBackpack(player, backpackContext.getSubBackpackContext(slotIndex)); + } else if (backpackContainer.isStorageInventorySlot(payload.slotIndex)) { + openBackpack(player, backpackContext.getSubBackpackContext(payload.slotIndex)); } } else if (player.containerMenu instanceof IContextAwareContainer contextAwareContainer) { BackpackContext backpackContext = contextAwareContainer.getBackpackContext(); @@ -79,7 +73,7 @@ private void handlePacket(@Nullable Player player) { } } - private void findAndOpenFirstBackpack(Player player) { + private static void findAndOpenFirstBackpack(Player player) { PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryName, identifier, slot) -> { BackpackContext.Item backpackContext = new BackpackContext.Item(inventoryName, identifier, slot); player.openMenu(new SimpleMenuProvider((w, p, pl) -> new BackpackContainer(w, pl, backpackContext), backpack.getHoverName()), backpackContext::toBuffer); @@ -87,19 +81,7 @@ private void findAndOpenFirstBackpack(Player player) { }); } - private void openBackpack(Player player, BackpackContext backpackContext) { + private static void openBackpack(Player player, BackpackContext backpackContext) { player.openMenu(new SimpleMenuProvider((w, p, pl) -> new BackpackContainer(w, pl, backpackContext), backpackContext.getDisplayName(player)), backpackContext::toBuffer); } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeInt(slotIndex); - buffer.writeUtf(identifier); - buffer.writeUtf(handlerName); - } - - @Override - public ResourceLocation id() { - return ID; - } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockPickPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockPickPayload.java similarity index 52% rename from src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockPickPacket.java rename to src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockPickPayload.java index 09cc1576..4be1fdd9 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockPickPacket.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockPickPayload.java @@ -1,8 +1,8 @@ package net.p3pp3rf1y.sophisticatedbackpacks.network; -import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.network.handling.IPayloadContext; @@ -12,41 +12,28 @@ import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; -public class BlockPickPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "block_pick"); - private final ItemStack filter; +public record BlockPickPayload(ItemStack filter) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("block_pick")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ItemStack.STREAM_CODEC, + BlockPickPayload::filter, + BlockPickPayload::new); - public BlockPickPacket(ItemStack filter) { - this.filter = filter; - } - - public BlockPickPacket(FriendlyByteBuf buffer) { - this(buffer.readItem()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); + @Override + public Type type() { + return TYPE; } - private void handlePacket(Player player) { + public static void handlePayload(BlockPickPayload payload, IPayloadContext context) { + Player player = context.player(); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryHandlerName, identifier, slot) -> { - IBackpackWrapper wrapper = BackpackWrapper.fromData(backpack); + IBackpackWrapper wrapper = BackpackWrapper.fromStack(backpack); for (IBlockPickResponseUpgrade upgrade : wrapper.getUpgradeHandler().getWrappersThatImplement(IBlockPickResponseUpgrade.class)) { - if (upgrade.pickBlock(player, filter)) { + if (upgrade.pickBlock(player, payload.filter)) { return true; } } return false; }); } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeItem(filter); - } - - @Override - public ResourceLocation id() { - return ID; - } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockToolSwapPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockToolSwapPayload.java similarity index 58% rename from src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockToolSwapPacket.java rename to src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockToolSwapPayload.java index b1a312df..582d036f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockToolSwapPacket.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/BlockToolSwapPayload.java @@ -1,10 +1,10 @@ package net.p3pp3rf1y.sophisticatedbackpacks.network; +import io.netty.buffer.ByteBuf; import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.neoforged.neoforge.network.handling.IPayloadContext; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; @@ -14,35 +14,31 @@ import java.util.concurrent.atomic.AtomicBoolean; -public class BlockToolSwapPacket implements CustomPacketPayload { +public record BlockToolSwapPayload(BlockPos pos) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("block_tool_swap")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, + BlockToolSwapPayload::pos, + BlockToolSwapPayload::new); - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "block_tool_swap"); - private final BlockPos pos; - - public BlockToolSwapPacket(BlockPos pos) { - this.pos = pos; - } - - public BlockToolSwapPacket(FriendlyByteBuf buffer) { - this(BlockPos.of(buffer.readLong())); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); + @Override + public Type type() { + return TYPE; } - private void handlePacket(Player player) { + public static void handlePayload(BlockToolSwapPayload payload, IPayloadContext context) { + Player player = context.player(); AtomicBoolean result = new AtomicBoolean(false); AtomicBoolean anyUpgradeCanInteract = new AtomicBoolean(false); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryName, identifier, slot) -> { - BackpackWrapper.fromData(backpack).getUpgradeHandler().getWrappersThatImplement(IBlockToolSwapUpgrade.class) + BackpackWrapper.fromStack(backpack).getUpgradeHandler().getWrappersThatImplement(IBlockToolSwapUpgrade.class) .forEach(upgrade -> { if (!upgrade.canProcessBlockInteract() || result.get()) { return; } anyUpgradeCanInteract.set(true); - result.set(upgrade.onBlockInteract(player.level(), pos, player.level().getBlockState(pos), player)); + result.set(upgrade.onBlockInteract(player.level(), payload.pos, player.level().getBlockState(payload.pos), player)); }); return result.get(); } @@ -56,14 +52,4 @@ private void handlePacket(Player player) { player.displayClientMessage(Component.translatable("gui.sophisticatedbackpacks.status.no_tool_found_for_block"), true); } } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeLong(pos.asLong()); - } - - @Override - public ResourceLocation id() { - return ID; - } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/EntityToolSwapPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/EntityToolSwapPayload.java similarity index 66% rename from src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/EntityToolSwapPacket.java rename to src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/EntityToolSwapPayload.java index c77d69bc..e117328d 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/EntityToolSwapPacket.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/EntityToolSwapPayload.java @@ -1,9 +1,10 @@ package net.p3pp3rf1y.sophisticatedbackpacks.network; -import net.minecraft.network.FriendlyByteBuf; +import io.netty.buffer.ByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; @@ -15,25 +16,22 @@ import java.util.concurrent.atomic.AtomicBoolean; -public class EntityToolSwapPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "entity_tool_swap"); - private final int entityId; +public record EntityToolSwapPayload(int entityId) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("entity_tool_swap")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + EntityToolSwapPayload::entityId, + EntityToolSwapPayload::new); - public EntityToolSwapPacket(int entityId) { - this.entityId = entityId; - } - - public EntityToolSwapPacket(FriendlyByteBuf buffer) { - this(buffer.readInt()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); + @Override + public Type type() { + return TYPE; } - private void handlePacket(Player player) { + public static void handlePayload(EntityToolSwapPayload payload, IPayloadContext context) { + Player player = context.player(); Level level = player.level(); - Entity entity = level.getEntity(entityId); + Entity entity = level.getEntity(payload.entityId); if (entity == null) { return; @@ -42,7 +40,7 @@ private void handlePacket(Player player) { AtomicBoolean result = new AtomicBoolean(false); AtomicBoolean anyUpgradeCanInteract = new AtomicBoolean(false); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryName, identifier, slot) -> { - BackpackWrapper.fromData(backpack) + BackpackWrapper.fromStack(backpack) .getUpgradeHandler().getWrappersThatImplement(IEntityToolSwapUpgrade.class) .forEach(upgrade -> { if (!upgrade.canProcessEntityInteract() || result.get()) { @@ -64,14 +62,4 @@ private void handlePacket(Player player) { player.displayClientMessage(Component.translatable("gui.sophisticatedbackpacks.status.no_tool_found_for_entity"), true); } } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeInt(entityId); - } - - @Override - public ResourceLocation id() { - return ID; - } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPacket.java deleted file mode 100644 index 783206ea..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPacket.java +++ /dev/null @@ -1,51 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.network; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.player.Player; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.util.InventoryInteractionHelper; -import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; - -public class InventoryInteractionPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "inventory_interaction"); - private final BlockPos pos; - private final Direction face; - - public InventoryInteractionPacket(BlockPos pos, Direction face) { - this.pos = pos; - this.face = face; - } - - public InventoryInteractionPacket(FriendlyByteBuf buffer) { - this(buffer.readBlockPos(), buffer.readEnum(Direction.class)); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); - } - - private void handlePacket(Player player) { - PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryName, identifier, slot) -> { - InventoryInteractionHelper.tryInventoryInteraction(pos, player.level(), backpack, face, player); - player.swing(InteractionHand.MAIN_HAND, true); - return true; - }); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeBlockPos(pos); - buffer.writeEnum(face); - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPayload.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPayload.java new file mode 100644 index 00000000..c1645415 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/InventoryInteractionPayload.java @@ -0,0 +1,37 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.network; + +import io.netty.buffer.ByteBuf; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.util.InventoryInteractionHelper; +import net.p3pp3rf1y.sophisticatedbackpacks.util.PlayerInventoryProvider; + +public record InventoryInteractionPayload(BlockPos pos, Direction face) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("inventory_interaction")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, + InventoryInteractionPayload::pos, + Direction.STREAM_CODEC, + InventoryInteractionPayload::face, + InventoryInteractionPayload::new); + + @Override + public Type type() { + return TYPE; + } + + public static void handlePayload(InventoryInteractionPayload payload, IPayloadContext context) { + Player player = context.player(); + PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryName, identifier, slot) -> { + InventoryInteractionHelper.tryInventoryInteraction(payload.pos, player.level(), backpack, payload.face, player); + player.swing(InteractionHand.MAIN_HAND, true); + return true; + }); + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPacket.java deleted file mode 100644 index 719b5a7c..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPacket.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.network; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; -import net.p3pp3rf1y.sophisticatedcore.inventory.InventoryHandler; -import net.p3pp3rf1y.sophisticatedcore.network.PacketHelper; -import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeHandler; - -import java.util.UUID; - -public class RequestBackpackInventoryContentsPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "request_backpack_inventory_contents"); - private final UUID backpackUuid; - - public RequestBackpackInventoryContentsPacket(UUID backpackUuid) { - this.backpackUuid = backpackUuid; - } - - public RequestBackpackInventoryContentsPacket(FriendlyByteBuf buffer) { - this(buffer.readUUID()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); - } - - private void handlePacket(Player player) { - CompoundTag backpackContents = BackpackStorage.get().getOrCreateBackpackContents(backpackUuid); - - CompoundTag inventoryContents = new CompoundTag(); - Tag inventoryNbt = backpackContents.get(InventoryHandler.INVENTORY_TAG); - if (inventoryNbt != null) { - inventoryContents.put(InventoryHandler.INVENTORY_TAG, inventoryNbt); - } - Tag upgradeNbt = backpackContents.get(UpgradeHandler.UPGRADE_INVENTORY_TAG); - if (upgradeNbt != null) { - inventoryContents.put(UpgradeHandler.UPGRADE_INVENTORY_TAG, upgradeNbt); - } - PacketHelper.sendToPlayer(new BackpackContentsPacket(backpackUuid, inventoryContents), player); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeUUID(backpackUuid); - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPayload.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPayload.java new file mode 100644 index 00000000..174ce54a --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestBackpackInventoryContentsPayload.java @@ -0,0 +1,47 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.network; + +import io.netty.buffer.ByteBuf; +import net.minecraft.core.UUIDUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.server.level.ServerPlayer; +import net.neoforged.neoforge.network.PacketDistributor; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackStorage; +import net.p3pp3rf1y.sophisticatedcore.inventory.InventoryHandler; +import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeHandler; + +import java.util.UUID; + +public record RequestBackpackInventoryContentsPayload(UUID backpackUuid) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("request_backpack_inventory_contents")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + UUIDUtil.STREAM_CODEC, + RequestBackpackInventoryContentsPayload::backpackUuid, + RequestBackpackInventoryContentsPayload::new); + + @Override + public Type type() { + return TYPE; + } + + public static void handlePayload(RequestBackpackInventoryContentsPayload payload, IPayloadContext context) { + CompoundTag backpackContents = BackpackStorage.get().getOrCreateBackpackContents(payload.backpackUuid); + + CompoundTag inventoryContents = new CompoundTag(); + Tag inventoryNbt = backpackContents.get(InventoryHandler.INVENTORY_TAG); + if (inventoryNbt != null) { + inventoryContents.put(InventoryHandler.INVENTORY_TAG, inventoryNbt); + } + Tag upgradeNbt = backpackContents.get(UpgradeHandler.UPGRADE_INVENTORY_TAG); + if (upgradeNbt != null) { + inventoryContents.put(UpgradeHandler.UPGRADE_INVENTORY_TAG, upgradeNbt); + } + if (context.player() instanceof ServerPlayer serverPlayer) { + PacketDistributor.sendToPlayer(serverPlayer, new BackpackContentsPayload(payload.backpackUuid, inventoryContents)); + } + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPacket.java deleted file mode 100644 index 0ae506a4..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPacket.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.network; - -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.settings.BackpackMainSettingsCategory; -import net.p3pp3rf1y.sophisticatedcore.network.PacketHelper; -import net.p3pp3rf1y.sophisticatedcore.network.SyncPlayerSettingsPacket; -import net.p3pp3rf1y.sophisticatedcore.settings.SettingsManager; - -public class RequestPlayerSettingsPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "request_player_settings"); - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); - } - - private void handlePacket(Player player) { - String playerTagName = BackpackMainSettingsCategory.SOPHISTICATED_BACKPACK_SETTINGS_PLAYER_TAG; - PacketHelper.sendToPlayer(new SyncPlayerSettingsPacket(playerTagName, SettingsManager.getPlayerSettingsTag(player, playerTagName)), (ServerPlayer) player); - } - - @Override - public void write(FriendlyByteBuf buffer) { - //noop - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPayload.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPayload.java new file mode 100644 index 00000000..59ba5f99 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/RequestPlayerSettingsPayload.java @@ -0,0 +1,32 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.network; + +import io.netty.buffer.ByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; +import net.neoforged.neoforge.network.PacketDistributor; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.settings.BackpackMainSettingsCategory; +import net.p3pp3rf1y.sophisticatedcore.network.SyncPlayerSettingsPayload; +import net.p3pp3rf1y.sophisticatedcore.settings.SettingsManager; +import net.p3pp3rf1y.sophisticatedcore.util.StreamCodecHelper; + +public record RequestPlayerSettingsPayload() implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("request_player_settings")); + public static final StreamCodec STREAM_CODEC = StreamCodecHelper.singleton(RequestPlayerSettingsPayload::new); + + public static void handlePayload(@SuppressWarnings("unused") RequestPlayerSettingsPayload payload, IPayloadContext context) { + Player player = context.player(); + String playerTagName = BackpackMainSettingsCategory.SOPHISTICATED_BACKPACK_SETTINGS_PLAYER_TAG; + if (player instanceof ServerPlayer serverPlayer) { + PacketDistributor.sendToPlayer(serverPlayer, new SyncPlayerSettingsPayload(playerTagName, SettingsManager.getPlayerSettingsTag(player, playerTagName))); + } + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPacket.java deleted file mode 100644 index 0e727914..00000000 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPacket.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.p3pp3rf1y.sophisticatedbackpacks.network; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.neoforged.neoforge.network.handling.IPayloadContext; -import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; -import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackWrapper; -import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; -import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContainer; - -import javax.annotation.Nullable; - -public class SyncClientInfoPacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "sync_client_info"); - private final int slotIndex; - @Nullable - private final CompoundTag renderInfoNbt; - private final int columnsTaken; - - public SyncClientInfoPacket(int slotNumber, @Nullable CompoundTag renderInfoNbt, int columnsTaken) { - slotIndex = slotNumber; - this.renderInfoNbt = renderInfoNbt; - this.columnsTaken = columnsTaken; - } - - public SyncClientInfoPacket(FriendlyByteBuf buffer) { - this(buffer.readInt(), buffer.readNbt(), buffer.readInt()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); - } - - private void handlePacket(Player player) { - if (renderInfoNbt == null || !(player.containerMenu instanceof BackpackContainer)) { - return; - } - ItemStack backpack = player.getInventory().items.get(slotIndex); - IBackpackWrapper backpackWrapper = BackpackWrapper.fromData(backpack); - backpackWrapper.getRenderInfo().deserializeFrom(renderInfoNbt); - backpackWrapper.setColumnsTaken(columnsTaken, false); - } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeInt(slotIndex); - buffer.writeNbt(renderInfoNbt); - buffer.writeInt(columnsTaken); - } - - @Override - public ResourceLocation id() { - return ID; - } -} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPayload.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPayload.java new file mode 100644 index 00000000..74c54912 --- /dev/null +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/SyncClientInfoPayload.java @@ -0,0 +1,46 @@ +package net.p3pp3rf1y.sophisticatedbackpacks.network; + +import io.netty.buffer.ByteBuf; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; +import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.BackpackWrapper; +import net.p3pp3rf1y.sophisticatedbackpacks.backpack.wrapper.IBackpackWrapper; +import net.p3pp3rf1y.sophisticatedbackpacks.common.gui.BackpackContainer; +import net.p3pp3rf1y.sophisticatedcore.util.StreamCodecHelper; + +import javax.annotation.Nullable; + +public record SyncClientInfoPayload(int slotIndex, @Nullable CompoundTag renderInfoNbt, + int columnsTaken) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("sync_client_info")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + SyncClientInfoPayload::slotIndex, + StreamCodecHelper.ofNullable(ByteBufCodecs.COMPOUND_TAG), + SyncClientInfoPayload::renderInfoNbt, + ByteBufCodecs.INT, + SyncClientInfoPayload::columnsTaken, + SyncClientInfoPayload::new); + + @Override + public Type type() { + return TYPE; + } + + public static void handlePayload(SyncClientInfoPayload payload, IPayloadContext context) { + Player player = context.player(); + if (payload.renderInfoNbt == null || !(player.containerMenu instanceof BackpackContainer)) { + return; + } + ItemStack backpack = player.getInventory().items.get(payload.slotIndex); + IBackpackWrapper backpackWrapper = BackpackWrapper.fromStack(backpack); + backpackWrapper.getRenderInfo().deserializeFrom(player.level().registryAccess(), payload.renderInfoNbt); + backpackWrapper.setColumnsTaken(payload.columnsTaken, false); + } +} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/UpgradeTogglePacket.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/UpgradeTogglePayload.java similarity index 55% rename from src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/UpgradeTogglePacket.java rename to src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/UpgradeTogglePayload.java index 754b8fdb..209a5a6f 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/UpgradeTogglePacket.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/network/UpgradeTogglePayload.java @@ -1,9 +1,10 @@ package net.p3pp3rf1y.sophisticatedbackpacks.network; -import net.minecraft.network.FriendlyByteBuf; +import io.netty.buffer.ByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.neoforged.neoforge.network.handling.IPayloadContext; import net.p3pp3rf1y.sophisticatedbackpacks.SophisticatedBackpacks; @@ -13,27 +14,24 @@ import java.util.Map; -public class UpgradeTogglePacket implements CustomPacketPayload { - public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(SophisticatedBackpacks.MOD_ID, "upgrade_toggle"); - private final int upgradeSlot; +public record UpgradeTogglePayload(int upgradeSlot) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(SophisticatedBackpacks.getRL("upgrade_toggle")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + UpgradeTogglePayload::upgradeSlot, + UpgradeTogglePayload::new); - public UpgradeTogglePacket(int upgradeSlot) { - this.upgradeSlot = upgradeSlot; - } - - public UpgradeTogglePacket(FriendlyByteBuf buffer) { - this(buffer.readInt()); - } - - public void handle(IPayloadContext context) { - context.workHandler().execute(() -> context.player().ifPresent(this::handlePacket)); + @Override + public Type type() { + return TYPE; } - private void handlePacket(Player player) { + public static void handlePayload(UpgradeTogglePayload payload, IPayloadContext context) { + Player player = context.player(); PlayerInventoryProvider.get().runOnBackpacks(player, (backpack, inventoryName, identifier, slot) -> { - Map slotWrappers = BackpackWrapper.fromData(backpack).getUpgradeHandler().getSlotWrappers(); - if (slotWrappers.containsKey(upgradeSlot)) { - IUpgradeWrapper upgradeWrapper = slotWrappers.get(upgradeSlot); + Map slotWrappers = BackpackWrapper.fromStack(backpack).getUpgradeHandler().getSlotWrappers(); + if (slotWrappers.containsKey(payload.upgradeSlot)) { + IUpgradeWrapper upgradeWrapper = slotWrappers.get(payload.upgradeSlot); if (upgradeWrapper.canBeDisabled()) { upgradeWrapper.setEnabled(!upgradeWrapper.isEnabled()); String translKey = upgradeWrapper.isEnabled() ? "gui.sophisticatedbackpacks.status.upgrade_switched_on" : "gui.sophisticatedbackpacks.status.upgrade_switched_off"; @@ -43,14 +41,4 @@ private void handlePacket(Player player) { return true; }); } - - @Override - public void write(FriendlyByteBuf buffer) { - buffer.writeInt(upgradeSlot); - } - - @Override - public ResourceLocation id() { - return ID; - } } \ No newline at end of file diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/Matchers.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/Matchers.java index 9244e8d1..bd2c920c 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/Matchers.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/Matchers.java @@ -37,20 +37,20 @@ private Matchers() { @Override protected Optional> getPredicateFromObject(JsonObject jsonObject) { String tagName = GsonHelper.getAsString(jsonObject, "tag"); - TagKey tag = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(tagName)); + TagKey tag = TagKey.create(Registries.ITEM, ResourceLocation.parse(tagName)); return Optional.of(new ItemTagMatcher(tag)); } }); - addItemMatcherFactory(new ItemMatcherFactory("emptynbt") { + addItemMatcherFactory(new ItemMatcherFactory("nocomponents") { @Override protected Optional> getPredicateFromObject(JsonObject jsonObject) { - ResourceLocation itemName = ResourceLocation.fromNamespaceAndPath(GsonHelper.getAsString(jsonObject, "item")); + ResourceLocation itemName = ResourceLocation.parse(GsonHelper.getAsString(jsonObject, "item")); if (!BuiltInRegistries.ITEM.containsKey(itemName)) { SophisticatedBackpacks.LOGGER.debug("{} isn't loaded in item registry, skipping ...", itemName); } Item item = BuiltInRegistries.ITEM.get(itemName); - return Optional.of(st -> st.getItem() == item && (st.getTag() == null || st.getTag().isEmpty())); + return Optional.of(st -> st.getItem() == item && (st.getComponents().isEmpty())); } }); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/SwordRegistry.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/SwordRegistry.java index 0a503bb9..993fc284 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/SwordRegistry.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/SwordRegistry.java @@ -94,7 +94,7 @@ private void parseSwordMatcher(@Nullable String modId, JsonElement jsonElement) } private void parseSword(String swordName) { - BuiltInRegistries.ITEM.getOptional(ResourceLocation.fromNamespaceAndPath(swordName)) + BuiltInRegistries.ITEM.getOptional(ResourceLocation.parse(swordName)) .ifPresentOrElse( SWORD_ITEMS::add, () -> { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/ToolRegistry.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/ToolRegistry.java index d569180f..c9e52d15 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/ToolRegistry.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/registry/tool/ToolRegistry.java @@ -124,7 +124,7 @@ private void parseObjectPredicateEntry(Tuple, Set } private void parseObjectEntry(Tuple, Set>> tools, String objectName) { - ResourceLocation registryName = ResourceLocation.fromNamespaceAndPath(objectName); + ResourceLocation registryName = ResourceLocation.parse(objectName); Optional objectOptional = getObjectFromRegistry.apply(registryName); if (objectOptional.isPresent()) { toolMapping.addObjectTools(tools, objectOptional.get()); @@ -181,7 +181,7 @@ protected static Tuple, Set>> getItemsAndItemPred Set> itemPredicates = new HashSet<>(); for (JsonElement jsonElement : toolArray) { if (jsonElement.isJsonPrimitive()) { - ResourceLocation itemName = ResourceLocation.fromNamespaceAndPath(jsonElement.getAsString()); + ResourceLocation itemName = ResourceLocation.parse(jsonElement.getAsString()); if (!BuiltInRegistries.ITEM.containsKey(itemName)) { SophisticatedBackpacks.LOGGER.debug("{} isn't loaded in item registry, skipping ...", itemName); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/settings/BackToBackpackTab.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/settings/BackToBackpackTab.java index 5d5c5f19..09242f85 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/settings/BackToBackpackTab.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/settings/BackToBackpackTab.java @@ -3,7 +3,7 @@ import net.minecraft.network.chat.Component; import net.neoforged.neoforge.network.PacketDistributor; import net.p3pp3rf1y.sophisticatedbackpacks.client.gui.SBPTranslationHelper; -import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackOpenPacket; +import net.p3pp3rf1y.sophisticatedbackpacks.network.BackpackOpenPayload; import net.p3pp3rf1y.sophisticatedcore.client.gui.Tab; import net.p3pp3rf1y.sophisticatedcore.client.gui.controls.ImageButton; import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.*; @@ -18,6 +18,6 @@ protected BackToBackpackTab(Position position) { @Override protected void onTabIconClicked(int button) { - PacketDistributor.SERVER.noArg().send(new BackpackOpenPacket()); + PacketDistributor.sendToServer(new BackpackOpenPayload()); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeTab.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeTab.java index 76244c25..8daaa7b8 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeTab.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeTab.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; import net.minecraft.world.inventory.Slot; @@ -81,7 +82,7 @@ private void onNameChanged(String name) { return; } ItemStack firstItem = getContainer().getSlots().get(0).getItem(); - if (!firstItem.hasCustomHoverName() && name.equals(firstItem.getHoverName().getString())) { + if (!firstItem.has(DataComponents.CUSTOM_NAME) && name.equals(firstItem.getHoverName().getString())) { name = ""; } getContainer().setItemName(name); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeWrapper.java index 382d91b1..05034a7b 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/anvil/AnvilUpgradeWrapper.java @@ -1,30 +1,36 @@ package net.p3pp3rf1y.sophisticatedbackpacks.upgrades.anvil; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.item.ItemStack; -import net.neoforged.neoforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.ComponentItemHandler; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModDataComponents; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeWrapperBase; -import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; import java.util.function.Consumer; public class AnvilUpgradeWrapper extends UpgradeWrapperBase { - private final ItemStackHandler inventory; + private final ComponentItemHandler inventory; + protected AnvilUpgradeWrapper(IStorageWrapper storageWrapper, ItemStack upgrade, Consumer upgradeSaveHandler) { super(storageWrapper, upgrade, upgradeSaveHandler); - inventory = new ItemStackHandler(2) { + inventory = new ComponentItemHandler(upgrade, DataComponents.CONTAINER, 2) { @Override - protected void onContentsChanged(int slot) { - super.onContentsChanged(slot); - upgrade.addTagElement("craftingInventory", serializeNBT()); + protected void onContentsChanged(int slot, ItemStack oldStack, ItemStack newStack) { + super.onContentsChanged(slot, oldStack, newStack); save(); } + + @Override + public int getSlotLimit(int slot) { + return 64; + } }; - NBTHelper.getCompound(upgrade, "craftingInventory").ifPresent(inventory::deserializeNBT); } - public ItemStackHandler getInventory() { + public ComponentItemHandler getInventory() { return inventory; } @@ -34,20 +40,20 @@ public boolean canBeDisabled() { } public boolean shouldShiftClickIntoStorage() { - return NBTHelper.getBoolean(upgrade, "shiftClickIntoStorage").orElse(true); + return upgrade.getOrDefault(ModCoreDataComponents.SHIFT_CLICK_INTO_STORAGE, true); } public void setShiftClickIntoStorage(boolean shiftClickIntoStorage) { - NBTHelper.setBoolean(upgrade, "shiftClickIntoStorage", shiftClickIntoStorage); + upgrade.set(ModCoreDataComponents.SHIFT_CLICK_INTO_STORAGE, shiftClickIntoStorage); save(); } public String getItemName() { - return NBTHelper.getString(upgrade, "itemName").orElse(""); + return upgrade.getOrDefault(ModDataComponents.ITEM_NAME, ""); } public void setItemName(String itemName) { - NBTHelper.putString(upgrade.getOrCreateTag(), "itemName", itemName); + upgrade.set(ModDataComponents.ITEM_NAME, itemName); save(); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositFilterLogic.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositFilterLogic.java index d822cb2e..607e5daa 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositFilterLogic.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositFilterLogic.java @@ -1,11 +1,14 @@ package net.p3pp3rf1y.sophisticatedbackpacks.upgrades.deposit; +import net.minecraft.core.component.DataComponentType; import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModDataComponents; import net.p3pp3rf1y.sophisticatedcore.inventory.ItemStackKey; +import net.p3pp3rf1y.sophisticatedcore.upgrades.FilterAttributes; import net.p3pp3rf1y.sophisticatedcore.upgrades.FilterLogic; import net.p3pp3rf1y.sophisticatedcore.util.InventoryHelper; -import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; import java.util.HashSet; import java.util.Set; @@ -14,8 +17,8 @@ public class DepositFilterLogic extends FilterLogic { private Set inventoryFilterStacks = new HashSet<>(); - public DepositFilterLogic(ItemStack upgrade, Consumer saveHandler, int filterSlotCount) { - super(upgrade, saveHandler, filterSlotCount); + public DepositFilterLogic(ItemStack upgrade, Consumer saveHandler, int filterSlotCount, DeferredHolder, DataComponentType> contentsComponent) { + super(upgrade, saveHandler, filterSlotCount, contentsComponent); } public DepositFilterType getDepositFilterType() { @@ -61,11 +64,11 @@ public boolean matchesFilter(ItemStack stack) { } private void setFilterByInventory(boolean filterByInventory) { - NBTHelper.setBoolean(upgrade, "filterByInventory", filterByInventory); + upgrade.set(ModDataComponents.FILTER_BY_INVENTORY, filterByInventory); save(); } private boolean shouldFilterByInventory() { - return NBTHelper.getBoolean(upgrade, "filterByInventory").orElse(false); + return upgrade.getOrDefault(ModDataComponents.FILTER_BY_INVENTORY, false); } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositUpgradeWrapper.java index fa75251c..a485a034 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/deposit/DepositUpgradeWrapper.java @@ -6,6 +6,7 @@ import net.neoforged.neoforge.items.IItemHandler; import net.p3pp3rf1y.sophisticatedbackpacks.api.IItemHandlerInteractionUpgrade; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.inventory.FilteredItemHandler; import net.p3pp3rf1y.sophisticatedcore.upgrades.IFilteredUpgrade; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeWrapperBase; @@ -21,7 +22,7 @@ public class DepositUpgradeWrapper extends UpgradeWrapperBase upgradeSaveHandler) { super(backpackWrapper, upgrade, upgradeSaveHandler); - filterLogic = new DepositFilterLogic(upgrade, upgradeSaveHandler, upgradeItem.getFilterSlotCount()); + filterLogic = new DepositFilterLogic(upgrade, upgradeSaveHandler, upgradeItem.getFilterSlotCount(), ModCoreDataComponents.FILTER_ATTRIBUTES); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionFluidHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionFluidHandler.java index 0bf45019..ca8a55a7 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionFluidHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionFluidHandler.java @@ -115,7 +115,7 @@ public int fill(FluidStack resource, FluidAction action, boolean ignoreInOutLimi if (filled == resource.getAmount()) { return resource.getAmount(); } - toFill = new FluidStack(toFill, resource.getAmount() - filled); + toFill = new FluidStack(toFill.getFluid(), resource.getAmount() - filled); } return filled; @@ -137,7 +137,7 @@ public FluidStack drain(TagKey resourceTag, int maxDrain, FluidAction act return drainedStack; } if (!drainedStack.isEmpty()) { - stackToDrain = new FluidStack(drainedStack, maxDrain - drainedStack.getAmount()); + stackToDrain = new FluidStack(drainedStack.getFluid(), maxDrain - drainedStack.getAmount()); } } else { int amountDrained = fluidHandler.drain(stackToDrain, action, ignoreInOutLimit).getAmount(); @@ -161,10 +161,10 @@ public FluidStack drain(FluidStack resource, FluidAction action, boolean ignoreI if (drained == resource.getAmount()) { return resource; } - toDrain = new FluidStack(toDrain, resource.getAmount() - drained); + toDrain = new FluidStack(toDrain.getFluid(), resource.getAmount() - drained); } - return drained == 0 ? FluidStack.EMPTY : new FluidStack(resource, drained); + return drained == 0 ? FluidStack.EMPTY : new FluidStack(resource.getFluid(), drained); } @Nonnull diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionInventoryHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionInventoryHandler.java index 3fdfdb95..edc20b84 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionInventoryHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionInventoryHandler.java @@ -151,7 +151,7 @@ private int getSlotFromIndex(int slot, int index) { private ITrackedContentsItemHandler getHandlerFromIndex(int index) { if (index < 0 || index >= handlers.size()) { - return handlers.get(0); + return handlers.getFirst(); } return handlers.get(index); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeItem.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeItem.java index cfe70d5b..3e15435c 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeItem.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeItem.java @@ -31,12 +31,12 @@ public UpgradeType getType() { @Override public UpgradeSlotChangeResult canAddUpgradeTo(IStorageWrapper storageWrapper, ItemStack upgradeStack, boolean firstLevelStorage, boolean isClientSide) { UpgradeSlotChangeResult result = super.canAddUpgradeTo(storageWrapper, upgradeStack, firstLevelStorage, isClientSide); - if (!result.isSuccessful()) { + if (!result.successful()) { return result; } if (!firstLevelStorage) { - return new UpgradeSlotChangeResult.Fail(SBPTranslationHelper.INSTANCE.translError("add.inception_sub_backpack"), Collections.emptySet(), Collections.emptySet(), Collections.emptySet()); + return UpgradeSlotChangeResult.fail(SBPTranslationHelper.INSTANCE.translError("add.inception_sub_backpack"), Collections.emptySet(), Collections.emptySet(), Collections.emptySet()); } Set errorUpgradeSlots = new HashSet<>(); @@ -47,10 +47,10 @@ public UpgradeSlotChangeResult canAddUpgradeTo(IStorageWrapper storageWrapper, I }); if (!errorUpgradeSlots.isEmpty()) { - return new UpgradeSlotChangeResult.Fail(SBPTranslationHelper.INSTANCE.translError("add.inception_exists"), errorUpgradeSlots, Collections.emptySet(), Collections.emptySet()); + return UpgradeSlotChangeResult.fail(SBPTranslationHelper.INSTANCE.translError("add.inception_exists"), errorUpgradeSlots, Collections.emptySet(), Collections.emptySet()); } - return new UpgradeSlotChangeResult.Success(); + return UpgradeSlotChangeResult.success(); } @Override @@ -62,15 +62,15 @@ public List getUpgradeConflicts() { public UpgradeSlotChangeResult canRemoveUpgradeFrom(IStorageWrapper storageWrapper, boolean isClientSide) { Set slots = InventoryHelper.getItemSlots(storageWrapper.getInventoryHandler(), stack -> stack.getItem() instanceof BackpackItem); if (!slots.isEmpty()) { - return new UpgradeSlotChangeResult.Fail(SBPTranslationHelper.INSTANCE.translError("remove.inception_sub_backpack"), Collections.emptySet(), slots, Collections.emptySet()); + return UpgradeSlotChangeResult.fail(SBPTranslationHelper.INSTANCE.translError("remove.inception_sub_backpack"), Collections.emptySet(), slots, Collections.emptySet()); } - return new UpgradeSlotChangeResult.Success(); + return UpgradeSlotChangeResult.success(); } @Override public UpgradeSlotChangeResult canSwapUpgradeFor(ItemStack upgradeStackToPut, int upgradeSlot, IStorageWrapper storageWrapper, boolean isClientSide) { if (upgradeStackToPut.getItem() == this) { - return new UpgradeSlotChangeResult.Success(); + return UpgradeSlotChangeResult.success(); } return canRemoveUpgradeFrom(storageWrapper, isClientSide); diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeWrapper.java index 3ec6eab7..6c91c75b 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InceptionUpgradeWrapper.java @@ -6,13 +6,13 @@ import net.p3pp3rf1y.sophisticatedbackpacks.api.IEnergyStorageUpgradeWrapper; import net.p3pp3rf1y.sophisticatedbackpacks.api.IFluidHandlerWrapperUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.api.IInventoryWrapperUpgrade; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModDataComponents; import net.p3pp3rf1y.sophisticatedcore.api.IStorageFluidHandler; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; import net.p3pp3rf1y.sophisticatedcore.inventory.ITrackedContentsItemHandler; import net.p3pp3rf1y.sophisticatedcore.upgrades.IUpgradeAccessModifier; import net.p3pp3rf1y.sophisticatedcore.upgrades.IUpgradeWrapperAccessor; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeWrapperBase; -import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; import javax.annotation.Nullable; import java.util.function.Consumer; @@ -31,11 +31,11 @@ public boolean hideSettingsTab() { } public InventoryOrder getInventoryOrder() { - return NBTHelper.getEnumConstant(upgrade, "inventoryOrder", InventoryOrder::fromName).orElse(InventoryOrder.MAIN_FIRST); + return upgrade.getOrDefault(ModDataComponents.INVENTORY_ORDER, InventoryOrder.MAIN_FIRST); } public void setInventoryOrder(InventoryOrder inventoryOrder) { - NBTHelper.setEnumConstant(upgrade, "inventoryOrder", inventoryOrder); + upgrade.set(ModDataComponents.INVENTORY_ORDER, inventoryOrder); save(); storageWrapper.refreshInventoryForUpgradeProcessing(); } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InventoryOrder.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InventoryOrder.java index bbc86e8b..a6e24359 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InventoryOrder.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/InventoryOrder.java @@ -1,7 +1,11 @@ package net.p3pp3rf1y.sophisticatedbackpacks.upgrades.inception; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.StringRepresentable; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import java.util.Map; @@ -9,6 +13,10 @@ public enum InventoryOrder implements StringRepresentable { MAIN_FIRST("main_first"), INCEPTED_FIRST("incepted_first"); + + public static final Codec CODEC = StringRepresentable.fromEnum(InventoryOrder::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(InventoryOrder.class); + private final String name; InventoryOrder(String name) {this.name = name;} diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/SubBackpacksHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/SubBackpacksHandler.java index a0d3840c..6366c7c3 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/SubBackpacksHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/inception/SubBackpacksHandler.java @@ -42,7 +42,7 @@ private void onContentsChanged(int slot) { if (backpackWasInTheSlot != backpackIsInTheSlot) { notifyAndRefreshSubbackpacks(); } else { - if (BackpackWrapper.fromData(stackInSlot) != subBackpacks.get(slot)) { + if (BackpackWrapper.fromStack(stackInSlot) != subBackpacks.get(slot)) { notifyAndRefreshSubbackpacks(); } } @@ -74,7 +74,7 @@ private void refreshSubBackpacks() { for (int slot = 0; slot < inventoryHandler.getSlots(); slot++) { ItemStack slotStack = inventoryHandler.getStackInSlot(slot); if (slotStack.getItem() instanceof BackpackItem) { - subBackpacks.put(slot, BackpackWrapper.fromData(slotStack)); + subBackpacks.put(slot, BackpackWrapper.fromStack(slotStack)); } } } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeContainer.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeContainer.java index 2c1a21e7..8760c429 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeContainer.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeContainer.java @@ -8,7 +8,6 @@ import net.p3pp3rf1y.sophisticatedcore.upgrades.FilterLogicContainer; import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; -import java.util.Map; import java.util.Optional; public class RefillUpgradeContainer extends UpgradeContainerBase { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeWrapper.java index d6d42caa..a20eaa57 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/refill/RefillUpgradeWrapper.java @@ -1,10 +1,13 @@ package net.p3pp3rf1y.sophisticatedbackpacks.upgrades.refill; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; -import net.minecraft.nbt.StringTag; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.StringRepresentable; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.LivingEntity; @@ -12,24 +15,26 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.neoforged.neoforge.items.IItemHandler; -import net.neoforged.neoforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import net.p3pp3rf1y.sophisticatedbackpacks.api.IBlockPickResponseUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.client.gui.SBPTranslationHelper; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModDataComponents; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.inventory.ITrackedContentsItemHandler; import net.p3pp3rf1y.sophisticatedcore.upgrades.FilterLogic; import net.p3pp3rf1y.sophisticatedcore.upgrades.IFilteredUpgrade; import net.p3pp3rf1y.sophisticatedcore.upgrades.ITickableUpgrade; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeWrapperBase; import net.p3pp3rf1y.sophisticatedcore.util.CapabilityHelper; +import net.p3pp3rf1y.sophisticatedcore.util.CodecHelper; import net.p3pp3rf1y.sophisticatedcore.util.InventoryHelper; -import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; +import net.p3pp3rf1y.sophisticatedcore.util.StreamCodecHelper; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; -import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -40,14 +45,17 @@ public class RefillUpgradeWrapper extends UpgradeWrapperBase> TARGET_SLOTS_CODEC = Codec.unboundedMap(CodecHelper.STRING_ENCODED_INT, TargetSlot.CODEC); + public static final StreamCodec> TARGET_SLOTS_STREAM_CODEC = StreamCodecHelper.ofMap(ByteBufCodecs.INT, TargetSlot.STREAM_CODEC, HashMap::new); + private final Map targetSlots; private final FilterLogic filterLogic; public RefillUpgradeWrapper(IStorageWrapper backpackWrapper, ItemStack upgrade, Consumer upgradeSaveHandler) { super(backpackWrapper, upgrade, upgradeSaveHandler); - filterLogic = new FilterLogic(upgrade, upgradeSaveHandler, upgradeItem.getFilterSlotCount()); - targetSlots = NBTHelper.getMap(upgrade.getOrCreateTag(), "targetSlots", Integer::valueOf, (k, tag) -> Optional.of(TargetSlot.fromName(tag.getAsString()))).orElseGet(HashMap::new); + filterLogic = new FilterLogic(upgrade, upgradeSaveHandler, upgradeItem.getFilterSlotCount(), ModCoreDataComponents.FILTER_ATTRIBUTES); + targetSlots = new HashMap<>(upgrade.getOrDefault(ModDataComponents.TARGET_SLOTS, new HashMap<>())); if (upgradeItem.allowsTargetSlotSelection()) { FilterLogic.ObservableFilterItemStackHandler filterHandler = filterLogic.getFilterHandler(); filterHandler.setOnSlotChange(s -> onFilterChange(filterHandler, s)); @@ -76,7 +84,7 @@ public void setTargetSlot(int slot, TargetSlot targetSlot) { } private void saveTargetSlots() { - NBTHelper.putMap(upgrade.getOrCreateTag(), "targetSlots", targetSlots, String::valueOf, t -> StringTag.valueOf(t.getSerializedName())); + upgrade.set(ModDataComponents.TARGET_SLOTS, ImmutableMap.copyOf(targetSlots)); save(); } @@ -104,7 +112,7 @@ private void tryRefillFilter(@Nonnull LivingEntity entity, IItemHandler playerIn return; } int missingCount = targetSlot.missingCountGetter.getMissingCount(player, playerInvHandler, filter); - if (ItemHandlerHelper.canItemStacksStack(player.containerMenu.getCarried(), filter)) { + if (ItemStack.isSameItemSameComponents(player.containerMenu.getCarried(), filter)) { missingCount -= Math.min(missingCount, player.containerMenu.getCarried().getCount()); } if (missingCount == 0) { @@ -140,7 +148,7 @@ public boolean pickBlock(Player player, ItemStack filter) { ITrackedContentsItemHandler inventoryHandler = storageWrapper.getInventoryForUpgradeProcessing(); InventoryHelper.iterate(inventoryHandler, (slot, stack) -> { - if (ItemHandlerHelper.canItemStacksStack(stack, filter)) { + if (ItemStack.isSameItemSameComponents(stack, filter)) { hasItemInBackpack.set(true); stashSlot.set(slot); } @@ -180,7 +188,7 @@ private boolean canMoveMainHandToInventory(Player player) { ItemStack slotStack = player.getInventory().getItem(slot); if (slotStack.isEmpty()) { return true; - } else if (ItemHandlerHelper.canItemStacksStack(slotStack, player.getMainHandItem())) { + } else if (ItemStack.isSameItemSameComponents(slotStack, player.getMainHandItem())) { countToAdd -= (slotStack.getMaxStackSize() - slotStack.getCount()); if (countToAdd <= 0) { return true; @@ -235,6 +243,9 @@ public enum TargetSlot implements StringRepresentable { private final MissingCountGetter missingCountGetter; private final Filler filler; + public static final Codec CODEC = StringRepresentable.fromEnum(TargetSlot::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(TargetSlot.class); + TargetSlot(String name, Component acronym, Component description, MissingCountGetter missingCountGetter, Filler filler) { this.name = name; this.acronym = acronym; @@ -295,7 +306,7 @@ private interface Filler { private static ItemStack refillAnywhereInInventory(IItemHandler playerInvHandler, ItemStack extracted) { AtomicReference remainingStack = new AtomicReference<>(extracted); InventoryHelper.iterate(playerInvHandler, (slot, stack) -> { - if (ItemHandlerHelper.canItemStacksStack(stack, remainingStack.get())) { + if (ItemStack.isSameItemSameComponents(stack, remainingStack.get())) { remainingStack.set(playerInvHandler.insertItem(slot, remainingStack.get(), false)); } }, () -> remainingStack.get().isEmpty()); @@ -315,7 +326,7 @@ private static ItemStack refillAnywhereInInventory(IItemHandler playerInvHandler } private static int getMissingCount(ItemStack stack, ItemStack filter) { - if (ItemHandlerHelper.canItemStacksStack(stack, filter)) { + if (ItemStack.isSameItemSameComponents(stack, filter)) { return filter.getMaxStackSize() - stack.getCount(); } return filter.getMaxStackSize(); @@ -327,7 +338,7 @@ private static ItemStack refillSlot(Supplier getSlotContents, ItemSta setSlotContents.accept(stackToAdd); return ItemStack.EMPTY; } - if (ItemHandlerHelper.canItemStacksStack(contents, stackToAdd)) { + if (ItemStack.isSameItemSameComponents(contents, stackToAdd)) { contents.grow(stackToAdd.getCount()); return ItemStack.EMPTY; } diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/restock/RestockUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/restock/RestockUpgradeWrapper.java index aee9dbfb..55b6741b 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/restock/RestockUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/restock/RestockUpgradeWrapper.java @@ -6,6 +6,7 @@ import net.neoforged.neoforge.items.IItemHandler; import net.p3pp3rf1y.sophisticatedbackpacks.api.IItemHandlerInteractionUpgrade; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.inventory.FilteredItemHandler; import net.p3pp3rf1y.sophisticatedcore.settings.memory.MemorySettingsCategory; import net.p3pp3rf1y.sophisticatedcore.upgrades.ContentsFilterLogic; @@ -23,7 +24,9 @@ public class RestockUpgradeWrapper extends UpgradeWrapperBase upgradeSaveHandler) { super(backpackWrapper, upgrade, upgradeSaveHandler); - filterLogic = new ContentsFilterLogic(upgrade, upgradeSaveHandler, upgradeItem.getFilterSlotCount(), backpackWrapper::getInventoryHandler, backpackWrapper.getSettingsHandler().getTypeCategory(MemorySettingsCategory.class)); + filterLogic = new ContentsFilterLogic(upgrade, upgradeSaveHandler, upgradeItem.getFilterSlotCount(), + backpackWrapper::getInventoryHandler, backpackWrapper.getSettingsHandler().getTypeCategory(MemorySettingsCategory.class), + ModCoreDataComponents.FILTER_ATTRIBUTES); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapMode.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapMode.java index 1bf485d8..9685fff2 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapMode.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapMode.java @@ -1,7 +1,11 @@ package net.p3pp3rf1y.sophisticatedbackpacks.upgrades.toolswapper; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.StringRepresentable; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import java.util.Map; @@ -10,6 +14,9 @@ public enum ToolSwapMode implements StringRepresentable { ONLY_TOOLS("onlyTools"), NO_SWAP("noSwap"); + public static final Codec CODEC = StringRepresentable.fromEnum(ToolSwapMode::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(ToolSwapMode.class); + private final String name; ToolSwapMode(String name) { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapperUpgradeWrapper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapperUpgradeWrapper.java index c43038c1..742fd0d8 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapperUpgradeWrapper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/upgrades/toolswapper/ToolSwapperUpgradeWrapper.java @@ -3,7 +3,6 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -import com.google.common.collect.Multimap; import com.google.common.util.concurrent.AtomicDouble; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -12,9 +11,7 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeInstance; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -29,23 +26,24 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.neoforged.neoforge.common.IShearable; +import net.neoforged.neoforge.common.ItemAbilities; +import net.neoforged.neoforge.common.ItemAbility; import net.neoforged.neoforge.common.Tags; -import net.neoforged.neoforge.common.ToolAction; -import net.neoforged.neoforge.common.ToolActions; import net.p3pp3rf1y.sophisticatedbackpacks.Config; import net.p3pp3rf1y.sophisticatedbackpacks.api.IAttackEntityResponseUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.api.IBlockClickResponseUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.api.IBlockToolSwapUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.api.IEntityToolSwapUpgrade; import net.p3pp3rf1y.sophisticatedbackpacks.backpack.BackpackItem; +import net.p3pp3rf1y.sophisticatedbackpacks.init.ModDataComponents; import net.p3pp3rf1y.sophisticatedbackpacks.registry.tool.SwordRegistry; import net.p3pp3rf1y.sophisticatedbackpacks.registry.tool.ToolRegistry; import net.p3pp3rf1y.sophisticatedcore.api.IStorageWrapper; +import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents; import net.p3pp3rf1y.sophisticatedcore.inventory.IItemHandlerSimpleInserter; import net.p3pp3rf1y.sophisticatedcore.upgrades.FilterLogic; import net.p3pp3rf1y.sophisticatedcore.upgrades.UpgradeWrapperBase; import net.p3pp3rf1y.sophisticatedcore.util.InventoryHelper; -import net.p3pp3rf1y.sophisticatedcore.util.NBTHelper; import javax.annotation.Nullable; import java.util.*; @@ -55,7 +53,7 @@ import java.util.function.Consumer; import java.util.function.Predicate; -import static net.neoforged.neoforge.common.ToolActions.*; +import static net.neoforged.neoforge.common.ItemAbilities.*; public class ToolSwapperUpgradeWrapper extends UpgradeWrapperBase implements IBlockClickResponseUpgrade, IAttackEntityResponseUpgrade, IBlockToolSwapUpgrade, IEntityToolSwapUpgrade { @@ -78,7 +76,7 @@ public Boolean load(ItemStack key) { protected ToolSwapperUpgradeWrapper(IStorageWrapper backpackWrapper, ItemStack upgrade, Consumer upgradeSaveHandler) { super(backpackWrapper, upgrade, upgradeSaveHandler); - filterLogic = new FilterLogic(upgrade, upgradeSaveHandler, Config.SERVER.toolSwapperUpgrade.filterSlots.get()); + filterLogic = new FilterLogic(upgrade, upgradeSaveHandler, Config.SERVER.toolSwapperUpgrade.filterSlots.get(), ModCoreDataComponents.FILTER_ATTRIBUTES); } @Override @@ -174,13 +172,13 @@ private boolean isNotTool(ItemStack stack) { } private static boolean canPerformToolAction(ItemStack stack) { - return canPerformAnyAction(stack, ToolActions.DEFAULT_AXE_ACTIONS) || canPerformAnyAction(stack, ToolActions.DEFAULT_HOE_ACTIONS) - || canPerformAnyAction(stack, ToolActions.DEFAULT_PICKAXE_ACTIONS) || canPerformAnyAction(stack, ToolActions.DEFAULT_SHOVEL_ACTIONS) - || canPerformAnyAction(stack, ToolActions.DEFAULT_SHEARS_ACTIONS); + return canPerformAnyAction(stack, ItemAbilities.DEFAULT_AXE_ACTIONS) || canPerformAnyAction(stack, ItemAbilities.DEFAULT_HOE_ACTIONS) + || canPerformAnyAction(stack, ItemAbilities.DEFAULT_PICKAXE_ACTIONS) || canPerformAnyAction(stack, ItemAbilities.DEFAULT_SHOVEL_ACTIONS) + || canPerformAnyAction(stack, ItemAbilities.DEFAULT_SHEARS_ACTIONS); } - private static boolean canPerformAnyAction(ItemStack stack, Set toolActions) { - for (ToolAction toolAction : toolActions) { + private static boolean canPerformAnyAction(ItemStack stack, Set toolActions) { + for (ItemAbility toolAction : toolActions) { if (stack.canPerformAction(toolAction)) { return true; } @@ -194,8 +192,8 @@ private boolean isSword(ItemStack stack, Player player) { } AttributeInstance attackDamage = player.getAttribute(Attributes.ATTACK_DAMAGE); - if (!stack.isEmpty() && stack.canPerformAction(ToolActions.SWORD_SWEEP)) { - return attackDamage != null && attackDamage.getModifier(Item.BASE_ATTACK_DAMAGE_UUID) != null; + if (!stack.isEmpty() && stack.canPerformAction(ItemAbilities.SWORD_SWEEP)) { + return attackDamage != null && attackDamage.getModifier(Item.BASE_ATTACK_DAMAGE_ID) != null; } return false; } @@ -226,21 +224,21 @@ private boolean tryToSwapInWeapon(Player player, ItemStack mainHandItem) { private void updateBestWeapons(AtomicReference bestAxe, AtomicDouble bestAxeDamage, AtomicReference bestSword, AtomicDouble bestSwordDamage, ItemStack stack) { AttributeInstance attribute = new AttributeInstance(Attributes.ATTACK_DAMAGE, a -> { }); - Multimap attributeModifiers = stack.getAttributeModifiers(EquipmentSlot.MAINHAND); - if (!attributeModifiers.containsKey(Attributes.ATTACK_DAMAGE)) { - return; - } - attributeModifiers.get(Attributes.ATTACK_DAMAGE).forEach(m -> { - attribute.removeModifier(m.getId()); + stack.forEachModifier(EquipmentSlot.MAINHAND, (att, m) -> { + if (!att.equals(Attributes.ATTACK_DAMAGE)) { + return; + } + attribute.removeModifier(m); attribute.addTransientModifier(m); }); + double damageValue = attribute.getValue(); - if (stack.canPerformAction(ToolActions.AXE_DIG)) { + if (stack.canPerformAction(ItemAbilities.AXE_DIG)) { if (damageValue > bestAxeDamage.get()) { bestAxe.set(stack); bestAxeDamage.set(damageValue); } - } else if ((SwordRegistry.isSword(stack) || stack.canPerformAction(ToolActions.SWORD_SWEEP)) && damageValue > bestSwordDamage.get()) { + } else if ((SwordRegistry.isSword(stack) || stack.canPerformAction(ItemAbilities.SWORD_SWEEP)) && damageValue > bestSwordDamage.get()) { bestSword.set(stack); bestSwordDamage.set(damageValue); } @@ -272,20 +270,20 @@ public FilterLogic getFilterLogic() { } public boolean shouldSwapWeapon() { - return NBTHelper.getBoolean(upgrade, "shouldSwapWeapon").orElse(true); + return upgrade.getOrDefault(ModDataComponents.SHOULD_SWAP_WEAPON, true); } public void setSwapWeapon(boolean shouldSwapWeapon) { - NBTHelper.setBoolean(upgrade, "shouldSwapWeapon", shouldSwapWeapon); + upgrade.set(ModDataComponents.SHOULD_SWAP_WEAPON, shouldSwapWeapon); save(); } public ToolSwapMode getToolSwapMode() { - return NBTHelper.getEnumConstant(upgrade, "toolSwapMode", ToolSwapMode::fromName).orElse(ToolSwapMode.ANY); + return upgrade.getOrDefault(ModDataComponents.TOOL_SWAP_MODE, ToolSwapMode.ANY); } public void setToolSwapMode(ToolSwapMode toolSwapMode) { - NBTHelper.setEnumConstant(upgrade, "toolSwapMode", toolSwapMode); + upgrade.set(ModDataComponents.TOOL_SWAP_MODE, toolSwapMode); save(); } @@ -385,10 +383,10 @@ private boolean hasEquivalentItem(Collection alreadyGivenBefore, Item return false; } - private static final Set BLOCK_MODIFICATION_ACTIONS = Set.of(AXE_STRIP, AXE_SCRAPE, AXE_WAX_OFF, SHOVEL_FLATTEN, SHEARS_CARVE, SHEARS_HARVEST); + private static final Set BLOCK_MODIFICATION_ACTIONS = Set.of(AXE_STRIP, AXE_SCRAPE, AXE_WAX_OFF, SHOVEL_FLATTEN, SHEARS_CARVE, SHEARS_HARVEST); private boolean itemWorksOnBlock(Level level, BlockPos pos, BlockState blockState, Player player, ItemStack stack) { - for (ToolAction action : BLOCK_MODIFICATION_ACTIONS) { + for (ItemAbility action : BLOCK_MODIFICATION_ACTIONS) { if (stack.canPerformAction(action) && blockState.getToolModifiedState( new UseOnContext(level, player, InteractionHand.MAIN_HAND, stack, new BlockHitResult(Vec3.atCenterOf(pos), Direction.UP, pos, true)), action, true) != null) { return true; @@ -403,15 +401,15 @@ private boolean itemWorksOnBlock(Level level, BlockPos pos, BlockState blockStat } private boolean isShearsItem(ItemStack stack) { - return stack.getItem() instanceof ShearsItem || stack.is(Tags.Items.SHEARS); + return stack.getItem() instanceof ShearsItem || stack.is(Tags.Items.TOOLS_SHEAR); } private boolean isShearInteractionBlock(Level level, BlockPos pos, ItemStack stack, Block block) { - return (block instanceof IShearable shearable && shearable.isShearable(stack, level, pos)) || block instanceof BeehiveBlock; + return (block instanceof IShearable shearable && shearable.isShearable(null, stack, level, pos)) || block instanceof BeehiveBlock; } private boolean isShearableEntity(Entity entity, ItemStack stack) { - return entity instanceof IShearable shearable && shearable.isShearable(stack, entity.level(), entity.blockPosition()); + return entity instanceof IShearable shearable && shearable.isShearable(null, stack, entity.level(), entity.blockPosition()); } @Override diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/util/InventoryInteractionHelper.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/util/InventoryInteractionHelper.java index 68ef3e77..8541997c 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/util/InventoryInteractionHelper.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/util/InventoryInteractionHelper.java @@ -33,7 +33,7 @@ public static boolean tryInventoryInteraction(BlockPos pos, Level level, ItemSta } return CapabilityHelper.getFromItemHandler(level, pos, face, - itemHandler -> player.level().isClientSide || tryRunningInteractionWrappers(itemHandler, BackpackWrapper.fromData(backpack), player), + itemHandler -> player.level().isClientSide || tryRunningInteractionWrappers(itemHandler, BackpackWrapper.fromStack(backpack), player), false); } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index d2894e9c..d17a3e01 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -11,3 +11,4 @@ public net.minecraft.world.item.Item BASE_ATTACK_DAMAGE_UUID public net.minecraft.world.entity.item.ItemEntity pickupDelay public net.minecraft.world.item.RecordItem BY_NAME public net.minecraft.world.item.SpawnEggItem BY_ID +public net.minecraft.client.renderer.entity.EntityRenderDispatcher renderers \ No newline at end of file diff --git a/src/main/resources/data/curios/tags/items/back.json b/src/main/resources/data/curios/tags/item/back.json similarity index 100% rename from src/main/resources/data/curios/tags/items/back.json rename to src/main/resources/data/curios/tags/item/back.json diff --git a/src/main/resources/data/sophisticatedbackpacks/registry/compat/resourcefulbees/entity_tools.json b/src/main/resources/data/sophisticatedbackpacks/registry/compat/resourcefulbees/entity_tools.json index e74ccfe5..09335d8b 100644 --- a/src/main/resources/data/sophisticatedbackpacks/registry/compat/resourcefulbees/entity_tools.json +++ b/src/main/resources/data/sophisticatedbackpacks/registry/compat/resourcefulbees/entity_tools.json @@ -9,7 +9,7 @@ ], "tools": [ { - "type": "emptynbt", + "type": "nocomponents", "item": "resourcefulbees:bee_jar" }, "resourcefulbees:honey_dipper" diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml similarity index 100% rename from src/main/resources/META-INF/neoforge.mods.toml rename to src/main/templates/META-INF/neoforge.mods.toml