From 17a16a3aab0818b48c246883b87ffebff4982b2c Mon Sep 17 00:00:00 2001 From: MehVahdJukaar Date: Sat, 1 Jun 2024 12:49:15 +0200 Subject: [PATCH] selector wheel won't show anymore if target has no variants --- build.gradle | 2 ++ .../quark/content/experimental/config/VariantsConfig.java | 3 +++ .../content/experimental/module/VariantSelectorModule.java | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 567f5fa51..ececcb407 100644 --- a/build.gradle +++ b/build.gradle @@ -128,6 +128,8 @@ dependencies { implementation fg.deobf("curse.maven:lootr-361276:${deps.lootr}") implementation fg.deobf("curse.maven:just-enough-resources-jer-240630:4689010") + runtimeOnly fg.deobf("curse.maven:nofog-296468:4601446") + runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${deps.curios}") compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${deps.curios}:api") } diff --git a/src/main/java/org/violetmoon/quark/content/experimental/config/VariantsConfig.java b/src/main/java/org/violetmoon/quark/content/experimental/config/VariantsConfig.java index 71408df2a..bc32b598f 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/config/VariantsConfig.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/config/VariantsConfig.java @@ -147,6 +147,9 @@ public String getVariantOfBlock(Block baseBlock, Block possibleVariant) { return null; } + public boolean hasVariants(Block block) { + return !getVariants(block).isEmpty(); + } public Collection getAllVariants(Block block) { Map map = getVariants(block).variants; diff --git a/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java b/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java index 219ebaf3a..e6f5de8af 100644 --- a/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java +++ b/src/main/java/org/violetmoon/quark/content/experimental/module/VariantSelectorModule.java @@ -273,7 +273,7 @@ public void keystroke(ZInput.Key event) { }else if(!stack.isEmpty() && stack.getItem() instanceof BlockItem bi){ originalBlock = bi.getBlock(); } - if(originalBlock != null){ + if(originalBlock != null && variants.hasVariants(originalBlock)){ mc.setScreen(new VariantSelectorScreen(originalBlock, variantSelectorKey, clientVariant, variants.getVisibleVariants())); } @@ -317,7 +317,7 @@ public void gatherComponents(ZRenderTooltip.GatherComponents event) { } private boolean hasTooltip(ItemStack stack) { - return !stack.isEmpty() && stack.getItem() instanceof BlockItem bi && !variants.getAllVariants(bi.getBlock()).isEmpty(); + return !stack.isEmpty() && stack.getItem() instanceof BlockItem bi && !variants.hasVariants(bi.getBlock()); } @PlayEvent