Added a centered bottom anchor point, tray is now enabled by default and placed there for new users.
This commit is contained in:
parent
17a573fb6d
commit
9e66053119
|
@ -125,6 +125,9 @@ public class DraggableHudComponent extends HudComponent {
|
|||
case TOP_CENTER:
|
||||
this.setX(this.anchorPoint.getX() - (this.getW() / 2));
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
this.setX(this.anchorPoint.getX() - (this.getW() / 2));
|
||||
break;
|
||||
}
|
||||
if (this.glueSide != null) {
|
||||
switch (this.glueSide) {
|
||||
|
@ -158,6 +161,10 @@ public class DraggableHudComponent extends HudComponent {
|
|||
this.setX(this.anchorPoint.getX() - (this.getW() / 2));
|
||||
this.setY(this.anchorPoint.getY());
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
this.setX(this.anchorPoint.getX() - (this.getW() / 2));
|
||||
this.setY(this.anchorPoint.getY() - this.getH());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class AnchorPoint {
|
|||
this.point = point;
|
||||
}
|
||||
|
||||
public static enum Point {
|
||||
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_CENTER
|
||||
public enum Point {
|
||||
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, TOP_CENTER, BOTTOM_CENTER
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ public final class EnabledModsComponent extends DraggableHudComponent {
|
|||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
xOffset = (this.getW() - mc.fontRenderer.getStringWidth(name)) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
|
@ -100,6 +101,7 @@ public final class EnabledModsComponent extends DraggableHudComponent {
|
|||
mc.fontRenderer.drawStringWithShadow(name, this.getX() + xOffset, this.getY() + yOffset, mod.getColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
case BOTTOM_LEFT:
|
||||
case BOTTOM_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(name, this.getX() + xOffset, this.getY() + (this.getH() - mc.fontRenderer.FONT_HEIGHT) + yOffset, mod.getColor());
|
||||
|
|
|
@ -54,6 +54,7 @@ public final class EnemyPotionsComponent extends DraggableHudComponent {
|
|||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
xOffset = (this.getW() - width) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
|
@ -75,6 +76,7 @@ public final class EnemyPotionsComponent extends DraggableHudComponent {
|
|||
mc.fontRenderer.drawStringWithShadow(displayLine, this.getX() + xOffset, this.getY() + yOffset, effect.getPotion().getLiquidColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
case BOTTOM_LEFT:
|
||||
case BOTTOM_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(displayLine, this.getX() + xOffset, this.getY() + (this.getH() - mc.fontRenderer.FONT_HEIGHT) + yOffset, effect.getPotion().getLiquidColor());
|
||||
|
|
|
@ -19,6 +19,11 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public NotificationsComponent() {
|
||||
super("Notifications");
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
@ -33,6 +38,7 @@ public final class NotificationsComponent extends DraggableHudComponent {
|
|||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
offsetX = (this.getW() - Minecraft.getMinecraft().fontRenderer.getStringWidth(notification.getText())) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
|
|
|
@ -57,6 +57,7 @@ public final class PotionEffectsComponent extends DraggableHudComponent {
|
|||
if (this.getAnchorPoint() != null) {
|
||||
switch (this.getAnchorPoint().getPoint()) {
|
||||
case TOP_CENTER:
|
||||
case BOTTOM_CENTER:
|
||||
xOffset = (this.getW() - mc.fontRenderer.getStringWidth(effect)) / 2;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
|
@ -78,6 +79,7 @@ public final class PotionEffectsComponent extends DraggableHudComponent {
|
|||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
yOffset += (mc.fontRenderer.FONT_HEIGHT + 1);
|
||||
break;
|
||||
case BOTTOM_CENTER:
|
||||
case BOTTOM_LEFT:
|
||||
case BOTTOM_RIGHT:
|
||||
mc.fontRenderer.drawStringWithShadow(effect, this.getX() + xOffset, this.getY() + (this.getH() - mc.fontRenderer.FONT_HEIGHT) + yOffset, potionEffect.getPotion().getLiquidColor());
|
||||
|
|
|
@ -22,6 +22,7 @@ public class TrayComponent extends DraggableHudComponent {
|
|||
|
||||
public TrayComponent() {
|
||||
super("Tray");
|
||||
|
||||
buttons.add(new TrayButtonComponent("hub"));
|
||||
buttons.add(new TrayButtonComponent("combat"));
|
||||
buttons.add(new TrayButtonComponent("movement"));
|
||||
|
@ -29,6 +30,8 @@ public class TrayComponent extends DraggableHudComponent {
|
|||
buttons.add(new TrayButtonComponent("player"));
|
||||
buttons.add(new TrayButtonComponent("world"));
|
||||
buttons.add(new TrayButtonComponent("misc"));
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@ import me.rigamortis.seppuku.impl.gui.hud.component.module.ModuleListComponent;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import scala.tools.nsc.transform.patmat.Logic;
|
||||
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -39,12 +40,14 @@ public final class HudManager {
|
|||
final AnchorPoint TOP_RIGHT = new AnchorPoint(res.getScaledWidth() - 2, 2, AnchorPoint.Point.TOP_RIGHT);
|
||||
final AnchorPoint BOTTOM_LEFT = new AnchorPoint(2, res.getScaledHeight() - 2, AnchorPoint.Point.BOTTOM_LEFT);
|
||||
final AnchorPoint BOTTOM_RIGHT = new AnchorPoint(res.getScaledWidth() - 2, res.getScaledHeight() - 2, AnchorPoint.Point.BOTTOM_RIGHT);
|
||||
final AnchorPoint TOP_CENTER = new AnchorPoint(res.getScaledWidth() / 2, 2, AnchorPoint.Point.TOP_CENTER);
|
||||
final AnchorPoint TOP_CENTER = new AnchorPoint(res.getScaledWidth() / 2.0f, 2, AnchorPoint.Point.TOP_CENTER);
|
||||
final AnchorPoint BOTTOM_CENTER = new AnchorPoint(res.getScaledWidth() / 2.0f, res.getScaledHeight() - 2, AnchorPoint.Point.BOTTOM_CENTER);
|
||||
this.anchorPoints.add(TOP_LEFT);
|
||||
this.anchorPoints.add(TOP_RIGHT);
|
||||
this.anchorPoints.add(BOTTOM_LEFT);
|
||||
this.anchorPoints.add(BOTTOM_RIGHT);
|
||||
this.anchorPoints.add(TOP_CENTER);
|
||||
this.anchorPoints.add(BOTTOM_CENTER);
|
||||
|
||||
for (Module.ModuleType type : Module.ModuleType.values()) {
|
||||
if (type.equals(Module.ModuleType.HIDDEN) || type.equals(Module.ModuleType.UI))
|
||||
|
@ -79,8 +82,14 @@ public final class HudManager {
|
|||
this.componentList.add(new PlayerCountComponent());
|
||||
this.componentList.add(new OverViewComponent());
|
||||
this.componentList.add(new RearViewComponent());
|
||||
this.componentList.add(new TrayComponent());
|
||||
this.componentList.add(new NotificationsComponent(TOP_CENTER));
|
||||
|
||||
TrayComponent trayComponent = new TrayComponent();
|
||||
trayComponent.setAnchorPoint(BOTTOM_CENTER);
|
||||
this.componentList.add(trayComponent);
|
||||
|
||||
NotificationsComponent notificationsComponent = new NotificationsComponent();
|
||||
notificationsComponent.setAnchorPoint(TOP_CENTER);
|
||||
this.componentList.add(notificationsComponent);
|
||||
|
||||
this.loadExternalHudComponents();
|
||||
|
||||
|
@ -132,9 +141,13 @@ public final class HudManager {
|
|||
point.setY(event.getScaledResolution().getScaledHeight() - chatHeight - 2);
|
||||
}
|
||||
if (point.getPoint() == AnchorPoint.Point.TOP_CENTER) {
|
||||
point.setX(event.getScaledResolution().getScaledWidth() / 2);
|
||||
point.setX(event.getScaledResolution().getScaledWidth() / 2.0f);
|
||||
point.setY(2);
|
||||
}
|
||||
if (point.getPoint() == AnchorPoint.Point.BOTTOM_CENTER) {
|
||||
point.setX(event.getScaledResolution().getScaledWidth() / 2.0f);
|
||||
point.setY(event.getScaledResolution().getScaledHeight() - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,10 +177,7 @@ public final class HudManager {
|
|||
}
|
||||
|
||||
public void moveToTop(HudComponent component) {
|
||||
final Iterator it = this.componentList.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
final HudComponent comp = (HudComponent) it.next();
|
||||
for (HudComponent comp : this.componentList) {
|
||||
if (comp != null && comp == component) {
|
||||
this.componentList.remove(comp);
|
||||
this.componentList.add(comp);
|
||||
|
|
Loading…
Reference in New Issue