📄
pasted-code-1787911819660.txt
txt
160 lines
▶
Create a Minecraft Java Edition 26.2 mod using Fabric.
## Goal
The mod should allow the player to see other players normally even when those players have an active Invisibility effect (Potion of Invisibility).
## Requirements
- Minecraft version: 26.2
- Mod loader: Fabric
- Use the correct and compatible Fabric Loader and Fabric API versions for Minecraft 26.2.
- The mod should be client-side only whenever technically possible.
- Players with an active Invisibility effect should be rendered normally for the player using this mod.
- Normal gameplay behavior for other players must not be changed.
- Only players should have their invisibility visually bypassed. Do not affect mobs or other entities unless this is necessary for the implementation.
- Player armor must remain visible.
- Items held in the player's hands must remain visible.
- The normal player model, skin, animations, name tag, armor, and held items should render normally.
- Do NOT remove or modify the actual Invisibility effect on the target player.
- The Invisibility effect must remain active on the target player. Only the client-side rendering should ignore the visual invisibility.
- The mod must not require a server-side mod.
- Do not modify server-side game logic.
- The mod should be lightweight and performance-friendly.
- Do not constantly scan all entities every tick if this can be avoided.
## Rendering Implementation
Find the correct and current rendering hook, method, or Mixin point in Minecraft 26.2/Fabric where the game decides whether a player should be rendered because of the Invisibility effect.
Implement a Mixin or another appropriate Fabric mechanism that prevents invisible players from being completely hidden from the client.
Important:
- Use the actual Minecraft 26.2 classes, methods, mappings, and rendering architecture.
- Do NOT copy an implementation from older Minecraft versions such as 1.20, 1.21, 1.21.5, 1.21.8, etc.
- Do not assume that old method names or rendering classes still exist.
- Verify the actual Minecraft 26.2 mappings and Fabric API before writing the implementation.
- Do not invent APIs, classes, methods, or mappings.
- The player should be rendered using their normal skin and normal player model.
- The Invisibility status should be ignored ONLY for the visual rendering of players.
- The actual potion/effect state must remain untouched.
- Other clients/players who do not have the mod should still see the target player as invisible normally.
- The mod should only change what the local client renders.
## Configuration
Add a simple configuration system with at least:
- Mod enabled/disabled
- Option to only affect other players and not the local player
- The feature should be enabled by default.
If a configuration library is not necessary, use a lightweight configuration implementation that does not add unnecessary dependencies.
## Project Structure
Create a complete, buildable Fabric mod project.
The project should include:
- build.gradle
- gradle.properties
- settings.gradle
- fabric.mod.json
- Java source code
- Required Mixin configuration files
- Configuration code
- README.md
- Any other files required for the project to compile and run correctly
Use a sensible mod ID, for example:
visibleplayers
Use a suitable mod name such as:
Visible Players
## Code Quality
- Use clean and maintainable Java code.
- Follow Fabric/Minecraft coding conventions where appropriate.
- Add comments explaining important Mixins and rendering logic.
- Avoid unnecessary dependencies.
- Avoid unnecessary event handlers or tick-based entity scanning.
- Make the implementation as efficient as possible.
- Handle edge cases gracefully.
- Make sure the mod does not cause crashes when players join, leave, respawn, change dimensions, or switch effects.
## Compatibility
The target version is STRICTLY:
Minecraft Java Edition 26.2 + Fabric
Do not target any other Minecraft version.
Do not use APIs that were removed or changed before Minecraft 26.2.
Before generating the code, verify:
1. The correct Minecraft 26.2 mappings.
2. The correct Fabric Loader version.
3. The correct Fabric API version.
4. The actual player rendering classes in Minecraft 26.2.
5. The actual method responsible for checking player invisibility during rendering.
6. The correct Mixin target and method signature for Minecraft 26.2.
7. That the resulting project can actually compile against Minecraft 26.2.
If the exact rendering implementation differs from older Minecraft versions, adapt the solution to the actual 26.2 rendering architecture instead of using outdated code.
## Important Verification Step
Before generating the final code, research and verify the actual Minecraft 26.2/Fabric source and mappings.
Do NOT make assumptions based on previous Minecraft versions.
If a particular method, class, or Mixin target cannot be verified to exist in Minecraft 26.2, do not use it.
Explain briefly which Minecraft 26.2 rendering method/class you are targeting and why it is the correct location for bypassing player invisibility visually.
## Deliverables
Provide:
1. The complete project folder structure.
2. The complete contents of every required file.
3. All Java source files.
4. The Mixin configuration.
5. fabric.mod.json.
6. Gradle configuration files.
7. Configuration implementation.
8. README.md.
9. Exact build instructions.
10. Exact installation instructions.
The final project must be directly buildable with Gradle.
Explain how to:
1. Download/open the project.
2. Run the Gradle build.
3. Find the generated `.jar`.
4. Install Fabric Loader for Minecraft 26.2.
5. Install the required Fabric API.
6. Put the generated mod `.jar` into the Minecraft `mods` folder.
7. Launch Minecraft with the Fabric 26.2 profile.
## Final Important Rule
Do not generate placeholder code.
Do not use fake or guessed Minecraft classes/methods.
Do not use outdated Minecraft 1.20/1.21 rendering code.
The implementation must specifically target the real Minecraft Java Edition 26.2 + Fabric environment.
If there are multiple technically valid approaches, choose the simplest, most reliable, and most lightweight client-side implementation.
Verify the 26.2 naming, rendering/mixin hook, and project configuration APIs.
Create the complete client-only Fabric project with lightweight JSON configuration.
Add the player-render invisibility mixin, metadata, resources, and build/install documentation.
Created the complete visibleplayers Fabric 26.2 client-only mod.
Targets
Entity.isInvisibleTo(Entity)with a client-only mixin.Reveals only invisible players; mobs and server state remain unchanged.
Preserves normal player rendering, armor, held items, animations, skins, and name tags.
Added lightweight JSON configuration:
enabledonlyAffectOtherPlayers
Uses Fabric Loader
0.19.3, Fabric API0.158.0+26.2, Java 25, and Loom 1.17.Added build configuration, Fabric metadata, mixin configuration, Java sources, and README.
Build with:
gradle build
Generated jar:
build/libs/visibleplayers-1.0.0.jar
Configuration is created at:
config/visibleplayers.json
package com.kodari.visibleplayers.client;
import net.fabricmc.api.ClientModInitializer;
public final class VisiblePlayersClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
VisiblePlayersConfigManager.load();
}
}