update
52
README.md
@ -1,19 +1,39 @@
|
||||
@@ -1,2 +1,17 @@
|
||||
# NBTUtils
|
||||
Minecraft NBT Utils
|
||||
Minecraft NBT Utils
|
||||
我的世界NBT工具包
|
||||
可以读取和修改mc的NBT文件(.dat .mca)
|
||||
## Minecraft NBT Utils
|
||||
## 我的世界NBT工具包
|
||||
|
||||
### 主要功能
|
||||
可以读取和修改mc的NBT文件(.dat .mca)
|
||||
可以直接编辑NBT数据
|
||||
|
||||
可以实现区块修改:
|
||||
读取方块 放置方块 复制方块集 写入方块集 旋转、镜像方块集
|
||||
|
||||
可以实现地图修改:
|
||||
读取地图文件 修改地图文件 导出地图为png png生成地图文件
|
||||
|
||||
目前实现的玩法:
|
||||
生成地图画(可以是操作区块 也可以是操作地图
|
||||
生成obj模型(带材质
|
||||
生成midi音乐(需要音符盒扩展
|
||||
|
||||
|
||||
可以实现区块修改:
|
||||
* 读取方块
|
||||
* 放置方块
|
||||
* 复制方块集
|
||||
* 写入方块集
|
||||
* 旋转方块集
|
||||
* 镜像方块集
|
||||

|
||||
|
||||
|
||||
### 可以实现地图修改:
|
||||
* 读取地图文件
|
||||
* 修改地图文件
|
||||
* 导出地图为png
|
||||
* png生成地图文件
|
||||

|
||||
|
||||
|
||||
### 目前实现的玩法:
|
||||
|
||||
* 生成地图画(可以是操作区块 也可以是操作地图
|
||||

|
||||
|
||||
|
||||
* 生成obj模型(带材质
|
||||

|
||||
|
||||
|
||||
* 生成midi音乐(需要音符盒扩展
|
||||
|
||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
BIN
img/RGB.png
Normal file
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
@ -12,11 +12,11 @@ public class Test_BlocksCollective {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
//创建
|
||||
MCRegion mcRegion = new MCRegion(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\测试地图\\region"));
|
||||
MCRegion mcRegion = new MCRegion(new File("D:\\MineCraft\\MinecraftAll\\.minecraft\\versions\\1.19.4-OptiFine_I4\\saves\\新的世界\\region"));
|
||||
//mcRegion.setSaveMode(MCRegion.SAVEMODE_RewriteAll);
|
||||
|
||||
//获取方块集
|
||||
MCBlocksCollective blocks = mcRegion.getBlocksCollective(new MCPosInt(9404, 60, 10171), new MCPosInt(9303, 97, 10098));
|
||||
MCBlocksCollective blocks = mcRegion.getBlocksCollective(new MCPosInt(20473, 0 ,12), new MCPosInt(20464 ,8, 2));
|
||||
|
||||
//替换水为蓝色羊毛
|
||||
blocks.replace(b -> {
|
||||
@ -29,10 +29,16 @@ public class Test_BlocksCollective {
|
||||
}, new MCBlock("minecraft:barrier"));
|
||||
|
||||
//设置方块集 绕y轴顺时针旋转1次
|
||||
mcRegion.setBlocksCollective(new MCPosInt(9303, 100, 10098), blocks.rotation(1, 1));
|
||||
mcRegion.setBlocksCollective(new MCPosInt(20464, 16 ,2), blocks.clone().rotation(1, 1));
|
||||
|
||||
//设置方块集 绕x轴顺时针旋转1次
|
||||
mcRegion.setBlocksCollective(new MCPosInt(20464, 24 ,2), blocks.clone().rotation(0, 1));
|
||||
|
||||
//设置方块集 y轴翻转
|
||||
mcRegion.setBlocksCollective(new MCPosInt(9303, 150, 10098), blocks.flip(false, true, false));
|
||||
mcRegion.setBlocksCollective(new MCPosInt(20464, 32 ,2), blocks.clone().flip(false, true, false));
|
||||
|
||||
//设置方块集 x轴翻转
|
||||
mcRegion.setBlocksCollective(new MCPosInt(20464, 40 ,2), blocks.clone().flip(true, false, false));
|
||||
|
||||
//保存
|
||||
mcRegion.saveMCA();
|
||||
|
@ -9,6 +9,8 @@ import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Test_Img2Map {
|
||||
@ -16,287 +18,48 @@ public class Test_Img2Map {
|
||||
|
||||
|
||||
try {
|
||||
|
||||
BufferedImage Image = ImageIO.read(new File("E:\\工程文件\\java\\NBTUtils\\src\\text\\白猫RGB.png"));
|
||||
|
||||
|
||||
BufferedImage bufferedImage = new BufferedImage(250, 250, BufferedImage.TYPE_4BYTE_ABGR);
|
||||
for (int y = 0; y < 250; y++) {
|
||||
for (int x = 0; x < 250; x++) {
|
||||
bufferedImage.setRGB(x, y, MCMapColors.byte2color(MCMapColors.color2byte(new Color(Image.getRGB(x*4, y*4)))).getRGB());
|
||||
//图片生成预览图
|
||||
BufferedImage Image = ImageIO.read(new File("img\\WhiteCat.png"));
|
||||
BufferedImage bufferedImage = new BufferedImage(256, 256, BufferedImage.TYPE_4BYTE_ABGR);
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
bufferedImage.setRGB(x, y, MCMapColors.byte2color(MCMapColors.color2byte(new Color(Image.getRGB(x * 4, y * 4)))).getRGB());
|
||||
}
|
||||
}
|
||||
ImageIO.write(bufferedImage, "png", new File("E:\\工程文件\\java\\NBTUtils\\src\\text\\白猫RGB预览.png"));
|
||||
ImageIO.write(bufferedImage, "png", new File("img\\WhiteCatPreview.png"));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*{
|
||||
MCMap mcMap = new MCMap(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\地图画测试\\data\\map_0.dat"));
|
||||
mcMap.setImg(new File("E:\\工程文件\\java\\MCNBT\\src\\text\\RGB.png"));
|
||||
{//对编号0的地图更改数据
|
||||
MCMap mcMap = new MCMap(new File("D:\\MineCraft\\MinecraftAll\\.minecraft\\versions\\1.19.4-OptiFine_I4\\saves\\新的世界\\data\\map_0.dat"));
|
||||
mcMap.setLocked(true);
|
||||
mcMap.setScale(4);
|
||||
mcMap.setXZCenter(new MCPosInt(100000000, 100000000));
|
||||
mcMap.setTrackingPosition(false);
|
||||
mcMap.setUnlimitedTracking(false);
|
||||
mcMap.setImg(new FileInputStream("img\\RGB.png"));
|
||||
mcMap.saveFile();
|
||||
}
|
||||
{
|
||||
{//对编号1到4的地图更改数据
|
||||
for (int i = 0; i < 4; i++) {
|
||||
MCMap mcMap = new MCMap(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\地图画测试\\data\\map_" + (i + 1) + ".dat"));
|
||||
mcMap.setImg(new File("E:\\工程文件\\java\\MCNBT\\src\\text\\IMG" + (i + 1) + ".png"));
|
||||
MCMap mcMap = new MCMap(new File("D:\\MineCraft\\MinecraftAll\\.minecraft\\versions\\1.19.4-OptiFine_I4\\saves\\新的世界\\data\\map_" + (i + 1) + ".dat"));
|
||||
mcMap.setLocked(true);
|
||||
mcMap.setScale(4);
|
||||
mcMap.setXZCenter(new MCPosInt(100000000 * i, 100000000));
|
||||
mcMap.setTrackingPosition(false);
|
||||
mcMap.setUnlimitedTracking(false);
|
||||
mcMap.setImg(new FileInputStream("img\\IMG" + (i + 1) + ".png"));
|
||||
mcMap.saveFile();
|
||||
}
|
||||
}*/
|
||||
/* {
|
||||
MCMap mcMap = new MCMap(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\data\\map_17.dat"));
|
||||
mcMap.save2img(new File("E:\\工程文件\\java\\MCNBT\\src\\text\\保存的地图.png"));
|
||||
}*/
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
/*try {
|
||||
MCRegion mcRegion = new MCRegion(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\BadApple\\region"));
|
||||
CompoundTag block = mcRegion.getBlockState(new MCPosInt(2 ,-60, -1));
|
||||
System.out.println(block);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
//octave=mid low high {Properties={note=0, octave=low, powered=false, instrument=harp_l}, Name=minecraft:note_block}
|
||||
|
||||
//System.out.println(MCPosInt.pos2subChunkIndex(new MCPosInt(100,-10,100)).toStr());
|
||||
//System.out.println(MCPosInt.pos2chunk2(new MCPosInt(10000,100,100)).toStr());
|
||||
|
||||
|
||||
//System.out.println(1024>> 5);
|
||||
//System.out.println(9999999>> 5);
|
||||
//System.out.println(MCPosInt.blockToChunk(-114514));
|
||||
/*System.out.println(MCPosInt.chunk2relativelyChunk(new MCPosInt(0,0)).toStr());
|
||||
|
||||
try {
|
||||
MCRegion mcRegion = new MCRegion(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\测试地图\\region"));
|
||||
|
||||
CompoundTag c = mcRegion.getBlockEntitie(new MCPosInt(4, -60, 0));
|
||||
System.out.println(c);
|
||||
|
||||
mcRegion.setBlockEntitie(new MCPosInt(10, -60, -21), c);
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
|
||||
|
||||
//System.out.println(MCUtil.getMapBitSize(33));
|
||||
//MCSubChunk mcSubChunk = new MCSubChunk(1, 4);
|
||||
//mcSubChunk.set(12, 5);
|
||||
|
||||
//System.out.println(mcSubChunk.get(12));
|
||||
//mcSubChunk.set(17, 0xf);
|
||||
//System.out.println(Long.toBinaryString(mcSubChunk.getLongArray()[0]));
|
||||
//System.out.println(BitsUtils.bits2fStr(BitSet.valueOf(mcSubChunk.getLongArray())));
|
||||
/* long a = 55;
|
||||
a = a << 10;
|
||||
System.out.println(Long.toBinaryString(a));
|
||||
System.out.println(Long.toBinaryString(a & 0xF));
|
||||
System.out.println(a & 0xF);*/
|
||||
//System.out.println(BitsUtils.bits2fStr(BitSet.valueOf(a.toLongArray())));
|
||||
//System.out.println(MCUtil.getMapBitSize(16 * 16));
|
||||
/*MCRegion mcRegion = new MCRegion(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\测试地图\\region"));
|
||||
mcRegion.setBlockState(new MCPosInt(-30, -60, 9), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(-32, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(-512, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(-513, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(32, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(-511, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(-512, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.setBlockState(new MCPosInt(-513, -60, 0), new CompoundTag().setTag("Name", "minecraft:red_wool"));
|
||||
mcRegion.upDate();*/
|
||||
//MCA mca = MCUtil.readMCAFile(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界 (1)\\region\\r.19.19.mca"));
|
||||
/* MCChunk chunk = mca.getChunk(new MCPosInt(17, 17));
|
||||
System.out.println(chunk.getBlockState(new MCPosInt(0, 100, 0)));
|
||||
|
||||
int count = 0;
|
||||
for (int j = 0; j < 50; j++) {
|
||||
count++;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
chunk.setBlockState(new CompoundTag().setTag("Name", "minecraft:diamond_block"), new MCPosInt(i, 80 + count, 0));
|
||||
}
|
||||
|
||||
count++;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
chunk.setBlockState(new CompoundTag().setTag("Name", "minecraft:gold_block"), new MCPosInt(i, 80 + count, 15));
|
||||
}
|
||||
count++;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
chunk.setBlockState(new CompoundTag().setTag("Name", "minecraft:glass"), new MCPosInt(15, 80 + count, i));
|
||||
}
|
||||
|
||||
count++;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
chunk.setBlockState(new CompoundTag().setTag("Name", "minecraft:iron_block"), new MCPosInt(0, 80 + count, i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{//将编号1的地图保存为图片
|
||||
MCMap mcMap = new MCMap(new File("D:\\MineCraft\\MinecraftAll\\.minecraft\\versions\\1.19.4-OptiFine_I4\\saves\\新的世界\\data\\map_1.dat"));
|
||||
mcMap.save2img(new FileOutputStream("img\\SavedMap.png"));
|
||||
}
|
||||
|
||||
MCUtil.writeMCAFile(mca, new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界aaa\\region\\r.19.19.mca"));*/
|
||||
|
||||
//MCRegion mcRegion=new MCRegion(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\region"));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
try {
|
||||
MCPosInt localPos = MCChunkUtils.chunk2local(MCChunkUtils.pos2chunk(new MCPosInt(10000, 10000)));
|
||||
MCA mca = MCUtil.readMCAFile(new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\region\\r." + localPos.x + "." + localPos.z + ".mca"));
|
||||
CompoundTag chunk = MCChunkUtils.findChunk(mca.chunksNBT, new MCPosInt(10000 / 16, -4, 10000 / 16));
|
||||
|
||||
|
||||
//CompoundTag az = new CompoundTag();
|
||||
//az.setCompoundTag("",new CompoundTag().setListTag("az", mca.chunksNBT));
|
||||
|
||||
// MCUtil.writeNBT(az, new FileOutputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\aaaa.dat"));
|
||||
|
||||
//System.out.println(mca.chunksNBT);
|
||||
System.out.println(MCChunkUtils.subChunkFindBlockStates(MCChunkUtils.findSubChunk(chunk, -4), new MCPosInt(0, 6, 0)).getTag("Name"));
|
||||
System.out.println(MCChunkUtils.subChunkFindBlockStates(MCChunkUtils.findSubChunk(chunk, -4), new MCPosInt(0, 6, 0)));
|
||||
|
||||
System.out.println("修改前---");
|
||||
System.out.println(MCChunkUtils.chunkFindBlockEntities(chunk, new MCPosInt(10000, -59, 10000)));
|
||||
CompoundTag block = MCChunkUtils.chunkFindBlockEntities(chunk, new MCPosInt(10000, -59, 10000)).getListTag("Items").getCompoundTag(0);
|
||||
block.setTag("id", "minecraft:diamond");
|
||||
block.setCompoundTag("tag").setCompoundTag("display").setTag("Name","{\"text\":\"ZEDO\",\"color\":\"green\"}");
|
||||
System.out.println("修改后---");
|
||||
System.out.println(MCChunkUtils.chunkFindBlockEntities(chunk, new MCPosInt(10000, -59, 10000)));
|
||||
|
||||
MCUtil.writeMCAFile(mca, new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\region\\r." + localPos.x + "." + localPos.z + ".mca"));
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*try {
|
||||
|
||||
System.out.println(MCUtil.readDATFile(new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat")));
|
||||
MCUtil.writeNBT(MCUtil.readDATFile(new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat")),new FileOutputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat.dat"));
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
|
||||
//System.out.println(BytesUtils.bytes2longA(new byte[]{ (byte) 0x64,(byte) 0x00,(byte) 0x00 ,(byte) 0xFF,(byte) 0x00 , (byte) 0x00, (byte) 0x00,(byte) 0xAA}));
|
||||
//System.out.println(BytesUtils.bytes2longA((new byte[]{ (byte) 0xAA,(byte) 0x00,(byte) 0x00 ,(byte) 0x00 ,(byte) 0xFF,(byte) 0x00, (byte) 0x00,(byte) 0x64})));
|
||||
//System.out.println(BytesUtils.bytes2fStr(BytesUtils.long2bytes(-6196953082983612316l)));
|
||||
//System.out.println("bit:" + BitsUtils.bits2fStr(BytesUtils.bytes2bitsA(new byte[]{(byte) 0x23,(byte) 0xa3,(byte) 0x89})));
|
||||
//System.out.println("bit:" + BitsUtils.bits2fStr(BytesUtils.bytes2bitsA(BytesUtils.bytes2bytesA(new byte[]{(byte) 0x23,(byte) 0xa3,(byte) 0x89}))));
|
||||
|
||||
|
||||
//ByteArrayOutputStream out =new ByteArrayOutputStream();
|
||||
//{={fml=}}
|
||||
/* CompoundTag nbt = new CompoundTag("");
|
||||
|
||||
CompoundTag nbt2 = new CompoundTag("复合标签");
|
||||
nbt2.addTag(new Tag("short", (short) 2233));
|
||||
nbt2.addTag(new Tag("int", -114514));
|
||||
nbt2.addTag(new Tag("long", 114514L));
|
||||
nbt2.addTag(new Tag("float", 2.33f));
|
||||
nbt2.addTag(new Tag("double", 223344.5566));
|
||||
nbt2.addTag(new Tag("bytes", new byte[]{0, 1, 2, -5}));
|
||||
nbt2.addTag(new Tag("ints", new int[]{11, 22, 33, 44}));
|
||||
nbt2.addTag(new Tag("longs", new long[]{11, 22, 33, 44}));
|
||||
nbt2.addTag(new Tag("string", "字符串测试"));
|
||||
|
||||
|
||||
ListTag listTag = new ListTag("longlist", TagType.TAG_Long);
|
||||
listTag.addTag(8848L);
|
||||
listTag.addTag(-6666L);
|
||||
|
||||
|
||||
ListTag listTag2 = new ListTag("复合list", TagType.TAG_Compound);
|
||||
listTag2.addTag(new CompoundTag(null).addTag(new Tag("tag1","字符串")));
|
||||
listTag2.addTag(new CompoundTag(null).addTag(new Tag("tag2","好耶")));
|
||||
|
||||
nbt.addCompoundTag(nbt2);
|
||||
nbt.addCompoundTag(new CompoundTag("套娃测试1").addCompoundTag(new CompoundTag("套娃测试2").addCompoundTag(new CompoundTag("套娃测试3"))));
|
||||
nbt.addListTag(listTag);
|
||||
nbt.addListTag(listTag2);
|
||||
|
||||
System.out.println(nbt);
|
||||
try {
|
||||
MCUtil.writeNBT(nbt, new FileOutputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\test.dat"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
//System.out.println(BytesUtils.bytes2fStr(out.toByteArray()));
|
||||
|
||||
|
||||
//ByteArrayInputStream in = new ByteArrayInputStream();
|
||||
|
||||
|
||||
/* try {
|
||||
inflaterOutputStream.flush();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
|
||||
/*try {
|
||||
System.out.println(BytesUtils.bytes2fStr(ZLibUtils.decompress(new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\map.zlib"))));
|
||||
new FileOutputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\map.zlib.dat").write(ZLibUtils.decompress(new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\map.zlib")));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
|
||||
|
||||
/*int x, z;
|
||||
x = 1;
|
||||
z = 1;
|
||||
System.out.println(4 * ((x & 31) + (z & 31) * 32));*/
|
||||
/*try {
|
||||
FileInputStream fileInputStream = new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat");
|
||||
GZIPInputStream gzipInputStream = new GZIPInputStream(fileInputStream);
|
||||
|
||||
byte[] data = ((InputStream)gzipInputStream).readAllBytes();
|
||||
System.out.println(data.length);
|
||||
|
||||
FileOutputStream fileOutputStream =new FileOutputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat.gzip");
|
||||
fileOutputStream.write(data);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
|
||||
|
||||
/* CompoundTag compoundTag;
|
||||
try {
|
||||
compoundTag = MCUtil.readDATFile(new FileInputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//System.out.println(compoundTag.getNBT("a").getNBT("aa"));
|
||||
System.out.println(compoundTag);
|
||||
//compoundTag.getCompoundTag("").getCompoundTag("Data").addTag(new Tag("LevelName","芜湖"));
|
||||
System.out.println("世界名:" + compoundTag.getCompoundTag("").getCompoundTag("Data").getTag("LevelName").getData());
|
||||
System.out.println("玩家坐标:" + compoundTag.getCompoundTag("").getCompoundTag("Data").getCompoundTag("Player").getListTag("Pos"));
|
||||
|
||||
try {
|
||||
MCUtil.writeNBT(compoundTag,new FileOutputStream("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\新的世界\\level.dat.dat"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
/*
|
||||
ListTag listTag = compoundTag.getCompoundTag("").getCompoundTag("Data").getCompoundTag("Player").getListTag("Inventory");
|
||||
for (int i = 0; i < listTag.size(); i++) {
|
||||
System.out.println(listTag.getCompoundTag(i).getTagData("Slot"));
|
||||
}*/
|
||||
|
||||
//System.out.println(((int[]) compoundTag.getCompoundTag("").getCompoundTag("Data").getCompoundTag("Player").getTag("UUID").getTag())[0]);
|
||||
//CompoundTag compoundTag = new CompoundTag("az");
|
||||
//compoundTag.addCompoundTag(new CompoundTag("ddd"));
|
||||
|
||||
//System.out.println();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class Test_Img2MapArt {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ArrayList<File> FileList = new ArrayList<>();
|
||||
File[] files = new File("E:\\工程文件\\java\\MCNBT\\src\\text\\mc").listFiles();
|
||||
File[] files = new File("mc_res/bloks").listFiles();
|
||||
for (File f : files) {
|
||||
if (f.isFile()) {
|
||||
FileList.add(f);
|
||||
@ -74,7 +74,7 @@ public class Test_Img2MapArt {
|
||||
|
||||
text.lib.ImageFilter img = null;
|
||||
try {
|
||||
img = new text.lib.ImageFilter("E:\\工程文件\\java\\MCNBT\\src\\text\\白猫RGB.png");
|
||||
img = new text.lib.ImageFilter("img/WhiteCat.png");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class Test_Img2MapArt {
|
||||
//img.Zoom(new Dimension(128, 128));
|
||||
System.out.println("开始生成");
|
||||
try {
|
||||
MCRegion mcRegion = new MCRegion(new File("E:\\MineCraft文件\\1.18.2\\.minecraft\\saves\\测试地图\\region"));
|
||||
MCRegion mcRegion = new MCRegion(new File("D:\\MineCraft\\MinecraftAll\\.minecraft\\versions\\1.19.4-OptiFine_I4\\saves\\新的世界\\region"));
|
||||
|
||||
|
||||
MCChunk chunk = mcRegion.getChunk(new MCPosInt(0, 0));
|
||||
|
@ -24,7 +24,7 @@ public class Test_OBJ {
|
||||
MCRegion mcRegion = new MCRegion(new File("D:\\MineCraft\\MinecraftAll\\.minecraft\\versions\\1.19.4-OptiFine_I4\\saves\\新的世界\\region"), 10);
|
||||
mcRegion.setGenerateChunk(mcRegion.getChunk(new MCPosInt(0, 0)));
|
||||
|
||||
File objFile = new File("D:\\Projects\\Github\\NBTUtils\\src\\test\\obj\\星穹铁道-主控舱段_by_小海新不恋爱\\星穹铁道-主控舱段_by_小海新不恋爱_细节.obj");
|
||||
File objFile = new File("D:\\Projects\\Github\\OBJ模型\\星穹铁道-主控舱段_by_小海新不恋爱\\星穹铁道-主控舱段_by_小海新不恋爱_细节.obj");
|
||||
|
||||
|
||||
MCBlockColors mcBlockColors = new MCBlockColors(new File("D:\\Projects\\Github\\NBTUtils\\src\\test\\mc_res\\bloks"));
|
||||
@ -56,6 +56,7 @@ public class Test_OBJ {
|
||||
Obj materialGroup = entry.getValue();
|
||||
System.out.println("材质名:" + materialName);
|
||||
Mtl material = findMtlForName(allMtls, materialName);
|
||||
FloatTuple kdColor = material.getKd();
|
||||
String materialPath = material.getMapKd();
|
||||
materialPath = (materialPath == null ? "" : materialPath);
|
||||
File materialFile = new File(objFile.getParent() + "\\" + materialPath.replaceAll("volume://", ""));
|
||||
@ -154,7 +155,10 @@ public class Test_OBJ {
|
||||
}
|
||||
|
||||
} else {
|
||||
color = Color.WHITE;
|
||||
if (kdColor != null)//使用漫反射颜色
|
||||
color = new Color(kdColor.get(0), kdColor.get(1), kdColor.get(2));
|
||||
else//没有颜色 设置紫色
|
||||
color = Color.MAGENTA;
|
||||
}
|
||||
|
||||
MCBlockColors.BlockColor blockColor = mcBlockColors.colorFindBlock(color);
|
||||
|
Before Width: | Height: | Size: 422 KiB |
Before Width: | Height: | Size: 631 KiB |
Before Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 752 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 259 B |
Before Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 276 B |
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 138 B |
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 84 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 298 B |
Before Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 369 B |
@ -1,6 +0,0 @@
|
||||
{
|
||||
"animation": {
|
||||
"interpolate": true,
|
||||
"frametime": 10
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 294 B |