From 135094788dcc1771778e1f46d3d1b6d31600cd86 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 23 Aug 2024 19:05:04 -0400 Subject: [PATCH] More work on ponders --- .../630af4bded938901e0e1fd57c58a2ac245292828 | 2 +- .../6ba62358bf8e130d42215f5f9edbedd611809677 | 2 +- .../c6e4c19894bc5aece2976a0277ba8e1dbf023865 | 2 +- .../d6a1ec2d08c6d6d7facbde77dda6f0158c00bbd6 | 12 +-- .../assets/numismatics/lang/en_ud.json | 20 +++++ .../assets/numismatics/lang/en_us.json | 20 +++++ .../base/data/lang/NumismaticsLangGen.java | 10 +++ .../client/AccessorInputWindowElement.java | 6 +- .../mixin/client/PonderRegistryMixin.java | 40 +++++++++ .../ponder/DepositorScenes.java | 84 ++++++++++++++++++- ...lement.java => NumismaticsSharedText.java} | 27 +++--- .../resources/numismatics-common.mixins.json | 3 +- 12 files changed, 201 insertions(+), 27 deletions(-) create mode 100644 common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/PonderRegistryMixin.java rename common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/{IconInputWindowElement.java => NumismaticsSharedText.java} (54%) diff --git a/common/src/generated/resources/.cache/630af4bded938901e0e1fd57c58a2ac245292828 b/common/src/generated/resources/.cache/630af4bded938901e0e1fd57c58a2ac245292828 index 58d677f5..48e6e656 100644 --- a/common/src/generated/resources/.cache/630af4bded938901e0e1fd57c58a2ac245292828 +++ b/common/src/generated/resources/.cache/630af4bded938901e0e1fd57c58a2ac245292828 @@ -1,4 +1,4 @@ -// 1.20.1 2024-07-03T10:53:15.138751138 Create: Numismatics/Numismatics' Advancements +// 1.20.1 2024-08-23T18:12:57.114724483 Create: Numismatics/Numismatics' Advancements 8f32fb49ef81058e2e660fac983dbef2f554db38 data/numismatics/advancements/root.json 645c92e6e449889ed4cf617432fd6fa87ffe355b data/numismatics/advancements/questionable_investment.json 894790d980b33b5cc24a21937c7db72bf0af1c5a data/numismatics/advancements/money_laundering.json diff --git a/common/src/generated/resources/.cache/6ba62358bf8e130d42215f5f9edbedd611809677 b/common/src/generated/resources/.cache/6ba62358bf8e130d42215f5f9edbedd611809677 index 36bada8a..abcca38f 100644 --- a/common/src/generated/resources/.cache/6ba62358bf8e130d42215f5f9edbedd611809677 +++ b/common/src/generated/resources/.cache/6ba62358bf8e130d42215f5f9edbedd611809677 @@ -1,4 +1,4 @@ -// 1.20.1 2024-07-03T10:53:15.138076264 Create: Numismatics/Numismatics Standard Recipes +// 1.20.1 2024-08-23T18:12:57.109303796 Create: Numismatics/Numismatics Standard Recipes e16d9a5134c226db94bb389c44e55a8b393ca6c4 data/numismatics/recipes/crafting/brass_depositor.json 151c31385fcbf7283f380e25ee2c8fdacd6d5103 data/numismatics/recipes/crafting/orange_id_card.json 858305a3537cdcb5bb19b883e688ddb876f0473c data/numismatics/recipes/crafting/brown_id_card.json diff --git a/common/src/generated/resources/.cache/c6e4c19894bc5aece2976a0277ba8e1dbf023865 b/common/src/generated/resources/.cache/c6e4c19894bc5aece2976a0277ba8e1dbf023865 index 88d72ef3..b049ecce 100644 --- a/common/src/generated/resources/.cache/c6e4c19894bc5aece2976a0277ba8e1dbf023865 +++ b/common/src/generated/resources/.cache/c6e4c19894bc5aece2976a0277ba8e1dbf023865 @@ -1 +1 @@ -// 1.20.1 2024-07-03T10:53:15.138642657 Create: Numismatics/Numismatics' Sequenced Assembly Recipes +// 1.20.1 2024-08-23T18:12:57.110147708 Create: Numismatics/Numismatics' Sequenced Assembly Recipes diff --git a/common/src/generated/resources/.cache/d6a1ec2d08c6d6d7facbde77dda6f0158c00bbd6 b/common/src/generated/resources/.cache/d6a1ec2d08c6d6d7facbde77dda6f0158c00bbd6 index 168db413..2fc1c168 100644 --- a/common/src/generated/resources/.cache/d6a1ec2d08c6d6d7facbde77dda6f0158c00bbd6 +++ b/common/src/generated/resources/.cache/d6a1ec2d08c6d6d7facbde77dda6f0158c00bbd6 @@ -1,4 +1,4 @@ -// 1.20.1 2024-07-03T10:53:15.136472954 Create: Numismatics/Registrate Provider for numismatics [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] +// 1.20.1 2024-08-23T18:12:57.100507436 Create: Numismatics/Registrate Provider for numismatics [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)] 70c481f36a9718ac48632e6939ac6ba785be4c9e assets/numismatics/models/item/black_id_card.json 95ef415a564eba1d212053195d25b199427b94e3 assets/numismatics/blockstates/creative_vendor.json 4458283178334ae169a7cbbd1aa09067cbb99ee7 data/numismatics/tags/items/internal/dyes/green_dyes.json @@ -25,9 +25,9 @@ c1863c2bd08a5910a534aee0dcbc61a352fb9577 assets/numismatics/models/item/white_ca 890e519d407cab18c04ee439e7d5f67eb4f76ab3 assets/numismatics/models/item/blaze_banker.json 8fd12493390894fa5b3988f499f758c17137af16 assets/numismatics/models/item/sun.json 27788e1854c12b323c1fe5945858fce4d1544e3c data/numismatics/tags/items/internal/dyes/white_dyes.json -41b79e319044d6179f7757f73ef67c9acdbfe87d assets/numismatics/models/item/lime_id_card.json -dcf8ea4cef1226fb52d84359d1d2ff403ddb556a assets/numismatics/models/item/orange_id_card.json 36e1dad2803241c11c646b9737be8af6d67ef8fe data/c/tags/items/string.json +dcf8ea4cef1226fb52d84359d1d2ff403ddb556a assets/numismatics/models/item/orange_id_card.json +41b79e319044d6179f7757f73ef67c9acdbfe87d assets/numismatics/models/item/lime_id_card.json c1878dd808cf36e400e13885adfab22b60ac291e assets/numismatics/models/item/purple_id_card.json 9c20dd40c03605721d0231ffde829d55e36b1c05 assets/numismatics/models/item/yellow_card.json c05836600bd1689f598515841869634b1d709cca assets/numismatics/models/item/yellow_id_card.json @@ -38,11 +38,11 @@ a8cb82f19034a0e724e12df45c883e9cd469c210 assets/numismatics/models/item/green_ca cca7e7be961c6ed6272f19211bb17707b7934155 assets/numismatics/models/item/creative_vendor.json 9fdcd12c871f136e66973a8c02be94a675a4b727 data/numismatics/tags/items/internal/dyes/yellow_dyes.json dc5c60bbbaf3a5d7bc1f9bc0c9377757dbd8de49 data/numismatics/loot_tables/blocks/bank_terminal.json -aed88ddc55f53f022f96f0685b39d989667a2cb9 assets/numismatics/lang/en_us.json +7859a7a5b2e54af1cfa7e917a89f931cf34409cb assets/numismatics/lang/en_us.json edd6109002439af0f15959debe4cb9cca254add8 data/minecraft/tags/blocks/mineable/pickaxe.json facbd710d107ebc9b2c6ddfa3b59a16d5f85c992 assets/numismatics/models/item/spur.json d6f017479b3cc538f73d7fb0a1e65d1742bab266 assets/numismatics/models/item/light_blue_id_card.json -359ae558c1863eafeb0b0e762d472ea201473701 assets/numismatics/lang/en_ud.json +9167f82af5b0c8020036176b36f945d4f421e4dc assets/numismatics/lang/en_ud.json e62db1a880d468865769307ad19f16d9b7dac7c1 data/numismatics/tags/items/internal/dyes/light_gray_dyes.json c5958ebbc2782c2611690c642713cadc59656814 assets/numismatics/models/item/light_blue_card.json 9e6e50d40e3688ae681107e60ac5ff5fc22585f9 data/numismatics/loot_tables/blocks/andesite_depositor.json @@ -86,8 +86,8 @@ ad712dd2a2a7268dfa773f38a50d526952758d5c data/numismatics/tags/items/internal/dy 182450e6ad4229f2959e6c50e38ef6e2ff5259d0 data/numismatics/tags/items/internal/dyes/orange_dyes.json 56973a6ce09377c8f235f46aa4d71a2a9fabf587 assets/numismatics/models/item/red_card.json bdf101b181fa593ac3f92224b80c8ec45b5f046a data/numismatics/tags/items/numismatics_items.json -f7f43dd6d567ec8303c73b79409bc92d8b56574a assets/numismatics/blockstates/andesite_depositor.json 266d9b0eb6fdecc4bcf6da465078d059009a3b54 data/numismatics/loot_tables/blocks/blaze_banker.json +f7f43dd6d567ec8303c73b79409bc92d8b56574a assets/numismatics/blockstates/andesite_depositor.json 411b79f79547a0adcb665bf7440e8169f7dcb24e assets/numismatics/models/block/brass_depositor.json 99e3dd233c66e14a6e572e332ac8b7af1f8ed94e assets/numismatics/models/item/orange_card.json 83ce6c9d27970b4c643f0f9f3dfeb58668fca3d4 assets/numismatics/models/item/banking_guide.json diff --git a/common/src/generated/resources/assets/numismatics/lang/en_ud.json b/common/src/generated/resources/assets/numismatics/lang/en_ud.json index 5b383c00..e226ac11 100644 --- a/common/src/generated/resources/assets/numismatics/lang/en_ud.json +++ b/common/src/generated/resources/assets/numismatics/lang/en_ud.json @@ -112,5 +112,25 @@ "item.numismatics.yellow_id_card": "pɹɐƆ ᗡI ʍoןןǝʎ", "itemGroup.numismatics": "sɔıʇɐɯsıɯnN :ǝʇɐǝɹƆ", "numismatics.andesite_depositor.price": "ǝɔıɹԀ", + "numismatics.ponder.blaze_banker.header": "sǝzɐןᗺ ɥʇıʍ buıʞuɐᗺ", + "numismatics.ponder.blaze_banker.text_1": "ɹǝuɹnq ǝzɐןq ɐ oʇ ǝpın⅁ buıʞuɐᗺ ɐ buıʎןddɐ ʎq ɹǝʞuɐᗺ ǝzɐןᗺ ɐ ǝʇɐǝɹƆ", + "numismatics.ponder.blaze_banker.text_2": "ʇunoɔɔɐ uʍo ɹıǝɥʇ buısn ʇnoɥʇıʍ ʎǝuoɯ ǝbɐuɐɯ oʇ sɹǝʎɐןd ɹoɟ ʎɐʍ ɐ sı ɹǝʞuɐᗺ ǝzɐןᗺ ǝɥ⟘", + "numismatics.ponder.blaze_banker.text_3": "˙ʇoןs pɹɐɔ sʇı oʇuı ʇı ǝɔɐןd 'ɹǝʞuɐᗺ ɐ oʇ pɹɐɔ ɐ puıq o⟘", + "numismatics.ponder.depositor.header": "sɹoʇısodǝᗡ buıs∩", + "numismatics.ponder.depositor.text_1": "ʇndʇno ǝuoʇspǝɹ ɐ ǝɔnpoɹd puɐ ʎǝuoɯ ʇdǝɔɔɐ oʇ ʎɐʍ ɐ ǝɹɐ sɹoʇısodǝᗡ", + "numismatics.ponder.depositor.text_2": "sbuıɥʇ ʎuɐɯ ɹoɟ pǝsn ǝq uɐɔ ʇndʇno ǝuoʇspǝɹ sıɥ⟘", + "numismatics.ponder.depositor.text_3": "ʎǝuoɯ buıʇdǝɔɔɐ ɯoɹɟ ɯǝɥʇ buıʇuǝʌǝɹd 'ʇnduı ǝuoʇspǝɹ ɐ buısn pǝʞɔoן ǝq osןɐ uɐɔ ʎǝɥ⟘", + "numismatics.ponder.depositor_pricing.header": "buıɔıɹԀ ɹoʇısodǝᗡ", + "numismatics.ponder.depositor_pricing.text_1": "I∩ sʇı uı ʇǝs ǝq uɐɔ ǝɔıɹd s’ɹoʇısodǝp Ɐ", + "numismatics.ponder.depositor_pricing.text_2": "uıoɔ ɐ ɹoɟ puɐɥ s’ɹǝʎɐןd ǝɥʇ ʞɔǝɥɔ ʎןuo ןןıʍ puɐ 'suıoɔ ǝןbuıs uı ǝɔıɹd ǝןdɯıs ɐ ʇǝs ʎןuo uɐɔ ɹoʇısodǝp ǝʇısǝpuɐ ǝɥ⟘", + "numismatics.ponder.shared.amount1x": "xƖ", + "numismatics.ponder.shared.amount2x": "xᄅ", + "numismatics.ponder.shared.amount3x": "xƐ", + "numismatics.ponder.shared.amount4x": "xㄣ", + "numismatics.ponder.shared.amount5x": "xϛ", + "numismatics.ponder.shared.amount6x": "x9", + "numismatics.ponder.shared.amount7x": "xㄥ", + "numismatics.ponder.shared.amount8x": "x8", + "numismatics.ponder.shared.amount9x": "x6", "numismatics.trust_list.configure": "ʇsıꞀ ʇsnɹ⟘ ǝɹnbıɟuoƆ" } \ No newline at end of file diff --git a/common/src/generated/resources/assets/numismatics/lang/en_us.json b/common/src/generated/resources/assets/numismatics/lang/en_us.json index d03a2de9..80ed85ef 100644 --- a/common/src/generated/resources/assets/numismatics/lang/en_us.json +++ b/common/src/generated/resources/assets/numismatics/lang/en_us.json @@ -112,5 +112,25 @@ "item.numismatics.yellow_id_card": "Yellow ID Card", "itemGroup.numismatics": "Create: Numismatics", "numismatics.andesite_depositor.price": "Price", + "numismatics.ponder.blaze_banker.header": "Banking with Blazes", + "numismatics.ponder.blaze_banker.text_1": "Create a Blaze Banker by applying a Banking Guide to a blaze burner", + "numismatics.ponder.blaze_banker.text_2": "The Blaze Banker is a way for players to manage money without using their own account", + "numismatics.ponder.blaze_banker.text_3": "To bind a card to a Banker, place it into its card slot.", + "numismatics.ponder.depositor.header": "Using Depositors", + "numismatics.ponder.depositor.text_1": "Depositors are a way to accept money and produce a redstone output", + "numismatics.ponder.depositor.text_2": "This redstone output can be used for many things", + "numismatics.ponder.depositor.text_3": "They can also be locked using a redstone input, preventing them from accepting money", + "numismatics.ponder.depositor_pricing.header": "Depositor Pricing", + "numismatics.ponder.depositor_pricing.text_1": "A depositor’s price can be set in its UI", + "numismatics.ponder.depositor_pricing.text_2": "The andesite depositor can only set a simple price in single coins, and will only check the player’s hand for a coin", + "numismatics.ponder.shared.amount1x": "1x", + "numismatics.ponder.shared.amount2x": "2x", + "numismatics.ponder.shared.amount3x": "3x", + "numismatics.ponder.shared.amount4x": "4x", + "numismatics.ponder.shared.amount5x": "5x", + "numismatics.ponder.shared.amount6x": "6x", + "numismatics.ponder.shared.amount7x": "7x", + "numismatics.ponder.shared.amount8x": "8x", + "numismatics.ponder.shared.amount9x": "9x", "numismatics.trust_list.configure": "Configure Trust List" } \ No newline at end of file diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/base/data/lang/NumismaticsLangGen.java b/common/src/main/java/dev/ithundxr/createnumismatics/base/data/lang/NumismaticsLangGen.java index 7e282ed2..2a69fcc3 100644 --- a/common/src/main/java/dev/ithundxr/createnumismatics/base/data/lang/NumismaticsLangGen.java +++ b/common/src/main/java/dev/ithundxr/createnumismatics/base/data/lang/NumismaticsLangGen.java @@ -20,8 +20,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.simibubi.create.foundation.ponder.PonderLocalization; import com.simibubi.create.foundation.utility.FilesHelper; import com.tterrag.registrate.providers.RegistrateLangProvider; +import dev.ithundxr.createnumismatics.Numismatics; +import dev.ithundxr.createnumismatics.ponder.utils.NumismaticsSharedText; import dev.ithundxr.createnumismatics.registry.NumismaticsAdvancements; import java.util.Map; @@ -34,6 +37,7 @@ public static void generate(RegistrateLangProvider provider) { provideDefaultLang("interface", langConsumer); provideDefaultLang("tooltips", langConsumer); NumismaticsAdvancements.provideLang(langConsumer); + providePonderLang(langConsumer); } private static void provideDefaultLang(String fileName, BiConsumer consumer) { @@ -49,4 +53,10 @@ private static void provideDefaultLang(String fileName, BiConsumer consumer) { + NumismaticsSharedText.gatherText(); + + PonderLocalization.provideLang(Numismatics.MOD_ID, consumer); + } } diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/AccessorInputWindowElement.java b/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/AccessorInputWindowElement.java index 86b28bdb..8c35730c 100644 --- a/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/AccessorInputWindowElement.java +++ b/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/AccessorInputWindowElement.java @@ -18,13 +18,13 @@ package dev.ithundxr.createnumismatics.mixin.client; -import com.simibubi.create.foundation.gui.AllIcons; import com.simibubi.create.foundation.ponder.element.InputWindowElement; +import net.minecraft.resources.ResourceLocation; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(InputWindowElement.class) public interface AccessorInputWindowElement { - @Accessor("icon") - void numismatics$setIcon(AllIcons icon); + @Accessor("key") + void numsismatics$setKey(ResourceLocation key); } diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/PonderRegistryMixin.java b/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/PonderRegistryMixin.java new file mode 100644 index 00000000..ccbe45c0 --- /dev/null +++ b/common/src/main/java/dev/ithundxr/createnumismatics/mixin/client/PonderRegistryMixin.java @@ -0,0 +1,40 @@ +/* + * Numismatics + * Copyright (c) 2024 The Railways Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package dev.ithundxr.createnumismatics.mixin.client; + +import com.simibubi.create.foundation.ponder.PonderRegistry; +import com.simibubi.create.foundation.ponder.PonderScene; +import com.simibubi.create.foundation.ponder.PonderStoryBoardEntry; +import dev.ithundxr.createnumismatics.annotation.mixin.DevMixin; +import dev.ithundxr.createnumismatics.ponder.utils.NumismaticsSharedText; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +@DevMixin +@Mixin(PonderRegistry.class) +public class PonderRegistryMixin { + @Inject(method = "compile(Ljava/util/List;)Ljava/util/List;", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/infrastructure/ponder/SharedText;gatherText()V"), remap = false) + private static void numismatics$injectNumismaticsSharedText(List entries, CallbackInfoReturnable> cir) { + NumismaticsSharedText.gatherText(); + } +} diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/ponder/DepositorScenes.java b/common/src/main/java/dev/ithundxr/createnumismatics/ponder/DepositorScenes.java index 3f9a83f8..5e8f787a 100644 --- a/common/src/main/java/dev/ithundxr/createnumismatics/ponder/DepositorScenes.java +++ b/common/src/main/java/dev/ithundxr/createnumismatics/ponder/DepositorScenes.java @@ -18,11 +18,15 @@ package dev.ithundxr.createnumismatics.ponder; +import com.simibubi.create.foundation.gui.AllIcons; import com.simibubi.create.foundation.ponder.SceneBuilder; import com.simibubi.create.foundation.ponder.SceneBuildingUtil; +import com.simibubi.create.foundation.ponder.element.InputWindowElement; +import com.simibubi.create.foundation.ponder.instruction.ShowInputInstruction; import com.simibubi.create.foundation.utility.Pointing; +import dev.ithundxr.createnumismatics.Numismatics; import dev.ithundxr.createnumismatics.content.depositor.AbstractDepositorBlock; -import dev.ithundxr.createnumismatics.ponder.utils.IconInputWindowElement; +import dev.ithundxr.createnumismatics.mixin.client.AccessorInputWindowElement; import dev.ithundxr.createnumismatics.registry.NumismaticsIcons; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -32,6 +36,7 @@ import net.minecraft.world.level.block.RepeaterBlock; import net.minecraft.world.level.block.TrapDoorBlock; import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.phys.Vec3; public class DepositorScenes { public static void depositor(SceneBuilder scene, SceneBuildingUtil util) { @@ -137,8 +142,8 @@ public static void depositor(SceneBuilder scene, SceneBuildingUtil util) { .placeNearTarget(); scene.idle(20); - scene.overlay.showControls(new IconInputWindowElement(util.vector.topOf(andesiteDepositor), Pointing.DOWN).withIcon(NumismaticsIcons.I_COIN_COG_RED_LINE), 40); - scene.overlay.showControls(new IconInputWindowElement(util.vector.topOf(brassDepositor), Pointing.DOWN).withIcon(NumismaticsIcons.I_COIN_COG_RED_LINE), 40); + scene.overlay.showControls(new InputWindowElement(util.vector.topOf(andesiteDepositor), Pointing.DOWN).showing(NumismaticsIcons.I_COIN_COG_RED_LINE), 40); + scene.overlay.showControls(new InputWindowElement(util.vector.topOf(brassDepositor), Pointing.DOWN).showing(NumismaticsIcons.I_COIN_COG_RED_LINE), 40); cycleState(andesiteDepositorLeft, RepeaterBlock.POWERED, scene); cycleState(brassDepositorRight, RepeaterBlock.POWERED, scene); @@ -156,6 +161,68 @@ public static void depositor(SceneBuilder scene, SceneBuildingUtil util) { } public static void depositorPricing(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("depositor_pricing", "Depositor Pricing"); + scene.configureBasePlate(0, 0, 5); + scene.showBasePlate(); + scene.idle(10); + + BlockPos andesiteDepositor = util.grid.at(2, 1, 2); + + BlockPos redstoneLamp = util.grid.at(2, 1, 3); + + scene.world.showSection(util.select.position(andesiteDepositor), Direction.DOWN); + scene.idle(10); + + scene.world.showSection(util.select.position(redstoneLamp), Direction.DOWN); + scene.idle(10); + + scene.overlay.showText(70) + .attachKeyFrame() + .text("A depositor’s price can be set in its UI") + .pointAt(util.vector.topOf(andesiteDepositor)) + .placeNearTarget(); + scene.idle(80); + + InputWindowElement element = new InputWindowElement(util.vector.topOf(andesiteDepositor), Pointing.DOWN); + ((AccessorInputWindowElement) element).numsismatics$setKey(Numismatics.asResource("amount_spaced_1x")); + scene.addInstruction(new ShowInputInstruction(element, 77)); + + changeIcon(scene, element, NumismaticsIcons.I_COIN_SPUR); + changeIcon(scene, element, NumismaticsIcons.I_COIN_BEVEL); + changeIcon(scene, element, NumismaticsIcons.I_COIN_SPROCKET); + changeIcon(scene, element, NumismaticsIcons.I_COIN_COG); + changeIcon(scene, element, NumismaticsIcons.I_COIN_CROWN); + + changeIcon(scene, element, NumismaticsIcons.I_COIN_SUN); + + changeIcon(scene, element, NumismaticsIcons.I_COIN_CROWN); + changeIcon(scene, element, NumismaticsIcons.I_COIN_COG); + changeIcon(scene, element, NumismaticsIcons.I_COIN_SPROCKET); + changeIcon(scene, element, NumismaticsIcons.I_COIN_BEVEL); + changeIcon(scene, element, NumismaticsIcons.I_COIN_SPUR); + + scene.overlay.showText(70) + .attachKeyFrame() + .text("The andesite depositor can only set a simple price in single coins, and will only check the player’s hand for a coin") + .pointAt(util.vector.topOf(andesiteDepositor)) + .placeNearTarget(); + scene.idle(80); + + showIcon(scene, util.vector.topOf(andesiteDepositor), "amount1x", NumismaticsIcons.I_COIN_COG_RED_LINE, 40); + scene.idle(50); + + showIcon(scene, util.vector.topOf(andesiteDepositor), "amount1x", NumismaticsIcons.I_COIN_SPUR, 40); + + scene.effects.indicateSuccess(andesiteDepositor); + + cycleState(andesiteDepositor, AbstractDepositorBlock.LOCKED, scene); + cycleState(redstoneLamp, RedstoneLampBlock.LIT, scene); + + scene.idle(50); + + cycleState(andesiteDepositor, AbstractDepositorBlock.LOCKED, scene); + cycleState(redstoneLamp, RedstoneLampBlock.LIT, scene); + } @@ -168,4 +235,15 @@ private static void cycleDoorState(BlockPos doorPos, SceneBuilder scene) { cycleState(doorPos, DoorBlock.OPEN, scene); cycleState(doorPos.above(), DoorBlock.OPEN, scene); } + + private static void showIcon(SceneBuilder scene, Vec3 sceneSpace, String sharedTextValue, AllIcons icon, int duration) { + InputWindowElement element = new InputWindowElement(sceneSpace, Pointing.DOWN).showing(icon); + ((AccessorInputWindowElement) element).numsismatics$setKey(Numismatics.asResource(sharedTextValue)); + scene.overlay.showControls(element, duration); + } + + private static void changeIcon(SceneBuilder scene, InputWindowElement element, AllIcons icon) { + scene.addInstruction(s -> element.showing(icon)); + scene.idle(7); + } } diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/IconInputWindowElement.java b/common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/NumismaticsSharedText.java similarity index 54% rename from common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/IconInputWindowElement.java rename to common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/NumismaticsSharedText.java index 04591449..d1bc24d1 100644 --- a/common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/IconInputWindowElement.java +++ b/common/src/main/java/dev/ithundxr/createnumismatics/ponder/utils/NumismaticsSharedText.java @@ -18,19 +18,24 @@ package dev.ithundxr.createnumismatics.ponder.utils; -import com.simibubi.create.foundation.gui.AllIcons; -import com.simibubi.create.foundation.ponder.element.InputWindowElement; -import com.simibubi.create.foundation.utility.Pointing; -import dev.ithundxr.createnumismatics.mixin.client.AccessorInputWindowElement; -import net.minecraft.world.phys.Vec3; +import com.simibubi.create.foundation.ponder.PonderLocalization; +import dev.ithundxr.createnumismatics.Numismatics; -public class IconInputWindowElement extends InputWindowElement { - public IconInputWindowElement(Vec3 sceneSpace, Pointing direction) { - super(sceneSpace, direction); +public class NumismaticsSharedText { + public static void gatherText() { + // Add entries used across several ponder scenes (Safe for hotswap) + + createNumberPonderEntries(1, 10); } - public InputWindowElement withIcon(AllIcons icon) { - ((AccessorInputWindowElement) this).numismatics$setIcon(icon); - return this; + private static void createNumberPonderEntries(int from, int to) { + for (int i = from; i < to; i++) { + add("amount" + i + "x", i + "x"); + add("amount_spaced_" + i + "x", i + "x "); + } + } + + private static void add(String k, String v) { + PonderLocalization.registerShared(Numismatics.asResource(k), v); } } diff --git a/common/src/main/resources/numismatics-common.mixins.json b/common/src/main/resources/numismatics-common.mixins.json index 44ed5377..b5fa6744 100644 --- a/common/src/main/resources/numismatics-common.mixins.json +++ b/common/src/main/resources/numismatics-common.mixins.json @@ -4,7 +4,6 @@ "package": "dev.ithundxr.createnumismatics.mixin", "compatibilityLevel": "JAVA_17", "client": [ - "client.AccessorInputWindowElement", "client.MixinBitmapProvider$Definition", "client.MixinChatScreen", "client.MixinPonderIndex" @@ -13,6 +12,8 @@ "AccessorSimpleContainer", "MixinAbstractContainerMenu", "MixinServerPlayer", + "client.AccessorInputWindowElement", + "client.PonderRegistryMixin", "compat.carryon.MixinPickupHandler" ], "injectors": {