enhancement

This commit is contained in:
NK 2023-05-26 23:57:47 +01:00
parent 011c729f32
commit 03809a260f
5 changed files with 8 additions and 24 deletions

View file

@ -1,5 +1,6 @@
package me.night0721.lilase.events;
import lombok.Getter;
import net.minecraft.network.Packet;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@ -7,7 +8,7 @@ import net.minecraftforge.fml.common.eventhandler.Event;
// TODO: Implement Lombok Library for clean code
@Cancelable
public class PacketSentEvent extends Event {
private final Packet<?> packet;
private @Getter final Packet<?> packet;
public PacketSentEvent(Packet<?> packet) {
this.packet = packet;

View file

@ -28,7 +28,7 @@ import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
public class Claimer extends Sniper {
public ClaimerState state = ClaimerState.NONE;
public List<Integer> toClaim = new ArrayList<>();
public final List<Integer> toClaim = new ArrayList<>();
@Override
public void onTick() {

View file

@ -27,10 +27,10 @@ import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
// TODO: Fix repeating code (I will do it soon)
public class Flipper {
public String name;
public int price;
public int target;
public String uuid;
public final String name;
public final int price;
public final int target;
public final String uuid;
public static FlipperState state = FlipperState.NONE;
public static final Rotation rotation = new Rotation();
private final Clock buyWait = new Clock();

View file

@ -30,7 +30,7 @@ import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
public class Relister extends Sniper {
public RelisterState state = RelisterState.NONE;
public boolean shouldBeRelisting = false;
public List<Integer> toRelist = new ArrayList<>();
public final List<Integer> toRelist = new ArrayList<>();
private final Pattern BUYITNOW = Pattern.compile("Buy it now: ([\\d,]+) coins");
@Override

View file

@ -1,25 +1,12 @@
package me.night0721.lilase.gui;
import me.night0721.lilase.Lilase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;
// TODO: Generify repeating code.
public class TextRenderer {
public static void drawString(String text, int x, int y, double scale) {
double scaleReset = Math.pow(scale, -1);
GL11.glScaled(scale, scale, scale);
y -= Lilase.mc.fontRendererObj.FONT_HEIGHT * scale;
for (String line : text.split("\n")) {
y += Lilase.mc.fontRendererObj.FONT_HEIGHT * scale;
Lilase.mc.fontRendererObj.drawString(line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF, true);
}
GL11.glScaled(scaleReset, scaleReset, scaleReset);
GlStateManager.color(1, 1, 1, 1);
}
public static void drawString(String text, int x, int y, double scale, int color) {
double scaleReset = Math.pow(scale, -1);
@ -33,10 +20,6 @@ public class TextRenderer {
GlStateManager.color(1, 1, 1, 1);
}
public void drawCenteredString(String text, int x, int y, double scale) {
drawString(text, x - Minecraft.getMinecraft().fontRendererObj.getStringWidth(text) / 2, y - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2, scale);
}
public static void drawGradientString(FontRenderer fontRenderer, String text, int x, int y, int colorStart, int colorEnd) {
int textWidth = fontRenderer.getStringWidth(text);
int startX = x - textWidth / 2;