|
1 | | -# CLAUDE.md |
2 | | - |
3 | | -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
4 | | - |
5 | | -## Build Commands |
6 | | - |
7 | | -```bash |
8 | | -# Build the mod (creates JAR in build/libs/) |
9 | | -./gradlew build |
10 | | - |
11 | | -# Clean build artifacts |
12 | | -./gradlew clean |
13 | | - |
14 | | -# Run Minecraft client with the mod loaded (for testing) |
15 | | -./gradlew runClient |
16 | | - |
17 | | -# Run Minecraft server with the mod loaded |
18 | | -./gradlew runServer |
19 | | - |
20 | | -# Generate data (datagen) |
21 | | -./gradlew runDatagen |
22 | | -``` |
23 | | - |
24 | | -## Project Overview |
25 | | - |
26 | | -WesterosCraftEssentials 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. |
27 | | - |
28 | | -## Architecture |
29 | | - |
30 | | -**Entry Point**: `WesterosCraftEssentials.java` - Implements `ModInitializer`, loads config on initialization. |
31 | | - |
32 | | -**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: |
33 | | -1. Add static field to `WesterosCraftConfig` |
34 | | -2. Add corresponding field to inner `ConfigData` class |
35 | | -3. Add assignment in `load()` method |
36 | | - |
37 | | -**Mixin System**: All mixins are in `westeroscraft.mixin` package and registered in `westeroscraft-essentials.mixins.json`. Mixins inject into vanilla Minecraft classes to: |
38 | | -- Cancel behaviors (e.g., ice melting, snow melting) |
39 | | -- Override survival checks (e.g., allow snow on any surface) |
40 | | - |
41 | | -Pattern for adding new block behavior modifications: |
42 | | -1. Create mixin class in `src/main/java/westeroscraft/mixin/` |
43 | | -2. Register mixin in `src/main/resources/westeroscraft-essentials.mixins.json` |
44 | | -3. Add config option to control the behavior |
45 | | - |
46 | | -## LuckPerms Integration |
47 | | - |
48 | | -Optional permission system integration via `LuckPermsIntegration.java`. LuckPerms must be installed separately on the server. |
49 | | - |
50 | | -```java |
51 | | -// Check permission (returns true if LuckPerms not installed - fail-open) |
52 | | -LuckPermsIntegration.hasPermission(serverPlayer, "westeroscraft.somepermission"); |
53 | | - |
54 | | -// Check permission (returns false if LuckPerms not installed - fail-closed) |
55 | | -LuckPermsIntegration.hasPermissionStrict(serverPlayer, "westeroscraft.somepermission"); |
56 | | -``` |
57 | | - |
58 | | -## Auto-Restore System |
59 | | - |
60 | | -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. |
61 | | - |
62 | | -**How it works:** |
63 | | -1. Mixins (`DoorBlockMixin`, `TrapDoorBlockMixin`, `FenceGateBlockMixin`) intercept player interactions |
64 | | -2. If player has the configured permission (default: `westeroscraft.autorestore`), the original state is recorded |
65 | | -3. After a configurable delay, the block reverts to its original state |
66 | | -4. Creative mode players are exempt - their changes are permanent and cancel pending restores |
67 | | - |
68 | | -**Config structure** (in `config/westeroscraft-essentials.json`): |
69 | | -```json |
70 | | -{ |
71 | | - "autoRestore": { |
72 | | - "enabled": true, |
73 | | - "delaySeconds": 30, |
74 | | - "permission": "westeroscraft.autorestore", |
75 | | - "allDoors": false, |
76 | | - "allGates": false, |
77 | | - "allTrapDoors": false, |
78 | | - "doors": ["minecraft:oak_door"], |
79 | | - "gates": ["minecraft:oak_fence_gate"], |
80 | | - "trapDoors": ["minecraft:oak_trapdoor"] |
81 | | - } |
82 | | -} |
83 | | -``` |
84 | | - |
85 | | -Use `allDoors`/`allGates`/`allTrapDoors` to apply to all blocks of that type, or specify individual block IDs in the lists. |
86 | | - |
87 | | -## Key Dependencies |
88 | | - |
89 | | -- Fabric Loader 0.18.4+ |
90 | | -- Fabric API |
91 | | -- Minecraft 1.21.1 |
92 | | -- Java 21 |
93 | | -- LuckPerms API 5.4 (compileOnly - optional runtime dependency) |
94 | | -- Uses official Mojang mappings (not Yarn) |
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build Commands |
| 6 | + |
| 7 | +```bash |
| 8 | +# Build the mod (creates JAR in build/libs/) |
| 9 | +./gradlew build |
| 10 | + |
| 11 | +# Clean build artifacts |
| 12 | +./gradlew clean |
| 13 | + |
| 14 | +# Run Minecraft client with the mod loaded (for testing) |
| 15 | +./gradlew runClient |
| 16 | + |
| 17 | +# Run Minecraft server with the mod loaded |
| 18 | +./gradlew runServer |
| 19 | + |
| 20 | +# Generate data (datagen) |
| 21 | +./gradlew runDatagen |
| 22 | +``` |
| 23 | + |
| 24 | +## Project Overview |
| 25 | + |
| 26 | +WesterosCraftEssentials 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. |
| 27 | + |
| 28 | +## Architecture |
| 29 | + |
| 30 | +**Entry Point**: `WesterosCraftEssentials.java` - Implements `ModInitializer`, loads config on initialization. |
| 31 | + |
| 32 | +**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: |
| 33 | +1. Add static field to `WesterosCraftConfig` |
| 34 | +2. Add corresponding field to inner `ConfigData` class |
| 35 | +3. Add assignment in `load()` method |
| 36 | + |
| 37 | +**Mixin System**: All mixins are in `westeroscraft.mixin` package and registered in `westeroscraft-essentials.mixins.json`. Mixins inject into vanilla Minecraft classes to: |
| 38 | +- Cancel behaviors (e.g., ice melting, snow melting) |
| 39 | +- Override survival checks (e.g., allow snow on any surface) |
| 40 | + |
| 41 | +Pattern for adding new block behavior modifications: |
| 42 | +1. Create mixin class in `src/main/java/westeroscraft/mixin/` |
| 43 | +2. Register mixin in `src/main/resources/westeroscraft-essentials.mixins.json` |
| 44 | +3. Add config option to control the behavior |
| 45 | + |
| 46 | +## LuckPerms Integration |
| 47 | + |
| 48 | +Optional permission system integration via `LuckPermsIntegration.java`. LuckPerms must be installed separately on the server. |
| 49 | + |
| 50 | +```java |
| 51 | +// Check permission (returns true if LuckPerms not installed - fail-open) |
| 52 | +LuckPermsIntegration.hasPermission(serverPlayer, "westeroscraft.somepermission"); |
| 53 | + |
| 54 | +// Check permission (returns false if LuckPerms not installed - fail-closed) |
| 55 | +LuckPermsIntegration.hasPermissionStrict(serverPlayer, "westeroscraft.somepermission"); |
| 56 | +``` |
| 57 | + |
| 58 | +## Auto-Restore System |
| 59 | + |
| 60 | +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. |
| 61 | + |
| 62 | +**How it works:** |
| 63 | +1. Mixins (`DoorBlockMixin`, `TrapDoorBlockMixin`, `FenceGateBlockMixin`) intercept player interactions |
| 64 | +2. If player has the configured permission (default: `westeroscraft.autorestore`), the original state is recorded |
| 65 | +3. After a configurable delay, the block reverts to its original state |
| 66 | +4. Creative mode players are exempt - their changes are permanent and cancel pending restores |
| 67 | + |
| 68 | +**Config structure** (in `config/westeroscraft-essentials.json`): |
| 69 | +```json |
| 70 | +{ |
| 71 | + "autoRestore": { |
| 72 | + "enabled": true, |
| 73 | + "delaySeconds": 30, |
| 74 | + "permission": "westeroscraft.autorestore", |
| 75 | + "allDoors": false, |
| 76 | + "allGates": false, |
| 77 | + "allTrapDoors": false, |
| 78 | + "doors": ["minecraft:oak_door"], |
| 79 | + "gates": ["minecraft:oak_fence_gate"], |
| 80 | + "trapDoors": ["minecraft:oak_trapdoor"] |
| 81 | + } |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +Use `allDoors`/`allGates`/`allTrapDoors` to apply to all blocks of that type, or specify individual block IDs in the lists. |
| 86 | + |
| 87 | +## Key Dependencies |
| 88 | + |
| 89 | +- Fabric Loader 0.18.4+ |
| 90 | +- Fabric API |
| 91 | +- Minecraft 1.21.1 |
| 92 | +- Java 21 |
| 93 | +- LuckPerms API 5.4 (compileOnly - optional runtime dependency) |
| 94 | +- Uses official Mojang mappings (not Yarn) |
0 commit comments