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 Resent INSTANCE;
|
||||
//private ISound uwu;
|
||||
public ModManager modManager;
|
||||
|
||||
public void init() {
|
||||
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.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import dev.resent.module.base.Mod.Category;
|
||||
import dev.resent.module.impl.hud.ArmorHud;
|
||||
|
@ -108,12 +109,9 @@ public class ModManager {
|
|||
}
|
||||
|
||||
public ArrayList<Mod> modsInCategory(Category c){
|
||||
ArrayList<Mod> inCategory = new ArrayList<>();
|
||||
for(Mod m : this.modules){
|
||||
if(m.getCategory() == c)
|
||||
inCategory.add(m);
|
||||
}
|
||||
return inCategory;
|
||||
ArrayList<Mod> inCat = (ArrayList<Mod>) this.modules.stream().filter(m -> m.getCategory() == c).collect(Collectors.toList());
|
||||
|
||||
return inCat;
|
||||
}
|
||||
|
||||
public void register(final Mod m) {
|
||||
|
|
|
@ -8,9 +8,7 @@ import net.minecraft.client.gui.GuiScreen;
|
|||
|
||||
public abstract class RenderMod extends Mod {
|
||||
|
||||
public int x, y, width, height;
|
||||
public int lastX;
|
||||
public int lastY;
|
||||
public int x, y, lastX, lastY, width, height;
|
||||
private boolean dragging;
|
||||
|
||||
public RenderMod(){
|
||||
|
@ -28,7 +26,8 @@ public abstract class RenderMod extends Mod {
|
|||
|
||||
public void draw() {}
|
||||
|
||||
public void resize() {
|
||||
public void renderLayout(final int mouseX, final int mouseY) {
|
||||
|
||||
if ((getX() + getWidth()) > GuiScreen.width) {
|
||||
this.x = GuiScreen.width - getWidth();
|
||||
dragging = false;
|
||||
|
@ -42,11 +41,7 @@ public abstract class RenderMod extends Mod {
|
|||
this.y = 0;
|
||||
dragging = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void renderLayout(final int mouseX, final int mouseY) {
|
||||
|
||||
resize();
|
||||
|
||||
draw();
|
||||
|
||||
if (this.dragging) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user