enhancement
This commit is contained in:
parent
011c729f32
commit
03809a260f
5 changed files with 8 additions and 24 deletions
|
@ -1,5 +1,6 @@
|
||||||
package me.night0721.lilase.events;
|
package me.night0721.lilase.events;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
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
|
// TODO: Implement Lombok Library for clean code
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public class PacketSentEvent extends Event {
|
public class PacketSentEvent extends Event {
|
||||||
private final Packet<?> packet;
|
private @Getter final Packet<?> packet;
|
||||||
|
|
||||||
public PacketSentEvent(Packet<?> packet) {
|
public PacketSentEvent(Packet<?> packet) {
|
||||||
this.packet = packet;
|
this.packet = packet;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
|
||||||
|
|
||||||
public class Claimer extends Sniper {
|
public class Claimer extends Sniper {
|
||||||
public ClaimerState state = ClaimerState.NONE;
|
public ClaimerState state = ClaimerState.NONE;
|
||||||
public List<Integer> toClaim = new ArrayList<>();
|
public final List<Integer> toClaim = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick() {
|
public void onTick() {
|
||||||
|
|
|
@ -27,10 +27,10 @@ import static me.night0721.lilase.utils.PlayerUtils.sendPacketWithoutEvent;
|
||||||
|
|
||||||
// TODO: Fix repeating code (I will do it soon)
|
// TODO: Fix repeating code (I will do it soon)
|
||||||
public class Flipper {
|
public class Flipper {
|
||||||
public String name;
|
public final String name;
|
||||||
public int price;
|
public final int price;
|
||||||
public int target;
|
public final int target;
|
||||||
public String uuid;
|
public final String uuid;
|
||||||
public static FlipperState state = FlipperState.NONE;
|
public static FlipperState state = FlipperState.NONE;
|
||||||
public static final Rotation rotation = new Rotation();
|
public static final Rotation rotation = new Rotation();
|
||||||
private final Clock buyWait = new Clock();
|
private final Clock buyWait = new Clock();
|
||||||
|
|
|
@ -30,7 +30,7 @@ import static me.night0721.lilase.utils.KeyBindingManager.stopMovement;
|
||||||
public class Relister extends Sniper {
|
public class Relister extends Sniper {
|
||||||
public RelisterState state = RelisterState.NONE;
|
public RelisterState state = RelisterState.NONE;
|
||||||
public boolean shouldBeRelisting = false;
|
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");
|
private final Pattern BUYITNOW = Pattern.compile("Buy it now: ([\\d,]+) coins");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,25 +1,12 @@
|
||||||
package me.night0721.lilase.gui;
|
package me.night0721.lilase.gui;
|
||||||
|
|
||||||
import me.night0721.lilase.Lilase;
|
import me.night0721.lilase.Lilase;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
// TODO: Generify repeating code.
|
// TODO: Generify repeating code.
|
||||||
public class TextRenderer {
|
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) {
|
public static void drawString(String text, int x, int y, double scale, int color) {
|
||||||
double scaleReset = Math.pow(scale, -1);
|
double scaleReset = Math.pow(scale, -1);
|
||||||
|
|
||||||
|
@ -33,10 +20,6 @@ public class TextRenderer {
|
||||||
GlStateManager.color(1, 1, 1, 1);
|
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) {
|
public static void drawGradientString(FontRenderer fontRenderer, String text, int x, int y, int colorStart, int colorEnd) {
|
||||||
int textWidth = fontRenderer.getStringWidth(text);
|
int textWidth = fontRenderer.getStringWidth(text);
|
||||||
int startX = x - textWidth / 2;
|
int startX = x - textWidth / 2;
|
||||||
|
|
Loading…
Reference in a new issue