Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 7 Фев 2024
- Сообщения
- 80
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Переделал кс гуи тандера :)
click ->
Чтобы гуи была как основная: перейдите в Core и вставьте текст ниже
click ->
Пожалуйста, авторизуйтесь для просмотра ссылки.
SecondGui (ThunderGui):
package fever.visual.features.modules.client;
import fever.visual.features.modules.Module;
import fever.visual.setting.Setting;
import fever.visual.setting.impl.ColorSetting;
import java.awt.*;
public final class SecondGui extends Module {
public static final Setting<ColorSetting> onColor1 = new Setting<>("OnColor1", new ColorSetting(new Color(0x38C3A5).getRGB()));
public static final Setting<ColorSetting> onColor2 = new Setting<>("OnColor2", new ColorSetting(new Color(0x8E1F3F).getRGB()));
public static final Setting<Float> scrollSpeed = new Setting<>("ScrollSpeed", 2f, 0.1F, 2.0F);
public SecondGui() {
super("CsGui", Category.CLIENT);
}
[USER=1367676]@override[/USER]
public void onEnable() {
mc.setScreen(fever.visual.gui.secondgui.SecondGui.getSecondGui());
disable();
}
public enum colorModeEn {
Static,
Sky,
LightRainbow,
Rainbow,
Fade,
DoubleColor,
Analogous
}
public static Color getColorByTheme(int id) {
return switch (id) {
case 0 -> new Color(0, 0, 0, 130); // Основная плита
case 1 -> new Color(0, 0, 0, 130); // плита лого
case 2 -> new Color(0xFFFFFF); // надпись FeverVisual+, белые иконки
case 3, 8 -> new Color(0xA65252); // версия под надписью
case 4 -> new Color(0, 0, 0, 130); // плита под категориями, выбор режима гуи (выкл)
case 5 -> new Color(0, 93, 255, 50); // выбор режима гуи (вкл)
case 6 -> new Color(255, 255, 255, 255); // цвет разделителя качели выбора режима
case 7 -> new Color(65, 105, 225, 20); // цвет плиты настроек
case 9 -> new Color(0, 255, 255, 255); //
case 11 -> new Color(0, 0, 0, 100); //настройки?
default -> new Color(255, 0, 0, 50); // плита под категориями
};
}
}
Чтобы гуи была как основная: перейдите в Core и вставьте текст ниже
SecondGui (ThunderGui):
Managers.NOTIFICATION.onUpdate();
Managers.MODULE.onUpdate();
SecondGui.getInstance().onTick();
if (ModuleManager.secondGui.getBind().getKey() == -1) {
Command.sendMessage(Formatting.RED + (isRu() ? "Привязка клавиш Clickgui по умолчанию -> Правый Шифт" : "Default clickgui keybind --> Right Shift"));
ModuleManager.secondGui.setBind(InputUtil.fromTranslationKey("key.keyboard.344").getCode(), false, false);
}
Module.java:
package fever.visual.features.modules;
import com.mojang.logging.LogUtils;
import fever.visual.FeverVisual;
import fever.visual.core.Managers;
import fever.visual.core.manager.client.CommandManager;
import fever.visual.core.manager.client.ModuleManager;
import fever.visual.features.modules.client.ClientSettings;
import fever.visual.features.modules.client.UnHook;
import fever.visual.features.modules.client.Windows;
import fever.visual.gui.notification.Notification;
import fever.visual.setting.Setting;
import fever.visual.setting.impl.Bind;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.network.PendingUpdateManager;
import net.minecraft.client.network.SequencedPacketCreator;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.Packet;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
import java.util.*;
import static fever.visual.FeverVisual.LOGGER;
import static fever.visual.core.Managers.NOTIFICATION;
import static fever.visual.features.modules.client.ClientSettings.isRu;
public abstract class Module {
private final Setting<Bind> bind = new Setting<>("Keybind", new Bind(-1, false, false));
private final Setting<Boolean> drawn = new Setting<>("Drawn", true);
private final Setting<Boolean> enabled = new Setting<>("Enabled", false);
private final Category category;
private final String displayName;
private final List<String> ignoreSoundList = Arrays.asList(
"SecondGui",
"HudEditor"
);
public static final MinecraftClient mc = MinecraftClient.getInstance();
public Module(@NotNull String name, @NotNull Category category) {
this.displayName = name;
this.category = category;
}
public void onEnable() {
}
public void onDisable() {
}
public void onLogin() {
}
public void onLogout() {
}
public void onUpdate() {
}
public void onRender2D(DrawContext event) {
}
public void onRender3D(MatrixStack event) {
}
public void onUnload() {
}
public boolean isToggleable() {
return true;
}
protected void sendPacket(Packet<?> packet) {
if (mc.getNetworkHandler() == null) return;
mc.getNetworkHandler().sendPacket(packet);
}
protected void sendPacketSilent(Packet<?> packet) {
if (mc.getNetworkHandler() == null) return;
FeverVisual.core.silentPackets.add(packet);
mc.getNetworkHandler().sendPacket(packet);
}
protected void sendSequencedPacket(SequencedPacketCreator packetCreator) {
if (mc.getNetworkHandler() == null || mc.world == null) return;
try (PendingUpdateManager pendingUpdateManager = mc.world.getPendingUpdateManager().incrementSequence();) {
int i = pendingUpdateManager.getSequence();
mc.getNetworkHandler().sendPacket(packetCreator.predict(i));
}
}
public String getDisplayInfo() {
return null;
}
public boolean isOn() {
return enabled.getValue();
}
public boolean isOff() {
return !enabled.getValue();
}
public void setEnabled(boolean enabled) {
this.enabled.setValue(enabled);
}
public void onThread() {
}
public void enable() {
if (!(this instanceof UnHook))
enabled.setValue(true);
if (!fullNullCheck() || (this instanceof UnHook) || (this instanceof Windows))
onEnable();
if (isOn()) FeverVisual.EVENT_BUS.subscribe(this);
if (fullNullCheck()) return;
LogUtils.getLogger().info("[FeverVisual] enabled " + this.getName());
Managers.MODULE.sortModules();
if (!ignoreSoundList.contains(getDisplayName())) {
NOTIFICATION.publicity(getDisplayName(), isRu() ? "Модуль включен!" : "Was Enabled!", 2, Notification.Type.ENABLED);
Managers.SOUND.playEnable();
}
}
public void disable(String reason) {
sendMessage(reason);
disable();
}
/**
* [USER=318004]@see[/USER] #disable(String)
*/
public void disable() {
try {
FeverVisual.EVENT_BUS.unsubscribe(this);
} catch (Exception ignored) {
}
enabled.setValue(false);
Managers.MODULE.sortModules();
if (fullNullCheck()) return;
onDisable();
LOGGER.info("[FeverVisual] disabled {}", getName());
if (!ignoreSoundList.contains(getDisplayName())) {
NOTIFICATION.publicity(getDisplayName(), isRu() ? "Модуль выключен!" : "Was Disabled!", 2, Notification.Type.DISABLED);
Managers.SOUND.playDisable();
}
}
public void toggle() {
if (enabled.getValue()) disable();
else enable();
}
public String getDisplayName() {
return displayName;
}
public boolean isDrawn() {
return drawn.getValue();
}
public void setDrawn(boolean d) {
drawn.setValue(d);
}
public Category getCategory() {
return category;
}
public Bind getBind() {
return bind.getValue();
}
public void setBind(int key, boolean mouse, boolean hold) {
setBind(new Bind(key, mouse, hold));
}
public void setBind(Bind b) {
bind.setValue(b);
}
public boolean listening() {
return isOn();
}
public String getFullArrayString() {
return getDisplayName() + Formatting.GRAY + (getDisplayInfo() != null ? " [" + Formatting.WHITE + getDisplayInfo() + Formatting.GRAY + "]" : "");
}
public static boolean fullNullCheck() {
return mc.player == null || mc.world == null || ModuleManager.unHook.isEnabled();
}
public String getName() {
return getDisplayName();
}
public List<Setting<?>> getSettings() {
ArrayList<Setting<?>> settingList = new ArrayList<>();
Class<?> currentSuperclass = getClass();
while (currentSuperclass != null) {
for (Field field : currentSuperclass.getDeclaredFields()) {
if (!Setting.class.isAssignableFrom(field.getType()))
continue;
try {
field.setAccessible(true);
settingList.add((Setting<?>) field.get(this));
} catch (IllegalAccessException error) {
LOGGER.warn(error.getMessage());
}
}
currentSuperclass = currentSuperclass.getSuperclass();
}
settingList.forEach(s -> s.setModule(this));
return settingList;
}
public boolean isEnabled() {
return isOn();
}
public boolean isDisabled() {
return !isEnabled();
}
public static void clickSlot(int id) {
if (id == -1 || mc.interactionManager == null || mc.player == null) return;
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, id, 0, SlotActionType.PICKUP, mc.player);
}
public static void clickSlot(int id, SlotActionType type) {
if (id == -1 || mc.interactionManager == null || mc.player == null) return;
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, id, 0, type, mc.player);
}
public static void clickSlot(int id, int button, SlotActionType type) {
if (id == -1 || mc.interactionManager == null || mc.player == null) return;
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, id, button, type, mc.player);
}
public void sendMessage(String message) {
if (fullNullCheck() || !ClientSettings.clientMessages.getValue() || ModuleManager.unHook.isEnabled()) return;
if (mc.isOnThread()) {
mc.player.sendMessage(Text.of(CommandManager.getClientMessage() + " " + Formatting.GRAY + "[" + Formatting.DARK_PURPLE + getDisplayName() + Formatting.GRAY + "] " + message));
} else {
mc.executeSync(() ->
mc.player.sendMessage(Text.of(CommandManager.getClientMessage() + " " + Formatting.GRAY + "[" + Formatting.DARK_PURPLE + getDisplayName() + Formatting.GRAY + "] " + message))
);
}
}
public void sendChatMessage(String message) {
if (fullNullCheck()) return;
mc.getNetworkHandler().sendChatMessage(message);
}
public void sendChatCommand(String command) {
if (fullNullCheck()) return;
mc.getNetworkHandler().sendChatCommand(command);
}
public void debug(String message) {
if (fullNullCheck()) return;
if (mc.isOnThread()) {
mc.player.sendMessage(Text.of(CommandManager.getClientMessage() + " " + Formatting.GRAY + "[" + Formatting.DARK_PURPLE + getDisplayName() + Formatting.GRAY + "] [\uD83D\uDD27] " + message));
} else {
mc.executeSync(() -> {
mc.player.sendMessage(Text.of(CommandManager.getClientMessage() + " " + Formatting.GRAY + "[" + Formatting.DARK_PURPLE + getDisplayName() + Formatting.GRAY + "] [\uD83D\uDD27] " + message));
});
}
}
public boolean isKeyPressed(int button) {
if (button == -1 || ModuleManager.unHook.isEnabled())
return false;
if (Managers.MODULE.activeMouseKeys.contains(button)) {
Managers.MODULE.activeMouseKeys.clear();
return true;
}
if (button < 10) // check
return false;
return InputUtil.isKeyPressed(mc.getWindow().getHandle(), button);
}
public boolean isKeyPressed(Setting<Bind> bind) {
if (bind.getValue().getKey() == -1 || ModuleManager.unHook.isEnabled())
return false;
return isKeyPressed(bind.getValue().getKey());
}
public [USER=1265501]@nullable[/USER] Setting<?> getSettingByName(String name) {
for (Setting<?> setting : getSettings()) {
if (!setting.getName().equalsIgnoreCase(name)) continue;
return setting;
}
return null;
}
public static class Category {
private final String name;
private static final Map<String, Category> CATEGORIES = new LinkedHashMap<>();
// Predefined categories as static instances
public static final Category COMBAT = new Category("Pvp");
public static final Category MISC = new Category("Other");
public static final Category RENDER = new Category("Visual");
public static final Category PLAYER = new Category("Player");
public static final Category CLIENT = new Category("Client");
public static final Category HUD = new Category("Interface");
public static final Category PRIVATE = new Category("Private");
// Initialize predefined categories
static {
CATEGORIES.put("Interface", HUD);
CATEGORIES.put("Pvp", COMBAT);
CATEGORIES.put("Other", MISC);
CATEGORIES.put("Visual", RENDER);
CATEGORIES.put("Player", PLAYER);
CATEGORIES.put("Client", CLIENT);
}
// Private constructor to control creation
private Category(String name) {
this.name = name;
}
public String getName() {
return name;
}
// Static method to get or create a category
public static Category getCategory(String name) {
return CATEGORIES.computeIfAbsent(name, Category::new);
}
public static Collection<Category> values() {
return CATEGORIES.values();
}
public static boolean isCustomCategory(Category category) {
Set<String> predefinedCategoryNames = Set.of("Combat", "Misc", "Render", "Movement", "Player", "Client", "HUD");
return !predefinedCategoryNames.contains(category.getName());
}
[USER=1367676]@override[/USER]
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Category category = (Category) o;
return Objects.equals(name, category.name);
}
[USER=1367676]@override[/USER]
public int hashCode() {
return Objects.hash(name);
}
}
}
Последнее редактирование: