This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build the mod (creates JAR in build/libs/)
./gradlew build
# Clean build artifacts
./gradlew clean
# Run Minecraft client with the mod loaded (for testing)
./gradlew runClient
# Run Minecraft server with the mod loaded
./gradlew runServer
# Generate data (datagen)
./gradlew runDatagenWesterosCraftEssentials is a Fabric mod for Minecraft 1.21.1 that provides server-side gameplay modifications for the WesterosCraft server. It uses mixins to modify vanilla Minecraft behavior.
Entry Point: WesterosCraftEssentials.java - Implements ModInitializer, loads config on initialization.
Configuration System: config/WesterosCraftConfig.java - JSON-based config stored at config/westeroscraft-essentials.json. Static fields are loaded from JSON at startup. To add a new config option:
- Add static field to
WesterosCraftConfig - Add corresponding field to inner
ConfigDataclass - Add assignment in
load()method
Mixin System: All mixins are in westeroscraft.mixin package and registered in westeroscraft-essentials.mixins.json. Mixins inject into vanilla Minecraft classes to:
- Cancel behaviors (e.g., ice melting, snow melting)
- Override survival checks (e.g., allow snow on any surface)
Pattern for adding new block behavior modifications:
- Create mixin class in
src/main/java/westeroscraft/mixin/ - Register mixin in
src/main/resources/westeroscraft-essentials.mixins.json - Add config option to control the behavior
Optional permission system integration via LuckPermsIntegration.java. LuckPerms must be installed separately on the server.
// Check permission (returns true if LuckPerms not installed - fail-open)
LuckPermsIntegration.hasPermission(serverPlayer, "westeroscraft.somepermission");
// Check permission (returns false if LuckPerms not installed - fail-closed)
LuckPermsIntegration.hasPermissionStrict(serverPlayer, "westeroscraft.somepermission");The restore/AutoRestoreManager.java handles automatic restoration of doors, trapdoors, and fence gates for players with a specific permission. Used for creative servers where guests can interact with doors but changes should revert.
How it works:
- Mixins (
DoorBlockMixin,TrapDoorBlockMixin,FenceGateBlockMixin) intercept player interactions - If player has the configured permission (default:
westeroscraft.autorestore), the original state is recorded - After a configurable delay, the block reverts to its original state
- Creative mode players are exempt - their changes are permanent and cancel pending restores
Config structure (in config/westeroscraft-essentials.json):
{
"autoRestore": {
"enabled": true,
"delaySeconds": 30,
"permission": "westeroscraft.autorestore",
"allDoors": false,
"allGates": false,
"allTrapDoors": false,
"doors": ["minecraft:oak_door"],
"gates": ["minecraft:oak_fence_gate"],
"trapDoors": ["minecraft:oak_trapdoor"]
}
}Use allDoors/allGates/allTrapDoors to apply to all blocks of that type, or specify individual block IDs in the lists.
- Fabric Loader 0.18.4+
- Fabric API
- Minecraft 1.21.1
- Java 21
- LuckPerms API 5.4 (compileOnly - optional runtime dependency)
- Uses official Mojang mappings (not Yarn)