Skip to content

Museum HUD #1170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.uiAndVisuals.showEquipmentInInventory = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.museumOverlay"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.museumOverlay.@Tooltip")))
.binding(defaults.uiAndVisuals.museumOverlay,
() -> config.uiAndVisuals.museumOverlay,
newValue -> config.uiAndVisuals.museumOverlay = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.cancelComponentUpdateAnimation"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.cancelComponentUpdateAnimation.@Tooltip")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class UIAndVisualsConfig {
@SerialEntry
public ItemCooldown itemCooldown = new ItemCooldown();

@SerialEntry
public boolean museumOverlay = true;

@SerialEntry
public SlotText slotText = new SlotText();

Expand Down
31 changes: 26 additions & 5 deletions src/main/java/de/hysky/skyblocker/mixins/HandledScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextManager;
import de.hysky.skyblocker.skyblock.item.tooltip.BackpackPreview;
import de.hysky.skyblocker.skyblock.item.tooltip.CompactorDeletorPreview;
import de.hysky.skyblocker.skyblock.museum.MuseumItemCache;
import de.hysky.skyblocker.skyblock.museum.MuseumManager;
import de.hysky.skyblocker.skyblock.quicknav.QuickNav;
import de.hysky.skyblocker.skyblock.quicknav.QuickNavButton;
import de.hysky.skyblocker.utils.ItemUtils;
Expand Down Expand Up @@ -97,6 +99,12 @@ public abstract class HandledScreenMixin<T extends ScreenHandler> extends Screen
@Shadow
protected abstract List<Text> getTooltipFromItem(ItemStack stack);

@Shadow
protected int x;
@Shadow
protected int y;
@Shadow
protected int backgroundWidth;
@Unique
private List<QuickNavButton> quickNavButtons;

Expand All @@ -113,13 +121,28 @@ protected HandledScreenMixin(Text title) {
}
}

@Inject(method = "init", at = @At("TAIL"))
private void skyblocker$initMuseumOverlay(CallbackInfo ci) {
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().uiAndVisuals.museumOverlay && client != null && client.player != null && !client.player.isCreative() && getTitle().getString().contains("Museum")) {
new MuseumManager(this, this.x, this.y, this.backgroundWidth);
}
}

@Inject(method = "removed", at = @At("HEAD"))
private void skyblocker$removeMuseumOverlay(CallbackInfo ci) {
if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().uiAndVisuals.museumOverlay && client != null && client.player != null && !client.player.isCreative() && getTitle().getString().contains("Museum")) {
// Reset Overlay variables when no longer in Museum inventory
MuseumManager.reset();
}
}

@Inject(at = @At("HEAD"), method = "keyPressed")
public void skyblocker$keyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
if (this.client != null && this.client.player != null && this.focusedSlot != null && keyCode != 256 && !this.client.options.inventoryKey.matchesKey(keyCode, scanCode) && Utils.isOnSkyblock()) {
SkyblockerConfig config = SkyblockerConfigManager.get();
//wiki lookup
if (config.general.wikiLookup.enableWikiLookup && WikiLookup.wikiLookup.matchesKey(keyCode, scanCode)) {
WikiLookup.openWiki(this.focusedSlot, client.player);
WikiLookup.openWiki(this.focusedSlot.getStack(), client.player);
}
//item protection
if (ItemProtection.itemProtection.matchesKey(keyCode, scanCode)) {
Expand Down Expand Up @@ -309,10 +332,8 @@ protected HandledScreenMixin(Text title) {
}
}

case GenericContainerScreenHandler genericContainerScreenHandler when title.equals(MuseumItemCache.DONATION_CONFIRMATION_SCREEN_TITLE) -> {
//Museum Item Cache donation tracking
MuseumItemCache.handleClick(slot, slotId, genericContainerScreenHandler.slots);
}
case GenericContainerScreenHandler genericContainerScreenHandler when title.equals(MuseumItemCache.DONATION_CONFIRMATION_SCREEN_TITLE) -> //Museum Item Cache donation tracking
MuseumItemCache.handleClick(slot, slotId, genericContainerScreenHandler.slots);

case null, default -> {}
}
Expand Down
218 changes: 0 additions & 218 deletions src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public static void init() {
));
}

public static void openWiki(@NotNull Slot slot, @NotNull PlayerEntity player) {
WikiLookup.openWiki(slot.getStack(), player);
}

public static void openWiki(ItemStack stack, PlayerEntity player) {
ItemUtils.getItemIdOptional(stack)
.map(ItemRepository::getWikiLink)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void addToTooltip(@Nullable Slot focusedSloFt, ItemStack stack, List<Text
}
}

private double getItemCost(NEURecipe recipe, int depth) {
public static double getItemCost(NEURecipe recipe, int depth) {
if (depth >= MAX_RECURSION_DEPTH) return -1;

double totalCraftCost = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package de.hysky.skyblocker.skyblock.item.tooltip.adders;

import de.hysky.skyblocker.skyblock.item.MuseumItemCache;
import de.hysky.skyblocker.skyblock.item.tooltip.SimpleTooltipAdder;
import de.hysky.skyblocker.skyblock.item.tooltip.info.TooltipInfoType;
import de.hysky.skyblocker.skyblock.museum.MuseumItemCache;
import de.hysky.skyblocker.utils.ItemUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
Expand Down
Loading