Renamed the commonly used Position POJO into AdvancedPosition, as it also hold pitch, yaw and roll
Made GuiDropdown only accept instances of GuiEntryListEntry to avoid unneccessary toString() methods returning the name Added GuiEntryListValueEntry which holds a Value and a Name to be displayed Continued work on GuiObjectManager
This commit is contained in:
30
src/main/java/eu/crushedpixel/replaymod/holders/Position.java
Executable file → Normal file
30
src/main/java/eu/crushedpixel/replaymod/holders/Position.java
Executable file → Normal file
@@ -5,8 +5,6 @@ import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@@ -15,36 +13,10 @@ public class Position implements KeyframeValue {
|
||||
|
||||
@Interpolate
|
||||
public double x, y, z;
|
||||
@Interpolate
|
||||
public double pitch, yaw, roll;
|
||||
|
||||
private Integer spectatedEntityID;
|
||||
|
||||
public Position(int entityID, boolean spectate) {
|
||||
this(Minecraft.getMinecraft().theWorld.getEntityByID(entityID), spectate);
|
||||
}
|
||||
|
||||
public Position(Entity e, boolean spectate) {
|
||||
this(e.posX, e.posY, e.posZ, e.rotationPitch, e.rotationYaw, spectate ? e.getEntityId() : null);
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float pitch, float yaw, Integer spectatedEntityID) {
|
||||
this(x, y, z, pitch, yaw, 0, spectatedEntityID);
|
||||
}
|
||||
|
||||
public Position(double x, double y, double z, float pitch, float yaw) {
|
||||
this(x, y, z, pitch, yaw, 0, null);
|
||||
}
|
||||
|
||||
public double distanceSquared(double x, double y, double z) {
|
||||
double dx = this.x - x;
|
||||
double dy = this.y - y;
|
||||
double dz = this.z - z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position newInstance() {
|
||||
return new Position();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user