Cursor rule
.cursor/rules/proj-compostables.mdcCursor rules
Quality
66/100
Scores the file, not the repository.Length
1,045 words
31 headings · 2 code blocksRepository
0
— · pushed 47 days agoLast changed
3 days ago
First indexed 3 days ago.1# Compostables Mod Specific Context23## Mod Overview4The Compostables mod extends Minecraft's composting functionality by making 107 organic items compostable that aren't in vanilla. This includes rotten flesh, spider eyes, eggs, meat, fish, soil blocks, chorus fruits, leather, leather armor, and paper.56## Project Structure7- `src/main/java/org/survivorsunited/mods/compostables/` - Main mod code8- `docs/` - Docusaurus documentation website9- `scripts/` - PowerShell build and deployment scripts10- `gradle.properties` - Centralized mod configuration1112## Current Implementation1314### Main Features15- 107 new compostable items with balanced chances (30% to 100%)16- Farmer villagers can collect and compost portable items17- Server-side only (no client mod required)18- Uses vanilla composter block1920### Compostable Items by Chance21- **30%**: Dead Bush, Dirt Path, Grass Block, Rooted Dirt, Muddy Mangrove Roots, Turtle Egg, Sniffer Egg, Sculk Vein22- **35%**: Bamboo23- **50%**: Podzol, Chorus Fruit, Chorus Plant, Rabbit's Foot24- **65%**: Spider Eye, Mycelium, Nylium Blocks, Popped Chorus Fruit, Egg, Raw Meat/Fish (all types), String25- **85%**: Poisonous Potato, Chorus Flower26- **100%**: All meat (raw and cooked), all fish (raw and cooked), all stews, all dyes, all carpets, all wool blocks, all leather items (leather, leather armor pieces, leather horse armor), paper, bone items, bamboo block, rotten flesh, fermented spider eye2728### Technical Implementation291. **Item Registration**: Uses `ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE` map302. **Villager Behavior**: Mixin modifies farmer profession to include new gatherable items313. **No new blocks/items**: Only extends existing composting system3233## Project-Specific Details3435### Namespace36- Mod ID: `su-compostables`37- Java package: `org.survivorsunited.mods.compostables`38- Main class: `Compostables`39- Mixin package: `org.survivorsunited.mods.compostables.mixin`4041### Key Classes42- `Compostables.java`: Registers all 107 compostable items43- `FarmerMixin.java`: Makes farmers collect portable compostable items4445## Development Guidelines4647### Java Code Standards48- Follow existing code style and patterns49- Use proper Minecraft item names (e.g., "Block of Bamboo" not "Bamboo Block")50- All composting chances should match the values in Compostables.java:51 - 30% = 0.3f, 50% = 0.5f, 65% = 0.65f, 85% = 0.85f, 100% = 1.0f52- Register items using `ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put()`53- Always log the total count of registered items5455### Important Item Names56- "Block of Bamboo" (not "Bamboo Block")57- All carpet items: "Color Carpet" (e.g., "White Carpet")58- All wool items: "Color Wool" (e.g., "White Wool")59- All dye items: "Color Dye" (e.g., "White Dye")6061### Documentation Updates62When updating mod items, ensure consistency across:63- `Compostables.java` (source of truth for percentages)64- `docs/docs/intro.md` (main documentation)65- `docs/docs/modrinth.md` (Modrinth project description)66- `README.md` (if needed)6768### Current Version69- Mod version: 1.0.4070- Minecraft: 1.21.1+71- Fabric Loader: 0.16.11+7273### Repository Secrets Required74- `MODRINTH_TOKEN`: API token from Modrinth account75- `PROJECT_ID`: Modrinth project ID (get after creating project)7677## Development Notes78- Golden items (golden carrot, golden apple) excluded as they're valuable consumables79- Soil blocks can't be picked up by villagers but players can compost them80- Balanced around vanilla composting rates81- No configuration file - all values hardcoded for consistency82- Processed organic materials (paper, leather) are 100% compost chance83- Leather items include: raw leather, leather helmet, chestplate, leggings, boots, and leather horse armor8485### Mixin Development Guidelines86When working with mixins in this project:871. **Always check runtime logs first** - The test server log at `test-server/logs/latest.log` provides exact method signatures882. **Use constructor injection for VillagerProfession** - More stable than static initializer interception893. **Watch for API changes** - Minecraft 1.21.5 changed many core APIs9091### Common Issues and Solutions9293#### VillagerProfession Mixin Failures94- **Symptom**: Compilation errors about type mismatches95- **Solution**: Check the runtime error in server logs for exact JVM descriptors96- **Example**: In 1.21.5, VillagerProfession constructor uses `Text` not `String`9798#### Build Issues99- **Java Version**: Requires Java 21100- **Build Command**: `./gradlew build` or use `.\build.ps1` on Windows101- **Test Server**: Built mod is auto-copied to `test-server/mods/`102103### Important File Locations104- Mixins: `src/main/java/org/survivorsunited/mods/compostables/mixin/`105- Mixin config: `src/main/resources/compostables.mixins.json`106- Test server logs: `test-server/logs/latest.log`107- Technical docs: `docs/technical.md`108109### FarmerMixin Implementation Details110- Injects into VillagerProfession constructor111- Adds portable compostable items to farmer's gatherable items112- Uses Text.getString() to identify farmer profession113- Compatible with Minecraft 1.21.5 API changes114115## Detailed Mixin Troubleshooting Guide116117### VillagerProfession Mixin Issues (Minecraft 1.21.5)118119#### Problem Description120When upgrading to Minecraft 1.21.5, the VillagerProfession mixin failed with compilation errors indicating incompatible types. The error showed that `String` could not be converted to `Registry<VillagerProfession>`.121122#### Root Cause123Minecraft 1.21.5 significantly changed the VillagerProfession API:124- Registration methods now require a `Registry<VillagerProfession>` as the first parameter125- Constructor signature changed from using String id to Text name126- Workstation parameters changed to use `Predicate<RegistryEntry<PointOfInterestType>>`127128#### Resolution Process1291301. **Initial Error Analysis**131 - Compilation error: `String cannot be converted to Registry<VillagerProfession>`132 - This indicated the method signature had changed1331342. **Key Debugging Steps**135 - Check the actual runtime error in `test-server/logs/latest.log`136 - The runtime error provides the EXACT expected method signature137 - Example error message:138```139 Expected (Lnet/minecraft/class_2561;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/class_3414;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V140```1411423. **Decoding the JVM Descriptors**143 - `Lnet/minecraft/class_2561;` = Text (not String)144 - `Ljava/util/function/Predicate;` = Predicate type145 - `Lnet/minecraft/class_3414;` = SoundEvent1461474. **Final Solution**148 Instead of trying to intercept static registration, inject into the constructor:149```java150 @Inject(method = "<init>", at = @At("RETURN"))151 private void modifyFarmerGatherables(Text name, Predicate<RegistryEntry<PointOfInterestType>> heldWorkstation,152 Predicate<RegistryEntry<PointOfInterestType>> acquirableWorkstation,153 ImmutableSet<Item> gatherableItems, ImmutableSet<Block> secondaryJobSites,154 SoundEvent workSound, CallbackInfo ci)155```156157#### Key Learnings1581591. **Always check runtime logs** - The test server log provides exact method signatures expected by the mixin system1602. **Constructor injection is more stable** - Injecting into constructors is often more reliable than trying to intercept static initializers1613. **JVM descriptors tell the truth** - The error messages show the exact types needed in JVM format1624. **API changes between versions** - Major Minecraft updates often change fundamental APIs163164### Quick Reference: Common Mixin Descriptor Mappings165166| JVM Descriptor | Java Type |167|----------------|-----------|168| `Lnet/minecraft/class_2561;` | `Text` |169| `Lnet/minecraft/class_3414;` | `SoundEvent` |170| `Lnet/minecraft/class_3852;` | `VillagerProfession` |171| `Ljava/util/function/Predicate;` | `Predicate<?>` |172| `Lcom/google/common/collect/ImmutableSet;` | `ImmutableSet<?>` |173174### Debugging Workflow1751761. **Build fails** → Check compilation error for type mismatches1772. **Runtime fails** → Check `test-server/logs/latest.log` for exact signatures1783. **Decode descriptors** → Map JVM types to Java types1794. **Update mixin** → Use exact types from error message1805. **Test** → Run server to verify mixin applies correctly
Also in survivorsunited/mods-su-compostables
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| survivorsunited/mods-su-compostables.cursor/rules/ci-cd-workflow.mdc · 0 | Cursor rules | setupbuildgitsecurity+3 | 63/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/development-workflow.mdc · 0 | Cursor rules | setupbuildteststyle+4 | 86/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/documentation-standards.mdc · 0 | Cursor rules | setupbuildtestlint-format+4 | 91/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/gradle-build-standards.mdc · 0 | Cursor rules | buildstyledependenciesdeployment | 78/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/java-coding-standards.mdc · 0 | Cursor rules | stylearch | 58/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/project-overview.mdc · 0 | Cursor rules | buildarchdeploymentagent-behaviour+1 | 67/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/recipe-json-standards.mdc · 0 | Cursor rules | lint-formatstylearchtypes | 62/100 | 3 days ago | |
| survivorsunited/mods-su-compostables.cursor/rules/rules.mdc · 0 | Cursor rules | buildteststylearch+4 | 92/100 | 3 days ago |
Diff against .cursor/rules/ci-cd-workflow.mdc Diff against .cursor/rules/development-workflow.mdc Diff against .cursor/rules/documentation-standards.mdc Diff against .cursor/rules/gradle-build-standards.mdc Diff against .cursor/rules/java-coding-standards.mdc Diff against .cursor/rules/project-overview.mdc Diff against .cursor/rules/recipe-json-standards.mdc Diff against .cursor/rules/rules.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
