Fixed Pagination not being updated correctly
Added GuiLoadingListEntry to Lists while in Replay Center
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiListExtended.IGuiListEntry;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GuiLoadingListEntry implements IGuiListEntry {
|
||||
|
||||
boolean registered = false;
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
private GuiReplayListExtended parent;
|
||||
private final String message = I18n.format("replaymod.gui.loading")+"...";
|
||||
|
||||
public GuiLoadingListEntry(GuiReplayListExtended parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) {
|
||||
try {
|
||||
int width = mc.fontRendererObj.getStringWidth(message);
|
||||
mc.fontRendererObj.drawString(message, x+(listWidth/2)-(width/2), y + (slotHeight/2)-(mc.fontRendererObj.FONT_HEIGHT/2) - 7
|
||||
, Color.LIGHT_GRAY.getRGB());
|
||||
|
||||
String bubbles = System.currentTimeMillis() % 500 >= 250 ? "oOo" : "OoO";
|
||||
|
||||
width = mc.fontRendererObj.getStringWidth(bubbles);
|
||||
mc.fontRendererObj.drawString(bubbles, x+(listWidth/2)-(width/2), y + (slotHeight/2)-(mc.fontRendererObj.FONT_HEIGHT/2) + 8
|
||||
, Color.LIGHT_GRAY.getRGB());
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) {}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int p_148278_1_, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) {}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package eu.crushedpixel.replaymod.gui.elements;
|
||||
|
||||
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiListExtended;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -9,14 +8,13 @@ import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class GuiReplayListExtended extends GuiListExtended {
|
||||
|
||||
public int selected = -1;
|
||||
private List<GuiReplayListEntry> entries = new ArrayList<GuiReplayListEntry>();
|
||||
private List<IGuiListEntry> entries = new ArrayList<IGuiListEntry>();
|
||||
|
||||
public GuiReplayListExtended(Minecraft mcIn, int p_i45010_2_,
|
||||
int p_i45010_3_, int p_i45010_4_, int p_i45010_5_, int p_i45010_6_) {
|
||||
@@ -70,19 +68,27 @@ public abstract class GuiReplayListExtended extends GuiListExtended {
|
||||
}
|
||||
|
||||
public void clearEntries() {
|
||||
entries = new ArrayList<GuiReplayListEntry>();
|
||||
entries = new ArrayList<IGuiListEntry>();
|
||||
}
|
||||
|
||||
public void addEntry(FileInfo fileInfo, File image) {
|
||||
entries.add(new GuiReplayListEntry(this, fileInfo, image));
|
||||
public void addEntry(IGuiListEntry entry) {
|
||||
entries.add(entry);
|
||||
}
|
||||
|
||||
public void addEntry(int index, IGuiListEntry entry) {
|
||||
entries.add(index, entry);
|
||||
}
|
||||
|
||||
public void removeEntry(IGuiListEntry entry) {
|
||||
entries.remove(entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiReplayListEntry getListEntry(int index) {
|
||||
public IGuiListEntry getListEntry(int index) {
|
||||
return entries.get(index);
|
||||
}
|
||||
|
||||
public List<GuiReplayListEntry> getEntries() {
|
||||
public List<IGuiListEntry> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user