From 342cbd93226ada9583d8f6d0a00fe5e0073d3a65 Mon Sep 17 00:00:00 2001 From: Ray Neiheiser Date: Tue, 5 Nov 2024 10:05:41 +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 53dd93ba079..dac535c575f 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.translatableEscape(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.translatableEscape(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 8dd564f56f9..2af7e223b0e 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 @@ -13,6 +13,7 @@ import com.minecolonies.api.util.CompatibilityUtils; import com.minecolonies.api.util.SoundUtils; import com.minecolonies.api.util.WorldUtil; +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; @@ -112,7 +113,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; @@ -164,11 +165,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)) @@ -196,7 +197,7 @@ private void findBedAndTryToSleep() } } - usedBed = citizen.getRestrictCenter(); + usedBed = homePos; } if (citizen.isWorkerAtSiteWithMove(usedBed, 3))