LibShapeDraw is a Minecraft client mod that is required by other mods. It doesn't do anything on its own. Rather, it provides a set of flexible and powerful drawing and animation tools for those other mods to use.
If you want to see some of the things LibShapeDraw is capable of, there is a Demos mod available on the downloads page.
An even better showcase is to look at actual mods that use LibShapeDraw. Here's a screenshot of BuildRegion:
Here's a sneak preview of a mod that's in development, which uses LibShapeDraw to render trails behind entities, including mobs and projectiles. You'll be able to see exactly where that arrow came from or where that ender pearl is heading to!
There are many, many more uses for LibShapeDraw. Please submit screenshots and videos to this thread! Also, if you're a mod author whose mod uses LibShapeDraw, I'd be happy to add a link here for you.
Installation
First of all, make sure that either ModLoader or Forge is installed. LibShapeDraw is compatible with either.
Next, download the jar and do one of the following, whichever you prefer:
Use a launcher utility to add the jar (recommended). There are many launchers out there, e.g. Magic Launcher.
OR
Move the jar file to Forge's coremods subdirectory. This subdirectory can be found in your Minecraft directory. If you use ModLoader rather than Forge, use the mods subdirectory instead of coremods.
OR
Manually patch the contents of the jar file into your minecraft.jar. Old-school modding still works. Be sure to remove the META-INF folder.
Compatibility
LibShapeDraw was designed with compatibility in mind. It does not modify any vanilla classes and therefore should be compatible with virtually every mod that works with ModLoader or Forge.
If it's not, the next step is to verify that LibShapeDraw is installed properly. Browse to your Minecraft directory and look for a mods/LibShapeDraw subdirectory. There should be a file named LibShapeDraw.log in it; you can open it in a text editor. If this file doesn't exist or has an old timestamp then LibShapeDraw is not installed correctly. Try reinstalling.
If you're still stuck with a specific problem, see the contact section at the bottom. Please have the crash report and LibShapeDraw.log handy.
If your mod could use any of the following things, LibShapeDraw is the library for you:
The ability to create arbitrary shapes and draw in the game world itselfwithout having to mess with OpenGL contexts, finding a render hook, or other tedious details.
The ability to smoothly animate shapes (and anything else, really) using the easy-to-use Trident animation library built-in to LibShapeDraw.
Vector3 and Color classes, full of well-documented and throughly-tested convenience methods. Want to calculate the pitch and yaw angles between two 3-dimensional points in a couple lines of code? No problem.
Design goals
LibShapeDraw is designed to be easy to use, both for devs and for players. These are the design goals to that end:
Minimal dependencies. Either ModLoader or Forge is required to get up and running. That's all.
Maximal compatibility. LibShapeDraw does not modify the bytecode of any vanilla Minecraft class. You are free to modify Minecraft classes in your own mod if needed; LibShapeDraw will not interfere.
Unobtrusive. Pick and choose the components you want to use. LibShapeDraw is a toolkit for your mod to use. It is not a heavy DoEverythingThisWay framework.
Powerful. What good is an API that doesn't let you do cool stuff? Check the demos for some of the many possibilities.
Concise and clear. Convenience methods, fluent interfaces, etc. let you write less code to do more. That's what LibShapeDraw is all about.
Well-documented. The key to success for any API, really.
Throughly tested. A full JUnit test suite to help prevent bugs.
Open source. MIT-licensed and open to community feedback and patches.
Enough high-level overview stuff. Let's dive in and actually use the API:
Basic usage
Add the jar to your project's classpath and instantiate LibShapeDraw somewhere in your code. Create and add some Shapes for the API instance to render.
Each Shape type is defined using classes like Color, Vector3, and ShapeTransform. You can easily animate a shape by calling animateStart and animateStop on these classes.
Plenty of sample code is available; see the Documentation section below. Here's a quick example:
// Create a 1x1x1 wireframe box at x=0, y=63 (sea level), z=0.
this.libShapeDraw = new LibShapeDraw();
Vector3 pointA = new Vector3(0, 63, 0);
Vector3 pointB = new Vector3(1, 64, 1);
WireframeCuboid shape = new WireframeCuboid(pointA, pointB);
Color lineColor = Color.CYAN.copy();
shape.setLineStyle(lineColor, 2.0F, false);
libShapeDraw.addShape(shape);
// Reposition it up a dozen blocks and make it 2x1x1 instead of 1x1x1.
pointA.addY(12.0);
pointB.addY(12.0).addX(1.0);
// Animate it! Smoothly change color from cyan to green and back every 5
// seconds, and also spin in place, rotating once every 7 seconds.
lineColor.animateStartLoop(Color.GREEN, true, 5000);
ShapeRotate rotate = new ShapeRotate(0.0, Axis.Y);
shape.addTransform(rotate);
rotate.animateStartLoop(360.0, false, 7000);
How to add the LibShapeDraw jar to the classpath in MCP
Minecraft Coder Pack (MCP) is an excellent tool for creating mods, letting you work with deobfuscated Minecraft code. Using external libraries (such as LibShapeDraw) involves a few extra steps:
Get a copy of a LibShapeDraw release jar. You can use either the normal release or the special dev release (named LibShapeDraw-VERSION-dev.jar). Check the downloads list for the latest.
The dev release is recommended: either release type will work for compiling your mod, but the dev release also lets you test/debug your MCP mod without doing a full reobfuscate/deploy.
Copy the LibShapeDraw jar to jars/bin.
Edit conf/mcp.cfg. Scroll down to the [RECOMPILE] section. There is a property named ClassPathClient; this is where we will add a reference to the LibShapeDraw jar. Add
,%(DirJars)s/bin/LibShapeDraw-VERSION-dev.jar
(changing VERSION as appropriate) to the end of the line.
If you are using ModLoader, also copy the LibShapeDraw jar to jars/mods. Skip this step if you're using Forge.
If you are using Eclipse, add the LibShapeDraw jar to the project's build path. Go to the Project Explorer pane and expand jars/bin. Right-click the LibShapeDraw jar, Build Path, Add to Build Path.
The dev release also includes the source code for convenience, giving you easy access to the Javadocs in your IDE. Documentation
How would I use this to make an item like a marker where its uses would let me draw on existing blocks like a real marker?
Rollback Post to RevisionRollBack
Check out my mods: Kinyoshi Mods (which includes Ancient Tree Root, Bone Ore, Chert Craft, Corn Nuts, Desert Cotton Plant, Desert Grund Plant, Desert Petrified Wood and misc tweaks).https://sites.google.com/site/kinyoshimods/
How would I use this to make an item like a marker where its uses would let me draw on existing blocks like a real marker?
Hi Kinyoshi, sorry I didn't see your reply earlier. I had set up this thread in the "WIP Mods" forum as a placeholder. Just released version 1.0 today.
Anyway to answer your question: that's a neat concept! Here's how I'd go about it:
Make the new item. There are numerous tutorials on how to do this. I believe ModLoader has some methods to facilitate this.
In onTickInGame, check if the player is holding the mouse button down while holding the marker item. If they are, do some ray tracing, based on the player's pitch/yaw hitting the block's face. This is probably the trickiest part.
Once you've got the position on the block that you want to doodle on, here's where LibShapeDraw can make your life easier. I'd suggest using a WireframeLines instance for each continuous doodle. You can add a point every so often as the user moves the mouse around. Be sure to make the doodle a little bit (~0.01 blocks) away from the block so it doesn't intersect with the block's face; intersections can render weird.
I haven't tried it yet. I'm still working on trying to get armor settings to work with modloader. I was going to use one of my chert items to make chalk that could be made with chert and glowstone dust to make glow chalk where you could draw arrows pointing the way out as you explore caves. I get lost alot.
Rollback Post to RevisionRollBack
Check out my mods: Kinyoshi Mods (which includes Ancient Tree Root, Bone Ore, Chert Craft, Corn Nuts, Desert Cotton Plant, Desert Grund Plant, Desert Petrified Wood and misc tweaks).https://sites.google.com/site/kinyoshimods/
Yes. Because no vanilla classes are modified, you can install LibShapeDraw that way if you like.
EDIT - The above statement is only true if you're using ModLoader. If you're using Forge instead, use the coremods directory instead. Apologies for any confusion.
Yes. Because no vanilla classes are modified, you can install LibShapeDraw that way if you like.
It didn't work from the mods folder for me; it was causing an error when loading BuildRegion. My guess is that it was attempting to load BuildRegion first, which failed due to LibShapeDraw not being loaded yet.
Installing LibShapeDraw inside Minecraft.jar fixed it for me.
20 November 2012: LibShapeDraw 1.3 released for Minecraft 1.4.5; see changelog for details.
04 December 2012: LibShapeDraw 1.3.1 released, still for Minecraft 1.4.5. This release is primarily for addressing compatibility issues; see changelog for details.
The Meaning of Life, the Universe, and Everything.
Join Date:
1/5/2012
Posts:
62
Member Details
Great work Bencvt,
Thank you for taking the time to make an open source project. I'm looking into doing some client side decoration of vanilla blocks for a Runecraft sequel. I'm already well versed in OpenGL. Would you still recommend using LibShapeDraw for a Forge mod given that they've changed the way that Forge hooks events?
updated for Minecraft 1.4.5
LibShapeDraw is a Minecraft client mod that is required by other mods. It doesn't do anything on its own. Rather, it provides a set of flexible and powerful drawing and animation tools for those other mods to use.
Download LibShapeDraw 1.3.1 for Minecraft 1.4.5 here.
Older versions are also available on the downloads page.
Demo
An even better showcase is to look at actual mods that use LibShapeDraw. Here's a screenshot of BuildRegion:
Here's a sneak preview of a mod that's in development, which uses LibShapeDraw to render trails behind entities, including mobs and projectiles. You'll be able to see exactly where that arrow came from or where that ender pearl is heading to!
There are many, many more uses for LibShapeDraw. Please submit screenshots and videos to this thread! Also, if you're a mod author whose mod uses LibShapeDraw, I'd be happy to add a link here for you.
Installation
First of all, make sure that either ModLoader or Forge is installed. LibShapeDraw is compatible with either.
Next, download the jar and do one of the following, whichever you prefer:
Compatibility
LibShapeDraw was designed with compatibility in mind. It does not modify any vanilla classes and therefore should be compatible with virtually every mod that works with ModLoader or Forge.
Troubleshooting
If Minecraft is crashing, check Minecraft Game Client Support on minecraftforums.net as a first step.
If it's not, the next step is to verify that LibShapeDraw is installed properly. Browse to your Minecraft directory and look for a mods/LibShapeDraw subdirectory. There should be a file named LibShapeDraw.log in it; you can open it in a text editor. If this file doesn't exist or has an old timestamp then LibShapeDraw is not installed correctly. Try reinstalling.
If you're still stuck with a specific problem, see the contact section at the bottom. Please have the crash report and LibShapeDraw.log handy.
________________________________________________________________________________For Developers
If your mod could use any of the following things, LibShapeDraw is the library for you:
LibShapeDraw is designed to be easy to use, both for devs and for players. These are the design goals to that end:
Basic usage
Add the jar to your project's classpath and instantiate LibShapeDraw somewhere in your code. Create and add some Shapes for the API instance to render.
Each Shape type is defined using classes like Color, Vector3, and ShapeTransform. You can easily animate a shape by calling animateStart and animateStop on these classes.
Plenty of sample code is available; see the Documentation section below. Here's a quick example:
How to add the LibShapeDraw jar to the classpath in MCP
Minecraft Coder Pack (MCP) is an excellent tool for creating mods, letting you work with deobfuscated Minecraft code. Using external libraries (such as LibShapeDraw) involves a few extra steps:
This project's official GitHub repo is located at github.com/bencvt/LibShapeDraw. Anyone is free to open an issue.
Feel free to post in this minecraftforums.net thread as well.
Finally, feel free to ping me (bencvt) in IRC. I'm often lurking in various channels related to Minecraft development on esper.net and freenode.net.
Other mods by bencvt
BuildRegion | ExtraFluffy | LibShapeDraw | McPacketSniffer | NoSoundLag | more...
BuildRegion | ExtraFluffy | LibShapeDraw | McPacketSniffer | NoSoundLag | more...
Hi Kinyoshi, sorry I didn't see your reply earlier. I had set up this thread in the "WIP Mods" forum as a placeholder. Just released version 1.0 today.
Anyway to answer your question: that's a neat concept! Here's how I'd go about it:
BuildRegion | ExtraFluffy | LibShapeDraw | McPacketSniffer | NoSoundLag | more...
Updates at twitter: https://twitter.com/luacs1998
Yes. Because no vanilla classes are modified, you can install LibShapeDraw that way if you like.
EDIT - The above statement is only true if you're using ModLoader. If you're using Forge instead, use the coremods directory instead. Apologies for any confusion.
BuildRegion | ExtraFluffy | LibShapeDraw | McPacketSniffer | NoSoundLag | more...
It didn't work from the mods folder for me; it was causing an error when loading BuildRegion. My guess is that it was attempting to load BuildRegion first, which failed due to LibShapeDraw not being loaded yet.
Installing LibShapeDraw inside Minecraft.jar fixed it for me.
This is mostly a maintenance release; a few minor changes are listed in the changelog.
BuildRegion | ExtraFluffy | LibShapeDraw | McPacketSniffer | NoSoundLag | more...
04 December 2012: LibShapeDraw 1.3.1 released, still for Minecraft 1.4.5. This release is primarily for addressing compatibility issues; see changelog for details.
BuildRegion | ExtraFluffy | LibShapeDraw | McPacketSniffer | NoSoundLag | more...
Thank you for taking the time to make an open source project. I'm looking into doing some client side decoration of vanilla blocks for a Runecraft sequel. I'm already well versed in OpenGL. Would you still recommend using LibShapeDraw for a Forge mod given that they've changed the way that Forge hooks events?