mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-21 12:42:11 +00:00
Added real time display of Loaded/Forced chunks
This commit is contained in:
1 parent
6ffec426b5
commit
8378b8fc6d
4 files changed
+75
-2
No files matched your search
@@ -116,5 +116,23 @@ public class ChunkManager {
|
||||
|
||||
return outList;
|
||||
}
|
||||
|
||||
public static int getLoadedChunkAmount(){
|
||||
int loadedChunks = 0;
|
||||
for (WorldServer world : DimensionManager.getWorlds()){
|
||||
int loadedChunksForDim = world.getChunkProvider().getLoadedChunkCount();
|
||||
loadedChunks += loadedChunksForDim;
|
||||
//System.out.printf("[ %2d ] %d chunks\n", world.provider.dimensionId, loadedChunksForDim);
|
||||
}
|
||||
//System.out.printf("Total : %d chunks\n", loadedChunks);
|
||||
return loadedChunks;
|
||||
}
|
||||
|
||||
public static int getForcedChunkAmount(){
|
||||
int forcedChunks = 0;
|
||||
for (WorldServer world : DimensionManager.getWorlds()){
|
||||
forcedChunks += world.getPersistentChunks().size();
|
||||
}
|
||||
return forcedChunks;
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,14 @@ public class OpisPacketHandler implements IPacketHandler {
|
||||
modOpis.selectedBlock = (CoordinatesBlock)castedPacket.data;
|
||||
SwingUI.instance().getBtnTimingTERemoveHighlight().setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
else if(castedPacket.dataReq == Message.VALUE_CHUNK_FORCED){
|
||||
SwingUI.instance().getLblSummaryForcedChunks().setText(String.valueOf(((SerialInt)castedPacket.data).value));
|
||||
}
|
||||
|
||||
else if(castedPacket.dataReq == Message.VALUE_CHUNK_LOADED){
|
||||
SwingUI.instance().getLblSummaryLoadedChunks().setText(String.valueOf(((SerialInt)castedPacket.data).value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,6 +366,9 @@ public class OpisPacketHandler implements IPacketHandler {
|
||||
|
||||
OpisPacketHandler.validateAndSend(Packet_DataValue.create(Message.STATUS_ACCESS_LEVEL, new SerialInt(PlayerTracker.instance().getPlayerAccessLevel(player).ordinal())), player);
|
||||
|
||||
OpisPacketHandler.validateAndSend(Packet_DataValue.create(Message.VALUE_CHUNK_FORCED, new SerialInt(ChunkManager.getForcedChunkAmount())), player);
|
||||
OpisPacketHandler.validateAndSend(Packet_DataValue.create(Message.VALUE_CHUNK_LOADED, new SerialInt(ChunkManager.getLoadedChunkAmount())), player);
|
||||
|
||||
// This portion is to get the proper filtered amounts depending on the player preferences.
|
||||
String name = ((EntityPlayer)player).getEntityName();
|
||||
boolean filtered = false;
|
||||
|
||||
@@ -30,6 +30,9 @@ public enum Message {
|
||||
VALUE_AMOUNT_UPLOAD,
|
||||
VALUE_AMOUNT_DOWNLOAD,
|
||||
|
||||
VALUE_CHUNK_FORCED,
|
||||
VALUE_CHUNK_LOADED,
|
||||
|
||||
STATUS_START,
|
||||
STATUS_STOP,
|
||||
STATUS_RUN_UPDATE,
|
||||
|
||||
@@ -154,6 +154,10 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
private JButton btnPlayers_Dummy2;
|
||||
private JLabel lblSummaryTimeStampLastRun;
|
||||
private JButton btnTimingTERemoveHighlight;
|
||||
private JLabel lblSummary_16;
|
||||
private JLabel lblSummary_17;
|
||||
private JLabel lblSummaryForcedChunks;
|
||||
private JLabel lblSummaryLoadedChunk;
|
||||
|
||||
public void showUI(){
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
@@ -173,7 +177,7 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
private SwingUI() {
|
||||
setTitle("Opis Control Panel");
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setBounds(100, 100, 838, 449);
|
||||
setBounds(100, 100, 893, 455);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
contentPane.setLayout(new BorderLayout(0, 0));
|
||||
@@ -407,6 +411,38 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
gbc_lblSummaryAmountHandlers.gridy = 5;
|
||||
panelSummary.add(lblSummaryAmountHandlers, gbc_lblSummaryAmountHandlers);
|
||||
|
||||
lblSummary_16 = new JLabel("Forced chunks");
|
||||
GridBagConstraints gbc_lblSummary_16 = new GridBagConstraints();
|
||||
gbc_lblSummary_16.insets = new Insets(0, 0, 5, 5);
|
||||
gbc_lblSummary_16.gridx = 9;
|
||||
gbc_lblSummary_16.gridy = 5;
|
||||
panelSummary.add(lblSummary_16, gbc_lblSummary_16);
|
||||
|
||||
lblSummaryForcedChunks = new JLabel("0");
|
||||
GridBagConstraints gbc_lblSummaryForcedChunks = new GridBagConstraints();
|
||||
gbc_lblSummaryForcedChunks.anchor = GridBagConstraints.EAST;
|
||||
gbc_lblSummaryForcedChunks.gridwidth = 2;
|
||||
gbc_lblSummaryForcedChunks.insets = new Insets(0, 0, 5, 5);
|
||||
gbc_lblSummaryForcedChunks.gridx = 11;
|
||||
gbc_lblSummaryForcedChunks.gridy = 5;
|
||||
panelSummary.add(lblSummaryForcedChunks, gbc_lblSummaryForcedChunks);
|
||||
|
||||
lblSummary_17 = new JLabel("Loaded chunks");
|
||||
GridBagConstraints gbc_lblSummary_17 = new GridBagConstraints();
|
||||
gbc_lblSummary_17.insets = new Insets(0, 0, 5, 5);
|
||||
gbc_lblSummary_17.gridx = 9;
|
||||
gbc_lblSummary_17.gridy = 6;
|
||||
panelSummary.add(lblSummary_17, gbc_lblSummary_17);
|
||||
|
||||
lblSummaryLoadedChunk = new JLabel("0");
|
||||
GridBagConstraints gbc_lblSummaryLoadedChunk = new GridBagConstraints();
|
||||
gbc_lblSummaryLoadedChunk.anchor = GridBagConstraints.EAST;
|
||||
gbc_lblSummaryLoadedChunk.gridwidth = 2;
|
||||
gbc_lblSummaryLoadedChunk.insets = new Insets(0, 0, 5, 5);
|
||||
gbc_lblSummaryLoadedChunk.gridx = 11;
|
||||
gbc_lblSummaryLoadedChunk.gridy = 6;
|
||||
panelSummary.add(lblSummaryLoadedChunk, gbc_lblSummaryLoadedChunk);
|
||||
|
||||
lblSummary_6 = new JLabel("Total");
|
||||
GridBagConstraints gbc_lblSummary_6 = new GridBagConstraints();
|
||||
gbc_lblSummary_6.anchor = GridBagConstraints.WEST;
|
||||
@@ -1040,4 +1076,10 @@ public class SwingUI extends JFrame implements ActionListener, ItemListener, Wi
|
||||
public JButton getBtnTimingTERemoveHighlight() {
|
||||
return btnTimingTERemoveHighlight;
|
||||
}
|
||||
public JLabel getLblSummaryForcedChunks() {
|
||||
return lblSummaryForcedChunks;
|
||||
}
|
||||
public JLabel getLblSummaryLoadedChunks() {
|
||||
return lblSummaryLoadedChunk;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user