initiated replacement of schematics with updated version of original Bpt code
This commit is contained in:
parent
b4deff27bd
commit
51f0580374
41 changed files with 677 additions and 1414 deletions
|
@ -9,9 +9,6 @@
|
|||
package buildcraft;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -52,7 +49,6 @@ import buildcraft.builders.BlockPathMarker;
|
|||
import buildcraft.builders.BuilderProxy;
|
||||
import buildcraft.builders.EventHandlerBuilders;
|
||||
import buildcraft.builders.GuiHandler;
|
||||
import buildcraft.builders.IBuilderHook;
|
||||
import buildcraft.builders.ItemBlueprintStandard;
|
||||
import buildcraft.builders.ItemBlueprintTemplate;
|
||||
import buildcraft.builders.TileArchitect;
|
||||
|
@ -81,8 +77,6 @@ import buildcraft.builders.urbanism.UrbanistToolsIconProvider;
|
|||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.InterModComms;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
import buildcraft.core.blueprints.BptRootIndex;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BCLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
@ -118,9 +112,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
public static int fillerLifespanTough;
|
||||
public static int fillerLifespanNormal;
|
||||
public static ActionFiller[] fillerActions;
|
||||
private static BptRootIndex rootBptIndex;
|
||||
public static TreeMap<String, BptPlayerIndex> playerLibrary = new TreeMap<String, BptPlayerIndex>();
|
||||
private static LinkedList<IBuilderHook> hooks = new LinkedList<IBuilderHook>();
|
||||
@Instance("BuildCraft|Builders")
|
||||
public static BuildCraftBuilders instance;
|
||||
|
||||
|
@ -357,40 +348,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
InterModComms.processIMC(event);
|
||||
}
|
||||
|
||||
public static BptPlayerIndex getPlayerIndex(String name) {
|
||||
BptRootIndex rootIndex = getBptRootIndex();
|
||||
|
||||
if (!playerLibrary.containsKey(name)) {
|
||||
try {
|
||||
playerLibrary.put(name, new BptPlayerIndex(name + ".list", rootIndex));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return playerLibrary.get(name);
|
||||
}
|
||||
|
||||
public static BptRootIndex getBptRootIndex() {
|
||||
if (rootBptIndex == null) {
|
||||
try {
|
||||
rootBptIndex = new BptRootIndex("index.txt");
|
||||
rootBptIndex.loadIndex();
|
||||
|
||||
for (IBuilderHook hook : hooks) {
|
||||
hook.rootIndexInitialized(rootBptIndex);
|
||||
}
|
||||
|
||||
rootBptIndex.importNewFiles();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return rootBptIndex;
|
||||
}
|
||||
|
||||
public static ItemStack getBptItemStack(Item item, int damage, String name) {
|
||||
ItemStack stack = new ItemStack(item, 1, damage);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
@ -401,12 +358,6 @@ public class BuildCraftBuilders extends BuildCraftMod {
|
|||
return stack;
|
||||
}
|
||||
|
||||
public static void addHook(IBuilderHook hook) {
|
||||
if (!hooks.contains(hook)) {
|
||||
hooks.add(hook);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ServerStop(FMLServerStoppingEvent event) {
|
||||
TilePathMarker.clearAvailableMarkersList();
|
||||
|
|
|
@ -15,7 +15,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* This class records a slot, either from a blueprint or from a block placed in the world.
|
||||
* This class records a slot, either from a blueprint or from a block placed in
|
||||
* the world.
|
||||
*/
|
||||
public class BptSlotInfo {
|
||||
|
||||
|
@ -26,13 +27,17 @@ public class BptSlotInfo {
|
|||
public int z;
|
||||
|
||||
/**
|
||||
* This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this list or compute their own int BptBlock.
|
||||
* This field contains requirements for a given block when stored in the
|
||||
* blueprint. Modders can either rely on this list or compute their own int
|
||||
* BptBlock.
|
||||
*/
|
||||
public LinkedList<ItemStack> storedRequirements = new LinkedList<ItemStack>();
|
||||
|
||||
/**
|
||||
* This tree contains additional data to be stored in the blueprint. By default, it will be initialized from BptBlock.initializeFromWorld with the standard
|
||||
* readNBT function of the corresponding tile (if any) and will be loaded from BptBlock.buildBlock using the standard writeNBT function.
|
||||
* This tree contains additional data to be stored in the blueprint. By
|
||||
* default, it will be initialized from BptBlock.initializeFromWorld with
|
||||
* the standard readNBT function of the corresponding tile (if any) and will
|
||||
* be loaded from BptBlock.buildBlock using the standard writeNBT function.
|
||||
*/
|
||||
public NBTTagCompound cpt = new NBTTagCompound();
|
||||
|
||||
|
|
|
@ -8,35 +8,15 @@
|
|||
*/
|
||||
package buildcraft.api.blueprints;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.core.Position;
|
||||
|
||||
/**
|
||||
* This interface provide contextual information when building or initializing blueprint slots.
|
||||
* This interface provide contextual information when building or initializing
|
||||
* blueprint slots.
|
||||
*/
|
||||
public interface IBptContext {
|
||||
|
||||
/**
|
||||
* If bptItemStack is an ItemStack extracted from the blueprint containing this mapping, this will return an item stack with the id of the current world
|
||||
*/
|
||||
public ItemStack mapItemStack(ItemStack bptItemStack);
|
||||
|
||||
/**
|
||||
* Blueprints may be created in a world with a given id setting, and then ported to a world with different ids. Heuristics are used to retreive these new
|
||||
* ids automatically. This interface provide services to map ids from a blueprints to current ids in the world, and should be used whenever storing block
|
||||
* numbers or item stacks in blueprints..
|
||||
*/
|
||||
public int mapWorldId(int bptWorldId);
|
||||
|
||||
/**
|
||||
* This asks the id mapping to store a mapping from this Id, which may be either an itemId or a blockId. In effect, the blueprint will record it and make it
|
||||
* available upon blueprint load. Note that block present in the blueprint are automatically stored upon blueprint save, so this is really only needed when
|
||||
* writing ids that are e.g. in inventory stacks.
|
||||
*/
|
||||
public void storeId(int worldId);
|
||||
|
||||
public Position rotatePositionLeft(Position pos);
|
||||
|
||||
public IBox surroundingBox();
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
*/
|
||||
package buildcraft.api.filler;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IBox;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IFillerPattern {
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.urbanism.RenderBoxProvider;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
|
@ -16,7 +15,7 @@ public class BuilderProxyClient extends BuilderProxy {
|
|||
|
||||
@Override
|
||||
public void registerClientHook() {
|
||||
BuildCraftBuilders.addHook(new ClientBuilderHook());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
import buildcraft.core.blueprints.BptRootIndex;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ClientBuilderHook implements IBuilderHook {
|
||||
|
||||
@Override
|
||||
public void rootIndexInitialized(BptRootIndex rootBptIndex) throws IOException {
|
||||
BptPlayerIndex playerIndex = new BptPlayerIndex(CoreProxy.proxy.playerName() + ".list", rootBptIndex);
|
||||
BuildCraftBuilders.playerLibrary.put(CoreProxy.proxy.playerName(), playerIndex);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.core.blueprints.BptRootIndex;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface IBuilderHook {
|
||||
|
||||
public void rootIndexInitialized(BptRootIndex rootBptIndex) throws IOException;
|
||||
|
||||
}
|
|
@ -14,10 +14,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.utils.NBTUtils;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -31,23 +31,23 @@ public abstract class ItemBlueprint extends ItemBuildCraft {
|
|||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
// TODO: This code will break in SMP, put name and creator in NBT
|
||||
Blueprint blueprint = getBlueprint(stack);
|
||||
BlueprintBase blueprint = getBlueprint(stack);
|
||||
if (blueprint != null) {
|
||||
list.add(String.format(StringUtils.localize("item.blueprint.name"), blueprint.getName()));
|
||||
list.add(String.format(StringUtils.localize("item.blueprint.creator"), blueprint.getCreator()));
|
||||
list.add(String.format(StringUtils.localize("item.blueprint.name"), blueprint.id.name));
|
||||
list.add(String.format(StringUtils.localize("item.blueprint.creator"), blueprint.author));
|
||||
} else
|
||||
list.add(StringUtils.localize("item.blueprint.blank"));
|
||||
}
|
||||
|
||||
public static ItemStack getBlueprintItem(Blueprint blueprint) {
|
||||
public static ItemStack getBlueprintItem(BlueprintBase blueprint) {
|
||||
ItemStack stack = new ItemStack(BuildCraftBuilders.blueprintItem, 1, 1);
|
||||
NBTTagCompound nbt = NBTUtils.getItemData(stack);
|
||||
blueprint.getId().write (nbt);
|
||||
blueprint.id.write (nbt);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
public static Blueprint getBlueprint(ItemStack stack) {
|
||||
public static BlueprintBase getBlueprint(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlueprintTemplate extends ItemBptBase {
|
||||
public class ItemBlueprintTemplate extends ItemBlueprint {
|
||||
private IIcon usedTemplate;
|
||||
|
||||
public ItemBlueprintTemplate() {
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
|
||||
public abstract class ItemBptBase extends ItemBuildCraft {
|
||||
|
||||
public ItemBptBase() {
|
||||
super(CreativeTabBuildCraft.TIER_3);
|
||||
|
||||
maxStackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "all" })
|
||||
// @Override (client only)
|
||||
public abstract IIcon getIconFromDamage(int i);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "all" })
|
||||
// @Override (client only)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean advanced) {
|
||||
if (itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BptName")) {
|
||||
list.add(itemstack.getTagCompound().getString("BptName"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(itemStack.getItemDamage());
|
||||
if (bpt != null)
|
||||
return BuildCraftBuilders.getBptItemStack(itemStack.getItem(), itemStack.getItemDamage(), bpt.getName());
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) {
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemBptBluePrint extends ItemBptBase {
|
||||
|
||||
private IIcon cleanBlueprint;
|
||||
private IIcon usedBlueprint;
|
||||
|
||||
public ItemBptBluePrint() {
|
||||
super();
|
||||
setCreativeTab(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i) {
|
||||
if (i == 0)
|
||||
return cleanBlueprint;
|
||||
else
|
||||
return usedBlueprint;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
cleanBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_clean");
|
||||
usedBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_used");
|
||||
}
|
||||
}
|
|
@ -22,10 +22,10 @@ import buildcraft.core.Box;
|
|||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.IBoxProvider;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.blueprints.BptBlueprint;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.blueprints.BptContext;
|
||||
import buildcraft.core.blueprints.BptTemplate;
|
||||
import buildcraft.core.blueprints.Template;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
import buildcraft.core.network.RPC;
|
||||
import buildcraft.core.network.RPCHandler;
|
||||
|
@ -88,19 +88,19 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
return;
|
||||
}
|
||||
|
||||
BptBase result;
|
||||
BlueprintBase result;
|
||||
BptContext context = null;
|
||||
|
||||
if (items[0].getItem() instanceof ItemBlueprintTemplate) {
|
||||
if (items[0].getItem() instanceof ItemBlueprint) {
|
||||
result = createBptBlueprint();
|
||||
context = new BptContext(worldObj, (Blueprint) result, box);
|
||||
} else {
|
||||
result = createBptTemplate();
|
||||
context = new BptContext(worldObj, null, box);
|
||||
} else {
|
||||
result = createBptBlueprint();
|
||||
context = new BptContext(worldObj, (BptBlueprint) result, box);
|
||||
}
|
||||
|
||||
if (!name.equals("")) {
|
||||
result.setName(name);
|
||||
result.id.name = name;
|
||||
}
|
||||
|
||||
result.anchorX = xCoord - box.xMin;
|
||||
|
@ -123,22 +123,14 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
result.rotateLeft(context);
|
||||
}
|
||||
|
||||
ItemStack stack;
|
||||
BuildCraftBuilders.serverDB.add(result);
|
||||
|
||||
if (result.equals(BuildCraftBuilders.getBptRootIndex().getBluePrint(lastBptId))) {
|
||||
result = BuildCraftBuilders.getBptRootIndex().getBluePrint(lastBptId);
|
||||
stack = BuildCraftBuilders.getBptItemStack(items[0].getItem(), lastBptId, result.getName());
|
||||
} else {
|
||||
int bptId = BuildCraftBuilders.getBptRootIndex().storeBluePrint(result);
|
||||
stack = BuildCraftBuilders.getBptItemStack(items[0].getItem(), bptId, result.getName());
|
||||
lastBptId = bptId;
|
||||
}
|
||||
|
||||
setInventorySlotContents(1, stack);
|
||||
setInventorySlotContents(1, ItemBlueprint.getBlueprintItem(result));
|
||||
setInventorySlotContents(0, null);
|
||||
}
|
||||
|
||||
public BptBase createBptTemplate() {
|
||||
public BlueprintBase createBptTemplate() {
|
||||
int mask1 = 1;
|
||||
int mask0 = 0;
|
||||
|
||||
|
@ -147,7 +139,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
mask0 = 1;
|
||||
}
|
||||
|
||||
BptBase result = new BptTemplate(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
BlueprintBase result = new Template(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
for (int x = box.xMin; x <= box.xMax; ++x) {
|
||||
for (int y = box.yMin; y <= box.yMax; ++y) {
|
||||
|
@ -164,8 +156,8 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
|
|||
return result;
|
||||
}
|
||||
|
||||
private BptBase createBptBlueprint() {
|
||||
BptBlueprint result = new BptBlueprint(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
private BlueprintBase createBptBlueprint() {
|
||||
Blueprint result = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
BptContext context = new BptContext(worldObj, result, box);
|
||||
|
||||
|
|
|
@ -8,19 +8,6 @@
|
|||
*/
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
import buildcraft.core.network.RPC;
|
||||
import buildcraft.core.network.RPCHandler;
|
||||
import buildcraft.core.network.RPCSide;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -29,6 +16,15 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.inventory.InvUtils;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
import buildcraft.core.network.RPC;
|
||||
import buildcraft.core.network.RPCHandler;
|
||||
import buildcraft.core.network.RPCSide;
|
||||
|
||||
/**
|
||||
* In this implementation, the blueprint library is the interface to the
|
||||
|
@ -44,7 +40,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
@NetworkData
|
||||
public String owner = "";
|
||||
|
||||
private ArrayList<BptBase> currentPage;
|
||||
private ArrayList<BlueprintBase> currentPage;
|
||||
|
||||
public LinkedList <String> currentBlueprint = new LinkedList <String> ();
|
||||
|
||||
|
@ -60,14 +56,14 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
setCurrentPage(getNextPage(null));
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<BptBase> getNextPage(String after) {
|
||||
ArrayList<BptBase> result = new ArrayList<BptBase>();
|
||||
public ArrayList<BlueprintBase> getNextPage(String after) {
|
||||
/*ArrayList<BlueprintBase> result = new ArrayList<BlueprintBase>();
|
||||
|
||||
BptPlayerIndex index = BuildCraftBuilders.getPlayerIndex(BuildersProxy.getOwner(this));
|
||||
|
||||
|
@ -80,18 +76,19 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
break;
|
||||
}
|
||||
|
||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(it);
|
||||
BlueprintBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(it);
|
||||
|
||||
if (bpt != null) {
|
||||
result.add(bpt);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;*/
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<BptBase> getPrevPage(String before) {
|
||||
ArrayList<BptBase> result = new ArrayList<BptBase>();
|
||||
public ArrayList<BlueprintBase> getPrevPage(String before) {
|
||||
/*ArrayList<BlueprintBase> result = new ArrayList<BlueprintBase>();
|
||||
|
||||
BptPlayerIndex index = BuildCraftBuilders.getPlayerIndex(BuildersProxy.getOwner(this));
|
||||
|
||||
|
@ -104,14 +101,15 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
break;
|
||||
}
|
||||
|
||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(it);
|
||||
BlueprintBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(it);
|
||||
|
||||
if (bpt != null) {
|
||||
result.add(bpt);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;*/
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateCurrentNames() {
|
||||
|
@ -123,18 +121,18 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList<BptBase> getCurrentPage() {
|
||||
public ArrayList<BlueprintBase> getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public void setCurrentPage(ArrayList<BptBase> newPage) {
|
||||
public void setCurrentPage(ArrayList<BlueprintBase> newPage) {
|
||||
currentPage = newPage;
|
||||
selected = -1;
|
||||
updateCurrentNames();
|
||||
}
|
||||
|
||||
public void setCurrentPage(boolean nextPage) {
|
||||
int index = 0;
|
||||
/*int index = 0;
|
||||
if (nextPage) {
|
||||
index = currentPage.size() - 1;
|
||||
}
|
||||
|
@ -142,11 +140,11 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
setCurrentPage(getNextPage(currentPage.get(index).file.getName()));
|
||||
} else {
|
||||
setCurrentPage(getNextPage(null));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void deleteSelectedBpt() {
|
||||
BptPlayerIndex index = BuildCraftBuilders.getPlayerIndex(BuildersProxy.getOwner(this));
|
||||
/*BptPlayerIndex index = BuildCraftBuilders.getPlayerIndex(BuildersProxy.getOwner(this));
|
||||
if (selected > -1 && selected < currentPage.size()) {
|
||||
index.deleteBluePrint(currentPage.get(selected).file.getName());
|
||||
if (currentPage.size() > 0) {
|
||||
|
@ -156,7 +154,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
selected = -1;
|
||||
updateCurrentNames();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -264,7 +262,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
@ -283,7 +281,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
setInventorySlotContents(1, stack[0]);
|
||||
setInventorySlotContents(0, null);
|
||||
|
||||
Blueprint bpt = ItemBlueprint.getBlueprint(stack [1]);
|
||||
BlueprintBase bpt = ItemBlueprint.getBlueprint(stack [1]);
|
||||
|
||||
if (bpt != null && uploadingPlayer != null) {
|
||||
RPCHandler.rpcPlayer(this, "receiveBlueprint", uploadingPlayer, bpt);
|
||||
|
@ -303,18 +301,20 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
|
||||
if (progressOut == 100 && stack[3] == null) {
|
||||
if (selected > -1 && selected < currentPage.size()) {
|
||||
BptBase bpt = currentPage.get(selected);
|
||||
setInventorySlotContents(3, BuildCraftBuilders.getBptItemStack(stack[2].getItem(), bpt.position, bpt.getName()));
|
||||
BlueprintBase bpt = currentPage.get(selected);
|
||||
setInventorySlotContents(3, BuildCraftBuilders.getBptItemStack(
|
||||
stack[2].getItem(), bpt.position, bpt.id.name));
|
||||
} else {
|
||||
setInventorySlotContents(3, BuildCraftBuilders.getBptItemStack(stack[2].getItem(), 0, null));
|
||||
setInventorySlotContents(3, BuildCraftBuilders.getBptItemStack(
|
||||
stack[2].getItem(), 0, null));
|
||||
}
|
||||
|
||||
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
}
|
||||
|
||||
@RPC (RPCSide.CLIENT)
|
||||
public void receiveBlueprint (Blueprint bpt) {
|
||||
public void receiveBlueprint (BlueprintBase bpt) {
|
||||
BuildCraftBuilders.clientDB.add(bpt);
|
||||
updateCurrentNames();
|
||||
}
|
||||
|
|
|
@ -33,11 +33,10 @@ import buildcraft.core.IBoxProvider;
|
|||
import buildcraft.core.IBuilderInventory;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.blueprints.BptBlueprint;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.blueprints.BptBuilderBase;
|
||||
import buildcraft.core.blueprints.BptBuilderBlueprint;
|
||||
import buildcraft.core.blueprints.BptBuilderTemplate;
|
||||
import buildcraft.core.blueprints.BptContext;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
import buildcraft.core.robots.EntityRobot;
|
||||
|
@ -244,7 +243,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory,
|
|||
}
|
||||
|
||||
public BptBuilderBase instanciateBluePrint(int x, int y, int z, ForgeDirection o) {
|
||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(items[0].getItemDamage());
|
||||
BlueprintBase bpt = ItemBlueprint.getBlueprint(items [0]);
|
||||
|
||||
if (bpt == null)
|
||||
return null;
|
||||
|
@ -266,12 +265,13 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory,
|
|||
bpt.rotateLeft(context);
|
||||
}
|
||||
|
||||
if (items[0].getItem() instanceof ItemBlueprintTemplate)
|
||||
return new BptBuilderTemplate(bpt, worldObj, x, y, z);
|
||||
else if (items[0].getItem() instanceof ItemBptBluePrint)
|
||||
return new BptBuilderBlueprint((BptBlueprint) bpt, worldObj, x, y, z);
|
||||
else
|
||||
if (items[0].getItem() instanceof ItemBlueprint) {
|
||||
return new BptBuilderBlueprint((Blueprint) bpt, worldObj, x, y, z);
|
||||
/*} else if (items[0].getItem() instanceof ItemBptBluePrint) {
|
||||
return new BptBuilderTemplate(bpt, worldObj, x, y, z);*/
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -310,8 +310,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory,
|
|||
}
|
||||
|
||||
public void iterateBpt() {
|
||||
if (items[0] == null || !(items[0].getItem() instanceof ItemBptBase)) {
|
||||
|
||||
if (items[0] == null || !(items[0].getItem() instanceof ItemBlueprint)) {
|
||||
if (bluePrintBuilder != null) {
|
||||
bluePrintBuilder = null;
|
||||
}
|
||||
|
@ -348,9 +347,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory,
|
|||
|
||||
if (bluePrintBuilder != null) {
|
||||
box.reset();
|
||||
/*
|
||||
box.initialize(bluePrintBuilder);
|
||||
*/
|
||||
}
|
||||
|
||||
if (builderRobot != null) {
|
||||
|
@ -573,7 +570,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory,
|
|||
}
|
||||
|
||||
public boolean isBuildingBlueprint() {
|
||||
return getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof ItemBptBluePrint;
|
||||
return getStackInSlot(0) != null && getStackInSlot(0).getItem() instanceof ItemBlueprint;
|
||||
}
|
||||
|
||||
public Collection<ItemStack> getNeededItems() {
|
||||
|
|
|
@ -19,13 +19,13 @@ import buildcraft.api.core.IAreaProvider;
|
|||
|
||||
public class BlueprintBuilder implements IAreaProvider {
|
||||
|
||||
public final Blueprint blueprint;
|
||||
public final SchematicBlueprint blueprint;
|
||||
public final ForgeDirection orientation;
|
||||
public final World worldObj;
|
||||
public final int x, y, z;
|
||||
private final List<SchematicBuilder> builders;
|
||||
|
||||
public BlueprintBuilder(Blueprint blueprint, World world, int x, int y, int z, ForgeDirection orientation) {
|
||||
public BlueprintBuilder(SchematicBlueprint blueprint, World world, int x, int y, int z, ForgeDirection orientation) {
|
||||
this.blueprint = blueprint;
|
||||
this.orientation = orientation;
|
||||
this.worldObj = world;
|
||||
|
|
|
@ -9,11 +9,8 @@
|
|||
package buildcraft.builders.blueprints;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
|
@ -30,11 +27,11 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class BlueprintDatabase {
|
||||
private final int bufferSize = 8192;
|
||||
|
@ -44,7 +41,7 @@ public class BlueprintDatabase {
|
|||
private Set <BlueprintId> blueprintIds = new TreeSet<BlueprintId> ();
|
||||
|
||||
//private Map<BlueprintId, BlueprintMeta> blueprintMetas = new HashMap<BlueprintId, BlueprintMeta>();
|
||||
private Map<BlueprintId, Blueprint> loadedBlueprints = new WeakHashMap<BlueprintId, Blueprint>();
|
||||
private Map<BlueprintId, BlueprintBase> loadedBlueprints = new WeakHashMap<BlueprintId, BlueprintBase>();
|
||||
|
||||
/**
|
||||
* Initialize the blueprint database.
|
||||
|
@ -98,8 +95,8 @@ public class BlueprintDatabase {
|
|||
* @param id blueprint id
|
||||
* @return blueprint or null if it can't be retrieved
|
||||
*/
|
||||
public Blueprint get(BlueprintId id) {
|
||||
Blueprint ret = loadedBlueprints.get(id);
|
||||
public BlueprintBase get(BlueprintId id) {
|
||||
BlueprintBase ret = loadedBlueprints.get(id);
|
||||
|
||||
if (ret == null) {
|
||||
ret = load(id);
|
||||
|
@ -114,7 +111,7 @@ public class BlueprintDatabase {
|
|||
* @param blueprint blueprint to add
|
||||
* @return id for the added blueprint
|
||||
*/
|
||||
public BlueprintId add(Blueprint blueprint) {
|
||||
public BlueprintId add(BlueprintBase blueprint) {
|
||||
BlueprintId id = save(blueprint);
|
||||
|
||||
if (!blueprintIds.contains(id)) {
|
||||
|
@ -128,10 +125,10 @@ public class BlueprintDatabase {
|
|||
return id;
|
||||
}
|
||||
|
||||
private BlueprintId save(Blueprint blueprint) {
|
||||
private BlueprintId save(BlueprintBase blueprint) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
blueprint.writeToNBT(nbt);
|
||||
|
||||
|
||||
ByteBuf buf = Unpooled.buffer();
|
||||
|
||||
Utils.writeNBT(buf, nbt);
|
||||
|
@ -139,9 +136,9 @@ public class BlueprintDatabase {
|
|||
byte[] data = new byte [buf.readableBytes()];
|
||||
buf.readBytes(data);
|
||||
|
||||
blueprint.generateId(data);
|
||||
blueprint.id.generateUniqueId(data);
|
||||
|
||||
BlueprintId id = blueprint.meta.id;
|
||||
BlueprintId id = blueprint.id;
|
||||
|
||||
File blueprintFile = new File(blueprintFolder, String.format(Locale.ENGLISH, "%s" + fileExt, id.toString()));
|
||||
|
||||
|
@ -191,7 +188,7 @@ public class BlueprintDatabase {
|
|||
}
|
||||
}
|
||||
|
||||
private Blueprint load(final BlueprintId id) {
|
||||
private BlueprintBase load(final BlueprintId id) {
|
||||
/*FilenameFilter filter = new FilenameFilter() {
|
||||
String prefix = meta.getId().toString();
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import buildcraft.core.network.NetworkData;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
|
||||
public class BlueprintMeta {
|
||||
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.builders.blueprints;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -7,8 +15,6 @@ import buildcraft.builders.blueprints.BlueprintBuilder.SchematicBuilder;
|
|||
|
||||
public class MaskHandler extends BlockHandler {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean buildBlockFromSchematic(World world, SchematicBuilder builder, IBlueprintBuilderAgent builderAgent) {
|
||||
MaskSchematic mask = (MaskSchematic) builder.schematic;
|
||||
|
@ -20,6 +26,7 @@ public class MaskHandler extends BlockHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplete(World world, SchematicBuilder builder) {
|
||||
MaskSchematic mask = (MaskSchematic) builder.schematic;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
* This class is used to represent the data of the blueprint as it exists in the
|
||||
* world.
|
||||
*/
|
||||
public class Blueprint {
|
||||
public class SchematicBlueprint {
|
||||
|
||||
@NetworkData
|
||||
public BlueprintMeta meta;
|
||||
|
@ -56,18 +56,18 @@ public class Blueprint {
|
|||
// synchronized.
|
||||
private List<ItemStack> costs;
|
||||
|
||||
public static Blueprint create(int sizeX, int sizeY, int sizeZ) {
|
||||
return new Blueprint(new BlueprintMeta(), sizeX, sizeY, sizeZ);
|
||||
public static SchematicBlueprint create(int sizeX, int sizeY, int sizeZ) {
|
||||
return new SchematicBlueprint(new BlueprintMeta(), sizeX, sizeY, sizeZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* To be used by the serialiser only
|
||||
*/
|
||||
public Blueprint() {
|
||||
public SchematicBlueprint() {
|
||||
|
||||
}
|
||||
|
||||
public Blueprint(int sizeX, int sizeY, int sizeZ) {
|
||||
public SchematicBlueprint(int sizeX, int sizeY, int sizeZ) {
|
||||
this.sizeX = sizeX;
|
||||
this.sizeY = sizeY;
|
||||
this.sizeZ = sizeZ;
|
||||
|
@ -75,7 +75,7 @@ public class Blueprint {
|
|||
schematics = new Schematic[sizeX][sizeY][sizeZ];
|
||||
}
|
||||
|
||||
public Blueprint(BlueprintMeta meta, int sizeX, int sizeY, int sizeZ) {
|
||||
public SchematicBlueprint(BlueprintMeta meta, int sizeX, int sizeY, int sizeZ) {
|
||||
this.meta = meta;
|
||||
|
||||
this.sizeX = sizeX;
|
||||
|
@ -85,7 +85,7 @@ public class Blueprint {
|
|||
schematics = new Schematic[sizeX][sizeY][sizeZ];
|
||||
}
|
||||
|
||||
protected Blueprint(BlueprintMeta meta, NBTTagCompound nbt) {
|
||||
protected SchematicBlueprint(BlueprintMeta meta, NBTTagCompound nbt) {
|
||||
this(meta, nbt.getInteger("sizeX"),
|
||||
nbt.getInteger("sizeY"),
|
||||
nbt.getInteger("sizeZ"));
|
|
@ -8,16 +8,6 @@
|
|||
*/
|
||||
package buildcraft.builders.filler.pattern;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.api.filler.IPatternIterator;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
@ -28,6 +18,15 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.api.filler.IPatternIterator;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public abstract class FillerPattern implements IFillerPattern {
|
||||
|
||||
|
@ -49,6 +48,9 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: This should be based on templates!!!!!
|
||||
*/
|
||||
public BlueprintBuilder getBlueprint (Box box, World world) {
|
||||
return null;
|
||||
}
|
||||
|
@ -209,7 +211,7 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
// TODO: fix sound
|
||||
//world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
}
|
||||
|
||||
|
||||
if (BuildCraftBuilders.fillerDestroy) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else if (BlockUtil.isToughBlock(world, x, y, z)) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.SchematicBlueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.builders.blueprints.MaskSchematic;
|
||||
import buildcraft.core.Box;
|
||||
|
@ -47,7 +47,7 @@ public class PatternClear extends FillerPattern {
|
|||
int yMax = (int) box.pMax().y;
|
||||
int zMax = (int) box.pMax().z;
|
||||
|
||||
Blueprint bpt = new Blueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
SchematicBlueprint bpt = new SchematicBlueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
|
||||
System.out.println ("MAX = " + yMax + ", MIN = " + yMin);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.SchematicBlueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.builders.blueprints.MaskSchematic;
|
||||
import buildcraft.core.Box;
|
||||
|
@ -49,7 +49,7 @@ public class PatternFill extends FillerPattern {
|
|||
int yMax = (int) box.pMax().y;
|
||||
int zMax = (int) box.pMax().z;
|
||||
|
||||
Blueprint bpt = new Blueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
SchematicBlueprint bpt = new SchematicBlueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
|
||||
for (int y = yMin; y <= yMax; ++y) {
|
||||
for (int x = xMin; x <= xMax; ++x) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.SchematicBlueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.builders.blueprints.MaskSchematic;
|
||||
import buildcraft.core.Box;
|
||||
|
@ -50,7 +50,7 @@ public class PatternFlatten extends FillerPattern {
|
|||
int yMax = (int) box.pMax().y;
|
||||
int zMax = (int) box.pMax().z;
|
||||
|
||||
Blueprint bpt = new Blueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
SchematicBlueprint bpt = new SchematicBlueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
|
||||
boolean found = false;
|
||||
for (int y = yMax; y >= yMin; --y) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.SchematicBlueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.builders.blueprints.MaskSchematic;
|
||||
import buildcraft.core.Box;
|
||||
|
@ -75,7 +75,7 @@ public class PatternPyramid extends FillerPattern {
|
|||
int yMax = (int) box.pMax().y;
|
||||
int zMax = (int) box.pMax().z;
|
||||
|
||||
Blueprint bpt = new Blueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
SchematicBlueprint bpt = new SchematicBlueprint(xMax - xMin + 1, yMax - yMin + 1, zMax - zMin + 1);
|
||||
|
||||
int xSize = xMax - xMin + 1;
|
||||
int zSize = zMax - zMin + 1;
|
||||
|
|
|
@ -8,18 +8,18 @@
|
|||
*/
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
import buildcraft.core.gui.GuiBuildCraft;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.GuiBuildCraft;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class GuiBlueprintLibrary extends GuiBuildCraft {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/library_rw.png");
|
||||
|
@ -27,7 +27,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
TileBlueprintLibrary library;
|
||||
ContainerBlueprintLibrary container;
|
||||
boolean computeInput;
|
||||
BptPlayerIndex index;
|
||||
//BptPlayerIndex index;
|
||||
|
||||
public GuiBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) {
|
||||
super(new ContainerBlueprintLibrary(player, library), library, TEXTURE);
|
||||
|
@ -38,10 +38,10 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
this.library = library;
|
||||
container = (ContainerBlueprintLibrary) inventorySlots;
|
||||
|
||||
index = BuildCraftBuilders.getPlayerIndex(player.getDisplayName());
|
||||
//index = BuildCraftBuilders.getPlayerIndex(player.getDisplayName());
|
||||
library.updateCurrentNames();
|
||||
}
|
||||
|
||||
|
||||
private GuiButton nextPageButton;
|
||||
private GuiButton prevPageButton;
|
||||
private GuiButton lockButton;
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.blueprints.BlueprintBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IBptContributor {
|
||||
|
||||
public void saveToBluePrint(TileEntity builder, BptBase bluePrint, BptSlotInfo slot);
|
||||
public void saveToBluePrint(TileEntity builder, BlueprintBase bluePrint, BptSlotInfo slot);
|
||||
|
||||
public void loadFromBluePrint(TileEntity builder, BptBase bluePrint, BptSlotInfo slot);
|
||||
public void loadFromBluePrint(TileEntity builder, BlueprintBase bluePrint, BptSlotInfo slot);
|
||||
|
||||
}
|
||||
|
|
157
common/buildcraft/core/blueprints/Blueprint.java
Normal file
157
common/buildcraft/core/blueprints/Blueprint.java
Normal file
|
@ -0,0 +1,157 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import buildcraft.core.IBptContributor;
|
||||
import buildcraft.core.utils.BCLog;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class Blueprint extends BlueprintBase {
|
||||
public Blueprint() {
|
||||
super ();
|
||||
}
|
||||
|
||||
public Blueprint(int sizeX, int sizeY, int sizeZ) {
|
||||
super(sizeX, sizeY, sizeZ);
|
||||
}
|
||||
|
||||
public void readFromWorld(IBptContext context, TileEntity anchorTile, int x, int y, int z) {
|
||||
BptSlot slot = new BptSlot();
|
||||
|
||||
slot.x = (int) (x - context.surroundingBox().pMin().x);
|
||||
slot.y = (int) (y - context.surroundingBox().pMin().y);
|
||||
slot.z = (int) (z - context.surroundingBox().pMin().z);
|
||||
slot.block = anchorTile.getWorldObj().getBlock(x, y, z);
|
||||
slot.meta = anchorTile.getWorldObj().getBlockMetadata(x, y, z);
|
||||
|
||||
if (slot.block instanceof BlockContainer) {
|
||||
TileEntity tile = anchorTile.getWorldObj().getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof IBptContributor) {
|
||||
IBptContributor contributor = (IBptContributor) tile;
|
||||
|
||||
contributor.saveToBluePrint(anchorTile, this, slot);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
slot.initializeFromWorld(context, x, y, z);
|
||||
contents[slot.x][slot.y][slot.z] = slot;
|
||||
} catch (Throwable t) {
|
||||
// Defensive code against errors in implementers
|
||||
t.printStackTrace();
|
||||
BCLog.logger.throwing("BptBlueprint", "readFromWorld", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void saveContents(NBTTagCompound nbt) {
|
||||
HashMap <Block, Integer> blocksInUse = new HashMap<Block, Integer>();
|
||||
HashMap <Item, Integer> itemsInUse = new HashMap<Item, Integer>();
|
||||
|
||||
NBTTagList nbtContents = new NBTTagList();
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
NBTTagCompound cpt = new NBTTagCompound();
|
||||
contents[x][y][z].writeToNBT(nbt, blocksInUse, itemsInUse);
|
||||
nbtContents.appendTag(cpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nbt.setTag("contents", nbtContents);
|
||||
|
||||
NBTTagList blocksMapping = new NBTTagList();
|
||||
|
||||
for (Entry<Block, Integer> e : blocksInUse.entrySet()) {
|
||||
NBTTagCompound sub = new NBTTagCompound();
|
||||
sub.setString("name",
|
||||
Block.blockRegistry.getNameForObject(e.getKey()));
|
||||
sub.setInteger("id", e.getValue());
|
||||
blocksMapping.appendTag(sub);
|
||||
}
|
||||
|
||||
nbt.setTag("blocksMapping", blocksMapping);
|
||||
|
||||
NBTTagList itemsMapping = new NBTTagList();
|
||||
|
||||
for (Entry<Item, Integer> e : itemsInUse.entrySet()) {
|
||||
NBTTagCompound sub = new NBTTagCompound();
|
||||
sub.setString("name",
|
||||
Item.itemRegistry.getNameForObject(e.getKey()));
|
||||
sub.setInteger("id", e.getValue());
|
||||
blocksMapping.appendTag(sub);
|
||||
}
|
||||
|
||||
nbt.setTag("itemsMapping", blocksMapping);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContents(NBTTagCompound nbt) throws BptError {
|
||||
HashMap <Integer, Block> blocksInUse = new HashMap<Integer, Block>();
|
||||
HashMap <Integer, Integer> itemsInUse = new HashMap<Integer, Integer>();
|
||||
|
||||
NBTTagList blocksMapping = nbt.getTagList("blocksMapping",
|
||||
Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int i = 0; i < blocksMapping.tagCount(); ++i) {
|
||||
NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
|
||||
|
||||
int id = sub.getInteger("id");
|
||||
String name = sub.getString("name");
|
||||
|
||||
Block b = (Block) Block.blockRegistry.getObject(name);
|
||||
|
||||
blocksInUse.put(id, b);
|
||||
}
|
||||
|
||||
NBTTagList itemsMapping = nbt.getTagList("itemsMapping",
|
||||
Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
for (int i = 0; i < blocksMapping.tagCount(); ++i) {
|
||||
NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
|
||||
|
||||
int id = sub.getInteger("id");
|
||||
String name = sub.getString("name");
|
||||
|
||||
Item item = (Item) Item.itemRegistry.getObject(name);
|
||||
|
||||
itemsInUse.put(id, Item.itemRegistry.getIDForObject(item));
|
||||
}
|
||||
|
||||
NBTTagList nbtContents = nbt.getTagList("contents",
|
||||
Utils.NBTTag_Types.NBTTagCompound.ordinal());
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
NBTTagCompound cpt = nbtContents.getCompoundTagAt(index);
|
||||
index++;
|
||||
contents[x][y][z] = new BptSlot();
|
||||
contents[x][y][z].readFromNBT(cpt, blocksInUse, itemsInUse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
265
common/buildcraft/core/blueprints/BlueprintBase.java
Normal file
265
common/buildcraft/core/blueprints/BlueprintBase.java
Normal file
|
@ -0,0 +1,265 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.builders.blueprints.BlueprintId;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.utils.BCLog;
|
||||
|
||||
public abstract class BlueprintBase {
|
||||
|
||||
BptSlot contents[][][];
|
||||
|
||||
public int position;
|
||||
|
||||
public int anchorX, anchorY, anchorZ;
|
||||
public int sizeX, sizeY, sizeZ;
|
||||
|
||||
public BlueprintId id = new BlueprintId();
|
||||
|
||||
public String author;
|
||||
|
||||
protected String version = "";
|
||||
|
||||
public BlueprintBase() {
|
||||
}
|
||||
|
||||
public BlueprintBase(int sizeX, int sizeY, int sizeZ) {
|
||||
contents = new BptSlot[sizeX][sizeY][sizeZ];
|
||||
|
||||
this.sizeX = sizeX;
|
||||
this.sizeY = sizeY;
|
||||
this.sizeZ = sizeZ;
|
||||
|
||||
anchorX = 0;
|
||||
anchorY = 0;
|
||||
anchorZ = 0;
|
||||
}
|
||||
|
||||
public void setBlock(int x, int y, int z, Block block) {
|
||||
if (contents[x][y][z] == null) {
|
||||
contents[x][y][z] = new BptSlot();
|
||||
contents[x][y][z].x = x;
|
||||
contents[x][y][z].y = y;
|
||||
contents[x][y][z].z = z;
|
||||
}
|
||||
|
||||
contents[x][y][z].block = block;
|
||||
}
|
||||
|
||||
public void rotateLeft(BptContext context) {
|
||||
BptSlot newContents[][][] = new BptSlot[sizeZ][sizeY][sizeX];
|
||||
|
||||
for (int x = 0; x < sizeZ; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeX; ++z) {
|
||||
newContents[x][y][z] = contents[z][y][(sizeZ - 1) - x];
|
||||
|
||||
if (newContents[x][y][z] != null) {
|
||||
try {
|
||||
newContents[x][y][z].rotateLeft(context);
|
||||
} catch (Throwable t) {
|
||||
// Defensive code against errors in implementers
|
||||
t.printStackTrace();
|
||||
BCLog.logger.throwing("BptBase", "rotateLeft", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int newAnchorX, newAnchorY, newAnchorZ;
|
||||
|
||||
newAnchorX = (sizeZ - 1) - anchorZ;
|
||||
newAnchorY = anchorY;
|
||||
newAnchorZ = anchorX;
|
||||
|
||||
contents = newContents;
|
||||
int tmp = sizeX;
|
||||
sizeX = sizeZ;
|
||||
sizeZ = tmp;
|
||||
|
||||
anchorX = newAnchorX;
|
||||
anchorY = newAnchorY;
|
||||
anchorZ = newAnchorZ;
|
||||
|
||||
context.rotateLeft();
|
||||
}
|
||||
|
||||
public void writeToNBT (NBTTagCompound nbt) {
|
||||
nbt.setString("version", Version.VERSION);
|
||||
|
||||
if (this instanceof Template) {
|
||||
nbt.setString("kind", "template");
|
||||
} else {
|
||||
nbt.setString("kind", "blueprint");
|
||||
}
|
||||
|
||||
nbt.setInteger("sizeX", sizeX);
|
||||
nbt.setInteger("sizeY", sizeY);
|
||||
nbt.setInteger("sizeZ", sizeZ);
|
||||
nbt.setInteger("anchorX", anchorX);
|
||||
nbt.setInteger("anchorY", anchorY);
|
||||
nbt.setInteger("anchorZ", anchorZ);
|
||||
|
||||
if (author != null) {
|
||||
nbt.setString("author", author);
|
||||
}
|
||||
|
||||
saveContents(nbt);
|
||||
}
|
||||
|
||||
public static BlueprintBase loadBluePrint(NBTTagCompound nbt) {
|
||||
String kind = nbt.getString("kind");
|
||||
|
||||
BlueprintBase bpt;
|
||||
|
||||
if ("template".equals("kind")) {
|
||||
bpt = new Template ();
|
||||
} else {
|
||||
bpt = new Blueprint();
|
||||
}
|
||||
|
||||
bpt.readFromNBT(nbt);
|
||||
|
||||
return bpt;
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound nbt) {
|
||||
BlueprintBase result = null;
|
||||
|
||||
String version = nbt.getString("version");
|
||||
|
||||
sizeX = nbt.getInteger("sizeX");
|
||||
sizeY = nbt.getInteger("sizeY");
|
||||
sizeZ = nbt.getInteger("sizeZ");
|
||||
anchorX = nbt.getInteger("anchorX");
|
||||
anchorY = nbt.getInteger("anchorY");
|
||||
anchorZ = nbt.getInteger("anchorZ");
|
||||
|
||||
author = nbt.getString("author");
|
||||
|
||||
id = new BlueprintId();
|
||||
id.read(nbt.getCompoundTag("id"));
|
||||
|
||||
contents = new BptSlot [sizeX][sizeY][sizeZ];
|
||||
|
||||
try {
|
||||
loadContents (nbt);
|
||||
} catch (BptError e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || !(o.getClass() != getClass())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlueprintBase bpt = (BlueprintBase) o;
|
||||
|
||||
if (sizeX != bpt.sizeX || sizeY != bpt.sizeY || sizeZ != bpt.sizeZ
|
||||
|| anchorX != bpt.anchorX || anchorY != bpt.anchorY
|
||||
|| anchorZ != bpt.anchorZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int x = 0; x < contents.length; ++x) {
|
||||
for (int y = 0; y < contents[0].length; ++y) {
|
||||
for (int z = 0; z < contents[0][0].length; ++z) {
|
||||
if (contents[x][y][z] != null
|
||||
&& bpt.contents[x][y][z] == null) {
|
||||
return false;
|
||||
} else if (contents[x][y][z] == null
|
||||
&& bpt.contents[x][y][z] != null) {
|
||||
return false;
|
||||
} else if (contents[x][y][z] == null
|
||||
&& bpt.contents[x][y][z] == null) {
|
||||
continue;
|
||||
} else if (contents[x][y][z].block != bpt.contents[x][y][z].block) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BlueprintBase clone() {
|
||||
BlueprintBase res = null;
|
||||
|
||||
try {
|
||||
res = getClass().newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
res.anchorX = anchorX;
|
||||
res.anchorY = anchorY;
|
||||
res.anchorZ = anchorZ;
|
||||
|
||||
res.sizeX = sizeX;
|
||||
res.sizeY = sizeY;
|
||||
res.sizeZ = sizeZ;
|
||||
|
||||
res.position = position;
|
||||
res.id = id;
|
||||
res.author = author;
|
||||
|
||||
res.contents = new BptSlot[sizeX][sizeY][sizeZ];
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z)
|
||||
if (contents[x][y][z] != null) {
|
||||
res.contents[x][y][z] = contents[x][y][z].clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copyTo(res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
protected void copyTo(BlueprintBase base) {
|
||||
|
||||
}
|
||||
|
||||
public Box getBoxForPos(int x, int y, int z) {
|
||||
int xMin = x - anchorX;
|
||||
int yMin = y - anchorY;
|
||||
int zMin = z - anchorZ;
|
||||
int xMax = x + sizeX - anchorX - 1;
|
||||
int yMax = y + sizeY - anchorY - 1;
|
||||
int zMax = z + sizeZ - anchorZ - 1;
|
||||
|
||||
Box res = new Box();
|
||||
res.initialize(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
res.reorder();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public abstract void loadContents(NBTTagCompound nbt) throws BptError;
|
||||
|
||||
public abstract void saveContents(NBTTagCompound nbt);
|
||||
}
|
|
@ -1,350 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BCLog;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public abstract class BptBase {
|
||||
|
||||
BptSlot contents[][][];
|
||||
|
||||
public int position;
|
||||
|
||||
public int anchorX, anchorY, anchorZ;
|
||||
public int sizeX, sizeY, sizeZ;
|
||||
|
||||
protected String name;
|
||||
|
||||
public String author;
|
||||
|
||||
public File file;
|
||||
|
||||
protected String version = "";
|
||||
|
||||
public BptBase() {
|
||||
}
|
||||
|
||||
public BptBase(int sizeX, int sizeY, int sizeZ) {
|
||||
contents = new BptSlot[sizeX][sizeY][sizeZ];
|
||||
|
||||
this.sizeX = sizeX;
|
||||
this.sizeY = sizeY;
|
||||
this.sizeZ = sizeZ;
|
||||
|
||||
anchorX = 0;
|
||||
anchorY = 0;
|
||||
anchorZ = 0;
|
||||
}
|
||||
|
||||
public void setBlock(int x, int y, int z, Block block) {
|
||||
if (contents[x][y][z] == null) {
|
||||
contents[x][y][z] = new BptSlot();
|
||||
contents[x][y][z].x = x;
|
||||
contents[x][y][z].y = y;
|
||||
contents[x][y][z].z = z;
|
||||
}
|
||||
|
||||
contents[x][y][z].block = block;
|
||||
}
|
||||
|
||||
public void rotateLeft(BptContext context) {
|
||||
BptSlot newContents[][][] = new BptSlot[sizeZ][sizeY][sizeX];
|
||||
|
||||
for (int x = 0; x < sizeZ; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeX; ++z) {
|
||||
newContents[x][y][z] = contents[z][y][(sizeZ - 1) - x];
|
||||
|
||||
if (newContents[x][y][z] != null) {
|
||||
try {
|
||||
newContents[x][y][z].rotateLeft(context);
|
||||
} catch (Throwable t) {
|
||||
// Defensive code against errors in implementers
|
||||
t.printStackTrace();
|
||||
BCLog.logger.throwing("BptBase", "rotateLeft", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int newAnchorX, newAnchorY, newAnchorZ;
|
||||
|
||||
newAnchorX = (sizeZ - 1) - anchorZ;
|
||||
newAnchorY = anchorY;
|
||||
newAnchorZ = anchorX;
|
||||
|
||||
contents = newContents;
|
||||
int tmp = sizeX;
|
||||
sizeX = sizeZ;
|
||||
sizeZ = tmp;
|
||||
|
||||
anchorX = newAnchorX;
|
||||
anchorY = newAnchorY;
|
||||
anchorZ = newAnchorZ;
|
||||
|
||||
context.rotateLeft();
|
||||
}
|
||||
|
||||
public File save() {
|
||||
try {
|
||||
File baseDir = new File("./");
|
||||
|
||||
baseDir.mkdir();
|
||||
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
|
||||
FileOutputStream output = new FileOutputStream(file);
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, "8859_1"));
|
||||
|
||||
writer.write("version:" + Version.VERSION);
|
||||
writer.newLine();
|
||||
|
||||
if (this instanceof BptTemplate) {
|
||||
writer.write("kind:template");
|
||||
} else {
|
||||
writer.write("kind:blueprint");
|
||||
}
|
||||
writer.newLine();
|
||||
|
||||
writer.write("sizeX:" + sizeX);
|
||||
writer.newLine();
|
||||
writer.write("sizeY:" + sizeY);
|
||||
writer.newLine();
|
||||
writer.write("sizeZ:" + sizeZ);
|
||||
writer.newLine();
|
||||
writer.write("anchorX:" + anchorX);
|
||||
writer.newLine();
|
||||
writer.write("anchorY:" + anchorY);
|
||||
writer.newLine();
|
||||
writer.write("anchorZ:" + anchorZ);
|
||||
writer.newLine();
|
||||
writer.write("name:" + name);
|
||||
writer.newLine();
|
||||
|
||||
if (author != null) {
|
||||
writer.write("author:" + author);
|
||||
writer.newLine();
|
||||
}
|
||||
|
||||
saveAttributes(writer);
|
||||
|
||||
writer.newLine();
|
||||
writer.flush();
|
||||
output.close();
|
||||
|
||||
return file;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || !(o.getClass() != getClass()))
|
||||
return false;
|
||||
|
||||
BptBase bpt = (BptBase) o;
|
||||
|
||||
if (sizeX != bpt.sizeX || sizeY != bpt.sizeY || sizeZ != bpt.sizeZ || anchorX != bpt.anchorX || anchorY != bpt.anchorY || anchorZ != bpt.anchorZ)
|
||||
return false;
|
||||
|
||||
for (int x = 0; x < contents.length; ++x) {
|
||||
for (int y = 0; y < contents[0].length; ++y) {
|
||||
for (int z = 0; z < contents[0][0].length; ++z) {
|
||||
if (contents[x][y][z] != null && bpt.contents[x][y][z] == null)
|
||||
return false;
|
||||
|
||||
if (contents[x][y][z] == null && bpt.contents[x][y][z] != null)
|
||||
return false;
|
||||
|
||||
if (contents[x][y][z] == null && bpt.contents[x][y][z] == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (contents[x][y][z].block != bpt.contents[x][y][z].block)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static BptBase loadBluePrint(File file, int position) {
|
||||
BptBase result = null;
|
||||
|
||||
String version = null;
|
||||
|
||||
try {
|
||||
FileInputStream input = new FileInputStream(file);
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "8859_1"));
|
||||
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
String[] cpts = line.split(":");
|
||||
String attr = cpts[0];
|
||||
|
||||
if (attr.equals("kind")) {
|
||||
if (cpts[1].equals("template")) {
|
||||
result = new BptTemplate();
|
||||
} else if (cpts[1].equals("blueprint")) {
|
||||
result = new BptBlueprint();
|
||||
}
|
||||
|
||||
result.position = position;
|
||||
result.version = version;
|
||||
result.file = file;
|
||||
} else if (attr.equals("sizeX")) {
|
||||
result.sizeX = Integer.parseInt(cpts[1]);
|
||||
} else if (attr.equals("sizeY")) {
|
||||
result.sizeY = Integer.parseInt(cpts[1]);
|
||||
} else if (attr.equals("sizeZ")) {
|
||||
result.sizeZ = Integer.parseInt(cpts[1]);
|
||||
} else if (attr.equals("anchorX")) {
|
||||
result.anchorX = Integer.parseInt(cpts[1]);
|
||||
} else if (attr.equals("anchorY")) {
|
||||
result.anchorY = Integer.parseInt(cpts[1]);
|
||||
} else if (attr.equals("anchorZ")) {
|
||||
result.anchorZ = Integer.parseInt(cpts[1]);
|
||||
} else if (attr.equals("name")) {
|
||||
result.name = cpts[1];
|
||||
} else if (attr.equals("version")) {
|
||||
if (result != null) {
|
||||
result.version = version;
|
||||
} else {
|
||||
version = cpts[1];
|
||||
}
|
||||
} else if (attr.equals("author")) {
|
||||
result.author = cpts[1];
|
||||
} else if (result != null)
|
||||
if (cpts.length >= 2) {
|
||||
result.loadAttribute(reader, attr, cpts[1]);
|
||||
} else {
|
||||
result.loadAttribute(reader, attr, "");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (name == null)
|
||||
return "#" + position;
|
||||
else
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BptBase clone() {
|
||||
BptBase res = null;
|
||||
|
||||
try {
|
||||
res = getClass().newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
res.anchorX = anchorX;
|
||||
res.anchorY = anchorY;
|
||||
res.anchorZ = anchorZ;
|
||||
|
||||
res.sizeX = sizeX;
|
||||
res.sizeY = sizeY;
|
||||
res.sizeZ = sizeZ;
|
||||
|
||||
res.position = position;
|
||||
res.name = name;
|
||||
res.author = author;
|
||||
|
||||
res.contents = new BptSlot[sizeX][sizeY][sizeZ];
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z)
|
||||
if (contents[x][y][z] != null) {
|
||||
res.contents[x][y][z] = contents[x][y][z].clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copyTo(res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
protected void copyTo(BptBase base) {
|
||||
|
||||
}
|
||||
|
||||
public Box getBoxForPos(int x, int y, int z) {
|
||||
int xMin = x - anchorX;
|
||||
int yMin = y - anchorY;
|
||||
int zMin = z - anchorZ;
|
||||
int xMax = x + sizeX - anchorX - 1;
|
||||
int yMax = y + sizeY - anchorY - 1;
|
||||
int zMax = z + sizeZ - anchorZ - 1;
|
||||
|
||||
Box res = new Box();
|
||||
res.initialize(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
res.reorder();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public abstract void loadAttribute(BufferedReader reader, String attr, String val) throws IOException, BptError;
|
||||
|
||||
public abstract void saveAttributes(BufferedWriter writer) throws IOException;
|
||||
}
|
|
@ -1,353 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import buildcraft.core.IBptContributor;
|
||||
import buildcraft.core.utils.BCLog;
|
||||
|
||||
public class BptBlueprint extends BptBase {
|
||||
|
||||
//private int[] idMapping = new int[Item.itemsList.length];
|
||||
|
||||
TreeSet<Integer> idsToMap = new TreeSet<Integer>();
|
||||
|
||||
public BptBlueprint() {
|
||||
//for (int i = 0; i < idMapping.length; ++i) {
|
||||
// idMapping[i] = i;
|
||||
//}
|
||||
}
|
||||
|
||||
public BptBlueprint(int sizeX, int sizeY, int sizeZ) {
|
||||
super(sizeX, sizeY, sizeZ);
|
||||
|
||||
//for (int i = 0; i < idMapping.length; ++i) {
|
||||
// idMapping[i] = i;
|
||||
//}
|
||||
}
|
||||
|
||||
public void readFromWorld(IBptContext context, TileEntity anchorTile, int x, int y, int z) {
|
||||
BptSlot slot = new BptSlot();
|
||||
|
||||
slot.x = (int) (x - context.surroundingBox().pMin().x);
|
||||
slot.y = (int) (y - context.surroundingBox().pMin().y);
|
||||
slot.z = (int) (z - context.surroundingBox().pMin().z);
|
||||
slot.block = anchorTile.getWorldObj().getBlock(x, y, z);
|
||||
slot.meta = anchorTile.getWorldObj().getBlockMetadata(x, y, z);
|
||||
|
||||
if (slot.block instanceof BlockContainer) {
|
||||
TileEntity tile = anchorTile.getWorldObj().getTileEntity(x, y, z);
|
||||
|
||||
if (tile != null && tile instanceof IBptContributor) {
|
||||
IBptContributor contributor = (IBptContributor) tile;
|
||||
|
||||
contributor.saveToBluePrint(anchorTile, this, slot);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
slot.initializeFromWorld(context, x, y, z);
|
||||
contents[slot.x][slot.y][slot.z] = slot;
|
||||
} catch (Throwable t) {
|
||||
// Defensive code against errors in implementers
|
||||
t.printStackTrace();
|
||||
BCLog.logger.throwing("BptBlueprint", "readFromWorld", t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAttributes(BufferedWriter writer) throws IOException {
|
||||
/*writer.write("sizeX:" + sizeX);
|
||||
writer.newLine();
|
||||
writer.write("sizeY:" + sizeY);
|
||||
writer.newLine();
|
||||
writer.write("sizeZ:" + sizeZ);
|
||||
writer.newLine();
|
||||
writer.write("anchorX:" + anchorX);
|
||||
writer.newLine();
|
||||
writer.write("anchorY:" + anchorY);
|
||||
writer.newLine();
|
||||
writer.write("anchorZ:" + anchorZ);
|
||||
writer.newLine();
|
||||
|
||||
boolean[] idsUsed = new boolean[Item.itemsList.length];
|
||||
|
||||
for (int i = 1; i < idsUsed.length; ++i) {
|
||||
idsUsed[i] = false;
|
||||
}
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
BptSlotInfo slot = contents[x][y][z];
|
||||
|
||||
storeId(slot.blockId);
|
||||
|
||||
for (ItemStack stack : slot.storedRequirements) {
|
||||
storeId(stack.itemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.write("idMap:");
|
||||
writer.newLine();
|
||||
|
||||
for (Integer id : idsToMap) {
|
||||
if (id < Block.blocksList.length && Block.blocksList[id] != null) {
|
||||
writer.write(BlueprintManager.getBlockSignature(Block.blocksList[id]) + "=" + id);
|
||||
} else {
|
||||
writer.write(BlueprintManager.getItemSignature(Item.itemsList[id]) + "=" + id);
|
||||
}
|
||||
|
||||
writer.newLine();
|
||||
}
|
||||
|
||||
writer.write(":idMap");
|
||||
writer.newLine();
|
||||
|
||||
writer.write("contents:");
|
||||
writer.newLine();
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
BptSlotInfo slot = contents[x][y][z];
|
||||
|
||||
if (slot != null && slot.blockId != 0) {
|
||||
slot.cpt.setInteger("bId", slot.blockId);
|
||||
|
||||
if (slot.meta != 0) {
|
||||
slot.cpt.setInteger("meta", slot.meta);
|
||||
}
|
||||
|
||||
NBTBase.writeNamedTag(slot.cpt, new BptDataStream(writer));
|
||||
|
||||
writer.newLine();
|
||||
} else {
|
||||
writer.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.write(":contents");
|
||||
writer.newLine();
|
||||
|
||||
writer.write("requirements:");
|
||||
writer.newLine();
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
BptSlotInfo slot = contents[x][y][z];
|
||||
|
||||
if (slot != null && slot.blockId != 0 && slot.storedRequirements.size() > 0) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for (ItemStack stack : slot.storedRequirements) {
|
||||
NBTTagCompound sub = new NBTTagCompound();
|
||||
stack.writeToNBT(sub);
|
||||
list.appendTag(sub);
|
||||
}
|
||||
|
||||
NBTBase.writeNamedTag(list, new BptDataStream(writer));
|
||||
|
||||
writer.newLine();
|
||||
} else {
|
||||
writer.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.write(":requirements");
|
||||
writer.newLine();*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadAttribute(BufferedReader reader, String attr, String val) throws IOException, BptError {
|
||||
/*if ("3.1.0".equals(version))
|
||||
throw new BptError("Blueprint format 3.1.0 is not supported anymore, can't load " + file);
|
||||
|
||||
// blockMap is still tested for being able to load pre 3.1.2 bpts
|
||||
if (attr.equals("blockMap") || attr.equals("idMap")) {
|
||||
while (true) {
|
||||
String mapStr = reader.readLine();
|
||||
|
||||
if (mapStr == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
mapStr = mapStr.replaceAll("\n", "");
|
||||
|
||||
if (mapStr.equals(":blockMap") || mapStr.equals(":idMap"))
|
||||
return;
|
||||
|
||||
String[] parts = mapStr.split("=");
|
||||
int blockId = Integer.parseInt(parts[1]);
|
||||
|
||||
if (parts[0].startsWith("#I")) {
|
||||
ItemSignature sig = new ItemSignature(parts[0]);
|
||||
int itemId = Integer.parseInt(parts[1]);
|
||||
|
||||
if (!itemMatch(sig, Item.itemsList[itemId])) {
|
||||
boolean found = false;
|
||||
for (int i = 256; i < Item.itemsList.length; ++i) {
|
||||
|
||||
// Items between 256 and Block.blocksList.length may
|
||||
// be item or block
|
||||
if (i < Block.blocksList.length && Block.blocksList[i] != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itemMatch(sig, Item.itemsList[i])) {
|
||||
found = true;
|
||||
idMapping[itemId] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
throw new BptError("BLUEPRINT ERROR: can't find item of signature " + sig + " for " + name);
|
||||
}
|
||||
|
||||
} else {
|
||||
BlockSignature bptSignature = new BlockSignature(parts[0]);
|
||||
BptBlock defaultBlock = BlueprintManager.blockBptProps[0];
|
||||
|
||||
BptBlock handlingBlock = BlueprintManager.blockBptProps[blockId];
|
||||
|
||||
if (handlingBlock == null) {
|
||||
handlingBlock = defaultBlock;
|
||||
}
|
||||
|
||||
if (!handlingBlock.match(Block.blocksList[blockId], bptSignature)) {
|
||||
boolean found = false;
|
||||
|
||||
for (int i = 0; i < Block.blocksList.length; ++i)
|
||||
if (Block.blocksList[i] != null) {
|
||||
handlingBlock = BlueprintManager.blockBptProps[i];
|
||||
|
||||
if (handlingBlock == null) {
|
||||
handlingBlock = defaultBlock;
|
||||
}
|
||||
|
||||
if (handlingBlock.match(Block.blocksList[i], bptSignature)) {
|
||||
idMapping[blockId] = i;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
throw new BptError("BLUEPRINT ERROR: can't find block of signature " + bptSignature + " for " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (attr.equals("contents")) {
|
||||
contents = new BptSlot[sizeX][sizeY][sizeZ];
|
||||
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
String slotStr = reader.readLine().replaceAll("\n", "");
|
||||
|
||||
if (slotStr.equals(":contents"))
|
||||
return;
|
||||
|
||||
if (!slotStr.equals("")) {
|
||||
BptSlot slot = new BptSlot();
|
||||
slot.x = x;
|
||||
slot.y = y;
|
||||
slot.z = z;
|
||||
|
||||
slot.cpt = (NBTTagCompound) NBTBase.readNamedTag(new BptDataStream(new StringReader(slotStr)));
|
||||
|
||||
slot.blockId = mapWorldId(slot.cpt.getInteger("bId"));
|
||||
|
||||
if (slot.cpt.hasKey("meta")) {
|
||||
slot.meta = slot.cpt.getInteger("meta");
|
||||
}
|
||||
|
||||
contents[x][y][z] = slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (attr.equals("requirements")) {
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
String reqStr = reader.readLine().replaceAll("\n", "");
|
||||
|
||||
if (reqStr.equals(":requirements"))
|
||||
return;
|
||||
|
||||
if (!reqStr.equals("")) {
|
||||
NBTTagList list = (NBTTagList) NBTBase.readNamedTag(new BptDataStream(new StringReader(reqStr)));
|
||||
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
ItemStack stk = mapItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) list.tagAt(i)));
|
||||
|
||||
contents[x][y][z].storedRequirements.add(stk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (name == null)
|
||||
return "Blueprint #" + position;
|
||||
else
|
||||
return name;
|
||||
}
|
||||
|
||||
public ItemStack mapItemStack(ItemStack bptItemStack) {
|
||||
//ItemStack newStack = bptItemStack.copy();
|
||||
|
||||
//newStack.itemID = idMapping[newStack.itemID];
|
||||
|
||||
//return newStack;
|
||||
return null;
|
||||
}
|
||||
|
||||
public int mapWorldId(int bptWorldId) {
|
||||
//return idMapping[bptWorldId];
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void storeId(int worldId) {
|
||||
if (worldId != 0) {
|
||||
idsToMap.add(worldId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Block block) {
|
||||
super.setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyTo(BptBase bpt) {
|
||||
//((BptBlueprint) bpt).idMapping = idMapping.clone();
|
||||
}
|
||||
}
|
|
@ -16,12 +16,12 @@ import buildcraft.core.IBuilderInventory;
|
|||
|
||||
public abstract class BptBuilderBase implements IAreaProvider {
|
||||
|
||||
public BptBase blueprint;
|
||||
public BlueprintBase blueprint;
|
||||
int x, y, z;
|
||||
public boolean done;
|
||||
protected BptContext context;
|
||||
|
||||
public BptBuilderBase(BptBase bluePrint, World world, int x, int y, int z) {
|
||||
public BptBuilderBase(BlueprintBase bluePrint, World world, int x, int y, int z) {
|
||||
this.blueprint = bluePrint;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
@ -31,8 +31,8 @@ public abstract class BptBuilderBase implements IAreaProvider {
|
|||
Box box = new Box();
|
||||
box.initialize(this);
|
||||
|
||||
if (bluePrint instanceof BptBlueprint) {
|
||||
context = new BptContext(world, (BptBlueprint) bluePrint, box);
|
||||
if (bluePrint instanceof Blueprint) {
|
||||
context = new BptContext(world, (Blueprint) bluePrint, box);
|
||||
} else {
|
||||
context = new BptContext(world, null, box);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
});
|
||||
|
||||
public BptBuilderBlueprint(BptBlueprint bluePrint, World world, int x, int y, int z) {
|
||||
public BptBuilderBlueprint(Blueprint bluePrint, World world, int x, int y, int z) {
|
||||
super(bluePrint, world, x, y, z);
|
||||
|
||||
for (int j = bluePrint.sizeY - 1; j >= 0; --j) {
|
||||
|
|
|
@ -19,7 +19,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
LinkedList<BptSlot> clearList = new LinkedList<BptSlot>();
|
||||
LinkedList<BptSlot> buildList = new LinkedList<BptSlot>();
|
||||
|
||||
public BptBuilderTemplate(BptBase bluePrint, World world, int x, int y, int z) {
|
||||
public BptBuilderTemplate(BlueprintBase bluePrint, World world, int x, int y, int z) {
|
||||
super(bluePrint, world, x, y, z);
|
||||
|
||||
for (int j = bluePrint.sizeY - 1; j >= 0; --j) {
|
||||
|
|
|
@ -8,48 +8,24 @@
|
|||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.Box;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BptContext implements IBptContext {
|
||||
|
||||
private BptBlueprint bpt;
|
||||
private Blueprint bpt;
|
||||
private Box box;
|
||||
private World world;
|
||||
|
||||
public BptContext(World world, BptBlueprint bpt, Box box) {
|
||||
public BptContext(World world, Blueprint bpt, Box box) {
|
||||
this.bpt = bpt;
|
||||
this.box = box;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack mapItemStack(ItemStack bptItemStack) {
|
||||
if (bpt != null)
|
||||
return bpt.mapItemStack(bptItemStack);
|
||||
else
|
||||
return bptItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int mapWorldId(int bptWorldId) {
|
||||
if (bpt != null)
|
||||
return bpt.mapWorldId(bptWorldId);
|
||||
else
|
||||
return bptWorldId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeId(int worldId) {
|
||||
if (bpt != null) {
|
||||
bpt.storeId(worldId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position rotatePositionLeft(Position pos) {
|
||||
return new Position((box.sizeZ() - 1) - pos.z, pos.y, pos.x);
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class BptPlayerIndex {
|
||||
|
||||
private TreeMap<String, File> bluePrintsFile = new TreeMap<String, File>();
|
||||
|
||||
private File baseDir;
|
||||
private File file;
|
||||
|
||||
public BptPlayerIndex(String filename, BptRootIndex rootIndex) throws IOException {
|
||||
baseDir = new File("./", "blueprints/");
|
||||
file = new File(baseDir, filename);
|
||||
baseDir.mkdir();
|
||||
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
|
||||
for (String file : rootIndex.filesSet.keySet()) {
|
||||
bluePrintsFile.put(file, new File(baseDir, file));
|
||||
}
|
||||
|
||||
saveIndex();
|
||||
} else {
|
||||
loadIndex();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadIndex() throws IOException {
|
||||
FileInputStream input = new FileInputStream(file);
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "8859_1"));
|
||||
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
line = line.replaceAll("\\n", "");
|
||||
|
||||
File bptFile = new File(baseDir, line);
|
||||
|
||||
bluePrintsFile.put(line, bptFile);
|
||||
}
|
||||
|
||||
input.close();
|
||||
}
|
||||
|
||||
public void addBlueprint(File file) throws IOException {
|
||||
bluePrintsFile.put(file.getName(), file);
|
||||
|
||||
saveIndex();
|
||||
}
|
||||
|
||||
public void saveIndex() throws IOException {
|
||||
FileOutputStream output = new FileOutputStream(file);
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, "8859_1"));
|
||||
|
||||
for (String line : bluePrintsFile.keySet()) {
|
||||
writer.write(line);
|
||||
writer.newLine();
|
||||
}
|
||||
|
||||
writer.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
public void deleteBluePrint(String fileName) {
|
||||
bluePrintsFile.remove(fileName);
|
||||
|
||||
try {
|
||||
saveIndex();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String nextBpt(String name) {
|
||||
if (bluePrintsFile.size() == 0)
|
||||
return null;
|
||||
else if (name == null)
|
||||
return bluePrintsFile.firstKey();
|
||||
else
|
||||
return bluePrintsFile.higherKey(name);
|
||||
}
|
||||
|
||||
public String prevBpt(String name) {
|
||||
if (bluePrintsFile.size() == 0)
|
||||
return null;
|
||||
else if (name == null)
|
||||
return bluePrintsFile.lastKey();
|
||||
else
|
||||
return bluePrintsFile.lowerKey(name);
|
||||
}
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class BptRootIndex {
|
||||
|
||||
private TreeMap<Integer, File> bluePrintsFile = new TreeMap<Integer, File>();
|
||||
public TreeMap<String, Integer> filesSet = new TreeMap<String, Integer>();
|
||||
|
||||
private TreeMap<Integer, BptBase> bluePrints = new TreeMap<Integer, BptBase>();
|
||||
|
||||
private File baseDir;
|
||||
private File file;
|
||||
|
||||
public int maxBpt = 0;
|
||||
|
||||
public BptRootIndex(String filename) throws IOException {
|
||||
baseDir = new File("./", "blueprints/");
|
||||
file = new File(baseDir, filename);
|
||||
baseDir.mkdir();
|
||||
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadIndex() throws IOException {
|
||||
FileInputStream input = new FileInputStream(file);
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "8859_1"));
|
||||
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
line = line.replaceAll("\\n", "");
|
||||
|
||||
File bptFile = new File(baseDir, line);
|
||||
|
||||
maxBpt++;
|
||||
|
||||
filesSet.put(line, maxBpt);
|
||||
|
||||
if (bptFile.exists()) {
|
||||
bluePrintsFile.put(maxBpt, bptFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
input.close();
|
||||
|
||||
saveIndex();
|
||||
}
|
||||
|
||||
public void importNewFiles() throws IOException {
|
||||
String files[] = baseDir.list();
|
||||
|
||||
for (String foundFile : files) {
|
||||
String[] parts = foundFile.split("[.]");
|
||||
|
||||
if (parts.length < 2 || !parts[1].equals("bpt")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!filesSet.containsKey(foundFile)) {
|
||||
maxBpt++;
|
||||
filesSet.put(foundFile, maxBpt);
|
||||
|
||||
File newFile = new File(baseDir, foundFile);
|
||||
|
||||
bluePrintsFile.put(maxBpt, newFile);
|
||||
|
||||
// for (BptPlayerIndex playerIndex : BuildCraftBuilders.playerLibrary.values())
|
||||
// playerIndex.addBlueprint(newFile);
|
||||
}
|
||||
}
|
||||
|
||||
saveIndex();
|
||||
}
|
||||
|
||||
public void saveIndex() throws IOException {
|
||||
FileOutputStream output = new FileOutputStream(file);
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, "8859_1"));
|
||||
|
||||
for (int i = 1; i <= maxBpt; ++i) {
|
||||
File f = bluePrintsFile.get(i);
|
||||
|
||||
if (f != null) {
|
||||
writer.write(f.getName());
|
||||
}
|
||||
|
||||
writer.newLine();
|
||||
}
|
||||
|
||||
writer.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
public BptBase getBluePrint(int number) {
|
||||
if (!bluePrints.containsKey(number))
|
||||
if (bluePrintsFile.containsKey(number)) {
|
||||
BptBase bpt = BptBase.loadBluePrint(bluePrintsFile.get(number), number);
|
||||
|
||||
if (bpt != null) {
|
||||
bluePrints.put(number, bpt);
|
||||
bpt.file = bluePrintsFile.get(number);
|
||||
} else {
|
||||
bluePrintsFile.remove(number);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return bluePrints.get(number);
|
||||
}
|
||||
|
||||
public BptBase getBluePrint(String filename) {
|
||||
return getBluePrint(filesSet.get(filename));
|
||||
}
|
||||
|
||||
public int storeBluePrint(BptBase bluePrint) {
|
||||
String name = bluePrint.name;
|
||||
|
||||
if (name == null || name.equals("")) {
|
||||
name = "unnamed";
|
||||
}
|
||||
|
||||
if (filesSet.containsKey(name + ".bpt")) {
|
||||
int n = 0;
|
||||
|
||||
while (filesSet.containsKey(name + "_" + n + ".bpt")) {
|
||||
n++;
|
||||
}
|
||||
|
||||
name = name + "_" + n;
|
||||
}
|
||||
|
||||
maxBpt++;
|
||||
|
||||
filesSet.put(name + ".bpt", maxBpt);
|
||||
|
||||
name = name + ".bpt";
|
||||
|
||||
File bptFile = new File(baseDir, name);
|
||||
|
||||
bluePrintsFile.put(maxBpt, bptFile);
|
||||
bluePrints.put(maxBpt, bluePrint);
|
||||
bluePrint.file = bptFile;
|
||||
bluePrint.save();
|
||||
bluePrint.position = maxBpt;
|
||||
|
||||
try {
|
||||
saveIndex();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return maxBpt;
|
||||
}
|
||||
}
|
|
@ -8,15 +8,18 @@
|
|||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import buildcraft.api.blueprints.BlueprintManager;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class BptSlot extends BptSlotInfo {
|
||||
|
||||
|
@ -34,8 +37,8 @@ public class BptSlot extends BptSlotInfo {
|
|||
} else {
|
||||
return block == context.world().getBlock(x, y, z);
|
||||
}
|
||||
|
||||
//return BlueprintManager.blockBptProps[blockId].isValid(this, context);
|
||||
|
||||
//return BlueprintManager.blockBptProps[blockId].isValid(this, context);
|
||||
}
|
||||
|
||||
public void rotateLeft(IBptContext context) {
|
||||
|
@ -67,7 +70,7 @@ public class BptSlot extends BptSlotInfo {
|
|||
// the following line is just to resurect quarry building
|
||||
context.world().setBlock (x, y, z, block);
|
||||
context.world().setBlockMetadataWithNotify(x, y, z, meta, 0);
|
||||
|
||||
|
||||
//BlueprintManager.blockBptProps[blockId].buildBlock(this, context);
|
||||
}
|
||||
|
||||
|
@ -99,4 +102,49 @@ public class BptSlot extends BptSlotInfo {
|
|||
return obj;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt,
|
||||
HashMap<Block, Integer> blocksMap, HashMap<Item, Integer> itemsMap) {
|
||||
if (!blocksMap.containsKey(block)) {
|
||||
blocksMap.put(block,
|
||||
Block.blockRegistry.getIDForObject(block));
|
||||
}
|
||||
|
||||
nbt.setInteger("blockId", blocksMap.get(block));
|
||||
nbt.setInteger("blockMeta", meta);
|
||||
nbt.setTag("blockCpt", cpt);
|
||||
|
||||
NBTTagList rq = new NBTTagList();
|
||||
|
||||
for (ItemStack stack : storedRequirements) {
|
||||
if (!itemsMap.containsKey(stack.getItem())) {
|
||||
itemsMap.put(stack.getItem(),
|
||||
Item.itemRegistry.getIDForObject(stack.getItem()));
|
||||
}
|
||||
|
||||
NBTTagCompound sub = new NBTTagCompound();
|
||||
stack.writeToNBT(stack.writeToNBT(sub));
|
||||
rq.appendTag(sub);
|
||||
}
|
||||
|
||||
nbt.setTag("rq", rq);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt,
|
||||
HashMap<Integer, Block> blocksMap, HashMap<Integer, Integer> itemsMap) {
|
||||
|
||||
block = blocksMap.get(nbt.getInteger("blockId"));
|
||||
meta = nbt.getInteger("blockMeta");
|
||||
cpt = nbt.getCompoundTag("blockCpt");
|
||||
|
||||
NBTTagList rq = nbt.getTagList("rq", Utils.NBTTag_Types.NBTTagList.ordinal());
|
||||
|
||||
for (int i = 0; i < rq.tagCount(); ++i) {
|
||||
NBTTagCompound sub = rq.getCompoundTagAt(i);
|
||||
|
||||
// Maps the id in the blueprint to the id in the world
|
||||
sub.setInteger("id", itemsMap.get(sub.getInteger("id")));
|
||||
|
||||
storedRequirements.add(ItemStack.loadItemStackFromNBT(sub));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,26 +8,27 @@
|
|||
*/
|
||||
package buildcraft.core.blueprints;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class BptTemplate extends BptBase {
|
||||
/**
|
||||
* Use the template system to describe fillers
|
||||
*/
|
||||
public class Template extends BlueprintBase {
|
||||
|
||||
public BptTemplate() {
|
||||
public Template() {
|
||||
}
|
||||
|
||||
public BptTemplate(int sizeX, int sizeY, int sizeZ) {
|
||||
public Template(int sizeX, int sizeY, int sizeZ) {
|
||||
super(sizeX, sizeY, sizeZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAttributes(BufferedWriter writer) throws IOException {
|
||||
writer.write("mask:");
|
||||
public void saveContents(NBTTagCompound nbt) {
|
||||
/*writer.write("mask:");
|
||||
|
||||
boolean first = true;
|
||||
|
||||
/*for (int x = 0; x < sizeX; ++x) {
|
||||
for (int x = 0; x < sizeX; ++x) {
|
||||
for (int y = 0; y < sizeY; ++y) {
|
||||
for (int z = 0; z < sizeZ; ++z) {
|
||||
if (first) {
|
||||
|
@ -43,8 +44,8 @@ public class BptTemplate extends BptBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void loadAttribute(BufferedReader reader, String attr, String val) {
|
||||
if (attr.equals("mask")) {
|
||||
public void loadContents(NBTTagCompound nbt) throws BptError {
|
||||
/*if (attr.equals("mask")) {
|
||||
contents = new BptSlot[sizeX][sizeY][sizeZ];
|
||||
|
||||
String[] mask = val.split(",");
|
||||
|
@ -62,8 +63,8 @@ public class BptTemplate extends BptBase {
|
|||
maskIndex++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ import buildcraft.api.gates.IAction;
|
|||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.builders.blueprints.Blueprint;
|
||||
import buildcraft.builders.blueprints.SchematicBlueprint;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder;
|
||||
import buildcraft.builders.blueprints.BlueprintBuilder.SchematicBuilder;
|
||||
import buildcraft.core.Box;
|
||||
|
@ -628,7 +628,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
|||
}
|
||||
|
||||
private void initializeBlueprintBuilder() {
|
||||
Blueprint blueprint = Blueprint.create(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
SchematicBlueprint blueprint = SchematicBlueprint.create(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
for (int it = 0; it < 2; it++) {
|
||||
for (int i = 0; i < blueprint.sizeX; ++i) {
|
||||
|
|
Loading…
Reference in a new issue