misc: fix bad named fields

This commit is contained in:
Shirona1337
2026-05-23 03:58:30 +08:00
parent 5c3607c805
commit cd0bc4f27b
9 changed files with 40 additions and 252 deletions
@@ -1,50 +1,12 @@
package shit.zen.event.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.Generated;
import lombok.*;
import shit.zen.event.EventMarker;
@Data
@AllArgsConstructor
public class FallFlyingEvent
implements EventMarker {
@Getter @Setter
private float speed;
private static final String TO_STRING_PREFIX = "FallFlyingEvent(pitch=";
@Generated
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof FallFlyingEvent otherEvent)) {
return false;
}
if (!otherEvent.canEqual(this)) {
return false;
}
return Float.compare(this.getSpeed(), otherEvent.getSpeed()) == 0;
}
@Generated
protected boolean canEqual(Object other) {
return other instanceof FallFlyingEvent;
}
@Generated
public int hashCode() {
int prime = 59;
int result = 1;
result = result * 59 + Float.floatToIntBits(this.getSpeed());
return result;
}
@Generated
public String toString() {
return TO_STRING_PREFIX + this.getSpeed() + ")";
}
@Generated
public FallFlyingEvent(float speed) {
this.speed = speed;
}
private float pitch;
}
@@ -1,56 +1,14 @@
package shit.zen.event.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.Generated;
import lombok.*;
import shit.zen.event.EventMarker;
@Data
@AllArgsConstructor
public class HeadTurnEvent
implements EventMarker {
@Getter @Setter
private float yaw;
@Getter @Setter
private float pitch;
@Generated
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof HeadTurnEvent otherEvent)) {
return false;
}
if (!otherEvent.canEqual(this)) {
return false;
}
if (Float.compare(this.getYaw(), otherEvent.getYaw()) != 0) {
return false;
}
return Float.compare(this.getPitch(), otherEvent.getPitch()) == 0;
}
@Generated
protected boolean canEqual(Object other) {
return other instanceof HeadTurnEvent;
}
@Generated
public int hashCode() {
int prime = 59;
int result = 1;
result = result * 59 + Float.floatToIntBits(this.getYaw());
result = result * 59 + Float.floatToIntBits(this.getPitch());
return result;
}
@Generated
public String toString() {
return "HeadTurnEvent(yaw=" + this.getYaw() + ", lastYaw=" + this.getPitch() + ")";
}
@Generated
public HeadTurnEvent(float yaw, float pitch) {
this.yaw = yaw;
this.pitch = pitch;
}
private float lastYaw;
}
@@ -1,50 +1,12 @@
package shit.zen.event.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.Generated;
import lombok.AllArgsConstructor;
import lombok.Data;
import shit.zen.event.EventMarker;
@Data
@AllArgsConstructor
public class JumpMarkerEvent
implements EventMarker {
@Getter @Setter
private float jumpHeight;
private static final String TO_STRING_PREFIX = "JumpEvent(yaw=";
@Generated
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof JumpMarkerEvent otherEvent)) {
return false;
}
if (!otherEvent.canEqual(this)) {
return false;
}
return Float.compare(this.getJumpHeight(), otherEvent.getJumpHeight()) == 0;
}
@Generated
protected boolean canEqual(Object other) {
return other instanceof JumpMarkerEvent;
}
@Generated
public int hashCode() {
int prime = 59;
int result = 1;
result = result * 59 + Float.floatToIntBits(this.getJumpHeight());
return result;
}
@Generated
public String toString() {
return TO_STRING_PREFIX + this.getJumpHeight() + ")";
}
@Generated
public JumpMarkerEvent(float jumpHeight) {
this.jumpHeight = jumpHeight;
}
private float yaw;
}
@@ -1,72 +1,19 @@
package shit.zen.event.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.Generated;
import lombok.*;
import net.minecraft.world.entity.Entity;
import shit.zen.event.EventMarker;
import java.util.Objects;
@Data
@AllArgsConstructor
public class RayTraceEvent
implements EventMarker {
@Getter @Setter
public Entity entity;
@Getter @Setter
public float range;
public float yaw;
@Getter @Setter
public float blockRange;
@Generated
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof RayTraceEvent otherEvent)) {
return false;
}
if (!otherEvent.canEqual(this)) {
return false;
}
if (Float.compare(this.getRange(), otherEvent.getRange()) != 0) {
return false;
}
if (Float.compare(this.getBlockRange(), otherEvent.getBlockRange()) != 0) {
return false;
}
Entity thisEntity = this.getEntity();
Entity otherEntity = otherEvent.getEntity();
return !(!Objects.equals(thisEntity, otherEntity));
}
@Generated
protected boolean canEqual(Object other) {
return other instanceof RayTraceEvent;
}
@Generated
public int hashCode() {
int prime = 59;
int result = 1;
result = result * 59 + Float.floatToIntBits(this.getRange());
result = result * 59 + Float.floatToIntBits(this.getBlockRange());
Entity entity = this.getEntity();
result = result * 59 + (entity == null ? 43 : entity.hashCode());
return result;
}
@Generated
public String toString() {
float blockRange = this.getBlockRange();
float range = this.getRange();
String entityStr = String.valueOf(this.getEntity());
return "RayTraceEvent(entity=" + entityStr + ", yaw=" + range + ", pitch=" + blockRange + ")";
}
@Generated
public RayTraceEvent(Entity entity, float range, float blockRange) {
this.entity = entity;
this.range = range;
this.blockRange = blockRange;
}
public float pitch;
}
@@ -1,56 +1,14 @@
package shit.zen.event.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.Generated;
import lombok.*;
import shit.zen.event.EventMarker;
@AllArgsConstructor
@Data
public class UseItemRayTraceEvent
implements EventMarker {
@Getter @Setter
private float range;
private float yaw;
@Getter @Setter
private float blockRange;
@Generated
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof UseItemRayTraceEvent otherEvent)) {
return false;
}
if (!otherEvent.canEqual(this)) {
return false;
}
if (Float.compare(this.getRange(), otherEvent.getRange()) != 0) {
return false;
}
return Float.compare(this.getBlockRange(), otherEvent.getBlockRange()) == 0;
}
@Generated
protected boolean canEqual(Object other) {
return other instanceof UseItemRayTraceEvent;
}
@Generated
public int hashCode() {
int prime = 59;
int result = 1;
result = result * 59 + Float.floatToIntBits(this.getRange());
result = result * 59 + Float.floatToIntBits(this.getBlockRange());
return result;
}
@Generated
public String toString() {
return "UseItemRayTraceEvent(yaw=" + this.getRange() + ", pitch=" + this.getBlockRange() + ")";
}
@Generated
public UseItemRayTraceEvent(float range, float blockRange) {
this.range = range;
this.blockRange = blockRange;
}
private float pitch;
}
@@ -61,8 +61,8 @@ public class EntityPatch {
if (ZenClient.isReady()) {
ZenClient.getInstance().getEventBus().call(event);
}
yaw = event.getRange();
pitch = event.getBlockRange();
yaw = event.getYaw();
pitch = event.getPitch();
float pitchRad = pitch * (float) (Math.PI / 180.0);
float yawRad = -yaw * (float) (Math.PI / 180.0);
float cosYaw = Mth.cos(yawRad);
+2 -2
View File
@@ -25,7 +25,7 @@ public class ItemPatch {
if (ZenClient.isReady()) {
ZenClient.getInstance().getEventBus().call(event);
}
return event.getBlockRange();
return event.getPitch();
}
@WrapInvoke(
@@ -40,6 +40,6 @@ public class ItemPatch {
System.out.println(DEBUG_PREFIX + player.getYRot());
ZenClient.getInstance().getEventBus().call(event);
}
return event.getRange();
return event.getYaw();
}
}
@@ -79,8 +79,8 @@ public class LivingEntityPatch {
if (ZenClient.isReady()) {
ZenClient.getInstance().getEventBus().call(event);
}
ClientBase.partialTicks = event.getJumpHeight();
return event.getJumpHeight();
ClientBase.partialTicks = event.getYaw();
return event.getYaw();
}
@Inject(method = "travel", desc = "(Lnet/minecraft/world/phys/Vec3;)V", at = @At(At.Type.HEAD))
@@ -101,7 +101,7 @@ public class LivingEntityPatch {
if (ZenClient.isReady()) {
ZenClient.getInstance().getEventBus().call(event);
}
return event.getSpeed();
return event.getPitch();
}
@Inject(method = "hurt", desc = "(Lnet/minecraft/world/damagesource/DamageSource;F)Z", at = @At(At.Type.HEAD))
@@ -130,8 +130,9 @@ extends ClientBase {
if (sentRotation != null && prevSentRotation != null && mc.player != null) {
mc.player.setYHeadRot(sentRotation.getYaw());
mc.player.setYBodyRot(sentRotation.getYaw());
headTurnEvent.setYaw(sentRotation.getYaw());
headTurnEvent.setPitch(prevSentRotation.getYaw());
headTurnEvent.setLastYaw(prevSentRotation.getYaw());
}
}
@@ -170,24 +171,24 @@ extends ClientBase {
@EventTarget
public void onStrafe(StrafeEvent strafeEvent) {
if (isRotating && targetRotation != null) {
float f = targetRotation.getYaw();
MovementUtil.handleStrafe(strafeEvent, f);
float yaw = targetRotation.getYaw();
MovementUtil.handleStrafe(strafeEvent, yaw);
}
}
@EventTarget
public void onRayTrace(RayTraceEvent rayTraceEvent) {
if (targetRotation != null && rayTraceEvent.entity == mc.player && isRotating) {
rayTraceEvent.setRange(targetRotation.getYaw());
rayTraceEvent.setBlockRange(targetRotation.getPitch());
rayTraceEvent.setYaw(targetRotation.getYaw());
rayTraceEvent.setPitch(targetRotation.getPitch());
}
}
@EventTarget
public void onUseItemRayTrace(UseItemRayTraceEvent useItemRayTraceEvent) {
if (targetRotation != null && isRotating) {
useItemRayTraceEvent.setRange(targetRotation.getYaw());
useItemRayTraceEvent.setBlockRange(targetRotation.getPitch());
useItemRayTraceEvent.setYaw(targetRotation.getYaw());
useItemRayTraceEvent.setPitch(targetRotation.getPitch());
}
}
@@ -201,14 +202,14 @@ extends ClientBase {
@EventTarget
public void onJump(JumpMarkerEvent jumpMarkerEvent) {
if (isRotating && targetRotation != null) {
jumpMarkerEvent.setJumpHeight(targetRotation.getYaw());
jumpMarkerEvent.setYaw(targetRotation.getYaw());
}
}
@EventTarget
public void onFallFlying(FallFlyingEvent fallFlyingEvent) {
if (targetRotation != null) {
fallFlyingEvent.setSpeed(targetRotation.getPitch());
fallFlyingEvent.setPitch(targetRotation.getPitch());
}
}