From e2c50663a5f32c27cbc0aa6b9f20323e4fd089a4 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Fri, 5 Mar 2021 01:36:41 +0100 Subject: [PATCH] UI and tag enhancements - Fixed partial ticks on transitions - Transitions center on clicked components - Added auto-lang for tags - Moved some other ui stuff around --- src/generated/resources/.cache/cache | 26 +-- .../resources/assets/create/lang/en_us.json | 9 + .../assets/create/lang/unfinished/de_de.json | 11 +- .../assets/create/lang/unfinished/es_es.json | 11 +- .../assets/create/lang/unfinished/es_mx.json | 11 +- .../assets/create/lang/unfinished/fr_fr.json | 11 +- .../assets/create/lang/unfinished/it_it.json | 11 +- .../assets/create/lang/unfinished/ja_jp.json | 11 +- .../assets/create/lang/unfinished/ko_kr.json | 11 +- .../assets/create/lang/unfinished/nl_nl.json | 11 +- .../assets/create/lang/unfinished/pt_br.json | 11 +- .../assets/create/lang/unfinished/ru_ru.json | 11 +- .../assets/create/lang/unfinished/zh_cn.json | 11 +- .../assets/create/lang/unfinished/zh_tw.json | 11 +- .../foundation/gui/AbstractSimiScreen.java | 173 ++++++++------- .../create/foundation/gui/ScreenOpener.java | 64 +++--- .../create/foundation/gui/UIRenderHelper.java | 14 +- .../foundation/ponder/PonderLocalization.java | 37 +++- .../foundation/ponder/PonderRegistry.java | 1 + .../ponder/PonderTooltipHandler.java | 9 +- .../create/foundation/ponder/PonderUI.java | 170 +++++++++------ .../ponder/content/MovementActorScenes.java | 27 +++ .../ponder/content/PonderIndex.java | 42 ++-- .../ponder/content/PonderIndexScreen.java | 10 +- .../foundation/ponder/content/PonderTag.java | 75 +++++-- .../ponder/content/PonderTagScreen.java | 201 ++++++++++++------ .../foundation/ponder/ui/ChapterLabel.java | 13 +- .../foundation/ponder/ui/PonderButton.java | 20 +- .../ponder/portable_interface/redstone.nbt | Bin 0 -> 667 bytes .../ponder/portable_interface/transfer.nbt | Bin 0 -> 1085 bytes 30 files changed, 708 insertions(+), 315 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java create mode 100644 src/main/resources/ponder/portable_interface/redstone.nbt create mode 100644 src/main/resources/ponder/portable_interface/transfer.nbt diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 22ff97d25..1f3450836 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -401,19 +401,19 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json 2384c6457ecf24c7b38358179b8fa6eb93b9627a assets/create/lang/en_ud.json -569b3aaadf1e5c5849692c4e918dc762edd9a316 assets/create/lang/en_us.json -70a747f3639180da9cba1b8747fb19dacb1e9619 assets/create/lang/unfinished/de_de.json -610b1e766bc338d38906a160908cdb79e0d3bc54 assets/create/lang/unfinished/es_es.json -8eff0c23695d3e8c26d1265a82324242a9762226 assets/create/lang/unfinished/es_mx.json -fb150f105517632023265602cfc3c948be932917 assets/create/lang/unfinished/fr_fr.json -09111dedc02d6803134a8276ec481abcaa0e00c7 assets/create/lang/unfinished/it_it.json -c1f6faed7efb6f224aec7563b0ac6b891bc780d4 assets/create/lang/unfinished/ja_jp.json -c6139e7280236adcd136d40a94cd1cb708d402c6 assets/create/lang/unfinished/ko_kr.json -bb3fda881575df3ae26921edc3f4a3e2ecbc6ccd assets/create/lang/unfinished/nl_nl.json -8915f0902e59c1bbfb2c16e43e2ce62b3d616e0d assets/create/lang/unfinished/pt_br.json -ad8d2b7c8c7f3ac584218c33f86ba67c1873b7fc assets/create/lang/unfinished/ru_ru.json -e549baab96828524fc4694355546c685859956d6 assets/create/lang/unfinished/zh_cn.json -2506abb1c796aad920e803a8e1427908c5b115c1 assets/create/lang/unfinished/zh_tw.json +52fd28525a66b08652bac2d1a4a5543956b47091 assets/create/lang/en_us.json +00751ce98f978b4568723ebeaa0350d77a380cd8 assets/create/lang/unfinished/de_de.json +2d8c801b475cabc33c7d0f8f318ef9068a4b8cea assets/create/lang/unfinished/es_es.json +1b18ac809eda5655000a56190bd8be467062beab assets/create/lang/unfinished/es_mx.json +93340db6d63864fa23bf663954221b68d345a37f assets/create/lang/unfinished/fr_fr.json +299731bb461adb0c55393fa9c1d814861b002ebd assets/create/lang/unfinished/it_it.json +947363f4bcec709f398904ece57a5d66294dd6f8 assets/create/lang/unfinished/ja_jp.json +11798cdf3c66152fc736cdba465b795c0abac0b4 assets/create/lang/unfinished/ko_kr.json +b30301ea195e3c08dc8d1fecfd9a546255ac75b8 assets/create/lang/unfinished/nl_nl.json +feb0ab7a4c616447dd74e4cf808a003447cfdfe1 assets/create/lang/unfinished/pt_br.json +d12dde0c45bbf29613ade488619b57949ee7068c assets/create/lang/unfinished/ru_ru.json +b904d41c0cda0d56b1aa519a45a35800589445d5 assets/create/lang/unfinished/zh_cn.json +47e89b425362abb4241b4ffe73bfaa22fef0b6f0 assets/create/lang/unfinished/zh_tw.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index b3690cb9c..d4d95363b 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1807,9 +1807,14 @@ "create.ponder.subject": "Subject of this scene", "create.ponder.pondering": "Pondering about...", "create.ponder.identify_mode": "Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "Associated Entries", "create.ponder.shared.movement_anchors": "With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "Sneak +", "create.ponder.shared.ctrl_and": "Ctrl +", + "create.ponder.tag.arm_access": "Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "Kinetic Blocks", + "create.ponder.tag.kinetics.description": "Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "Andesite Funnels can only ever extract single items.", @@ -1866,6 +1871,10 @@ "create.ponder.shaft.scene_1.header": "Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 01610abd3..b1d288aac 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1059", + "_": "Missing Localizations: 1066", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_es.json b/src/generated/resources/assets/create/lang/unfinished/es_es.json index b99910daf..539839eb7 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_es.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_es.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 102", + "_": "Missing Localizations: 109", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index 6611145d1..fff507aad 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 989", + "_": "Missing Localizations: 996", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index 249958a19..693fe889c 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 771", + "_": "Missing Localizations: 778", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index 593c35df1..685be1ccf 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 107", + "_": "Missing Localizations: 114", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index e46f52ebf..d2422e9a2 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 114", + "_": "Missing Localizations: 121", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index e6ab8c399..6f40bbe56 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 160", + "_": "Missing Localizations: 167", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index dd0cc915d..8e529378e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1258", + "_": "Missing Localizations: 1265", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index 0dd6b00bf..77c539d59 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1324", + "_": "Missing Localizations: 1331", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index e9c2d527f..af1d88bd4 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 110", + "_": "Missing Localizations: 117", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index 6bd1e6840..3e91b0982 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 108", + "_": "Missing Localizations: 115", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json index 0fdf50b31..d6e1b1599 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 113", + "_": "Missing Localizations: 120", "_": "->------------------------] Game Elements [------------------------<-", @@ -1808,9 +1808,14 @@ "create.ponder.subject": "UNLOCALIZED: Subject of this scene", "create.ponder.pondering": "UNLOCALIZED: Pondering about...", "create.ponder.identify_mode": "UNLOCALIZED: Identify mode active.\nUnpause with [%1$s]", + "create.ponder.associated": "UNLOCALIZED: Associated Entries", "create.ponder.shared.movement_anchors": "UNLOCALIZED: With the help of Chassis or Super Glue, larger structures can be moved.", "create.ponder.shared.sneak_and": "UNLOCALIZED: Sneak +", "create.ponder.shared.ctrl_and": "UNLOCALIZED: Ctrl +", + "create.ponder.tag.arm_access": "UNLOCALIZED: Targets for Mechanical Arms", + "create.ponder.tag.arm_access.description": "UNLOCALIZED: Components which can be selected as inputs or outputs to the Mechanical Arm", + "create.ponder.tag.kinetics": "UNLOCALIZED: Kinetic Blocks", + "create.ponder.tag.kinetics.description": "UNLOCALIZED: Components which help generating, relaying and making use of Rotational Force", "create.ponder.brass_funnel.scene_0.header": "UNLOCALIZED: The Brass Funnel", "create.ponder.brass_funnel.scene_0.text_1": "UNLOCALIZED: Andesite Funnels can only ever extract single items.", @@ -1867,6 +1872,10 @@ "create.ponder.shaft.scene_1.header": "UNLOCALIZED: Encasing Shafts", "create.ponder.shaft.scene_1.text_1": "UNLOCALIZED: Andesite or Brass Casing can be used to encase them.", + "create.ponder.portable_storage_interface.scene_0.header": "UNLOCALIZED: Contraption Storage Exchange", + + "create.ponder.portable_storage_interface.scene_1.header": "UNLOCALIZED: Redstone Control", + "create.ponder.andesite_funnel.scene_0.header": "UNLOCALIZED: Using funnels", "create.ponder.andesite_funnel.scene_0.text_1": "UNLOCALIZED: Funnels are ideal for transferring items from and to inventories.", diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index 25ebdcac4..fcfba6f34 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -1,8 +1,17 @@ package com.simibubi.create.foundation.gui; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.mutable.MutableBoolean; +import org.apache.commons.lang3.mutable.MutableInt; +import org.lwjgl.glfw.GLFW; + import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import com.simibubi.create.foundation.utility.LerpedFloat; + import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -10,26 +19,25 @@ import net.minecraft.client.gui.widget.Widget; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.apache.commons.lang3.mutable.MutableBoolean; -import org.apache.commons.lang3.mutable.MutableInt; -import org.apache.logging.log4j.LogManager; -import org.lwjgl.glfw.GLFW; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; @OnlyIn(Dist.CLIENT) public abstract class AbstractSimiScreen extends Screen { protected int sWidth, sHeight; protected int guiLeft, guiTop; + protected int depthPointX, depthPointY; protected List widgets; - public final LerpedFloat transition = LerpedFloat.linear().startWithValue(0).chase(0, .1f, LerpedFloat.Chaser.LINEAR); + public final LerpedFloat transition = LerpedFloat.linear() + .startWithValue(0) + .chase(0, .1f, LerpedFloat.Chaser.LINEAR); protected AbstractSimiScreen() { super(new StringTextComponent("")); widgets = new ArrayList<>(); + MainWindow window = Minecraft.getInstance() + .getWindow(); + depthPointX = window.getScaledWidth() / 2; + depthPointY = window.getScaledHeight() / 2; } protected void setWindowSize(int width, int height) { @@ -42,104 +50,102 @@ public abstract class AbstractSimiScreen extends Screen { @Override public void tick() { super.tick(); - transition.tickChaser(); - - if (transition.getValue() < -0.9995f) { - transition.updateChaseTarget(0); - transition.setValue(0); - ScreenOpener.openLastScreen(); - } else if (transition.getValue() > 0.9995f) { - transition.updateChaseTarget(0); - transition.setValue(0); - } } @Override public void render(int mouseX, int mouseY, float partialTicks) { + partialTicks = partialTicks == 10 ? 0 + : Minecraft.getInstance() + .getRenderPartialTicks(); RenderSystem.pushMatrix(); + renderTransition(mouseX, mouseY, partialTicks); - partialTicks = Minecraft.getInstance() - .getRenderPartialTicks(); - renderBackground(); renderWindow(mouseX, mouseY, partialTicks); for (Widget widget : widgets) widget.render(mouseX, mouseY, partialTicks); - renderBreadcrumbs(mouseX, mouseY, partialTicks); - renderWindowForeground(mouseX, mouseY, partialTicks); for (Widget widget : widgets) widget.renderToolTip(mouseX, mouseY); RenderSystem.popMatrix(); + + renderBreadcrumbs(mouseX, mouseY, partialTicks); } private void renderTransition(int mouseX, int mouseY, float partialTicks) { - if (transition.getChaseTarget() != 0) { - if (ScreenOpener.getLastScreen() == null) { - return; - } else if (ScreenOpener.getLastScreen() == this) { - LogManager.getLogger().warn("Tired to render last screen recursively during transition"); - return; - } - //draw last screen into buffer - RenderSystem.pushMatrix();//1 + if (transition.getChaseTarget() == 0) { + renderBackground(); + return; + } + + renderBackground(); + + Screen lastScreen = ScreenOpener.getPreviouslyRenderedScreen(); + float transitionValue = transition.getValue(partialTicks); + double scale = 1 + 0.5 * transitionValue; + + // draw last screen into buffer + if (lastScreen != null && lastScreen != this) { + RenderSystem.pushMatrix();// 1 UIRenderHelper.framebuffer.framebufferClear(Minecraft.IS_RUNNING_ON_MAC); UIRenderHelper.prepFramebufferSize(); - RenderSystem.pushMatrix();//2 + RenderSystem.pushMatrix();// 2 RenderSystem.translated(0, 0, -1000); UIRenderHelper.framebuffer.bindFramebuffer(true); - ScreenOpener.getLastScreen().render(mouseX, mouseY, partialTicks); - RenderSystem.popMatrix();//2 - Minecraft.getInstance().getFramebuffer().bindFramebuffer(true); + lastScreen.render(mouseX, mouseY, 10); + RenderSystem.popMatrix();// 2 - //use the buffer texture - float transitionValue = transition.getValue(partialTicks); - if (transition.getChaseTarget() < 0) - transitionValue += 1; - //transitionV is ~1 when the older screen is hidden - //transitionV is ~0 when the older screen is still fully visible - double scale = 1 - 0.25 * transitionValue; - MainWindow window = Minecraft.getInstance().getWindow(); - int sw = window.getScaledWidth(); - int sh = window.getScaledHeight(); - RenderSystem.translated(sw * 0.5, sh * 0.5, -10); + // use the buffer texture + Minecraft.getInstance() + .getFramebuffer() + .bindFramebuffer(true); + + MainWindow window = Minecraft.getInstance() + .getWindow(); + int dpx = window.getScaledWidth() / 2; + int dpy = window.getScaledHeight() / 2; + if (lastScreen instanceof AbstractSimiScreen) { + dpx = ((AbstractSimiScreen) lastScreen).depthPointX; + dpy = ((AbstractSimiScreen) lastScreen).depthPointY; + } + + // transitionV is 1/-1 when the older screen is hidden + // transitionV is 0 when the older screen is still fully visible + RenderSystem.translated(dpx, dpy, 0); RenderSystem.scaled(scale, scale, 1); - RenderSystem.translated(sw * -0.5, sh * -0.5, 0); - - UIRenderHelper.drawFramebuffer(sw, sh, 1f - transitionValue); - RenderSystem.popMatrix();//1 - - //modify current screen as well - scale = 1 + 0.02 * (1 - transitionValue); - RenderSystem.translated(sw * 0.5, sh * 0.5, 0); - RenderSystem.scaled(scale, scale, 1); - RenderSystem.translated(sw * -0.5, sh * -0.5, 0); + RenderSystem.translated(-dpx, -dpy, 0); + UIRenderHelper.drawFramebuffer(1f - Math.abs(transitionValue)); + RenderSystem.popMatrix();// 1 } + + // modify current screen as well + scale = transitionValue > 0 ? 1 - 0.5 * (1 - transitionValue) : 1 + .5 * (1 + transitionValue); + RenderSystem.translated(depthPointX, depthPointY, 0); + RenderSystem.scaled(scale, scale, 1); + RenderSystem.translated(-depthPointX, -depthPointY, 0); } @Override public boolean mouseClicked(double x, double y, int button) { boolean result = false; - for (Widget widget : widgets) { + for (Widget widget : widgets) if (widget.mouseClicked(x, y, button)) result = true; - } return result; } @Override public boolean keyPressed(int code, int p_keyPressed_2_, int p_keyPressed_3_) { - for (Widget widget : widgets) { + for (Widget widget : widgets) if (widget.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; - } if (code == GLFW.GLFW_KEY_BACKSPACE) { - ScreenOpener.transitionToLast(); + ScreenOpener.openPreviousScreen(this); return true; } @@ -202,15 +208,13 @@ public abstract class AbstractSimiScreen extends Screen { history.add(0, Minecraft.getInstance().currentScreen); int spacing = 20; - List names = history - .stream() - .map(AbstractSimiScreen::screenTitle) - .collect(Collectors.toList()); + List names = history.stream() + .map(AbstractSimiScreen::screenTitle) + .collect(Collectors.toList()); - int bWidth = names - .stream() - .mapToInt(s -> font.getStringWidth(s) + spacing) - .sum(); + int bWidth = names.stream() + .mapToInt(s -> font.getStringWidth(s) + spacing) + .sum(); MutableInt x = new MutableInt(width - bWidth); MutableInt y = new MutableInt(height - 18); @@ -219,26 +223,33 @@ public abstract class AbstractSimiScreen extends Screen { if (x.getValue() < 25) x.setValue(25); + RenderSystem.pushMatrix(); + RenderSystem.translated(0, 0, 600); names.forEach(s -> { int sWidth = font.getStringWidth(s); - //UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing, 14, spacing/2, 0xbbababab, 0x22ababab); - UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing, 14, spacing/2, 0xdd101010, 0x44101010); + // UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing, + // 14, spacing/2, 0xbbababab, 0x22ababab); + UIRenderHelper.breadcrumbArrow(x.getValue(), y.getValue(), sWidth + spacing, 14, spacing / 2, 0xdd101010, + 0x44101010); drawString(font, s, x.getValue() + 5, y.getValue() + 3, first.getValue() ? 0xffeeffee : 0xffddeeff); first.setFalse(); x.add(sWidth + spacing); }); + RenderSystem.popMatrix(); } private static String screenTitle(Screen screen) { if (screen instanceof AbstractSimiScreen) return ((AbstractSimiScreen) screen).getBreadcrumbTitle(); - return screen.getClass().getSimpleName(); + return screen.getClass() + .getSimpleName(); } protected String getBreadcrumbTitle() { - return this.getClass().getSimpleName(); + return this.getClass() + .getSimpleName(); } protected void renderWindowForeground(int mouseX, int mouseY, float partialTicks) { @@ -253,4 +264,16 @@ public abstract class AbstractSimiScreen extends Screen { } } + public void centerScalingOn(int x, int y) { + depthPointX = x; + depthPointY = y; + } + + public void centerScalingOnMouse() { + MainWindow w = minecraft.getWindow(); + double mouseX = minecraft.mouseHelper.getMouseX() * w.getScaledWidth() / w.getWidth(); + double mouseY = minecraft.mouseHelper.getMouseY() * w.getScaledHeight() / w.getHeight(); + centerScalingOn((int) mouseX, (int) mouseY); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java b/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java index 59a08da3a..0a3f77489 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java @@ -1,25 +1,31 @@ package com.simibubi.create.foundation.gui; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screen.Screen; - -import javax.annotation.Nullable; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.List; +import javax.annotation.Nullable; + +import com.simibubi.create.foundation.ponder.PonderUI; +import com.simibubi.create.foundation.utility.LerpedFloat; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screen.Screen; + public class ScreenOpener { private static final Deque backStack = new ArrayDeque<>(); + private static Screen backSteppedFrom = null; public static void open(Screen screen) { open(Minecraft.getInstance().currentScreen, screen); } public static void open(@Nullable Screen current, Screen toOpen) { + backSteppedFrom = null; if (current != null) { - if (backStack.size() >= 15) //don't go deeper than 15 steps + if (backStack.size() >= 15) // don't go deeper than 15 steps backStack.pollLast(); backStack.push(current); @@ -29,30 +35,38 @@ public class ScreenOpener { openScreen(toOpen); } - public static void openLastScreen() { + public static void openPreviousScreen(Screen current) { if (backStack.isEmpty()) return; - - openScreen(backStack.pop()); + backSteppedFrom = current; + Screen previousScreen = backStack.pop(); + if (previousScreen instanceof AbstractSimiScreen) + ((AbstractSimiScreen) previousScreen).transition.startWithValue(-0.1) + .chase(-1, .4f, LerpedFloat.Chaser.EXP); + openScreen(previousScreen); } - //transitions are only supported in simiScreens atm. they take care of all the rendering for it + // transitions are only supported in simiScreens atm. they take care of all the + // rendering for it public static void transitionTo(AbstractSimiScreen screen) { - screen.transition.updateChaseTarget(1); + + List screenHistory = getScreenHistory(); + if (!screenHistory.isEmpty()) { + Screen previouslyRenderedScreen = screenHistory.get(0); + if (screen instanceof PonderUI && previouslyRenderedScreen instanceof PonderUI) { + if (((PonderUI) screen).getSubject() + .isItemEqual(((PonderUI) previouslyRenderedScreen).getSubject())) { + openPreviousScreen(Minecraft.getInstance().currentScreen); + return; + } + } + } + + screen.transition.startWithValue(0.1) + .chase(1, .4f, LerpedFloat.Chaser.EXP); open(screen); } - public static void transitionToLast() { - if (backStack.isEmpty()) - return; - - Screen currentScreen = Minecraft.getInstance().currentScreen; - if (currentScreen instanceof AbstractSimiScreen) - ((AbstractSimiScreen) currentScreen).transition.updateChaseTarget(-1); - else - openLastScreen(); - } - public static void clearStack() { backStack.clear(); } @@ -62,12 +76,14 @@ public class ScreenOpener { } @Nullable - public static Screen getLastScreen() { - return backStack.peek(); + public static Screen getPreviouslyRenderedScreen() { + return backSteppedFrom != null ? backSteppedFrom : backStack.peek(); } private static void openScreen(Screen screen) { - Minecraft.getInstance().enqueue(() -> Minecraft.getInstance().displayGuiScreen(screen)); + Minecraft.getInstance() + .enqueue(() -> Minecraft.getInstance() + .displayGuiScreen(screen)); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index 87816728e..a4b4a22f5 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -1,7 +1,10 @@ package com.simibubi.create.foundation.gui; +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; @@ -9,7 +12,6 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.client.gui.GuiUtils; -import org.lwjgl.opengl.GL11; public class UIRenderHelper { @@ -30,13 +32,15 @@ public class UIRenderHelper { } } - public static void drawFramebuffer(int width, int height, float alpha) { - float vx = (float) width; - float vy = (float) height; + public static void drawFramebuffer(float alpha) { + MainWindow window = Minecraft.getInstance() + .getWindow(); + + float vx = (float) window.getScaledWidth(); + float vy = (float) window.getScaledHeight(); float tx = (float) framebuffer.framebufferWidth / (float) framebuffer.framebufferTextureWidth; float ty = (float) framebuffer.framebufferHeight / (float) framebuffer.framebufferTextureHeight; - RenderSystem.enableTexture(); RenderSystem.enableBlend(); RenderSystem.disableLighting(); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java index 2c284cfe3..f99647b3d 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java @@ -7,6 +7,8 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.simibubi.create.Create; import com.simibubi.create.foundation.ponder.content.PonderIndex; +import com.simibubi.create.foundation.ponder.content.PonderTagScreen; +import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.util.ResourceLocation; @@ -14,10 +16,15 @@ import net.minecraft.util.ResourceLocation; public class PonderLocalization { static Map shared = new HashMap<>(); + static Map> tag = new HashMap<>(); static Map>> specific = new HashMap<>(); // + public static void registerTag(String key, String enUS, String description) { + tag.put(key, Couple.create(enUS, description)); + } + public static void registerShared(String key, String enUS) { shared.put(key, enUS); } @@ -44,9 +51,23 @@ public class PonderLocalization { return Lang.translate(langKeyForSpecific(component.getPath(), scene, k)); } + public static String getTag(String key) { + if (PonderIndex.EDITOR_MODE) + return tag.containsKey(key) ? tag.get(key) + .getFirst() : ("unregistered tag entry:" + key); + return Lang.translate(langKeyForTag(key)); + } + + public static String getTagDescription(String key) { + if (PonderIndex.EDITOR_MODE) + return tag.containsKey(key) ? tag.get(key) + .getSecond() : ("unregistered tag entry:" + key); + return Lang.translate(langKeyForTagDescription(key)); + } + // - static final String LANG_PREFIX = "ponder."; + public static final String LANG_PREFIX = "ponder."; public static JsonElement record() { JsonObject object = new JsonObject(); @@ -55,8 +76,14 @@ public class PonderLocalization { addGeneral(object, PonderTooltipHandler.SUBJECT, "Subject of this scene"); addGeneral(object, PonderUI.PONDERING, "Pondering about..."); addGeneral(object, PonderUI.IDENTIFY_MODE, "Identify mode active.\nUnpause with [%1$s]"); + addGeneral(object, PonderTagScreen.ASSOCIATED, "Associated Entries"); shared.forEach((k, v) -> object.addProperty(Create.ID + "." + langKeyForShared(k), v)); + tag.forEach((k, v) -> { + object.addProperty(Create.ID + "." + langKeyForTag(k), v.getFirst()); + object.addProperty(Create.ID + "." + langKeyForTagDescription(k), v.getSecond()); + }); + specific.forEach((rl, map) -> { String component = rl.getPath(); for (int i = 0; i < map.size(); i++) { @@ -84,4 +111,12 @@ public class PonderLocalization { return LANG_PREFIX + "shared." + k; } + protected static String langKeyForTag(String k) { + return LANG_PREFIX + "tag." + k; + } + + protected static String langKeyForTagDescription(String k) { + return LANG_PREFIX + "tag." + k + ".description"; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java index 0b93608c9..fe804fc53 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java @@ -107,6 +107,7 @@ public class PonderRegistry { public static JsonElement provideLangEntries() { PonderIndex.register(); + PonderTag.register(); SharedText.gatherText(); all.forEach((id, list) -> { for (int i = 0; i < list.size(); i++) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java index 8421df99e..87c56e7f0 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java @@ -1,6 +1,9 @@ package com.simibubi.create.foundation.ponder; +import java.util.List; + import com.google.common.base.Strings; +import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.ponder.content.PonderIndexScreen; import com.simibubi.create.foundation.ponder.content.PonderTagScreen; @@ -8,6 +11,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.LerpedFloat; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.screen.Screen; @@ -21,8 +25,6 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.event.RenderTooltipEvent; -import java.util.List; - public class PonderTooltipHandler { static LerpedFloat holdWProgress = LerpedFloat.linear() @@ -78,6 +80,9 @@ public class PonderTooltipHandler { if (!subject && InputMappings.isKeyDown(window, keyCode)) { if (value >= 1) { + if (currentScreen instanceof AbstractSimiScreen) + ((AbstractSimiScreen) currentScreen).centerScalingOnMouse(); + ScreenOpener.transitionTo(PonderUI.of(stack)); holdWProgress.startWithValue(0); return; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 6b30e3cfc..6118475b1 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -1,14 +1,38 @@ package com.simibubi.create.foundation.ponder; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.IntStream; + +import org.apache.commons.lang3.mutable.MutableBoolean; +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; -import com.simibubi.create.foundation.gui.*; +import com.simibubi.create.foundation.gui.AbstractSimiScreen; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.gui.AllIcons; +import com.simibubi.create.foundation.gui.GuiGameElement; +import com.simibubi.create.foundation.gui.ScreenOpener; +import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.ponder.PonderScene.SceneTransform; -import com.simibubi.create.foundation.ponder.content.*; +import com.simibubi.create.foundation.ponder.content.DebugScenes; +import com.simibubi.create.foundation.ponder.content.PonderChapter; +import com.simibubi.create.foundation.ponder.content.PonderIndex; +import com.simibubi.create.foundation.ponder.content.PonderTag; +import com.simibubi.create.foundation.ponder.content.PonderTagScreen; import com.simibubi.create.foundation.ponder.ui.PonderButton; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; -import com.simibubi.create.foundation.utility.*; +import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.ColorHelper; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.LerpedFloat; import com.simibubi.create.foundation.utility.LerpedFloat.Chaser; +import com.simibubi.create.foundation.utility.Pair; +import com.simibubi.create.foundation.utility.Pointing; + import net.minecraft.client.ClipboardHelper; import net.minecraft.client.GameSettings; import net.minecraft.client.MainWindow; @@ -28,13 +52,6 @@ import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.registries.ForgeRegistries; -import org.apache.commons.lang3.mutable.MutableBoolean; -import org.lwjgl.opengl.GL11; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.IntStream; public class PonderUI extends AbstractSimiScreen { @@ -61,10 +78,11 @@ public class PonderUI extends AbstractSimiScreen { private LerpedFloat lazyIndex; private int index = 0; - private PonderButton left, right, icon, scan, chap; + private PonderButton left, right, scan, chap; public static PonderUI of(ItemStack item) { - return new PonderUI(PonderRegistry.compile(item.getItem().getRegistryName())); + return new PonderUI(PonderRegistry.compile(item.getItem() + .getRegistryName())); } public static PonderUI of(PonderChapter chapter) { @@ -74,9 +92,17 @@ public class PonderUI extends AbstractSimiScreen { } public PonderUI(List scenes) { + ResourceLocation component = scenes.get(0).component; + if (ForgeRegistries.ITEMS.containsKey(component)) + stack = new ItemStack(ForgeRegistries.ITEMS.getValue(component)); + else + stack = new ItemStack(ForgeRegistries.BLOCKS.getValue(component)); + + tags = new ArrayList<>(PonderRegistry.tags.getTags(component)); this.scenes = scenes; if (scenes.isEmpty()) { - List l = Collections.singletonList(new PonderStoryBoardEntry(DebugScenes::empty, "debug/scene_1", new ResourceLocation("minecraft", "stick"))); + List l = Collections.singletonList(new PonderStoryBoardEntry(DebugScenes::empty, + "debug/scene_1", new ResourceLocation("minecraft", "stick"))); scenes.addAll(PonderRegistry.compile(l)); } lazyIndex = LerpedFloat.linear() @@ -94,43 +120,31 @@ public class PonderUI extends AbstractSimiScreen { super.init(); widgets.clear(); - ResourceLocation component = scenes.get(0).component; - if (ForgeRegistries.ITEMS.containsKey(component)) - stack = new ItemStack(ForgeRegistries.ITEMS.getValue(component)); - else - stack = new ItemStack(ForgeRegistries.BLOCKS.getValue(component)); - - tags = new ArrayList<>(PonderRegistry.tags.getTags(component)); tagButtons = new ArrayList<>(); tagFades = new ArrayList<>(); - tags.forEach(t -> { int i = tagButtons.size(); int x = 31; - int y = 91 + i * 40; - PonderButton b = new PonderButton(x, y, () -> { + int y = 71 + i * 30; + PonderButton b = new PonderButton(x, y, (mouseX, mouseY) -> { + centerScalingOn(mouseX, mouseY); ScreenOpener.transitionTo(new PonderTagScreen(t)); - }) - .showing(t) - .fade(0, -1); + }).showing(t); widgets.add(b); tagButtons.add(b); LerpedFloat chase = LerpedFloat.linear() - .startWithValue(0) - .chase(0, .05f, Chaser.exp(.1)); + .startWithValue(0) + .chase(0, .05f, Chaser.exp(.1)); tagFades.add(chase); }); - widgets.add(icon = new PonderButton(31, 31, () -> { - }).showing(stack).fade(0, -1)); - if (chapter != null) { widgets.add(chap = new PonderButton(width - 31 - 24, 31, () -> { - }).showing(chapter).fade(0, -1)); + }).showing(chapter)); } GameSettings bindings = minecraft.gameSettings; @@ -350,19 +364,30 @@ public class PonderUI extends AbstractSimiScreen { // Chapter title RenderSystem.pushMatrix(); RenderSystem.translated(0, 0, 800); - int x = icon.x + icon.getWidth() + 8; - int y = icon.y; + int x = 31 + 20 + 8; + int y = 31; - UIRenderHelper.streak(0, x - 4, y + 10, 26, (int) (150 * fade), 0x101010); + String title = activeScene.getTitle(); + int wordWrappedHeight = font.getWordWrappedHeight(title, left.x); - drawString(font, Lang.translate(PONDERING), x, y, 0xffa3a3a3); - y += 12; + int streakHeight = 35 - 9 + wordWrappedHeight; + UIRenderHelper.streak(0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (150 * fade), 0x101010); + UIRenderHelper.streak(180, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (30 * fade), 0x101010); + renderBox(21, 21, 30, 30, false); + + GuiGameElement.of(stack) + .at(x - 39, y - 11) + .scale(2) + .render(); + + drawString(font, Lang.translate(PONDERING), x, y - 6, 0xffa3a3a3); + y += 8; x += 0; - //RenderSystem.translated(0, 3 * (indexDiff), 0); + // RenderSystem.translated(0, 3 * (indexDiff), 0); RenderSystem.translated(x, y, 0); RenderSystem.rotatef(indexDiff * -75, 1, 0, 0); RenderSystem.translated(0, 0, 5); - font.drawSplitString(activeScene.getTitle(), 0, 0, left.x, ColorHelper.applyAlpha(textColor, 1 - indexDiff)); + font.drawSplitString(title, 0, 0, left.x, ColorHelper.applyAlpha(textColor, 1 - indexDiff)); RenderSystem.popMatrix(); if (chapter != null) { @@ -372,7 +397,8 @@ public class PonderUI extends AbstractSimiScreen { UIRenderHelper.streak(180, 4, 10, 26, (int) (150 * fade), 0x101010); drawRightAlignedString(font, Lang.translate(IN_CHAPTER), 0, 0, 0xffa3a3a3); - drawRightAlignedString(font, Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee); + drawRightAlignedString(font, + Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()), 0, 12, 0xffeeeeee); RenderSystem.popMatrix(); } @@ -448,43 +474,47 @@ public class PonderUI extends AbstractSimiScreen { RenderSystem.popMatrix(); } - //Tags + // Tags List sceneTags = activeScene.tags; boolean highlightAll = sceneTags.contains(PonderTag.Highlight.ALL); - double s = Minecraft.getInstance().getWindow().getGuiScaleFactor(); - IntStream.range(0, tagButtons.size()).forEach(i -> { - RenderSystem.pushMatrix(); - LerpedFloat chase = tagFades.get(i); - PonderButton button = tagButtons.get(i); - if (button.isMouseOver(mouseX, mouseY)) { - chase.updateChaseTarget(1); - } else - chase.updateChaseTarget(0); + double s = Minecraft.getInstance() + .getWindow() + .getGuiScaleFactor(); + IntStream.range(0, tagButtons.size()) + .forEach(i -> { + RenderSystem.pushMatrix(); + LerpedFloat chase = tagFades.get(i); + PonderButton button = tagButtons.get(i); + if (button.isMouseOver(mouseX, mouseY)) { + chase.updateChaseTarget(1); + } else + chase.updateChaseTarget(0); - chase.tickChaser(); + chase.tickChaser(); - if (highlightAll || sceneTags.contains(this.tags.get(i))) - button.flash(); - else - button.dim(); + if (highlightAll || sceneTags.contains(this.tags.get(i))) + button.flash(); + else + button.dim(); - int x = button.x + button.getWidth() + 4; - int y = button.y - 2; - RenderSystem.translated(x, y + 5 * (1 - fade), 0); + int x = button.x + button.getWidth() + 4; + int y = button.y - 2; + RenderSystem.translated(x, y + 5 * (1 - fade), 800); - float fadedWidth = 200 * chase.getValue(partialTicks); - UIRenderHelper.streak(0, 0, 12, 26, (int) fadedWidth, 0x101010); + float fadedWidth = 200 * chase.getValue(partialTicks); + UIRenderHelper.streak(0, 0, 12, 26, (int) fadedWidth, 0x101010); - GL11.glScissor((int) (x * s), 0, (int) (fadedWidth * s), (int) (height * s)); - GL11.glEnable(GL11.GL_SCISSOR_TEST); + GL11.glScissor((int) (x * s), 0, (int) (fadedWidth * s), (int) (height * s)); + GL11.glEnable(GL11.GL_SCISSOR_TEST); - String tagName = Lang.translate("ponder.tag." + this.tags.get(i).getId()); - drawString(tagName, 3, 8, 0xffeedd); + String tagName = this.tags.get(i) + .getTitle(); + drawString(tagName, 3, 8, 0xffeedd); - GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glDisable(GL11.GL_SCISSOR_TEST); - RenderSystem.popMatrix(); - }); + RenderSystem.popMatrix(); + }); } protected void lowerButtonGroup(int index, int mouseX, int mouseY, float fade, AllIcons icon, KeyBinding key) { @@ -523,7 +553,7 @@ public class PonderUI extends AbstractSimiScreen { return; if (w instanceof PonderButton) { PonderButton mtdButton = (PonderButton) w; - mtdButton.runCallback(); + mtdButton.runCallback(x, y); handled.setTrue(); return; } @@ -587,7 +617,9 @@ public class PonderUI extends AbstractSimiScreen { if (chapter != null) return Lang.translate(PonderLocalization.LANG_PREFIX + "chapter." + chapter.getId()); - return stack.getItem().getName().getFormattedText(); + return stack.getItem() + .getName() + .getFormattedText(); } public FontRenderer getFontRenderer() { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java new file mode 100644 index 000000000..855b80413 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java @@ -0,0 +1,27 @@ +package com.simibubi.create.foundation.ponder.content; + +import com.simibubi.create.foundation.ponder.SceneBuilder; +import com.simibubi.create.foundation.ponder.SceneBuildingUtil; + +import net.minecraft.util.Direction; + +public class MovementActorScenes { + + public static void psiTransfer(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("Contraption Storage Exchange"); + scene.configureBasePlate(0, 0, 6); + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); + + } + + public static void psiRedstone(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("Redstone Control"); + scene.configureBasePlate(0, 0, 6); + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + scene.world.showSection(util.select.layersFrom(1), Direction.DOWN); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java index 0e6b00894..ad9371231 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.ponder.content; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.ponder.PonderRegistry; + import net.minecraft.block.Blocks; import net.minecraft.item.Items; @@ -16,8 +17,10 @@ public class PonderIndex { // (!) Modifications inside storyboard methods only require re-opening the ui PonderRegistry.forComponents(AllBlocks.SHAFT) - .addStoryBoard("shaft/relay", KineticsScenes::shaftAsRelay, b -> b.highlightAllTags().chapter(PonderChapter.of("basic_kinetics"))) - .addStoryBoard("shaft/encasing", KineticsScenes::shaftsCanBeEncased, b -> b.chapter(PonderChapter.of("encasing"))); + .addStoryBoard("shaft/relay", KineticsScenes::shaftAsRelay, b -> b.highlightAllTags() + .chapter(PonderChapter.of("basic_kinetics"))) + .addStoryBoard("shaft/encasing", KineticsScenes::shaftsCanBeEncased, + b -> b.chapter(PonderChapter.of("encasing"))); // Funnels PonderRegistry.addStoryBoard(AllBlocks.BRASS_FUNNEL, "funnels/brass", FunnelScenes::brass); @@ -28,7 +31,7 @@ public class PonderIndex { .addStoryBoard("funnels/redstone", FunnelScenes::redstone) .addStoryBoard("funnels/transposer", FunnelScenes::transposer); PonderRegistry.addStoryBoard(AllBlocks.ANDESITE_FUNNEL, "funnels/brass", FunnelScenes::brass); - + // Gantries PonderRegistry.addStoryBoard(AllBlocks.GANTRY_SHAFT, "gantry/intro", GantryScenes::introForShaft); PonderRegistry.addStoryBoard(AllBlocks.GANTRY_CARRIAGE, "gantry/intro", GantryScenes::introForPinion); @@ -37,6 +40,11 @@ public class PonderIndex { .addStoryBoard("gantry/direction", GantryScenes::direction) .addStoryBoard("gantry/subgantry", GantryScenes::subgantry); + // Movement Actors + PonderRegistry.forComponents(AllBlocks.PORTABLE_STORAGE_INTERFACE) + .addStoryBoard("portable_interface/transfer", MovementActorScenes::psiTransfer) + .addStoryBoard("portable_interface/redstone", MovementActorScenes::psiRedstone); + // Debug scenes, can be found in game via the Brass Hand if (EDITOR_MODE) DebugScenes.registerAll(); @@ -45,26 +53,22 @@ public class PonderIndex { public static void registerTags() { PonderRegistry.tags.forItems(AllBlocks.SHAFT.getId()) - .add(PonderTag.Create.KINETICS); + .add(PonderTag.KINETICS); PonderRegistry.tags.forItems(AllBlocks.ANDESITE_FUNNEL.getId(), AllBlocks.BRASS_FUNNEL.getId()) - .add(PonderTag.Create.ARM_ACCESS) - .add(PonderTag.Vanilla.ITEM_TRANSFER) - .add(PonderTag.Vanilla.REDSTONE_CONTROL); + .add(PonderTag.ARM_ACCESS) + .add(PonderTag.ITEM_TRANSFER) + .add(PonderTag.REDSTONE_CONTROL); - PonderRegistry.tags.forTag(PonderTag.Vanilla.REDSTONE_CONTROL) - .add(Items.REDSTONE.getRegistryName()) - .add(Blocks.LEVER.getRegistryName()); + PonderRegistry.tags.forTag(PonderTag.REDSTONE_CONTROL) + .add(Items.REDSTONE.getRegistryName()) + .add(Blocks.LEVER.getRegistryName()); - PonderRegistry.tags.forTag(PonderTag.Create.KINETICS) - .add(AllBlocks.COGWHEEL.getId()) - .add(AllBlocks.LARGE_COGWHEEL.getId()) - .add(AllItems.BELT_CONNECTOR.getId()) - .add(AllBlocks.ENCASED_CHAIN_DRIVE.getId()); - - PonderChapter.of("basic_kinetics").addTagsToChapter( - PonderTag.Create.KINETICS - ); + PonderRegistry.tags.forTag(PonderTag.KINETICS) + .add(AllBlocks.COGWHEEL.getId()) + .add(AllBlocks.LARGE_COGWHEEL.getId()) + .add(AllItems.BELT_CONNECTOR.getId()) + .add(AllBlocks.ENCASED_CHAIN_DRIVE.getId()); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java index 542148e96..a8176db77 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java @@ -63,9 +63,11 @@ public class PonderIndexScreen extends AbstractSimiScreen { //todo at some point pagination or horizontal scrolling may be needed for chapters/items for (PonderChapter chapter : chapters) { - ChapterLabel label = new ChapterLabel(chapter, chapterCenterX + layout.getX(), chapterCenterY + layout.getY(), () -> { - ScreenOpener.transitionTo(PonderUI.of(chapter)); - }); + ChapterLabel label = new ChapterLabel(chapter, chapterCenterX + layout.getX(), + chapterCenterY + layout.getY(), (mouseX, mouseY) -> { + centerScalingOn(mouseX, mouseY); + ScreenOpener.transitionTo(PonderUI.of(chapter)); + }); widgets.add(label); layout.next(); @@ -98,7 +100,7 @@ public class PonderIndexScreen extends AbstractSimiScreen { int itemCenterY = (int) (height * itemYmult); for (Item item : items) { - PonderButton button = new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, () -> {}) + PonderButton button = new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, (x, y) -> {}) .showing(new ItemStack(item)); button.fade(1); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java index c960b8f01..6e4679494 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java @@ -4,6 +4,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.IScreenRenderable; +import com.simibubi.create.foundation.ponder.PonderLocalization; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; import net.minecraft.item.Item; @@ -15,11 +17,44 @@ import net.minecraftforge.api.distmarker.OnlyIn; public class PonderTag implements IScreenRenderable { + // + + public static final PonderTag + + KINETICS = new PonderTag("kinetics").item(AllBlocks.COGWHEEL.get() + .asItem(), true, false) + .defaultLang("Kinetic Blocks", "Components which help generating, relaying and making use of Rotational Force"), + FLUID_TRANSFER = new PonderTag("fluid_transfer").idAsIcon(), + OPEN_INVENTORY = new PonderTag("open_inventory").item(AllBlocks.BASIN.get() + .asItem()), + ARM_ACCESS = new PonderTag("arm_access").item(AllBlocks.MECHANICAL_ARM.get() + .asItem()) + .defaultLang("Targets for Mechanical Arms", + "Components which can be selected as inputs or outputs to the Mechanical Arm"), + REDSTONE_CONTROL = new PonderTag("redstone_control").item(Items.REDSTONE, true, false), + ITEM_TRANSFER = new PonderTag("item_transfer").idAsIcon(); + + public static class Highlight { + public static final PonderTag ALL = new PonderTag("_all"); + } + + // + private final String id; private ResourceLocation icon; private ItemStack itemIcon = ItemStack.EMPTY; private ItemStack mainItem = ItemStack.EMPTY; + public String getTitle() { + return PonderLocalization.getTag(id); + } + + public String getDescription() { + return PonderLocalization.getTagDescription(id); + } + + // Builder + public PonderTag(String id) { this.id = id; } @@ -28,6 +63,11 @@ public class PonderTag implements IScreenRenderable { return id; } + public PonderTag defaultLang(String title, String description) { + PonderLocalization.registerTag(id, title, description); + return this; + } + public ItemStack getMainItem() { return mainItem; } @@ -46,8 +86,10 @@ public class PonderTag implements IScreenRenderable { } public PonderTag item(Item item, boolean useAsIcon, boolean useAsMainItem) { - if (useAsIcon) this.itemIcon = new ItemStack(item); - if (useAsMainItem) this.mainItem = new ItemStack(item); + if (useAsIcon) + this.itemIcon = new ItemStack(item); + if (useAsMainItem) + this.mainItem = new ItemStack(item); return this; } @@ -57,32 +99,23 @@ public class PonderTag implements IScreenRenderable { RenderSystem.pushMatrix(); RenderSystem.translated(x, y, 0); if (icon != null) { - Minecraft.getInstance().getTextureManager().bindTexture(icon); + Minecraft.getInstance() + .getTextureManager() + .bindTexture(icon); RenderSystem.scaled(0.25, 0.25, 1); - //x and y offset, blit z offset, tex x and y, tex width and height, entire tex sheet width and height + // x and y offset, blit z offset, tex x and y, tex width and height, entire tex + // sheet width and height AbstractGui.blit(0, 0, 0, 0, 0, 64, 64, 64, 64); } else if (!itemIcon.isEmpty()) { RenderSystem.translated(-4, -4, 0); - RenderSystem.scaled(1.5, 1.5, 1); - GuiGameElement.of(itemIcon).render(); + RenderSystem.scaled(1.5, 1.5, 1.5); + GuiGameElement.of(itemIcon) + .render(); } RenderSystem.popMatrix(); } - public static class Create { - public static final PonderTag KINETICS = new PonderTag("kinetics").item(AllBlocks.COGWHEEL.get().asItem(), true, false); - public static final PonderTag FLUID_TRANSFER = new PonderTag("fluid_transfer").idAsIcon(); + // Load class + public static void register() {} - public static final PonderTag OPEN_INVENTORY = new PonderTag("open_inventory").item(AllBlocks.BASIN.get().asItem()); - public static final PonderTag ARM_ACCESS = new PonderTag("arm_access").item(AllBlocks.MECHANICAL_ARM.get().asItem()); - } - - public static class Vanilla { - public static final PonderTag REDSTONE_CONTROL = new PonderTag("redstone_control").item(Items.REDSTONE, true, false); - public static final PonderTag ITEM_TRANSFER = new PonderTag("item_transfer").idAsIcon(); - } - - public static class Highlight { - public static final PonderTag ALL = new PonderTag("_all"); - } } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java index 1281a1ba0..0fef32306 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java @@ -1,16 +1,23 @@ package com.simibubi.create.foundation.ponder.content; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.apache.commons.lang3.mutable.MutableBoolean; + import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.AbstractSimiScreen; -import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.gui.UIRenderHelper; +import com.simibubi.create.foundation.ponder.PonderLocalization; import com.simibubi.create.foundation.ponder.PonderRegistry; import com.simibubi.create.foundation.ponder.PonderUI; import com.simibubi.create.foundation.ponder.ui.ChapterLabel; import com.simibubi.create.foundation.ponder.ui.LayoutHelper; import com.simibubi.create.foundation.ponder.ui.PonderButton; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.Block; import net.minecraft.client.MainWindow; import net.minecraft.client.gui.widget.Widget; @@ -20,12 +27,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; import net.minecraftforge.registries.ForgeRegistries; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - public class PonderTagScreen extends AbstractSimiScreen { + public static final String ASSOCIATED = PonderLocalization.LANG_PREFIX + "associated"; + protected final PonderTag tag; protected final List items; private final double itemXmult = 0.5; @@ -35,12 +40,11 @@ public class PonderTagScreen extends AbstractSimiScreen { private final double chapterXmult = 0.5; private final double chapterYmult = 0.75; protected Rectangle2d chapterArea; - private final double mainXmult = 0.5; +// private final double mainXmult = 0.5; private final double mainYmult = 0.15; private ItemStack hoveredItem = ItemStack.EMPTY; - public PonderTagScreen(PonderTag tag) { this.tag = tag; items = new ArrayList<>(); @@ -52,21 +56,21 @@ public class PonderTagScreen extends AbstractSimiScreen { super.init(); widgets.clear(); - //items + // items items.clear(); PonderRegistry.tags.getItems(tag) - .stream() - .map(key -> { - Item item = ForgeRegistries.ITEMS.getValue(key); - if (item == null) { - Block b = ForgeRegistries.BLOCKS.getValue(key); - if (b != null) - item = b.asItem(); - } - return item; - }) - .filter(Objects::nonNull) - .forEach(items::add); + .stream() + .map(key -> { + Item item = ForgeRegistries.ITEMS.getValue(key); + if (item == null) { + Block b = ForgeRegistries.BLOCKS.getValue(key); + if (b != null) + item = b.asItem(); + } + return item; + }) + .filter(Objects::nonNull) + .forEach(items::add); int rowCount = MathHelper.clamp((int) Math.ceil(items.size() / 11d), 1, 3); LayoutHelper layout = LayoutHelper.centeredHorizontal(items.size(), rowCount, 28, 28, 8); @@ -75,15 +79,20 @@ public class PonderTagScreen extends AbstractSimiScreen { int itemCenterY = (int) (height * itemYmult); for (Item i : items) { - PonderButton button = new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, () -> {}) - .showing(new ItemStack(i)); + PonderButton button = + new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, (mouseX, mouseY) -> { + if (!PonderRegistry.all.containsKey(i.getRegistryName())) + return; + centerScalingOn(mouseX, mouseY); + ScreenOpener.transitionTo(PonderUI.of(new ItemStack(i))); + }).showing(new ItemStack(i)); button.fade(1); widgets.add(button); layout.next(); } - //chapters + // chapters chapters.clear(); chapters.addAll(PonderRegistry.tags.getChapters(tag)); @@ -94,9 +103,11 @@ public class PonderTagScreen extends AbstractSimiScreen { int chapterCenterY = (int) (height * chapterYmult); for (PonderChapter chapter : chapters) { - ChapterLabel label = new ChapterLabel(chapter, chapterCenterX + layout.getX(), chapterCenterY + layout.getY(), () -> { - ScreenOpener.transitionTo(PonderUI.of(chapter)); - }); + ChapterLabel label = new ChapterLabel(chapter, chapterCenterX + layout.getX(), + chapterCenterY + layout.getY(), (mouseX, mouseY) -> { + centerScalingOn(mouseX, mouseY); + ScreenOpener.transitionTo(PonderUI.of(chapter)); + }); widgets.add(label); layout.next(); @@ -127,45 +138,89 @@ public class PonderTagScreen extends AbstractSimiScreen { renderChapters(mouseX, mouseY, partialTicks); // - int x = (int) (width * mainXmult); - int y = (int) (height * mainYmult); +// int x = (int) (width * mainXmult); +// int y = (int) (height * mainYmult); +// +// RenderSystem.pushMatrix(); +// RenderSystem.translated(x, y, 0); +// RenderSystem.translated(-150, 0, 0); +// +// if (!tag.getMainItem() +// .isEmpty()) { +// RenderSystem.translated(-25, 0, 0); +// PonderUI.renderBox(0, -10, 20, 20, false); +// RenderSystem.pushMatrix(); +// RenderSystem.translated(-2, -12, 0); +// RenderSystem.scaled(1.5, 1.5, 1); +// GuiGameElement.of(tag.getMainItem()) +// .render(); +// +// RenderSystem.popMatrix(); +// +// RenderSystem.translated(75, 0, 0); +// +// } +// +// RenderSystem.pushMatrix(); +//// RenderSystem.scaled(1.5, 1.5, 1); +// +// // render icon & box +// PonderUI.renderBox(-8, -20, 40, 40, false); +// RenderSystem.translated(0, -10, 100); +// RenderSystem.scaled(1.5, 1.5, 1); +// tag.draw(this, 0, 0); +// +// RenderSystem.popMatrix(); +// +// // tag name & description +// UIRenderHelper.streak(0, 36, 0, 39, 350, 0x101010); +// drawString(font, Lang.translate("ponder.tag." + tag.getId()), 41, -16, 0xffff_ffff); +// drawString(font, Lang.translate("ponder.tag." + tag.getId() + ".desc"), 41, -4, 0xffff_ffff); +// +// RenderSystem.popMatrix(); RenderSystem.pushMatrix(); + RenderSystem.translated(width / 2 - 120, height * mainYmult - 40, 0); + + RenderSystem.pushMatrix(); + RenderSystem.translated(0, 0, 800); + int x = 31 + 20 + 8; + int y = 31; + + String title = tag.getTitle(); + + int streakHeight = 35; + UIRenderHelper.streak(0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (240), 0x101010); + PonderUI.renderBox(21, 21, 30, 30, false); + + drawString(font, Lang.translate(PonderUI.PONDERING), x, y - 6, 0xffa3a3a3); + y += 8; + x += 0; + // RenderSystem.translated(0, 3 * (indexDiff), 0); RenderSystem.translated(x, y, 0); - RenderSystem.translated(-150, 0, 0); - - if (!tag.getMainItem().isEmpty()) { - RenderSystem.translated(-25, 0, 0); - PonderUI.renderBox(0, -10, 20, 20, false); - RenderSystem.pushMatrix(); - RenderSystem.translated(-2, -12, 0); - RenderSystem.scaled(1.5, 1.5, 1); - GuiGameElement.of(tag.getMainItem()).render(); - - RenderSystem.popMatrix(); - - RenderSystem.translated(75, 0, 0); - - } + RenderSystem.translated(0, 0, 5); + font.drawString(title, 0, 0, 0xeeeeee); + RenderSystem.popMatrix(); RenderSystem.pushMatrix(); - RenderSystem.scaled(1.5, 1.5, 1); - - - //render icon & box - PonderUI.renderBox(0, -10, 20, 20, true); - RenderSystem.translated(2, 2 - 10, 100); + RenderSystem.translated(23, 23, 0); + RenderSystem.scaled(1.66, 1.66, 1.66); tag.draw(this, 0, 0); - + RenderSystem.popMatrix(); RenderSystem.popMatrix(); - //tag name & description - UIRenderHelper.streak(0, 36, 0, 39, 350, 0x101010); - drawString(font, Lang.translate("ponder.tag." + tag.getId()), 41, -16, 0xffff_ffff); - drawString(font, Lang.translate("ponder.tag." + tag.getId() + ".desc"), 41, -4, 0xffff_ffff); + RenderSystem.pushMatrix(); + int w = (int) (width * .45); + x = (width - w) / 2; + y = (int) (height * itemYmult + itemArea.getHeight() + 20); + String desc = tag.getDescription(); + int h = font.getWordWrappedHeight(desc, w); + + PonderUI.renderBox(x - 3, y - 3, w + 6, h + 6, false); + RenderSystem.translated(0, 0, 100); + font.drawSplitString(desc, x, y, w, 0xeeeeee); RenderSystem.popMatrix(); - } protected void renderItems(int mouseX, int mouseY, float partialTicks) { @@ -175,14 +230,19 @@ public class PonderTagScreen extends AbstractSimiScreen { int x = (int) (width * itemXmult); int y = (int) (height * itemYmult); + String relatedTitle = Lang.translate(ASSOCIATED); + int stringWidth = font.getStringWidth(relatedTitle); + RenderSystem.pushMatrix(); RenderSystem.translated(x, y, 0); + PonderUI.renderBox((sWidth - stringWidth) / 2 - 5, itemArea.getY() - 21, stringWidth + 10, 10, false); + RenderSystem.translated(0, 0, 200); - UIRenderHelper.streak(0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 180, 0x101010); - drawString(font, "Related Items", itemArea.getX() - 5, itemArea.getY() - 25, 0xffddeeff); +// UIRenderHelper.streak(0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 180, 0x101010); + drawCenteredString(font, relatedTitle, sWidth / 2, itemArea.getY() - 20, 0xeeeeee); - UIRenderHelper.streak(0, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth()/2 + 75, 0x101010); - UIRenderHelper.streak(180, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth()/2 + 75, 0x101010); + UIRenderHelper.streak(0, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75, 0x101010); + UIRenderHelper.streak(180, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75, 0x101010); RenderSystem.popMatrix(); @@ -221,11 +281,32 @@ public class PonderTagScreen extends AbstractSimiScreen { @Override protected String getBreadcrumbTitle() { - return Lang.translate("ponder.tag." + tag.getId()); + return tag.getTitle(); } public ItemStack getHoveredTooltipItem() { return hoveredItem; } + @Override + public boolean mouseClicked(double x, double y, int button) { + MutableBoolean handled = new MutableBoolean(false); + widgets.forEach(w -> { + if (handled.booleanValue()) + return; + if (!w.isMouseOver(x, y)) + return; + if (w instanceof PonderButton) { + PonderButton mtdButton = (PonderButton) w; + mtdButton.runCallback(x, y); + handled.setTrue(); + return; + } + }); + + if (handled.booleanValue()) + return true; + return super.mouseClicked(x, y, button); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java index a912f324a..62f680df6 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java @@ -1,9 +1,13 @@ package com.simibubi.create.foundation.ponder.ui; +import java.util.function.BiConsumer; + +import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import com.simibubi.create.foundation.ponder.content.PonderChapter; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.client.Minecraft; public class ChapterLabel extends AbstractSimiWidget { @@ -11,7 +15,7 @@ public class ChapterLabel extends AbstractSimiWidget { private final PonderChapter chapter; private final PonderButton button; - public ChapterLabel(PonderChapter chapter, int x, int y, Runnable onClick) { + public ChapterLabel(PonderChapter chapter, int x, int y, BiConsumer onClick) { super(x, y, 175, 38); this.button = new PonderButton(x + 4, y + 4, onClick, 30, 30).showing(chapter); @@ -22,8 +26,9 @@ public class ChapterLabel extends AbstractSimiWidget { @Override public void render(int mouseX, int mouseY, float partialTicks) { - UIRenderHelper.streak(0, x, y + height/2, height - 2, width, 0x101010); - drawString(Minecraft.getInstance().fontRenderer, Lang.translate("ponder.chapter." + chapter.getId()), x + 50, y + 20, 0xffddeeff); + UIRenderHelper.streak(0, x, y + height / 2, height - 2, width, 0x101010); + drawString(Minecraft.getInstance().fontRenderer, Lang.translate("ponder.chapter." + chapter.getId()), x + 50, + y + 20, 0xffddeeff); button.renderButton(mouseX, mouseY, partialTicks); super.render(mouseX, mouseY, partialTicks); @@ -34,6 +39,6 @@ public class ChapterLabel extends AbstractSimiWidget { if (!button.isMouseOver(x, y)) return; - button.runCallback(); + button.runCallback(x, y); } } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java index 8ba55e22a..9e3e4cb1a 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.ponder.ui; +import java.util.function.BiConsumer; + import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.IScreenRenderable; @@ -8,6 +10,7 @@ import com.simibubi.create.foundation.ponder.PonderUI; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.LerpedFloat; + import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.ItemStack; @@ -17,7 +20,7 @@ public class PonderButton extends AbstractSimiWidget { private IScreenRenderable icon; private ItemStack item; protected boolean pressed; - private Runnable onClick; + private BiConsumer onClick; private int xFadeModifier; private int yFadeModifier; private float fade; @@ -26,14 +29,19 @@ public class PonderButton extends AbstractSimiWidget { public static final int SIZE = 20; - public PonderButton(int x, int y, Runnable onClick, int width, int height) { + public PonderButton(int x, int y, BiConsumer onClick, int width, int height) { super(x, y, width, height); this.onClick = onClick; - flash = LerpedFloat.linear().startWithValue(0); + flash = LerpedFloat.linear() + .startWithValue(0); + } + + public PonderButton(int x, int y, BiConsumer onClick) { + this(x, y, onClick, SIZE, SIZE); } public PonderButton(int x, int y, Runnable onClick) { - this(x, y, onClick, SIZE, SIZE); + this(x, y, ($, $$) -> onClick.run()); } public PonderButton showing(IScreenRenderable icon) { @@ -121,8 +129,8 @@ public class PonderButton extends AbstractSimiWidget { RenderSystem.popMatrix(); } - public void runCallback() { - onClick.run(); + public void runCallback(double mouseX, double mouseY) { + onClick.accept((int) mouseX, (int) mouseY); } @Override diff --git a/src/main/resources/ponder/portable_interface/redstone.nbt b/src/main/resources/ponder/portable_interface/redstone.nbt new file mode 100644 index 0000000000000000000000000000000000000000..799754288d00df99b8f78f1fe8848f7de6812711 GIT binary patch literal 667 zcmV;M0%ZLkiwFP!000000KJyaj?*v@#wW4Urd{#p00NGP7vRhdX)jz>D|XpyjbilZCvs+ zqHUh!kjf=|EG?4eOJ%GV3x$RA#)>r-QhT&3QDOqqYg41eCGGY6QW8^_r;1Dhv(heb z2H8!8glILdujr?1AN;76q)h1jSG`uae?R@c(^~2^VJ~h|0=|+fYK;-|+UKRw-o?S{voOHw)WZyh)_s97j z_G&9NmR77h@zD8^z6)v76D@LlZsjL5$LGXsBv!Zx^O5}&=F@1Vl~CwCHlL=89Qc*k zBD_D;R&S)oqBNSkqe;Eu%|YR`sf+geM!@;CH5JeQS^+u)FV9^$+^#G#~U z9W)lTv`-db)StZ{tTBCX`>6FRyDMpJl~^=~^QG|O4y}_$(?Zre5#$7xHHZ8>gp(E;1t_71ygZno6vumD3EEM2kf z#-OERi-=4LBwg3J+N1O-dcP;z4y`XomK>)0>I4`{O!9X={v^+FNXUrzn%{v(2(h05 zeyDwq$Pk3#hJz;d8IfR~%IH>y_|MlP;$>2oi>k*XR2ycXSg}8+*D|NqnA3OQcn%!j zfkPcQ<#zP}|y5=@!q zVoCg~S644X65PnOilB2rkDOfU8jLOnKY&=8#HJ}EgDWr_sctD5PFcnxZnodQw}JUL zSOjp+&?o)NI9KlaIYoO$fz~!6bf(W^GL95rFlTc}O^cpZul+OHe|&DpKa!jCW^Q_q z&CP(4@p&9Woaf}5-|UWgM7BaQx)g7*s!FvTVYmiXy2#n&T57DdZ{d}S(X+P0-At_4 zNNf%|Oe~I{i)9M=_~6I25H@EX8Q(-U5pP(!-VNpse^EHRf+%5vM=YJqfhoJ>@E|mO z@(Z6la{5{^p%=(6f zlft(J#sFzcj`|IMXyp%m%~yCFD%4j6DwE2vc?vU)s<0)@xIn`T76In!T5dpLW^qSc zaAb<8>-K3H4*m_pev9EjWw;^lFgO3CFpuJD&2@{WP2%t`5rd<|gI!|J?Y*Os+c>Rv zN+Poi^LZ$N*RV1wthC^s*0?AE-Mq$V3oZO;T5yE+(52{dDLr@veO3sh`6|Qxc8lH` z9zAqjzUaDx_8XP)rys|(D-Qqv6~{$a9P~&WzrX));~+a zw8YV=$9^0WoHNK+3dVr_-TY*Ty$V|ac~;*UTFA|8_tTn`qo3EKn}i#fMN*)Xh{TKI zT1mVB?eB7IfTFwsq6?O4z~vcJhIk-i9K%|&YmPQ}Ck@f36xWe3k&54855&^S+`W#@ z$$||~nZM0OLFuovYW|Tnq_KLCmBq4fk?Mq@7b8rVVv&JnF6uOwJ}InRGwa!`=qx%M z^nvXyf4Gu&a_+hDc+N!Q2EESV8SYL|?MrOrmWv$%pDQ+>QW@Xjx z^3)b(%rOY-SxkJR)-~&}EH^OY4VqG^TrT(YDcMwDzzMR<7Uc@;HcM;vK~;4@7a6## zC@1CFP7w5Qh$>-BE$vBMZW1`$B5tgwWv^6Hu&KIWhP?r$xx^lM_<{ThQ%CvZloJ2| DNM#~= literal 0 HcmV?d00001