Module lists now spawn separate and pre-locked, velocity values renamed, finishing up for 3.1

This commit is contained in:
noil 2020-11-26 23:15:58 -05:00
parent 465a1b1933
commit 8b57b5559d
5 changed files with 40 additions and 21 deletions

View File

@ -72,7 +72,7 @@ public class DraggableHudComponent extends HudComponent {
if (isHudEditor) { if (isHudEditor) {
RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x75101010); RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x75101010);
if (this.isLocked()) { if (this.isLocked()) {
RenderUtil.drawBorderedRect(this.getX() - 1, this.getY() - 1, this.getX() + this.getW() + 1, this.getY() + this.getH() + 1, 0.5f, 0x00000000, 0x75FF0000); RenderUtil.drawBorderedRect(this.getX() - 1, this.getY() - 1, this.getX() + this.getW() + 1, this.getY() + this.getH() + 1, 0.5f, 0x00000000, 0x75FFFFFF);
} }
} }

View File

@ -33,13 +33,13 @@ public final class HubComponent extends ResizableHudComponent {
private final Texture texture; private final Texture texture;
public HubComponent() { public HubComponent() {
super("Hub", 100, 100); super("Hub", 100, 150);
this.texture = new Texture("module-hub.png"); this.texture = new Texture("module-hub.png");
this.setVisible(true); this.setVisible(true);
this.setSnappable(false); this.setSnappable(false);
this.setW(100); this.setW(100);
this.setH(100); this.setH(150);
this.setX((Minecraft.getMinecraft().displayWidth / 2.0f) - (this.getW() / 2)); this.setX((Minecraft.getMinecraft().displayWidth / 2.0f) - (this.getW() / 2));
this.setY((Minecraft.getMinecraft().displayHeight / 2.0f) - (this.getH() / 2)); this.setY((Minecraft.getMinecraft().displayHeight / 2.0f) - (this.getH() / 2));
} }

View File

@ -57,10 +57,11 @@ public final class ModuleListComponent extends ResizableHudComponent {
this.texture = new Texture("module-" + type.name().toLowerCase() + ".png"); this.texture = new Texture("module-" + type.name().toLowerCase() + ".png");
this.setSnappable(false); this.setSnappable(false);
this.setLocked(true);
this.setW(100); this.setW(100);
this.setH(100); this.setH(100);
this.setX((Minecraft.getMinecraft().displayWidth / 2.0f) - (this.getW() / 2)); this.setX(20);
this.setY((Minecraft.getMinecraft().displayHeight / 2.0f) - (this.getH() / 2)); this.setY(20);
} }
@Override @Override
@ -439,7 +440,6 @@ public final class ModuleListComponent extends ResizableHudComponent {
components.add(valueButton); components.add(valueButton);
} else if (value.getValue() instanceof Number) { } else if (value.getValue() instanceof Number) {
TextComponent valueNumberText = new TextComponent(value.getName(), value.getValue().toString(), true); TextComponent valueNumberText = new TextComponent(value.getName(), value.getValue().toString(), true);
//valueNumberText.displayValue = value.getValue().toString();
valueNumberText.setTooltipText(value.getDesc() + " " + ChatFormatting.GRAY + "(" + value.getMin() + " - " + value.getMax() + ")"); valueNumberText.setTooltipText(value.getDesc() + " " + ChatFormatting.GRAY + "(" + value.getMin() + " - " + value.getMax() + ")");
valueNumberText.returnListener = new ComponentListener() { valueNumberText.returnListener = new ComponentListener() {
@Override @Override
@ -463,6 +463,11 @@ public final class ModuleListComponent extends ResizableHudComponent {
} }
}; };
components.add(valueNumberText); components.add(valueNumberText);
//TODO: after v3.1
//SliderComponent sliderComponent = new SliderComponent(value.getName(), value);
//sliderComponent.setTooltipText(value.getDesc() + " " + ChatFormatting.GRAY + "(" + value.getMin() + " - " + value.getMax() + ")");
//components.add(sliderComponent);
} else if (value.getValue() instanceof Enum) { } else if (value.getValue() instanceof Enum) {
final Enum val = (Enum) value.getValue(); final Enum val = (Enum) value.getValue();
final StringBuilder options = new StringBuilder(); final StringBuilder options = new StringBuilder();

View File

@ -48,12 +48,26 @@ public final class HudManager {
this.anchorPoints.add(TOP_CENTER); this.anchorPoints.add(TOP_CENTER);
this.anchorPoints.add(BOTTOM_CENTER); this.anchorPoints.add(BOTTOM_CENTER);
int moduleListXOffset = 0;
int moduleListYOffset = 0;
for (Module.ModuleType type : Module.ModuleType.values()) { for (Module.ModuleType type : Module.ModuleType.values()) {
if (type.equals(Module.ModuleType.HIDDEN) || type.equals(Module.ModuleType.UI)) if (type.equals(Module.ModuleType.HIDDEN) || type.equals(Module.ModuleType.UI))
continue; continue;
final ModuleListComponent moduleList = new ModuleListComponent(type); final ModuleListComponent moduleList = new ModuleListComponent(type);
if ((moduleList.getX() + moduleListXOffset) > res.getScaledWidth()) {
moduleListXOffset = 0;
moduleListYOffset += moduleList.getH() + 4 /* gap above and below each column */;
}
moduleList.setX(moduleList.getX() + moduleListXOffset);
if (moduleListYOffset != 0) {
moduleList.setY(moduleList.getY() + moduleListYOffset);
}
this.componentList.add(moduleList); this.componentList.add(moduleList);
moduleListXOffset += moduleList.getW() + 4 /* gap between each list */;
} }
this.componentList.add(new WatermarkComponent()); this.componentList.add(new WatermarkComponent());

View File

@ -19,8 +19,8 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
*/ */
public final class VelocityModule extends Module { public final class VelocityModule extends Module {
public final Value<Integer> horizontal_vel = new Value<>("Horizontal_Velocity", new String[]{"HorizontalVelocity", "HVel", "HV", "HorizontalVel", "Horizontal", "H"}, "The horizontal velocity you will take.", 0, 0, 100, 1); public final Value<Integer> horizontalVelocity = new Value<>("Horizontal", new String[]{"HorizontalVelocity", "Horizontal_Velocity", "HVel", "HV", "HorizontalVel", "Horizontal", "H"}, "The horizontal velocity you will take.", 0, 0, 100, 1);
public final Value<Integer> vertical_vel = new Value<>("Vertical_Velocity", new String[]{"VerticalVelocity", "VVel", "VV", "VerticalVel", "Vertical", "Vert", "V"}, "The vertical velocity you will take.", 0, 0, 100, 1); public final Value<Integer> verticalVelocity = new Value<>("Vertical", new String[]{"VerticalVelocity", "Vertical_Velocity", "VVel", "VV", "VerticalVel", "Vertical", "Vert", "V"}, "The vertical velocity you will take.", 0, 0, 100, 1);
public final Value<Boolean> explosions = new Value<>("Explosions", new String[]{"Explosions", "Explosion", "EXP", "EX", "Expl"}, "Apply velocity modifier on explosion velocity.", true); public final Value<Boolean> explosions = new Value<>("Explosions", new String[]{"Explosions", "Explosion", "EXP", "EX", "Expl"}, "Apply velocity modifier on explosion velocity.", true);
public final Value<Boolean> bobbers = new Value<>("Bobbers", new String[]{"Bobb", "Bob", "FishHook", "FishHooks"}, "Apply velocity modifier on fishing bobber velocity.", true); public final Value<Boolean> bobbers = new Value<>("Bobbers", new String[]{"Bobb", "Bob", "FishHook", "FishHooks"}, "Apply velocity modifier on fishing bobber velocity.", true);
@ -32,7 +32,7 @@ public final class VelocityModule extends Module {
@Override @Override
public String getMetaData() { public String getMetaData() {
return String.format(ChatFormatting.WHITE + "H:%s%%" + ChatFormatting.GRAY + "|" + ChatFormatting.WHITE + "V:%s%%", this.horizontal_vel.getValue(), this.vertical_vel.getValue()); return String.format(ChatFormatting.WHITE + "H:%s%%" + ChatFormatting.GRAY + "|" + ChatFormatting.WHITE + "V:%s%%", this.horizontalVelocity.getValue(), this.verticalVelocity.getValue());
} }
@Listener @Listener
@ -53,36 +53,36 @@ public final class VelocityModule extends Module {
if (event.getPacket() instanceof SPacketEntityVelocity) { if (event.getPacket() instanceof SPacketEntityVelocity) {
final SPacketEntityVelocity packet = (SPacketEntityVelocity) event.getPacket(); final SPacketEntityVelocity packet = (SPacketEntityVelocity) event.getPacket();
if (packet.getEntityID() == mc.player.getEntityId()) { if (packet.getEntityID() == mc.player.getEntityId()) {
if (this.horizontal_vel.getValue() == 0 && this.vertical_vel.getValue() == 0) { if (this.horizontalVelocity.getValue() == 0 && this.verticalVelocity.getValue() == 0) {
event.setCanceled(true); event.setCanceled(true);
return; return;
} }
if (this.horizontal_vel.getValue() != 100) { if (this.horizontalVelocity.getValue() != 100) {
packet.motionX = packet.motionX / 100 * this.horizontal_vel.getValue(); packet.motionX = packet.motionX / 100 * this.horizontalVelocity.getValue();
packet.motionZ = packet.motionZ / 100 * this.horizontal_vel.getValue(); packet.motionZ = packet.motionZ / 100 * this.horizontalVelocity.getValue();
} }
if (this.vertical_vel.getValue() != 100) { if (this.verticalVelocity.getValue() != 100) {
packet.motionY = packet.motionY / 100 * this.vertical_vel.getValue(); packet.motionY = packet.motionY / 100 * this.verticalVelocity.getValue();
} }
} }
} }
if (event.getPacket() instanceof SPacketExplosion && this.explosions.getValue()) { if (event.getPacket() instanceof SPacketExplosion && this.explosions.getValue()) {
final SPacketExplosion packet = (SPacketExplosion) event.getPacket(); final SPacketExplosion packet = (SPacketExplosion) event.getPacket();
if (this.horizontal_vel.getValue() == 0 && this.vertical_vel.getValue() == 0) { if (this.horizontalVelocity.getValue() == 0 && this.verticalVelocity.getValue() == 0) {
event.setCanceled(true); event.setCanceled(true);
return; return;
} }
if (this.horizontal_vel.getValue() != 100) { if (this.horizontalVelocity.getValue() != 100) {
packet.motionX = packet.motionX / 100 * this.horizontal_vel.getValue(); packet.motionX = packet.motionX / 100 * this.horizontalVelocity.getValue();
packet.motionZ = packet.motionZ / 100 * this.horizontal_vel.getValue(); packet.motionZ = packet.motionZ / 100 * this.horizontalVelocity.getValue();
} }
if (this.vertical_vel.getValue() != 100) { if (this.verticalVelocity.getValue() != 100) {
packet.motionY = packet.motionY / 100 * this.vertical_vel.getValue(); packet.motionY = packet.motionY / 100 * this.verticalVelocity.getValue();
} }
} }
} }