This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The addon is called "CPU Info" now New more accurate icon Added new GUI-Editor tab "CPU Info" You now can also show your core amount -> If your CPU is hyperthreading you have to activate "Is your CPU hyperthreading?" in the addon settings or else your cores will not be shown correctly.
- Loading branch information
Showing
13 changed files
with
146 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.rappytv.cpuinfo.main; | ||
|
||
import com.rappytv.cpuinfo.modules.Category; | ||
import com.rappytv.cpuinfo.modules.cpu.CoreModule; | ||
import com.rappytv.cpuinfo.modules.cpu.PercentUsageModule; | ||
import com.sun.management.OperatingSystemMXBean; | ||
import net.labymod.api.LabyModAddon; | ||
import net.labymod.ingamegui.ModuleCategoryRegistry; | ||
import net.labymod.settings.elements.BooleanElement; | ||
import net.labymod.settings.elements.ControlElement; | ||
import net.labymod.settings.elements.SettingsElement; | ||
import net.labymod.utils.Consumer; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
import java.lang.management.ManagementFactory; | ||
import java.util.List; | ||
|
||
public class Main extends LabyModAddon { | ||
|
||
public static final OperatingSystemMXBean os = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); | ||
public static boolean hyper = false; | ||
|
||
@Override | ||
public void onEnable() { | ||
ModuleCategoryRegistry.loadCategory(new Category()); | ||
getApi().registerModule(new PercentUsageModule()); | ||
getApi().registerModule(new CoreModule()); | ||
} | ||
|
||
@Override | ||
public void loadConfig() { | ||
hyper = getConfig().has("hyperthreading") ? getConfig().get("hyperthreading").getAsBoolean() : hyper; | ||
} | ||
|
||
@Override | ||
protected void fillSettings(List<SettingsElement> list) { | ||
BooleanElement hyperbool = new BooleanElement("Is your CPU hyperthreading?", new ControlElement.IconData(new ResourceLocation("cpuinfo/textures/settings/portal.png")), new Consumer<Boolean>() { | ||
@Override | ||
public void accept(Boolean accepted) { | ||
hyper = accepted; | ||
|
||
getConfig().addProperty("hyperthreading", hyper); | ||
saveConfig(); | ||
} | ||
}, hyper); | ||
|
||
list.add(hyperbool); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.rappytv.cpuinfo.modules; | ||
|
||
import net.labymod.ingamegui.ModuleCategory; | ||
import net.labymod.settings.elements.ControlElement; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
public class Category extends ModuleCategory { | ||
|
||
|
||
public Category() { | ||
super("CPU Info", true, new ControlElement.IconData(new ResourceLocation("cpuinfo/textures/icon.png"))); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/com/rappytv/cpuinfo/modules/cpu/CoreModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.rappytv.cpuinfo.modules.cpu; | ||
|
||
import com.rappytv.cpuinfo.main.Main; | ||
import com.rappytv.cpuinfo.modules.Category; | ||
import net.labymod.ingamegui.ModuleCategory; | ||
import net.labymod.ingamegui.moduletypes.SimpleModule; | ||
import net.labymod.settings.elements.ControlElement; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
public class CoreModule extends SimpleModule { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Cores"; | ||
} | ||
|
||
@Override | ||
public String getDisplayValue() { | ||
int cores = Runtime.getRuntime().availableProcessors(); | ||
if(Main.hyper) cores /= 2; | ||
return String.valueOf(cores); | ||
} | ||
|
||
@Override | ||
public String getDefaultValue() { | ||
return "4"; | ||
} | ||
|
||
@Override | ||
public ControlElement.IconData getIconData() { | ||
return new ControlElement.IconData(new ResourceLocation("cpuinfo/textures/modules/cores.png")); | ||
} | ||
|
||
@Override | ||
public void loadSettings() {} | ||
|
||
@Override | ||
public String getSettingName() { | ||
return "cpu_cores"; | ||
} | ||
|
||
@Override | ||
public String getControlName() { | ||
return "CPU Cores"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Displays the quantity of cores your CPU has."; | ||
} | ||
|
||
@Override | ||
public int getSortingId() { | ||
return 7; | ||
} | ||
|
||
@Override | ||
public ModuleCategory getCategory() { | ||
return new Category(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"uuid": "%uuid%", | ||
"name": "CPU Usage Display", | ||
"mainClass": "com.rappytv.cpudisplay.main.Main", | ||
"name": "CPU Info", | ||
"mainClass": "com.rappytv.cpuinfo.main.Main", | ||
"description": "This addon lets you add a new module called \"CPU Usage\" to your screen which displays your current CPU Usage in %", | ||
"version": 1, | ||
"version": 2, | ||
"author": "RappyTV#6969", | ||
"category": 1, | ||
"icon": "https://cdn.discordapp.com/attachments/962708390805655593/974966193544904754/icon.png" | ||
"icon": "https://cdn.discordapp.com/attachments/938944740920016916/991304102699081858/icon.png" | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.14 KB
src/main/resources/assets/minecraft/cpuinfo/textures/modules/cores.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.19 KB
src/main/resources/assets/minecraft/cpuinfo/textures/modules/percentage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.23 KB
src/main/resources/assets/minecraft/cpuinfo/textures/settings/portal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.