- Explore MCP Servers
- mcp-snippets
Mcp Snippets
What is Mcp Snippets
mcp-snippets is a collection of Java code snippets designed for Minecraft mod and client development, providing utilities for animation, shaders, and raycasting.
Use cases
Use cases include creating animated user interfaces, implementing custom shaders for visual effects, and detecting player interactions with the game world through raycasting.
How to use
To use mcp-snippets, integrate the provided code examples into your Minecraft mod or client project. Ensure you have the necessary event listeners and rendering methods set up as shown in the examples.
Key features
Key features include a simple animation utility for 2D rendering, a GL shader system for custom graphics effects, and a raycasting utility to detect player interactions with entities and blocks.
Where to use
mcp-snippets can be used in the development of Minecraft mods and clients, particularly in areas requiring custom graphics, animations, and player interaction mechanics.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Snippets
mcp-snippets is a collection of Java code snippets designed for Minecraft mod and client development, providing utilities for animation, shaders, and raycasting.
Use cases
Use cases include creating animated user interfaces, implementing custom shaders for visual effects, and detecting player interactions with the game world through raycasting.
How to use
To use mcp-snippets, integrate the provided code examples into your Minecraft mod or client project. Ensure you have the necessary event listeners and rendering methods set up as shown in the examples.
Key features
Key features include a simple animation utility for 2D rendering, a GL shader system for custom graphics effects, and a raycasting utility to detect player interactions with entities and blocks.
Where to use
mcp-snippets can be used in the development of Minecraft mods and clients, particularly in areas requiring custom graphics, animations, and player interaction mechanics.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Snippets
Java code snippets for Minecraft mod / client development
Animation
A simple animation utility mainly for 2D rendering stuff
Example usage:
final Animation animation = new Animation(); @EventListener public void onRender2D(Render2DEvent event) { this.animation.animate(100, 0.03F); Gui.drawRect(0, 0, animation.getValue(), 100, -1); }
Shader
A simple GL shader system
Example shader:
@ShaderInfo(frag = "wallpaper.fsh") public class WallpaperShader extends ClientShader { @Override public void render(Object... objects) { float width = (float) objects[0]; float height = (float) objects[1]; float time = (float) objects[2]; useShader(); setUniformF("resolution", width, height); setUniformF("time", time); drawQuad(-1, -1, 1, 1); disuseShader(); } }
Example Shader Usage:
private WallpaperShader wallpaperShader; private int time; public void initGui() { this.time = System.currentTimeMillis(); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { if(wallpaperShader == null) { wallpaperShader = new WallpaperShader(); } drawDefaultBackground(); GlStateManager.enableAlpha(); GlStateManager.disableCull(); wallpaperShader.render(width, height * 2, (System.currentTimeMillis() - time) / 1000F); }
Raycast
A utility to check what the player is aiming at depending on the given rotations.
Example Usage:
double range = 3; MovingObjectPosition cast = RaycastUtil.raycast(range); if(cast != null) { if(cast.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { System.out.println("HIT ENTITY"); } else if(cast.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { System.out.println("HIT BLOCK"); } }
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










