Remove internal phase comments and format code

Strip all Phase references, TODO/FUTURE roadmap notes, and internal
planning comments from the codebase. Run Prettier for consistent
formatting across all Java files.
This commit is contained in:
NotEvil
2026-04-12 01:24:49 +02:00
parent 73d70e212d
commit a71093ba9c
482 changed files with 8500 additions and 5155 deletions

View File

@@ -3,10 +3,10 @@ package com.tiedup.remake.entities.ai;
import com.tiedup.remake.util.KidnapperAIHelper;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Mob;
import org.jetbrains.annotations.Nullable;
/**
* Reusable stuck detection for kidnapper AI goals.

View File

@@ -16,7 +16,6 @@ import net.minecraft.world.phys.Vec3;
/**
* AI Goal: Damsel flees from nearby players and kidnappers.
*
* Phase 14.2: Based on original EntityAIAvoidKidnapper
*
* <p><b>Behavior:</b></p>
* <ul>
@@ -138,9 +137,7 @@ public class DamselFleeFromPlayerGoal extends Goal {
.getEntitiesOfClass(
EntityKidnapper.class,
searchBox,
k ->
k.isAlive() &&
damsel.distanceTo(k) <= maxDistance
k -> k.isAlive() && damsel.distanceTo(k) <= maxDistance
);
if (!kidnappers.isEmpty()) {

View File

@@ -7,7 +7,6 @@ import net.minecraft.world.entity.ai.goal.PanicGoal;
/**
* AI Goal: Damsel panics and flees when hurt.
*
* Phase 14.2: Based on original EntityAIPanicTiedUp
*
* <p><b>Behavior:</b></p>
* <ul>

View File

@@ -6,7 +6,6 @@ import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
/**
* AI Goal: Damsel wanders randomly when not restrained.
*
* Phase 14.2: Based on original EntityAIWanderExceptWhenTiedUp
*
* <p><b>Behavior:</b></p>
* <ul>

View File

@@ -8,7 +8,6 @@ import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
/**
* AI Goal: Damsel watches nearby players.
*
* Phase 14.2: Based on original EntityAIWatchClosestBlindfolded
*
* <p><b>Behavior:</b></p>
* <ul>

View File

@@ -13,7 +13,6 @@ import net.minecraft.world.level.Level;
/**
* Abstract base class for kidnapper flee goals.
*
* Phase 3: Refactoring - Consolidates common flee behavior
*
* Subclasses:
* - KidnapperFleeSafeGoal: Flee without slave

View File

@@ -14,7 +14,6 @@ import net.minecraft.world.entity.ai.goal.Goal;
/**
* AI Goal for EntityKidnapper to actively search for an escaped prisoner.
*
* Phase 3: Kidnapper Revamp - Advanced AI
*
* This goal:
* 1. Activates when kidnapper is in ALERT state with a valid alertTarget

View File

@@ -15,7 +15,6 @@ import net.minecraft.world.phys.Vec3;
/**
* AI Goal for EntityKidnapperArcher to attack targets from range.
*
* Phase 18: Archer Kidnappers
*
* This goal:
* 1. Finds targets within bow range (10-25 blocks)

View File

@@ -1,7 +1,6 @@
package com.tiedup.remake.entities.ai.kidnapper;
import com.tiedup.remake.cells.CampOwnership;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.cells.CellRegistryV2;
import com.tiedup.remake.cells.ConfiscatedInventoryRegistry;
@@ -20,6 +19,7 @@ import com.tiedup.remake.state.IRestrainable;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.util.KidnapperAIHelper;
import com.tiedup.remake.util.teleport.TeleportHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@@ -1117,7 +1117,6 @@ public class KidnapperBringToCellGoal extends Goal {
}
/**
* Phase 2: Confiscate the player's inventory and store in LOOT chest.
*/
private void confiscateInventory(
ServerPlayer player,

View File

@@ -1,7 +1,6 @@
package com.tiedup.remake.entities.ai.kidnapper;
import com.tiedup.remake.core.SystemMessageManager;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.dialogue.EntityDialogueManager;
import com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory;
@@ -17,6 +16,7 @@ import com.tiedup.remake.prison.PrisonerState;
import com.tiedup.remake.state.IBondageState;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.util.KidnapperAIHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
@@ -32,7 +32,6 @@ import net.minecraft.world.item.ItemStack;
/**
* AI Goal for EntityKidnapper to capture and enslave targets.
*
* Phase 14.3.3: Capture mechanics AI
*
* This goal:
* 1. Moves towards the target
@@ -231,7 +230,6 @@ public class KidnapperCaptureGoal extends Goal {
return false;
}
// Phase 17: Stop if target was already captured by someone else
IBondageState state = KidnappedHelper.getKidnappedState(this.target);
if (state != null && state.isCaptive()) {
TiedUpMod.LOGGER.debug(

View File

@@ -1,6 +1,5 @@
package com.tiedup.remake.entities.ai.kidnapper;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.cells.CampOwnership;
import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.cells.CellRegistryV2;
@@ -11,6 +10,7 @@ import com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory;
import com.tiedup.remake.entities.EntityKidnapper;
import com.tiedup.remake.prison.service.PrisonerService;
import com.tiedup.remake.state.IBondageState;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@@ -25,7 +25,6 @@ import net.minecraft.world.item.ItemStack;
/**
* AI Goal for EntityKidnapper to decide what to do after capturing a slave.
*
* Phase 14.3.5: Decision system
*
* This goal activates when:
* - Kidnapper has a slave

View File

@@ -8,7 +8,6 @@ import net.minecraft.world.entity.ai.goal.Goal;
/**
* AI Goal for EntityKidnapper to find suitable targets.
*
* Phase 14.3.2: Target acquisition AI
*
* This goal:
* 1. Searches for nearby players and damsels within range

View File

@@ -6,7 +6,6 @@ import com.tiedup.remake.entities.EntityKidnapper;
/**
* AI Goal for EntityKidnapper to flee to safety without a slave.
*
* Phase 14.3.5: Flee behavior without slave
*
* This goal activates when:
* - Kidnapper does NOT have a slave

View File

@@ -13,7 +13,6 @@ import net.minecraft.world.item.ItemStack;
/**
* AI Goal for EntityKidnapper to flee while carrying a captive.
*
* Phase 14.3.5: Flee behavior with captive
*
* This goal activates when:
* - Kidnapper has a captive

View File

@@ -17,7 +17,6 @@ import net.minecraft.world.phys.Vec3;
/**
* AI Goal for EntityKidnapper to patrol around their home area.
*
* Phase 14.3.4: Patrol behavior for kidnappers
*
* This goal:
* 1. Activates when kidnapper has no target and no slave

View File

@@ -12,7 +12,6 @@ import net.minecraft.world.entity.ai.goal.Goal;
/**
* AI Goal for EntityKidnapper to punish a recaptured prisoner.
*
* Phase 3: Kidnapper Revamp - Advanced AI
*
* This goal:
* 1. Activates when kidnapper is in PUNISH state with a captive

View File

@@ -3,7 +3,6 @@ package com.tiedup.remake.entities.ai.kidnapper;
/**
* Enum defining the behavioral states of a Kidnapper entity.
*
* Phase 3: Kidnapper Revamp - Advanced AI States
*
* These states drive the kidnapper's AI decision-making and help
* coordinate behavior between multiple kidnappers.

View File

@@ -22,7 +22,6 @@ import net.minecraft.world.entity.player.Player;
/**
* AI Goal for EntityKidnapper to wait for a buyer when selling a slave.
*
* Phase 14.3.5: Sale system
*
* This goal activates when:
* - Kidnapper has a slave

View File

@@ -1,6 +1,5 @@
package com.tiedup.remake.entities.ai.kidnapper;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.core.SystemMessageManager;
import com.tiedup.remake.core.SystemMessageManager.MessageCategory;
import com.tiedup.remake.core.TiedUpMod;
@@ -12,6 +11,7 @@ import com.tiedup.remake.prison.PrisonerRecord;
import com.tiedup.remake.state.IRestrainable;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.util.tasks.ItemTask;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.world.entity.ai.goal.Goal;
@@ -21,7 +21,6 @@ import net.minecraft.world.item.ItemStack;
/**
* AI Goal for EntityKidnapper to wait for a worker to complete a job.
*
* Phase 14.3.5: Job system
*
* This goal activates when:
* - Kidnapper has assigned a job (isWaitingForJobToBeCompleted)

View File

@@ -1,7 +1,6 @@
package com.tiedup.remake.entities.ai.kidnapper;
import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.cells.CellRegistryV2;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.dialogue.DialogueBridge;
@@ -14,6 +13,7 @@ import com.tiedup.remake.items.base.BindVariant;
import com.tiedup.remake.state.IBondageState;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.util.KidnapperAIHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@@ -701,7 +701,10 @@ public class KidnapperWalkPrisonerGoal extends Goal {
}
// Find the prisoner
IBondageState prisoner = findPrisoner(serverLevel, this.walkedPrisonerId);
IBondageState prisoner = findPrisoner(
serverLevel,
this.walkedPrisonerId
);
if (prisoner == null || !prisoner.asLivingEntity().isAlive()) {
// Prisoner died or disappeared - abort
TiedUpMod.LOGGER.debug(

View File

@@ -143,16 +143,13 @@ public class MaidCollectRansomGoal extends Goal {
collectTicks++;
if (!itemsCollected) {
// Phase 1: Go to collect target and collect items
tickCollectPhase(target);
} else {
// Phase 2: Return to trader
tickReturnPhase();
}
}
/**
* Phase 1: Walk to target and collect items.
*/
private void tickCollectPhase(BlockPos target) {
// Look at target
@@ -194,7 +191,6 @@ public class MaidCollectRansomGoal extends Goal {
}
/**
* Phase 2: Return to trader with collected items.
*/
private void tickReturnPhase() {
// Refresh trader reference if null

View File

@@ -1,10 +1,10 @@
package com.tiedup.remake.entities.ai.maid;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.entities.EntityMaid;
import com.tiedup.remake.state.IRestrainable;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.server.level.ServerLevel;

View File

@@ -1,7 +1,6 @@
package com.tiedup.remake.entities.ai.maid.goals;
import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.cells.CellRegistryV2;
import com.tiedup.remake.core.ModConfig;
import com.tiedup.remake.core.TiedUpMod;
@@ -15,6 +14,7 @@ import com.tiedup.remake.prison.PrisonerState;
import com.tiedup.remake.prison.RansomRecord;
import com.tiedup.remake.state.IBondageState;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.Set;
import java.util.UUID;
@@ -274,7 +274,9 @@ public class MaidAssignTaskGoal extends Goal {
// 7. Free kidnapped state and remove all restraints
IBondageState cap = KidnappedHelper.getKidnappedState(prisoner);
if (cap != null) {
net.minecraft.world.item.ItemStack collar = cap.getEquipment(BodyRegionV2.NECK);
net.minecraft.world.item.ItemStack collar = cap.getEquipment(
BodyRegionV2.NECK
);
if (!collar.isEmpty()) {
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
prisoner,

View File

@@ -1,7 +1,6 @@
package com.tiedup.remake.entities.ai.maid.goals;
import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.cells.CellRegistryV2;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.entities.EntityMaid;
@@ -19,6 +18,7 @@ import com.tiedup.remake.state.ICaptor;
import com.tiedup.remake.util.KidnappedHelper;
import com.tiedup.remake.util.KidnapperAIHelper;
import com.tiedup.remake.util.MessageDispatcher;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
@@ -213,7 +213,6 @@ public class MaidReturnGoal extends Goal {
}
/**
* Phase 1: Walk toward prisoner. When close enough, leash them.
*/
private void tickApproachPrisoner(
ServerLevel level,
@@ -244,7 +243,6 @@ public class MaidReturnGoal extends Goal {
}
/**
* Phase 2: Walk to cell with leashed prisoner following.
* Uses WaypointNavigator if path waypoints are defined, else vanilla pathfinding.
*/
private void tickWalkToCell(ServerLevel level, ServerPlayer prisoner) {
@@ -338,7 +336,8 @@ public class MaidReturnGoal extends Goal {
}
} else {
// Fallback: use basic rope if no snapshot
cap.equip(BodyRegionV2.ARMS,
cap.equip(
BodyRegionV2.ARMS,
new ItemStack(
com.tiedup.remake.items.ModItems.getBind(
com.tiedup.remake.items.base.BindVariant.ROPES
@@ -651,7 +650,9 @@ public class MaidReturnGoal extends Goal {
IBondageState cap = KidnappedHelper.getKidnappedState(prisoner);
if (cap != null) {
// Remove collar (force=true to bypass lock)
net.minecraft.world.item.ItemStack collar = cap.getEquipment(BodyRegionV2.NECK);
net.minecraft.world.item.ItemStack collar = cap.getEquipment(
BodyRegionV2.NECK
);
if (!collar.isEmpty()) {
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
prisoner,

View File

@@ -1,11 +1,11 @@
package com.tiedup.remake.entities.ai.master;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.dialogue.DialogueBridge;
import com.tiedup.remake.entities.EntityKidnapper;
import com.tiedup.remake.entities.EntityMaster;
import com.tiedup.remake.state.IRestrainable;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.server.level.ServerPlayer;
@@ -157,9 +157,7 @@ public class MasterBuyPlayerGoal extends Goal {
TiedUpMod.LOGGER.debug(
"[MasterBuyPlayerGoal] {} approaching {} to buy player",
master.getNpcName(),
targetKidnapper != null
? targetKidnapper.getNpcName()
: "unknown"
targetKidnapper != null ? targetKidnapper.getNpcName() : "unknown"
);
}
@@ -484,19 +482,29 @@ public class MasterBuyPlayerGoal extends Goal {
// Manually remove each region EXCEPT neck (collar) and torso (clothes)
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
player, com.tiedup.remake.v2.BodyRegionV2.ARMS, true
player,
com.tiedup.remake.v2.BodyRegionV2.ARMS,
true
);
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
player, com.tiedup.remake.v2.BodyRegionV2.MOUTH, true
player,
com.tiedup.remake.v2.BodyRegionV2.MOUTH,
true
);
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
player, com.tiedup.remake.v2.BodyRegionV2.EYES, true
player,
com.tiedup.remake.v2.BodyRegionV2.EYES,
true
);
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
player, com.tiedup.remake.v2.BodyRegionV2.EARS, true
player,
com.tiedup.remake.v2.BodyRegionV2.EARS,
true
);
com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper.unequipFromRegion(
player, com.tiedup.remake.v2.BodyRegionV2.HANDS, true
player,
com.tiedup.remake.v2.BodyRegionV2.HANDS,
true
);
// V1 speed reduction handled by MovementStyleManager (V2 tick-based).

View File

@@ -1,11 +1,11 @@
package com.tiedup.remake.entities.ai.master;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.dialogue.DialogueBridge;
import com.tiedup.remake.entities.EntityMaster;
import com.tiedup.remake.state.IPlayerLeashAccess;
import com.tiedup.remake.state.PlayerBindState;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;

View File

@@ -1,13 +1,13 @@
package com.tiedup.remake.entities.ai.master;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.dialogue.DialogueBridge;
import com.tiedup.remake.entities.EntityMaster;
import com.tiedup.remake.items.ModItems;
import com.tiedup.remake.items.base.BindVariant;
import com.tiedup.remake.state.HumanChairHelper;
import com.tiedup.remake.state.PlayerBindState;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
@@ -156,9 +156,7 @@ public class MasterHumanChairGoal extends Goal {
}
}
// ========================================
// PHASE: APPROACHING
// ========================================
private void tickApproaching(ServerPlayer pet) {
master.getLookControl().setLookAt(pet, 30.0F, 30.0F);
@@ -177,9 +175,7 @@ public class MasterHumanChairGoal extends Goal {
}
}
// ========================================
// PHASE: SETTLING
// ========================================
private void tickSettling(ServerPlayer pet) {
master.getLookControl().setLookAt(pet, 30.0F, 30.0F);
@@ -224,9 +220,7 @@ public class MasterHumanChairGoal extends Goal {
}
}
// ========================================
// PHASE: SITTING
// ========================================
private void tickSitting(ServerPlayer pet) {
phaseTimer++;
@@ -281,9 +275,7 @@ public class MasterHumanChairGoal extends Goal {
}
}
// ========================================
// IDLE BEHAVIORS DURING SITTING
// ========================================
private void tickIdleBehavior(ServerPlayer pet) {
// Periodically look at nearby entities or comment
@@ -356,9 +348,7 @@ public class MasterHumanChairGoal extends Goal {
}
}
// ========================================
// POSITIONING
// ========================================
/**
* Position master on pet's back, facing sideways (perpendicular).
@@ -390,9 +380,7 @@ public class MasterHumanChairGoal extends Goal {
master.setDeltaMovement(0, 0, 0);
}
// ========================================
// POSE MANAGEMENT
// ========================================
/**
* Apply the human chair pose to the pet:

View File

@@ -403,9 +403,7 @@ public class MasterPlaceBlockGoal extends Goal {
}
}
// ========================================
// FIX: NBT PERSISTENCE FOR PLACED BLOCKS
// ========================================
/**
* Get the currently placed block position (for NBT saving).

View File

@@ -360,18 +360,15 @@ public class MasterRandomEventGoal extends Goal {
this.currentEvent = null;
}
// ========================================
// STATIC CLEANUP METHODS
// ========================================
/** All body regions that can have temporary master event items */
private static final List<BodyRegionV2> TEMP_ITEM_CLEANUP_REGIONS =
List.of(
BodyRegionV2.ARMS,
BodyRegionV2.EYES,
BodyRegionV2.MOUTH,
BodyRegionV2.HANDS
);
private static final List<BodyRegionV2> TEMP_ITEM_CLEANUP_REGIONS = List.of(
BodyRegionV2.ARMS,
BodyRegionV2.EYES,
BodyRegionV2.MOUTH,
BodyRegionV2.HANDS
);
/**
* Check and cleanup any expired temporary master event items on a player.

View File

@@ -374,9 +374,7 @@ public class MasterTaskAssignGoal extends Goal {
master.setMasterState(MasterState.TASK_ASSIGN);
}
// ========================================
// DEMAND TASK - INVENTORY SCANNING
// ========================================
/**
* Scan pet's inventory and find the most valuable item to demand.

View File

@@ -1,12 +1,12 @@
package com.tiedup.remake.entities.ai.master;
import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.dialogue.DialogueBridge;
import com.tiedup.remake.entities.EntityMaster;
import com.tiedup.remake.items.ItemChokeCollar;
import com.tiedup.remake.state.PlayerBindState;
import com.tiedup.remake.util.MessageDispatcher;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;

View File

@@ -52,8 +52,11 @@ public abstract class AbstractNpcJobGoal extends Goal {
protected final EntityDamsel npc;
protected final double speedModifier;
@Nullable protected BlockPos chestPos;
@Nullable protected Player master;
@Nullable
protected BlockPos chestPos;
@Nullable
protected Player master;
protected List<ItemStack> heldItems = new ArrayList<>();
protected int phase;
@@ -188,7 +191,12 @@ public abstract class AbstractNpcJobGoal extends Goal {
onStop();
if (!heldItems.isEmpty() && chestPos != null) {
NpcGoalHelper.storeItemsInChest(npc, npc.level(), chestPos, heldItems);
NpcGoalHelper.storeItemsInChest(
npc,
npc.level(),
chestPos,
heldItems
);
}
this.chestPos = null;
@@ -217,7 +225,10 @@ public abstract class AbstractNpcJobGoal extends Goal {
private void tickScanning() {
if (--this.scanTimer <= 0) {
float efficiency = NpcGoalHelper.getJobEfficiency(npc, getCommand());
float efficiency = NpcGoalHelper.getJobEfficiency(
npc,
getCommand()
);
this.scanTimer = (int) (SCAN_INTERVAL / efficiency);
// Check if we need to store items first
@@ -253,19 +264,26 @@ public abstract class AbstractNpcJobGoal extends Goal {
// Move towards chest
if (--this.pathRecalcTimer <= 0) {
this.pathRecalcTimer = 10;
npc.getNavigation().moveTo(
chestPos.getX() + 0.5,
chestPos.getY(),
chestPos.getZ() + 0.5,
speedModifier
);
npc
.getNavigation()
.moveTo(
chestPos.getX() + 0.5,
chestPos.getY(),
chestPos.getZ() + 0.5,
speedModifier
);
}
// Check if close enough to store
double dist = npc.blockPosition().distSqr(chestPos);
double interactDist = getInteractDistance();
if (dist <= interactDist * interactDist) {
NpcGoalHelper.storeItemsInChest(npc, npc.level(), chestPos, heldItems);
NpcGoalHelper.storeItemsInChest(
npc,
npc.level(),
chestPos,
heldItems
);
heldItems.clear();
this.phase = PHASE_SCANNING;
this.scanTimer = 0;

View File

@@ -101,7 +101,9 @@ public class NpcFarmCommandGoal extends AbstractNpcJobGoal {
speakJobIdleDialogue();
this.jobIdleTalkCooldown =
JOB_IDLE_TALK_MIN +
npc.getRandom().nextInt(JOB_IDLE_TALK_MAX - JOB_IDLE_TALK_MIN);
npc
.getRandom()
.nextInt(JOB_IDLE_TALK_MAX - JOB_IDLE_TALK_MIN);
}
}
}
@@ -136,12 +138,14 @@ public class NpcFarmCommandGoal extends AbstractNpcJobGoal {
// Move towards crop
if (--this.pathRecalcTimer <= 0) {
this.pathRecalcTimer = 10;
npc.getNavigation().moveTo(
targetCrop.getX() + 0.5,
targetCrop.getY(),
targetCrop.getZ() + 0.5,
speedModifier
);
npc
.getNavigation()
.moveTo(
targetCrop.getX() + 0.5,
targetCrop.getY(),
targetCrop.getZ() + 0.5,
speedModifier
);
}
// Check if close enough to harvest
@@ -186,8 +190,14 @@ public class NpcFarmCommandGoal extends AbstractNpcJobGoal {
}
// Apply yield bonus from experience
float yieldMult = NpcGoalHelper.getJobYieldMultiplier(npc, NpcCommand.FARM);
if (yieldMult > 1.0f && npc.getRandom().nextFloat() < (yieldMult - 1.0f)) {
float yieldMult = NpcGoalHelper.getJobYieldMultiplier(
npc,
NpcCommand.FARM
);
if (
yieldMult > 1.0f &&
npc.getRandom().nextFloat() < (yieldMult - 1.0f)
) {
if (!drops.isEmpty()) {
ItemStack bonusDrop = drops
.get(npc.getRandom().nextInt(drops.size()))
@@ -209,14 +219,23 @@ public class NpcFarmCommandGoal extends AbstractNpcJobGoal {
}
// Sound effect
level.playSound(null, targetCrop, SoundEvents.CROP_BREAK, SoundSource.BLOCKS, 1.0f, 1.0f);
level.playSound(
null,
targetCrop,
SoundEvents.CROP_BREAK,
SoundSource.BLOCKS,
1.0f,
1.0f
);
// Look at the crop
npc.getLookControl().setLookAt(
targetCrop.getX() + 0.5,
targetCrop.getY() + 0.5,
targetCrop.getZ() + 0.5
);
npc
.getLookControl()
.setLookAt(
targetCrop.getX() + 0.5,
targetCrop.getY() + 0.5,
targetCrop.getZ() + 0.5
);
harvestCooldown = 10;
@@ -245,13 +264,19 @@ public class NpcFarmCommandGoal extends AbstractNpcJobGoal {
if (player == null) return;
String dialogueId =
com.tiedup.remake.dialogue.DialogueTriggerSystem.selectProactiveDialogue(npc);
com.tiedup.remake.dialogue.DialogueTriggerSystem.selectProactiveDialogue(
npc
);
if (dialogueId == null || dialogueId.startsWith("idle.")) {
dialogueId = "jobs.idle.farm";
}
com.tiedup.remake.dialogue.EntityDialogueManager.talkByDialogueId(npc, player, dialogueId);
com.tiedup.remake.dialogue.EntityDialogueManager.talkByDialogueId(
npc,
player,
dialogueId
);
}
@Nullable
@@ -321,7 +346,9 @@ public class NpcFarmCommandGoal extends AbstractNpcJobGoal {
@Nullable
private BlockState getCropStateForSeed(ItemStack seed) {
if (seed.is(Items.WHEAT_SEEDS)) return Blocks.WHEAT.defaultBlockState();
if (seed.is(Items.BEETROOT_SEEDS)) return Blocks.BEETROOTS.defaultBlockState();
if (
seed.is(Items.BEETROOT_SEEDS)
) return Blocks.BEETROOTS.defaultBlockState();
if (seed.is(Items.CARROT)) return Blocks.CARROTS.defaultBlockState();
if (seed.is(Items.POTATO)) return Blocks.POTATOES.defaultBlockState();
return null;

View File

@@ -125,19 +125,23 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
this.pathRecalcTimer = 10;
BlockPos adjacentPos = findAdjacentSolidBlock(waterPos);
if (adjacentPos != null) {
npc.getNavigation().moveTo(
adjacentPos.getX() + 0.5,
adjacentPos.getY(),
adjacentPos.getZ() + 0.5,
speedModifier
);
npc
.getNavigation()
.moveTo(
adjacentPos.getX() + 0.5,
adjacentPos.getY(),
adjacentPos.getZ() + 0.5,
speedModifier
);
} else {
npc.getNavigation().moveTo(
waterPos.getX() + 0.5,
waterPos.getY() + 1,
waterPos.getZ() + 0.5,
speedModifier
);
npc
.getNavigation()
.moveTo(
waterPos.getX() + 0.5,
waterPos.getY() + 1,
waterPos.getZ() + 0.5,
speedModifier
);
}
}
@@ -156,11 +160,13 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
}
// Look at water while preparing to cast
npc.getLookControl().setLookAt(
waterPos.getX() + 0.5,
waterPos.getY() + 0.5,
waterPos.getZ() + 0.5
);
npc
.getLookControl()
.setLookAt(
waterPos.getX() + 0.5,
waterPos.getY() + 0.5,
waterPos.getZ() + 0.5
);
if (--this.castDelay > 0) {
return;
@@ -178,7 +184,9 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
// Cast sound
level.playSound(
null,
npc.getX(), npc.getY(), npc.getZ(),
npc.getX(),
npc.getY(),
npc.getZ(),
SoundEvents.FISHING_BOBBER_THROW,
SoundSource.NEUTRAL,
0.5f,
@@ -197,11 +205,13 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
}
// Look at bobber while waiting
npc.getLookControl().setLookAt(
activeBobber.getX(),
activeBobber.getY(),
activeBobber.getZ()
);
npc
.getLookControl()
.setLookAt(
activeBobber.getX(),
activeBobber.getY(),
activeBobber.getZ()
);
if (activeBobber.isBiting()) {
this.phase = PHASE_REELING;
@@ -223,8 +233,13 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
}
// Apply yield bonus
float yieldMult = NpcGoalHelper.getJobYieldMultiplier(npc, NpcCommand.FISH);
if (yieldMult > 1.0f && npc.getRandom().nextFloat() < (yieldMult - 1.0f)) {
float yieldMult = NpcGoalHelper.getJobYieldMultiplier(
npc,
NpcCommand.FISH
);
if (
yieldMult > 1.0f && npc.getRandom().nextFloat() < (yieldMult - 1.0f)
) {
if (!loot.isEmpty()) {
ItemStack bonusDrop = loot
.get(npc.getRandom().nextInt(loot.size()))
@@ -237,10 +252,13 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
// Reel sound
level.playSound(
null,
npc.getX(), npc.getY(), npc.getZ(),
npc.getX(),
npc.getY(),
npc.getZ(),
SoundEvents.FISHING_BOBBER_RETRIEVE,
SoundSource.NEUTRAL,
1.0f, 1.0f
1.0f,
1.0f
);
// Drain rest
@@ -281,10 +299,14 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
.getLootTable(BuiltInLootTables.FISHING);
float experienceLuck =
NpcGoalHelper.getJobYieldMultiplier(npc, NpcCommand.FISH) - 1.0f;
NpcGoalHelper.getJobYieldMultiplier(npc, NpcCommand.FISH) -
1.0f;
LootParams params = new LootParams.Builder(serverLevel)
.withParameter(LootContextParams.ORIGIN, new Vec3(npc.getX(), npc.getY(), npc.getZ()))
.withParameter(
LootContextParams.ORIGIN,
new Vec3(npc.getX(), npc.getY(), npc.getZ())
)
.withParameter(LootContextParams.THIS_ENTITY, npc)
.withLuck(experienceLuck)
.create(LootContextParamSets.FISHING);
@@ -342,7 +364,9 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
chestPos.getZ() + z
);
if (level.getBlockState(mutable).getBlock() == Blocks.WATER) {
if (
level.getBlockState(mutable).getBlock() == Blocks.WATER
) {
double dist = npc.blockPosition().distSqr(mutable);
if (dist < nearestDist) {
nearest = mutable.immutable();
@@ -369,7 +393,9 @@ public class NpcFishCommandGoal extends AbstractNpcJobGoal {
for (BlockPos adjacent : offsets) {
if (
level.getBlockState(adjacent).isAir() &&
level.getBlockState(adjacent.below()).isSolidRender(level, adjacent.below())
level
.getBlockState(adjacent.below())
.isSolidRender(level, adjacent.below())
) {
return adjacent;
}

View File

@@ -1,10 +1,10 @@
package com.tiedup.remake.entities.ai.personality;
import com.tiedup.remake.entities.EntityDamsel;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.items.base.ItemBind;
import com.tiedup.remake.personality.NpcCommand;
import com.tiedup.remake.personality.ToolMode;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
@@ -506,9 +506,7 @@ public class NpcFollowCommandGoal extends Goal {
if (dist <= ATTACK_RANGE) {
// Try to capture using bind item
ItemStack bindItem = npc.getMainHandItem();
if (
bindItem.getItem() instanceof ItemBind
) {
if (bindItem.getItem() instanceof ItemBind) {
// Apply bind to target
captureTarget.equip(BodyRegionV2.ARMS, bindItem.copy());

View File

@@ -7,7 +7,6 @@ import com.tiedup.remake.personality.NpcCommand;
import com.tiedup.remake.personality.PersonalityState;
import java.util.List;
import java.util.UUID;
import org.jetbrains.annotations.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.server.level.ServerLevel;
@@ -19,6 +18,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
import org.jetbrains.annotations.Nullable;
/**
* Utility methods shared by NPC command goals.

View File

@@ -1,11 +1,11 @@
package com.tiedup.remake.entities.ai.personality;
import com.tiedup.remake.entities.EntityDamsel;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.items.base.ItemBind;
import com.tiedup.remake.items.base.ItemCollar;
import com.tiedup.remake.personality.NpcCommand;
import com.tiedup.remake.personality.PersonalityState;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
@@ -426,9 +426,7 @@ public class NpcGuardCommandGoal extends Goal {
NonNullList<ItemStack> inventory = npc.getNpcInventory();
for (int i = 0; i < inventory.size(); i++) {
ItemStack stack = inventory.get(i);
if (
stack.getItem() instanceof ItemBind
) {
if (stack.getItem() instanceof ItemBind) {
// Apply bind to slave
slave.equip(BodyRegionV2.ARMS, stack.copy());
stack.shrink(1);

View File

@@ -26,7 +26,7 @@ import net.minecraft.world.entity.player.Player;
*
* <p>Also handles idle dialogue and XP awards.</p>
*
* Personality System Phase 5: Living Jobs
* Personality System Living Jobs
*/
public class NpcIdleCommandGoal extends Goal {

View File

@@ -1,12 +1,12 @@
package com.tiedup.remake.entities.ai.personality;
import com.tiedup.remake.core.SettingsAccessor;
import com.tiedup.remake.entities.EntityDamsel;
import com.tiedup.remake.v2.BodyRegionV2;
import com.tiedup.remake.items.base.IHasResistance;
import com.tiedup.remake.personality.PersonalityState;
import com.tiedup.remake.personality.PersonalityType;
import com.tiedup.remake.core.SettingsAccessor;
import com.tiedup.remake.util.TiedUpSounds;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
@@ -66,7 +66,9 @@ public class NpcStruggleGoal extends Goal {
@Override
public boolean canUse() {
// Check game rule
if (!SettingsAccessor.isNpcStruggleEnabled(npc.level().getGameRules())) {
if (
!SettingsAccessor.isNpcStruggleEnabled(npc.level().getGameRules())
) {
return false;
}
@@ -275,7 +277,9 @@ public class NpcStruggleGoal extends Goal {
* Get the base struggle interval from game rules.
*/
private int getBaseInterval() {
return SettingsAccessor.getNpcStruggleInterval(npc.level().getGameRules());
return SettingsAccessor.getNpcStruggleInterval(
npc.level().getGameRules()
);
}
/**