Skip to content

Commit

Permalink
Global Search
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterCheezeCake committed Sep 29, 2024
1 parent 043a059 commit b2299d0
Show file tree
Hide file tree
Showing 24 changed files with 440 additions and 10 deletions.
16 changes: 15 additions & 1 deletion src/main/java/wtf/cheeze/sbt/command/SBTCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,21 @@ public class SBTCommand {
public static void registerEvents() {
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(
literal("sbt")
.then(CommandUtils.getScreenOpeningCommand("config", () -> SBTConfig.getScreen(null)))
.then(literal("config")
.then(literal("search")
.executes(context -> {
MinecraftClient mc = context.getSource().getClient();
Screen screen = SBTConfig.getGlobalSearchScreen(null);
mc.send(() -> mc.setScreen(screen));
return 1;
})
)
.executes(context -> {
MinecraftClient mc = context.getSource().getClient();
Screen screen = SBTConfig.getScreen(null);
mc.send(() -> mc.setScreen(screen));
return 1;
}))
.then(CommandUtils.getScreenOpeningCommand("hud", () -> new HudScreen(Text.literal("SkyBlockTweaks"), SkyblockTweaks.HUDS, null)))
.then(literal("debug")
.then(literal("forcevalue")
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/wtf/cheeze/sbt/config/GlobalSearchYaclScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.config;

import dev.isxander.yacl3.api.YetAnotherConfigLib;
import dev.isxander.yacl3.gui.YACLScreen;
import net.minecraft.client.gui.screen.Screen;

import java.util.function.Supplier;

public class GlobalSearchYaclScreen extends YACLScreen {

private final Supplier<Screen> parentSupplier;

public GlobalSearchYaclScreen(YetAnotherConfigLib config, Supplier<Screen> parent) {
super(config, null);
this.parentSupplier = parent;
}

@Override
public void close() {
this.client.setScreen(parentSupplier.get());
}
}
19 changes: 19 additions & 0 deletions src/main/java/wtf/cheeze/sbt/config/SBTConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ public static Screen getScreen(Screen parent) {

}).generateScreen(parent);
}
public static Screen getGlobalSearchScreen(Screen parent) {
return YetAnotherConfigLib.create(HANDLER,
(defaults, configThing, builder) -> {
return builder
.title(Text.literal("SkyblockTweaks"))
.category(GlobalSearchCategory.getCategory(defaults, configThing));

}).generateScreen(parent);
}
public static Screen getSpecialGlobalSearchScreen(Screen bigParent) {
var yacl = YetAnotherConfigLib.create(HANDLER,
(defaults, configThing, builder) -> {
return builder
.title(Text.literal("SkyblockTweaks"))
.category(GlobalSearchCategory.getCategory(defaults, configThing));

});
return new GlobalSearchYaclScreen(yacl, () -> getScreen(bigParent));
}

public static ConfigImpl get() {
return HANDLER.instance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config)
return ConfigCategory.createBuilder()
.name(Text.translatable("sbt.config.general"))
.tooltip(Text.translatable("sbt.config.general.desc"))
.option(GlobalSearchCategory.getOpenGlobalSearchButton(defaults, config))
.option(Version.getStreamOption(defaults, config))
.group(InventoryTweaks.getGroup(defaults, config))
.group(MenuHighlights.Config.getGroup(defaults, config))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.config.categories;

import dev.isxander.yacl3.api.ButtonOption;
import dev.isxander.yacl3.api.ConfigCategory;
import dev.isxander.yacl3.api.OptionDescription;
import net.minecraft.text.Text;
import wtf.cheeze.sbt.SkyblockTweaks;
import wtf.cheeze.sbt.config.ConfigImpl;
import wtf.cheeze.sbt.config.SBTConfig;
import wtf.cheeze.sbt.features.BrewingStandOverlay;
import wtf.cheeze.sbt.features.MenuHighlights;
import wtf.cheeze.sbt.features.chat.ChatProtections;
import wtf.cheeze.sbt.features.chat.PartyFeatures;
import wtf.cheeze.sbt.features.huds.*;
import wtf.cheeze.sbt.mixin.YACLScreenAccessor;
import wtf.cheeze.sbt.utils.Version;
import wtf.cheeze.sbt.utils.actionbar.ActionBarTransformer;

public class GlobalSearchCategory {

public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config) {
return ConfigCategory.createBuilder()
.name(Text.translatable("sbt.config.globalSearch"))
.tooltip(Text.translatable("sbt.config.globalSearch.desc"))
.option(Version.getStreamOption(defaults, config))
.group(General.InventoryTweaks.getGroup(defaults, config))
.group(MenuHighlights.Config.getGroup(defaults, config))
.group(BrewingStandOverlay.Config.getGroup(defaults, config))
.group(General.HudTweaks.getGroup(defaults, config))
.group(ActionBarTransformer.Config.getGroup(defaults, config))
.group(PartyFeatures.Config.getGroup(defaults, config))
.group(PartyFeatures.Config.getBlackList(defaults, config))
.group(ChatProtections.Config.getGroup(defaults, config))
.group(SkillHUDManager.SkillHUD.Config.getGroup(defaults, config))
.group(SkillHUDManager.SkillBar.Config.getGroup(defaults, config))
.group(HealthHUD.Config.getGroup(defaults, config))
.group(HealthBar.Config.getGroup(defaults, config))
.group(ManaHUD.Config.getGroup(defaults, config))
.group(ManaBar.Config.getGroup(defaults, config))
.group(OverflowManaHUD.Config.getGroup(defaults, config))
.group(EhpHUD.Config.getGroup(defaults, config))
.group(SpeedHUD.Config.getGroup(defaults, config))
.group(DefenseHUD.Config.getGroup(defaults, config))
.group(DamageReductionHUD.Config.getGroup(defaults, config))
.group(DrillFuelHUD.Config.getGroup(defaults, config))
.group(DrillFuelBar.Config.getGroup(defaults, config))
.group(CoordinatesHUD.Config.getGroup(defaults, config))
.group(RealTimeHUD.Config.getGroup(defaults, config))
.group(FpsHUD.Config.getGroup(defaults, config))
.group(TickerHUD.Config.getGroup(defaults, config))
.build();
}

public static ButtonOption getOpenGlobalSearchButton(ConfigImpl defaults, ConfigImpl config) {
return ButtonOption.createBuilder()
.name(Text.translatable("sbt.config.globalSearch.open"))
.description(OptionDescription.of(Text.translatable("sbt.config.globalSearch.open.desc")))
.text(Text.translatable("sbt.config.globalSearch.open.text"))
.action((y, o) -> {

if (y.pendingChanges()) {
y.finishOrSave();
}
SkyblockTweaks.mc.setScreen(SBTConfig.getSpecialGlobalSearchScreen(((YACLScreenAccessor) y).sbt$getParent()));


})
.build();
}


}
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/config/persistent/PersistentData.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.config.persistent;

import net.fabricmc.loader.api.FabricLoader;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/config/persistent/ProfileData.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.config.persistent;

import wtf.cheeze.sbt.utils.skyblock.SkyblockConstants;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/features/BrewingStandOverlay.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.features;

import dev.isxander.yacl3.api.Option;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/features/chat/ChatProtections.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.features.chat;

import dev.isxander.yacl3.api.Option;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/wtf/cheeze/sbt/features/chat/PartyFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@

import dev.isxander.yacl3.api.ListOption;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionDescription;
import dev.isxander.yacl3.api.OptionGroup;
import dev.isxander.yacl3.api.controller.IntegerFieldControllerBuilder;
import dev.isxander.yacl3.api.controller.StringControllerBuilder;
import dev.isxander.yacl3.config.v2.api.SerialEntry;
import net.azureaaron.hmapi.network.HypixelNetworking;
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.Text;
import wtf.cheeze.sbt.SkyblockTweaks;
import wtf.cheeze.sbt.config.ConfigImpl;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/features/huds/SkillHUDManager.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.features.huds;

import dev.isxander.yacl3.api.NameableEnum;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/wtf/cheeze/sbt/features/huds/SpeedHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package wtf.cheeze.sbt.features.huds;

import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionDescription;
import dev.isxander.yacl3.api.OptionGroup;
import dev.isxander.yacl3.api.controller.ColorControllerBuilder;
import dev.isxander.yacl3.config.v2.api.SerialEntry;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/features/huds/TickerHUD.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.features.huds;

import dev.isxander.yacl3.api.Option;
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/wtf/cheeze/sbt/mixin/YACLScreenAccessor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.mixin;

import dev.isxander.yacl3.gui.YACLScreen;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(YACLScreen.class)
public interface YACLScreenAccessor {
@Accessor("parent")
Screen sbt$getParent();
}
18 changes: 18 additions & 0 deletions src/main/java/wtf/cheeze/sbt/utils/HTTPUtils.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2024 MisterCheezeCake
*
* This file is part of SkyblockTweaks.
*
* SkyblockTweaks is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* SkyblockTweaks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.utils;

import java.io.IOException;
Expand Down
Loading

0 comments on commit b2299d0

Please sign in to comment.