public static void Postfix(Farmer __instance, xTile.Dimensions.Rectangle viewport, GameLocation currentLocation, ref Vector2 __state) { if (!IsModEnabled()) { return; } if (backwardsFarmer) { Vector2 dest = __state - (__instance.Position - __state); int width = __instance.GetSpriteWidthForPositioning() * 4 * 3 / 4; Rectangle destRectFloor = new Rectangle((int)Math.Floor(dest.X) - 8, (int)Math.Floor(dest.Y) - 16, width, 32); Rectangle destRectCeil = new Rectangle((int)Math.Ceiling(dest.X) + 8, (int)Math.Ceiling(dest.Y) + 16, width, 32); Rectangle destRect = Rectangle.Union(destRectCeil, destRectFloor); if (!currentLocation.isCollidingPosition(destRect, viewport, true, -1, false, __instance)) { __instance.Position = dest; } } }