From 379376b1b45f091c29d7fce24c65f9a8272022e3 Mon Sep 17 00:00:00 2001 From: Ray Neiheiser Date: Tue, 5 Nov 2024 10:05:02 +0100 Subject: [PATCH] small hotfix for 10405 --- .../commands/citizencommands/CommandCitizenInfo.java | 2 +- .../core/entity/ai/minimal/EntityAISleep.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minecolonies/core/commands/citizencommands/CommandCitizenInfo.java b/src/main/java/com/minecolonies/core/commands/citizencommands/CommandCitizenInfo.java index 356ca0820c6..738014e9902 100755 --- a/src/main/java/com/minecolonies/core/commands/citizencommands/CommandCitizenInfo.java +++ b/src/main/java/com/minecolonies/core/commands/citizencommands/CommandCitizenInfo.java @@ -71,7 +71,7 @@ public int onExecute(final CommandContext context) final BlockPos citizenPosition = entityCitizen.blockPosition(); context.getSource() .sendSuccess(() -> Component.translatable(CommandTranslationConstants.COMMAND_CITIZEN_INFO_POSITION, citizenPosition.getX(), citizenPosition.getY(), citizenPosition.getZ()), true); - final BlockPos homePosition = entityCitizen.getRestrictCenter(); + final BlockPos homePosition = citizenData.getHomePosition(); context.getSource() .sendSuccess(() -> Component.translatable(CommandTranslationConstants.COMMAND_CITIZEN_INFO_HOME_POSITION, homePosition.getX(), homePosition.getY(), homePosition.getZ()), true); diff --git a/src/main/java/com/minecolonies/core/entity/ai/minimal/EntityAISleep.java b/src/main/java/com/minecolonies/core/entity/ai/minimal/EntityAISleep.java index f638653537f..073b64fe618 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/minimal/EntityAISleep.java +++ b/src/main/java/com/minecolonies/core/entity/ai/minimal/EntityAISleep.java @@ -14,6 +14,7 @@ import com.minecolonies.api.util.SoundUtils; import com.minecolonies.api.util.WorldUtil; import com.minecolonies.core.Network; +import com.minecolonies.core.colony.buildings.AbstractBuilding; import com.minecolonies.core.colony.buildings.modules.BuildingModules; import com.minecolonies.core.entity.citizen.EntityCitizen; import com.minecolonies.core.network.messages.client.SleepingParticleMessage; @@ -113,7 +114,7 @@ private IState walkHome() final IBuilding homeBuilding = citizen.getCitizenData().getHomeBuilding(); if (homeBuilding == null) { - @Nullable final BlockPos homePosition = citizen.getRestrictCenter(); + @Nullable final BlockPos homePosition = citizen.getCitizenData().getHomePosition(); if (homePosition.distSqr(BlockPos.containing(Math.floor(citizen.getX()), citizen.getY(), Math.floor(citizen.getZ()))) <= RANGE_TO_BE_HOME) { return FIND_BED; @@ -165,11 +166,11 @@ private void findBedAndTryToSleep() } final IColony colony = citizen.getCitizenColonyHandler().getColony(); - if (colony != null && colony.getBuildingManager().getBuilding(citizen.getRestrictCenter()) != null) + if (colony != null && citizen.getCitizenData().getHomeBuilding() instanceof AbstractBuilding hut) { + final BlockPos homePos = citizen.getCitizenData().getHomePosition(); if (usedBed == null) { - final IBuilding hut = colony.getBuildingManager().getBuilding(citizen.getRestrictCenter()); List bedList = new ArrayList<>(); if (hut.hasModule(BuildingModules.BED)) @@ -197,7 +198,7 @@ private void findBedAndTryToSleep() } } - usedBed = citizen.getRestrictCenter(); + usedBed = homePos; } if (citizen.isWorkerAtSiteWithMove(usedBed, 3))