some work on the blueprint database, new unique id concept

This commit is contained in:
Player 2013-11-18 16:06:38 +01:00
parent 7594b70a2e
commit a035a15632
8 changed files with 432 additions and 207 deletions

View file

@ -173,7 +173,8 @@ public class BuildCraftCore {
BCLog.initLog(); BCLog.initLog();
BlueprintDatabase.configFolder = evt.getModConfigurationDirectory(); BlueprintDatabase.init(evt.getModConfigurationDirectory());
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf")); mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));
try { try {
mainConfiguration.load(); mainConfiguration.load();

View file

@ -13,12 +13,14 @@ import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.ItemBuildCraft; import buildcraft.core.ItemBuildCraft;
import buildcraft.core.utils.NBTUtils; import buildcraft.core.utils.NBTUtils;
import buildcraft.core.utils.StringUtils; import buildcraft.core.utils.StringUtils;
import java.util.List; import java.util.List;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import buildcraft.builders.blueprints.BlueprintId;
public abstract class ItemBlueprint extends ItemBuildCraft { public abstract class ItemBlueprint extends ItemBuildCraft {
public ItemBlueprint(int i) { public ItemBlueprint(int i) {
@ -39,11 +41,14 @@ public abstract class ItemBlueprint extends ItemBuildCraft {
} }
public static Blueprint getBlueprint(ItemStack stack) { public static Blueprint getBlueprint(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ItemBlueprint) {
NBTTagCompound nbt = NBTUtils.getItemData(stack); NBTTagCompound nbt = NBTUtils.getItemData(stack);
UUID uuid = NBTUtils.readUUID(nbt, "blueprint"); byte[] idRaw = nbt.getByteArray("blueprint");
return BlueprintDatabase.getBlueprint(uuid); BlueprintId id = BlueprintId.fromRawId(idRaw);
}
if (id == null) {
return null; return null;
} else {
return BlueprintDatabase.get(id);
}
} }
} }

View file

@ -93,14 +93,14 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
blueprint.anchorOrientation = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); blueprint.anchorOrientation = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
BlueprintDatabase.addBlueprint(blueprint); BlueprintDatabase.add(blueprint);
setInventorySlotContents(1, blueprint.getBlueprintItem()); setInventorySlotContents(1, blueprint.getBlueprintItem());
setInventorySlotContents(0, null); setInventorySlotContents(0, null);
} }
private Blueprint createMaskBlueprint(Box box) { private Blueprint createMaskBlueprint(Box box) {
Blueprint blueprint = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ()); Blueprint blueprint = Blueprint.create(box.sizeX(), box.sizeY(), box.sizeZ());
for (int x = box.xMin; x <= box.xMax; ++x) { for (int x = box.xMin; x <= box.xMax; ++x) {
for (int y = box.yMin; y <= box.yMax; ++y) { for (int y = box.yMin; y <= box.yMax; ++y) {
@ -120,7 +120,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
} }
private Blueprint createStandardBlueprint(Box box) { private Blueprint createStandardBlueprint(Box box) {
Blueprint blueprint = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ()); Blueprint blueprint = Blueprint.create(box.sizeX(), box.sizeY(), box.sizeZ());
for (int x = box.xMin; x <= box.xMax; ++x) { for (int x = box.xMin; x <= box.xMax; ++x) {
for (int y = box.yMin; y <= box.yMax; ++y) { for (int y = box.yMin; y <= box.yMax; ++y) {

View file

@ -13,16 +13,18 @@ import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.BCLog; import buildcraft.core.utils.BCLog;
import buildcraft.core.utils.NBTUtils; import buildcraft.core.utils.NBTUtils;
import buildcraft.factory.TileQuarry; import buildcraft.factory.TileQuarry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.UUID;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
/** /**
@ -30,42 +32,82 @@ import net.minecraftforge.common.ForgeDirection;
* world. * world.
* *
* @author CovertJaguar <http://www.railcraft.info/> * @author CovertJaguar <http://www.railcraft.info/>
* @author Player
*/ */
public class Blueprint { public class Blueprint {
private BlueprintMeta meta;
private final String version = "Blueprint-2.0";
private final UUID uuid;
private String name;
private String creator;
private final Schematic[][][] schematics; private final Schematic[][][] schematics;
public final int sizeX, sizeY, sizeZ; public final int sizeX, sizeY, sizeZ;
public int anchorX, anchorY, anchorZ; public int anchorX, anchorY, anchorZ;
public ForgeDirection anchorOrientation = ForgeDirection.NORTH; public ForgeDirection anchorOrientation = ForgeDirection.NORTH;
private List<ItemStack> costs; private List<ItemStack> costs;
public Blueprint(int sizeX, int sizeY, int sizeZ) { public static Blueprint create(int sizeX, int sizeY, int sizeZ) {
this(sizeX, sizeY, sizeZ, UUID.randomUUID()); return new Blueprint(new BlueprintMeta(), sizeX, sizeY, sizeZ);
} }
private Blueprint(int sizeX, int sizeY, int sizeZ, UUID uuid) { private Blueprint(BlueprintMeta meta, int sizeX, int sizeY, int sizeZ) {
this.uuid = uuid; this.meta = meta;
this.sizeX = sizeX; this.sizeX = sizeX;
this.sizeY = sizeY; this.sizeY = sizeY;
this.sizeZ = sizeZ; this.sizeZ = sizeZ;
schematics = new Schematic[sizeX][sizeY][sizeZ]; schematics = new Schematic[sizeX][sizeY][sizeZ];
} }
protected Blueprint(BlueprintMeta meta, NBTTagCompound nbt) {
this(meta, nbt.getInteger("sizeX"),
nbt.getInteger("sizeY"),
nbt.getInteger("sizeZ"));
anchorX = nbt.getInteger("anchorX");
anchorY = nbt.getInteger("anchorY");
anchorZ = nbt.getInteger("anchorZ");
anchorOrientation = ForgeDirection.getOrientation(nbt.getByte("anchorOrientation"));
NBTTagList blockList = nbt.getTagList("blocks");
for (int i = 0; i < blockList.tagCount(); i++) {
NBTTagCompound blockNBT = (NBTTagCompound) blockList.tagAt(i);
Schematic schematic = Schematic.createSchematicFromNBT(blockNBT);
schematics[schematic.x][schematic.y][schematic.z] = schematic;
}
}
public BlueprintId getId() {
return meta.getId();
}
protected void setId(BlueprintId id) {
meta.setId(id);
}
public String getName() { public String getName() {
return name; return meta.getName();
} }
public void setName(String name) { public void setName(String name) {
this.name = name; meta.setName(name);
}
/**
* @return the creator
*/
public String getCreator() {
return meta.getCreator();
}
/**
* @param creator the creator to set
*/
public void setCreator(String creator) {
meta.setCreator(creator);
} }
private void setSchematic(int x, int y, int z, Schematic schematic) { private void setSchematic(int x, int y, int z, Schematic schematic) {
if (schematic == null) if (getId() != null) throw new IllegalStateException("modifying finalized blueprint");
return;
schematic.x = x; schematic.x = x;
schematic.y = y; schematic.y = y;
schematic.z = z; schematic.z = z;
@ -124,10 +166,6 @@ public class Blueprint {
return schematics[x][y][z]; return schematics[x][y][z];
} }
public UUID getUUID() {
return uuid;
}
/** /**
* Returns a list of all blocks in the Blueprint in the order they should be * Returns a list of all blocks in the Blueprint in the order they should be
* built. * built.
@ -174,7 +212,10 @@ public class Blueprint {
} }
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(NBTTagCompound nbt) {
meta.writeToNBT(nbt);
NBTTagList blockList = new NBTTagList(); NBTTagList blockList = new NBTTagList();
for (int y = 0; y < sizeY; y++) { for (int y = 0; y < sizeY; y++) {
for (int x = 0; x < sizeX; x++) { for (int x = 0; x < sizeX; x++) {
for (int z = 0; z < sizeZ; z++) { for (int z = 0; z < sizeZ; z++) {
@ -186,12 +227,8 @@ public class Blueprint {
} }
} }
} }
nbt.setTag("blocks", blockList); nbt.setTag("blocks", blockList);
nbt.setLong("uuidMost", uuid.getMostSignificantBits());
nbt.setLong("uuidLeast", uuid.getLeastSignificantBits());
nbt.setString("name", name);
nbt.setString("version", version);
nbt.setString("creator", creator);
nbt.setInteger("sizeX", sizeX); nbt.setInteger("sizeX", sizeX);
nbt.setInteger("sizeY", sizeY); nbt.setInteger("sizeY", sizeY);
nbt.setInteger("sizeZ", sizeZ); nbt.setInteger("sizeZ", sizeZ);
@ -201,46 +238,7 @@ public class Blueprint {
nbt.setByte("anchorOrientation", (byte) anchorOrientation.ordinal()); nbt.setByte("anchorOrientation", (byte) anchorOrientation.ordinal());
} }
public static Blueprint readFromNBT(NBTTagCompound nbt) {
long most = nbt.getLong("uuidMost");
long least = nbt.getLong("uuidLeast");
int sizeX = nbt.getInteger("sizeX");
int sizeY = nbt.getInteger("sizeY");
int sizeZ = nbt.getInteger("sizeZ");
Blueprint blueprint = new Blueprint(sizeX, sizeY, sizeZ, new UUID(most, least));
blueprint.name = nbt.getString("name");
blueprint.creator = nbt.getString("creator");
blueprint.anchorX = nbt.getInteger("anchorX");
blueprint.anchorY = nbt.getInteger("anchorY");
blueprint.anchorZ = nbt.getInteger("anchorZ");
blueprint.anchorOrientation = ForgeDirection.getOrientation(nbt.getByte("anchorOrientation"));
NBTTagList blockList = nbt.getTagList("blocks");
for (int i = 0; i < blockList.tagCount(); i++) {
NBTTagCompound blockNBT = (NBTTagCompound) blockList.tagAt(i);
Schematic schematic = Schematic.createSchematicFromNBT(blockNBT);
blueprint.schematics[schematic.x][schematic.y][schematic.z] = schematic;
}
return blueprint;
}
/**
* @return the creator
*/
public String getCreator() {
return creator;
}
/**
* @param creator the creator to set
*/
public void setCreator(String creator) {
this.creator = creator;
}
public void rotateLeft() { public void rotateLeft() {
anchorOrientation = anchorOrientation.getRotation(ForgeDirection.DOWN); anchorOrientation = anchorOrientation.getRotation(ForgeDirection.DOWN);
@ -249,7 +247,7 @@ public class Blueprint {
public ItemStack getBlueprintItem() { public ItemStack getBlueprintItem() {
ItemStack blueprint = new ItemStack(BuildCraftBuilders.blueprintItem, 1, 1); ItemStack blueprint = new ItemStack(BuildCraftBuilders.blueprintItem, 1, 1);
NBTTagCompound nbt = NBTUtils.getItemData(blueprint); NBTTagCompound nbt = NBTUtils.getItemData(blueprint);
NBTUtils.writeUUID(nbt, "blueprint", uuid); nbt.setByteArray("blueprint", getId().toRawId());
return blueprint; return blueprint;
} }
} }

View file

@ -8,127 +8,225 @@
*/ */
package buildcraft.builders.blueprints; package buildcraft.builders.blueprints;
import cpw.mods.fml.relauncher.Side; import java.io.ByteArrayInputStream;
import cpw.mods.fml.relauncher.SideOnly; import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.WeakHashMap;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
/** /**
* *
* @author Player
* @author CovertJaguar <http://www.railcraft.info/> * @author CovertJaguar <http://www.railcraft.info/>
*/ */
public class BlueprintDatabase { public class BlueprintDatabase {
public static void init(File configDir) {
blueprintFolder = new File(new File(configDir, "buildcraft"), "blueprints");
public static File configFolder; if (!blueprintFolder.exists()) blueprintFolder.mkdirs();
private static Map<UUID, Blueprint> blueprints = new HashMap<UUID, Blueprint>();
public static Blueprint getBlueprint(UUID uuid) { loadIndex();
if(uuid == null)
return null;
Blueprint blueprint = blueprints.get(uuid);
if (blueprint == null) {
blueprint = loadBlueprint(uuid);
addBlueprint(blueprint);
}
return blueprint;
} }
public static void addBlueprint(Blueprint blueprint) { public static Blueprint get(BlueprintId id) {
if (blueprint == null) Blueprint ret = blueprints.get(id);
return;
blueprints.put(blueprint.getUUID(), blueprint); if (ret == null) {
BlueprintMeta meta = blueprintMetas.get(id);
if (meta == null) return null; // no meta -> no bpt as well
ret = load(meta);
} }
private static File getBlueprintFolder() { return ret;
File blueprintFolder = new File(configFolder, "buildcraft/blueprints/");
if (!blueprintFolder.exists()) {
blueprintFolder.mkdirs();
}
return blueprintFolder;
} }
private static String uuidToString(UUID uuid) { public static BlueprintId add(Blueprint blueprint) {
return String.format(Locale.ENGLISH, "%x%x", uuid.getMostSignificantBits(), uuid.getLeastSignificantBits()); BlueprintId id = save(blueprint);
blueprint.setId(id);
blueprints.put(id, blueprint);
return id;
} }
public static void saveBlueprint(Blueprint blueprint) { private static BlueprintId save(Blueprint blueprint) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
blueprint.writeToNBT(nbt); blueprint.writeToNBT(nbt);
File blueprintFile = new File(getBlueprintFolder(), String.format(Locale.ENGLISH, "%x%x-%s.nbt", uuidToString(blueprint.getUUID()), blueprint.getName())); ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(bos);
if (blueprintFile.exists())
return;
try { try {
NBTBase.writeNamedTag(nbt, os);
} catch (IOException e) {
throw new RuntimeException(e);
}
byte[] data = bos.toByteArray();
BlueprintId id = BlueprintId.generate(data);
File blueprintFile = new File(blueprintFolder, String.format(Locale.ENGLISH, "%s-%s.nbt", id.toString(), blueprint.getName()));
if (!blueprintFile.exists()) {
OutputStream gzOs = null;
try {
gzOs = new GZIPOutputStream(new FileOutputStream(blueprintFile));
gzOs.write(data);
CompressedStreamTools.write(nbt, blueprintFile); CompressedStreamTools.write(nbt, blueprintFile);
} catch (IOException ex) { } catch (IOException ex) {
Logger.getLogger("Buildcraft").log(Level.SEVERE, String.format("Failed to save Blueprint file: %s %s", blueprintFile.getName(), ex.getMessage())); Logger.getLogger("Buildcraft").log(Level.SEVERE, String.format("Failed to save Blueprint file: %s %s", blueprintFile.getName(), ex.getMessage()));
} finally {
try {
if (gzOs != null) gzOs.close();
} catch (IOException e) { }
} }
} }
public static void saveBlueprints() { return id;
for (Blueprint blueprint : blueprints.values()) {
saveBlueprint(blueprint);
}
} }
private static Blueprint loadBlueprint(final UUID uuid) { private static void loadIndex() {
FilenameFilter filter = new FilenameFilter() { FilenameFilter filter = new FilenameFilter() {
private String uuidString = uuidToString(uuid);
@Override @Override
public boolean accept(File dir, String name) { public boolean accept(File dir, String name) {
return name.startsWith(uuidString); return name.endsWith(fileExt);
} }
}; };
NBTTagCompound nbt = null;
File blueprintFolder = getBlueprintFolder();
for (File blueprintFile : blueprintFolder.listFiles(filter)) { for (File blueprintFile : blueprintFolder.listFiles(filter)) {
RawBlueprint rawBlueprint = load(blueprintFile);
if (rawBlueprint == null) {
// TODO: delete?
continue;
}
BlueprintMeta meta;
try { try {
nbt = CompressedStreamTools.read(blueprintFile); meta = new BlueprintMeta(rawBlueprint.id, rawBlueprint.nbt);
break; } catch (Exception e) {
} catch (IOException ex) { // TODO: delete?
Logger.getLogger("Buildcraft").log(Level.SEVERE, String.format("Failed to load Blueprint file: %s %s", blueprintFile.getName(), ex.getMessage())); continue;
}
// TODO: check if the filename is matching id+name
BlueprintMeta prevValue = blueprintMetas.put(meta.getId(), meta);
if (prevValue != null) {
// TODO: duplicate entry, handle
}
} }
} }
if (nbt == null) { private static Blueprint load(final BlueprintMeta meta) {
FilenameFilter filter = new FilenameFilter() {
String prefix = meta.getId().toString();
@Override
public boolean accept(File dir, String name) {
return name.endsWith(fileExt) && name.startsWith(prefix);
}
};
for (File blueprintFile : blueprintFolder.listFiles(filter)) {
RawBlueprint rawBlueprint = load(blueprintFile);
if (rawBlueprint == null) {
continue;
}
Blueprint blueprint;
try {
blueprint = new Blueprint(meta, rawBlueprint.nbt);
} catch (Exception e) {
// TODO: delete?
continue;
}
blueprints.put(blueprint.getId(), blueprint);
return blueprint;
}
return null; return null;
} }
return Blueprint.readFromNBT(nbt);
}
public static void loadBlueprints() { private static RawBlueprint load(File file) {
FilenameFilter filter = new FilenameFilter() { InputStream fileIs = null;
@Override ByteArrayOutputStream decompressedStream;
public boolean accept(File dir, String name) {
return name.endsWith(".nbt");
}
};
File blueprintFolder = getBlueprintFolder();
for (File blueprintFile : blueprintFolder.listFiles(filter)) {
try { try {
NBTTagCompound nbt = CompressedStreamTools.read(blueprintFile); fileIs = new GZIPInputStream(new FileInputStream(file), bufferSize);
addBlueprint(Blueprint.readFromNBT(nbt)); decompressedStream = new ByteArrayOutputStream(bufferSize * 4);
} catch (IOException ex) { byte buffer[] = new byte[bufferSize];
Logger.getLogger("Buildcraft").log(Level.SEVERE, String.format("Failed to load Blueprint file: %s %s", blueprintFile.getName(), ex.getMessage())); int len;
}
while ((len = fileIs.read(buffer)) != -1) {
decompressedStream.write(buffer, 0, len);
} }
} catch (IOException e) {
Logger.getLogger("Buildcraft").log(Level.SEVERE, String.format("Failed to load Blueprint file: %s %s", file.getName(), e.getMessage()));
return null;
} finally {
try {
fileIs.close();
} catch (IOException e) {}
} }
@SideOnly(Side.CLIENT) byte[] data = decompressedStream.toByteArray();
public static void sendBlueprintsToServer() { BlueprintId id = BlueprintId.generate(data);
// TODO
DataInputStream dataIs = new DataInputStream(new ByteArrayInputStream(data));
NBTTagCompound nbt;
try {
nbt = CompressedStreamTools.read(dataIs);
} catch (IOException e) {
return null;
} }
return new RawBlueprint(id, nbt);
}
private static class RawBlueprint {
RawBlueprint(BlueprintId id, NBTTagCompound nbt) {
this.id = id;
this.nbt = nbt;
}
final BlueprintId id;
final NBTTagCompound nbt;
}
private static final int bufferSize = 8192;
private static final String fileExt = ".bpt";
private static File blueprintFolder;
private static Map<BlueprintId, BlueprintMeta> blueprintMetas = new HashMap<BlueprintId, BlueprintMeta>();
private static Map<BlueprintId, Blueprint> blueprints = new WeakHashMap<BlueprintId, Blueprint>();
} }

View file

@ -0,0 +1,64 @@
package buildcraft.builders.blueprints;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
public final class BlueprintId {
public static BlueprintId generate(byte[] data) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] id = digest.digest(data);
return new BlueprintId(id);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
public static BlueprintId fromRawId(byte[] id) {
if (id.length != 32) return null;
return new BlueprintId(id);
}
private BlueprintId(byte[] id) {
this.id = id;
}
public byte[] toRawId() {
return id;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof BlueprintId) {
return Arrays.equals(id, ((BlueprintId) obj).id);
} else {
return false;
}
}
@Override
public int hashCode() {
return Arrays.hashCode(id);
}
@Override
public String toString() {
char[] ret = new char[id.length * 2];
for (int i = 0; i < id.length; i++) {
ret[i * 2] = toHex(id[i] >>> 4);
ret[i * 2 + 1] = toHex(id[i] & 0xf);
}
return new String(ret);
}
private char toHex(int i) {
return (char) (i < 10 ? '0' + i : 'a' - 10 + i);
}
private final byte[] id;
}

View file

@ -0,0 +1,60 @@
package buildcraft.builders.blueprints;
import net.minecraft.nbt.NBTTagCompound;
public class BlueprintMeta {
private final String version = "Blueprint-2.0";
private BlueprintId id;
private String name;
private String creator;
protected BlueprintMeta() {
}
protected BlueprintMeta(BlueprintId id, NBTTagCompound nbt) {
this.id = id;
name = nbt.getString("name");
creator = nbt.getString("creator");
}
protected BlueprintId getId() {
return id;
}
protected void setId(BlueprintId id) {
this.id = id;
}
protected String getName() {
return name;
}
protected void setName(String name) {
if (getId() != null) throw new IllegalStateException("modifying finalized blueprint");
this.name = name;
}
/**
* @return the creator
*/
protected String getCreator() {
return creator;
}
/**
* @param creator the creator to set
*/
protected void setCreator(String creator) {
if (getId() != null) throw new IllegalStateException("modifying finalized blueprint");
this.creator = creator;
}
protected void writeToNBT(NBTTagCompound nbt) {
nbt.setString("name", name);
nbt.setString("version", version);
nbt.setString("creator", creator);
}
}

View file

@ -51,7 +51,6 @@ import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type; import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import static net.minecraftforge.common.ForgeDirection.*;
public class TileQuarry extends TileBuildCraft implements IMachine, IPowerReceptor, IBuilderInventory { public class TileQuarry extends TileBuildCraft implements IMachine, IPowerReceptor, IBuilderInventory {
@ -619,7 +618,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
} }
private void initializeBlueprintBuilder() { private void initializeBlueprintBuilder() {
Blueprint blueprint = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ()); Blueprint blueprint = Blueprint.create(box.sizeX(), box.sizeY(), box.sizeZ());
for (int it = 0; it < 2; it++) { for (int it = 0; it < 2; it++) {
for (int i = 0; i < blueprint.sizeX; ++i) { for (int i = 0; i < blueprint.sizeX; ++i) {