Code optimization & lambda
This commit is contained in:
parent
1511a5cedb
commit
4c6c0ee684
|
@ -10,9 +10,19 @@ public class Resent {
|
||||||
|
|
||||||
public static final String NAME = "Resent", VERSION = "3.4";
|
public static final String NAME = "Resent", VERSION = "3.4";
|
||||||
public static final Resent INSTANCE;
|
public static final Resent INSTANCE;
|
||||||
|
//private ISound uwu;
|
||||||
public ModManager modManager;
|
public ModManager modManager;
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
Resent.INSTANCE.modManager = new ModManager();
|
Resent.INSTANCE.modManager = new ModManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public void playMusic(ResourceLocation loc){
|
||||||
|
this.uwu = PositionedSoundRecord.create(loc);
|
||||||
|
if(uwu != null){
|
||||||
|
Minecraft.getMinecraft().getSoundHandler().stopSounds();
|
||||||
|
Minecraft.getMinecraft().getSoundHandler().playSound(uwu);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package dev.resent.module.base;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import dev.resent.module.base.Mod.Category;
|
import dev.resent.module.base.Mod.Category;
|
||||||
import dev.resent.module.impl.hud.ArmorHud;
|
import dev.resent.module.impl.hud.ArmorHud;
|
||||||
|
@ -108,12 +109,9 @@ public class ModManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Mod> modsInCategory(Category c){
|
public ArrayList<Mod> modsInCategory(Category c){
|
||||||
ArrayList<Mod> inCategory = new ArrayList<>();
|
ArrayList<Mod> inCat = (ArrayList<Mod>) this.modules.stream().filter(m -> m.getCategory() == c).collect(Collectors.toList());
|
||||||
for(Mod m : this.modules){
|
|
||||||
if(m.getCategory() == c)
|
return inCat;
|
||||||
inCategory.add(m);
|
|
||||||
}
|
|
||||||
return inCategory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(final Mod m) {
|
public void register(final Mod m) {
|
||||||
|
|
|
@ -8,9 +8,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
public abstract class RenderMod extends Mod {
|
public abstract class RenderMod extends Mod {
|
||||||
|
|
||||||
public int x, y, width, height;
|
public int x, y, lastX, lastY, width, height;
|
||||||
public int lastX;
|
|
||||||
public int lastY;
|
|
||||||
private boolean dragging;
|
private boolean dragging;
|
||||||
|
|
||||||
public RenderMod(){
|
public RenderMod(){
|
||||||
|
@ -28,7 +26,8 @@ public abstract class RenderMod extends Mod {
|
||||||
|
|
||||||
public void draw() {}
|
public void draw() {}
|
||||||
|
|
||||||
public void resize() {
|
public void renderLayout(final int mouseX, final int mouseY) {
|
||||||
|
|
||||||
if ((getX() + getWidth()) > GuiScreen.width) {
|
if ((getX() + getWidth()) > GuiScreen.width) {
|
||||||
this.x = GuiScreen.width - getWidth();
|
this.x = GuiScreen.width - getWidth();
|
||||||
dragging = false;
|
dragging = false;
|
||||||
|
@ -42,11 +41,7 @@ public abstract class RenderMod extends Mod {
|
||||||
this.y = 0;
|
this.y = 0;
|
||||||
dragging = false;
|
dragging = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void renderLayout(final int mouseX, final int mouseY) {
|
|
||||||
|
|
||||||
resize();
|
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
if (this.dragging) {
|
if (this.dragging) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user