Skip to content

Commit

Permalink
selector wheel won't show anymore if target has no variants
Browse files Browse the repository at this point in the history
  • Loading branch information
MehVahdJukaar committed Jun 1, 2024
1 parent b89e1d1 commit 17a16a3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public String getVariantOfBlock(Block baseBlock, Block possibleVariant) {
return null;
}

public boolean hasVariants(Block block) {
return !getVariants(block).isEmpty();
}

public Collection<Block> getAllVariants(Block block) {
Map<String, Block> map = getVariants(block).variants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 17a16a3

Please sign in to comment.