-
Notifications
You must be signed in to change notification settings - Fork 497
/
BlockSchematic.java
40 lines (34 loc) · 1 KB
/
BlockSchematic.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package buildcraft.api.builder;
import net.minecraft.nbt.NBTTagCompound;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public final class BlockSchematic {
public final String blockName;
public int metadata = 0;
public NBTTagCompound blockData = null;
public int x, y, z;
public BlockSchematic(String blockName) {
this.blockName = blockName;
}
public void writeToNBT(NBTTagCompound nbt) {
nbt.setString("blockName", blockName);
nbt.setByte("metadata", (byte) metadata);
nbt.setInteger("x", x);
nbt.setInteger("y", y);
nbt.setInteger("z", z);
nbt.setCompoundTag("blockData", blockData);
}
public static BlockSchematic readFromNBT(NBTTagCompound nbt) {
BlockSchematic block = new BlockSchematic(nbt.getString("blockName"));
block.metadata = nbt.getInteger("metadata");
block.x = nbt.getInteger("x");
block.y = nbt.getInteger("y");
block.z = nbt.getInteger("z");
if (nbt.hasKey("blockData")) {
block.blockData = nbt.getCompoundTag("blockData");
}
return block;
}
}