RandomPatches (Forge)

RandomPatches (Forge)

56M Downloads

[FEATURE] MC-2025 fix

V10lator opened this issue ยท 2 comments

commented

I think it would be great if you coild integrate the fix for MC-2025 untill we wait for MC 1.13 which should have it fixed upstream.

The fix is to add code to the Entity.class:

In writeToNBT, somewhere within the try block, do the following:

AxisAlignedBB aabb = this.getEntityBoundingBox();
compound.setTag("AABB", this.newDoubleNBTList(
    aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ));

There are two places in readFromNBT that call setPosition, which resets the AABB based on entity width. It is very important that this new code be inserted after those calls. This needs to be the very last thing inside of the try block.

So right after this:

if (this.shouldSetPosAfterLoading())
{                
    this.setPosition(this.posX, this.posY, this.posZ);
}

Insert this code:

if (compound.hasKey("AABB")) {
    NBTTagList aabb = compound.getTagList("AABB", 6);
    this.setEntityBoundingBox(new AxisAlignedBB(aabb.getDoubleAt(0), aabb.getDoubleAt(1),
                                                aabb.getDoubleAt(2), aabb.getDoubleAt(3),
                                                aabb.getDoubleAt(4), aabb.getDoubleAt(5)));
}       

(fix from https://www.reddit.com/r/Mojira/comments/8pgd4q/final_and_proper_fix_to_mc2025_simple_reliable/ )

commented

Sure, I'll add this in.

commented

This is in 1.9.0.0, although it hasn't been extensively tested.