Skip to content

Commit

Permalink
hide highlight too
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAHuman-xD committed May 16, 2024
1 parent 53101f5 commit 3fcbb92
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 33 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repositories {
url = "https://maven.shedaniel.me/"
}
maven {
name = "Jade, Just Enough Calculation"
name = "Jade"
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
Expand All @@ -49,7 +49,6 @@ dependencies {
modImplementation "maven.modrinth:patchouli:${project.patchouli_version}"

modImplementation "curse.maven:jade-324717:${project.jade_version}"
modImplementation "curse.maven:just-enough-calculation-242223:${project.jec_version}"

modImplementation ("dev.emi:emi-fabric:${project.emi_version}") {
exclude(group: "net.fabricmc.fabric-api")
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ rei_version=14.1.714
# https://www.curseforge.com/minecraft/mc-mods/jade/files?page=1&pageSize=20&gameVersionTypeId=4
jade_version=4957713

# https://www.curseforge.com/minecraft/mc-mods/just-enough-calculation/files/all?page=1&pageSize=20&gameVersionTypeId=4
jec_version=5066672

# https://modrinth.com/mod/mbp/versions
mbp_version=1.5.1

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,15 @@
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.List;
import java.util.Locale;
import java.util.Set;

@Mixin(value = ItemStack.class, priority = 100000)
public abstract class ItemStackMixin {
@Unique
private static final Set<String> HIDDEN = Set.of("_UI_BACKGROUND", "_UI_INPUT_SLOT", "_UI_OUTPUT_SLOT");

@Shadow @Nullable
public abstract NbtCompound getNbt();

Expand All @@ -43,7 +38,7 @@ public void changeTooltip(PlayerEntity player, TooltipContext context, CallbackI
}

final List<Text> lore = cir.getReturnValue();
if (ModConfig.hideBackgroundTooltips() && HIDDEN.contains(id)) {
if (ModConfig.hideBackgroundTooltips() && Utils.HIDDEN_SF_IDS.contains(id)) {
lore.clear();
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package me.justahuman.slimefun_essentials.mixins.minecraft;

import me.justahuman.slimefun_essentials.config.ModConfig;
import me.justahuman.slimefun_essentials.utils.Utils;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Slot.class)
public abstract class SlotMixin {
@Shadow
public abstract ItemStack getStack();

@Inject(at = @At("HEAD"), method = "canBeHighlighted", cancellable = true)
public void canBeHighlighted(CallbackInfoReturnable<Boolean> cir) {
if (!ModConfig.hideBackgroundTooltips()) {
return;
}

final ItemStack itemStack = getStack();
final String id = Utils.getSlimefunId(itemStack);
if (id != null && Utils.HIDDEN_SF_IDS.contains(id)) {
cir.setReturnValue(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import org.slf4j.LoggerFactory;

import java.util.Locale;
import java.util.Set;

public class Utils {
public static final String ID = "slimefun_essentials";
public static final Set<String> HIDDEN_SF_IDS = Set.of("_UI_BACKGROUND", "_UI_INPUT_SLOT", "_UI_OUTPUT_SLOT");
private static final Logger LOGGER = LoggerFactory.getLogger(ID);
private static final String ERROR_MESSAGE = "[SFE] Failed to load data";

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/slimefun_essentials.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"package": "me.justahuman.slimefun_essentials.mixins",
"compatibilityLevel": "JAVA_17",
"client": [
"minecraft.AddServerScreenMixin",
"minecraft.InteractionManagerMixin",
"minecraft.ItemStackMixin",
"minecraft.OrbAccessor",
"minecraft.SlotMixin",
"patchouli.BookMixin",
"patchouli.ContentsBuilderMixin",
"patchouli.ItemStackUtilMixin",
"minecraft.InteractionManagerMixin",
"mbp.MBPDataMixin",
"mbp.MBPProviderMixin",
"minecraft.AddServerScreenMixin",
"jec.ILabelMixin"
],
"server": [],
"injectors": {
Expand Down

0 comments on commit 3fcbb92

Please sign in to comment.