Skip to content

Commit

Permalink
small hotfix for 10405
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Nov 5, 2024
1 parent a90ee76 commit 379376b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public int onExecute(final CommandContext<CommandSourceStack> 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -165,11 +166,11 @@ private void findBedAndTryToSleep()
}

final IColony colony = citizen.getCitizenColonyHandler().getColony();
if (colony != null && colony.getBuildingManager().getBuilding(citizen.getRestrictCenter()) != null)

This comment has been minimized.

Copy link
@uecasm

uecasm Nov 5, 2024

Contributor

Is there some reason this couldn't be an IBuilding any more?

This comment has been minimized.

Copy link
@Raycoms

Raycoms Nov 5, 2024

Author Contributor

No

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<BlockPos> bedList = new ArrayList<>();

if (hut.hasModule(BuildingModules.BED))
Expand Down Expand Up @@ -197,7 +198,7 @@ private void findBedAndTryToSleep()
}
}

usedBed = citizen.getRestrictCenter();
usedBed = homePos;
}

if (citizen.isWorkerAtSiteWithMove(usedBed, 3))
Expand Down

0 comments on commit 379376b

Please sign in to comment.