From fe53dcc1aaf709eb717bf291b6755d1f0d9f59fc Mon Sep 17 00:00:00 2001 From: Amirhan-Taipovjan-Greatest-I <51203385+Amirhan-Taipovjan-Greatest-I@users.noreply.github.com> Date: Thu, 18 Jan 2024 21:15:25 +0300 Subject: [PATCH 01/48] Actualized Vanilla-ish Tatar Translation! --- src/main/resources/assets/owo/lang/tt_ru.json | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/resources/assets/owo/lang/tt_ru.json diff --git a/src/main/resources/assets/owo/lang/tt_ru.json b/src/main/resources/assets/owo/lang/tt_ru.json new file mode 100644 index 00000000..c4f394fb --- /dev/null +++ b/src/main/resources/assets/owo/lang/tt_ru.json @@ -0,0 +1,56 @@ +{ + "modmenu.descriptionTranslation.owo": "әйе бу начар мин беләм", + "modmenu.summaryTranslation.owo": "әйе бу начар мин беләм", + "text.owo.itemGroup.tab_template": [ + { "index": 0 }, + { "text": " > ", "color": "gray" }, + { "index": 1, "color": "dark_gray" } + ], + "text.owo.itemGroup.select_hint": {"text": "Берничә сайлау өчен Shift төймәсенә басыгыз", "color": "gray"}, + "text.owo.configure_hot_reload.title": "Кайнар яңадан йөкләү", + "text.owo.configure_hot_reload.choose_file": "Файлны сайлау", + "text.owo.configure_hot_reload.save": "Саклау", + "text.owo.configure_hot_reload.model": [ + {"text": "Модель: ", "color": "yellow"}, + {"index": 0, "color": "gray"} + ], + "text.owo.configure_hot_reload.reload_from.unset": "Сайланмаган", + "text.owo.configure_hot_reload.reload_from": [ + {"text": "Яңадан йөкләү урыны: ", "color": "yellow"}, + {"index": 0, "color": "gray"} + ], + "text.owo.config.search": "Эзләү...", + "text.owo.config.search.matches": "%$2d нәтиҗәдән %$1d нәтиҗә", + "text.owo.config.search.no_matches": "Нәтиҗәләр юк", + "text.owo.config.must_restart": "Сез керткән кайбер үзгәрешләр куллану өчен яңадан йөкләүне таләп итә", + "text.owo.config.button.exit_minecraft": "Minecraft-тан чыгу", + "text.owo.config.button.ignore_restart": "Яңадан кушу соңрак", + "text.owo.config.button.range.edit_as_text": "Текст кебек үзгәртү", + "text.owo.config.button.range.edit_with_slider": "Шудырма белән үзгәртү", + "text.owo.config.applies_after_restart": [ + {"text": "⏻ ", "color": "#FAEA48"}, + {"text": "Бу көйләү яңадан йөкләүдән соң кулланыла", "color": "gray"} + ], + "text.owo.config.managed_by_server": [ + {"text": "⚑ ", "color": "#EB1D36"}, + {"text": "Бу көйләү сервер белән идарә ителә\n Аны үзгәртү өчен өзелегез", "color": "gray"} + ], + "text.owo.config.button.reload": "Яңадан йөкләү", + "text.owo.config.button.done": "Булды", + "text.owo.config.sections": {"text": "Бүлекләр", "underlined": true}, + "text.owo.config.list.add_entry": "Элементны өстәү", + "text.owo.config.boolean_toggle.enabled": [ + "", + {"text": "[", "color": "gray"}, + {"text": "✔", "color": "#28FFBF"}, + {"text": "]", "color": "gray"}, + " Кушык" + ], + "text.owo.config.boolean_toggle.disabled": [ + "", + {"text": "[", "color": "gray"}, + {"text": "❌", "color": "#EB1D36"}, + {"text": "]", "color": "gray"}, + " Сүнек" + ] +} From 9430849ec569885f23e8e74065a32e2830e2a6dc Mon Sep 17 00:00:00 2001 From: Amirhan-Taipovjan-Greatest-I <51203385+Amirhan-Taipovjan-Greatest-I@users.noreply.github.com> Date: Sat, 27 Apr 2024 18:36:31 +0300 Subject: [PATCH 02/48] =?UTF-8?q?Changed=20"Reload"=20Translation=20to=20j?= =?UTF-8?q?ust=20"=E2=86=BB"=20Symbol=20to=20avoid=20being=20not=20fitting?= =?UTF-8?q?=20in=20Button.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/assets/owo/lang/tt_ru.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/owo/lang/tt_ru.json b/src/main/resources/assets/owo/lang/tt_ru.json index c4f394fb..be474121 100644 --- a/src/main/resources/assets/owo/lang/tt_ru.json +++ b/src/main/resources/assets/owo/lang/tt_ru.json @@ -35,7 +35,7 @@ {"text": "⚑ ", "color": "#EB1D36"}, {"text": "Бу көйләү сервер белән идарә ителә\n Аны үзгәртү өчен өзелегез", "color": "gray"} ], - "text.owo.config.button.reload": "Яңадан йөкләү", + "text.owo.config.button.reload": "↻", "text.owo.config.button.done": "Булды", "text.owo.config.sections": {"text": "Бүлекләр", "underlined": true}, "text.owo.config.list.add_entry": "Элементны өстәү", From 7b19a64281d7268630cff80b25ab1d7b8570b944 Mon Sep 17 00:00:00 2001 From: Amirhan-Taipovjan-Greatest-I <51203385+Amirhan-Taipovjan-Greatest-I@users.noreply.github.com> Date: Wed, 29 May 2024 21:29:17 +0300 Subject: [PATCH 03/48] Actualization of Tatar Translation! --- src/main/resources/assets/owo/lang/tt_ru.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/assets/owo/lang/tt_ru.json b/src/main/resources/assets/owo/lang/tt_ru.json index be474121..4438608b 100644 --- a/src/main/resources/assets/owo/lang/tt_ru.json +++ b/src/main/resources/assets/owo/lang/tt_ru.json @@ -37,6 +37,7 @@ ], "text.owo.config.button.reload": "↻", "text.owo.config.button.done": "Булды", + "text.owo.config.sections_tooltip": "Бүлекләр", "text.owo.config.sections": {"text": "Бүлекләр", "underlined": true}, "text.owo.config.list.add_entry": "Элементны өстәү", "text.owo.config.boolean_toggle.enabled": [ From d2874f8d10b3762ab3ca19bd55cca7df8e292797 Mon Sep 17 00:00:00 2001 From: Basique Date: Mon, 17 Jun 2024 00:45:13 +0300 Subject: [PATCH 04/48] itemgroup: turn OwoItemSettings into an interface injection --- .../owo/itemgroup/OwoItemSettings.java | 89 ++++--------------- .../owo/mixin/itemgroup/ItemMixin.java | 11 +-- .../mixin/itemgroup/ItemSettingsMixin.java | 75 ++++++++++++++++ src/main/resources/fabric.mod.json | 3 + src/main/resources/owo.mixins.json | 1 + .../io/wispforest/uwu/items/UwuItems.java | 3 +- .../uwu/items/UwuTestStickItem.java | 3 +- 7 files changed, 104 insertions(+), 81 deletions(-) create mode 100644 src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java diff --git a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java index 1c82eef2..cb27212f 100644 --- a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java +++ b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java @@ -1,63 +1,48 @@ package io.wispforest.owo.itemgroup; -import net.fabricmc.fabric.api.item.v1.CustomDamageHandler; -import net.fabricmc.fabric.api.item.v1.EquipmentSlotProvider; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.Hand; -import net.minecraft.util.Rarity; import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; import java.util.function.BiConsumer; -public class OwoItemSettings extends Item.Settings { +public interface OwoItemSettings { - @Nullable - private OwoItemGroup group = null; - private int tab = 0; - private BiConsumer stackGenerator = OwoItemGroup.DEFAULT_STACK_GENERATOR; - private boolean trackUsageStat = false; - - public OwoItemSettings group(ItemGroupReference ref) { - this.group = ref.group(); - this.tab = ref.tab(); - return this; + default Item.Settings group(ItemGroupReference ref) { + throw new IllegalStateException("Implemented in mixin."); } /** * @param group The item group this item should appear in */ - public OwoItemSettings group(OwoItemGroup group) { - this.group = group; - return this; + default Item.Settings group(OwoItemGroup group) { + throw new IllegalStateException("Implemented in mixin."); } - public OwoItemGroup group() { - return this.group; + default OwoItemGroup group() { + throw new IllegalStateException("Implemented in mixin."); } - public OwoItemSettings tab(int tab) { - this.tab = tab; - return this; + default Item.Settings tab(int tab) { + throw new IllegalStateException("Implemented in mixin."); } - public int tab() { - return this.tab; + default int tab() { + throw new IllegalStateException("Implemented in mixin."); } /** * @param generator The function this item uses for creating stacks in the * {@link OwoItemGroup} it is in, by default this will be {@link OwoItemGroup#DEFAULT_STACK_GENERATOR} */ - public OwoItemSettings stackGenerator(BiConsumer generator) { - this.stackGenerator = generator; - return this; + default Item.Settings stackGenerator(BiConsumer generator) { + throw new IllegalStateException("Implemented in mixin."); } - public BiConsumer stackGenerator() { - return this.stackGenerator; + default BiConsumer stackGenerator() { + throw new IllegalStateException("Implemented in mixin."); } /** @@ -65,47 +50,11 @@ public BiConsumer stackGenerator() { * for this item every time {@link Item#use(World, PlayerEntity, Hand)} * returns an accepted result */ - public OwoItemSettings trackUsageStat() { - this.trackUsageStat = true; - return this; - } - - public boolean shouldTrackUsageStat() { - return this.trackUsageStat; - } - - @Override - public OwoItemSettings equipmentSlot(EquipmentSlotProvider equipmentSlotProvider) { - return (OwoItemSettings) super.equipmentSlot(equipmentSlotProvider); - } - - @Override - public OwoItemSettings customDamage(CustomDamageHandler handler) { - return (OwoItemSettings) super.customDamage(handler); - } - - @Override - public OwoItemSettings maxCount(int maxCount) { - return (OwoItemSettings) super.maxCount(maxCount); - } - - @Override - public OwoItemSettings maxDamage(int maxDamage) { - return (OwoItemSettings) super.maxDamage(maxDamage); - } - - @Override - public OwoItemSettings recipeRemainder(Item recipeRemainder) { - return (OwoItemSettings) super.recipeRemainder(recipeRemainder); - } - - @Override - public OwoItemSettings rarity(Rarity rarity) { - return (OwoItemSettings) super.rarity(rarity); + default Item.Settings trackUsageStat() { + throw new IllegalStateException("Implemented in mixin."); } - @Override - public OwoItemSettings fireproof() { - return (OwoItemSettings) super.fireproof(); + default boolean shouldTrackUsageStat() { + throw new IllegalStateException("Implemented in mixin."); } } diff --git a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java index e22072b2..3c89b97f 100644 --- a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java +++ b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java @@ -1,7 +1,6 @@ package io.wispforest.owo.mixin.itemgroup; import io.wispforest.owo.itemgroup.OwoItemGroup; -import io.wispforest.owo.itemgroup.OwoItemSettings; import io.wispforest.owo.util.pond.OwoItemExtensions; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; @@ -31,12 +30,10 @@ public class ItemMixin implements OwoItemExtensions { @Inject(method = "", at = @At("TAIL")) private void grabTab(Item.Settings settings, CallbackInfo ci) { - if (settings instanceof OwoItemSettings owoSettings) { - this.owo$tab = owoSettings.tab(); - this.owo$stackGenerator = owoSettings.stackGenerator(); - this.owo$group = owoSettings.group(); - this.owo$trackUsageStat = owoSettings.shouldTrackUsageStat(); - } + this.owo$tab = settings.tab(); + this.owo$stackGenerator = settings.stackGenerator(); + this.owo$group = settings.group(); + this.owo$trackUsageStat = settings.shouldTrackUsageStat(); } @Override diff --git a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java new file mode 100644 index 00000000..3503240d --- /dev/null +++ b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java @@ -0,0 +1,75 @@ +package io.wispforest.owo.mixin.itemgroup; + +import io.wispforest.owo.itemgroup.ItemGroupReference; +import io.wispforest.owo.itemgroup.OwoItemGroup; +import io.wispforest.owo.itemgroup.OwoItemSettings; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.BiConsumer; + +@Mixin(Item.Settings.class) +public class ItemSettingsMixin implements OwoItemSettings { + private OwoItemGroup owo$group = null; + private int owo$tab = 0; + // TODO: OwoItemGroup.DEFAULT_STACK_GENERATOR was inlined to not cause clinit issues. fix. + private BiConsumer owo$stackGenerator = (item, stacks) -> stacks.add(item.getDefaultStack()); + private boolean owo$trackUsageStat = false; + + @Override + public Item.Settings group(ItemGroupReference ref) { + this.owo$group = ref.group(); + this.owo$tab = ref.tab(); + + return (Item.Settings)(Object) this; + } + + @Override + public Item.Settings group(OwoItemGroup group) { + this.owo$group = group; + + return (Item.Settings)(Object) this; + } + + @Override + public OwoItemGroup group() { + return owo$group; + } + + @Override + public Item.Settings tab(int tab) { + this.owo$tab = tab; + + return (Item.Settings)(Object) this; + } + + @Override + public int tab() { + return owo$tab; + } + + @Override + public Item.Settings stackGenerator(BiConsumer generator) { + this.owo$stackGenerator = generator; + + return (Item.Settings)(Object) this; + } + + @Override + public BiConsumer stackGenerator() { + return owo$stackGenerator; + } + + @Override + public Item.Settings trackUsageStat() { + this.owo$trackUsageStat = true; + + return (Item.Settings)(Object) this; + } + + @Override + public boolean shouldTrackUsageStat() { + return owo$trackUsageStat; + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 846bbe01..386789a9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -73,6 +73,9 @@ ], "net/minecraft/class_332": [ "io/wispforest/owo/ui/util/MatrixStackTransformer" + ], + "net/minecraft/class_1792\u0024class_1793": [ + "io/wispforest/owo/itemgroup/OwoItemSettings" ] } } diff --git a/src/main/resources/owo.mixins.json b/src/main/resources/owo.mixins.json index 85f9823e..a1be1899 100644 --- a/src/main/resources/owo.mixins.json +++ b/src/main/resources/owo.mixins.json @@ -21,6 +21,7 @@ "SimpleRegistryMixin", "TagGroupLoaderMixin", "itemgroup.ItemGroupAccessor", + "itemgroup.ItemSettingsMixin", "itemgroup.ItemMixin", "offline.AdvancementProgressAccessor", "offline.PlayerAdvancementTrackerMixin", diff --git a/src/testmod/java/io/wispforest/uwu/items/UwuItems.java b/src/testmod/java/io/wispforest/uwu/items/UwuItems.java index 635c75dd..23e360b1 100644 --- a/src/testmod/java/io/wispforest/uwu/items/UwuItems.java +++ b/src/testmod/java/io/wispforest/uwu/items/UwuItems.java @@ -1,6 +1,5 @@ package io.wispforest.uwu.items; -import io.wispforest.owo.itemgroup.OwoItemSettings; import io.wispforest.owo.registration.annotations.AssignedName; import io.wispforest.owo.registration.annotations.RegistryNamespace; import io.wispforest.owo.registration.reflect.ItemRegistryContainer; @@ -19,7 +18,7 @@ public class UwuItems implements ItemRegistryContainer { public static class OwoCompatItems implements ItemRegistryContainer { @AssignedName("owo_ingot") - public static final Item OWO_COMPAT_ITEM = new Item(new OwoItemSettings().group(Uwu.FOUR_TAB_GROUP).tab(2)); + public static final Item OWO_COMPAT_ITEM = new Item(new Item.Settings().group(Uwu.FOUR_TAB_GROUP).tab(2)); @Override public boolean shouldProcessField(Item value, String identifier, Field field) { diff --git a/src/testmod/java/io/wispforest/uwu/items/UwuTestStickItem.java b/src/testmod/java/io/wispforest/uwu/items/UwuTestStickItem.java index 390a5230..927fb8f1 100644 --- a/src/testmod/java/io/wispforest/uwu/items/UwuTestStickItem.java +++ b/src/testmod/java/io/wispforest/uwu/items/UwuTestStickItem.java @@ -7,7 +7,6 @@ import io.wispforest.endec.impl.KeyedEndec; import io.wispforest.endec.impl.StructEndecBuilder; import io.wispforest.owo.itemgroup.OwoItemGroup; -import io.wispforest.owo.itemgroup.OwoItemSettings; import io.wispforest.owo.ops.WorldOps; import io.wispforest.endec.Endec; import io.wispforest.endec.SerializationContext; @@ -67,7 +66,7 @@ public DataResult encode(String input, DynamicOps ops, T prefix) { private static final KeyedEndec KYED = YEP_SAME_HERE.keyed("kyed", (String) null); public UwuTestStickItem() { - super(new OwoItemSettings() + super(new Item.Settings() .group(Uwu.SIX_TAB_GROUP).tab(3).maxCount(1) .trackUsageStat() .stackGenerator(OwoItemGroup.DEFAULT_STACK_GENERATOR.andThen((item, stacks) -> { From a2543ed576ca3f20927eccc03d30a5c63c253378 Mon Sep 17 00:00:00 2001 From: Basique Date: Tue, 2 Jul 2024 20:25:03 +0300 Subject: [PATCH 05/48] fix backwards compat --- .../owo/itemgroup/OwoItemGroup.java | 5 +- .../owo/itemgroup/OwoItemSettings.java | 86 ++++++++++++++----- .../itemgroup/OwoItemSettingsExtension.java | 60 +++++++++++++ .../owo/itemgroup/gui/ItemGroupTab.java | 4 +- .../mixin/itemgroup/ItemSettingsMixin.java | 4 +- src/main/resources/fabric.mod.json | 2 +- 6 files changed, 133 insertions(+), 28 deletions(-) create mode 100644 src/main/java/io/wispforest/owo/itemgroup/OwoItemSettingsExtension.java diff --git a/src/main/java/io/wispforest/owo/itemgroup/OwoItemGroup.java b/src/main/java/io/wispforest/owo/itemgroup/OwoItemGroup.java index 74d0d2ce..1c3454d1 100644 --- a/src/main/java/io/wispforest/owo/itemgroup/OwoItemGroup.java +++ b/src/main/java/io/wispforest/owo/itemgroup/OwoItemGroup.java @@ -28,9 +28,8 @@ * within, as well as arbitrary buttons with defaults provided for links * to places like GitHub, Modrinth, etc. *

- * Tabs can be populated by using {@link OwoItemSettings} and setting the - * {@link OwoItemSettings#tab(int)}. Furthermore, tags can be used for easily populating - * tabs from data + * Tabs can be populated by setting the {@link OwoItemSettingsExtension#tab(int)}. + * Furthermore, tags can be used for easily populating tabs from data *

* The roots of this implementation originated in Biome Makeover, where it was written by Lemonszz */ diff --git a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java index cb27212f..423b46be 100644 --- a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java +++ b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java @@ -1,48 +1,59 @@ package io.wispforest.owo.itemgroup; +import io.wispforest.owo.Owo; +import net.fabricmc.fabric.api.item.v1.CustomDamageHandler; +import net.fabricmc.fabric.api.item.v1.EquipmentSlotProvider; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.Hand; +import net.minecraft.util.Rarity; import net.minecraft.world.World; import java.util.function.BiConsumer; -public interface OwoItemSettings { +/** + * @deprecated Replaced with {@link OwoItemSettingsExtension}. + */ +@Deprecated(forRemoval = true) +public class OwoItemSettings extends Item.Settings { + public OwoItemSettings() { + Owo.LOGGER.warn("Deprecated OwoItemSettings used, switch to OwoItemSettingsExtension"); + } - default Item.Settings group(ItemGroupReference ref) { - throw new IllegalStateException("Implemented in mixin."); + public OwoItemSettings group(ItemGroupReference ref) { + return (OwoItemSettings) super.group(ref); } /** * @param group The item group this item should appear in */ - default Item.Settings group(OwoItemGroup group) { - throw new IllegalStateException("Implemented in mixin."); + public OwoItemSettings group(OwoItemGroup group) { + return (OwoItemSettings) super.group(group); } - default OwoItemGroup group() { - throw new IllegalStateException("Implemented in mixin."); + public OwoItemGroup group() { + return super.group(); } - default Item.Settings tab(int tab) { - throw new IllegalStateException("Implemented in mixin."); + public OwoItemSettings tab(int tab) { + return (OwoItemSettings) super.tab(tab); } - default int tab() { - throw new IllegalStateException("Implemented in mixin."); + public int tab() { + return super.tab(); } /** * @param generator The function this item uses for creating stacks in the * {@link OwoItemGroup} it is in, by default this will be {@link OwoItemGroup#DEFAULT_STACK_GENERATOR} */ - default Item.Settings stackGenerator(BiConsumer generator) { - throw new IllegalStateException("Implemented in mixin."); + public OwoItemSettings stackGenerator(BiConsumer generator) { + return (OwoItemSettings) super.stackGenerator(generator); } - default BiConsumer stackGenerator() { - throw new IllegalStateException("Implemented in mixin."); + public BiConsumer stackGenerator() { + return super.stackGenerator(); } /** @@ -50,11 +61,46 @@ default BiConsumer stackGenerator() { * for this item every time {@link Item#use(World, PlayerEntity, Hand)} * returns an accepted result */ - default Item.Settings trackUsageStat() { - throw new IllegalStateException("Implemented in mixin."); + public OwoItemSettings trackUsageStat() { + return (OwoItemSettings) super.trackUsageStat(); + } + + public boolean shouldTrackUsageStat() { + return super.shouldTrackUsageStat(); + } + + @Override + public OwoItemSettings equipmentSlot(EquipmentSlotProvider equipmentSlotProvider) { + return (OwoItemSettings) super.equipmentSlot(equipmentSlotProvider); + } + + @Override + public OwoItemSettings customDamage(CustomDamageHandler handler) { + return (OwoItemSettings) super.customDamage(handler); + } + + @Override + public OwoItemSettings maxCount(int maxCount) { + return (OwoItemSettings) super.maxCount(maxCount); + } + + @Override + public OwoItemSettings maxDamage(int maxDamage) { + return (OwoItemSettings) super.maxDamage(maxDamage); + } + + @Override + public OwoItemSettings recipeRemainder(Item recipeRemainder) { + return (OwoItemSettings) super.recipeRemainder(recipeRemainder); + } + + @Override + public OwoItemSettings rarity(Rarity rarity) { + return (OwoItemSettings) super.rarity(rarity); } - default boolean shouldTrackUsageStat() { - throw new IllegalStateException("Implemented in mixin."); + @Override + public OwoItemSettings fireproof() { + return (OwoItemSettings) super.fireproof(); } -} +} \ No newline at end of file diff --git a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettingsExtension.java b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettingsExtension.java new file mode 100644 index 00000000..3fb937cc --- /dev/null +++ b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettingsExtension.java @@ -0,0 +1,60 @@ +package io.wispforest.owo.itemgroup; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.util.Hand; +import net.minecraft.world.World; + +import java.util.function.BiConsumer; + +public interface OwoItemSettingsExtension { + + default Item.Settings group(ItemGroupReference ref) { + throw new IllegalStateException("Implemented in mixin."); + } + + /** + * @param group The item group this item should appear in + */ + default Item.Settings group(OwoItemGroup group) { + throw new IllegalStateException("Implemented in mixin."); + } + + default OwoItemGroup group() { + throw new IllegalStateException("Implemented in mixin."); + } + + default Item.Settings tab(int tab) { + throw new IllegalStateException("Implemented in mixin."); + } + + default int tab() { + throw new IllegalStateException("Implemented in mixin."); + } + + /** + * @param generator The function this item uses for creating stacks in the + * {@link OwoItemGroup} it is in, by default this will be {@link OwoItemGroup#DEFAULT_STACK_GENERATOR} + */ + default Item.Settings stackGenerator(BiConsumer generator) { + throw new IllegalStateException("Implemented in mixin."); + } + + default BiConsumer stackGenerator() { + throw new IllegalStateException("Implemented in mixin."); + } + + /** + * Automatically increment {@link net.minecraft.stat.Stats#USED} + * for this item every time {@link Item#use(World, PlayerEntity, Hand)} + * returns an accepted result + */ + default Item.Settings trackUsageStat() { + throw new IllegalStateException("Implemented in mixin."); + } + + default boolean shouldTrackUsageStat() { + throw new IllegalStateException("Implemented in mixin."); + } +} diff --git a/src/main/java/io/wispforest/owo/itemgroup/gui/ItemGroupTab.java b/src/main/java/io/wispforest/owo/itemgroup/gui/ItemGroupTab.java index b9f2b168..edc61d57 100644 --- a/src/main/java/io/wispforest/owo/itemgroup/gui/ItemGroupTab.java +++ b/src/main/java/io/wispforest/owo/itemgroup/gui/ItemGroupTab.java @@ -2,14 +2,14 @@ import io.wispforest.owo.itemgroup.Icon; import io.wispforest.owo.itemgroup.OwoItemGroup; -import io.wispforest.owo.itemgroup.OwoItemSettings; +import io.wispforest.owo.itemgroup.OwoItemSettingsExtension; import net.minecraft.item.ItemGroup; import net.minecraft.text.Text; import net.minecraft.util.Identifier; /** * Represents a tab inside an {@link OwoItemGroup} that contains all items in the - * passed {@code contentTag}. If you want to use {@link OwoItemSettings#tab(int)} to + * passed {@code contentTag}. If you want to use {@link OwoItemSettingsExtension#tab(int)} to * define the contents, use {@code null} as the tag */ public record ItemGroupTab( diff --git a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java index 3503240d..a1796cf5 100644 --- a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java +++ b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java @@ -2,7 +2,7 @@ import io.wispforest.owo.itemgroup.ItemGroupReference; import io.wispforest.owo.itemgroup.OwoItemGroup; -import io.wispforest.owo.itemgroup.OwoItemSettings; +import io.wispforest.owo.itemgroup.OwoItemSettingsExtension; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import org.spongepowered.asm.mixin.Mixin; @@ -10,7 +10,7 @@ import java.util.function.BiConsumer; @Mixin(Item.Settings.class) -public class ItemSettingsMixin implements OwoItemSettings { +public class ItemSettingsMixin implements OwoItemSettingsExtension { private OwoItemGroup owo$group = null; private int owo$tab = 0; // TODO: OwoItemGroup.DEFAULT_STACK_GENERATOR was inlined to not cause clinit issues. fix. diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 386789a9..67fb4efe 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -75,7 +75,7 @@ "io/wispforest/owo/ui/util/MatrixStackTransformer" ], "net/minecraft/class_1792\u0024class_1793": [ - "io/wispforest/owo/itemgroup/OwoItemSettings" + "io/wispforest/owo/itemgroup/OwoItemSettingsExtension" ] } } From 6f0e50cb8a835a83616f99182510f442d888d7bb Mon Sep 17 00:00:00 2001 From: Basique Date: Tue, 2 Jul 2024 20:25:52 +0300 Subject: [PATCH 06/48] oops --- .../java/io/wispforest/owo/itemgroup/OwoItemSettings.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java index 423b46be..496e5030 100644 --- a/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java +++ b/src/main/java/io/wispforest/owo/itemgroup/OwoItemSettings.java @@ -17,10 +17,6 @@ */ @Deprecated(forRemoval = true) public class OwoItemSettings extends Item.Settings { - public OwoItemSettings() { - Owo.LOGGER.warn("Deprecated OwoItemSettings used, switch to OwoItemSettingsExtension"); - } - public OwoItemSettings group(ItemGroupReference ref) { return (OwoItemSettings) super.group(ref); } From 4efa61d47ca739cf655971a510fb779f88951bdd Mon Sep 17 00:00:00 2001 From: Dragon-Seeker Date: Fri, 5 Jul 2024 19:39:54 -0500 Subject: [PATCH 07/48] Reimplement the ability to wrap ItemGroups and adjust RegistryAccess to fix #252 --- .../owo/itemgroup/json/WrapperGroup.java | 11 ++- .../owo/mixin/SimpleRegistryMixin.java | 34 --------- .../owo/mixin/registry/ReferenceAccessor.java | 15 ++++ .../SimpleRegistryAccessor.java | 7 +- .../mixin/registry/SimpleRegistryMixin.java | 74 +++++++++++++++++++ .../wispforest/owo/util/RegistryAccess.java | 13 +--- .../pond/OwoSimpleRegistryExtensions.java | 12 +++ src/main/resources/owo.mixins.json | 5 +- .../tags/{items => item}/tab_2_content.json | 0 9 files changed, 116 insertions(+), 55 deletions(-) delete mode 100644 src/main/java/io/wispforest/owo/mixin/SimpleRegistryMixin.java create mode 100644 src/main/java/io/wispforest/owo/mixin/registry/ReferenceAccessor.java rename src/main/java/io/wispforest/owo/mixin/{ui => registry}/SimpleRegistryAccessor.java (68%) create mode 100644 src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryMixin.java create mode 100644 src/main/java/io/wispforest/owo/util/pond/OwoSimpleRegistryExtensions.java rename src/testmod/resources/data/uwu/tags/{items => item}/tab_2_content.json (100%) diff --git a/src/main/java/io/wispforest/owo/itemgroup/json/WrapperGroup.java b/src/main/java/io/wispforest/owo/itemgroup/json/WrapperGroup.java index c6ada99b..f9ad0aa3 100644 --- a/src/main/java/io/wispforest/owo/itemgroup/json/WrapperGroup.java +++ b/src/main/java/io/wispforest/owo/itemgroup/json/WrapperGroup.java @@ -1,17 +1,17 @@ package io.wispforest.owo.itemgroup.json; -import com.mojang.serialization.Lifecycle; import io.wispforest.owo.itemgroup.Icon; import io.wispforest.owo.itemgroup.OwoItemGroup; import io.wispforest.owo.itemgroup.gui.ItemGroupButton; import io.wispforest.owo.itemgroup.gui.ItemGroupTab; import io.wispforest.owo.mixin.itemgroup.ItemGroupAccessor; -import io.wispforest.owo.mixin.ui.SimpleRegistryAccessor; +import io.wispforest.owo.mixin.registry.SimpleRegistryAccessor; +import io.wispforest.owo.util.pond.OwoSimpleRegistryExtensions; import net.minecraft.item.ItemGroup; import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.SimpleRegistry; +import net.minecraft.registry.entry.RegistryEntryInfo; import net.minecraft.util.Identifier; import org.jetbrains.annotations.ApiStatus; @@ -34,9 +34,8 @@ public WrapperGroup(ItemGroup parent, Identifier parentId, List ta int parentRawId = Registries.ITEM_GROUP.getRawId(parent); - // TODO: set doesn't exist anymore. figure out what to do. -// ((SimpleRegistryAccessor) Registries.ITEM_GROUP).owo$getValueToEntry().remove(parent); -// ((SimpleRegistry) Registries.ITEM_GROUP).set(parentRawId, RegistryKey.of(RegistryKeys.ITEM_GROUP, parentId), this, Lifecycle.stable()); + ((SimpleRegistryAccessor) Registries.ITEM_GROUP).owo$getValueToEntry().remove(parent); + ((OwoSimpleRegistryExtensions) Registries.ITEM_GROUP).owo$set(parentRawId, RegistryKey.of(RegistryKeys.ITEM_GROUP, parentId), this, RegistryEntryInfo.DEFAULT); ((ItemGroupAccessor) this).owo$setDisplayName(parent.getDisplayName()); ((ItemGroupAccessor) this).owo$setColumn(parent.getColumn()); diff --git a/src/main/java/io/wispforest/owo/mixin/SimpleRegistryMixin.java b/src/main/java/io/wispforest/owo/mixin/SimpleRegistryMixin.java deleted file mode 100644 index 997c5be3..00000000 --- a/src/main/java/io/wispforest/owo/mixin/SimpleRegistryMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.wispforest.owo.mixin; - -import io.wispforest.owo.util.RegistryAccess; -import net.minecraft.registry.SimpleRegistry; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Map; - -@Mixin(SimpleRegistry.class) -public class SimpleRegistryMixin implements RegistryAccess.AccessibleRegistry { - - @Shadow - @Final - private Map> idToEntry; - - @Shadow - @Final - private Map> valueToEntry; - - @Override - public @Nullable RegistryEntry getEntry(Identifier id) { - return this.idToEntry.get(id); - } - - @Override - public @Nullable RegistryEntry getEntry(T value) { - return this.valueToEntry.get(value); - } -} diff --git a/src/main/java/io/wispforest/owo/mixin/registry/ReferenceAccessor.java b/src/main/java/io/wispforest/owo/mixin/registry/ReferenceAccessor.java new file mode 100644 index 00000000..09354e4d --- /dev/null +++ b/src/main/java/io/wispforest/owo/mixin/registry/ReferenceAccessor.java @@ -0,0 +1,15 @@ +package io.wispforest.owo.mixin.registry; + +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(RegistryEntry.Reference.class) +public interface ReferenceAccessor { + @Invoker("setRegistryKey") + void owo$setRegistryKey(RegistryKey registryKey); + + @Invoker("setValue") + void owo$setValue(T value); +} diff --git a/src/main/java/io/wispforest/owo/mixin/ui/SimpleRegistryAccessor.java b/src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryAccessor.java similarity index 68% rename from src/main/java/io/wispforest/owo/mixin/ui/SimpleRegistryAccessor.java rename to src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryAccessor.java index a51860a5..b1219351 100644 --- a/src/main/java/io/wispforest/owo/mixin/ui/SimpleRegistryAccessor.java +++ b/src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryAccessor.java @@ -1,8 +1,8 @@ -package io.wispforest.owo.mixin.ui; +package io.wispforest.owo.mixin.registry; -import com.mojang.serialization.Lifecycle; import net.minecraft.registry.SimpleRegistry; import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -10,8 +10,9 @@ @Mixin(SimpleRegistry.class) public interface SimpleRegistryAccessor { - @Accessor("valueToEntry") Map> owo$getValueToEntry(); + @Accessor("idToEntry") + Map> owo$getIdToEntry(); } diff --git a/src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryMixin.java b/src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryMixin.java new file mode 100644 index 00000000..93adc7ac --- /dev/null +++ b/src/main/java/io/wispforest/owo/mixin/registry/SimpleRegistryMixin.java @@ -0,0 +1,74 @@ +package io.wispforest.owo.mixin.registry; + +import com.mojang.serialization.Lifecycle; +import io.wispforest.owo.util.OwoFreezer; +import io.wispforest.owo.util.pond.OwoSimpleRegistryExtensions; +import it.unimi.dsi.fastutil.objects.ObjectList; +import it.unimi.dsi.fastutil.objects.Reference2IntMap; +import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback; +import net.minecraft.registry.MutableRegistry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.SimpleRegistry; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.entry.RegistryEntryInfo; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Mixin(SimpleRegistry.class) +public abstract class SimpleRegistryMixin implements MutableRegistry, OwoSimpleRegistryExtensions { + + @Shadow private Map> intrusiveValueToEntry; + @Shadow @Final private Map, RegistryEntry.Reference> keyToEntry; + @Shadow @Final private Map> idToEntry; + @Shadow @Final private Map> valueToEntry; + @Shadow @Final private ObjectList> rawIdToEntry; + @Shadow @Final private Reference2IntMap entryToRawId; + @Shadow @Final private Map, RegistryEntryInfo> keyToEntryInfo; + @Shadow private Lifecycle lifecycle; + + //-- + + /** + * Copy of the {@link SimpleRegistry#add} function but uses {@link List#set} instead of {@link List#add} for {@link SimpleRegistry#rawIdToEntry} + */ + public RegistryEntry.Reference owo$set(int id, RegistryKey arg, T object, RegistryEntryInfo arg2) { + OwoFreezer.checkRegister("Registry Set Calls"); //this.assertNotFrozen(arg); + + Objects.requireNonNull(arg); + Objects.requireNonNull(object); + + RegistryEntry.Reference reference; + + if (this.intrusiveValueToEntry != null) { + reference = this.intrusiveValueToEntry.remove(object); + + if (reference == null) { + throw new AssertionError("Missing intrusive holder for " + arg + ":" + object); + } + + ((ReferenceAccessor) reference).owo$setRegistryKey(arg); + } else { + reference = this.keyToEntry.computeIfAbsent(arg, k -> RegistryEntry.Reference.standAlone(this.getEntryOwner(), k)); + ((ReferenceAccessor) reference).owo$setValue((T)object); + } + + this.keyToEntry.put(arg, reference); + this.idToEntry.put(arg.getValue(), reference); + this.valueToEntry.put(object, reference); + this.rawIdToEntry.set(id, reference); + this.entryToRawId.put(object, id); + this.keyToEntryInfo.put(arg, arg2); + this.lifecycle = this.lifecycle.add(arg2.lifecycle()); + + // TODO: SHOULD WE BE REFIREING THE EVENT? + RegistryEntryAddedCallback.event(this).invoker().onEntryAdded(id, arg.getValue(), (T)object); + + return reference; + } +} diff --git a/src/main/java/io/wispforest/owo/util/RegistryAccess.java b/src/main/java/io/wispforest/owo/util/RegistryAccess.java index a090e109..04c229b5 100644 --- a/src/main/java/io/wispforest/owo/util/RegistryAccess.java +++ b/src/main/java/io/wispforest/owo/util/RegistryAccess.java @@ -1,7 +1,7 @@ package io.wispforest.owo.util; +import io.wispforest.owo.mixin.registry.SimpleRegistryAccessor; import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; import net.minecraft.util.Identifier; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.SimpleRegistry; @@ -23,7 +23,7 @@ private RegistryAccess() {} @SuppressWarnings("unchecked") public static RegistryEntry getEntry(Registry registry, Identifier id) { checkSimple(registry); - return ((AccessibleRegistry) registry).getEntry(id); + return ((SimpleRegistryAccessor) registry).owo$getIdToEntry().get(id); } /** @@ -38,7 +38,7 @@ public static RegistryEntry getEntry(Registry registry, Identifier id) @SuppressWarnings("unchecked") public static RegistryEntry getEntry(Registry registry, T value) { checkSimple(registry); - return ((AccessibleRegistry) registry).getEntry(value); + return ((SimpleRegistryAccessor) registry).owo$getValueToEntry().get(value); } private static void checkSimple(Registry registry) { @@ -46,11 +46,4 @@ private static void checkSimple(Registry registry) { throw new IllegalArgumentException("[RegistryAccess] Tried to operate on Registry of class '" + registry.getClass() + "', but only 'SimpleRegistry' and descendants are supported"); } - - public interface AccessibleRegistry { - @Nullable RegistryEntry getEntry(Identifier id); - - @Nullable RegistryEntry getEntry(T value); - } - } diff --git a/src/main/java/io/wispforest/owo/util/pond/OwoSimpleRegistryExtensions.java b/src/main/java/io/wispforest/owo/util/pond/OwoSimpleRegistryExtensions.java new file mode 100644 index 00000000..2b7cc077 --- /dev/null +++ b/src/main/java/io/wispforest/owo/util/pond/OwoSimpleRegistryExtensions.java @@ -0,0 +1,12 @@ +package io.wispforest.owo.util.pond; + +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.entry.RegistryEntryInfo; +import org.jetbrains.annotations.ApiStatus; + +public interface OwoSimpleRegistryExtensions { + + @ApiStatus.Internal + RegistryEntry.Reference owo$set(int id, RegistryKey arg, T object, RegistryEntryInfo arg2); +} diff --git a/src/main/resources/owo.mixins.json b/src/main/resources/owo.mixins.json index 4f60f67d..ec8f45f2 100644 --- a/src/main/resources/owo.mixins.json +++ b/src/main/resources/owo.mixins.json @@ -20,7 +20,6 @@ "ServerPlayerEntityMixin", "ServerPlayerInteractionManagerMixin", "SetComponentsLootFunctionAccessor", - "SimpleRegistryMixin", "TagGroupLoaderMixin", "itemgroup.ItemGroupAccessor", "itemgroup.ItemMixin", @@ -30,13 +29,15 @@ "offline.WorldSaveHandlerMixin", "recipe_remainders.CraftingResultSlotMixin", "recipe_remainders.RecipeManagerMixin", + "registry.SimpleRegistryAccessor", + "registry.SimpleRegistryMixin", + "registry.ReferenceAccessor", "text.LanguageMixin", "text.TextCodecsMixin", "text.TranslatableTextContentMixin", "text.stapi.SystemDelegatedLanguageFixin", "tweaks.EulaReaderMixin", "tweaks.LevelInfoMixin", - "ui.SimpleRegistryAccessor", "ui.SlotAccessor", "ui.SlotMixin", "ui.access.BlockEntityAccessor" diff --git a/src/testmod/resources/data/uwu/tags/items/tab_2_content.json b/src/testmod/resources/data/uwu/tags/item/tab_2_content.json similarity index 100% rename from src/testmod/resources/data/uwu/tags/items/tab_2_content.json rename to src/testmod/resources/data/uwu/tags/item/tab_2_content.json From b3a16ab9b7b78b746f67837fea8e8e34fe61f541 Mon Sep 17 00:00:00 2001 From: Dragon-Seeker Date: Sat, 6 Jul 2024 23:37:32 -0500 Subject: [PATCH 08/48] [endec] Adjust Boolean in EdmOps to check if such is a Byte to be more lenient --- .../io/wispforest/owo/serialization/format/edm/EdmOps.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/wispforest/owo/serialization/format/edm/EdmOps.java b/src/main/java/io/wispforest/owo/serialization/format/edm/EdmOps.java index 67cb79e5..e91e9c1c 100644 --- a/src/main/java/io/wispforest/owo/serialization/format/edm/EdmOps.java +++ b/src/main/java/io/wispforest/owo/serialization/format/edm/EdmOps.java @@ -142,8 +142,10 @@ public DataResult getNumberValue(EdmElement input) { @Override public DataResult getBooleanValue(EdmElement input) { - if (input.value() instanceof Boolean b) { - return DataResult.success(b); + if (input.value() instanceof Boolean bl) { + return DataResult.success(bl); + } else if(input.value() instanceof Byte b) { + return DataResult.success(b == 1); } else { return DataResult.error(() -> "Not a boolean: " + input); } From fb135700d810a1f7c808e7d56b9e8359e2bb2e49 Mon Sep 17 00:00:00 2001 From: Dragon-Seeker Date: Wed, 10 Jul 2024 00:55:18 -0500 Subject: [PATCH 09/48] Fix background rendering for option screens Adds panorama --- .../io/wispforest/owo/mixin/ScreenAccessor.java | 14 ++++++++++++++ .../java/io/wispforest/owo/ui/core/Surface.java | 16 +++++++++++----- src/main/resources/owo.mixins.json | 3 ++- 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 src/main/java/io/wispforest/owo/mixin/ScreenAccessor.java diff --git a/src/main/java/io/wispforest/owo/mixin/ScreenAccessor.java b/src/main/java/io/wispforest/owo/mixin/ScreenAccessor.java new file mode 100644 index 00000000..bc8ce4f2 --- /dev/null +++ b/src/main/java/io/wispforest/owo/mixin/ScreenAccessor.java @@ -0,0 +1,14 @@ +package io.wispforest.owo.mixin; + +import net.minecraft.client.gui.RotatingCubeMapRenderer; +import net.minecraft.client.gui.screen.Screen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(Screen.class) +public interface ScreenAccessor { + @Accessor("ROTATING_PANORAMA_RENDERER") + static RotatingCubeMapRenderer owo$ROTATING_PANORAMA_RENDERER() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/io/wispforest/owo/ui/core/Surface.java b/src/main/java/io/wispforest/owo/ui/core/Surface.java index 22a03a70..af86b74d 100644 --- a/src/main/java/io/wispforest/owo/ui/core/Surface.java +++ b/src/main/java/io/wispforest/owo/ui/core/Surface.java @@ -2,15 +2,13 @@ import com.mojang.blaze3d.systems.RenderSystem; import io.wispforest.owo.client.OwoClient; +import io.wispforest.owo.mixin.ScreenAccessor; import io.wispforest.owo.ui.parsing.UIModelParsingException; import io.wispforest.owo.ui.parsing.UIParsing; import io.wispforest.owo.ui.util.NinePatchTexture; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.tooltip.TooltipBackgroundRenderer; import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -37,8 +35,16 @@ public interface Surface { }; Surface OPTIONS_BACKGROUND = (context, component) -> { - MinecraftClient.getInstance().gameRenderer.renderBlur(0); - MinecraftClient.getInstance().getFramebuffer().beginWrite(false); + var client = MinecraftClient.getInstance(); + var delta = client.getRenderTickCounter().getLastDuration(); + + if (client.world == null) { + ScreenAccessor.owo$ROTATING_PANORAMA_RENDERER() + .render(context, component.width(), component.height(), 1.0F, delta); + } + + client.gameRenderer.renderBlur(delta); + client.getFramebuffer().beginWrite(false); }; Surface TOOLTIP = (context, component) -> { diff --git a/src/main/resources/owo.mixins.json b/src/main/resources/owo.mixins.json index 4f60f67d..eaae15a2 100644 --- a/src/main/resources/owo.mixins.json +++ b/src/main/resources/owo.mixins.json @@ -14,6 +14,7 @@ "NbtCompoundMixin", "PacketByteBufMixin", "RegistryOpsAccessor", + "ScreenAccessor", "ScreenHandlerInvoker", "ScreenHandlerMixin", "ServerCommonNetworkHandlerAccessor", @@ -42,9 +43,9 @@ "ui.access.BlockEntityAccessor" ], "client": [ + "ClientCommonNetworkHandlerAccessor", "ClientConfigurationNetworkHandlerMixin", "ClientLoginNetworkHandlerAccessor", - "ClientCommonNetworkHandlerAccessor", "DrawContextMixin", "MinecraftClientMixin", "itemgroup.AbstractInventoryScreenMixin", From 14d49ef61ee73da9c5671fe37661734906a44642 Mon Sep 17 00:00:00 2001 From: Dragon-Seeker Date: Wed, 10 Jul 2024 01:02:27 -0500 Subject: [PATCH 10/48] Fix test mod config stuff This is the most annoying thing I have had to deal with that has lead to so much lost time that I frankly can not believe that such has been like this for quite some time... I blame you glisco... ok where were we? --- .../resources/assets/uwu/owo_ui/config.xml | 348 ++++++++++++------ 1 file changed, 244 insertions(+), 104 deletions(-) diff --git a/src/testmod/resources/assets/uwu/owo_ui/config.xml b/src/testmod/resources/assets/uwu/owo_ui/config.xml index 31bc35e8..e15fdc82 100644 --- a/src/testmod/resources/assets/uwu/owo_ui/config.xml +++ b/src/testmod/resources/assets/uwu/owo_ui/config.xml @@ -1,4 +1,5 @@ - + @@ -7,65 +8,79 @@ center - - - 8 - - + - + - - - + + + + + + + 3 + + - - 8 - - + 3 + + + 100 + 100 + + + + 1 + + + - 100 + 100 100 - - - 1 - - - 14 - 17 - - - - + + + 50 + + 100 100 + + + #77000000 + #99121212 + + + 1 + + - 90 - 82 + 101 + 100 - #77000000 - #FF121212 + #33FFFFFF - - - + @@ -136,13 +151,16 @@ right center - - - + + 5 + + + + 50 + - 90 - 10 + 100 @@ -151,7 +169,7 @@ center - #77000000 + @@ -162,55 +180,13 @@ - - - - - - - - - - 120 - - - - - - - 100,50 - center - - - - - 100 - 32 - - - - 5 - - - - - - + - + + + + + + + - + - + - -