use of cc.hyperium.internal.addons.AddonManifest in project Hyperium by HyperiumClient.
the class MixinNetHandlerPlayClient method handleCustomPayload.
@Inject(method = "handleCustomPayload", at = @At("RETURN"))
private void handleCustomPayload(S3FPacketCustomPayload packetIn, CallbackInfo ci) {
PacketBuffer packetBuffer = packetIn.getBufferData();
try {
int readableBytes = packetBuffer.readableBytes();
if (readableBytes > 0) {
byte[] payload = new byte[readableBytes - 1];
packetBuffer.readBytes(payload);
String message = new String(payload, Charsets.UTF_8);
if (LoginReplyHandler.SHOW_MESSAGES) {
GeneralChatHandler.instance().sendMessage("Packet message on channel " + packetIn.getChannelName() + " -> " + message);
}
if ("REGISTER".equalsIgnoreCase(packetIn.getChannelName())) {
if (message.contains("Hyperium")) {
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
buffer.writeString("Hyperium;" + Metadata.getVersion() + ";" + Metadata.getVersionID());
addToSendQueue(new C17PacketCustomPayload("REGISTER", buffer));
PacketBuffer addonbuffer = new PacketBuffer(Unpooled.buffer());
List<AddonManifest> addons = AddonBootstrap.INSTANCE.getAddonManifests();
addonbuffer.writeInt(addons.size());
for (AddonManifest addonmanifest : addons) {
String addonName = addonmanifest.getName();
String version = addonmanifest.getVersion();
if (addonName == null)
addonName = addonmanifest.getMainClass();
if (version == null)
version = "unknown";
addonbuffer.writeString(addonName);
addonbuffer.writeString(version);
}
addToSendQueue(new C17PacketCustomPayload("hyperium|Addons", addonbuffer));
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of cc.hyperium.internal.addons.AddonManifest in project Hyperium by HyperiumClient.
the class GuiAddonError method drawScreen.
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
int textY = 20;
drawCenteredString(fontRendererObj, ChatColor.RED.toString() + ChatColor.BOLD + "ERROR LOADING ADDONS", width / 2, textY, Color.WHITE.getRGB());
textY += 10;
drawCenteredString(fontRendererObj, ChatColor.RED.toString() + ChatColor.BOLD + "THE FOLLOWING ADDONS WON'T LOAD", width / 2, textY, Color.WHITE.getRGB());
textY += 10;
if (!AddonMinecraftBootstrap.getMissingDependenciesMap().isEmpty()) {
for (Map.Entry<AddonManifest, ArrayList<String>> entry : AddonMinecraftBootstrap.getMissingDependenciesMap().entrySet()) {
textY += 10;
drawCenteredString(fontRendererObj, ChatColor.RED + entry.getKey().getName() + " needs " + StringUtils.join(entry.getValue(), ", ") + " to load.", width / 2, textY, Color.WHITE.getRGB());
}
}
textY += 10;
if (!AddonMinecraftBootstrap.getDependenciesLoopMap().isEmpty()) {
for (Map.Entry<AddonManifest, ArrayList<AddonManifest>> entry : AddonMinecraftBootstrap.getDependenciesLoopMap().entrySet()) {
textY += 10;
drawCenteredString(fontRendererObj, ChatColor.RED + entry.getKey().getName() + " can't load together with " + StringUtils.join(entry.getValue().stream().map(AddonManifest::getName).collect(Collectors.toList()), ", " + "."), width / 2, textY, Color.WHITE.getRGB());
}
}
int hoverColor = new Color(0, 0, 0, 60).getRGB();
int color = new Color(0, 0, 0, 50).getRGB();
GuiBlock block1 = new GuiBlock(width / 2 - 100, width / 2 + 100, 200, 220);
Gui.drawRect(block1.getLeft(), block1.getTop(), block1.getRight(), block1.getBottom(), block1.isMouseOver(mouseX, mouseY) ? hoverColor : color);
drawCenteredString(fontRendererObj, "Continue", width / 2, 205, Color.WHITE.getRGB());
if (block1.isMouseOver(mouseX, mouseY) && Mouse.isButtonDown(0)) {
// Clear the maps so this screen goes away.
AddonMinecraftBootstrap.getDependenciesLoopMap().clear();
AddonMinecraftBootstrap.getMissingDependenciesMap().clear();
Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(new GuiHyperiumScreenMainMenu());
}
}
Aggregations