Notification Icons
This commit is contained in:
parent
29cc2f0aa9
commit
61ddfa54e6
|
@ -1,6 +1,7 @@
|
|||
package me.rigamortis.seppuku.api.notification;
|
||||
|
||||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.texture.Texture;
|
||||
import me.rigamortis.seppuku.api.util.MathUtil;
|
||||
import me.rigamortis.seppuku.api.util.Timer;
|
||||
import me.rigamortis.seppuku.impl.gui.hud.component.NotificationsComponent;
|
||||
|
@ -48,6 +49,10 @@ public final class Notification {
|
|||
this(title, text, Type.INFO, 3000);
|
||||
}
|
||||
|
||||
public Notification(String title, String text, Type type) {
|
||||
this(title, text, type, 3000);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
int incline = 8;
|
||||
this.transitionX = (float) MathUtil.parabolic(this.transitionX, this.x, incline);
|
||||
|
@ -130,16 +135,28 @@ public final class Notification {
|
|||
}
|
||||
|
||||
public enum Type {
|
||||
INFO(0xFF909090), SUCCESS(0xFF10FF10), WARNING(0xFFFFFF10), ERROR(0xFFFF1010), QUESTION(0xFF10FFFF), MISC(0xFFFFFFFF);
|
||||
INFO(0xFF909090, new Texture("info.png")),
|
||||
SUCCESS(0xFF10FF10, new Texture("success.png")),
|
||||
WARNING(0xFFFFFF10, new Texture("warning.png")),
|
||||
ERROR(0xFFFF1010, new Texture("error.png")),
|
||||
QUESTION(0xFF10FFFF, new Texture("question.png")),
|
||||
MISC(0xFFFFFFFF, new Texture("module-misc.png"));
|
||||
|
||||
private int color;
|
||||
private final int color;
|
||||
|
||||
Type(int color) {
|
||||
private final Texture texture;
|
||||
|
||||
Type(int color, Texture texture) {
|
||||
this.color = color;
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public Texture getTexture() {
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import me.rigamortis.seppuku.api.command.Command;
|
|||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.util.MathUtil;
|
||||
import me.rigamortis.seppuku.impl.module.hidden.CommandsModule;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -89,7 +90,7 @@ public final class CalcStrongholdCommand extends Command {
|
|||
}
|
||||
|
||||
Seppuku.INSTANCE.logcChat(component);
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", "Stronghold found " + ChatFormatting.GRAY + (int) dist + "m away");
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", "Stronghold found " + ChatFormatting.GRAY + (int) dist + "m away", Notification.Type.SUCCESS, 3000);
|
||||
this.firstStart = null;
|
||||
this.firstEnd = null;
|
||||
this.secondStart = null;
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
offsetX = (this.getW() - mc.fontRenderer.getStringWidth(notification.getText())) / 2;
|
||||
offsetX = (this.getW() - 16 - mc.fontRenderer.getStringWidth(notification.getText())) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
case BOTTOM_LEFT:
|
||||
|
@ -46,19 +46,24 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
break;
|
||||
case TOP_RIGHT:
|
||||
case BOTTOM_RIGHT:
|
||||
offsetX = this.getW() - mc.fontRenderer.getStringWidth(notification.getText());
|
||||
offsetX = this.getW() - 16 - mc.fontRenderer.getStringWidth(notification.getText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
notification.setX(this.getX() + offsetX);
|
||||
notification.setY(this.getY() + offsetY);
|
||||
notification.setWidth(mc.fontRenderer.getStringWidth(notification.getText()));
|
||||
notification.setWidth(16 + mc.fontRenderer.getStringWidth(notification.getText()));
|
||||
notification.setHeight(mc.fontRenderer.FONT_HEIGHT + 5);
|
||||
|
||||
//rect bg
|
||||
RenderUtil.drawRect(notification.getTransitionX() - 1, notification.getTransitionY(), notification.getTransitionX() + notification.getWidth() + 1, notification.getTransitionY() + notification.getHeight(), 0x75101010);
|
||||
RenderUtil.drawRect(notification.getTransitionX() - 1, notification.getTransitionY(), notification.getTransitionX() + notification.getWidth() + 1, (notification.getTransitionY() + 1), notification.getType().getColor());
|
||||
mc.fontRenderer.drawStringWithShadow(notification.getText(), notification.getTransitionX(), notification.getTransitionY() + 4.0F, 0xFFFFFFFF);
|
||||
//rect bar
|
||||
RenderUtil.drawRect(notification.getTransitionX() + 16 - 1, notification.getTransitionY(), notification.getTransitionX() + notification.getWidth() + 1, (notification.getTransitionY() + 1), notification.getType().getColor());
|
||||
//icon
|
||||
notification.getType().getTexture().render(notification.getTransitionX() - 1, notification.getTransitionY() - 1, 16, 16);
|
||||
//text
|
||||
mc.fontRenderer.drawStringWithShadow(notification.getText(), notification.getTransitionX() + 16, notification.getTransitionY() + 4.0F, 0xFFFFFFFF);
|
||||
|
||||
final float width = notification.getWidth();
|
||||
if (width >= maxWidth) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.rigamortis.seppuku.impl.module.combat;
|
|||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.player.EventUpdateWalkingPlayer;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.task.hand.HandSwapContext;
|
||||
import me.rigamortis.seppuku.api.task.rotation.RotationTask;
|
||||
import me.rigamortis.seppuku.api.util.InventoryUtil;
|
||||
|
@ -70,7 +71,7 @@ public final class BurrowModule extends Module {
|
|||
mc.player.jump(); // jump
|
||||
this.timer.reset(); // start timer
|
||||
} else {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", "You don't have any obsidian to use " + this.getDisplayName());
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", "You don't have any obsidian to use " + this.getDisplayName(), Notification.Type.WARNING, 3000);
|
||||
this.toggle(); // toggle off
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import me.rigamortis.seppuku.api.event.EventStageable;
|
|||
import me.rigamortis.seppuku.api.event.minecraft.EventRunTick;
|
||||
import me.rigamortis.seppuku.api.event.world.EventRemoveEntity;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -46,7 +47,7 @@ public class TotemNotifierModule extends Module {
|
|||
}
|
||||
} else if (offhandItem == Items.AIR) {
|
||||
if (entitiesWithTotems.contains(entity.getEntityId())) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", entity.getName() + " just popped a totem.");
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", entity.getName() + " just popped a totem.", Notification.Type.INFO, 2000);
|
||||
entitiesWithTotems.removeIf(i -> i.equals(entity.getEntityId()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import me.rigamortis.seppuku.api.event.player.EventSendChatMessage;
|
|||
import me.rigamortis.seppuku.api.event.render.EventRender2D;
|
||||
import me.rigamortis.seppuku.api.gui.hud.component.HudComponent;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.util.RenderUtil;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -164,7 +165,7 @@ public final class CommandsModule extends Module {
|
|||
continue;
|
||||
|
||||
if (cmd.getArguments() == null) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("Command Error", "Command has no arguments to tab complete.");
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("Command Error", "Command has no arguments to tab complete.", Notification.Type.ERROR, 3000);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.mojang.realmsclient.gui.ChatFormatting;
|
|||
import me.rigamortis.seppuku.Seppuku;
|
||||
import me.rigamortis.seppuku.api.event.world.EventAddEntity;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.util.Timer;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -61,7 +62,7 @@ public final class DonkeyAlertModule extends Module {
|
|||
alertText += " " + ChatFormatting.GRAY + distance;
|
||||
|
||||
if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", alertText);
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", alertText, Notification.Type.INFO, 3000);
|
||||
}
|
||||
|
||||
if (this.mode.getValue() == Mode.CHAT || this.mode.getValue() == Mode.BOTH) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import me.rigamortis.seppuku.Seppuku;
|
|||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.util.FileUtil;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -56,7 +57,7 @@ public final class NameAlertModule extends Module {
|
|||
|
||||
if ((text.contains(":") && text.toLowerCase().contains(ChatFormatting.LIGHT_PURPLE + "from")) ||
|
||||
(text.toLowerCase().contains(ChatFormatting.GRAY + "") && StringUtils.stripControlCodes(text).contains("whispers to you"))) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("Whisper", "Someone whispered to you.");
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("Whisper", "Someone whispered to you.", Notification.Type.MISC, 3000);
|
||||
if (this.saveToFile.getValue()) {
|
||||
this.saveMessageToFile("Whisper", StringUtils.stripControlCodes(text));
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ public final class NameAlertModule extends Module {
|
|||
if (chatUsernameMatcher.find()) {
|
||||
String username = chatUsernameMatcher.group(1).replaceAll(">", "");
|
||||
if (!username.equals(localUsername)) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("Public Chat", String.format("Someone mentioned you in chat. <%s>", username));
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("Public Chat", String.format("Someone mentioned you in chat. <%s>", username), Notification.Type.MISC, 3000);
|
||||
if (this.saveToFile.getValue()) {
|
||||
this.saveMessageToFile(username, text);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import me.rigamortis.seppuku.Seppuku;
|
|||
import me.rigamortis.seppuku.api.event.EventStageable;
|
||||
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.util.FileUtil;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import me.rigamortis.seppuku.impl.module.hidden.CommandsModule;
|
||||
|
@ -110,7 +111,7 @@ public final class StorageAlertModule extends Module {
|
|||
}
|
||||
}
|
||||
if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", message);
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", message, Notification.Type.INFO, 3000);
|
||||
}
|
||||
|
||||
if (this.saveToFile.getValue()) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import me.rigamortis.seppuku.api.event.world.EventAddEntity;
|
|||
import me.rigamortis.seppuku.api.event.world.EventRemoveEntity;
|
||||
import me.rigamortis.seppuku.api.friend.Friend;
|
||||
import me.rigamortis.seppuku.api.module.Module;
|
||||
import me.rigamortis.seppuku.api.notification.Notification;
|
||||
import me.rigamortis.seppuku.api.value.Value;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -39,7 +40,7 @@ public final class VisualRangeModule extends Module {
|
|||
final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has entered your visual range.";
|
||||
|
||||
if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", msg);
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", msg, Notification.Type.INFO, 3000);
|
||||
}
|
||||
|
||||
if (this.mode.getValue() == Mode.CHAT || this.mode.getValue() == Mode.BOTH) {
|
||||
|
@ -64,7 +65,7 @@ public final class VisualRangeModule extends Module {
|
|||
final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has left your visual range.";
|
||||
|
||||
if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) {
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", msg);
|
||||
Seppuku.INSTANCE.getNotificationManager().addNotification("", msg, Notification.Type.INFO, 3000);
|
||||
}
|
||||
|
||||
if (this.mode.getValue() == Mode.CHAT || this.mode.getValue() == Mode.BOTH) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 650 B |
Binary file not shown.
After Width: | Height: | Size: 685 B |
Binary file not shown.
After Width: | Height: | Size: 707 B |
Binary file not shown.
After Width: | Height: | Size: 657 B |
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Loading…
Reference in New Issue