🆙 Fix small rotation bug in beds

This commit is contained in:
duckietm
2026-03-16 07:50:45 +01:00
parent cc82c413cd
commit 9c7067b5a2
@@ -11,16 +11,11 @@ import com.eu.habbo.habbohotel.pets.RideablePet;
import com.eu.habbo.habbohotel.users.DanceType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.core.WiredManager;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericErrorMessagesComposer;
import com.eu.habbo.messages.outgoing.inventory.AddPetComposer;
import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitIdleComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserHandItemComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRemoveComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.habbohotel.wired.core.WiredManager;
import com.eu.habbo.messages.outgoing.rooms.users.*;
import gnu.trove.TCollections;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.TIntObjectMap;
@@ -377,10 +372,31 @@ public class RoomUnitManager {
habbo.getRoomUnit().setPreviousLocationZ(z);
}
} else if (topItem != null && topItem.getBaseItem().allowLay()) {
BedProfile bedProfile = new BedProfile(topItem);
// Snap user to the correct pillow tile for the current bed rotation
RoomTile pillowTile = bedProfile.snapToLay(this.room, topItem, habbo.getRoomUnit().getX(), habbo.getRoomUnit().getY());
// For double beds: if another user already occupies this pillow, use the other side
if (pillowTile != null && bedProfile.isDouble()) {
THashSet<Habbo> habbosAtPillow = this.getHabbosAt(pillowTile.x, pillowTile.y);
for (Habbo other : habbosAtPillow) {
if (other == habbo || other.getRoomUnit() == null) continue;
RoomTile otherSide = bedProfile.getOtherSide(this.room, topItem, pillowTile);
if (otherSide != null) {
pillowTile = otherSide;
}
break;
}
}
if (pillowTile != null) {
habbo.getRoomUnit().setLocation(pillowTile);
}
habbo.getRoomUnit().setZ(topItem.getZ());
habbo.getRoomUnit().setPreviousLocationZ(topItem.getZ());
habbo.getRoomUnit().setRotation(RoomUserRotation.fromValue(topItem.getRotation() % 4));
BedProfile bedProfile = new BedProfile(topItem);
double layHeight = Item.getCurrentHeight(topItem) + bedProfile.getLayZOffset();
habbo.getRoomUnit().setStatus(RoomUnitStatus.LAY, layHeight + ";" + bedProfile.getLayXOffset() + ";" + bedProfile.getLayYOffset());
} else {