Renamed directory to anticope
This commit is contained in:
50
src/main/java/anticope/rejects/gui/hud/AppleHud.java
Normal file
50
src/main/java/anticope/rejects/gui/hud/AppleHud.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HudRenderer;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.HudElement;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.RenderUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
public class AppleHud extends HudElement {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of golden apple counter.")
|
||||
.defaultValue(3)
|
||||
.min(1)
|
||||
.sliderMin(1)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
public AppleHud(HUD hud) {
|
||||
super(hud, "apples", "Displays the amount of golden apples in your inventory.", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(HudRenderer renderer) {
|
||||
box.setSize(16 * scale.get(), 16 * scale.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(HudRenderer renderer) {
|
||||
double x = box.getX();
|
||||
double y = box.getY();
|
||||
|
||||
if (isInEditor()) {
|
||||
RenderUtils.drawItem(Items.GOLDEN_APPLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
|
||||
} else {
|
||||
int count = InvUtils.find(Items.GOLDEN_APPLE).getCount();
|
||||
count += InvUtils.find(Items.ENCHANTED_GOLDEN_APPLE).getCount();
|
||||
if (count > 0)
|
||||
RenderUtils.drawItem(new ItemStack(Items.GOLDEN_APPLE, count), (int) x, (int) y, scale.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/main/java/anticope/rejects/gui/hud/BaritoneHud.java
Normal file
23
src/main/java/anticope/rejects/gui/hud/BaritoneHud.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.DoubleTextHudElement;
|
||||
|
||||
public class BaritoneHud extends DoubleTextHudElement {
|
||||
public BaritoneHud(HUD hud) {
|
||||
super(hud, "Baritone", "Displays what baritone is doing.", "Baritone: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRight() {
|
||||
IBaritoneProcess process = BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().mostRecentInControl().orElse(null);
|
||||
|
||||
if (process == null) return "-";
|
||||
|
||||
return process.displayName();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
16
src/main/java/anticope/rejects/gui/hud/CpsHud.java
Normal file
16
src/main/java/anticope/rejects/gui/hud/CpsHud.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import anticope.rejects.utils.RejectsUtils;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.DoubleTextHudElement;
|
||||
|
||||
public class CpsHud extends DoubleTextHudElement {
|
||||
public CpsHud(HUD hud) {
|
||||
super(hud, "cps", "Displays your CPS.", "CPS: ", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRight() {
|
||||
return Integer.toString(RejectsUtils.CPS);
|
||||
}
|
||||
}
|
||||
49
src/main/java/anticope/rejects/gui/hud/CrystalHud.java
Normal file
49
src/main/java/anticope/rejects/gui/hud/CrystalHud.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HudRenderer;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.HudElement;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.RenderUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
//SonyTV was here :)
|
||||
|
||||
public class CrystalHud extends HudElement {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of crystal counter.")
|
||||
.defaultValue(3)
|
||||
.min(1)
|
||||
.sliderMin(1)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
public CrystalHud(HUD hud) {
|
||||
super(hud, "crytals", "Displays the amount of crystals in your inventory.", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(HudRenderer renderer) {
|
||||
box.setSize(16 * scale.get(), 16 * scale.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(HudRenderer renderer) {
|
||||
double x = box.getX();
|
||||
double y = box.getY();
|
||||
|
||||
if (isInEditor()) {
|
||||
RenderUtils.drawItem(Items.END_CRYSTAL.getDefaultStack(), (int) x, (int) y, scale.get(), true);
|
||||
} else if (InvUtils.find(Items.END_CRYSTAL).getCount() > 0) {
|
||||
RenderUtils.drawItem(new ItemStack(Items.END_CRYSTAL, InvUtils.find(Items.END_CRYSTAL).getCount()), (int) x, (int) y, scale.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/main/java/anticope/rejects/gui/hud/ExpHud.java
Normal file
47
src/main/java/anticope/rejects/gui/hud/ExpHud.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HudRenderer;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.HudElement;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.RenderUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
public class ExpHud extends HudElement {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of exp bottle counter.")
|
||||
.defaultValue(3)
|
||||
.min(1)
|
||||
.sliderMin(1)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
public ExpHud(HUD hud) {
|
||||
super(hud, "exp", "Displays the amount of exp bottles in your inventory.", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(HudRenderer renderer) {
|
||||
box.setSize(16 * scale.get(), 16 * scale.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(HudRenderer renderer) {
|
||||
double x = box.getX();
|
||||
double y = box.getY();
|
||||
|
||||
if (isInEditor()) {
|
||||
RenderUtils.drawItem(Items.EXPERIENCE_BOTTLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
|
||||
} else if (InvUtils.find(Items.EXPERIENCE_BOTTLE).getCount() > 0) {
|
||||
RenderUtils.drawItem(new ItemStack(Items.EXPERIENCE_BOTTLE, InvUtils.find(Items.EXPERIENCE_BOTTLE).getCount()), (int) x, (int) y, scale.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
128
src/main/java/anticope/rejects/gui/screens/HeadScreen.java
Normal file
128
src/main/java/anticope/rejects/gui/screens/HeadScreen.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package anticope.rejects.gui.screens;
|
||||
|
||||
import anticope.rejects.utils.GiveUtils;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.WindowScreen;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
|
||||
import meteordevelopment.meteorclient.settings.EnumSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.settings.Settings;
|
||||
import meteordevelopment.meteorclient.utils.network.Http;
|
||||
import meteordevelopment.meteorclient.utils.network.MeteorExecutor;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
public class HeadScreen extends WindowScreen {
|
||||
|
||||
public enum Categories {
|
||||
Alphabet,
|
||||
Animals,
|
||||
Blocks,
|
||||
Decoration,
|
||||
Food_Drinks,
|
||||
Humanoid,
|
||||
Miscellaneous,
|
||||
Monsters,
|
||||
Plants
|
||||
}
|
||||
|
||||
private static final Type gsonType = new TypeToken<List<Map<String, String>>>() {}.getType();
|
||||
|
||||
private final Settings settings = new Settings();
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private static Categories category = Categories.Decoration;
|
||||
private final Setting<Categories> categorySetting = sgGeneral.add(new EnumSetting.Builder<Categories>()
|
||||
.name("Category")
|
||||
.defaultValue(category)
|
||||
.description("Category")
|
||||
.onChanged((v) -> this.loadHeads())
|
||||
.build()
|
||||
);
|
||||
|
||||
public HeadScreen(GuiTheme theme) {
|
||||
super(theme, "Heads");
|
||||
loadHeads();
|
||||
}
|
||||
|
||||
private void set() {
|
||||
clear();
|
||||
add(theme.settings(settings)).expandX();
|
||||
add(theme.horizontalSeparator()).expandX();
|
||||
}
|
||||
|
||||
private String getCat() {
|
||||
category = categorySetting.get();
|
||||
return category.toString().replace("_", "-");
|
||||
}
|
||||
|
||||
private void loadHeads() {
|
||||
MeteorExecutor.execute(() -> {
|
||||
List<Map<String, String>> res = Http.get("https://minecraft-heads.com/scripts/api.php?cat="+getCat()).sendJson(gsonType);
|
||||
List<ItemStack> heads = new ArrayList<>();
|
||||
res.forEach(a -> {
|
||||
try {
|
||||
heads.add(createHeadStack(a.get("uuid"), a.get("value"), a.get("name")));
|
||||
} catch (Exception e) { }
|
||||
});
|
||||
|
||||
WTable t = theme.table();
|
||||
for (ItemStack head : heads) {
|
||||
t.add(theme.item(head));
|
||||
t.add(theme.label(head.getName().asString()));
|
||||
WButton give = t.add(theme.button("Give")).widget();
|
||||
give.action = () -> {
|
||||
try {
|
||||
GiveUtils.giveItem(head);
|
||||
} catch (CommandSyntaxException e) {
|
||||
ChatUtils.error("Heads", e.getMessage());
|
||||
}
|
||||
};
|
||||
WButton equip = t.add(theme.button("Equip")).widget();
|
||||
equip.tooltip = "Equip client-side.";
|
||||
equip.action = () -> {
|
||||
mc.player.getInventory().armor.set(3, head);
|
||||
};
|
||||
t.row();
|
||||
}
|
||||
set();
|
||||
add(t).expandX().minWidth(400).widget();
|
||||
});
|
||||
}
|
||||
|
||||
private ItemStack createHeadStack(String uuid, String value, String name) {
|
||||
ItemStack head = Items.PLAYER_HEAD.getDefaultStack();
|
||||
NbtCompound tag = new NbtCompound();
|
||||
NbtCompound skullOwner = new NbtCompound();
|
||||
skullOwner.putUuid("Id", UUID.fromString(uuid));
|
||||
NbtCompound properties = new NbtCompound();
|
||||
NbtList textures = new NbtList();
|
||||
NbtCompound Value = new NbtCompound();
|
||||
Value.putString("Value", value);
|
||||
textures.add(Value);
|
||||
properties.put("textures", textures);
|
||||
skullOwner.put("Properties", properties);
|
||||
tag.put("SkullOwner", skullOwner);
|
||||
head.setNbt(tag);
|
||||
head.setCustomName(new LiteralText(name));
|
||||
return head;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initWidgets() {}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
package anticope.rejects.gui.screens;
|
||||
|
||||
import anticope.rejects.modules.InteractionMenu;
|
||||
import anticope.rejects.mixin.EntityAccessor;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.events.meteor.KeyEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.utils.render.PeekScreen;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.mob.EndermanEntity;
|
||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.StorageMinecartEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/*
|
||||
Ported from: https://github.com/BleachDrinker420/BleachHack/pull/211
|
||||
*/
|
||||
public class InteractionScreen extends Screen {
|
||||
|
||||
private final Entity entity;
|
||||
private String focusedString = null;
|
||||
private int crosshairX, crosshairY, focusedDot = -1;
|
||||
private float yaw, pitch;
|
||||
private final HashMap<String, Consumer<Entity>> functions;
|
||||
private final HashMap<String, String> msgs;
|
||||
|
||||
private final StaticListener shiftListener = new StaticListener();
|
||||
|
||||
// Style
|
||||
private final int selectedDotColor;
|
||||
private final int dotColor;
|
||||
private final int backgroundColor;
|
||||
private final int borderColor;
|
||||
private final int textColor;
|
||||
|
||||
public InteractionScreen(Entity e) {
|
||||
this(e, Modules.get().get(InteractionMenu.class));
|
||||
}
|
||||
|
||||
public InteractionScreen(Entity entity, InteractionMenu module) {
|
||||
super(new LiteralText("Menu Screen"));
|
||||
|
||||
selectedDotColor = module.selectedDotColor.get().getPacked();
|
||||
dotColor = module.dotColor.get().getPacked();
|
||||
backgroundColor = module.backgroundColor.get().getPacked();
|
||||
borderColor = module.borderColor.get().getPacked();
|
||||
textColor = module.textColor.get().getPacked();
|
||||
|
||||
this.entity = entity;
|
||||
functions = new HashMap<>();
|
||||
functions.put("Stats", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.setScreen(new StatsScreen(e));
|
||||
});
|
||||
if (entity instanceof PlayerEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.setScreen(new InventoryScreen((PlayerEntity) e));
|
||||
});
|
||||
}
|
||||
|
||||
else if (entity instanceof HorseBaseEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
if (client.player.isRiding()) {
|
||||
client.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, true));
|
||||
}
|
||||
client.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.interact(entity, true, Hand.MAIN_HAND));
|
||||
client.player.setSneaking(false);
|
||||
});
|
||||
}
|
||||
else if (entity instanceof StorageMinecartEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.interact(entity, true, Hand.MAIN_HAND));
|
||||
});
|
||||
}
|
||||
else {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
ItemStack container = new ItemStack(Items.CHEST);
|
||||
container.setCustomName(e.getName());
|
||||
client.setScreen(new PeekScreen(container, getInventory(e)));
|
||||
});
|
||||
}
|
||||
|
||||
functions.put("Spectate", (Entity e) -> {
|
||||
MinecraftClient.getInstance().setCameraEntity(e);
|
||||
client.player.sendMessage(new LiteralText("Sneak to un-spectate."), true);
|
||||
MeteorClient.EVENT_BUS.subscribe(shiftListener);
|
||||
closeScreen();
|
||||
});
|
||||
|
||||
if (entity.isGlowing()) {
|
||||
functions.put("Remove glow", (Entity e) -> {
|
||||
e.setGlowing(false);
|
||||
((EntityAccessor)e).invokeSetFlag(6, false);
|
||||
closeScreen();
|
||||
});
|
||||
} else {
|
||||
functions.put("Glow", (Entity e) -> {
|
||||
e.setGlowing(true);
|
||||
((EntityAccessor)e).invokeSetFlag(6, true);
|
||||
closeScreen();
|
||||
});
|
||||
}
|
||||
if (entity.noClip) {
|
||||
functions.put("Disable NoClip", (Entity e) -> {
|
||||
entity.noClip = false;
|
||||
closeScreen();
|
||||
});
|
||||
} else {
|
||||
functions.put("NoClip", (Entity e) -> {
|
||||
entity.noClip = true;
|
||||
closeScreen();
|
||||
});
|
||||
}
|
||||
msgs = Modules.get().get(InteractionMenu.class).messages;
|
||||
msgs.keySet().forEach((key) -> {
|
||||
if (msgs.get(key).contains("{username}") && !(entity instanceof PlayerEntity)) return;
|
||||
if (msgs.get(key).contains("{health}") && !(entity instanceof LivingEntity)) return;
|
||||
|
||||
functions.put(key, (Entity e) -> {
|
||||
closeScreen();
|
||||
client.setScreen(new ChatScreen(replacePlaceholders(msgs.get(key), e)));
|
||||
});
|
||||
|
||||
});
|
||||
functions.put("Cancel", (Entity e) -> {closeScreen();});
|
||||
}
|
||||
|
||||
private ItemStack[] getInventory(Entity e) {
|
||||
ItemStack[] stack = new ItemStack[27];
|
||||
final int[] index = {0};
|
||||
if (e instanceof EndermanEntity) {
|
||||
try {
|
||||
stack[index[0]] = ((EndermanEntity)e).getCarriedBlock().getBlock().asItem().getDefaultStack();
|
||||
index[0]++;
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
}
|
||||
if (Saddleable.class.isInstance(e)) {
|
||||
if (((Saddleable)e).isSaddled()){
|
||||
stack[index[0]] = Items.SADDLE.getDefaultStack();
|
||||
index[0]++;
|
||||
}
|
||||
}
|
||||
e.getItemsHand().forEach(itemStack -> {
|
||||
if (itemStack!=null) {
|
||||
stack[index[0]] = itemStack;
|
||||
index[0]++;
|
||||
}
|
||||
});
|
||||
e.getArmorItems().forEach(itemStack -> {
|
||||
if (itemStack!=null) {
|
||||
stack[index[0]] = itemStack;
|
||||
index[0]++;
|
||||
}
|
||||
});
|
||||
for (int i = index[0]; i < 27; i++) stack[i] = Items.AIR.getDefaultStack();
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
this.cursorMode(GLFW.GLFW_CURSOR_HIDDEN);
|
||||
yaw = client.player.getYaw();
|
||||
pitch = client.player.getPitch();
|
||||
}
|
||||
|
||||
private void cursorMode(int mode) {
|
||||
KeyBinding.unpressAll();
|
||||
double x = (double)(this.client.getWindow().getWidth() / 2);
|
||||
double y = (double)(this.client.getWindow().getHeight() / 2);
|
||||
InputUtil.setCursorParameters(this.client.getWindow().getHandle(), mode, x, y);
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if (Modules.get().get(InteractionMenu.class).keybind.get().isPressed())
|
||||
onClose();
|
||||
}
|
||||
|
||||
private void closeScreen() {
|
||||
client.setScreen((Screen) null);
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
cursorMode(GLFW.GLFW_CURSOR_NORMAL);
|
||||
// This makes the magic
|
||||
if (focusedString != null) {
|
||||
functions.get(focusedString).accept(this.entity);
|
||||
} else
|
||||
client.setScreen((Screen) null);
|
||||
}
|
||||
|
||||
public boolean isPauseScreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
|
||||
// Fake crosshair stuff
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, GUI_ICONS_TEXTURE);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.ONE_MINUS_DST_COLOR,
|
||||
GlStateManager.DstFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SrcFactor.ONE,
|
||||
GlStateManager.DstFactor.ZERO);
|
||||
drawTexture(matrix, crosshairX - 8, crosshairY - 8, 0, 0, 15, 15);
|
||||
|
||||
drawDots(matrix, (int) (Math.min(height, width) / 2 * 0.75), mouseX, mouseY);
|
||||
matrix.scale (2f, 2f, 1f);
|
||||
drawCenteredText(matrix, textRenderer, entity.getName(), width / 4, 6, 0xFFFFFFFF);
|
||||
|
||||
int scale = client.options.guiScale;
|
||||
Vector2 mouse = new Vector2(mouseX, mouseY);
|
||||
Vector2 center = new Vector2(width / 2, height / 2);
|
||||
mouse.subtract(center);
|
||||
mouse.normalize();
|
||||
Vector2 cross = mouse;
|
||||
|
||||
if (scale == 0)
|
||||
scale = 4;
|
||||
|
||||
// Move crossHair based on distance between mouse and center. But with limit
|
||||
if (Math.hypot(width / 2 - mouseX, height / 2 - mouseY) < 1f / scale * 200f)
|
||||
mouse.multiply((float) Math.hypot(width / 2 - mouseX, height / 2 - mouseY));
|
||||
else
|
||||
mouse.multiply(1f / scale * 200f);
|
||||
|
||||
this.crosshairX = (int) mouse.x + width / 2;
|
||||
this.crosshairY = (int) mouse.y + height / 2;
|
||||
|
||||
client.player.setYaw( yaw + cross.x / 3);
|
||||
client.player.setPitch(MathHelper.clamp(pitch + cross.y / 3, -90f, 90f));
|
||||
super.render(matrix, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void drawDots(MatrixStack matrix, int radius, int mouseX, int mouseY) {
|
||||
ArrayList<Point> pointList = new ArrayList<Point>();
|
||||
String cache[] = new String[functions.size()];
|
||||
double lowestDistance = Double.MAX_VALUE;
|
||||
int i = 0;
|
||||
|
||||
for (String string: functions.keySet()) {
|
||||
// Just some fancy calculations to get the positions of the dots
|
||||
double s = (double) i / functions.size() * 2 * Math.PI;
|
||||
int x = (int) Math.round(radius * Math.cos(s) + width / 2);
|
||||
int y = (int) Math.round(radius * Math.sin(s) + height / 2);
|
||||
drawTextField(matrix, x, y, string);
|
||||
|
||||
// Calculate lowest distance between mouse and dot
|
||||
if (Math.hypot(x - mouseX, y - mouseY) < lowestDistance) {
|
||||
lowestDistance = Math.hypot(x - mouseX, y - mouseY);
|
||||
focusedDot = i;
|
||||
}
|
||||
|
||||
cache[i] = string;
|
||||
pointList.add(new Point(x, y));
|
||||
i++;
|
||||
}
|
||||
|
||||
// Go through all point and if it is focused -> drawing different color, changing closest string value
|
||||
for (int j = 0; j < functions.size(); j++) {
|
||||
Point point = pointList.get(j);
|
||||
if (pointList.get(focusedDot) == point) {
|
||||
drawDot(matrix, point.x - 4, point.y - 4, selectedDotColor);
|
||||
this.focusedString = cache[focusedDot];
|
||||
}
|
||||
else
|
||||
drawDot(matrix, point.x - 4, point.y - 4, dotColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawRect(MatrixStack matrix, int startX, int startY, int width, int height, int colorInner,int colorOuter) {
|
||||
drawHorizontalLine(matrix, startX, startX + width, startY, colorOuter);
|
||||
drawHorizontalLine(matrix, startX, startX + width, startY + height, colorOuter);
|
||||
drawVerticalLine(matrix, startX, startY, startY + height, colorOuter);
|
||||
drawVerticalLine(matrix, startX + width, startY, startY + height, colorOuter);
|
||||
fill(matrix, startX + 1, startY + 1, startX + width, startY + height, colorInner);
|
||||
}
|
||||
|
||||
private void drawTextField(MatrixStack matrix, int x, int y, String key) {
|
||||
if (x >= width / 2) {
|
||||
drawRect(matrix, x + 10, y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
|
||||
drawStringWithShadow(matrix, textRenderer, key, x + 12, y - 4, textColor);
|
||||
} else {
|
||||
drawRect(matrix, x - 14 - textRenderer.getWidth(key), y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
|
||||
drawStringWithShadow(matrix, textRenderer, key, x - 12 - textRenderer.getWidth(key), y - 4, textColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Literally drawing it in code
|
||||
private void drawDot(MatrixStack matrix, int startX, int startY, int colorInner) {
|
||||
// Draw dot itself
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY, borderColor);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 1, borderColor);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 1, colorInner);
|
||||
fill(matrix, startX, startY + 2, startX + 8, startY + 6, borderColor);
|
||||
fill(matrix, startX + 1, startY + 2, startX + 7, startY + 6, colorInner);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 6, borderColor);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 6, colorInner);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 7, borderColor);
|
||||
|
||||
// Draw light overlay
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 3, startY + 1, 0x80FFFFFF);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 1, startY + 2, 0x80FFFFFF);
|
||||
}
|
||||
|
||||
private String replacePlaceholders(String in, Entity e) {
|
||||
in = in.replace("{uuid}", e.getUuidAsString());
|
||||
in = in.replace("{name}", e.getName().getString());
|
||||
in = in.replace("{pos}", String.format("%.2f %.2f %.2f", e.getX(), e.getY(), e.getZ()));
|
||||
if (e instanceof PlayerEntity) {
|
||||
in = in.replace("{username}", ((PlayerEntity)e).getGameProfile().getName());
|
||||
}
|
||||
if (e instanceof LivingEntity) {
|
||||
in = in.replace("{health}", String.format("%.2f", ((LivingEntity)e).getHealth()));
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
private class StaticListener {
|
||||
@EventHandler
|
||||
private void onKey(KeyEvent event) {
|
||||
if (client.options.keySneak.matchesKey(event.key, 0) || client.options.keySneak.matchesMouse(event.key)) {
|
||||
client.setCameraEntity(client.player);
|
||||
event.cancel();
|
||||
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Creating my own Vector class beacause I couldn´t find a good one in minecrafts code
|
||||
class Vector2 {
|
||||
float x, y;
|
||||
|
||||
Vector2 (float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
void normalize() {
|
||||
float mag = getMag();
|
||||
if (mag != 0 && mag != 1)
|
||||
divide(mag);
|
||||
}
|
||||
|
||||
void subtract (Vector2 vec) {
|
||||
this.x -= vec.x;
|
||||
this.y -= vec.y;
|
||||
}
|
||||
|
||||
void divide(float n) {
|
||||
x /= n;
|
||||
y /= n;
|
||||
}
|
||||
|
||||
void multiply(float n) {
|
||||
x *= n;
|
||||
y *= n;
|
||||
}
|
||||
|
||||
private float getMag() {
|
||||
return (float) Math.sqrt(x * x + y * y);
|
||||
}
|
||||
}
|
||||
95
src/main/java/anticope/rejects/gui/screens/StatsScreen.java
Normal file
95
src/main/java/anticope/rejects/gui/screens/StatsScreen.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package anticope.rejects.gui.screens;
|
||||
|
||||
import net.minecraft.client.resource.language.TranslationStorage;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectUtil;
|
||||
import net.minecraft.util.Language;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.GuiThemes;
|
||||
import meteordevelopment.meteorclient.gui.WindowScreen;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WSection;
|
||||
|
||||
public class StatsScreen extends WindowScreen {
|
||||
public final Entity entity;
|
||||
private boolean effectListExpanded = true;
|
||||
private boolean attribListExpanded = true;
|
||||
private boolean dimensionExpanded = false;
|
||||
public StatsScreen(Entity e) {
|
||||
super(GuiThemes.get(),e.getName().getString());
|
||||
this.entity = e;
|
||||
updateData();
|
||||
MeteorClient.EVENT_BUS.subscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClosed() {
|
||||
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||
super.onClosed();
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
clear();
|
||||
GuiTheme theme = GuiThemes.get();
|
||||
Language lang = TranslationStorage.getInstance();
|
||||
add(theme.label(String.format("Type: %s", lang.get(entity.getType().getTranslationKey()))));
|
||||
add(theme.label(String.format("Age: %d", entity.age)));
|
||||
add(theme.label(String.format("UUID: %s", entity.getUuidAsString())));
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity liv = (LivingEntity) entity;
|
||||
add(theme.label(String.format("Health: %.2f/%.2f", liv.getHealth(), liv.getMaxHealth())));
|
||||
add(theme.label(String.format("Armor: %d/20", liv.getArmor())));
|
||||
|
||||
WSection effectList = add(theme.section("Status Effects", effectListExpanded)).expandX().widget();
|
||||
effectList.action = () -> {
|
||||
effectListExpanded = effectList.isExpanded();
|
||||
};
|
||||
liv.getActiveStatusEffects().forEach((effect, instance) -> {
|
||||
String status = lang.get(effect.getTranslationKey());
|
||||
if (instance.getAmplifier() != 0) {
|
||||
status += (String.format(" %d (%s)", instance.getAmplifier()+1, StatusEffectUtil.durationToString(instance, 1)));
|
||||
} else {
|
||||
status += (String.format(" (%s)", StatusEffectUtil.durationToString(instance, 1)));
|
||||
}
|
||||
effectList.add(theme.label(status)).expandX();
|
||||
});
|
||||
if (liv.getActiveStatusEffects().isEmpty()) {
|
||||
effectList.add(theme.label("No effects")).expandX();
|
||||
}
|
||||
|
||||
WSection attribList = add(theme.section("Attributes", attribListExpanded)).expandX().widget();
|
||||
attribList.action = () -> {
|
||||
attribListExpanded = attribList.isExpanded();
|
||||
};
|
||||
liv.getAttributes().getTracked().forEach((attrib) -> {
|
||||
attribList.add(theme.label(String.format("%s: %.2f",
|
||||
lang.get(attrib.getAttribute().getTranslationKey()),
|
||||
attrib.getValue()
|
||||
))).expandX();
|
||||
});
|
||||
}
|
||||
WSection dimension = add(theme.section("Dimensions", dimensionExpanded)).expandX().widget();
|
||||
dimension.action = () -> {
|
||||
dimensionExpanded = dimension.isExpanded();
|
||||
};
|
||||
dimension.add(theme.label(String.format("Position: %.2f, %.2f, %.2f", entity.getX(), entity.getY(), entity.getZ()))).expandX();
|
||||
dimension.add(theme.label(String.format("Yaw: %.2f, Pitch: %.2f", entity.getYaw(), entity.getPitch()))).expandX();
|
||||
Box box = entity.getBoundingBox();
|
||||
dimension.add(theme.label(String.format("Bounding Box: %.2f, %.2f, %.2f",
|
||||
box.maxX-box.minX, box.maxY-box.minY, box.maxZ-box.minZ
|
||||
))).expandX();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
updateData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initWidgets() {}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
package anticope.rejects.gui.themes.rounded;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.widgets.*;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.input.WMeteorDropdown;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.input.WMeteorSlider;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.input.WMeteorTextBox;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.pressable.*;
|
||||
import meteordevelopment.meteorclient.gui.DefaultSettingsWidgetFactory;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.WidgetScreen;
|
||||
import meteordevelopment.meteorclient.gui.renderer.packer.GuiTexture;
|
||||
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
|
||||
import meteordevelopment.meteorclient.gui.utils.CharFilter;
|
||||
import meteordevelopment.meteorclient.gui.widgets.*;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WSection;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WView;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WWindow;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WDropdown;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WSlider;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.*;
|
||||
import meteordevelopment.meteorclient.renderer.text.TextRenderer;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
public class MeteorRoundedGuiTheme extends GuiTheme {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgColors = settings.createGroup("Colors");
|
||||
private final SettingGroup sgTextColors = settings.createGroup("Text");
|
||||
private final SettingGroup sgBackgroundColors = settings.createGroup("Background");
|
||||
private final SettingGroup sgOutline = settings.createGroup("Outline");
|
||||
private final SettingGroup sgSeparator = settings.createGroup("Separator");
|
||||
private final SettingGroup sgScrollbar = settings.createGroup("Scrollbar");
|
||||
private final SettingGroup sgSlider = settings.createGroup("Slider");
|
||||
|
||||
// General
|
||||
|
||||
public final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of the GUI.")
|
||||
.defaultValue(1)
|
||||
.min(0.75)
|
||||
.sliderMin(0.75)
|
||||
.sliderMax(4)
|
||||
.onSliderRelease()
|
||||
.onChanged(aDouble -> {
|
||||
if (mc.currentScreen instanceof WidgetScreen) ((WidgetScreen) mc.currentScreen).invalidate();
|
||||
})
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<AlignmentX> moduleAlignment = sgGeneral.add(new EnumSetting.Builder<AlignmentX>()
|
||||
.name("module-alignment")
|
||||
.description("How module titles are aligned.")
|
||||
.defaultValue(AlignmentX.Center)
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> categoryIcons = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("category-icons")
|
||||
.description("Adds item icons to module categories.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> hideHUD = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("hide-HUD")
|
||||
.description("Hide HUD when in GUI.")
|
||||
.defaultValue(false)
|
||||
.onChanged(v -> {
|
||||
if (mc.currentScreen instanceof WidgetScreen) mc.options.hudHidden = v;
|
||||
})
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Integer> round = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("round")
|
||||
.description("How much windows should be rounded")
|
||||
.defaultValue(0)
|
||||
.min(0)
|
||||
.max(20)
|
||||
.sliderMin(0)
|
||||
.sliderMax(15)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Colors
|
||||
|
||||
public final Setting<SettingColor> accentColor = color("accent", "Main color of the GUI.", new SettingColor(135, 0, 255));
|
||||
public final Setting<SettingColor> checkboxColor = color("checkbox", "Color of checkbox.", new SettingColor(135, 0, 255));
|
||||
public final Setting<SettingColor> plusColor = color("plus", "Color of plus button.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> minusColor = color("minus", "Color of minus button.", new SettingColor(255, 255, 255));
|
||||
|
||||
// Text
|
||||
|
||||
public final Setting<SettingColor> textColor = color(sgTextColors, "text", "Color of text.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> textSecondaryColor = color(sgTextColors, "text-secondary-text", "Color of secondary text.", new SettingColor(150, 150, 150));
|
||||
public final Setting<SettingColor> textHighlightColor = color(sgTextColors, "text-highlight", "Color of text highlighting.", new SettingColor(45, 125, 245, 100));
|
||||
public final Setting<SettingColor> titleTextColor = color(sgTextColors, "title-text", "Color of title text.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> loggedInColor = color(sgTextColors, "logged-in-text", "Color of logged in account name.", new SettingColor(45, 225, 45));
|
||||
|
||||
// Background
|
||||
|
||||
public final ThreeStateColorSetting backgroundColor = new ThreeStateColorSetting(
|
||||
sgBackgroundColors,
|
||||
"background",
|
||||
new SettingColor(20, 20, 20, 200),
|
||||
new SettingColor(30, 30, 30, 200),
|
||||
new SettingColor(40, 40, 40, 200)
|
||||
);
|
||||
|
||||
public final Setting<SettingColor> moduleBackground = color(sgBackgroundColors, "module-background", "Color of module background when active.", new SettingColor(50, 50, 50));
|
||||
|
||||
// Outline
|
||||
|
||||
public final ThreeStateColorSetting outlineColor = new ThreeStateColorSetting(
|
||||
sgOutline,
|
||||
"outline",
|
||||
new SettingColor(0, 0, 0),
|
||||
new SettingColor(10, 10, 10),
|
||||
new SettingColor(20, 20, 20)
|
||||
);
|
||||
|
||||
// Separator
|
||||
|
||||
public final Setting<SettingColor> separatorText = color(sgSeparator, "separator-text", "Color of separator text", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> separatorCenter = color(sgSeparator, "separator-center", "Center color of separators.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> separatorEdges = color(sgSeparator, "separator-edges", "Color of separator edges.", new SettingColor(225, 225, 225, 150));
|
||||
|
||||
// Scrollbar
|
||||
|
||||
public final ThreeStateColorSetting scrollbarColor = new ThreeStateColorSetting(
|
||||
sgScrollbar,
|
||||
"Scrollbar",
|
||||
new SettingColor(30, 30, 30, 200),
|
||||
new SettingColor(40, 40, 40, 200),
|
||||
new SettingColor(50, 50, 50, 200)
|
||||
);
|
||||
|
||||
// Slider
|
||||
|
||||
public final ThreeStateColorSetting sliderHandle = new ThreeStateColorSetting(
|
||||
sgSlider,
|
||||
"slider-handle",
|
||||
new SettingColor(0, 255, 180),
|
||||
new SettingColor(0, 240, 165),
|
||||
new SettingColor(0, 225, 150)
|
||||
);
|
||||
|
||||
public final Setting<SettingColor> sliderLeft = color(sgSlider, "slider-left", "Color of slider left part.", new SettingColor(0, 150, 80));
|
||||
public final Setting<SettingColor> sliderRight = color(sgSlider, "slider-right", "Color of slider right part.", new SettingColor(50, 50, 50));
|
||||
|
||||
public MeteorRoundedGuiTheme() {
|
||||
super("Meteor Rounded");
|
||||
|
||||
settingsFactory = new DefaultSettingsWidgetFactory(this);
|
||||
}
|
||||
|
||||
private Setting<SettingColor> color(SettingGroup group, String name, String description, SettingColor color) {
|
||||
return group.add(new ColorSetting.Builder()
|
||||
.name(name + "-color")
|
||||
.description(description)
|
||||
.defaultValue(color)
|
||||
.build());
|
||||
}
|
||||
private Setting<SettingColor> color(String name, String description, SettingColor color) {
|
||||
return color(sgColors, name, description, color);
|
||||
}
|
||||
|
||||
// Widgets
|
||||
|
||||
@Override
|
||||
public WWindow window(String title) {
|
||||
return w(new WMeteorWindow(title));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WLabel label(String text, boolean title, double maxWidth) {
|
||||
if (maxWidth == 0) return w(new WMeteorLabel(text, title));
|
||||
return w(new WMeteorMultiLabel(text, title, maxWidth));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WHorizontalSeparator horizontalSeparator(String text) {
|
||||
return w(new WMeteorHorizontalSeparator(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WVerticalSeparator verticalSeparator() {
|
||||
return w(new WMeteorVerticalSeparator());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WButton button(String text, GuiTexture texture) {
|
||||
return w(new WMeteorButton(text, texture));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WMinus minus() {
|
||||
return w(new WMeteorMinus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WPlus plus() {
|
||||
return w(new WMeteorPlus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WCheckbox checkbox(boolean checked) {
|
||||
return w(new WMeteorCheckbox(checked));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WSlider slider(double value, double min, double max) {
|
||||
return w(new WMeteorSlider(value, min, max));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTextBox textBox(String text, CharFilter filter) {
|
||||
return w(new WMeteorTextBox(text, filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> WDropdown<T> dropdown(T[] values, T value) {
|
||||
return w(new WMeteorDropdown<>(values, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTriangle triangle() {
|
||||
return w(new WMeteorTriangle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTooltip tooltip(String text) {
|
||||
return w(new WMeteorTooltip(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WView view() {
|
||||
return w(new WMeteorView());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WSection section(String title, boolean expanded, WWidget headerWidget) {
|
||||
return w(new WMeteorSection(title, expanded, headerWidget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WAccount account(WidgetScreen screen, Account<?> account) {
|
||||
return w(new WMeteorAccount(screen, account));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WWidget module(Module module) {
|
||||
return w(new WMeteorModule(module));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WQuad quad(Color color) {
|
||||
return w(new WMeteorQuad(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTopBar topBar() {
|
||||
return w(new WMeteorTopBar());
|
||||
}
|
||||
|
||||
// Colors
|
||||
|
||||
@Override
|
||||
public Color textColor() {
|
||||
return textColor.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color textSecondaryColor() {
|
||||
return textSecondaryColor.get();
|
||||
}
|
||||
|
||||
// Other
|
||||
|
||||
@Override
|
||||
public TextRenderer textRenderer() {
|
||||
return TextRenderer.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double scale(double value) {
|
||||
return value * scale.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean categoryIcons() {
|
||||
return categoryIcons.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideHUD() {
|
||||
return hideHUD.get();
|
||||
}
|
||||
|
||||
public int roundAmount() {
|
||||
return round.get();
|
||||
}
|
||||
|
||||
public class ThreeStateColorSetting {
|
||||
private final Setting<SettingColor> normal, hovered, pressed;
|
||||
|
||||
public ThreeStateColorSetting(SettingGroup group, String name, SettingColor c1, SettingColor c2, SettingColor c3) {
|
||||
normal = color(group, name, "Color of " + name + ".", c1);
|
||||
hovered = color(group, "hovered-" + name, "Color of " + name + " when hovered.", c2);
|
||||
pressed = color(group, "pressed-" + name, "Color of " + name + " when pressed.", c3);
|
||||
}
|
||||
|
||||
public SettingColor get() {
|
||||
return normal.get();
|
||||
}
|
||||
|
||||
public SettingColor get(boolean pressed, boolean hovered, boolean bypassDisableHoverColor) {
|
||||
if (pressed) return this.pressed.get();
|
||||
return (hovered && (bypassDisableHoverColor || !disableHoverColor)) ? this.hovered.get() : this.normal.get();
|
||||
}
|
||||
|
||||
public SettingColor get(boolean pressed, boolean hovered) {
|
||||
return get(pressed, hovered, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.utils.BaseWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public interface MeteorWidget extends BaseWidget {
|
||||
default MeteorRoundedGuiTheme theme() {
|
||||
return (MeteorRoundedGuiTheme) getTheme();
|
||||
}
|
||||
|
||||
default void renderBackground(GuiRenderer renderer, WWidget widget, boolean pressed, boolean mouseOver) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
int r = theme.roundAmount();
|
||||
double s = theme.scale(2);
|
||||
Color outlineColor = theme.outlineColor.get(pressed, mouseOver);
|
||||
GuiUtils.quadRounded(renderer, widget.x + s, widget.y + s, widget.width - s * 2, widget.height - s * 2, theme.backgroundColor.get(pressed, mouseOver), r - s);
|
||||
GuiUtils.quadOutlineRounded(renderer, widget, outlineColor, r, s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.WidgetScreen;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WAccount;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorAccount extends WAccount implements MeteorWidget {
|
||||
public WMeteorAccount(WidgetScreen screen, Account<?> account) {
|
||||
super(screen, account);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color loggedInColor() {
|
||||
return theme().loggedInColor.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color accountTypeColor() {
|
||||
return theme().textSecondaryColor.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WHorizontalSeparator;
|
||||
|
||||
public class WMeteorHorizontalSeparator extends WHorizontalSeparator implements MeteorWidget {
|
||||
public WMeteorHorizontalSeparator(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (text == null) renderWithoutText(renderer);
|
||||
else renderWithText(renderer);
|
||||
}
|
||||
|
||||
private void renderWithoutText(GuiRenderer renderer) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = theme.scale(1);
|
||||
double w = width / 2;
|
||||
|
||||
renderer.quad(x, y + s, w, s, theme.separatorEdges.get(), theme.separatorCenter.get());
|
||||
renderer.quad(x + w, y + s, w, s, theme.separatorCenter.get(), theme.separatorEdges.get());
|
||||
}
|
||||
|
||||
private void renderWithText(GuiRenderer renderer) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = theme.scale(2);
|
||||
double h = theme.scale(1);
|
||||
|
||||
double textStart = Math.round(width / 2.0 - textWidth / 2.0 - s);
|
||||
double textEnd = s + textStart + textWidth + s;
|
||||
|
||||
double offsetY = Math.round(height / 2.0);
|
||||
|
||||
renderer.quad(x, y + offsetY, textStart, h, theme.separatorEdges.get(), theme.separatorCenter.get());
|
||||
renderer.text(text, x + textStart + s, y, theme.separatorText.get(), false);
|
||||
renderer.quad(x + textEnd, y + offsetY, width - textEnd, h, theme.separatorCenter.get(), theme.separatorEdges.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WLabel;
|
||||
|
||||
public class WMeteorLabel extends WLabel implements MeteorWidget {
|
||||
public WMeteorLabel(String text, boolean title) {
|
||||
super(text, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (!text.isEmpty()) {
|
||||
renderer.text(text, x, y, color != null ? color : (title ? theme().titleTextColor.get() : theme().textColor.get()), title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_RIGHT;
|
||||
|
||||
public class WMeteorModule extends WPressable implements MeteorWidget {
|
||||
private final Module module;
|
||||
|
||||
private double titleWidth;
|
||||
|
||||
private double animationProgress1;
|
||||
|
||||
private double animationProgress2;
|
||||
|
||||
public WMeteorModule(Module module) {
|
||||
this.module = module;
|
||||
|
||||
if (module.isActive()) {
|
||||
animationProgress1 = 1;
|
||||
animationProgress2 = 1;
|
||||
} else {
|
||||
animationProgress1 = 0;
|
||||
animationProgress2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double pad() {
|
||||
return theme.scale(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCalculateSize() {
|
||||
double pad = pad();
|
||||
|
||||
if (titleWidth == 0) titleWidth = theme.textWidth(module.title);
|
||||
|
||||
width = pad + titleWidth + pad;
|
||||
height = pad + theme.textHeight() + pad;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPressed(int button) {
|
||||
if (button == GLFW_MOUSE_BUTTON_LEFT) module.toggle();
|
||||
else if (button == GLFW_MOUSE_BUTTON_RIGHT) mc.setScreen(theme.moduleScreen(module));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
|
||||
animationProgress1 += delta * 4 * ((module.isActive() || mouseOver) ? 1 : -1);
|
||||
animationProgress1 = Utils.clamp(animationProgress1, 0, 1);
|
||||
|
||||
animationProgress2 += delta * 6 * (module.isActive() ? 1 : -1);
|
||||
animationProgress2 = Utils.clamp(animationProgress2, 0, 1);
|
||||
|
||||
if (animationProgress1 > 0) {
|
||||
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());
|
||||
}
|
||||
if (animationProgress2 > 0) {
|
||||
renderer.quad(x, y + height * (1 - animationProgress2), theme.scale(2), height * animationProgress2, theme.accentColor.get());
|
||||
}
|
||||
|
||||
double x = this.x + pad;
|
||||
double w = width - pad * 2;
|
||||
|
||||
if (theme.moduleAlignment.get() == AlignmentX.Center) {
|
||||
x += w / 2 - titleWidth / 2;
|
||||
}
|
||||
else if (theme.moduleAlignment.get() == AlignmentX.Right) {
|
||||
x += w - titleWidth;
|
||||
}
|
||||
|
||||
renderer.text(module.title, x, y + pad, theme.textColor.get(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WMultiLabel;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorMultiLabel extends WMultiLabel implements MeteorWidget {
|
||||
public WMeteorMultiLabel(String text, boolean title, double maxWidth) {
|
||||
super(text, title, maxWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double h = theme.textHeight(title);
|
||||
Color color = theme().textColor.get();
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
renderer.text(lines.get(i), x, y + h * i, color, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WQuad;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorQuad extends WQuad {
|
||||
public WMeteorQuad(Color color) {
|
||||
super(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
GuiUtils.quadRounded(renderer, x, y, width, height, color, ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WSection;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WTriangle;
|
||||
|
||||
public class WMeteorSection extends WSection {
|
||||
public WMeteorSection(String title, boolean expanded, WWidget headerWidget) {
|
||||
super(title, expanded, headerWidget);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WHeader createHeader() {
|
||||
return new WMeteorHeader(title);
|
||||
}
|
||||
|
||||
protected class WMeteorHeader extends WHeader {
|
||||
private WTriangle triangle;
|
||||
|
||||
public WMeteorHeader(String title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
add(theme.horizontalSeparator(title)).expandX();
|
||||
|
||||
if (headerWidget != null) add(headerWidget);
|
||||
|
||||
triangle = new WHeaderTriangle();
|
||||
triangle.theme = theme;
|
||||
triangle.action = this::onClick;
|
||||
|
||||
add(triangle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
triangle.rotation = (1 - animProgress) * -90;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class WHeaderTriangle extends WTriangle implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
renderer.rotatedQuad(x, y, width, height, rotation, GuiRenderer.TRIANGLE, theme().textColor.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WTooltip;
|
||||
|
||||
public class WMeteorTooltip extends WTooltip implements MeteorWidget {
|
||||
public WMeteorTooltip(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
renderer.quad(this, theme().backgroundColor.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.tabs.Tab;
|
||||
import meteordevelopment.meteorclient.gui.tabs.TabScreen;
|
||||
import meteordevelopment.meteorclient.gui.tabs.Tabs;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WTopBar;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
import static org.lwjgl.glfw.GLFW.glfwSetCursorPos;
|
||||
|
||||
public class WMeteorTopBar extends WTopBar implements MeteorWidget {
|
||||
@Override
|
||||
protected Color getButtonColor(boolean pressed, boolean hovered) {
|
||||
return theme().backgroundColor.get(pressed, hovered);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getNameColor() {
|
||||
return theme().textColor.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
for (Tab tab : Tabs.get()) {
|
||||
add(new WTopBarButton(tab));
|
||||
}
|
||||
}
|
||||
|
||||
protected int getState(WTopBarButton btn) {
|
||||
int a = 0;
|
||||
if (btn.equals(cells.get(0).widget()))
|
||||
a |= 1;
|
||||
if (btn.equals(cells.get(cells.size() - 1).widget()))
|
||||
a |= 2;
|
||||
return a;
|
||||
}
|
||||
|
||||
protected class WTopBarButton extends WPressable {
|
||||
private final Tab tab;
|
||||
|
||||
public WTopBarButton(Tab tab) {
|
||||
this.tab = tab;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCalculateSize() {
|
||||
double pad = pad();
|
||||
|
||||
width = pad + theme.textWidth(tab.name) + pad;
|
||||
height = pad + theme.textHeight() + pad;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPressed(int button) {
|
||||
Screen screen = mc.currentScreen;
|
||||
|
||||
if (!(screen instanceof TabScreen) || ((TabScreen) screen).tab != tab) {
|
||||
double mouseX = mc.mouse.getX();
|
||||
double mouseY = mc.mouse.getY();
|
||||
|
||||
tab.openScreen(theme);
|
||||
glfwSetCursorPos(mc.getWindow().getHandle(), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double pad = pad();
|
||||
Color color = getButtonColor(pressed || (mc.currentScreen instanceof TabScreen && ((TabScreen) mc.currentScreen).tab == tab), mouseOver);
|
||||
|
||||
//renderer.quad(x, y, width, height, color);
|
||||
switch (getState(this)) {
|
||||
case 1:
|
||||
GuiUtils.quadRoundedSide(renderer, this, color, ((MeteorRoundedGuiTheme)theme).roundAmount(), false);
|
||||
break;
|
||||
case 2:
|
||||
GuiUtils.quadRoundedSide(renderer, this, color, ((MeteorRoundedGuiTheme)theme).roundAmount(), true);
|
||||
break;
|
||||
case 3:
|
||||
GuiUtils.quadRounded(renderer, this, color, ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
break;
|
||||
default:
|
||||
renderer.quad(this, color);
|
||||
break;
|
||||
}
|
||||
renderer.text(tab.name, x + pad, y + pad, getNameColor(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WVerticalSeparator;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorVerticalSeparator extends WVerticalSeparator implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
Color colorEdges = theme.separatorEdges.get();
|
||||
Color colorCenter = theme.separatorCenter.get();
|
||||
|
||||
double s = theme.scale(1);
|
||||
double offsetX = Math.round(width / 2.0);
|
||||
|
||||
renderer.quad(x + offsetX, y, s, height / 2, colorEdges, colorEdges, colorCenter, colorCenter);
|
||||
renderer.quad(x + offsetX, y + height / 2, s, height / 2, colorCenter, colorCenter, colorEdges, colorEdges);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WView;
|
||||
|
||||
public class WMeteorView extends WView implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (canScroll && hasScrollBar) {
|
||||
renderer.quad(handleX(), handleY(), handleWidth(), handleHeight(), theme().scrollbarColor.get(handlePressed, handleMouseOver));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WWindow;
|
||||
|
||||
public class WMeteorWindow extends WWindow implements MeteorWidget {
|
||||
public WMeteorWindow(String title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WHeader header() {
|
||||
return new WMeteorHeader();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (expanded || animProgress > 0) {
|
||||
GuiUtils.quadRounded(renderer,x , y + header.height / 2, width, height - header.height / 2, theme().backgroundColor.get(), ((MeteorRoundedGuiTheme)theme).roundAmount(), false);
|
||||
}
|
||||
}
|
||||
|
||||
private class WMeteorHeader extends WHeader {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
GuiUtils.quadRounded(renderer, this, theme().accentColor.get(), ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.input;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WDropdown;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorDropdown<T> extends WDropdown<T> implements MeteorWidget {
|
||||
public WMeteorDropdown(T[] values, T value) {
|
||||
super(values, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WDropdownRoot createRootWidget() {
|
||||
return new WRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WDropdownValue createValueWidget() {
|
||||
return new WValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
double s = theme.textHeight();
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
|
||||
String text = get().toString();
|
||||
double w = theme.textWidth(text);
|
||||
renderer.text(text, x + pad + maxValueWidth / 2 - w / 2, y + pad, theme.textColor.get(), false);
|
||||
|
||||
renderer.rotatedQuad(x + pad + maxValueWidth + pad, y + pad, s, s, 0, GuiRenderer.TRIANGLE, theme.textColor.get());
|
||||
}
|
||||
|
||||
private static class WRoot extends WDropdownRoot implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = theme.scale(2);
|
||||
Color c = theme.outlineColor.get();
|
||||
|
||||
renderer.quad(x, y + height - s, width, s, c);
|
||||
renderer.quad(x, y, s, height - s, c);
|
||||
renderer.quad(x + width - s, y, s, height - s, c);
|
||||
}
|
||||
}
|
||||
|
||||
private class WValue extends WDropdownValue implements MeteorWidget {
|
||||
@Override
|
||||
protected void onCalculateSize() {
|
||||
double pad = pad();
|
||||
|
||||
width = pad + theme.textWidth(value.toString()) + pad;
|
||||
height = pad + theme.textHeight() + pad;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
|
||||
Color color = theme.backgroundColor.get(pressed, mouseOver, true);
|
||||
int preA = color.a;
|
||||
color.a += color.a / 2;
|
||||
color.validate();
|
||||
|
||||
renderer.quad(this, color);
|
||||
|
||||
color.a = preA;
|
||||
|
||||
String text = value.toString();
|
||||
renderer.text(text, x + width / 2 - theme.textWidth(text) / 2, y + pad(), theme.textColor.get(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.input;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WSlider;
|
||||
|
||||
public class WMeteorSlider extends WSlider implements MeteorWidget {
|
||||
public WMeteorSlider(double value, double min, double max) {
|
||||
super(value, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double valueWidth = valueWidth();
|
||||
|
||||
renderBar(renderer, valueWidth);
|
||||
renderHandle(renderer, valueWidth);
|
||||
}
|
||||
|
||||
private void renderBar(GuiRenderer renderer, double valueWidth) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
|
||||
double s = theme.scale(3);
|
||||
double handleSize = handleSize();
|
||||
|
||||
double x = this.x + handleSize / 2;
|
||||
double y = this.y + height / 2 - s / 2;
|
||||
|
||||
renderer.quad(x, y, valueWidth, s, theme.sliderLeft.get());
|
||||
renderer.quad(x + valueWidth, y, width - valueWidth - handleSize, s, theme.sliderRight.get());
|
||||
}
|
||||
|
||||
private void renderHandle(GuiRenderer renderer, double valueWidth) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = handleSize();
|
||||
|
||||
renderer.quad(x + valueWidth, y, s, s, GuiRenderer.CIRCLE, theme.sliderHandle.get(dragging, handleMouseOver));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.input;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.utils.CharFilter;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
|
||||
public class WMeteorTextBox extends WTextBox implements MeteorWidget {
|
||||
private boolean cursorVisible;
|
||||
private double cursorTimer;
|
||||
|
||||
private double animProgress;
|
||||
|
||||
public WMeteorTextBox(String text, CharFilter filter) {
|
||||
super(text, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCursorChanged() {
|
||||
cursorVisible = true;
|
||||
cursorTimer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (cursorTimer >= 1) {
|
||||
cursorVisible = !cursorVisible;
|
||||
cursorTimer = 0;
|
||||
}
|
||||
else {
|
||||
cursorTimer += delta * 1.75;
|
||||
}
|
||||
|
||||
renderBackground(renderer, this, false, false);
|
||||
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
double overflowWidth = getOverflowWidthForRender();
|
||||
|
||||
renderer.scissorStart(x + pad, y + pad, width - pad * 2, height - pad * 2);
|
||||
|
||||
// Text content
|
||||
if (!text.isEmpty()) {
|
||||
renderer.text(text, x + pad - overflowWidth, y + pad, theme.textColor.get(), false);
|
||||
}
|
||||
|
||||
// Text highlighting
|
||||
if (focused && (cursor != selectionStart || cursor != selectionEnd)) {
|
||||
double selStart = x + pad + getTextWidth(selectionStart) - overflowWidth;
|
||||
double selEnd = x + pad + getTextWidth(selectionEnd) - overflowWidth;
|
||||
|
||||
renderer.quad(selStart, y + pad, selEnd - selStart, theme.textHeight(), theme.textHighlightColor.get());
|
||||
}
|
||||
|
||||
// Cursor
|
||||
animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
|
||||
animProgress = Utils.clamp(animProgress, 0, 1);
|
||||
|
||||
if ((focused && cursorVisible) || animProgress > 0) {
|
||||
renderer.setAlpha(animProgress);
|
||||
renderer.quad(x + pad + getTextWidth(cursor) - overflowWidth, y + pad, theme.scale(1), theme.textHeight(), theme.textColor.get());
|
||||
renderer.setAlpha(1);
|
||||
}
|
||||
|
||||
renderer.scissorEnd();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.renderer.packer.GuiTexture;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
|
||||
|
||||
public class WMeteorButton extends WButton implements MeteorWidget {
|
||||
public WMeteorButton(String text, GuiTexture texture) {
|
||||
super(text, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
|
||||
if (text != null) {
|
||||
renderer.text(text, x + width / 2 - textWidth / 2, y + pad, theme.textColor.get(), false);
|
||||
}
|
||||
else {
|
||||
double ts = theme.textHeight();
|
||||
renderer.quad(x + width / 2 - ts / 2, y + pad, ts, ts, texture, theme.textColor.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
|
||||
public class WMeteorCheckbox extends WCheckbox implements MeteorWidget {
|
||||
private double animProgress;
|
||||
|
||||
public WMeteorCheckbox(boolean checked) {
|
||||
super(checked);
|
||||
animProgress = checked ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
|
||||
animProgress += (checked ? 1 : -1) * delta * 14;
|
||||
animProgress = Utils.clamp(animProgress, 0, 1);
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
|
||||
if (animProgress > 0) {
|
||||
double cs = (width - theme.scale(2)) / 1.75 * animProgress;
|
||||
GuiUtils.quadRounded(renderer, x + (width - cs) / 2, y + (height - cs) / 2, cs, cs, theme.checkboxColor.get(), ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus;
|
||||
|
||||
public class WMeteorMinus extends WMinus implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double pad = pad();
|
||||
double s = theme.scale(3);
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
renderer.quad(x + pad, y + height / 2 - s / 2, width - pad * 2, s, theme().minusColor.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPlus;
|
||||
|
||||
public class WMeteorPlus extends WPlus implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
double s = theme.scale(3);
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
renderer.quad(x + pad, y + height / 2 - s / 2, width - pad * 2, s, theme.plusColor.get());
|
||||
renderer.quad(x + width / 2 - s / 2, y + pad, s, height - pad * 2, theme.plusColor.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WTriangle;
|
||||
|
||||
public class WMeteorTriangle extends WTriangle implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
renderer.rotatedQuad(x, y, width, height, rotation, GuiRenderer.TRIANGLE, theme().backgroundColor.get(pressed, mouseOver));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user