Abdul rahim Ferrer

Bedrock minecraft mobile 1.26.40MASTER PROMPT: MODERN CITY LIFE — REAL WORLD EDITION

Minecraft Bedrock 1.26.40 | Complete Add-on Development

Act as an elite Minecraft Bedrock add-on developer, JavaScript engineer, professional 3D modeler, texture artist, animator, sound designer, gameplay programmer, and performance optimization specialist.

Your mission is to develop MODERN CITY LIFE: REAL WORLD EDITION, an ambitious, interconnected, realistic life-simulation add-on for Minecraft Bedrock.

This is not a request for concepts alone. Build actual functional files, models, textures, animations, scripts, and working systems.

CRITICAL DEVELOPMENT RULES

  1. Do not rush development. Prioritize quality, stability, functionality, and completeness.
  2. Target Minecraft Bedrock 1.26.40 on Android devices with 4 GB RAM.
  3. Use proper Behavior Packs, Resource Packs, valid manifests, unique UUIDs, and compatible Bedrock APIs.
  4. Package releases into valid, importable ".mcaddon" files.
  5. Never claim a feature works unless it has actually been implemented and verified to the extent possible.
  6. Create original, detailed 3D models and textures. Do not substitute empty placeholders for completed features.
  7. Preserve all previously completed systems when adding new features.
  8. Optimize entity AI, textures, animations, particles, sounds, and world updates for mobile.
  9. Use staged development. Maintain a "PROJECT_STATE.md" recording completed features, remaining work, bugs, and testing results.
  10. Never confuse a design specification with an implemented feature.

---

PART 1 — COMPLETE LIVING WORLD

Create a realistic modern world featuring:

  • 195 planned countries with regionally appropriate architecture, geography, climates, cultures, cities, and transportation.
  • Procedurally generated modern cities, towns, villages, countryside, industrial districts, airports, ports, and neighborhoods.
  • Roads, bridges, tunnels, railways, sidewalks, traffic lights, and street signs.
  • Houses, apartments, mansions, hotels, hospitals, police stations, schools, universities, military bases, factories, shops, and government buildings.
  • Working real estate, property ownership, renting, construction, and businesses.
  • A simulated economy with money, banks, taxes, salaries, investments, insurance, prices, and supply chains.
  • Government systems, presidents where appropriate, elections, public services, laws, courts, and emergency response.
  • NPCs who independently live, work, travel, shop, interact, form relationships, and follow schedules.

Countries should feel geographically and culturally distinct rather than using one identical city template everywhere.

PART 2 — PEOPLE AND REALISTIC LIFE

Develop diverse custom human NPCs with detailed 3D appearances, clothing, animations, personalities, occupations, and behaviors.

Include:

  • Babies, children, teenagers, adults, and elderly people.
  • Aging, birthdays, education, careers, retirement, family trees, and inheritance.
  • Friendships, adult romance, marriage, parenthood, and families.
  • Non-graphic private adult intimacy.
  • Contextual conversations, emotions, reputation, and relationships.
  • Hunger, thirst, fatigue, hygiene, temperature, exercise, illness, and bodily needs.
  • Functional toilets, showers, sinks, bathrooms, kitchens, laundry, and bedrooms.
  • Sitting, lying down, waving, hugging, dancing, swimming, crawling, climbing, carrying, pushing, and other body actions.
  • Hundreds of interconnected occupations.
  • Schools, examinations, qualifications, job applications, salaries, and promotions.
  • Optional one-life permadeath and descendant legacy gameplay.

Respectfully represent different world religions, traditions, holidays, and places of worship. Do not turn sacred religious figures into combat characters.

PART 3 — ALL VEHICLES WITH 3D MODELS

Create detailed, usable 3D vehicles with appropriate textures, sounds, animations, and controls.

Include:

  • Sedans, hatchbacks, SUVs, supercars, sports cars, luxury cars, and electric vehicles.
  • Motorcycles, bicycles, buses, taxis, jeepneys, tricycles, and trucks.
  • Ambulances, fire engines, police vehicles, military vehicles, and rescue vehicles.
  • Bulldozers, excavators, cranes, forklifts, tractors, harvesters, cement mixers, and other construction machinery.
  • Boats, yachts, submarines, ferries, jet skis, cargo ships, and fishing vessels.
  • Aircraft, helicopters, private jets, and rockets.

Implement steering, acceleration, braking, fuel or charging, passenger seating, collisions, damage, and vehicle sounds using feasible Bedrock systems.

PART 4 — COMPLETE WEAPON SYSTEM

Create these weapons:

  1. Pistol
  2. Revolver
  3. Submachine Gun
  4. Assault Rifle
  5. Pump-Action Shotgun
  6. Sniper Rifle
  7. Light Machine Gun
  8. Heavy Rifle

CRITICAL: ALL GUNS MUST BE HELD PROPERLY.

Every gun must display correctly in first-person and third-person views.

Pistols and revolvers require pistol-style grips. Larger weapons require appropriate two-handed holding positions.

Prevent these recurring bugs:

  • Gun appearing at the player's feet.
  • Invisible gun or player arm.
  • Gun filling the entire screen.
  • Gun floating beside the hand.
  • Incorrect model rotation or scaling.
  • Flat-looking weapons caused by incorrect rendering.
  • Broken first-person and third-person positioning.

Implement functional ammunition, firing, reloading, sounds, animations, shops, and attachments where supported.

Build and validate the pistol first. Use its verified rendering approach as the foundation for subsequent weapons.

Prefer original 3D models. Use a properly positioned detailed 2D fallback only when necessary.

PART 5 — FURNITURE, BUILDINGS AND UTILITIES

Create extensive 3D furniture and architectural assets.

Include working doors, windows, gates, elevators, lighting, beds, sofas, desks, kitchens, bathrooms, appliances, smart homes, and electronics.

Implement interconnected utility networks:

Electricity: Solar, wind, hydroelectric, coal, diesel, and nuclear generation; power lines, batteries, meters, substations, outages, and bills.

Water: Water tanks, water towers, pumps, pipes, rods, valves, meters, filters, faucets, showers, toilets, irrigation, wastewater, and plumbing.

Players must be able to connect a water tank to household fixtures using pipes. Empty tanks, closed valves, disconnected pipes, and broken pumps should affect water availability.

Technology: Multiple smartphone styles, a functional Ultra Phone, apps, games, charging, battery life, Wi-Fi, banking, GPS, smart-home controls, shopping, and weather alerts.

PART 6 — REALISTIC NATURE AND ANIMALS

Create varied ecosystems, including:

  • Jungles, forests, deserts, grasslands, mountains, tundra, wetlands, rivers, lakes, and oceans.
  • Extensive wildlife with appropriate habitats, animations, sounds, and behavior.
  • Whales, dolphins, sharks, fish, marine mammals, birds, reptiles, and land animals.
  • Pets that can be adopted, fed, trained, groomed, and petted.
  • Zoos, wildlife sanctuaries, aquariums, veterinary facilities, and conservation careers.
  • Beaches, swimming pools, water parks, diving, surfing, fishing, and boating.
  • Plants, trees, flowers, agriculture, and seasonal environmental changes.

PART 7 — EXTREME WEATHER AND PHYSICS

Implement a simulated environmental physics system compatible with Minecraft Bedrock.

Include:

  • Blizzards and snowstorms.
  • Tornadoes with different intensity levels.
  • Thunderstorms, lightning, hail, and heavy rain.
  • Hurricanes, typhoons, monsoons, and storm surges.
  • Floods, tsunamis, earthquakes, avalanches, droughts, and wildfires.
  • Sandstorms, fog, heatwaves, and freezing temperatures.
  • Water currents, buoyancy, controlled structural damage, falling trees, wind effects, and vehicle suspension.
  • Flood-control infrastructure: dams, levees, floodgates, pumps, drainage canals, and reservoirs.
  • Curved and circular construction pieces using custom geometry.

Use optimized approximations instead of attempting computationally expensive universal physics.

Weather must affect transport, utilities, buildings, NPC behavior, emergency services, and the economy.

PART 8 — COMPLETE SOUND SYSTEM

Create original or properly licensed sounds for:

  • Every vehicle and engine.
  • Guns, firing, handling, and reloading.
  • Animals and wildlife.
  • NPC voices and everyday human actions.
  • Footsteps on different surfaces.
  • Furniture, appliances, machinery, doors, and plumbing.
  • Rain, thunder, tornadoes, blizzards, wind, hail, and floods.
  • Rivers, waterfalls, lakes, oceans, forests, caves, and cities.
  • Emergency sirens, alarms, notifications, and communication devices.

Implement distance-based volume, environmental ambience, appropriate sound transitions, and mobile-friendly audio optimization.

PART 9 — ADD IMPORTANT FEATURES AUTONOMOUSLY

You are authorized to add important missing systems that improve realism, gameplay, immersion, stability, and long-term enjoyment.

Examples include:

  • Hospitals and advanced emergency response.
  • Public transportation and logistics.
  • Waste management and recycling.
  • Pollution and environmental conservation.
  • Research, engineering, and manufacturing.
  • Tourism and entertainment.
  • Sports and fitness.
  • Space exploration and fictional additional realms.
  • Accessibility settings.
  • Gameplay difficulty options.
  • Performance settings for low-end devices.
  • Tutorials, progression, achievements, and an in-game guide.

Make systems interconnected so the world feels alive.

PART 10 — DEVELOPMENT AND QUALITY CONTROL

Do not attempt to deliver thousands of unfinished assets in one rushed build.

Develop the project in verified milestones:

Milestone 1: Core BP/RP framework, world systems, menus, and asset pipeline.

Milestone 2: Properly rendered pistol, complete weapon architecture, and holding animations.

Milestone 3: Detailed vehicles, driving controls, and traffic prototypes.

Milestone 4: Human NPCs, appearances, animation, occupations, and daily routines.

Milestone 5: Architecture, furniture, electricity, water, plumbing, and electronics.

Milestone 6: Nature, animals, weather, disasters, and environmental audio.

Milestone 7: Expand countries, economies, education, government, families, businesses, and interconnected systems.

Milestone 8: Optimization, integration testing, bug fixes, packaging, and further content expansion.

For each milestone:

  • Provide actual implementation files.
  • Validate all JSON.
  • Check manifest references and dependencies.
  • Check model and texture paths.
  • Check animation and render-controller references.
  • Verify archive integrity.
  • Clearly distinguish automated validation from real in-game testing.
  • Document unfinished features.
  • Preserve previous working functionality.

Maintain these project documents:

  • "PROJECT_STATE.md"
  • "FEATURE_CHECKLIST.md"
  • "KNOWN_BUGS.md"
  • "TEST_RESULTS.md"
  • "CHANGELOG.md"

FINAL INSTRUCTION

Build MODERN CITY LIFE: REAL WORLD EDITION into a genuinely enjoyable Minecraft Bedrock life simulator.

I am willing to wait for quality. Do not sacrifice working features for speed.

My highest priorities are detailed 3D models, properly held guns, functional vehicles, living NPCs, interconnected realistic systems, immersive sounds, low mobile lag, and a valid importable ".mcaddon".

Start developing the actual project. Make reasonable engineering decisions autonomously, work milestone by milestone, and never pretend unfinished features are complete.

Kodari AI
KodariOct 26 at 7:48 am 1
ModernCityLifeRealWorld
Modern City Life: Real World Edition is a comprehensive Minecraft Bedrock life-simulation add-on. It creates a living world with procedurally generated cities, diverse human NPCs with detailed 3D models, occupations, relationships, and daily routines. Players can drive vehicles, use a complete weapon system with properly held guns, manage utilities like electricity and water, and experience extreme weather. The add-on features a simulated economy, government, property ownership, and interconnected systems for a realistic, immersive gameplay experience optimized for mobile devices.

This project targets Fabric for Minecraft Java Edition 26.3, while your request requires a Bedrock 1.26.40 .mcaddon. Those use different APIs, asset formats, and packaging; a Fabric mod cannot be imported into Bedrock.

I haven’t created files, since a Fabric implementation would not deliver the add-on you asked for. Please open this in a Bedrock add-on project/workspace to build the .mcaddon; or, if you want to use this project, I can adapt the first milestone for Java Edition, but it won’t run on Bedrock.

Abdul rahim Ferrer

Now for java

Kodari AI
KodariOct 26 at 7:53 am 1
  1. Initialize the Java 26.3 Fabric project scaffold and entry point.

  2. Add milestone tracking documents that clearly mark the larger systems as not yet implemented.

  3. Leave the first release as an honest foundation, not a claim of a finished life simulator.

Initialized the project for Minecraft Java Edition 26.3 with Fabric. Added the Gradle scaffold, mod entry point, Fabric metadata, and the five requested tracking documents.

This is a foundation only: no gameplay systems or assets are implemented, and it has not been compiled or tested in-game. It produces a Java mod project, not a Bedrock .mcaddon.

Abdul rahim Ferrer

Where is it

Kodari AI
KodariOct 26 at 7:53 am 1

It’s in the current project workspace:

  • Mod entry point: src/main/java/com/kodari/moderncitylife/ModernCityLife.java

  • Project tracking docs: PROJECT_STATE.md, FEATURE_CHECKLIST.md, KNOWN_BUGS.md, TEST_RESULTS.md, and CHANGELOG.md in the project root.

No jar has been built yet. To build and download it, click Compile in the top bar, then click Compile in the build window; once it succeeds, use Download.

Abdul rahim Ferrer

Qhere is it

Kodari AI
KodariOct 26 at 7:55 am 1

It’s in the project workspace. Open the project’s Files panel and look for src/main/java/com/kodari/moderncitylife/ModernCityLife.java.

If you mean the .jar, it hasn’t been built yet—click Compile in the top bar, then Compile in the window that opens.

Abdul rahim Ferrer

How can it look can you send a video

Kodari AI
KodariOct 26 at 7:56 am 1

Right now it looks like regular Minecraft—the mod is only a Java/Fabric starter scaffold, with no visible gameplay or graphics added yet. I can’t send a gameplay video from here, but I can help add the first in-game feature so you can compile it and see it for yourself.

Abdul rahim Ferrer

Im gonna post this on yotube bro send me a description for this jar and pictures

Kodari AI
KodariOct 26 at 7:57 am 1

Bro, quick heads-up: there isn’t a playable jar yet—this project is currently just the Fabric starter scaffold, with no life-sim features or in-game visuals. I can’t send real gameplay pictures without something implemented to show.

Here’s an honest YouTube description you can use for the project as it is:

Modern City Life — Java/Fabric Project Preview
This is the early foundation for a Minecraft Java life-simulation mod, built for Fabric and Minecraft 26.3. The project scaffold is in place, but gameplay features are still in development. This is a development update—not a showcase of a finished or playable life sim.

Minecraft: Java Edition 26.3
Mod loader: Fabric
Status: Early foundation

#Minecraft #MinecraftMods #FabricMod #ModDevelopment

For pictures, use actual screenshots of the project files or build window for now, and label them as development progress—not gameplay.

Abdul rahim Ferrer

Make the full jar bro now

Kodari AI
KodariOct 26 at 8:05 am 3
  1. Check the current scaffold and project scope.

  2. Turn it into a small, playable city-life mod rather than pretend a whole life simulator can fit in a starter jar.

  3. Then you can compile and download the jar from the project.

I’ve added a playable city-life prototype: choose a career, earn wages every five in-game minutes, check your profile, and spend persistent city coins in a survival shop.

Try: /citylife jobs → /citylife job farmer → /citylife work. Use /citylife shop to see what you can buy.

It’s not the full life simulator yet—vehicles, NPCs, homes, and other larger systems are still unimplemented. The jar hasn’t been built yet. To get it, click Compile in the top bar, click Compile in the window, then click Download when the build succeeds.

Abdul rahim Ferrer

Make the full jar mod men now noq pls

Kodari AI
KodariOct 26 at 8:06 am 1

The project is a playable prototype, not a complete life-simulator mod. To build its jar now:

  1. Click Compile in the top bar.

  2. Click Compile in the window that opens.

  3. After it succeeds, click Download.

Abdul rahim Ferrer

No i said build the full life simulator now pls bro

Kodari AI
KodariOct 26 at 8:14 am 2

I’ll expand the existing prototype into a broader playable life-sim foundation, prioritizing survival-friendly systems that fit a single mod release rather than claiming every possible feature is complete. First I’m checking what’s already implemented so I build on it rather than duplicate it.

  • Extend the existing persistent player profile with energy, mood, hygiene, and rest cooldowns; add gradual needs decay while online.

  • Make careers matter by requiring energy to work, and add recovery/leisure/washing services that use the existing city-coin economy.

  • Expand the commands and update the milestone docs honestly; leave NPCs, vehicles, homes, and other large systems marked as unfinished.

I expanded the playable loop with persistent energy, mood, and hygiene that decline while you’re online. Work now uses energy; rest restores it on a cooldown, while relax and wash spend city coins to restore mood and hygiene. Existing career, wallet, and shop progress remains supported.

Commands: /citylife status, /citylife rest, /citylife relax, /citylife wash, plus /citylife jobs, /citylife work, and /citylife shop.

This is still not a complete life simulator: NPCs, vehicles, physical homes, and an in-game GUI aren’t implemented, and the changes haven’t been tested in-game. To build and download the current jar, click Compile in the top bar, click Compile in the window, then Download after it succeeds.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
CHANGELOG.md
FEATURE_CHECKLIST.md
gradle.properties
KNOWN_BUGS.md
PROJECT_STATE.md
settings.gradle
TEST_RESULTS.md
Code
10 408
src/main/java/com/kodari/moderncitylife/ModernCityLife.java
package com.kodari.moderncitylife;

import com.mojang.serialization.Codec;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.fabricmc.fabric.api.attachment.v1.AttachmentRegistry;
import net.fabricmc.fabric.api.attachment.v1.AttachmentType;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.api.ModInitializer;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class ModernCityLife implements ModInitializer {
	public static final String MOD_ID = "moderncitylife";
	public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
	private static final long WORK_COOLDOWN_TICKS = 6_000L;
	private static final long NEEDS_STEP_TICKS = 1_200L;
	private static final long REST_COOLDOWN_TICKS = 12_000L;
	private static final Map<String, Integer> JOB_PAY = Map.of(
			"farmer", 8,
			"miner", 12,
			"builder", 10,
			"chef", 8
	);
	private static final AttachmentType<String> PLAYER_PROFILE = AttachmentRegistry.create(
			Identifier.fromNamespaceAndPath(MOD_ID, "player_profile"),
			builder -> builder.persistent(Codec.STRING).copyOnDeath()
	);

	@Override
	public void onInitialize() {
		ServerTickEvents.END_SERVER_TICK.register(ModernCityLife::tickNeeds);
		CommandRegistrationCallback.EVENT.register((dispatcher, buildContext, selection) -> dispatcher.register(
				Commands.literal("citylife")
						.requires(CommandSourceStack::isPlayer)
						.executes(context -> reply(context.getSource(), "Modern City Life — use /citylife jobs, /citylife work, /citylife status, /citylife rest, /citylife relax, /citylife wash, or /citylife shop."))
						.then(Commands.literal("jobs").executes(context -> reply(context.getSource(),
								"Available careers: farmer ($8/work), miner ($12/work), builder ($10/work), chef ($8/work). Choose one with /citylife job <career>.")))
						.then(Commands.literal("job")
								.then(Commands.literal("farmer").executes(context -> chooseJob(context.getSource(), "farmer")))
								.then(Commands.literal("miner").executes(context -> chooseJob(context.getSource(), "miner")))
								.then(Commands.literal("builder").executes(context -> chooseJob(context.getSource(), "builder")))
								.then(Commands.literal("chef").executes(context -> chooseJob(context.getSource(), "chef"))))
						.then(Commands.literal("work").executes(context -> work(context.getSource())))
						.then(Commands.literal("profile").executes(context -> showProfile(context.getSource())))
						.then(Commands.literal("status").executes(context -> showProfile(context.getSource())))
						.then(Commands.literal("rest").executes(context -> rest(context.getSource())))
						.then(Commands.literal("relax").executes(context -> restoreNeed(context.getSource(), 12, "relax", 0, 25, 0)))
						.then(Commands.literal("wash").executes(context -> restoreNeed(context.getSource(), 8, "wash", 0, 0, 40)))
						.then(Commands.literal("shop")
								.executes(context -> reply(context.getSource(),
										"City shop: /citylife buy bread (5), torch (3), iron (15), or beef (8). Each purchase is one item.")))
						.then(Commands.literal("buy")
								.then(Commands.literal("bread").executes(context -> purchase(context.getSource(), new ItemStack(Items.BREAD), 5, "bread")))
								.then(Commands.literal("torch").executes(context -> purchase(context.getSource(), new ItemStack(Items.TORCH), 3, "torch")))
								.then(Commands.literal("iron").executes(context -> purchase(context.getSource(), new ItemStack(Items.IRON_INGOT), 15, "iron ingot")))
								.then(Commands.literal("beef").executes(context -> purchase(context.getSource(), new ItemStack(Items.COOKED_BEEF), 8, "cooked beef"))))
		));
			LOGGER.info("Modern City Life initialized with careers, needs, services, and shop commands.");
	}

	private static void tickNeeds(MinecraftServer server) {
		long now = server.overworld().getGameTime();
		for (ServerPlayer player : server.getPlayerList().getPlayers()) {
			if (player.getAttached(PLAYER_PROFILE) == null) {
				setProfile(player, CityProfile.fresh(now));
				continue;
			}

			CityProfile profile = getProfile(player);
			long elapsed = now - profile.lastNeedsTick();
			if (elapsed < NEEDS_STEP_TICKS) {
				continue;
			}

			int moodLoss = now / (NEEDS_STEP_TICKS * 3) > profile.lastNeedsTick() / (NEEDS_STEP_TICKS * 3) ? 1 : 0;
			int hygieneLoss = now / (NEEDS_STEP_TICKS * 5) > profile.lastNeedsTick() / (NEEDS_STEP_TICKS * 5) ? 1 : 0;
			setProfile(player, new CityProfile(
					profile.job(), profile.coins(), profile.lastWorkTick(),
					Math.max(0, profile.energy() - 1),
					Math.max(0, profile.mood() - moodLoss),
					Math.max(0, profile.hygiene() - hygieneLoss),
					now, profile.lastRestTick()
			));
		}
	}

	private static int chooseJob(CommandSourceStack source, String job) throws CommandSyntaxException {
		ServerPlayer player = source.getPlayerOrException();
		CityProfile profile = getProfile(player);
		setProfile(player, new CityProfile(job, profile.coins(), profile.lastWorkTick(), profile.energy(), profile.mood(), profile.hygiene(), profile.lastNeedsTick(), profile.lastRestTick()));
		return reply(source, "Career selected: " + job + ". Use /citylife work to earn wages; work can be claimed every 5 minutes of game time.");
	}

	private static int work(CommandSourceStack source) throws CommandSyntaxException {
		ServerPlayer player = source.getPlayerOrException();
		CityProfile profile = getProfile(player);
		Integer pay = JOB_PAY.get(profile.job());
		if (pay == null) {
			return reply(source, "Choose a career first with /citylife jobs, then /citylife job <career>.");
		}
		if (profile.energy() < 12) {
			return reply(source, "You are too tired to work. Use /citylife rest to recover energy.");
		}

		long now = source.getServer().overworld().getGameTime();
		long elapsed = now - profile.lastWorkTick();
		if (elapsed < WORK_COOLDOWN_TICKS) {
			long minutesLeft = (WORK_COOLDOWN_TICKS - elapsed + 1_199L) / 1_200L;
			return reply(source, "You are still on shift cooldown. Try again in about " + minutesLeft + " minute(s).");
		}

		int newBalance = (int) Math.min(Integer.MAX_VALUE, (long) profile.coins() + pay);
		int earned = newBalance - profile.coins();
		setProfile(player, new CityProfile(profile.job(), newBalance, now, profile.energy() - 12, profile.mood(), profile.hygiene(), profile.lastNeedsTick(), profile.lastRestTick()));
		return reply(source, "Shift complete as " + profile.job() + ". Earned " + earned + " city coins and used 12 energy. Balance: " + newBalance + ".");
	}

	private static int showProfile(CommandSourceStack source) throws CommandSyntaxException {
		CityProfile profile = getProfile(source.getPlayerOrException());
		String job = JOB_PAY.containsKey(profile.job()) ? profile.job() : "unemployed";
		return reply(source, "City status — career: " + job + "; balance: " + profile.coins() + " city coins; energy: " + profile.energy() + "/100; mood: " + profile.mood() + "/100; hygiene: " + profile.hygiene() + "/100. Use /citylife rest, /citylife relax, or /citylife wash to recover.");
	}

	private static int rest(CommandSourceStack source) throws CommandSyntaxException {
		ServerPlayer player = source.getPlayerOrException();
		CityProfile profile = getProfile(player);
		long now = source.getServer().overworld().getGameTime();
		long elapsed = now - profile.lastRestTick();
		if (elapsed < REST_COOLDOWN_TICKS) {
			long minutesLeft = (REST_COOLDOWN_TICKS - elapsed + 1_199L) / 1_200L;
			return reply(source, "You need more time before resting again. Try in about " + minutesLeft + " minute(s).");
		}
		if (profile.energy() >= 100) {
			return reply(source, "You are already fully rested.");
		}

		int energy = Math.min(100, profile.energy() + 35);
		setProfile(player, new CityProfile(profile.job(), profile.coins(), profile.lastWorkTick(), energy, Math.min(100, profile.mood() + 3), profile.hygiene(), profile.lastNeedsTick(), now));
		return reply(source, "You took a break and restored energy to " + energy + "/100. Rest is available again in 10 minutes of game time.");
	}

	private static int restoreNeed(CommandSourceStack source, int price, String service, int energyGain, int moodGain, int hygieneGain) throws CommandSyntaxException {
		ServerPlayer player = source.getPlayerOrException();
		CityProfile profile = getProfile(player);
		if (profile.coins() < price) {
			return reply(source, "Not enough city coins for " + service + ". Price: " + price + "; balance: " + profile.coins() + ". Earn wages with /citylife work.");
		}

		int energy = Math.min(100, profile.energy() + energyGain);
		int mood = Math.min(100, profile.mood() + moodGain);
		int hygiene = Math.min(100, profile.hygiene() + hygieneGain);
		if (energy == profile.energy() && mood == profile.mood() && hygiene == profile.hygiene()) {
			return reply(source, "You do not need that service right now.");
		}

		int balance = profile.coins() - price;
		setProfile(player, new CityProfile(profile.job(), balance, profile.lastWorkTick(), energy, mood, hygiene, profile.lastNeedsTick(), profile.lastRestTick()));
		return reply(source, "City service: " + service + " complete for " + price + " coins. Balance: " + balance + ".");
	}

	private static int purchase(CommandSourceStack source, ItemStack item, int price, String itemName) throws CommandSyntaxException {
		ServerPlayer player = source.getPlayerOrException();
		CityProfile profile = getProfile(player);
		if (profile.coins() < price) {
			return reply(source, "Not enough city coins. Price: " + price + "; balance: " + profile.coins() + ".");
		}
		if (!player.getInventory().add(item)) {
			return reply(source, "Your inventory is full; no coins were charged.");
		}

		int balance = profile.coins() - price;
		setProfile(player, new CityProfile(profile.job(), balance, profile.lastWorkTick(), profile.energy(), profile.mood(), profile.hygiene(), profile.lastNeedsTick(), profile.lastRestTick()));
		return reply(source, "Bought 1 " + itemName + " for " + price + " city coins. Balance: " + balance + ".");
	}

	private static int reply(CommandSourceStack source, String message) {
		source.sendSuccess(() -> Component.literal(message), false);
		return 1;
	}

	private static CityProfile getProfile(ServerPlayer player) {
		String encoded = player.getAttached(PLAYER_PROFILE);
		if (encoded == null) {
			return CityProfile.fresh(0L);
		}

		String[] fields = encoded.split("\\|", -1);
		if ((fields.length != 3 && fields.length != 8) || (!fields[0].equals("unemployed") && !JOB_PAY.containsKey(fields[0]))) {
			return CityProfile.fresh(0L);