From a765f793ab28987a4b00c997040da9d3ffee8f06 Mon Sep 17 00:00:00 2001 From: Raycoms Date: Mon, 30 Dec 2024 10:28:36 +0100 Subject: [PATCH] several small fixes (#10558) Fix exception with concrete mixer Fix exception with colonist removal event Fix issue with citizens not going to bed Fix citizens constantly pathing to bed if there is none --- .../core/entity/ai/minimal/EntityAISleep.java | 6 +++++- .../ai/workers/crafting/EntityAIConcreteMixer.java | 2 +- .../navigation/EntityNavigationUtils.java | 3 +-- .../pathjobs/PathJobMoveCloseToXNearY.java | 2 +- .../camps/amazon/amazon_jungle_barrel_shaft.nbt | Bin .../camps/amazon/amazon_jungle_boss.nbt | Bin .../camps/amazon/amazon_jungle_boss2.nbt | Bin .../camps/amazon/amazon_jungle_corner.nbt | Bin .../camps/amazon/amazon_jungle_intersection.nbt | Bin .../camps/amazon/amazon_jungle_ladder.nbt | Bin .../camps/amazon/amazon_jungle_pit_shaft.nbt | Bin .../camps/amazon/amazon_jungle_pyramid.nbt | Bin .../amazon/amazon_jungle_ruined_spawner_shaft.nbt | Bin .../amazon_jungle_ruined_spawner_shaft_deadend.nbt | Bin .../camps/amazon/amazon_jungle_shaft.nbt | Bin .../camps/amazon/amazon_jungle_spawner_corner.nbt | Bin .../amazon/amazon_jungle_spawner_intersection.nbt | Bin .../camps/amazon/amazon_jungle_spawner_shaft.nbt | Bin .../camps/amazon/amazon_jungle_tnt_shaft.nbt | Bin .../camps/amazon/amazon_jungle_trapped_corner.nbt | Bin .../{structures => structure}/camps/desert_camp.nbt | Bin .../camps/large_barbarian_camp.nbt | Bin .../camps/small_barbarian_camp.nbt | Bin 23 files changed, 8 insertions(+), 5 deletions(-) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_barrel_shaft.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_boss.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_boss2.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_corner.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_intersection.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_ladder.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_pit_shaft.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_pyramid.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_ruined_spawner_shaft.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_ruined_spawner_shaft_deadend.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_shaft.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_spawner_corner.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_spawner_intersection.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_spawner_shaft.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_tnt_shaft.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/amazon/amazon_jungle_trapped_corner.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/desert_camp.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/large_barbarian_camp.nbt (100%) rename src/main/resources/data/minecolonies/{structures => structure}/camps/small_barbarian_camp.nbt (100%) 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 02b15013b1a..de14f950be0 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 @@ -137,7 +137,7 @@ else if (homeBuilding.isInBuilding(citizen.blockPosition())) */ private boolean findBed() { - if (!citizen.getCitizenSleepHandler().isAsleep() || bedTicks < MAX_BED_TICKS) + if (!citizen.getCitizenSleepHandler().isAsleep() && bedTicks < MAX_BED_TICKS) { findBedAndTryToSleep(); return false; @@ -210,6 +210,10 @@ private void findBedAndTryToSleep() } citizen.getCitizenData().getCitizenHappinessHandler().resetModifier(SLEPTTONIGHT); } + else + { + bedTicks = 0; + } } } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIConcreteMixer.java b/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIConcreteMixer.java index b06591ba4d2..71dca742793 100644 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIConcreteMixer.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIConcreteMixer.java @@ -71,7 +71,7 @@ private IAIState placePowder() final int slot = getSlotWithPowder(); if (slot == -1) { - if (InventoryUtils.hasItemInItemHandler(building.getItemHandlerCap(), CONCRETE)) + if (InventoryUtils.getCountFromBuilding(building, CONCRETE) > 0) { needsCurrently = new Tuple<>(CONCRETE, STACKSIZE); return GATHERING_REQUIRED_MATERIALS; diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/navigation/EntityNavigationUtils.java b/src/main/java/com/minecolonies/core/entity/pathfinding/navigation/EntityNavigationUtils.java index c4f3c5be86e..065ab74590b 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/navigation/EntityNavigationUtils.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/navigation/EntityNavigationUtils.java @@ -60,8 +60,7 @@ public static boolean walkCloseToXNearY( // 1. Navigation Finished // 2. Navigation is progressing towards a previous task // 3. Navigation did not try once - boolean isOnRightTask = (nav.getPathResult() != null - && PathJobMoveCloseToXNearY.isJobFor(nav.getPathResult().getJob(), desiredPosition, nearbyPosition, distToDesired)); + boolean isOnRightTask = nav.getPathResult() != null && PathJobMoveCloseToXNearY.isJobFor(nav.getPathResult().getJob(), desiredPosition, nearbyPosition, 1); if (nav.isDone() || !isOnRightTask) { diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/PathJobMoveCloseToXNearY.java b/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/PathJobMoveCloseToXNearY.java index ac43838b65b..3131e329790 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/PathJobMoveCloseToXNearY.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/PathJobMoveCloseToXNearY.java @@ -115,7 +115,7 @@ public static boolean isJobFor(final AbstractPathJob job, final BlockPos desired { if (job instanceof PathJobMoveCloseToXNearY pathJob) { - return pathJob.nearbyPosition.equals(desiredPosition) && pathJob.nearbyPosition.equals(nearbyPosition) && pathJob.distToDesired == distance; + return pathJob.desiredPosition.equals(desiredPosition) && pathJob.nearbyPosition.equals(nearbyPosition) && pathJob.distToDesired == distance; } return false; diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_barrel_shaft.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_barrel_shaft.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_barrel_shaft.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_barrel_shaft.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_boss.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_boss.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_boss.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_boss.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_boss2.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_boss2.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_boss2.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_boss2.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_corner.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_corner.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_corner.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_corner.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_intersection.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_intersection.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_intersection.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_intersection.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_ladder.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_ladder.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_ladder.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_ladder.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_pit_shaft.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_pit_shaft.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_pit_shaft.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_pit_shaft.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_pyramid.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_pyramid.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_pyramid.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_pyramid.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_ruined_spawner_shaft.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_ruined_spawner_shaft.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_ruined_spawner_shaft.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_ruined_spawner_shaft.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_ruined_spawner_shaft_deadend.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_ruined_spawner_shaft_deadend.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_ruined_spawner_shaft_deadend.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_ruined_spawner_shaft_deadend.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_shaft.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_shaft.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_shaft.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_shaft.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_spawner_corner.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_spawner_corner.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_spawner_corner.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_spawner_corner.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_spawner_intersection.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_spawner_intersection.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_spawner_intersection.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_spawner_intersection.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_spawner_shaft.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_spawner_shaft.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_spawner_shaft.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_spawner_shaft.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_tnt_shaft.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_tnt_shaft.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_tnt_shaft.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_tnt_shaft.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_trapped_corner.nbt b/src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_trapped_corner.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/amazon/amazon_jungle_trapped_corner.nbt rename to src/main/resources/data/minecolonies/structure/camps/amazon/amazon_jungle_trapped_corner.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/desert_camp.nbt b/src/main/resources/data/minecolonies/structure/camps/desert_camp.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/desert_camp.nbt rename to src/main/resources/data/minecolonies/structure/camps/desert_camp.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/large_barbarian_camp.nbt b/src/main/resources/data/minecolonies/structure/camps/large_barbarian_camp.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/large_barbarian_camp.nbt rename to src/main/resources/data/minecolonies/structure/camps/large_barbarian_camp.nbt diff --git a/src/main/resources/data/minecolonies/structures/camps/small_barbarian_camp.nbt b/src/main/resources/data/minecolonies/structure/camps/small_barbarian_camp.nbt similarity index 100% rename from src/main/resources/data/minecolonies/structures/camps/small_barbarian_camp.nbt rename to src/main/resources/data/minecolonies/structure/camps/small_barbarian_camp.nbt