Skip to content

Commit

Permalink
Merge branch 'Toggle-T-Cross' of https://github.com/HexatomicRing/min…
Browse files Browse the repository at this point in the history
…ecolonies into Toggle-T-Cross
  • Loading branch information
HexatomicRing committed Nov 5, 2024
2 parents 608a297 + 74808cb commit 843075e
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.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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<BlockPos> bedList = new ArrayList<>();

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

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

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

0 comments on commit 843075e

Please sign in to comment.