From 5b611f947e6ee7f556ac23e622bc970aa55e641a Mon Sep 17 00:00:00 2001 From: Merhaf <54317788+Merhaf@users.noreply.github.com> Date: Sat, 6 Jul 2024 02:36:49 +0900 Subject: [PATCH 01/15] Update ko_kr.json (#462) --- .../assets/continuity/lang/ko_kr.json | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/resources/assets/continuity/lang/ko_kr.json b/src/main/resources/assets/continuity/lang/ko_kr.json index 4071e31..589a766 100644 --- a/src/main/resources/assets/continuity/lang/ko_kr.json +++ b/src/main/resources/assets/continuity/lang/ko_kr.json @@ -1,9 +1,13 @@ { - "options.continuity.title": "Continuity 설정", - "options.continuity.connected_textures": "연결된 텍스쳐", - "options.continuity.connected_textures.tooltip": "블록의 연결된 텍스쳐를 활성화 하거나 비활성화 합니다.", - "options.continuity.emissive_textures": "빛나는 텍스쳐", - "options.continuity.emissive_textures.tooltip": "블록 및 아이템 모델의 빛나는 텍스쳐를 활성화 하거나 비활성화 합니다.", - "options.continuity.custom_block_layers": "블록 레이어 ", - "options.continuity.custom_block_layers.tooltip": "블록 레이어 사용자화를 활성화 하거나 비활성화 합니다." + "options.continuity.title": "Continuity 설정", + "options.continuity.connected_textures": "연결된 텍스쳐", + "options.continuity.connected_textures.tooltip": "블록의 연결된 텍스쳐를 활성화 하거나 비활성화 합니다.", + "options.continuity.emissive_textures": "빛나는 텍스쳐", + "options.continuity.emissive_textures.tooltip": "블록 및 아이템 모델의 빛나는 텍스쳐를 활성화 하거나 비활성화 합니다.", + "options.continuity.custom_block_layers": "블록 레이어 ", + "options.continuity.custom_block_layers.tooltip": "블록 레이어 사용자화를 활성화 하거나 비활성화 합니다.", + "resourcePack.continuity.default.name": "기본 Continuity 텍스처", + "resourcePack.continuity.default.description": "유리, 사암, 책장", + "resourcePack.continuity.glass_pane_culling_fix.name": "유리판 컬링 수정", + "resourcePack.continuity.glass_pane_culling_fix.description": "유리판 사이의 면 제거" } From c7e40a92fb2d0750ddbf37d73f0021e28bbfcfdf Mon Sep 17 00:00:00 2001 From: NuruddinPlays <77572972+NuruddinPlays@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:44:18 +0800 Subject: [PATCH 02/15] Create ms_my.json and zlm_arab.json (#405) --- src/main/resources/assets/continuity/lang/ms_my.json | 9 +++++++++ src/main/resources/assets/continuity/lang/zlm_arab.json | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/ms_my.json create mode 100644 src/main/resources/assets/continuity/lang/zlm_arab.json diff --git a/src/main/resources/assets/continuity/lang/ms_my.json b/src/main/resources/assets/continuity/lang/ms_my.json new file mode 100644 index 0000000..87a31b2 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/ms_my.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Konfigurasi Continuity", + "options.continuity.connected_textures": "Tekstur Bersambung", + "options.continuity.connected_textures.tooltip": "Dayakan atau nyahdayakan tekstur yang disambungkan untuk blok.", + "options.continuity.emissive_textures": "Tekstur Emisif", + "options.continuity.emissive_textures.tooltip": "Dayakan atau nyahdayakan tekstur emisif untuk model blok dan item.", + "options.continuity.custom_block_layers": "Lapisan Blok Tersuai", + "options.continuity.custom_block_layers.tooltip": "Dayakan atau nyahdayakan lapisan blok tersuai." +} \ No newline at end of file diff --git a/src/main/resources/assets/continuity/lang/zlm_arab.json b/src/main/resources/assets/continuity/lang/zlm_arab.json new file mode 100644 index 0000000..d6e521a --- /dev/null +++ b/src/main/resources/assets/continuity/lang/zlm_arab.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "کونفيݢوراسي Continuity", + "options.continuity.connected_textures": "تيکستور برسامبوڠ", + "options.continuity.connected_textures.tooltip": "دايکن اتاو ڽهدايکن تيکستور يڠ دسامبوڠکن اونتوق بلوک.", + "options.continuity.emissive_textures": "تيکستور ايميسيف", + "options.continuity.emissive_textures.tooltip": "دايکن اتاو ڽهدايکن تيکستور ايميسيف اونتوق موديل بلوک دان اءيتم.", + "options.continuity.custom_block_layers": "لاڤيسن بلوک ترسواي", + "options.continuity.custom_block_layers.tooltip": "دايکن اتاو ڽهدايکن لاڤيسن بلوک ترسواي." +} \ No newline at end of file From e22ad7d83238cc03cd31a1e0acd2635c7b547f1c Mon Sep 17 00:00:00 2001 From: Santiago Hernandez <73335686+TheLegendofSaram@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:47:25 -0400 Subject: [PATCH 03/15] Mexican Spanish Translation (#399) Just a translation --- src/main/resources/assets/continuity/lang/es_mx.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/es_mx.json diff --git a/src/main/resources/assets/continuity/lang/es_mx.json b/src/main/resources/assets/continuity/lang/es_mx.json new file mode 100644 index 0000000..488fc73 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/es_mx.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Configuración de Continuity", + "options.continuity.connected_textures": "Texturas Conectadas", + "options.continuity.connected_textures.tooltip": "Activar o desactivar texturas conectadas para bloques.", + "options.continuity.emissive_textures": "Texturas Emisivas", + "options.continuity.emissive_textures.tooltip": "Activar o desactivar texturas emisivas para modelos de bloques e ítems.", + "options.continuity.custom_block_layers": "Capas de Bloques Personalizadas", + "options.continuity.custom_block_layers.tooltip": "Activar o desactivar capas de bloques personalizadas." +} From de03f278d90c77199215d2d6d4fff9de067a32c9 Mon Sep 17 00:00:00 2001 From: efekos <56752400+efekos@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:10:17 +0300 Subject: [PATCH 04/15] Create tr_tr.json (#335) --- src/main/resources/assets/continuity/lang/tr_tr.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/tr_tr.json diff --git a/src/main/resources/assets/continuity/lang/tr_tr.json b/src/main/resources/assets/continuity/lang/tr_tr.json new file mode 100644 index 0000000..e27f774 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/tr_tr.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Continuity Yapılandırması", + "options.continuity.connected_textures": "Bağlantılı Dokular", + "options.continuity.connected_textures.tooltip": "Bloklar için bağlantılı dokuları aç veya kapat.", + "options.continuity.emissive_textures": "Parlayan Dokular", + "options.continuity.emissive_textures.tooltip": "Eşya ve block modelleri için parlayan dokuları aç veya kapat.", + "options.continuity.custom_block_layers": "Özel Blok Katmanları", + "options.continuity.custom_block_layers.tooltip": "Özel blok katmanlarını aç veya kapat." +} From 6ec61b5f94a11b630872826a23e7e79ccf3bea04 Mon Sep 17 00:00:00 2001 From: Dontknow09 Date: Fri, 5 Jul 2024 20:10:55 +0200 Subject: [PATCH 05/15] Add Swedish Translations (#334) --- src/main/resources/assets/continuity/lang/sv_se.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/sv_se.json diff --git a/src/main/resources/assets/continuity/lang/sv_se.json b/src/main/resources/assets/continuity/lang/sv_se.json new file mode 100644 index 0000000..f4066f4 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/sv_se.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Continuity Konfiguration", + "options.continuity.connected_textures": "Anslutna Texturer", + "options.continuity.connected_textures.tooltip": "Aktivera eller inaktivera anslutna texturer för block.", + "options.continuity.emissive_textures": "Emissiva Texturer", + "options.continuity.emissive_textures.tooltip": "Aktivera eller inaktivera emissiva texturer för block- och föremålsmodeller.", + "options.continuity.custom_block_layers": "Anpassade Blocklager", + "options.continuity.custom_block_layers.tooltip": "Aktivera eller inaktivera anpassade blocklager." +} From 461fd0f59591d876a6472c11e586dfdb74c1d3a9 Mon Sep 17 00:00:00 2001 From: Amirhan-Taipovjan-Greatest-I <51203385+Amirhan-Taipovjan-Greatest-I@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:12:40 +0300 Subject: [PATCH 06/15] Vanilla-ish Tatar Translation! (#329) --- src/main/resources/assets/continuity/lang/tt_ru.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/tt_ru.json diff --git a/src/main/resources/assets/continuity/lang/tt_ru.json b/src/main/resources/assets/continuity/lang/tt_ru.json new file mode 100644 index 0000000..1de7177 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/tt_ru.json @@ -0,0 +1,11 @@ +{ + "modmenu.summaryTranslation.continuity": "Бу модны кулланып, Optifine-ның тоташтырылган текстуралары, җемелдек текстуралары, көйләнгән блок катламнары Optifine-сыз эшли.", + "modmenu.descriptionTranslation.continuity": "Continuity — Optifine тоташтырылган текстуралары форматын, OptiFine җемелдек текстуралар форматын (блок һәм предмет модельләре өчен генә) яки OptiFine-сыз эшләү өчен OptiFine көйләнгән блок катламнары форматын кулланучы ресурс җыелмаларын рөхсәт итә торган Fabric моды.", + "options.continuity.title": "Continuity көйләүләре", + "options.continuity.connected_textures": "Тоташтырылган текстуралар", + "options.continuity.connected_textures.tooltip": "Блоклар өчен тоташтырылган текстураларны кушырга яки сүндерергә.", + "options.continuity.emissive_textures": "Җемелдек текстуралар", + "options.continuity.emissive_textures.tooltip": "Блок һәм предмет модельләре өчен җемелдек текстураларны кушырга яки сүндерергә.", + "options.continuity.custom_block_layers": "Көйләнгән катламнар", + "options.continuity.custom_block_layers.tooltip": "Көйләнгән блок катламнарын кушырга яки сүндерергә." +} From 61a1b751fe4c53c0bd86e25204ca62595c1cb3c8 Mon Sep 17 00:00:00 2001 From: I_am_Vietnam <91591390+ImVietnam@users.noreply.github.com> Date: Sat, 6 Jul 2024 01:13:15 +0700 Subject: [PATCH 07/15] Create vi_vn.json (#271) * Create vi_vn.json * Update vi_vn.json --- src/main/resources/assets/continuity/lang/vi_vn.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/vi_vn.json diff --git a/src/main/resources/assets/continuity/lang/vi_vn.json b/src/main/resources/assets/continuity/lang/vi_vn.json new file mode 100644 index 0000000..93e2174 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/vi_vn.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Cấu hình Continuity", + "options.continuity.connected_textures": "Hoạ tiết được kết nối", + "options.continuity.connected_textures.tooltip": "Bật hoặc tắt hoạ tiết được kết nối cho các khối.", + "options.continuity.emissive_textures": "Hoạ tiết phát xạ", + "options.continuity.emissive_textures.tooltip": "Bật hoặc tắt hoạ tiết phát xạ cho các mô hình khối và vật phẩm.", + "options.continuity.custom_block_layers": "Lớp khối tùy chỉnh", + "options.continuity.custom_block_layers.tooltip": "Bật hoặc tắt các lớp khối tùy chỉnh." +} From 1aba21d77d903b1dbffa505cfbae622e8d524917 Mon Sep 17 00:00:00 2001 From: Boxadactle Date: Fri, 5 Jul 2024 11:15:28 -0700 Subject: [PATCH 08/15] Add Spanish translation (#267) * Add files via upload * fix the incorrect adjective --- src/main/resources/assets/continuity/lang/es_es.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/es_es.json diff --git a/src/main/resources/assets/continuity/lang/es_es.json b/src/main/resources/assets/continuity/lang/es_es.json new file mode 100644 index 0000000..342c5c9 --- /dev/null +++ b/src/main/resources/assets/continuity/lang/es_es.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Configuración de Continuity", + "options.continuity.connected_textures": "Texturas conectadas", + "options.continuity.connected_textures.tooltip": "Activar o desactivar las texturas conectados para los bloques.", + "options.continuity.emissive_textures": "Texturas emisivas", + "options.continuity.emissive_textures.tooltip": "Activar o desactivar las texturas emisivas para los bloques y modelos de artículos.", + "options.continuity.custom_block_layers": "Capas de bloque personalizadas", + "options.continuity.custom_block_layers.tooltip": "Activar o desactivar las capas de bloque personalizadas." +} From 1fc1ba4e51f902ea263e861fbbbd84d89dcea07f Mon Sep 17 00:00:00 2001 From: BurrConnie <114810287+BurrConnie@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:16:28 +0300 Subject: [PATCH 09/15] Update/fix Ukrainian localization (1.19.3) (#227) * Added resource pack strings * Abbreviated some strings to fit button widths * General rephrasing to make it more consistent with vanilla localization --- .../resources/assets/continuity/lang/uk_ua.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/resources/assets/continuity/lang/uk_ua.json b/src/main/resources/assets/continuity/lang/uk_ua.json index 2788271..ec62a23 100644 --- a/src/main/resources/assets/continuity/lang/uk_ua.json +++ b/src/main/resources/assets/continuity/lang/uk_ua.json @@ -1,9 +1,13 @@ { - "options.continuity.title": "Налаштування Continuity", + "options.continuity.title": "Параметри Continuity", "options.continuity.connected_textures": "З'єднані текстури", - "options.continuity.connected_textures.tooltip": "Увімкнути/вимкнути з'єднані текстури для блоків.", - "options.continuity.emissive_textures": "Текстури, що світяться", - "options.continuity.emissive_textures.tooltip": "Увімкнути/вимкнути текстури, що світяться для блоків та моделів предметів.", + "options.continuity.connected_textures.tooltip": "Увімкнути з'єднані текстури для блоків.", + "options.continuity.emissive_textures": "Випромінюючі текстури", + "options.continuity.emissive_textures.tooltip": "Увімкнути випромінюючі текстури для блоків та моделів предметів.", "options.continuity.custom_block_layers": "Власні шари блоків", - "options.continuity.custom_block_layers.tooltip": "Увімкнути/вимкнути власні шари текстур для блоків." + "options.continuity.custom_block_layers.tooltip": "Увімкнути власні шари текстур для блоків.", + "resourcePack.continuity.default.name": "Станд. з'єдн. текстури", + "resourcePack.continuity.default.description": "Книжні полиці, пісковик та скло", + "resourcePack.continuity.glass_pane_culling_fix.name": "Виправл. скляні панелі", + "resourcePack.continuity.glass_pane_culling_fix.description": "Виправл. поглинення горизонтальних граней" } From a6b3291e58ad391479467287eaa8efd7c093814a Mon Sep 17 00:00:00 2001 From: Madis Otenurm Date: Fri, 5 Jul 2024 21:17:02 +0300 Subject: [PATCH 10/15] Estonian 1.19.3 update (#212) * Update et_ee.json * Update et_ee.json * Update et_ee.json * Update et_ee.json --- src/main/resources/assets/continuity/lang/et_ee.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/continuity/lang/et_ee.json b/src/main/resources/assets/continuity/lang/et_ee.json index 8f83216..61399d6 100644 --- a/src/main/resources/assets/continuity/lang/et_ee.json +++ b/src/main/resources/assets/continuity/lang/et_ee.json @@ -5,5 +5,9 @@ "options.continuity.emissive_textures": "Hõõguvad tekstuurid", "options.continuity.emissive_textures.tooltip": "Luba või keela ploki- ja esememudelite hõõguvad tekstuurid.", "options.continuity.custom_block_layers": "Kohandatud plokikihid", - "options.continuity.custom_block_layers.tooltip": "Luba või keela kohandatud plokikihid." + "options.continuity.custom_block_layers.tooltip": "Luba või keela kohandatud plokikihid.", + "resourcePack.continuity.default.name": "Vaikimisi ühendatud tekstuurid", + "resourcePack.continuity.default.description": "Raamaturiiulid, liivakivi ja klaas", + "resourcePack.continuity.glass_pane_culling_fix.name": "Klaaspaneelide eral. parandus", + "resourcePack.continuity.glass_pane_culling_fix.description": "Parandab ülemise ja alumise külje eralduse" } From 794c408b97642e62e0d06e43b4ea9504f3d8f323 Mon Sep 17 00:00:00 2001 From: notlin4 <121224522+notlin4@users.noreply.github.com> Date: Sat, 6 Jul 2024 02:17:38 +0800 Subject: [PATCH 11/15] Add Traditional Chinese (#209) * Create zh_tw.json * Update Traditional Chinese * Update zh_tw.json --- src/main/resources/assets/continuity/lang/zh_tw.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/resources/assets/continuity/lang/zh_tw.json diff --git a/src/main/resources/assets/continuity/lang/zh_tw.json b/src/main/resources/assets/continuity/lang/zh_tw.json new file mode 100644 index 0000000..bd4afdc --- /dev/null +++ b/src/main/resources/assets/continuity/lang/zh_tw.json @@ -0,0 +1,9 @@ +{ + "options.continuity.title": "Continuity 設定", + "options.continuity.connected_textures": "連接紋理", + "options.continuity.connected_textures.tooltip": "啟用或停用方塊的連接紋理。", + "options.continuity.emissive_textures": "高光紋理", + "options.continuity.emissive_textures.tooltip": "啟用或停用方塊和物品模型的高光紋理。", + "options.continuity.custom_block_layers": "自訂方塊層", + "options.continuity.custom_block_layers.tooltip": "啟用或停用自訂方塊層。" +} From ec3d96bfd3adfcc276999b406f984a950a965dc3 Mon Sep 17 00:00:00 2001 From: Felix14_v2 <75726196+Felix14-v2@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:18:51 +0300 Subject: [PATCH 12/15] Update ru_ru.json (#150) * Update ru_ru.json * Update ru_ru.json --- .../resources/assets/continuity/lang/ru_ru.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/continuity/lang/ru_ru.json b/src/main/resources/assets/continuity/lang/ru_ru.json index 7cdbc33..4042ac6 100644 --- a/src/main/resources/assets/continuity/lang/ru_ru.json +++ b/src/main/resources/assets/continuity/lang/ru_ru.json @@ -1,9 +1,16 @@ { "options.continuity.title": "Настройки Continuity", "options.continuity.connected_textures": "Соединённые текстуры", - "options.continuity.connected_textures.tooltip": "Включить/отключить соединённые текстуры блоков.", + "options.continuity.connected_textures.tooltip": "Переключить соединённые текстуры блоков.", "options.continuity.emissive_textures": "Светящиеся текстуры", - "options.continuity.emissive_textures.tooltip": "Включить/отключить светящиеся текстуры блоков и моделей предметов.", + "options.continuity.emissive_textures.tooltip": "Переключить светящиеся текстуры блоков и моделей предметов.", "options.continuity.custom_block_layers": "Пользов. слои отрисовки", - "options.continuity.custom_block_layers.tooltip": "Включить/отключить возможность изменения типа отрисовки для блоков." + "options.continuity.custom_block_layers.tooltip": "Переключить возможность изменения типа отрисовки для блоков.", + "resourcePack.continuity.default.name": "Обычное соединение текстур", + "resourcePack.continuity.default.description": "Книжные полки, песчаник и стекло.", + "resourcePack.continuity.glass_pane_culling_fix.name": "Исправленные грани панелей", + "resourcePack.continuity.glass_pane_culling_fix.description": "Улучшенное отсечение граней стекла", + + "modmenu.summaryTranslation.continuity": "Эффективные соединённые текстуры для Fabric.", + "modmenu.descriptionTranslation.continuity": "Continuity – мод для Fabric, основанный на современных API для обеспечения максимально эффективного опыта взаимодействия. Его предназначение – обеспечить поддержку всех наборов ресурсов, использующих формат соединённых текстур Optifine. Также Continuity поддерживает его формат светящихся текстур у моделей блоков и предметов." } From 24781a2b3bc182900dc0894edece22ff675965ab Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:47:03 -0600 Subject: [PATCH 13/15] Improve language file formatting - Bump version --- gradle.properties | 2 +- src/main/resources/assets/continuity/lang/ko_kr.json | 2 +- src/main/resources/assets/continuity/lang/ms_my.json | 2 +- src/main/resources/assets/continuity/lang/ru_ru.json | 1 - src/main/resources/assets/continuity/lang/tt_ru.json | 6 +++--- src/main/resources/assets/continuity/lang/zlm_arab.json | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7792992..d380f8d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings = 1.19.3+build.5 loader_version = 0.15.10 # Mod Properties -mod_version = 3.0.0-beta.5 +mod_version = 3.0.0-beta.6 mod_minecraft_version = 1.19.3 maven_group = me.pepperbell archives_base_name = continuity diff --git a/src/main/resources/assets/continuity/lang/ko_kr.json b/src/main/resources/assets/continuity/lang/ko_kr.json index 589a766..af4d972 100644 --- a/src/main/resources/assets/continuity/lang/ko_kr.json +++ b/src/main/resources/assets/continuity/lang/ko_kr.json @@ -4,7 +4,7 @@ "options.continuity.connected_textures.tooltip": "블록의 연결된 텍스쳐를 활성화 하거나 비활성화 합니다.", "options.continuity.emissive_textures": "빛나는 텍스쳐", "options.continuity.emissive_textures.tooltip": "블록 및 아이템 모델의 빛나는 텍스쳐를 활성화 하거나 비활성화 합니다.", - "options.continuity.custom_block_layers": "블록 레이어 ", + "options.continuity.custom_block_layers": "블록 레이어", "options.continuity.custom_block_layers.tooltip": "블록 레이어 사용자화를 활성화 하거나 비활성화 합니다.", "resourcePack.continuity.default.name": "기본 Continuity 텍스처", "resourcePack.continuity.default.description": "유리, 사암, 책장", diff --git a/src/main/resources/assets/continuity/lang/ms_my.json b/src/main/resources/assets/continuity/lang/ms_my.json index 87a31b2..766a38e 100644 --- a/src/main/resources/assets/continuity/lang/ms_my.json +++ b/src/main/resources/assets/continuity/lang/ms_my.json @@ -6,4 +6,4 @@ "options.continuity.emissive_textures.tooltip": "Dayakan atau nyahdayakan tekstur emisif untuk model blok dan item.", "options.continuity.custom_block_layers": "Lapisan Blok Tersuai", "options.continuity.custom_block_layers.tooltip": "Dayakan atau nyahdayakan lapisan blok tersuai." -} \ No newline at end of file +} diff --git a/src/main/resources/assets/continuity/lang/ru_ru.json b/src/main/resources/assets/continuity/lang/ru_ru.json index 4042ac6..bdbc1d6 100644 --- a/src/main/resources/assets/continuity/lang/ru_ru.json +++ b/src/main/resources/assets/continuity/lang/ru_ru.json @@ -10,7 +10,6 @@ "resourcePack.continuity.default.description": "Книжные полки, песчаник и стекло.", "resourcePack.continuity.glass_pane_culling_fix.name": "Исправленные грани панелей", "resourcePack.continuity.glass_pane_culling_fix.description": "Улучшенное отсечение граней стекла", - "modmenu.summaryTranslation.continuity": "Эффективные соединённые текстуры для Fabric.", "modmenu.descriptionTranslation.continuity": "Continuity – мод для Fabric, основанный на современных API для обеспечения максимально эффективного опыта взаимодействия. Его предназначение – обеспечить поддержку всех наборов ресурсов, использующих формат соединённых текстур Optifine. Также Continuity поддерживает его формат светящихся текстур у моделей блоков и предметов." } diff --git a/src/main/resources/assets/continuity/lang/tt_ru.json b/src/main/resources/assets/continuity/lang/tt_ru.json index 1de7177..2b87dca 100644 --- a/src/main/resources/assets/continuity/lang/tt_ru.json +++ b/src/main/resources/assets/continuity/lang/tt_ru.json @@ -1,11 +1,11 @@ { - "modmenu.summaryTranslation.continuity": "Бу модны кулланып, Optifine-ның тоташтырылган текстуралары, җемелдек текстуралары, көйләнгән блок катламнары Optifine-сыз эшли.", - "modmenu.descriptionTranslation.continuity": "Continuity — Optifine тоташтырылган текстуралары форматын, OptiFine җемелдек текстуралар форматын (блок һәм предмет модельләре өчен генә) яки OptiFine-сыз эшләү өчен OptiFine көйләнгән блок катламнары форматын кулланучы ресурс җыелмаларын рөхсәт итә торган Fabric моды.", "options.continuity.title": "Continuity көйләүләре", "options.continuity.connected_textures": "Тоташтырылган текстуралар", "options.continuity.connected_textures.tooltip": "Блоклар өчен тоташтырылган текстураларны кушырга яки сүндерергә.", "options.continuity.emissive_textures": "Җемелдек текстуралар", "options.continuity.emissive_textures.tooltip": "Блок һәм предмет модельләре өчен җемелдек текстураларны кушырга яки сүндерергә.", "options.continuity.custom_block_layers": "Көйләнгән катламнар", - "options.continuity.custom_block_layers.tooltip": "Көйләнгән блок катламнарын кушырга яки сүндерергә." + "options.continuity.custom_block_layers.tooltip": "Көйләнгән блок катламнарын кушырга яки сүндерергә.", + "modmenu.summaryTranslation.continuity": "Бу модны кулланып, Optifine-ның тоташтырылган текстуралары, җемелдек текстуралары, көйләнгән блок катламнары Optifine-сыз эшли.", + "modmenu.descriptionTranslation.continuity": "Continuity — Optifine тоташтырылган текстуралары форматын, OptiFine җемелдек текстуралар форматын (блок һәм предмет модельләре өчен генә) яки OptiFine-сыз эшләү өчен OptiFine көйләнгән блок катламнары форматын кулланучы ресурс җыелмаларын рөхсәт итә торган Fabric моды." } diff --git a/src/main/resources/assets/continuity/lang/zlm_arab.json b/src/main/resources/assets/continuity/lang/zlm_arab.json index d6e521a..e82abc5 100644 --- a/src/main/resources/assets/continuity/lang/zlm_arab.json +++ b/src/main/resources/assets/continuity/lang/zlm_arab.json @@ -6,4 +6,4 @@ "options.continuity.emissive_textures.tooltip": "دايکن اتاو ڽهدايکن تيکستور ايميسيف اونتوق موديل بلوک دان اءيتم.", "options.continuity.custom_block_layers": "لاڤيسن بلوک ترسواي", "options.continuity.custom_block_layers.tooltip": "دايکن اتاو ڽهدايکن لاڤيسن بلوک ترسواي." -} \ No newline at end of file +} From 3dab2d19a058bfcc1aa94817d99285a4584933b9 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:12:19 -0600 Subject: [PATCH 14/15] Naming fixes and backport misc. changes from 1.21 - Rename variables, fields, and methods to use "pack id" instead of "pack name" - Fix overlay CtmProperties naming variables and fields with "id" instead of "resourceId" - Use Identifier.withPath whenever possible - Add missing nullable annotations in BaseProcessingPredicate --- .../client/mixin/AtlasLoaderMixin.java | 2 +- .../AbstractQuadProcessorFactory.java | 4 +- .../processor/BaseProcessingPredicate.java | 2 + .../processor/CompactCtmQuadProcessor.java | 8 ++-- .../client/properties/BaseCtmProperties.java | 42 +++++++++---------- .../BasicConnectingCtmProperties.java | 2 +- .../CompactConnectingCtmProperties.java | 4 +- .../OrientedConnectingCtmProperties.java | 2 +- .../properties/PropertiesParsingHelper.java | 30 ++++++------- .../properties/RandomCtmProperties.java | 6 +-- .../properties/RepeatCtmProperties.java | 14 +++---- .../properties/TileAmountValidator.java | 4 +- .../overlay/BaseOverlayCtmProperties.java | 6 +-- ...rientedConnectingOverlayCtmProperties.java | 6 +-- .../overlay/OverlayPropertiesSection.java | 20 ++++----- .../overlay/RandomOverlayCtmProperties.java | 6 +-- .../overlay/RepeatOverlayCtmProperties.java | 6 +-- .../overlay/StandardOverlayCtmProperties.java | 10 ++--- .../client/resource/CustomBlockLayers.java | 4 +- .../resource/ResourceRedirectHandler.java | 2 +- .../client/util/biome/BiomeHolderManager.java | 2 +- 21 files changed, 92 insertions(+), 90 deletions(-) diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java index cc965c7..dcee9d6 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/AtlasLoaderMixin.java @@ -63,7 +63,7 @@ abstract class AtlasLoaderMixin { Map emissiveIdMap = new Object2ObjectOpenHashMap<>(); suppliers.forEach((id, supplier) -> { if (!id.getPath().endsWith(emissiveSuffix)) { - Identifier emissiveId = new Identifier(id.getNamespace(), id.getPath() + emissiveSuffix); + Identifier emissiveId = id.withPath(id.getPath() + emissiveSuffix); if (!suppliers.containsKey(emissiveId)) { Identifier emissiveLocation = emissiveId.withPath("textures/" + emissiveId.getPath() + ".png"); Optional optionalResource = resourceManager.getResource(emissiveLocation); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java index 93d3a0a..be7bc6c 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessorFactory.java @@ -19,7 +19,7 @@ public QuadProcessor createProcessor(T properties, Function textureAmount) { - ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); max = textureAmount; } @@ -40,7 +40,7 @@ public QuadProcessor createProcessor(T properties, Function textureAmount) { if (replacementSprites == null) { - ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.warn("Method '" + properties.getMethod() + "' requires " + textureAmount + " tiles but " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); } max = textureAmount; } @@ -666,7 +666,7 @@ public QuadProcessor createProcessor(CompactConnectingCtmProperties properties, } if (provided < textureAmount) { - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + textureAmount + " tiles but only " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + textureAmount + " tiles but only " + provided + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); for (int i = provided; i < textureAmount; i++) { sprites[i] = missingSprite; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java index 0f687b8..8267449 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/BaseCtmProperties.java @@ -53,7 +53,7 @@ public class BaseCtmProperties implements CtmProperties { protected Properties properties; protected Identifier resourceId; - protected String packName; + protected String packId; protected int packPriority; protected ResourceManager resourceManager; protected String method; @@ -81,7 +81,7 @@ public class BaseCtmProperties implements CtmProperties { public BaseCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { this.properties = properties; this.resourceId = resourceId; - this.packName = pack.getName(); + this.packId = pack.getName(); this.packPriority = packPriority; this.resourceManager = resourceManager; this.method = method; @@ -135,14 +135,14 @@ public void init() { } protected void parseMatchTiles() { - matchTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "matchTiles", resourceId, packName, ResourceRedirectHandler.get(resourceManager)); + matchTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "matchTiles", resourceId, packId, ResourceRedirectHandler.get(resourceManager)); if (matchTilesSet != null && matchTilesSet.isEmpty()) { valid = false; } } protected void parseMatchBlocks() { - matchBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "matchBlocks", resourceId, packName); + matchBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "matchBlocks", resourceId, packId); if (matchBlocksPredicate == PropertiesParsingHelper.EMPTY_BLOCK_STATE_PREDICATE) { valid = false; } @@ -167,7 +167,7 @@ protected void detectMatches() { protected void validateMatches() { if (matchTilesSet == null && matchBlocksPredicate == null) { - ContinuityClient.LOGGER.error("No tile or block matches provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No tile or block matches provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } } @@ -175,7 +175,7 @@ protected void validateMatches() { protected void parseTiles() { String tilesStr = properties.getProperty("tiles"); if (tilesStr == null) { - ContinuityClient.LOGGER.error("No 'tiles' value provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No 'tiles' value provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; return; } @@ -208,13 +208,13 @@ protected void parseTiles() { if (min <= max) { try { for (int tile = min; tile <= max; tile++) { - listBuilder.add(new Identifier(resourceId.getNamespace(), basePath + tile + ".png")); + listBuilder.add(resourceId.withPath(basePath + tile + ".png")); } } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'", e); } } else { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } continue; } catch (NumberFormatException e) { @@ -271,11 +271,11 @@ protected void parseTiles() { try { listBuilder.add(new Identifier(namespace, path)); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'", e); } } } else { - ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tiles' element '" + tileStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } } @@ -313,7 +313,7 @@ protected void parseFaces() { try { faces.add(Direction.valueOf(faceStr1)); } catch (IllegalArgumentException e) { - ContinuityClient.LOGGER.warn("Unknown 'faces' element '" + faceStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown 'faces' element '" + faceStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } } } @@ -356,7 +356,7 @@ protected void parseBiomes() { Identifier biomeId = new Identifier(biomeStr.toLowerCase(Locale.ROOT)); biomeHolderSet.add(BiomeHolderManager.getOrCreateHolder(biomeId)); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'biomes' element '" + biomeStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'biomes' element '" + biomeStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'", e); } } @@ -446,7 +446,7 @@ protected void parseHeights() { } } } - ContinuityClient.LOGGER.warn("Invalid 'heights' element '" + heightStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'heights' element '" + heightStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } if (!predicateList.isEmpty()) { @@ -480,7 +480,7 @@ protected void parseLegacyHeights() { try { min = Integer.parseInt(minHeightStr.trim()); } catch (NumberFormatException e) { - ContinuityClient.LOGGER.warn("Invalid 'minHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'minHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); hasMinHeight = false; } } @@ -488,7 +488,7 @@ protected void parseLegacyHeights() { try { max = Integer.parseInt(maxHeightStr.trim()); } catch (NumberFormatException e) { - ContinuityClient.LOGGER.warn("Invalid 'maxHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'maxHeight' value '" + minHeightStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); hasMaxHeight = false; } } @@ -586,7 +586,7 @@ protected void parseResourceCondition() { try { resourceId = new Identifier(resourceStr); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid resource '" + resourceStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid resource '" + resourceStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packId + "'", e); continue; } @@ -610,10 +610,10 @@ protected void parseResourceCondition() { break; } } else { - ContinuityClient.LOGGER.warn("Unknown pack '" + packStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown pack '" + packStr + "' in 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + this.resourceId + "' in pack '" + packId + "'"); } } else { - ContinuityClient.LOGGER.warn("Invalid 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'resourceCondition' element '" + conditionStr + "' at index " + i + " in file '" + resourceId + "' in pack '" + packId + "'"); } } } @@ -666,8 +666,8 @@ public Identifier getResourceId() { return resourceId; } - public String getPackName() { - return packName; + public String getPackId() { + return packId; } public int getPackPriority() { diff --git a/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java index ee4ddf3..6e46feb 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java @@ -55,7 +55,7 @@ protected void detectConnect() { protected void validateConnect() { if (connectionPredicate == null) { - ContinuityClient.LOGGER.error("No valid connection type provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No valid connection type provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java index e55b967..4420d74 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/CompactConnectingCtmProperties.java @@ -49,12 +49,12 @@ protected void parseTileReplacements() { try { value = Integer.parseInt(valueStr); } catch (NumberFormatException e) { - ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); continue; } // TODO: deduplicate code if (value < 0) { - ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + key + "' value '" + valueStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); continue; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java index 420f7a1..744e435 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/OrientedConnectingCtmProperties.java @@ -26,7 +26,7 @@ public void init() { } protected void parseOrient() { - OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packName); + OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packId); if (orientationMode != null) { this.orientationMode = orientationMode; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java b/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java index ed914a4..1fe61a0 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java @@ -35,7 +35,7 @@ public final class PropertiesParsingHelper { public static final Predicate EMPTY_BLOCK_STATE_PREDICATE = state -> false; @Nullable - public static Set parseMatchTiles(Properties properties, String propertyKey, Identifier fileLocation, String packName, @Nullable ResourceRedirectHandler redirectHandler) { + public static Set parseMatchTiles(Properties properties, String propertyKey, Identifier fileLocation, String packId, @Nullable ResourceRedirectHandler redirectHandler) { String matchTilesStr = properties.getProperty(propertyKey); if (matchTilesStr == null) { return null; @@ -101,10 +101,10 @@ public static Set parseMatchTiles(Properties properties, String prop try { set.add(new Identifier(namespace, path)); } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'", e); } } else { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + matchTileStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); } } @@ -115,7 +115,7 @@ public static Set parseMatchTiles(Properties properties, String prop } @Nullable - public static Predicate parseBlockStates(Properties properties, String propertyKey, Identifier fileLocation, String packName) { + public static Predicate parseBlockStates(Properties properties, String propertyKey, Identifier fileLocation, String packId) { String blockStatesStr = properties.getProperty(propertyKey); if (blockStatesStr == null) { return null; @@ -146,7 +146,7 @@ public static Predicate parseBlockStates(Properties properties, Stri startIndex = 2; } } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'", e); continue; } @@ -174,20 +174,20 @@ public static Predicate parseBlockStates(Properties properties, Stri if (optionalValue.isPresent()) { valueSet.add(optionalValue.get()); } else { - ContinuityClient.LOGGER.warn("Invalid block property value '" + propertyValueStr + "' for property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid block property value '" + propertyValueStr + "' for property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } } else { - ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } else { - ContinuityClient.LOGGER.warn("Unknown block property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown block property '" + propertyName + "' for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } else { - ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid block property definition for block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); continue Block; } } @@ -214,10 +214,10 @@ public static Predicate parseBlockStates(Properties properties, Stri } } } else { - ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); } } else { - ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid '" + propertyKey + "' element '" + blockStateStr + "' at index " + i + " in file '" + fileLocation + "' in pack '" + packId + "'"); } } @@ -266,7 +266,7 @@ public static Predicate parseBlockStates(Properties properties, Stri } @Nullable - public static Symmetry parseSymmetry(Properties properties, String propertyKey, Identifier fileLocation, String packName) { + public static Symmetry parseSymmetry(Properties properties, String propertyKey, Identifier fileLocation, String packId) { String symmetryStr = properties.getProperty(propertyKey); if (symmetryStr == null) { return null; @@ -275,13 +275,13 @@ public static Symmetry parseSymmetry(Properties properties, String propertyKey, try { return Symmetry.valueOf(symmetryStr.trim().toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { - ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + symmetryStr + "' in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + symmetryStr + "' in file '" + fileLocation + "' in pack '" + packId + "'"); } return null; } @Nullable - public static OrientationMode parseOrientationMode(Properties properties, String propertyKey, Identifier fileLocation, String packName) { + public static OrientationMode parseOrientationMode(Properties properties, String propertyKey, Identifier fileLocation, String packId) { String orientationModeStr = properties.getProperty(propertyKey); if (orientationModeStr == null) { return null; @@ -290,7 +290,7 @@ public static OrientationMode parseOrientationMode(Properties properties, String try { return OrientationMode.valueOf(orientationModeStr.trim().toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { - ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + orientationModeStr + "' in file '" + fileLocation + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown '" + propertyKey + "' value '" + orientationModeStr + "' in file '" + fileLocation + "' in pack '" + packId + "'"); } return null; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java index f7eea82..50352db 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/RandomCtmProperties.java @@ -67,7 +67,7 @@ protected void parseWeights() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.warn("Invalid 'weights' element '" + weightStr + "' at index '" + i + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'weights' element '" + weightStr + "' at index '" + i + "' in file '" + resourceId + "' in pack '" + packId + "'"); } if (!weights.isEmpty()) { @@ -91,11 +91,11 @@ protected void parseRandomLoops() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.warn("Invalid 'randomLoops' value '" + randomLoopsStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'randomLoops' value '" + randomLoopsStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } protected void parseSymmetry() { - Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packName); + Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packId); if (symmetry != null) { this.symmetry = symmetry; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java index 9f93c7f..fd6c71c 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/RepeatCtmProperties.java @@ -31,7 +31,7 @@ public void init() { protected void parseWidth() { String widthStr = properties.getProperty("width"); if (widthStr == null) { - ContinuityClient.LOGGER.error("No 'width' value provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No 'width' value provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; return; } @@ -45,14 +45,14 @@ protected void parseWidth() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.error("Invalid 'width' value '" + widthStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("Invalid 'width' value '" + widthStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } protected void parseHeight() { String heightStr = properties.getProperty("height"); if (heightStr == null) { - ContinuityClient.LOGGER.error("No 'height' value provided in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("No 'height' value provided in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; return; } @@ -66,19 +66,19 @@ protected void parseHeight() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.error("Invalid 'height' value '" + heightStr + "' in file '" + resourceId + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.error("Invalid 'height' value '" + heightStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); valid = false; } protected void parseSymmetry() { - Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packName); + Symmetry symmetry = PropertiesParsingHelper.parseSymmetry(properties, "symmetry", resourceId, packId); if (symmetry != null) { this.symmetry = symmetry; } } protected void parseOrient() { - OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packName); + OrientationMode orientationMode = PropertiesParsingHelper.parseOrientationMode(properties, "orient", resourceId, packId); if (orientationMode != null) { this.orientationMode = orientationMode; } @@ -107,7 +107,7 @@ public boolean validateTileAmount(int amount, T properties) { if (amount == targetAmount) { return true; } - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); return false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java b/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java index 589e686..0636f3e 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/TileAmountValidator.java @@ -31,7 +31,7 @@ public boolean validateTileAmount(int amount, T properties) { if (amount == targetAmount) { return true; } - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires exactly " + targetAmount + " tiles but " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); return false; } } @@ -48,7 +48,7 @@ public boolean validateTileAmount(int amount, T properties) { if (amount >= targetAmount) { return true; } - ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + targetAmount + " tiles but only " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackName() + "'"); + ContinuityClient.LOGGER.error("Method '" + properties.getMethod() + "' requires at least " + targetAmount + " tiles but only " + amount + " were provided in file '" + properties.getResourceId() + "' in pack '" + properties.getPackId() + "'"); return false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java index a6769b0..9aa0772 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/BaseOverlayCtmProperties.java @@ -10,9 +10,9 @@ public class BaseOverlayCtmProperties extends BaseCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public BaseOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public BaseOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java index 5ad4de2..2c64394 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OrientedConnectingOverlayCtmProperties.java @@ -11,9 +11,9 @@ public class OrientedConnectingOverlayCtmProperties extends OrientedConnectingCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public OrientedConnectingOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method, OrientationMode defaultOrientationMode) { - super(properties, id, pack, packPriority, resourceManager, method, defaultOrientationMode); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public OrientedConnectingOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method, OrientationMode defaultOrientationMode) { + super(properties, resourceId, pack, packPriority, resourceManager, method, defaultOrientationMode); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } public OrientedConnectingOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java index f05d185..46cb410 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/OverlayPropertiesSection.java @@ -15,18 +15,18 @@ public class OverlayPropertiesSection { protected Properties properties; - protected Identifier id; - protected String packName; + protected Identifier resourceId; + protected String packId; protected int tintIndex = -1; @Nullable protected BlockState tintBlock; protected BlendMode layer = BlendMode.CUTOUT_MIPPED; - public OverlayPropertiesSection(Properties properties, Identifier id, String packName) { + public OverlayPropertiesSection(Properties properties, Identifier resourceId, String packId) { this.properties = properties; - this.id = id; - this.packName = packName; + this.resourceId = resourceId; + this.packId = packId; } public void init() { @@ -50,7 +50,7 @@ protected void parseTintIndex() { } catch (NumberFormatException e) { // } - ContinuityClient.LOGGER.warn("Invalid 'tintIndex' value '" + tintIndexStr + "' in file '" + id + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tintIndex' value '" + tintIndexStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } protected void parseTintBlock() { @@ -69,7 +69,7 @@ protected void parseTintBlock() { blockId = new Identifier(parts[0], parts[1]); } } catch (InvalidIdentifierException e) { - ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + id + "' in pack '" + packName + "'", e); + ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + resourceId + "' in pack '" + packId + "'", e); return; } @@ -77,10 +77,10 @@ protected void parseTintBlock() { Block block = Registries.BLOCK.get(blockId); tintBlock = block.getDefaultState(); } else { - ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in 'tintBlock' value '" + tintBlockStr + "' in file '" + id + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Unknown block '" + blockId + "' in 'tintBlock' value '" + tintBlockStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } } else { - ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + id + "' in pack '" + packName + "'"); + ContinuityClient.LOGGER.warn("Invalid 'tintBlock' value '" + tintBlockStr + "' in file '" + resourceId + "' in pack '" + packId + "'"); } } @@ -95,7 +95,7 @@ protected void parseLayer() { case "cutout_mipped" -> layer = BlendMode.CUTOUT_MIPPED; case "cutout" -> layer = BlendMode.CUTOUT; case "translucent" -> layer = BlendMode.TRANSLUCENT; - default -> ContinuityClient.LOGGER.warn("Unknown 'layer' value '" + layerStr + " in file '" + id + "' in pack '" + packName + "'"); + default -> ContinuityClient.LOGGER.warn("Unknown 'layer' value '" + layerStr + " in file '" + resourceId + "' in pack '" + packId + "'"); } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java index ed2100c..ba87d79 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RandomOverlayCtmProperties.java @@ -10,9 +10,9 @@ public class RandomOverlayCtmProperties extends RandomCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public RandomOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public RandomOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java index 7e7d229..0960582 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/RepeatOverlayCtmProperties.java @@ -10,9 +10,9 @@ public class RepeatOverlayCtmProperties extends RepeatCtmProperties implements OverlayPropertiesSection.Provider { protected OverlayPropertiesSection overlaySection; - public RepeatOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public RepeatOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override diff --git a/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java index a20fa43..aeba0f0 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/overlay/StandardOverlayCtmProperties.java @@ -21,9 +21,9 @@ public class StandardOverlayCtmProperties extends BasicConnectingCtmProperties i @Nullable protected Predicate connectBlocksPredicate; - public StandardOverlayCtmProperties(Properties properties, Identifier id, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { - super(properties, id, pack, packPriority, resourceManager, method); - overlaySection = new OverlayPropertiesSection(properties, id, packName); + public StandardOverlayCtmProperties(Properties properties, Identifier resourceId, ResourcePack pack, int packPriority, ResourceManager resourceManager, String method) { + super(properties, resourceId, pack, packPriority, resourceManager, method); + overlaySection = new OverlayPropertiesSection(properties, resourceId, packId); } @Override @@ -40,11 +40,11 @@ public OverlayPropertiesSection getOverlayPropertiesSection() { } protected void parseConnectTiles() { - connectTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "connectTiles", resourceId, packName, ResourceRedirectHandler.get(resourceManager)); + connectTilesSet = PropertiesParsingHelper.parseMatchTiles(properties, "connectTiles", resourceId, packId, ResourceRedirectHandler.get(resourceManager)); } protected void parseConnectBlocks() { - connectBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "connectBlocks", resourceId, packName); + connectBlocksPredicate = PropertiesParsingHelper.parseBlockStates(properties, "connectBlocks", resourceId, packId); } @Nullable diff --git a/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java b/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java index 0b16bf5..a1d502b 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java @@ -76,10 +76,10 @@ private static void reload(ResourceManager manager) { } } - private static void reload(Properties properties, Identifier fileLocation, String packName) { + private static void reload(Properties properties, Identifier fileLocation, String packId) { for (BlockLayer blockLayer : BlockLayer.VALUES) { String propertyKey = "layer." + blockLayer.getKey(); - Predicate predicate = PropertiesParsingHelper.parseBlockStates(properties, propertyKey, fileLocation, packName); + Predicate predicate = PropertiesParsingHelper.parseBlockStates(properties, propertyKey, fileLocation, packId); if (predicate != null && predicate != PropertiesParsingHelper.EMPTY_BLOCK_STATE_PREDICATE) { LAYER_PREDICATES[blockLayer.ordinal()] = predicate; empty = false; diff --git a/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java b/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java index 58cef42..a57b995 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/ResourceRedirectHandler.java @@ -88,7 +88,7 @@ public Identifier redirect(Identifier id) { BooleanState invalidIdentifierState = InvalidIdentifierStateHolder.get(); invalidIdentifierState.enable(); - Identifier newId = new Identifier(id.getNamespace(), newPath); + Identifier newId = id.withPath(newPath); invalidIdentifierState.disable(); return newId; diff --git a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java index c80247d..d4fd669 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java +++ b/src/main/java/me/pepperbell/continuity/client/util/biome/BiomeHolderManager.java @@ -44,7 +44,7 @@ public static void refreshHolders() { String path = id.getPath(); String compactPath = path.replace("_", ""); if (!path.equals(compactPath)) { - Identifier compactId = new Identifier(id.getNamespace(), compactPath); + Identifier compactId = id.withPath(compactPath); if (!biomeRegistry.containsId(compactId)) { compactIdMap.put(compactId, id); } From b055564fb8c8643cd187ff5abdc3926480a0c344 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:37:35 -0600 Subject: [PATCH 15/15] Do judge a block by its appearance - Call FabricBlock.getAppearance and use the result where appropriate; Fix #307 - Improve StandardOverlayQuadProcessor - Optimize and clean up code - Fix "two sides adj" case not checking for adjacent blocks with the same overlay before applying corner overlay - Remove explicit dynamic bounds check to improve mod compatibility - Remove key suffix from fields in ProcessingDataKeys --- .../continuity/api/client/QuadProcessor.java | 2 +- .../client/model/CtmBakedModel.java | 27 +- .../processor/AbstractQuadProcessor.java | 8 +- .../processor/BaseProcessingPredicate.java | 10 +- .../processor/CompactCtmQuadProcessor.java | 12 +- .../client/processor/ConnectionPredicate.java | 16 +- .../client/processor/ProcessingDataKeys.java | 12 +- .../client/processor/ProcessingPredicate.java | 2 +- .../client/processor/TopQuadProcessor.java | 10 +- .../overlay/OverlayProcessingPredicate.java | 4 +- .../overlay/SimpleOverlayQuadProcessor.java | 8 +- .../overlay/StandardOverlayQuadProcessor.java | 365 +++++++++--------- .../processor/simple/CtmSpriteProvider.java | 14 +- .../processor/simple/FixedSpriteProvider.java | 2 +- .../simple/HorizontalSpriteProvider.java | 12 +- .../HorizontalVerticalSpriteProvider.java | 16 +- .../simple/RandomSpriteProvider.java | 12 +- .../simple/RepeatSpriteProvider.java | 4 +- .../processor/simple/SimpleQuadProcessor.java | 6 +- .../processor/simple/SpriteProvider.java | 2 +- .../VerticalHorizontalSpriteProvider.java | 16 +- .../simple/VerticalSpriteProvider.java | 12 +- .../BasicConnectingCtmProperties.java | 18 +- .../impl/client/ProcessingContextImpl.java | 3 + 24 files changed, 307 insertions(+), 286 deletions(-) diff --git a/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java b/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java index 06f3e4d..80b3292 100644 --- a/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java @@ -15,7 +15,7 @@ import net.minecraft.world.BlockRenderView; public interface QuadProcessor { - ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context); + ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context); interface ProcessingContext extends ProcessingDataProvider { void addEmitterConsumer(Consumer consumer); diff --git a/src/main/java/me/pepperbell/continuity/client/model/CtmBakedModel.java b/src/main/java/me/pepperbell/continuity/client/model/CtmBakedModel.java index ba9d65f..4cfe785 100644 --- a/src/main/java/me/pepperbell/continuity/client/model/CtmBakedModel.java +++ b/src/main/java/me/pepperbell/continuity/client/model/CtmBakedModel.java @@ -14,6 +14,7 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; @@ -47,7 +48,24 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos return; } - quadTransform.prepare(blockView, state, pos, randomSupplier, ContinuityConfig.INSTANCE.useManualCulling.get(), getSliceFunc(state)); + // The correct way to get the appearance of the origin state from within a block model is to (1) call + // getAppearance on the result of blockView.getBlockState(pos) instead of the passed state and (2) pass the + // pos and world state of the adjacent block as the source pos and source state. + // (1) is not followed here because at this point in execution, within this call to + // CtmBakedModel#emitBlockQuads, the state parameter must already contain the world state. Even if this + // CtmBakedModel is wrapped, then the wrapper must pass the same state as it received because not doing so can + // cause crashes when the wrapped model is a vanilla multipart model or delegates to one. Thus, getting the + // world state again is inefficient and unnecessary. + // (2) is not possible here because the appearance state is necessary to get the slice and only the processors + // within the slice actually perform checks on adjacent blocks. Likewise, the processors themselves cannot + // retrieve the appearance state since the correct processors can only be chosen with the initially correct + // appearance state. + // Additionally, the side is chosen to always be the first constant of the enum (DOWN) for simplicity. Querying + // the appearance for all six sides would be more correct, but less efficient. This may be fixed in the future, + // especially if there is an actual use case for it. + BlockState appearanceState = state.getAppearance(blockView, pos, Direction.DOWN, state, pos); + + quadTransform.prepare(blockView, appearanceState, state, pos, randomSupplier, ContinuityConfig.INSTANCE.useManualCulling.get(), getSliceFunc(appearanceState)); context.pushTransform(quadTransform); super.emitBlockQuads(blockView, state, pos, randomSupplier, context); @@ -87,6 +105,7 @@ protected static class CtmQuadTransform implements RenderContext.QuadTransform { protected final CullingCache cullingCache = new CullingCache(); protected BlockRenderView blockView; + protected BlockState appearanceState; protected BlockState state; protected BlockPos pos; protected Supplier randomSupplier; @@ -116,7 +135,7 @@ protected Boolean transformOnce(MutableQuadView quad, int pass) { QuadProcessors.Slice slice = sliceFunc.apply(sprite); QuadProcessor[] processors = pass == 0 ? slice.processors() : slice.multipassProcessors(); for (QuadProcessor processor : processors) { - QuadProcessor.ProcessingResult result = processor.processQuad(quad, sprite, blockView, state, pos, randomSupplier, pass, processingContext); + QuadProcessor.ProcessingResult result = processor.processQuad(quad, sprite, blockView, appearanceState, state, pos, randomSupplier, pass, processingContext); if (result == QuadProcessor.ProcessingResult.NEXT_PROCESSOR) { continue; } @@ -137,8 +156,9 @@ public boolean isActive() { return active; } - public void prepare(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, boolean useManualCulling, Function sliceFunc) { + public void prepare(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, boolean useManualCulling, Function sliceFunc) { this.blockView = blockView; + this.appearanceState = appearanceState; this.state = state; this.pos = pos; this.randomSupplier = randomSupplier; @@ -153,6 +173,7 @@ public void prepare(BlockRenderView blockView, BlockState state, BlockPos pos, S public void reset() { blockView = null; + appearanceState = null; state = null; pos = null; randomSupplier = null; diff --git a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java index 866175c..74e4fbb 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java @@ -20,12 +20,12 @@ public AbstractQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPre } @Override - public ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { - if (!processingPredicate.shouldProcessQuad(quad, sprite, blockView, state, pos, context)) { + public ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { + if (!processingPredicate.shouldProcessQuad(quad, sprite, blockView, appearanceState, state, pos, context)) { return ProcessingResult.NEXT_PROCESSOR; } - return processQuadInner(quad, sprite, blockView, state, pos, randomSupplier, pass, context); + return processQuadInner(quad, sprite, blockView, appearanceState, state, pos, randomSupplier, pass, context); } - public abstract ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context); + public abstract ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context); } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java b/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java index 6151bde..8713d37 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java @@ -38,7 +38,7 @@ public BaseProcessingPredicate(@Nullable EnumSet faces, @Nullable Pre } @Override - public boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, ProcessingDataProvider dataProvider) { + public boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, ProcessingDataProvider dataProvider) { if (heightPredicate != null) { if (!heightPredicate.test(pos.getY())) { return false; @@ -46,8 +46,8 @@ public boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView b } if (faces != null) { Direction face = quad.lightFace(); - if (state.contains(Properties.AXIS)) { - Direction.Axis axis = state.get(Properties.AXIS); + if (appearanceState.contains(Properties.AXIS)) { + Direction.Axis axis = appearanceState.get(Properties.AXIS); if (axis == Direction.Axis.X) { face = face.rotateClockwise(Direction.Axis.Z); } else if (axis == Direction.Axis.Z) { @@ -59,13 +59,13 @@ public boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView b } } if (biomePredicate != null) { - Biome biome = dataProvider.getData(ProcessingDataKeys.BIOME_CACHE_KEY).get(blockView, pos); + Biome biome = dataProvider.getData(ProcessingDataKeys.BIOME_CACHE).get(blockView, pos); if (biome == null || !biomePredicate.test(biome)) { return false; } } if (blockEntityNamePredicate != null) { - String blockEntityName = dataProvider.getData(ProcessingDataKeys.BLOCK_ENTITY_NAME_CACHE_KEY).get(blockView, pos); + String blockEntityName = dataProvider.getData(ProcessingDataKeys.BLOCK_ENTITY_NAME_CACHE).get(blockView, pos); if (blockEntityName == null || !blockEntityNamePredicate.test(blockEntityName)) { return false; } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/CompactCtmQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/CompactCtmQuadProcessor.java index a95988e..3b37f8f 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/CompactCtmQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/CompactCtmQuadProcessor.java @@ -69,11 +69,11 @@ public CompactCtmQuadProcessor(Sprite[] sprites, ProcessingPredicate processingP } @Override - public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { - int orientation = orientationMode.getOrientation(quad, state); + public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { + int orientation = orientationMode.getOrientation(quad, appearanceState); Direction[] directions = DirectionMaps.getMap(quad.lightFace())[orientation]; - BlockPos.Mutable mutablePos = context.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - int connections = CtmSpriteProvider.getConnections(connectionPredicate, innerSeams, directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + BlockPos.Mutable mutablePos = context.getData(ProcessingDataKeys.MUTABLE_POS); + int connections = CtmSpriteProvider.getConnections(directions, connectionPredicate, innerSeams, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); // @@ -157,7 +157,7 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl return ProcessingResult.STOP; } - VertexContainer vertexContainer = context.getData(ProcessingDataKeys.VERTEX_CONTAINER_KEY); + VertexContainer vertexContainer = context.getData(ProcessingDataKeys.VERTEX_CONTAINER); vertexContainer.fillBaseVertices(quad); QuadEmitter extraQuadEmitter = context.getExtraQuadEmitter(); @@ -385,7 +385,7 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl spriteIndexB = temp; } - VertexContainer vertexContainer = context.getData(ProcessingDataKeys.VERTEX_CONTAINER_KEY); + VertexContainer vertexContainer = context.getData(ProcessingDataKeys.VERTEX_CONTAINER); vertexContainer.fillBaseVertices(quad); QuadEmitter extraQuadEmitter = context.getExtraQuadEmitter(); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java b/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java index acf0cd5..9705ebb 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java @@ -7,17 +7,19 @@ import net.minecraft.world.BlockRenderView; public interface ConnectionPredicate { - boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite); + boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockState otherAppearanceState, BlockState otherState, BlockPos otherPos, Direction face, Sprite quadSprite); - default boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockPos toPos, Direction face, Sprite quadSprite) { - return shouldConnect(blockView, state, pos, blockView.getBlockState(toPos), face, quadSprite); + default boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockPos otherPos, Direction face, Sprite quadSprite) { + BlockState otherState = blockView.getBlockState(otherPos); + BlockState otherAppearanceState = otherState.getAppearance(blockView, otherPos, face, state, pos); + return shouldConnect(blockView, appearanceState, state, pos, otherAppearanceState, otherState, otherPos, face, quadSprite); } - default boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockPos.Mutable toPos, Direction face, Sprite quadSprite, boolean innerSeams) { - if (shouldConnect(blockView, state, pos, toPos, face, quadSprite)) { + default boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockPos.Mutable otherPos, Direction face, Sprite quadSprite, boolean innerSeams) { + if (shouldConnect(blockView, appearanceState, state, pos, otherPos, face, quadSprite)) { if (innerSeams) { - toPos.move(face); - return !shouldConnect(blockView, state, pos, toPos, face, quadSprite); + otherPos.move(face); + return !shouldConnect(blockView, appearanceState, state, pos, otherPos, face, quadSprite); } else { return true; } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java b/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java index e2d7dbe..985843c 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java @@ -11,12 +11,12 @@ import net.minecraft.util.math.BlockPos; public final class ProcessingDataKeys { - public static final ProcessingDataKey MUTABLE_POS_KEY = create("mutable_pos", BlockPos.Mutable::new); - public static final ProcessingDataKey BIOME_CACHE_KEY = create("biome_cache", BaseProcessingPredicate.BiomeCache::new, BaseProcessingPredicate.BiomeCache::reset); - public static final ProcessingDataKey BLOCK_ENTITY_NAME_CACHE_KEY = create("block_entity_name_cache", BaseProcessingPredicate.BlockEntityNameCache::new, BaseProcessingPredicate.BlockEntityNameCache::reset); - public static final ProcessingDataKey VERTEX_CONTAINER_KEY = create("vertex_container", CompactCtmQuadProcessor.VertexContainer::new); - public static final ProcessingDataKey STANDARD_OVERLAY_EMITTER_POOL_KEY = create("standard_overlay_emitter_pool", StandardOverlayQuadProcessor.OverlayEmitterPool::new, StandardOverlayQuadProcessor.OverlayEmitterPool::reset); - public static final ProcessingDataKey SIMPLE_OVERLAY_EMITTER_POOL_KEY = create("simple_overlay_emitter_pool", SimpleOverlayQuadProcessor.OverlayEmitterPool::new, SimpleOverlayQuadProcessor.OverlayEmitterPool::reset); + public static final ProcessingDataKey MUTABLE_POS = create("mutable_pos", BlockPos.Mutable::new); + public static final ProcessingDataKey BIOME_CACHE = create("biome_cache", BaseProcessingPredicate.BiomeCache::new, BaseProcessingPredicate.BiomeCache::reset); + public static final ProcessingDataKey BLOCK_ENTITY_NAME_CACHE = create("block_entity_name_cache", BaseProcessingPredicate.BlockEntityNameCache::new, BaseProcessingPredicate.BlockEntityNameCache::reset); + public static final ProcessingDataKey VERTEX_CONTAINER = create("vertex_container", CompactCtmQuadProcessor.VertexContainer::new); + public static final ProcessingDataKey STANDARD_OVERLAY_EMITTER_POOL = create("standard_overlay_emitter_pool", StandardOverlayQuadProcessor.OverlayEmitterPool::new, StandardOverlayQuadProcessor.OverlayEmitterPool::reset); + public static final ProcessingDataKey SIMPLE_OVERLAY_EMITTER_POOL = create("simple_overlay_emitter_pool", SimpleOverlayQuadProcessor.OverlayEmitterPool::new, SimpleOverlayQuadProcessor.OverlayEmitterPool::reset); private static ProcessingDataKey create(String id, Supplier valueSupplier) { return ProcessingDataKeyRegistry.get().registerKey(ContinuityClient.asId(id), valueSupplier); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/ProcessingPredicate.java b/src/main/java/me/pepperbell/continuity/client/processor/ProcessingPredicate.java index cfd2812..8623793 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/ProcessingPredicate.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/ProcessingPredicate.java @@ -8,5 +8,5 @@ import net.minecraft.world.BlockRenderView; public interface ProcessingPredicate { - boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, ProcessingDataProvider dataProvider); + boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, ProcessingDataProvider dataProvider); } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java index 221c7bd..066114a 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java @@ -25,18 +25,18 @@ public TopQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicat } @Override - public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { + public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { Direction lightFace = quad.lightFace(); Direction.Axis axis; - if (state.contains(Properties.AXIS)) { - axis = state.get(Properties.AXIS); + if (appearanceState.contains(Properties.AXIS)) { + axis = appearanceState.get(Properties.AXIS); } else { axis = Direction.Axis.Y; } if (lightFace.getAxis() != axis) { Direction up = Direction.from(axis, Direction.AxisDirection.POSITIVE); - BlockPos.Mutable mutablePos = context.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos, up); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, lightFace, sprite, innerSeams)) { + BlockPos.Mutable mutablePos = context.getData(ProcessingDataKeys.MUTABLE_POS).set(pos, up); + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, lightFace, sprite, innerSeams)) { return SimpleQuadProcessor.process(quad, sprite, sprites[0]); } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/overlay/OverlayProcessingPredicate.java b/src/main/java/me/pepperbell/continuity/client/processor/overlay/OverlayProcessingPredicate.java index 2b73012..88c4ec4 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/overlay/OverlayProcessingPredicate.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/overlay/OverlayProcessingPredicate.java @@ -24,8 +24,8 @@ public OverlayProcessingPredicate(@Nullable EnumSet faces, @Nullable } @Override - public boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, ProcessingDataProvider dataProvider) { - if (!super.shouldProcessQuad(quad, sprite, blockView, state, pos, dataProvider)) { + public boolean shouldProcessQuad(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, ProcessingDataProvider dataProvider) { + if (!super.shouldProcessQuad(quad, sprite, blockView, appearanceState, state, pos, dataProvider)) { return false; } return QuadUtil.isQuadUnitSquare(quad); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java index e9b0076..091e553 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java @@ -42,11 +42,11 @@ public SimpleOverlayQuadProcessor(SpriteProvider spriteProvider, ProcessingPredi } @Override - public ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { - if (processingPredicate.shouldProcessQuad(quad, sprite, blockView, state, pos, context)) { - Sprite newSprite = spriteProvider.getSprite(quad, sprite, blockView, state, pos, randomSupplier, context); + public ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { + if (processingPredicate.shouldProcessQuad(quad, sprite, blockView, appearanceState, state, pos, context)) { + Sprite newSprite = spriteProvider.getSprite(quad, sprite, blockView, appearanceState, state, pos, randomSupplier, context); if (newSprite != null && !TextureUtil.isMissingSprite(newSprite)) { - OverlayEmitter emitter = context.getData(ProcessingDataKeys.SIMPLE_OVERLAY_EMITTER_POOL_KEY).get(); + OverlayEmitter emitter = context.getData(ProcessingDataKeys.SIMPLE_OVERLAY_EMITTER_POOL).get(); emitter.prepare(quad.lightFace(), newSprite, RenderUtil.getTintColor(tintBlock, blockView, pos, tintIndex), material); context.addEmitterConsumer(emitter); } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java index d83e3fc..d2246b4 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java @@ -34,7 +34,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; -import net.minecraft.world.EmptyBlockView; public class StandardOverlayQuadProcessor extends AbstractQuadProcessor { @Nullable @@ -63,142 +62,140 @@ public StandardOverlayQuadProcessor(Sprite[] sprites, ProcessingPredicate proces this.tintIndex = tintIndex; this.tintBlock = tintBlock; material = RenderUtil.getMaterialFinder().blendMode(0, layer).find(); + + // Turn all missing sprites into null, since it is more efficient to check for a null sprite than a missing + // sprite. There is no functional difference between missing and null sprites for this processor. + for (int i = 0; i < sprites.length; i++) { + Sprite sprite = sprites[i]; + if (TextureUtil.isMissingSprite(sprite)) { + sprites[i] = null; + } + } } @Override - public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { + public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { Direction lightFace = quad.lightFace(); - OverlayEmitter emitter = getEmitter(blockView, pos, state, lightFace, sprite, DirectionMaps.getMap(lightFace)[0], context); + OverlayEmitter emitter = getEmitter(blockView, appearanceState, state, pos, lightFace, sprite, DirectionMaps.getMap(lightFace)[0], context); if (emitter != null) { context.addEmitterConsumer(emitter); } return ProcessingResult.NEXT_PROCESSOR; } - protected boolean appliesOverlay(BlockState other, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { - if (other.getBlock().hasDynamicBounds()) { - return false; - } - if (!other.isFullCube(EmptyBlockView.INSTANCE, BlockPos.ORIGIN)) { + protected boolean appliesOverlay(BlockState otherAppearanceState, BlockState otherState, BlockPos otherPos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + // OptiFine never applies overlays from blocks with dynamic bounds. To improve mod compatibility, call + // isFullCube with the correct values and do not check for dynamic bounds explicitly. For vanilla blocks, this + // change only makes it so retracted pistons and shulker boxes can apply overlays. + if (!otherState.isFullCube(blockView, otherPos)) { return false; } if (connectBlocksPredicate != null) { - if (!connectBlocksPredicate.test(other)) { + if (!connectBlocksPredicate.test(otherAppearanceState)) { return false; } } if (connectTilesSet != null) { - if (!connectTilesSet.contains(SpriteCalculator.getSprite(other, face).getContents().getId())) { + if (!connectTilesSet.contains(SpriteCalculator.getSprite(otherAppearanceState, face).getContents().getId())) { return false; } } - return !connectionPredicate.shouldConnect(blockView, state, pos, other, face, quadSprite); + return !connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, otherAppearanceState, otherState, otherPos, face, quadSprite); } - protected boolean hasSameOverlay(BlockState other, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + protected boolean hasSameOverlay(@Nullable BlockState otherAppearanceState, Direction face) { + if (otherAppearanceState == null) { + return false; + } if (matchBlocksPredicate != null) { - if (!matchBlocksPredicate.test(other)) { + if (!matchBlocksPredicate.test(otherAppearanceState)) { return false; } } if (matchTilesSet != null) { - if (!matchTilesSet.contains(SpriteCalculator.getSprite(other, face).getContents().getId())) { + if (!matchTilesSet.contains(SpriteCalculator.getSprite(otherAppearanceState, face).getContents().getId())) { return false; } } return true; } - protected boolean appliesOverlayUnobscured(BlockState state0, Direction direction0, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - boolean a0 = appliesOverlay(state0, blockView, state, pos, lightFace, quadSprite); - if (a0) { - mutablePos.set(pos, direction0).move(lightFace); - a0 = !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); - } - return a0; - } - - protected boolean hasSameOverlayUnobscured(BlockState state0, Direction direction0, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - boolean s0 = hasSameOverlay(state0, blockView, state, pos, lightFace, quadSprite); - if (s0) { - mutablePos.set(pos, direction0).move(lightFace); - s0 = !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); - } - return s0; - } - - protected boolean appliesOverlayCorner(Direction direction0, Direction direction1, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - mutablePos.set(pos, direction0).move(direction1); - boolean corner0 = appliesOverlay(blockView.getBlockState(mutablePos), blockView, state, pos, lightFace, quadSprite); - if (corner0) { + protected boolean appliesOverlayCorner(Direction dir0, Direction dir1, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction lightFace, Sprite quadSprite) { + mutablePos.set(pos, dir0).move(dir1); + BlockState otherState = blockView.getBlockState(mutablePos); + BlockState otherAppearanceState = otherState.getAppearance(blockView, mutablePos, lightFace, state, pos); + if (appliesOverlay(otherAppearanceState, otherState, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { mutablePos.move(lightFace); - corner0 = !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); + return !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); } - return corner0; + return false; } - protected OverlayEmitter fromCorner(Direction direction0, Direction direction1, int sprite0, int sprite1, OverlayEmitter emitter, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { + protected OverlayEmitter fromTwoSidesAdj(OverlayEmitter emitter, @Nullable BlockState appearanceState0, @Nullable BlockState appearanceState1, Direction dir0, Direction dir1, int sprite, int spriteC01, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction lightFace, Sprite quadSprite) { prepareEmitter(emitter, lightFace, blockView, pos); - emitter.addSprite(sprites[sprite0]); - mutablePos.set(pos, direction0).move(direction1); - if (appliesOverlay(blockView.getBlockState(mutablePos), blockView, state, pos, lightFace, quadSprite)) { - mutablePos.move(lightFace); - if (!blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { - emitter.addSprite(sprites[sprite1]); - } + emitter.addSprite(sprites[sprite]); + // OptiFine does not check whether the other two adjacent blocks have the same overlay before trying to apply + // the corner overlay. I consider this a bug since it is inconsistent with other cases, so it is fixed here by + // checking those blocks. + if ((hasSameOverlay(appearanceState0, lightFace) + || hasSameOverlay(appearanceState1, lightFace)) + && appliesOverlayCorner(dir0, dir1, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + emitter.addSprite(sprites[spriteC01]); } return emitter; } - protected OverlayEmitter fromOneSide(BlockState state0, BlockState state1, BlockState state2, Direction direction0, Direction direction1, Direction direction2, int sprite0, int sprite1, int sprite2, OverlayEmitter emitter, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - boolean s0 = hasSameOverlayUnobscured(state0, direction0, blockView, pos, state, lightFace, quadSprite, mutablePos); - boolean s1 = hasSameOverlayUnobscured(state1, direction1, blockView, pos, state, lightFace, quadSprite, mutablePos); - boolean s2 = hasSameOverlayUnobscured(state2, direction2, blockView, pos, state, lightFace, quadSprite, mutablePos); + protected OverlayEmitter fromOneSide(OverlayEmitter emitter, @Nullable BlockState appearanceState0, @Nullable BlockState appearanceState1, @Nullable BlockState appearanceState2, Direction dir0, Direction dir1, Direction dir2, int sprite, int spriteC01, int spriteC12, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction lightFace, Sprite quadSprite) { + boolean c01; + boolean c12; + if (hasSameOverlay(appearanceState1, lightFace)) { + c01 = true; + c12 = true; + } else { + c01 = hasSameOverlay(appearanceState0, lightFace); + c12 = hasSameOverlay(appearanceState2, lightFace); + } prepareEmitter(emitter, lightFace, blockView, pos); - emitter.addSprite(sprites[sprite0]); - if (s0 | s1) { - if (appliesOverlayCorner(direction0, direction1, blockView, pos, state, lightFace, quadSprite, mutablePos)) { - emitter.addSprite(sprites[sprite1]); - } + emitter.addSprite(sprites[sprite]); + if (c01 && appliesOverlayCorner(dir0, dir1, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + emitter.addSprite(sprites[spriteC01]); } - if (s1 | s2) { - if (appliesOverlayCorner(direction1, direction2, blockView, pos, state, lightFace, quadSprite, mutablePos)) { - emitter.addSprite(sprites[sprite2]); - } + if (c12 && appliesOverlayCorner(dir1, dir2, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + emitter.addSprite(sprites[spriteC12]); } return emitter; } protected static OverlayEmitter getEmitter(ProcessingDataProvider dataProvider) { - return dataProvider.getData(ProcessingDataKeys.STANDARD_OVERLAY_EMITTER_POOL_KEY).get(); + return dataProvider.getData(ProcessingDataKeys.STANDARD_OVERLAY_EMITTER_POOL).get(); } protected void prepareEmitter(OverlayEmitter emitter, Direction face, BlockRenderView blockView, BlockPos pos) { emitter.prepare(face, RenderUtil.getTintColor(tintBlock, blockView, pos, tintIndex), material); } - protected OverlayEmitter prepareEmitter(OverlayEmitter emitter, Direction face, BlockRenderView blockView, BlockPos pos, int sprite1) { + protected OverlayEmitter prepareEmitter(OverlayEmitter emitter, Direction face, BlockRenderView blockView, BlockPos pos, int sprite0) { prepareEmitter(emitter, face, blockView, pos); - emitter.addSprite(sprites[sprite1]); + emitter.addSprite(sprites[sprite0]); return emitter; } - protected OverlayEmitter prepareEmitter(OverlayEmitter emitter, Direction face, BlockRenderView blockView, BlockPos pos, int sprite1, int sprite2) { + protected OverlayEmitter prepareEmitter(OverlayEmitter emitter, Direction face, BlockRenderView blockView, BlockPos pos, int sprite0, int sprite1) { prepareEmitter(emitter, face, blockView, pos); + emitter.addSprite(sprites[sprite0]); emitter.addSprite(sprites[sprite1]); - emitter.addSprite(sprites[sprite2]); return emitter; } /* - 0: D R (CORNER) + 0: CORNER D+R 1: D - 2: L D (CORNER) + 2: CORNER L+D 3: D R 4: L D 5: L D R - 6: L D T + 6: L D U 7: R 8: L D R U 9: L @@ -206,127 +203,126 @@ protected OverlayEmitter prepareEmitter(OverlayEmitter emitter, Direction face, 11: L U 12: D R U 13: L R U - 14: R U (CORNER) + 14: CORNER R+U 15: U - 16: L U (CORNER) + 16: CORNER L+U */ @Nullable - protected OverlayEmitter getEmitter(BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, Direction[] directions, ProcessingDataProvider dataProvider) { - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - - // - - mutablePos.set(pos, directions[0]); - BlockState state0 = blockView.getBlockState(mutablePos); - boolean left = appliesOverlayUnobscured(state0, directions[0], blockView, pos, state, lightFace, quadSprite, mutablePos); - mutablePos.set(pos, directions[1]); - BlockState state1 = blockView.getBlockState(mutablePos); - boolean down = appliesOverlayUnobscured(state1, directions[1], blockView, pos, state, lightFace, quadSprite, mutablePos); - mutablePos.set(pos, directions[2]); - BlockState state2 = blockView.getBlockState(mutablePos); - boolean right = appliesOverlayUnobscured(state2, directions[2], blockView, pos, state, lightFace, quadSprite, mutablePos); - mutablePos.set(pos, directions[3]); - BlockState state3 = blockView.getBlockState(mutablePos); - boolean up = appliesOverlayUnobscured(state3, directions[3], blockView, pos, state, lightFace, quadSprite, mutablePos); - - // - - if (left & down & right & up) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 8); - } - if (left & down & right) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 5); - } - if (left & down & up) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 6); - } - if (left & right & up) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 13); - } - if (down & right & up) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 12); - } - - if (left & right) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 9, 7); - } - if (up & down) { - return prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 15, 1); - } - - if (left & down) { - return fromCorner(directions[2], directions[3], 4, 14, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (down & right) { - return fromCorner(directions[0], directions[3], 3, 16, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (right & up) { - return fromCorner(directions[0], directions[1], 10, 2, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (up & left) { - return fromCorner(directions[1], directions[2], 11, 0, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - - // - - if (left) { - return fromOneSide(state1, state2, state3, directions[1], directions[2], directions[3], 9, 0, 14, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (down) { - return fromOneSide(state2, state3, state0, directions[2], directions[3], directions[0], 1, 14, 16, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (right) { - return fromOneSide(state3, state0, state1, directions[3], directions[0], directions[1], 7, 16, 2, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (up) { - return fromOneSide(state0, state1, state2, directions[0], directions[1], directions[2], 15, 2, 0, getEmitter(dataProvider), blockView, pos, state, lightFace, quadSprite, mutablePos); - } - - // - - boolean s0 = hasSameOverlayUnobscured(state0, directions[0], blockView, pos, state, lightFace, quadSprite, mutablePos); - boolean s1 = hasSameOverlayUnobscured(state1, directions[1], blockView, pos, state, lightFace, quadSprite, mutablePos); - boolean s2 = hasSameOverlayUnobscured(state2, directions[2], blockView, pos, state, lightFace, quadSprite, mutablePos); - boolean s3 = hasSameOverlayUnobscured(state3, directions[3], blockView, pos, state, lightFace, quadSprite, mutablePos); - - boolean corner0 = false; - boolean corner1 = false; - boolean corner2 = false; - boolean corner3 = false; - if (s0 | s1) { - corner0 = appliesOverlayCorner(directions[0], directions[1], blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (s1 | s2) { - corner1 = appliesOverlayCorner(directions[1], directions[2], blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (s2 | s3) { - corner2 = appliesOverlayCorner(directions[2], directions[3], blockView, pos, state, lightFace, quadSprite, mutablePos); - } - if (s3 | s0) { - corner3 = appliesOverlayCorner(directions[3], directions[0], blockView, pos, state, lightFace, quadSprite, mutablePos); - } - - if (corner0 | corner1 | corner2 | corner3) { - OverlayEmitter emitter = getEmitter(dataProvider); - prepareEmitter(emitter, lightFace, blockView, pos); - if (corner0) { - emitter.addSprite(sprites[2]); + protected OverlayEmitter getEmitter(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction lightFace, Sprite quadSprite, Direction[] directions, ProcessingDataProvider dataProvider) { + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS); + + // [up] | [right] | [down] | [left] + // 8 + // 1 * 4 + // 2 + int applications = 0; + + mutablePos.set(pos, directions[0]).move(lightFace); + BlockState appearanceState0; + if (!blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { + mutablePos.set(pos, directions[0]); + BlockState state0 = blockView.getBlockState(mutablePos); + appearanceState0 = state0.getAppearance(blockView, mutablePos, lightFace, state, pos); + if (appliesOverlay(appearanceState0, state0, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + applications |= 0b0001; } - if (corner1) { - emitter.addSprite(sprites[0]); + } else { + appearanceState0 = null; + } + + mutablePos.set(pos, directions[1]).move(lightFace); + BlockState appearanceState1; + if (!blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { + mutablePos.set(pos, directions[1]); + BlockState state1 = blockView.getBlockState(mutablePos); + appearanceState1 = state1.getAppearance(blockView, mutablePos, lightFace, state, pos); + if (appliesOverlay(appearanceState1, state1, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + applications |= 0b0010; } - if (corner2) { - emitter.addSprite(sprites[14]); + } else { + appearanceState1 = null; + } + + mutablePos.set(pos, directions[2]).move(lightFace); + BlockState appearanceState2; + if (!blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { + mutablePos.set(pos, directions[2]); + BlockState state2 = blockView.getBlockState(mutablePos); + appearanceState2 = state2.getAppearance(blockView, mutablePos, lightFace, state, pos); + if (appliesOverlay(appearanceState2, state2, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + applications |= 0b0100; } - if (corner3) { - emitter.addSprite(sprites[16]); + } else { + appearanceState2 = null; + } + + mutablePos.set(pos, directions[3]).move(lightFace); + BlockState appearanceState3; + if (!blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { + mutablePos.set(pos, directions[3]); + BlockState state3 = blockView.getBlockState(mutablePos); + appearanceState3 = state3.getAppearance(blockView, mutablePos, lightFace, state, pos); + if (appliesOverlay(appearanceState3, state3, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite)) { + applications |= 0b1000; } - return emitter; - } - - // - - return null; + } else { + appearanceState3 = null; + } + + return switch (applications) { + case 0b1111 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 8); + case 0b0111 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 5); + case 0b1011 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 6); + case 0b1101 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 13); + case 0b1110 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 12); + // + case 0b0101 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 9, 7); + case 0b1010 -> prepareEmitter(getEmitter(dataProvider), lightFace, blockView, pos, 1, 15); + // + case 0b0011 -> fromTwoSidesAdj(getEmitter(dataProvider), appearanceState2, appearanceState3, directions[2], directions[3], 4, 14, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + case 0b0110 -> fromTwoSidesAdj(getEmitter(dataProvider), appearanceState3, appearanceState0, directions[3], directions[0], 3, 16, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + case 0b1100 -> fromTwoSidesAdj(getEmitter(dataProvider), appearanceState0, appearanceState1, directions[0], directions[1], 10, 2, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + case 0b1001 -> fromTwoSidesAdj(getEmitter(dataProvider), appearanceState1, appearanceState2, directions[1], directions[2], 11, 0, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + // + case 0b0001 -> fromOneSide(getEmitter(dataProvider), appearanceState1, appearanceState2, appearanceState3, directions[1], directions[2], directions[3], 9, 0, 14, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + case 0b0010 -> fromOneSide(getEmitter(dataProvider), appearanceState2, appearanceState3, appearanceState0, directions[2], directions[3], directions[0], 1, 14, 16, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + case 0b0100 -> fromOneSide(getEmitter(dataProvider), appearanceState3, appearanceState0, appearanceState1, directions[3], directions[0], directions[1], 7, 16, 2, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + case 0b1000 -> fromOneSide(getEmitter(dataProvider), appearanceState0, appearanceState1, appearanceState2, directions[0], directions[1], directions[2], 15, 2, 0, mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + // + case 0b0000 -> { + boolean s0 = hasSameOverlay(appearanceState0, lightFace); + boolean s1 = hasSameOverlay(appearanceState1, lightFace); + boolean s2 = hasSameOverlay(appearanceState2, lightFace); + boolean s3 = hasSameOverlay(appearanceState3, lightFace); + + boolean c01 = (s0 | s1) && appliesOverlayCorner(directions[0], directions[1], mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + boolean c12 = (s1 | s2) && appliesOverlayCorner(directions[1], directions[2], mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + boolean c23 = (s2 | s3) && appliesOverlayCorner(directions[2], directions[3], mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + boolean c30 = (s3 | s0) && appliesOverlayCorner(directions[3], directions[0], mutablePos, blockView, appearanceState, state, pos, lightFace, quadSprite); + + if (c01 | c12 | c23 | c30) { + OverlayEmitter emitter = getEmitter(dataProvider); + prepareEmitter(emitter, lightFace, blockView, pos); + if (c01) { + emitter.addSprite(sprites[2]); + } + if (c12) { + emitter.addSprite(sprites[0]); + } + if (c23) { + emitter.addSprite(sprites[14]); + } + if (c30) { + emitter.addSprite(sprites[16]); + } + yield emitter; + } + + yield null; + } + // + default -> throw new IllegalStateException("Unexpected value: " + applications); + }; } public static class OverlayEmitter implements Consumer { @@ -353,10 +349,9 @@ public void prepare(Direction face, int color, RenderMaterial material) { this.material = material; } - public void addSprite(Sprite sprite) { - if (sprite != null && !TextureUtil.isMissingSprite(sprite)) { - sprites[spriteAmount] = sprite; - spriteAmount++; + public void addSprite(@Nullable Sprite sprite) { + if (sprite != null) { + sprites[spriteAmount++] = sprite; } } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/CtmSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/CtmSpriteProvider.java index 9cb170a..9246e52 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/CtmSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/CtmSpriteProvider.java @@ -56,18 +56,18 @@ public CtmSpriteProvider(Sprite[] sprites, ConnectionPredicate connectionPredica @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, state); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - int connections = getConnections(connectionPredicate, innerSeams, directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, appearanceState); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS); + int connections = getConnections(directions, connectionPredicate, innerSeams, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); return sprites[SPRITE_INDEX_MAP[connections]]; } - public static int getConnections(ConnectionPredicate connectionPredicate, boolean innerSeams, Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + public static int getConnections(Direction[] directions, ConnectionPredicate connectionPredicate, boolean innerSeams, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 4; i++) { mutablePos.set(pos, directions[i]); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << (i * 2); } } @@ -76,7 +76,7 @@ public static int getConnections(ConnectionPredicate connectionPredicate, boolea int index2 = (i + 1) % 4; if (((connections >>> index1 * 2) & 1) == 1 && ((connections >>> index2 * 2) & 1) == 1) { mutablePos.set(pos, directions[index1]).move(directions[index2]); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << (i * 2 + 1); } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java index 67f9e19..4be8eac 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java @@ -22,7 +22,7 @@ public FixedSpriteProvider(Sprite sprite) { @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { return this.sprite; } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalSpriteProvider.java index 11ccc2b..2aaa68a 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalSpriteProvider.java @@ -39,18 +39,18 @@ public HorizontalSpriteProvider(Sprite[] sprites, ConnectionPredicate connection @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, state); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - int connections = getConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, appearanceState); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS); + int connections = getConnections(directions, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); return sprites[SPRITE_INDEX_MAP[connections]]; } - protected int getConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + protected int getConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 2; i++) { mutablePos.set(pos, directions[i * 2]); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << i; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalVerticalSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalVerticalSpriteProvider.java index 1781149..6e97648 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalVerticalSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/HorizontalVerticalSpriteProvider.java @@ -36,28 +36,28 @@ public HorizontalVerticalSpriteProvider(Sprite[] sprites, ConnectionPredicate co @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, state); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - int connections = getConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, appearanceState); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS); + int connections = getConnections(directions, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); if (connections != 0) { return sprites[SPRITE_INDEX_MAP[connections]]; } else { - int secondaryConnections = getSecondaryConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + int secondaryConnections = getSecondaryConnections(directions, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); return sprites[SECONDARY_SPRITE_INDEX_MAP[secondaryConnections]]; } } - protected int getSecondaryConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + protected int getSecondaryConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 2; i++) { Direction direction = directions[i * 2 + 1]; mutablePos.set(pos, direction); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << (i * 3 + 1); for (int j = 0; j < 2; j++) { mutablePos.set(pos, direction).move(directions[((i + j) % 2) * 2]); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << (i * 3 + j * 2); } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java index 3fdf36b..60da9bf 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java @@ -36,26 +36,26 @@ public RandomSpriteProvider(Sprite[] sprites, RandomIndexProvider indexProvider, @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Direction face = symmetry.apply(quad.lightFace()); + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + Direction face = quad.lightFace(); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); if (linked) { - Block block = state.getBlock(); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos); + Block block = appearanceState.getBlock(); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS).set(pos); int i = 0; do { mutablePos.setY(mutablePos.getY() - 1); i++; - } while (i < 3 && block == blockView.getBlockState(mutablePos).getBlock()); + } while (i < 3 && block == blockView.getBlockState(mutablePos).getAppearance(blockView, mutablePos, face, state, pos).getBlock()); y = mutablePos.getY() + 1; } - int seed = MathUtil.mix(x, y, z, face.ordinal(), randomLoops); + int seed = MathUtil.mix(x, y, z, symmetry.apply(face).ordinal(), randomLoops); return sprites[indexProvider.getRandomIndex(seed)]; } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java index 1c2a049..9c3ac23 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java @@ -33,7 +33,7 @@ public RepeatSpriteProvider(Sprite[] sprites, int width, int height, Symmetry sy @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { Direction face = symmetry.apply(quad.lightFace()); int x = pos.getX(); @@ -77,7 +77,7 @@ public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, } } - switch (orientationMode.getOrientation(quad, state)) { + switch (orientationMode.getOrientation(quad, appearanceState)) { case 1 -> { int temp = spriteX; spriteX = -spriteY - 1; diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java index 92101d7..f2207d5 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java @@ -28,11 +28,11 @@ public SimpleQuadProcessor(SpriteProvider spriteProvider, ProcessingPredicate pr } @Override - public ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { - if (!processingPredicate.shouldProcessQuad(quad, sprite, blockView, state, pos, context)) { + public ProcessingResult processQuad(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, ProcessingContext context) { + if (!processingPredicate.shouldProcessQuad(quad, sprite, blockView, appearanceState, state, pos, context)) { return ProcessingResult.NEXT_PROCESSOR; } - Sprite newSprite = spriteProvider.getSprite(quad, sprite, blockView, state, pos, randomSupplier, context); + Sprite newSprite = spriteProvider.getSprite(quad, sprite, blockView, appearanceState, state, pos, randomSupplier, context); return process(quad, sprite, newSprite); } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java index 5c87131..479c3b2 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java @@ -15,7 +15,7 @@ public interface SpriteProvider { @Nullable - Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider); + Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider); interface Factory { SpriteProvider createSpriteProvider(Sprite[] sprites, T properties); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalHorizontalSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalHorizontalSpriteProvider.java index dd455a8..055af0c 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalHorizontalSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalHorizontalSpriteProvider.java @@ -36,28 +36,28 @@ public VerticalHorizontalSpriteProvider(Sprite[] sprites, ConnectionPredicate co @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, state); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - int connections = getConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, appearanceState); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS); + int connections = getConnections(directions, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); if (connections != 0) { return sprites[SPRITE_INDEX_MAP[connections]]; } else { - int secondaryConnections = getSecondaryConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + int secondaryConnections = getSecondaryConnections(directions, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); return sprites[SECONDARY_SPRITE_INDEX_MAP[secondaryConnections]]; } } - protected int getSecondaryConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + protected int getSecondaryConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 2; i++) { Direction direction = directions[i * 2]; mutablePos.set(pos, direction); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, state, appearanceState, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << (i * 3); for (int j = 0; j < 2; j++) { mutablePos.set(pos, direction).move(directions[((i + j) % 2) * 2 + 1]); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << ((i * 3 + j * 2 + 5) % 6); } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalSpriteProvider.java index b3489e5..5c12377 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/VerticalSpriteProvider.java @@ -41,18 +41,18 @@ public VerticalSpriteProvider(Sprite[] sprites, ConnectionPredicate connectionPr @Override @Nullable - public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, state); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); - int connections = getConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { + Direction[] directions = DirectionMaps.getDirections(orientationMode, quad, appearanceState); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS); + int connections = getConnections(directions, mutablePos, blockView, appearanceState, state, pos, quad.lightFace(), sprite); return sprites[SPRITE_INDEX_MAP[connections]]; } - protected int getConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { + protected int getConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 2; i++) { mutablePos.set(pos, directions[i * 2 + 1]); - if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + if (connectionPredicate.shouldConnect(blockView, appearanceState, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << i; } } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java index 6e46feb..54f5470 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/BasicConnectingCtmProperties.java @@ -67,29 +67,29 @@ public ConnectionPredicate getConnectionPredicate() { public enum ConnectionType implements ConnectionPredicate { BLOCK { @Override - public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { - return state.getBlock() == toState.getBlock(); + public boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockState otherAppearanceState, BlockState otherState, BlockPos otherPos, Direction face, Sprite quadSprite) { + return appearanceState.getBlock() == otherAppearanceState.getBlock(); } }, TILE { @Override - public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { - if (state == toState) { + public boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockState otherAppearanceState, BlockState otherState, BlockPos otherPos, Direction face, Sprite quadSprite) { + if (appearanceState == otherAppearanceState) { return true; } - return quadSprite == SpriteCalculator.getSprite(toState, face); + return quadSprite == SpriteCalculator.getSprite(otherAppearanceState, face); } }, MATERIAL { @Override - public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { - return state.getMaterial() == toState.getMaterial(); + public boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockState otherAppearanceState, BlockState otherState, BlockPos otherPos, Direction face, Sprite quadSprite) { + return appearanceState.getMaterial() == otherAppearanceState.getMaterial(); } }, STATE { @Override - public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { - return state == toState; + public boolean shouldConnect(BlockRenderView blockView, BlockState appearanceState, BlockState state, BlockPos pos, BlockState otherAppearanceState, BlockState otherState, BlockPos otherPos, Direction face, Sprite quadSprite) { + return appearanceState == otherAppearanceState; } }; } diff --git a/src/main/java/me/pepperbell/continuity/impl/client/ProcessingContextImpl.java b/src/main/java/me/pepperbell/continuity/impl/client/ProcessingContextImpl.java index c1d03ce..0f62cf8 100644 --- a/src/main/java/me/pepperbell/continuity/impl/client/ProcessingContextImpl.java +++ b/src/main/java/me/pepperbell/continuity/impl/client/ProcessingContextImpl.java @@ -3,6 +3,8 @@ import java.util.List; import java.util.function.Consumer; +import org.jetbrains.annotations.Nullable; + import it.unimi.dsi.fastutil.objects.ObjectArrayList; import me.pepperbell.continuity.api.client.ProcessingDataKey; import me.pepperbell.continuity.api.client.ProcessingDataKeyRegistry; @@ -54,6 +56,7 @@ public T getData(ProcessingDataKey key) { } @SuppressWarnings("unchecked") + @Nullable public T getDataOrNull(ProcessingDataKey key) { return (T) processingData[key.getRawId()]; }