From 70b8d2e998ef0d361552000de623513949def274 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 8 Jun 2022 14:46:01 +0200 Subject: [PATCH] Pressure awareness - Backtanks now warn a player when reaching 10% and 0% respectively - Pulleys can now be monitored with a Stockpile Switch - Target blocks now act as a display source for analog redstone strength --- src/generated/resources/.cache/cache | 32 ++++---- .../resources/assets/create/lang/en_us.json | 10 ++- .../assets/create/lang/unfinished/de_de.json | 10 ++- .../assets/create/lang/unfinished/es_cl.json | 10 ++- .../assets/create/lang/unfinished/es_es.json | 10 ++- .../assets/create/lang/unfinished/fr_fr.json | 10 ++- .../assets/create/lang/unfinished/it_it.json | 10 ++- .../assets/create/lang/unfinished/ja_jp.json | 10 ++- .../assets/create/lang/unfinished/ko_kr.json | 10 ++- .../assets/create/lang/unfinished/nl_nl.json | 10 ++- .../assets/create/lang/unfinished/pl_pl.json | 10 ++- .../assets/create/lang/unfinished/pt_br.json | 10 ++- .../assets/create/lang/unfinished/pt_pt.json | 10 ++- .../assets/create/lang/unfinished/ro_ro.json | 10 ++- .../assets/create/lang/unfinished/ru_ru.json | 10 ++- .../assets/create/lang/unfinished/zh_cn.json | 10 ++- .../assets/create/lang/unfinished/zh_tw.json | 10 ++- .../pulley/PulleyTileEntity.java | 23 ++++-- .../curiosities/armor/BackTankUtil.java | 46 +++++++++-- .../curiosities/armor/DivingHelmetItem.java | 2 +- .../block/display/AllDisplayBehaviours.java | 2 + .../block/display/DisplayLinkBlock.java | 6 ++ .../source/FillLevelDisplaySource.java | 67 ++-------------- .../PercentOrProgressBarDisplaySource.java | 77 +++++++++++++++++++ .../source/RedstonePowerDisplaySource.java | 58 ++++++++++++++ .../block/redstone/StockpileSwitchBlock.java | 25 +++--- .../redstone/StockpileSwitchObservable.java | 7 ++ .../redstone/StockpileSwitchTileEntity.java | 21 +++-- .../assets/create/lang/default/interface.json | 13 +++- 29 files changed, 415 insertions(+), 124 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/display/source/PercentOrProgressBarDisplaySource.java create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/display/source/RedstonePowerDisplaySource.java create mode 100644 src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchObservable.java diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 57811a3ed..ce985ea00 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -554,22 +554,22 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json 50f7862ded2d9a955c259a12685906a9ec9ad97a assets/create/lang/en_ud.json -bd11cec0a09bc17c36293f2318b3a55816ba7357 assets/create/lang/en_us.json -43dceacc12846afb41841f8e6f89fbde373aee0c assets/create/lang/unfinished/de_de.json -9c8452625f048b42cc44e92781854560fb0a31b6 assets/create/lang/unfinished/es_cl.json -287eeafaa0c3d618b992b3da200b80c30d84b469 assets/create/lang/unfinished/es_es.json -7fc00f821984d29d0f2e58a0cd9f54c107765a9d assets/create/lang/unfinished/fr_fr.json -846428c03588dcf1166b77c92efd0196044b83f2 assets/create/lang/unfinished/it_it.json -abdd740066a0152f3bce5d3368f788e4a949ec35 assets/create/lang/unfinished/ja_jp.json -6a06c83079fdba01a2a565958af15330af7988f5 assets/create/lang/unfinished/ko_kr.json -d2f791d81474467bab224cc1ed7d33209d4b533c assets/create/lang/unfinished/nl_nl.json -b0a821a5b68e8863d76bf0c26881457c640f2db1 assets/create/lang/unfinished/pl_pl.json -59826c6788b6eb792bb8180f7691296b3d16b755 assets/create/lang/unfinished/pt_br.json -3ce46ee7790faf9b5e76159795675b636beee4b9 assets/create/lang/unfinished/pt_pt.json -741cc70fc2aaedd6d79c570705d28343d76cfcf6 assets/create/lang/unfinished/ro_ro.json -5bfbf61f079563cddabb1ac02e68395a8b5ab688 assets/create/lang/unfinished/ru_ru.json -50952f6f40e77ae2ab0ac7fb0bea6a2776b14469 assets/create/lang/unfinished/zh_cn.json -edccb3df1d94493485cfb451c1f7d6dfc4a2678d assets/create/lang/unfinished/zh_tw.json +96614cd555fed5ebe7d8df6252fa50754c6791fa assets/create/lang/en_us.json +36090345672d7090a40724aa825ec4e50c480fbb assets/create/lang/unfinished/de_de.json +f365d79601113e1c4c7ecc825e12f6190c90941f assets/create/lang/unfinished/es_cl.json +93ae152cf0acab537d0aed48e812425430f67745 assets/create/lang/unfinished/es_es.json +9c41eb507db3073c26f29a56655270c0d591209d assets/create/lang/unfinished/fr_fr.json +f47c79169263e0367391d08c35b4ea0b461318ce assets/create/lang/unfinished/it_it.json +27d41aac785c80d2d12499a477ac3ce18c6d3942 assets/create/lang/unfinished/ja_jp.json +6f0f264704ae5aea0ff14db7c9c6e0ad1cfd550e assets/create/lang/unfinished/ko_kr.json +7366202ce7eada97f56bb4bdeb7b83c65fe26eaf assets/create/lang/unfinished/nl_nl.json +411f8b4197e39165d7ffb0507cb02ac9d78bec03 assets/create/lang/unfinished/pl_pl.json +dcdfe6cdbfbd89024c9f8a715a96c9ccf37d84bf assets/create/lang/unfinished/pt_br.json +c45e084905b1e8edff4d6789bb1cf8d6765171e9 assets/create/lang/unfinished/pt_pt.json +246e2e2f1b8971837b03649aa0cee46789a6c493 assets/create/lang/unfinished/ro_ro.json +f907f78cbe5ba10503fe6c46b4cc66dc13e55164 assets/create/lang/unfinished/ru_ru.json +ccd9afb8a17829570f1ee52395845f7b12aab7b3 assets/create/lang/unfinished/zh_cn.json +72fac7ef99dbb56b21a6ddb69687bb6fb9469bbb assets/create/lang/unfinished/zh_tw.json 487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json 3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 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 91c26dfe7..29b064d39 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1348,6 +1348,10 @@ "create.hint.empty_bearing": "_Right-click_ the bearing with an _empty_ _hand_ to _attach_ the structure you just built in front of it.", "create.hint.full_deployer.title": "Deployer Item Overflow", "create.hint.full_deployer": "It appears this _Deployer_ contains _excess_ _items_ that need to be _extracted._ Use a _hopper,_ _funnel_ or other means to free it from its overflow.", + + "create.backtank.low": "Backtank pressure low", + "create.backtank.depleted": "Backtank pressure depleted", + "create.hint.derailed_train.title": "Derailed Train", "create.hint.derailed_train": "It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1562,6 +1566,10 @@ "create.display_source.kinetic_stress.max": "Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "Stress Capacity (Remaining)", + "create.display_source.redstone_power": "Redstone Power", + "create.display_source.redstone_power.display": "Display Format", + "create.display_source.redstone_power.number": "Number", + "create.display_source.redstone_power.progress_bar": "Progress Bar", "create.display_target.line": "Line %1$s", "create.display_target.page": "Page %1$s", @@ -2714,4 +2722,4 @@ "_": "Thank you for translating Create!" -} +} \ No newline at end of file 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 94efdb896..e108fb09d 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: 957", + "_": "Missing Localizations: 963", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_Rechts-Klicke_ das Lager mit einer _leeren_ _Hand_ um die Struktur die du davor gebaut hast _anzubringen_.", "create.hint.full_deployer.title": "Einsatzgerät Gegenstand Überlauf", "create.hint.full_deployer": "Es scheint, dieses _Einsatzgerät_ enthält _überflüssige_ _Gegenstände_ die _extrahiert_ werden müssen. Nutze _Trichter_ oder anderes um ihn von seinem Überfluss zu befreien.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", diff --git a/src/generated/resources/assets/create/lang/unfinished/es_cl.json b/src/generated/resources/assets/create/lang/unfinished/es_cl.json index 7aa6f2639..c8b5b94ac 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_cl.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_cl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 607", + "_": "Missing Localizations: 613", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "Haz _Click-Derecho_ en el rodamiento con tu _mano_ _vacía_ para _unir_ la estructura que acabas de construir frente a él.", "create.hint.full_deployer.title": "Desbordamiento de objetos del Desplegador", "create.hint.full_deployer": "Parece que este _Desplegador_ contiene _objetos_ de _exceso_ que requieren ser _extraídos._ Usa una _tolva,_ _tolvogán_ u otros parecidos para librarlo del sobreflujo.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 7b7732ac8..49253a653 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: 271", + "_": "Missing Localizations: 277", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "Haz clic derecho sobre el rodamiento con la _mano vacía_ para _adjuntar_ la estructura que acabas de construir delante de él.", "create.hint.full_deployer.title": "Exceso de objetos en el desplegador", "create.hint.full_deployer": "Parece que este _desplegador_ contiene _exceso_ de objetos que necesitan ser _extraídos._ Usa una _tolva_, _embudo_ u otro medio para liberarlo de su excedente.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 cec422106..4b8d62eff 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: 1845", + "_": "Missing Localizations: 1851", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "UNLOCALIZED: _Right-click_ the bearing with an _empty_ _hand_ to _attach_ the structure you just built in front of it.", "create.hint.full_deployer.title": "UNLOCALIZED: Deployer Item Overflow", "create.hint.full_deployer": "UNLOCALIZED: It appears this _Deployer_ contains _excess_ _items_ that need to be _extracted._ Use a _hopper,_ _funnel_ or other means to free it from its overflow.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 804d6d74a..700cd91f6 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: 1534", + "_": "Missing Localizations: 1540", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_Clicca_ _col_ _destro_ il supporto con una _mano_ _vuota_ per _attaccarci_ la struttura che ci hai appena costruito davanti.", "create.hint.full_deployer.title": "Overflow di oggetti dell'installatore", "create.hint.full_deployer": "Sembra che questo _installatore_ contenga _oggetti_ _eccessivi_ che necessitano di essere _estratti_. Usa una _tramoggia_, un _imbuto_ o altro per liberarlo dall'overflow.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 1d9f99c77..1171530fa 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: 273", + "_": "Missing Localizations: 279", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_素手_でベアリングを_右クリック_して、その前に先ほど作った構造物を_接続_します。", "create.hint.full_deployer.title": "デプロイヤーのアイテムが溢れています", "create.hint.full_deployer": "この_デプロイヤー_には、_搬出_する必要がある余分なアイテムが含まれています。_ ホッパー_や_漏斗_などの手段を利用して、溢れないようにしてください。", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 ac4064c05..5ff614293 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: 273", + "_": "Missing Localizations: 279", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_맨 손_으로 베어링을 _우클릭_하여 구조물을 _부착_하세요.", "create.hint.full_deployer.title": "기계 손 아이템 과적", "create.hint.full_deployer": "이 _기계 손_은 _배출_할 아이템을 가지고 있습니다. 호퍼 , 퍼널 등을 이용해 아이템을 빼내세요.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 d218e274c..40ee6024c 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: 2197", + "_": "Missing Localizations: 2203", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "UNLOCALIZED: _Right-click_ the bearing with an _empty_ _hand_ to _attach_ the structure you just built in front of it.", "create.hint.full_deployer.title": "UNLOCALIZED: Deployer Item Overflow", "create.hint.full_deployer": "UNLOCALIZED: It appears this _Deployer_ contains _excess_ _items_ that need to be _extracted._ Use a _hopper,_ _funnel_ or other means to free it from its overflow.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", diff --git a/src/generated/resources/assets/create/lang/unfinished/pl_pl.json b/src/generated/resources/assets/create/lang/unfinished/pl_pl.json index 4946bb7db..de733f956 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pl_pl.json +++ b/src/generated/resources/assets/create/lang/unfinished/pl_pl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 646", + "_": "Missing Localizations: 652", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_Kliknij_ na łożysko _PPM_ pustą ręką, aby _przyczepić_ do niego strukturę zbudowaną z przodu.", "create.hint.full_deployer.title": "Nadmiar przedmiotów w aplikatorze", "create.hint.full_deployer": "Wygląda na to, że ten _aplikator_ zawiera _nadmiar_ _przedmiotów_, które muszą zostać _wyciągnięte_. Użyj _leji_, _lejków_ lub innych sposobów, aby uwolnić od przepełnienia.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 97ecf62a7..ad4555fe4 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: 1141", + "_": "Missing Localizations: 1147", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": " _clique com o botão direito_ o rolamento com a _mão_ _vazia_ para _conectar_ a estrutura que você construiu não frente disso.", "create.hint.full_deployer.title": "Implantador transbordando de itens", "create.hint.full_deployer": "Aparenta que esse _inplantador_ contém _itens_ em _excesso_ que precisam ser _extraídos._ Use um _funil,_ _funil de andesito/latão_ ou outros meios para extrair os itens excedentes.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_pt.json b/src/generated/resources/assets/create/lang/unfinished/pt_pt.json index 0283b3425..73fb1db9f 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_pt.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_pt.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1819", + "_": "Missing Localizations: 1825", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "UNLOCALIZED: _Right-click_ the bearing with an _empty_ _hand_ to _attach_ the structure you just built in front of it.", "create.hint.full_deployer.title": "UNLOCALIZED: Deployer Item Overflow", "create.hint.full_deployer": "UNLOCALIZED: It appears this _Deployer_ contains _excess_ _items_ that need to be _extracted._ Use a _hopper,_ _funnel_ or other means to free it from its overflow.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", diff --git a/src/generated/resources/assets/create/lang/unfinished/ro_ro.json b/src/generated/resources/assets/create/lang/unfinished/ro_ro.json index dfe6d6db7..90a4ad28e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ro_ro.json +++ b/src/generated/resources/assets/create/lang/unfinished/ro_ro.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 274", + "_": "Missing Localizations: 280", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "Apasă _Click-Dreapta_ pe rulment cu o _mână_ _goală_ pentru a _atașa_ structura pe care tocmai a construit-o în fața ei.", "create.hint.full_deployer.title": "Revărsare De Obiecte Deployer", "create.hint.full_deployer": "De pare că acest _Deployer_ conține _obiecte în_ _exces_ care trebuie să fie _extrase._ Folosește o _pâlnie_ sau alte mijloace pentru a-l elibera din revărsare.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 bacca5fad..68d147f4f 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: 651", + "_": "Missing Localizations: 657", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_Правый клик_ по подшипнику _пустой рукой_, чтобы _присоединить_ к нему структуру, которую вы только что построили перед ним.", "create.hint.full_deployer.title": "Переполнение автономного активатора", "create.hint.full_deployer": "Похоже, этот _автономный активатор_ содержит _лишние_ _предметы_, которые необходимо _извлечь_. Используйте _воронку_ или _другие способы_, чтобы освободить его от переполнения.", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 432cc637f..6dab2eeda 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: 271", + "_": "Missing Localizations: 277", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_空手右击_轴承,可以将你新建造的结构_接到_轴承上", "create.hint.full_deployer.title": "机械手物品溢出", "create.hint.full_deployer": "_机械手_包含_过剩的物品_,需要被_提取_,使用_漏斗_或其他方法将其从溢出中释放出来", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", 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 16743cb17..b3cd166c3 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: 665", + "_": "Missing Localizations: 671", "_": "->------------------------] Game Elements [------------------------<-", @@ -1349,6 +1349,10 @@ "create.hint.empty_bearing": "_空手右鍵_軸承來_添加_你新建造的結構。", "create.hint.full_deployer.title": "機械手物品溢出", "create.hint.full_deployer": "_機械手_包含_過剩的物品_需要被_取出._使用漏斗_或其他方法將溢出解決。", + + "create.backtank.low": "UNLOCALIZED: Backtank pressure low", + "create.backtank.depleted": "UNLOCALIZED: Backtank pressure depleted", + "create.hint.derailed_train.title": "UNLOCALIZED: Derailed Train", "create.hint.derailed_train": "UNLOCALIZED: It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -1563,6 +1567,10 @@ "create.display_source.kinetic_stress.max": "UNLOCALIZED: Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "UNLOCALIZED: Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "UNLOCALIZED: Stress Capacity (Remaining)", + "create.display_source.redstone_power": "UNLOCALIZED: Redstone Power", + "create.display_source.redstone_power.display": "UNLOCALIZED: Display Format", + "create.display_source.redstone_power.number": "UNLOCALIZED: Number", + "create.display_source.redstone_power.progress_bar": "UNLOCALIZED: Progress Bar", "create.display_target.line": "UNLOCALIZED: Line %1$s", "create.display_target.page": "UNLOCALIZED: Page %1$s", diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java index df74fa28e..88411120b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java @@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Blo import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionCollider; import com.simibubi.create.content.contraptions.components.structureMovement.ControlledContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.piston.LinearActuatorTileEntity; +import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchObservable; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; @@ -24,7 +25,7 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -public class PulleyTileEntity extends LinearActuatorTileEntity { +public class PulleyTileEntity extends LinearActuatorTileEntity implements StockpileSwitchObservable { protected int initialOffset; private float prevAnimatedOffset; @@ -90,7 +91,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { for (i = ((int) offset); i > 0; i--) { BlockPos offset = worldPosition.below(i); BlockState oldState = level.getBlockState(offset); - if (oldState.getBlock() instanceof SimpleWaterloggedBlock && oldState.hasProperty(BlockStateProperties.WATERLOGGED) + if (oldState.getBlock() instanceof SimpleWaterloggedBlock + && oldState.hasProperty(BlockStateProperties.WATERLOGGED) && oldState.getValue(BlockStateProperties.WATERLOGGED)) { level.setBlock(offset, Blocks.WATER.defaultBlockState(), 66); continue; @@ -98,7 +100,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { level.setBlock(offset, Blocks.AIR.defaultBlockState(), 66); } - if (!contraption.getBlocks().isEmpty()) { + if (!contraption.getBlocks() + .isEmpty()) { contraption.removeBlocksFromWorld(level, BlockPos.ZERO); movedContraption = ControlledContraptionEntity.create(level, this, contraption); movedContraption.setPos(anchor.getX(), anchor.getY(), anchor.getZ()); @@ -166,7 +169,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { protected Vec3 toPosition(float offset) { if (movedContraption.getContraption() instanceof PulleyContraption) { PulleyContraption contraption = (PulleyContraption) movedContraption.getContraption(); - return Vec3.atLowerCornerOf(contraption.anchor).add(0, contraption.initialOffset - offset, 0); + return Vec3.atLowerCornerOf(contraption.anchor) + .add(0, contraption.initialOffset - offset, 0); } return Vec3.ZERO; @@ -208,7 +212,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { @Override protected int getExtensionRange() { - return Math.max(0, Math.min(AllConfigs.SERVER.kinetics.maxRopeLength.get(), (worldPosition.getY() - 1) - level.getMinBuildHeight())); + return Math.max(0, Math.min(AllConfigs.SERVER.kinetics.maxRopeLength.get(), + (worldPosition.getY() - 1) - level.getMinBuildHeight())); } @Override @@ -237,4 +242,12 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { public void animateOffset(float forcedOffset) { offset = forcedOffset; } + + @Override + public float getPercent() { + int distance = worldPosition.getY() - level.getMinBuildHeight(); + if (distance <= 0) + return 100; + return 100 * getInterpolatedOffset(.5f) / distance; + } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/BackTankUtil.java b/src/main/java/com/simibubi/create/content/curiosities/armor/BackTankUtil.java index 82b3649a8..c12c2da0d 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/BackTankUtil.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/BackTankUtil.java @@ -2,11 +2,20 @@ package com.simibubi.create.content.curiosities.armor; import com.simibubi.create.AllEnchantments; import com.simibubi.create.AllItems; +import com.simibubi.create.AllSoundEvents; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -33,10 +42,37 @@ public class BackTankUtil { return Math.min(tag.getFloat("Air"), maxAir(backtank)); } - public static void consumeAir(ItemStack backtank, float i) { + public static void consumeAir(LivingEntity entity, ItemStack backtank, float i) { CompoundTag tag = backtank.getOrCreateTag(); - tag.putFloat("Air", Math.min(getAir(backtank) - i, maxAir(backtank))); + int maxAir = maxAir(backtank); + float air = getAir(backtank); + float newAir = air - i; + tag.putFloat("Air", Math.min(newAir, maxAir)); backtank.setTag(tag); + + if (!(entity instanceof ServerPlayer player)) + return; + sendWarning(player, air, newAir, maxAir / 10f); + sendWarning(player, air, newAir, 1); + } + + private static void sendWarning(ServerPlayer player, float air, float newAir, float threshold) { + if (newAir > threshold) + return; + if (air <= threshold) + return; + + boolean depleted = threshold == 1; + MutableComponent component = Lang.translate(depleted ? "backtank.depleted" : "backtank.low"); + + AllSoundEvents.DENY.play(player.level, null, player.blockPosition(), 1, 1.25f); + AllSoundEvents.STEAM.play(player.level, null, player.blockPosition(), .5f, .5f); + + player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 40, 10)); + player.connection.send(new ClientboundSetSubtitleTextPacket( + new TextComponent("\u26A0 ").withStyle(depleted ? ChatFormatting.RED : ChatFormatting.GOLD) + .append(component.withStyle(ChatFormatting.GRAY)))); + player.connection.send(new ClientboundSetTitleTextPacket(new TextComponent(""))); } public static int maxAir(ItemStack backtank) { @@ -63,7 +99,7 @@ public class BackTankUtil { if (!hasAirRemaining(backtank)) return false; float cost = ((float) maxAirWithoutEnchants()) / usesPerTank; - consumeAir(backtank, cost); + consumeAir(entity, backtank, cost); return true; } @@ -105,8 +141,8 @@ public class BackTankUtil { return 0; ItemStack backtank = get(player); if (backtank.isEmpty() || !hasAirRemaining(backtank)) - return Mth.hsvToRgb( - Math.max(0.0F, 1.0F - (float) stack.getDamageValue() / stack.getMaxDamage()) / 3.0F, 1.0F, 1.0F); + return Mth.hsvToRgb(Math.max(0.0F, 1.0F - (float) stack.getDamageValue() / stack.getMaxDamage()) / 3.0F, + 1.0F, 1.0F); return backtank.getItem() .getBarColor(backtank); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/DivingHelmetItem.java b/src/main/java/com/simibubi/create/content/curiosities/armor/DivingHelmetItem.java index b429d1f52..5eb910891 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/DivingHelmetItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/DivingHelmetItem.java @@ -58,7 +58,7 @@ public class DivingHelmetItem extends CopperArmorItem { entity.setAirSupply(Math.min(entity.getMaxAirSupply(), entity.getAirSupply() + 10)); entity.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 30, 0, true, false, true)); - BackTankUtil.consumeAir(backtank, 1); + BackTankUtil.consumeAir(entity, backtank, 1); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/display/AllDisplayBehaviours.java b/src/main/java/com/simibubi/create/content/logistics/block/display/AllDisplayBehaviours.java index 837465852..49d3a5419 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/display/AllDisplayBehaviours.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/display/AllDisplayBehaviours.java @@ -11,6 +11,7 @@ import com.simibubi.create.Create; import com.simibubi.create.content.logistics.block.display.source.DeathCounterDisplaySource; import com.simibubi.create.content.logistics.block.display.source.DisplaySource; import com.simibubi.create.content.logistics.block.display.source.EnchantPowerDisplaySource; +import com.simibubi.create.content.logistics.block.display.source.RedstonePowerDisplaySource; import com.simibubi.create.content.logistics.block.display.source.ScoreboardDisplaySource; import com.simibubi.create.content.logistics.block.display.target.DisplayTarget; import com.simibubi.create.content.logistics.block.display.target.LecternDisplayTarget; @@ -181,5 +182,6 @@ public class AllDisplayBehaviours { assign(register(Create.asResource("death_count_display_source"), new DeathCounterDisplaySource()), Blocks.RESPAWN_ANCHOR); assign(register(Create.asResource("scoreboard_display_source"), new ScoreboardDisplaySource()), BlockEntityType.COMMAND_BLOCK); assign(register(Create.asResource("enchant_power_display_source"), new EnchantPowerDisplaySource()), BlockEntityType.ENCHANTING_TABLE); + assign(register(Create.asResource("redstone_power_display_source"), new RedstonePowerDisplaySource()), Blocks.TARGET); } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/display/DisplayLinkBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/display/DisplayLinkBlock.java index 46d8317bd..eea7120d2 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/display/DisplayLinkBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/display/DisplayLinkBlock.java @@ -7,6 +7,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.logistics.block.display.source.DisplaySource; +import com.simibubi.create.content.logistics.block.display.source.RedstonePowerDisplaySource; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.WrenchableDirectionalBlock; import com.simibubi.create.foundation.gui.ScreenOpener; @@ -92,6 +93,11 @@ public class DisplayLinkBlock extends WrenchableDirectionalBlock implements ITE< boolean isMoving) { if (worldIn.isClientSide) return; + + if (fromPos.equals(pos.relative(state.getValue(FACING) + .getOpposite()))) + sendToGatherers(worldIn, fromPos, (dlte, p) -> dlte.tickSource(), RedstonePowerDisplaySource.class); + boolean powered = shouldBePowered(state, worldIn, pos); boolean previouslyPowered = state.getValue(POWERED); if (previouslyPowered != powered) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/display/source/FillLevelDisplaySource.java b/src/main/java/com/simibubi/create/content/logistics/block/display/source/FillLevelDisplaySource.java index b35a7637c..3f5a3b9f7 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/display/source/FillLevelDisplaySource.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/display/source/FillLevelDisplaySource.java @@ -1,64 +1,28 @@ package com.simibubi.create.content.logistics.block.display.source; -import static com.simibubi.create.content.logistics.trains.management.display.FlapDisplaySection.WIDE_MONOSPACE; - import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; -import com.simibubi.create.content.logistics.block.display.target.DisplayTargetStats; import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchTileEntity; -import com.simibubi.create.content.logistics.trains.management.display.FlapDisplaySection; -import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayTileEntity; import com.simibubi.create.foundation.gui.ModularGuiLineBuilder; import com.simibubi.create.foundation.utility.Lang; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.util.Mth; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public class FillLevelDisplaySource extends NumericSingleLineDisplaySource { +public class FillLevelDisplaySource extends PercentOrProgressBarDisplaySource { @Override - protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { + protected Float getProgress(DisplayLinkContext context) { BlockEntity te = context.getSourceTE(); if (!(te instanceof StockpileSwitchTileEntity sste)) - return EMPTY_LINE; - - float currentLevel = sste.currentLevel; - if (usePercent(context)) - return new TextComponent(Mth.clamp((int) (currentLevel * 100), 0, 100) + "%"); - - String label = context.sourceConfig() - .getString("Label"); - - int labelSize = label.isEmpty() ? 0 : label.length() + 1; - int length = Math.min(stats.maxColumns() - labelSize, 128); - - if (context.getTargetTE() instanceof SignBlockEntity) - length = (int) (length * 6f / 9f); - if (context.getTargetTE() instanceof FlapDisplayTileEntity) - length = sizeForWideChars(length); - - int filledLength = (int) (currentLevel * length); - - if (length < 1) - return EMPTY_LINE; - - StringBuilder s = new StringBuilder(); - int emptySpaces = length - filledLength; - for (int i = 0; i < filledLength; i++) - s.append("\u2588"); - for (int i = 0; i < emptySpaces; i++) - s.append("\u2592"); - - return new TextComponent(s.toString()); + return null; + return sste.currentLevel; } - - private boolean usePercent(DisplayLinkContext context) { + + @Override + protected boolean progressBarActive(DisplayLinkContext context) { return context.sourceConfig() - .getInt("Mode") == 0; + .getInt("Mode") != 0; } @Override @@ -66,21 +30,6 @@ public class FillLevelDisplaySource extends NumericSingleLineDisplaySource { return "fill_level"; } - @Override - protected String getFlapDisplayLayoutName(DisplayLinkContext context) { - return usePercent(context) ? super.getFlapDisplayLayoutName(context) : "Progress"; - } - - @Override - protected FlapDisplaySection createSectionForValue(DisplayLinkContext context, int size) { - return usePercent(context) ? super.createSectionForValue(context, size) - : new FlapDisplaySection(size * FlapDisplaySection.MONOSPACE, "pixel", false, false).wideFlaps(); - } - - private int sizeForWideChars(int size) { - return (int) (size * FlapDisplaySection.MONOSPACE / WIDE_MONOSPACE); - } - @Override @OnlyIn(Dist.CLIENT) public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/display/source/PercentOrProgressBarDisplaySource.java b/src/main/java/com/simibubi/create/content/logistics/block/display/source/PercentOrProgressBarDisplaySource.java new file mode 100644 index 000000000..5e9809147 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/display/source/PercentOrProgressBarDisplaySource.java @@ -0,0 +1,77 @@ +package com.simibubi.create.content.logistics.block.display.source; + +import static com.simibubi.create.content.logistics.trains.management.display.FlapDisplaySection.WIDE_MONOSPACE; + +import javax.annotation.Nullable; + +import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; +import com.simibubi.create.content.logistics.block.display.target.DisplayTargetStats; +import com.simibubi.create.content.logistics.trains.management.display.FlapDisplaySection; +import com.simibubi.create.content.logistics.trains.management.display.FlapDisplayTileEntity; + +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.util.Mth; +import net.minecraft.world.level.block.entity.SignBlockEntity; + +public abstract class PercentOrProgressBarDisplaySource extends NumericSingleLineDisplaySource { + + @Override + protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) { + Float currentLevel = getProgress(context); + if (currentLevel == null) + return EMPTY_LINE; + if (!progressBarActive(context)) + return new TextComponent(formatNumeric(currentLevel)); + + String label = context.sourceConfig() + .getString("Label"); + + int labelSize = label.isEmpty() ? 0 : label.length() + 1; + int length = Math.min(stats.maxColumns() - labelSize, 128); + + if (context.getTargetTE() instanceof SignBlockEntity) + length = (int) (length * 6f / 9f); + if (context.getTargetTE() instanceof FlapDisplayTileEntity) + length = sizeForWideChars(length); + + int filledLength = (int) (currentLevel * length); + + if (length < 1) + return EMPTY_LINE; + + StringBuilder s = new StringBuilder(); + int emptySpaces = length - filledLength; + for (int i = 0; i < filledLength; i++) + s.append("\u2588"); + for (int i = 0; i < emptySpaces; i++) + s.append("\u2592"); + + return new TextComponent(s.toString()); + } + + protected String formatNumeric(Float currentLevel) { + return Mth.clamp((int) (currentLevel * 100), 0, 100) + "%"; + } + + @Nullable + protected abstract Float getProgress(DisplayLinkContext context); + + protected abstract boolean progressBarActive(DisplayLinkContext context); + + @Override + protected String getFlapDisplayLayoutName(DisplayLinkContext context) { + return !progressBarActive(context) ? super.getFlapDisplayLayoutName(context) : "Progress"; + } + + @Override + protected FlapDisplaySection createSectionForValue(DisplayLinkContext context, int size) { + return !progressBarActive(context) ? super.createSectionForValue(context, size) + : new FlapDisplaySection(size * FlapDisplaySection.MONOSPACE, "pixel", false, false).wideFlaps(); + } + + private int sizeForWideChars(int size) { + return (int) (size * FlapDisplaySection.MONOSPACE / WIDE_MONOSPACE); + } + +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/display/source/RedstonePowerDisplaySource.java b/src/main/java/com/simibubi/create/content/logistics/block/display/source/RedstonePowerDisplaySource.java new file mode 100644 index 000000000..4ee7b8d91 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/display/source/RedstonePowerDisplaySource.java @@ -0,0 +1,58 @@ +package com.simibubi.create.content.logistics.block.display.source; + +import com.simibubi.create.content.logistics.block.display.DisplayLinkContext; +import com.simibubi.create.foundation.gui.ModularGuiLineBuilder; +import com.simibubi.create.foundation.utility.Lang; + +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public class RedstonePowerDisplaySource extends PercentOrProgressBarDisplaySource { + + @Override + protected String getTranslationKey() { + return "redstone_power"; + } + + @Override + protected String formatNumeric(Float currentLevel) { + return String.valueOf((int) (currentLevel * 15)); + } + + @Override + protected boolean allowsLabeling(DisplayLinkContext context) { + return true; + } + + @Override + protected Float getProgress(DisplayLinkContext context) { + BlockState blockState = context.level() + .getBlockState(context.getSourcePos()); + return Math.max(context.level() + .getDirectSignalTo(context.getSourcePos()), + blockState.getOptionalValue(BlockStateProperties.POWER) + .orElse(0)) + / 15f; + } + + @Override + protected boolean progressBarActive(DisplayLinkContext context) { + return context.sourceConfig() + .getInt("Mode") != 0; + } + + @Override + @OnlyIn(Dist.CLIENT) + public void initConfigurationWidgets(DisplayLinkContext context, ModularGuiLineBuilder builder, boolean isFirstLine) { + super.initConfigurationWidgets(context, builder, isFirstLine); + if (isFirstLine) + return; + builder.addSelectionScrollInput(0, 120, + (si, l) -> si.forOptions(Lang.translatedOptions("display_source.redstone_power", "number", "progress_bar")) + .titled(Lang.translate("display_source.redstone_power.display")), + "Mode"); + } + +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchBlock.java index ff9385465..dc548ab53 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchBlock.java @@ -40,7 +40,8 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -public class StockpileSwitchBlock extends HorizontalDirectionalBlock implements ITE, IWrenchable { +public class StockpileSwitchBlock extends HorizontalDirectionalBlock + implements ITE, IWrenchable { public static final IntegerProperty INDICATOR = IntegerProperty.create("indicator", 0, 6); @@ -146,25 +147,23 @@ public class StockpileSwitchBlock extends HorizontalDirectionalBlock implements } } - if (preferredFacing != null) { - state = state.setValue(FACING, preferredFacing); - } else if (context.getClickedFace() - .getAxis() - .isHorizontal()) { - state = state.setValue(FACING, context.getClickedFace()); - } else { - state = state.setValue(FACING, context.getHorizontalDirection() - .getOpposite()); - } + if (preferredFacing != null) + return state.setValue(FACING, preferredFacing); - return state; + Direction facing = context.getClickedFace() + .getAxis() + .isHorizontal() ? context.getClickedFace() + : context.getHorizontalDirection() + .getOpposite(); + return state.setValue(FACING, context.getPlayer() != null && context.getPlayer() + .isSteppingCarefully() ? facing.getOpposite() : facing); } @Override public Class getTileEntityClass() { return StockpileSwitchTileEntity.class; } - + @Override public BlockEntityType getTileEntityType() { return AllTileEntities.STOCKPILE_SWITCH.get(); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchObservable.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchObservable.java new file mode 100644 index 000000000..1c4eff748 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchObservable.java @@ -0,0 +1,7 @@ +package com.simibubi.create.content.logistics.block.redstone; + +public interface StockpileSwitchObservable { + + public float getPercent(); + +} diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java index c4ec6e067..150aa9494 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipula import com.simibubi.create.foundation.tileEntity.behaviour.inventory.TankManipulationBehaviour; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; @@ -77,10 +78,18 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { boolean changed = false; float occupied = 0; float totalSpace = 0; + float prevLevel = currentLevel; observedInventory.findNewCapability(); observedTank.findNewCapability(); - if (observedInventory.hasInventory() || observedTank.hasInventory()) { + + BlockPos target = worldPosition.relative(getBlockState().getOptionalValue(StockpileSwitchBlock.FACING) + .orElse(Direction.NORTH)); + + if (level.getBlockEntity(target) instanceof StockpileSwitchObservable observable) { + currentLevel = observable.getPercent() / 100f; + + } else if (observedInventory.hasInventory() || observedTank.hasInventory()) { if (observedInventory.hasInventory()) { // Item inventory IItemHandler inv = observedInventory.getInventory(); @@ -112,6 +121,9 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { occupied += count * (1f / space); } } + + currentLevel = occupied / totalSpace; + } else { // No compatible inventories found if (currentLevel == -1) @@ -124,12 +136,9 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { return; } - float stockLevel = occupied / totalSpace; - if (currentLevel != stockLevel) - changed = true; - currentLevel = stockLevel; currentLevel = Mth.clamp(currentLevel, 0, 1); - + changed = currentLevel != prevLevel; + boolean previouslyPowered = redstoneState; if (redstoneState && currentLevel <= offWhenBelow) redstoneState = false; diff --git a/src/main/resources/assets/create/lang/default/interface.json b/src/main/resources/assets/create/lang/default/interface.json index 6f1dcf23e..2f9f69898 100644 --- a/src/main/resources/assets/create/lang/default/interface.json +++ b/src/main/resources/assets/create/lang/default/interface.json @@ -557,6 +557,9 @@ "create.hint.full_deployer.title": "Deployer Item Overflow", "create.hint.full_deployer": "It appears this _Deployer_ contains _excess_ _items_ that need to be _extracted._ Use a _hopper,_ _funnel_ or other means to free it from its overflow.", + "create.backtank.low": "Backtank pressure low", + "create.backtank.depleted": "Backtank pressure depleted", + "create.hint.derailed_train.title": "Derailed Train", "create.hint.derailed_train": "It appears this _Train_ is no longer sitting on a connected track piece. _Right-Click_ using a _wrench_ in order to relocate it to a nearby track.", @@ -768,12 +771,16 @@ "create.display_source.boiler_status": "Boiler Status", "create.display_source.entity_name": "Entity Name", "create.display_source.kinetic_speed": "Rotation Speed (RPM)", - "create.display_source.kinetic_speed.absolute": "Ignore Direction", - "create.display_source.kinetic_speed.directional": "Include Direction", - "create.display_source.kinetic_stress.current": "Stress Impact (Amount)", + "create.display_source.kinetic_speed.absolute": "Ignore Direction", + "create.display_source.kinetic_speed.directional": "Include Direction", + "create.display_source.kinetic_stress.current": "Stress Impact (Amount)", "create.display_source.kinetic_stress.max": "Stress Capacity (Max)", "create.display_source.kinetic_stress.percent": "Stress Impact (Percent)", "create.display_source.kinetic_stress.remaining": "Stress Capacity (Remaining)", + "create.display_source.redstone_power": "Redstone Power", + "create.display_source.redstone_power.display": "Display Format", + "create.display_source.redstone_power.number": "Number", + "create.display_source.redstone_power.progress_bar": "Progress Bar", "create.display_target.line": "Line %1$s", "create.display_target.page": "Page %1$s",