This is a raw java utility for generating command files for the command runner mod (commandrunnermod.com).
I use it to convert pixel art to glass and shapes. It's unfinished, but might be useful to you. It's raw code, but it's a bit hard to find stuff like this.
Largest file loaded is 90K commands from a command_block.
Lasted Updated Aug 7 2016 ... 1.9 to 1.10.2 Also the BlockDumpMod gives blockdump command which writes blocks to a text file as execute setblock commands or gives a report.
Largest file loaded is 90K commands from a command_block.
Lasted Updated Aug 7 2016 ... 1.9 to 1.10.2 Also the BlockDumpMod gives blockdump command which writes blocks to a text file as execute setblock commands or gives a report.
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThis is a raw java utility for generating command files for the command runner mod (commandrunnermod.com).
I use it to convert pixel art to glass and shapes. It's unfinished, but might be useful to you. It's raw code, but it's a bit hard to find stuff like this.
Might be useful to you if you are a java coder.
// imagetomcglass unfinished import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import javax.imageio.ImageIO; public class ImageToMCGlass { static ProcessOrientationType orient = ProcessOrientationType.flat; private static boolean whiteair = false; private static OutputType outtype = OutputType.stained_glass; public static void main(String[] args) throws IOException { // TODO Auto-generated method stub if (args.length < 4) { System.out .println("Need filename of image, outputname, flat|vertical|depthf|depthv, glass|clay|opaque"); return; } File fl = new File(args[0]); BufferedImage bi = ImageIO.read(fl); File outfile = new File(args[1]); PrintWriter pw = new PrintWriter(outfile); int height = bi.getHeight(); int width = bi.getWidth(); boolean skip = false; boolean div2=false; String colorstr = ""; String coordstr = ""; ColorUtils cu = new ColorUtils(); String execcoords = "~ ~ ~"; if (args[2].toLowerCase().trim().matches("flat")) { orient = ProcessOrientationType.flat; System.out.println("y,z up flat"); } else if (args[2].toLowerCase().trim().matches("vertical")) { orient = ProcessOrientationType.vertical; System.out.println("x,y vertical"); } else if (args[2].toLowerCase().trim().matches("depthv")) { orient = ProcessOrientationType.depthvert; System.out.println("x,y vertical"); } else if (args[2].toLowerCase().trim().matches("depthh")) { orient = ProcessOrientationType.depthflat; System.out.println("y,z flat"); } else if (args[2].toLowerCase().trim().matches("wall")) { orient = ProcessOrientationType.wall; div2=true; execcoords = "~"+(-Math.abs(height/2))+" ~ "+"~"+(-Math.abs(width/2)); System.out.println("y,z wall"); } if (args[3].toLowerCase().trim().matches("whiteair")) { whiteair = true; System.out.println("white/transparent is unmapped (air)"); } if (args[3] == "graydepth") { System.out.println("Grayscale image is mapped as depth"); // bi. } // cu. for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int color = bi.getRGB(x, y); Color clr = new Color(bi.getRGB(x, y)); int red = (color & 0xFF0000) >> 16; int green = (color & 0x00FF00) >> 8; int blue = (color & 0x0000FF); if (outtype == OutputType.stained_glass) colorstr = cu.getMCColorNameFromRgb( "minecraft:stained_glass ", red, green, blue); else if (outtype == OutputType.stained_clay) { colorstr = cu.getMCColorNameFromRgb( "minecraft:stained_clay ", red, green, blue); } if (!colorstr.startsWith("No")) { } else colorstr = "minecraft:wool 15"; // if () if (orient == ProcessOrientationType.flat) { coordstr = "setblock ~" + (height - y) + " ~ " + "~" + (width - x); } else if (orient == ProcessOrientationType.vertical) { coordstr = "setblock ~" + (width - x) + " ~" + (height - y) + " ~"; } else if (orient == ProcessOrientationType.depthvert) { int depth = 4 - (1 + ((red + blue + green) / 3) / 64); coordstr = "fill ~" + (width - x) + " ~" + (height - y) + " ~" + " ~" + (width - x) + " ~" + (height - y) + " ~" + depth; colorstr = "minecraft:stone 0"; } else if (orient == ProcessOrientationType.depthflat) { int depth = 4 - (1 + ((red + blue + green) / 3) / 64); coordstr = "fill ~" + (height - y) + " ~" + " ~" + (width - x) + " ~" + (height - y) + " ~" + depth + " ~" + (width - x); colorstr = "minecraft:quartz_block 3"; } else if (orient == ProcessOrientationType.wall) { int doit = 4 - (1 + ((red + blue + green) / 3) / 64); if ((red + blue + green) / 3 < 64) { coordstr = "fill ~" + (height - y) + " ~" + " ~" + (width - x) + " ~" + (height - y) + " ~" + 90 + " ~" + (width - x); colorstr = args[4].trim() +" 0"; skip = false; } else if (green > 224 & (red < 64 & blue < 64)) { coordstr = "fill ~" + (height - y) + " ~" + " ~" + (width - x) + " ~" + (height - y) + " ~" + " ~" + (width - x); colorstr = "minecraft:dirt 0"; skip = false; } else if (green < 64 & (red > 224 & blue < 64)) { coordstr = "fill ~" + (height - y) + " ~" + " ~" + (width - x) + " ~" + (height - y) + " ~" + " ~" + (width - x); colorstr = "minecraft:stone 3"; skip = false; } else if (green < 64 & (red < 64 & blue > 224)) { coordstr = "fill ~" + (height - y) + " ~" + " ~" + (width - x) + " ~" + (height - y) + " ~1" + " ~" + (width - x); colorstr = "minecraft:planks 3"; skip = false; } else skip = true; } if (skip) { } else { pw.println("/execute @p "+ execcoords + " " + coordstr + " " + colorstr); System.out.println("/" + coordstr + " " + colorstr + " color r" + red + " g" + green + " b" + blue); } } } pw.println(); pw.close(); // return 0; } }Colorutil
// OutputType.java public enum OutputType { stained_glass,stained_clay,opaquewiderange }// ProcessColorType.java public enum ProcessColorType { grayscale, color }// ProcessOrientationType.java public enum ProcessOrientationType { flat, vertical, depthvert, depthflat, wall }Writes the CommandRunnerMod which gives the executefile command to read commands from a file. http://mods.curse.com/mc-mods/minecraft/246088-commandrunnermod
Largest file loaded is 90K commands from a command_block.
Lasted Updated Aug 7 2016 ... 1.9 to 1.10.2 Also the BlockDumpMod gives blockdump command which writes blocks to a text file as execute setblock commands or gives a report.
-
View User Profile
-
View Posts
-
Send Message
Curse Premium400X200 Parthenon
Writes the CommandRunnerMod which gives the executefile command to read commands from a file. http://mods.curse.com/mc-mods/minecraft/246088-commandrunnermod
Largest file loaded is 90K commands from a command_block.
Lasted Updated Aug 7 2016 ... 1.9 to 1.10.2 Also the BlockDumpMod gives blockdump command which writes blocks to a text file as execute setblock commands or gives a report.