Revert EntityEvent.Size changes to before #9018 was called. (#9679)

Kept newly added methods for binary compatibility but deprecated them all for removal.
The entire pose/eye/size system needs to be reevaluated and address some of Mojang's changes.
However this should fix any bugs that pulling that PR may of caused.
This commit is contained in:
LexManos authored and GitHub committed 2023-07-21 23:44:01 -07:00
1 parent 93a615e900
commit f157567d2a
5 files changed
+47 -120

No files matched your search

@@ -128,7 +128,6 @@ public class EntityEvent extends Event
}
/**
* This event is fired whenever {@link Entity#getDimensionsForge(Pose)} gets called.<br>
* CAREFUL: This is also fired in the Entity constructor. Therefore, the entity (subclass) might not be fully initialized. Check {@link Entity#isAddedToWorld()} or {@code !Entity.firstUpdate}.<br>
* If you change the player's size, you probably want to set the eye height accordingly as well<br>
* <br>
@@ -138,28 +137,23 @@ public class EntityEvent extends Event
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public static class Size extends EntityEvent
{
@Deprecated(forRemoval = true, since = "1.20.1") // Remove Entity Eye/Size hooks, as they need to be redesigned
public static class Size extends EntityEvent {
private final Pose pose;
private final EntityDimensions originalSize;
private EntityDimensions newSize;
private final float oldEyeHeight;
private float newEyeHeight;
public Size(Entity entity, Pose pose, EntityDimensions size)
{
public Size(Entity entity, Pose pose, EntityDimensions size) {
this(entity, pose, size, 1.0f); // Eye height doesn't matter this is just for binary compatibility.
}
@Deprecated(forRemoval = true, since = "1.20.1")
public Size(Entity entity, Pose pose, EntityDimensions size, float defaultEyeHeight)
{
public Size(Entity entity, Pose pose, EntityDimensions size, float defaultEyeHeight) {
this(entity, pose, size, size, defaultEyeHeight, defaultEyeHeight);
}
@Deprecated(forRemoval = true, since = "1.20.1")
public Size(Entity entity, Pose pose, EntityDimensions oldSize, EntityDimensions newSize, float oldEyeHeight, float newEyeHeight)
{
public Size(Entity entity, Pose pose, EntityDimensions oldSize, EntityDimensions newSize, float oldEyeHeight, float newEyeHeight) {
super(entity);
this.pose = pose;
this.originalSize = oldSize;
@@ -169,50 +163,33 @@ public class EntityEvent extends Event
}
public Pose getPose() { return pose; }
/** @deprecated Use {@link #getOriginalSize()} */
@Deprecated(forRemoval = true, since = "1.20.1")
public EntityDimensions getOldSize() { return this.getOriginalSize(); }
public EntityDimensions getOriginalSize() { return originalSize; }
public EntityDimensions getNewSize() { return newSize; }
public void setNewSize(EntityDimensions size) { this.newSize = size; }
/** @deprecated Use {@link EyeHeight} to hook into changes to eye height. Updating the eye height will not actually so anything anymore. */
@Deprecated(forRemoval = true)
public void setNewSize(EntityDimensions size, boolean updateEyeHeight)
{
public void setNewSize(EntityDimensions size, boolean updateEyeHeight) {
this.setNewSize(size);
if (updateEyeHeight)
{
if (updateEyeHeight) {
this.newEyeHeight = this.getEntity().getEyeHeightAccess(this.getPose(), this.newSize);
}
}
/** @deprecated Use {@link EyeHeight} to hook into changes to eye height. */
@Deprecated(forRemoval = true, since = "1.20.1")
public float getOldEyeHeight() { return oldEyeHeight; }
/** @deprecated Use {@link EyeHeight} to hook into changes to eye height. */
@Deprecated(forRemoval = true, since = "1.20.1")
public float getNewEyeHeight() { return newEyeHeight; }
public void setNewEyeHeight(float eyeHeight) { this.newEyeHeight = eyeHeight; }
}
/**
* This event is fired whenever {@link IForgeEntity#getEyeHeightForge(Pose, EntityDimensions)} gets called.<br>
* CAREFUL: This is also fired in the Entity constructor. Therefore, the entity (subclass) might not be fully initialized. Check {@link Entity#isAddedToWorld()} or {@code !Entity.firstUpdate}.<br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.<br>
*Remove Entity Eye/Size hooks, as they need to be redesigned, this is no longer fired in any forge/vanilla code.
**/
public static class EyeHeight extends EntityEvent
{
@Deprecated(forRemoval = true, since = "1.20.1")
public static class EyeHeight extends EntityEvent {
private final Pose pose;
private final EntityDimensions size;
private final float originalEyeHeight;
private float newEyeHeight;
public EyeHeight(Entity entity, Pose pose, EntityDimensions size, float eyeHeight)
{
public EyeHeight(Entity entity, Pose pose, EntityDimensions size, float eyeHeight) {
super(entity);
this.pose = pose;
this.size = size;