Skip to content

Commit

Permalink
Refactor Fancy Crafting Table
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 committed Apr 3, 2024
1 parent a0590e5 commit f0069ca
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static class General {
public boolean betterPartyFinder = true;

@SerialEntry
public boolean fancyCraftingUi = true;
public boolean fancyCraftingTable = true;

@SerialEntry
public boolean backpackPreviewWithoutShift = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.general.betterPartyFinder = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.general.fancyCraftingTable"))
.binding(defaults.general.fancyCraftingTable,
() -> config.general.fancyCraftingTable,
newValue -> config.general.fancyCraftingTable = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.general.backpackPreviewWithoutShift"))
.binding(defaults.general.backpackPreviewWithoutShift,
Expand All @@ -55,13 +62,6 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.general.compactorDeletorPreview = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.general.fancyCraftingUi"))
.binding(defaults.general.fancyCraftingUi,
() -> config.general.fancyCraftingUi,
newValue -> config.general.fancyCraftingUi = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.general.hideEmptyTooltips"))
.binding(defaults.general.hideEmptyTooltips,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface HandledScreenProviderMixin<T extends ScreenHandler> {
}

ci.cancel();
} else if (SkyblockerConfigManager.get().general.fancyCraftingUi && screenHandler instanceof GenericContainerScreenHandler containerScreenHandler && name.getString().toLowerCase().contains("craft item")) {
} else if (SkyblockerConfigManager.get().general.fancyCraftingTable && screenHandler instanceof GenericContainerScreenHandler containerScreenHandler && name.getString().toLowerCase().contains("craft item")) {
SkyblockCraftingTableScreenHandler skyblockCraftingTableScreenHandler = new SkyblockCraftingTableScreenHandler(containerScreenHandler, player.getInventory());
client.player.currentScreenHandler = skyblockCraftingTableScreenHandler;
client.setScreen(new SkyblockCraftingTableScreen(skyblockCraftingTableScreenHandler, player.getInventory(), Text.literal("Craft Item")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class SkyblockCraftingTableScreen extends HandledScreen<SkyblockCraftingT
protected static final ButtonTextures MORE_CRAFTS_TEXTURES = new ButtonTextures(
new Identifier(SkyblockerMod.NAMESPACE, "quick_craft/more_button"),
new Identifier(SkyblockerMod.NAMESPACE, "quick_craft/more_button_disabled"),
new Identifier(SkyblockerMod.NAMESPACE, "quick_craft/more_button_highlighted"));
new Identifier(SkyblockerMod.NAMESPACE, "quick_craft/more_button_highlighted")
);

protected static final Identifier QUICK_CRAFT = new Identifier(SkyblockerMod.NAMESPACE, "quick_craft/quick_craft_overlay");
private final ItemListWidget recipeBook = new ItemListWidget();
Expand All @@ -56,7 +57,7 @@ protected void init() {
moreCraftsButton = new TexturedButtonWidget(this.x + 174, y + 62, 16, 16, MORE_CRAFTS_TEXTURES,
button -> this.onMouseClick(handler.slots.get(26), handler.slots.get(26).id, 0, SlotActionType.PICKUP));
moreCraftsButton.setTooltipDelay(250);
moreCraftsButton.setTooltip(Tooltip.of(Text.literal("More crafts")));
moreCraftsButton.setTooltip(Tooltip.of(Text.literal("More Crafts")));
this.addDrawableChild(moreCraftsButton);
assert (client != null ? client.player : null) != null;
client.player.currentScreenHandler = handler; // recipe book replaces it with the Dummy one fucking DUMBASS
Expand Down Expand Up @@ -142,14 +143,10 @@ public DummyRecipeScreenHandler() {
}

@Override
public void populateRecipeFinder(RecipeMatcher finder) {

}
public void populateRecipeFinder(RecipeMatcher finder) {}

@Override
public void clearCraftingSlots() {

}
public void clearCraftingSlots() {}

@Override
public boolean matches(RecipeEntry<? extends Recipe<SimpleInventory>> recipe) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"text.autoconfig.skyblocker.option.general.searchOverlay.enableCommands.@Tooltip": "Opens the bazaar search with \"/bzs\" and auction house with \"/ahs\". A re-log is required for this setting to be updated.",
"text.autoconfig.skyblocker.option.general.searchOverlay.historyLabel": "History:",
"text.autoconfig.skyblocker.option.general.betterPartyFinder": "Better Party Finder",
"text.autoconfig.skyblocker.option.general.fancyCraftingUi": "Fancy Crafting UI",
"text.autoconfig.skyblocker.option.general.fancyCraftingTable": "Fancy Crafting Table UI",
"skyblocker.itemTooltip.nullMessage": "§cItem price information on tooltip will renew in max 60 seconds. If not, check latest.log",
"skyblocker.itemTooltip.noData": "§cNo Data",

Expand Down

0 comments on commit f0069ca

Please sign in to comment.