made progress at resurecting Quarry, for #1561
This commit is contained in:
parent
757bea50dc
commit
ac055f0b4f
23 changed files with 144 additions and 221 deletions
|
@ -42,7 +42,6 @@ import buildcraft.factory.FactoryProxy;
|
|||
import buildcraft.factory.FactoryProxyClient;
|
||||
import buildcraft.factory.GuiHandler;
|
||||
import buildcraft.factory.PumpDimensionList;
|
||||
import buildcraft.factory.SchematicFrame;
|
||||
import buildcraft.factory.SchematicRefinery;
|
||||
import buildcraft.factory.SchematicTank;
|
||||
import buildcraft.factory.TileAutoWorkbench;
|
||||
|
@ -145,7 +144,6 @@ public class BuildCraftFactory extends BuildCraftMod {
|
|||
|
||||
FactoryProxy.proxy.initializeTileEntities();
|
||||
|
||||
SchematicRegistry.registerSchematicBlock(frameBlock, SchematicFrame.class);
|
||||
SchematicRegistry.registerSchematicBlock(refineryBlock, SchematicRefinery.class);
|
||||
SchematicRegistry.registerSchematicBlock(tankBlock, SchematicTank.class);
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
*/
|
||||
package buildcraft.api.filler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.Template;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -23,5 +25,7 @@ public interface IFillerPattern {
|
|||
|
||||
public String getDisplayName();
|
||||
|
||||
public Template getBlueprint (Box box);
|
||||
public Template getTemplate (Box box);
|
||||
|
||||
public Blueprint getBlueprint (Box box, Block block);
|
||||
}
|
||||
|
|
|
@ -178,11 +178,8 @@ public class BuildingItem implements IBuilder {
|
|||
Block block = context.world().getBlock((int) destination.x, (int)destination.y, (int)destination.z);
|
||||
int meta = context.world().getBlockMetadata((int) destination.x, (int)destination.y, (int)destination.z);
|
||||
|
||||
context.world().playAuxSFXAtEntity(
|
||||
null,
|
||||
2001,
|
||||
(int) destination.x,
|
||||
(int) destination.y,
|
||||
context.world().playAuxSFXAtEntity(null, 2001,
|
||||
(int) destination.x, (int) destination.y,
|
||||
(int) destination.z,
|
||||
Block.getIdFromBlock(block) + (meta << 12));
|
||||
|
||||
|
|
|
@ -12,8 +12,10 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.api.mj.MjBattery;
|
||||
import buildcraft.core.IBoxProvider;
|
||||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
|
@ -21,7 +23,7 @@ import buildcraft.core.network.RPC;
|
|||
import buildcraft.core.network.RPCHandler;
|
||||
import buildcraft.core.network.RPCSide;
|
||||
|
||||
public abstract class TileAbstractBuilder extends TileBuildCraft implements IInventory {
|
||||
public abstract class TileAbstractBuilder extends TileBuildCraft implements IInventory, IBoxProvider {
|
||||
|
||||
public static double BREAK_ENERGY = 10;
|
||||
public static double BUILD_ENERGY = 20;
|
||||
|
@ -83,5 +85,17 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements IInv
|
|||
mjStored -= quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
mjStored = nbttagcompound.getDouble("mjStored");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound.setDouble("mjStored", mjStored);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import buildcraft.api.gates.IAction;
|
|||
import buildcraft.core.BlockIndex;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.IBoxProvider;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
|
@ -41,7 +40,7 @@ import buildcraft.core.network.RPCHandler;
|
|||
import buildcraft.core.network.RPCSide;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileBuilder extends TileAbstractBuilder implements IMachine, IBoxProvider {
|
||||
public class TileBuilder extends TileAbstractBuilder implements IMachine {
|
||||
|
||||
private static int POWER_ACTIVATION = 50;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import buildcraft.builders.filler.pattern.PatternFill;
|
|||
import buildcraft.builders.triggers.ActionFiller;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.IBoxProvider;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.blueprints.BptBuilderTemplate;
|
||||
import buildcraft.core.blueprints.BptContext;
|
||||
|
@ -40,7 +39,7 @@ import buildcraft.core.triggers.ActionMachineControl;
|
|||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class TileFiller extends TileAbstractBuilder implements IMachine, IActionReceptor, IBoxProvider {
|
||||
public class TileFiller extends TileAbstractBuilder implements IMachine, IActionReceptor {
|
||||
|
||||
public IFillerPattern currentPattern = PatternFill.INSTANCE;
|
||||
|
||||
|
@ -105,7 +104,7 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
|
|||
|
||||
if (currentPattern != null && currentTemplate == null) {
|
||||
currentTemplate = new BptBuilderTemplate(
|
||||
currentPattern.getBlueprint(box), getWorld(), box.xMin,
|
||||
currentPattern.getTemplate(box), getWorld(), box.xMin,
|
||||
box.yMin, box.zMin);
|
||||
context = currentTemplate.getContext();
|
||||
}
|
||||
|
|
|
@ -11,10 +11,14 @@ package buildcraft.builders.filler.pattern;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import buildcraft.api.blueprints.SchematicMask;
|
||||
import buildcraft.api.blueprints.SchematicRegistry;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.Template;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -97,4 +101,25 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Blueprint getBlueprint (Box box, Block block) {
|
||||
Blueprint result = new Blueprint (box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
Template tmpl = getTemplate(box);
|
||||
|
||||
for (int x = 0; x < box.sizeX(); ++x) {
|
||||
for (int y = 0; y < box.sizeY(); ++y) {
|
||||
for (int z = 0; z < box.sizeZ(); ++z) {
|
||||
if (tmpl.contents[x][y][z] != null) {
|
||||
result.contents[x][y][z] = SchematicRegistry
|
||||
.newSchematicBlock(block);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class PatternBox extends FillerPattern {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Template getBlueprint(Box box) {
|
||||
public Template getTemplate(Box box) {
|
||||
Template result = new Template (box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
int xMin = 0;
|
||||
|
|
|
@ -18,7 +18,7 @@ public class PatternClear extends FillerPattern {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Template getBlueprint (Box box) {
|
||||
public Template getTemplate (Box box) {
|
||||
int xMin = (int) box.pMin().x;
|
||||
int yMin = (int) box.pMin().y;
|
||||
int zMin = (int) box.pMin().z;
|
||||
|
|
|
@ -19,7 +19,7 @@ public class PatternCylinder extends FillerPattern {
|
|||
|
||||
|
||||
@Override
|
||||
public Template getBlueprint(Box box) {
|
||||
public Template getTemplate(Box box) {
|
||||
Template result = new Template (box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
int xMin = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ public class PatternFill extends FillerPattern {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Template getBlueprint (Box box) {
|
||||
public Template getTemplate (Box box) {
|
||||
Template bpt = new Template(box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
fill (0, 0, 0, box.sizeX() - 1, box.sizeY() - 1, box.sizeZ() - 1, bpt);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class PatternFlatten extends FillerPattern {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Template getBlueprint (Box box) {
|
||||
public Template getTemplate (Box box) {
|
||||
int xMin = (int) box.pMin().x;
|
||||
int yMin = 1;
|
||||
int zMin = (int) box.pMin().z;
|
||||
|
|
|
@ -20,7 +20,7 @@ public class PatternFrame extends FillerPattern {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Template getBlueprint(Box box) {
|
||||
public Template getTemplate(Box box) {
|
||||
Template template = new Template (box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
|
||||
int xMin = 0;
|
||||
|
|
|
@ -18,7 +18,7 @@ public class PatternHorizon extends FillerPattern {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Template getBlueprint(Box box) {
|
||||
public Template getTemplate(Box box) {
|
||||
/*
|
||||
int xMin = 0;
|
||||
int yMin = 0;
|
||||
|
|
|
@ -22,7 +22,7 @@ public class PatternPyramid extends FillerPattern {
|
|||
boolean param1 = true;
|
||||
|
||||
@Override
|
||||
public Template getBlueprint (Box box) {
|
||||
public Template getTemplate (Box box) {
|
||||
int xMin = (int) box.pMin().x;
|
||||
int yMin = (int) box.pMin().y;
|
||||
int zMin = (int) box.pMin().z;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class PatternStairs extends FillerPattern {
|
|||
int param4 = 0;
|
||||
|
||||
@Override
|
||||
public Template getBlueprint(Box box) {
|
||||
public Template getTemplate(Box box) {
|
||||
int xMin = 0;
|
||||
int yMin = 0;
|
||||
int zMin = 0;
|
||||
|
|
|
@ -46,16 +46,20 @@ public class RenderBoxProvider extends TileEntitySpecialRenderer {
|
|||
|
||||
if (tileentity instanceof IBoxesProvider) {
|
||||
for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
|
||||
RenderBox.doRender(
|
||||
if (b.isVisible) {
|
||||
RenderBox.doRender(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
getTexture(b.kind), b);
|
||||
}
|
||||
}
|
||||
} else if (tileentity instanceof IBoxProvider) {
|
||||
Box b = ((IBoxProvider) tileentity).getBox();
|
||||
|
||||
RenderBox.doRender(
|
||||
if (b.isVisible) {
|
||||
RenderBox.doRender(
|
||||
TileEntityRendererDispatcher.instance.field_147553_e,
|
||||
getTexture(b.kind), b);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -183,7 +183,9 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (checkRequirements(builder, (SchematicBlock) slot.schematic)) {
|
||||
if (BlockUtil.isSoftBlock(world, slot.x, slot.y, slot.z)
|
||||
&& checkRequirements(builder,
|
||||
(SchematicBlock) slot.schematic)) {
|
||||
useRequirements(builder, slot);
|
||||
|
||||
iterator.remove();
|
||||
|
|
|
@ -8,13 +8,6 @@
|
|||
*/
|
||||
package buildcraft.factory;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.IFramePipeConnection;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -30,24 +23,18 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.IFramePipeConnection;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFrame extends Block implements IFramePipeConnection {
|
||||
|
||||
public BlockFrame() {
|
||||
super(Material.glass);
|
||||
setHardness(0.5F);
|
||||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int i, int j, int k, Random random) {
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
if (meta == 1 && random.nextInt(10) > 5) {
|
||||
world.setBlockToAir(i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,6 +88,7 @@ public class BlockFrame extends Block implements IFramePipeConnection {
|
|||
return AxisAlignedBB.getBoundingBox((double) i + xMin, (double) j + yMin, (double) k + zMin, (double) i + xMax, (double) j + yMax, (double) k + zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "all" })
|
||||
// @Override (client only)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
|
@ -208,4 +209,19 @@ public class BlockQuarry extends BlockBuildCraft {
|
|||
textureTop = par1IconRegister.registerIcon("buildcraft:quarry_top");
|
||||
textureFront = par1IconRegister.registerIcon("buildcraft:quarry_front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,12 @@
|
|||
*/
|
||||
package buildcraft.factory;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.builders.RenderBuilder;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.render.RenderVoid;
|
||||
import buildcraft.core.render.RenderingEntityBlocks;
|
||||
|
@ -20,9 +25,6 @@ import buildcraft.factory.render.RenderRefinery;
|
|||
import buildcraft.factory.render.RenderTank;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import java.lang.reflect.Method;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FactoryProxyClient extends FactoryProxy {
|
||||
|
||||
|
@ -48,6 +50,7 @@ public class FactoryProxyClient extends FactoryProxy {
|
|||
RenderingEntityBlocks.blockByEntityRenders.put(new EntityRenderIndex(BuildCraftFactory.hopperBlock, 0), new RenderHopper());
|
||||
}
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileQuarry.class, new RenderBuilder());
|
||||
}
|
||||
|
||||
@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.factory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.SchematicBlock;
|
||||
import buildcraft.api.blueprints.IBuilderContext;
|
||||
|
||||
public class SchematicFrame extends SchematicBlock {
|
||||
|
||||
@Override
|
||||
public void addRequirements(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,6 @@
|
|||
*/
|
||||
package buildcraft.factory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -27,33 +26,28 @@ import net.minecraftforge.common.ForgeChunkManager.Type;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.api.blueprints.SchematicRegistry;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.filler.FillerManager;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.builders.BuildingItem;
|
||||
import buildcraft.builders.TileAbstractBuilder;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.Box.Kind;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.DefaultAreaProvider;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.LaserData;
|
||||
import buildcraft.core.blueprints.Blueprint;
|
||||
import buildcraft.core.blueprints.BptBuilderBase;
|
||||
import buildcraft.core.blueprints.BptBuilderBlueprint;
|
||||
import buildcraft.core.blueprints.BuildingSlot;
|
||||
import buildcraft.core.network.NetworkData;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.robots.EntityRobotBuilder;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerReceptor {
|
||||
public class TileQuarry extends TileAbstractBuilder implements IMachine {
|
||||
|
||||
public @NetworkData
|
||||
Box box = new Box();
|
||||
|
@ -65,30 +59,17 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
double headPosX, headPosY, headPosZ;
|
||||
public @NetworkData
|
||||
double speed = 0.03;
|
||||
public @NetworkData
|
||||
boolean builderDone = false;
|
||||
public EntityRobotBuilder builder;
|
||||
private BptBuilderBlueprint blueprintBuilder;
|
||||
|
||||
private BptBuilderBase builder;
|
||||
public EntityMechanicalArm arm;
|
||||
public PowerHandler powerHandler;
|
||||
boolean isDigging = false;
|
||||
public static final int MAX_ENERGY = 15000;
|
||||
private static final PowerHandler.PerditionCalculator PERDITION = new PowerHandler.PerditionCalculator(2 * BuildCraftFactory.miningMultiplier);
|
||||
|
||||
public TileQuarry() {
|
||||
powerHandler = new PowerHandler(this, PowerHandler.Type.MACHINE);
|
||||
initPowerProvider();
|
||||
}
|
||||
|
||||
private void initPowerProvider() {
|
||||
float mj = 25 * BuildCraftFactory.miningMultiplier;
|
||||
powerHandler.configure(50 * BuildCraftFactory.miningMultiplier, 100 * BuildCraftFactory.miningMultiplier, mj, MAX_ENERGY * BuildCraftFactory.miningMultiplier);
|
||||
powerHandler.setPerdition(PERDITION);
|
||||
public TileQuarry () {
|
||||
box.kind = Kind.STRIPES;
|
||||
}
|
||||
|
||||
public void createUtilsIfNeeded() {
|
||||
if (blueprintBuilder == null) {
|
||||
|
||||
if (builder == null) {
|
||||
if (!box.isInitialized()) {
|
||||
setBoundaries(loadDefaultBoundaries);
|
||||
}
|
||||
|
@ -96,7 +77,7 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
initializeBlueprintBuilder();
|
||||
}
|
||||
|
||||
if (builderDone) {
|
||||
if (builder != null && builder.isDone(this)) {
|
||||
box.isVisible = false;
|
||||
|
||||
if (arm == null) {
|
||||
|
@ -126,9 +107,8 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
public EntityPlayer placedBy;
|
||||
|
||||
private void createArm() {
|
||||
|
||||
worldObj.spawnEntityInWorld(new EntityMechanicalArm(worldObj, box.xMin + CoreConstants.PIPE_MAX_POS, yCoord + blueprintBuilder.blueprint.sizeY - 1
|
||||
+ CoreConstants.PIPE_MIN_POS, box.zMin + CoreConstants.PIPE_MAX_POS, blueprintBuilder.blueprint.sizeX - 2 + CoreConstants.PIPE_MIN_POS * 2, blueprintBuilder.blueprint.sizeZ
|
||||
worldObj.spawnEntityInWorld(new EntityMechanicalArm(worldObj, box.xMin + CoreConstants.PIPE_MAX_POS, yCoord + builder.blueprint.sizeY - 1
|
||||
+ CoreConstants.PIPE_MIN_POS, box.zMin + CoreConstants.PIPE_MAX_POS, builder.blueprint.sizeX - 2 + CoreConstants.PIPE_MIN_POS * 2, builder.blueprint.sizeZ
|
||||
- 2 + CoreConstants.PIPE_MIN_POS * 2, this));
|
||||
}
|
||||
|
||||
|
@ -141,25 +121,26 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if (!isAlive && !worldObj.isRemote) {
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAlive && worldObj.isRemote) {
|
||||
if (!isAlive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inProcess) {
|
||||
double energyToUse = 2 + powerHandler.getEnergyStored() / 500;
|
||||
double energyToUse = 2 + mjStored / 500;
|
||||
|
||||
double energy = powerHandler.useEnergy(energyToUse, energyToUse, true);
|
||||
|
||||
if (energy > 0) {
|
||||
moveHead(0.1 + energy / 200F);
|
||||
if (mjStored > energyToUse) {
|
||||
mjStored -= energyToUse;
|
||||
moveHead(0.1 + energyToUse / 200F);
|
||||
}
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote && inProcess) {
|
||||
// TODO: Don't send an update at each tick!!!! At most once every
|
||||
// 20 ~ 25 ticks
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
|
@ -169,66 +150,22 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
|
||||
createUtilsIfNeeded();
|
||||
|
||||
if (blueprintBuilder != null) {
|
||||
//builderDone = !blueprintIterator.hasNext();
|
||||
//if (!builderDone) {
|
||||
// buildFrame();
|
||||
// return;
|
||||
//} else if (builder != null && builder.done()) {
|
||||
// killBuilder();
|
||||
//}
|
||||
if (builder != null) {
|
||||
if (!builder.isDone(this)) {
|
||||
builder.buildNextSlot(worldObj, this, xCoord, yCoord, zCoord);
|
||||
} else {
|
||||
dig();
|
||||
}
|
||||
}
|
||||
|
||||
if (builder == null) {
|
||||
dig();
|
||||
}
|
||||
}
|
||||
|
||||
private void killBuilder() {
|
||||
builder.setDead();
|
||||
builder = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider) {
|
||||
}
|
||||
|
||||
protected void buildFrame() {
|
||||
BuildingSlot schematic = blueprintBuilder.getNextBlock(getWorld(), this);
|
||||
|
||||
if (schematic == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
float mj = 25 * BuildCraftFactory.miningMultiplier;
|
||||
powerHandler.configure(50 * BuildCraftFactory.miningMultiplier, 100 * BuildCraftFactory.miningMultiplier, mj, MAX_ENERGY * BuildCraftFactory.miningMultiplier);
|
||||
|
||||
if (powerHandler.useEnergy(mj, mj, true) != mj) {
|
||||
return;
|
||||
}
|
||||
|
||||
//if (builder == null) {
|
||||
// builder = new EntityRobotBuilder(worldObj, box);
|
||||
// worldObj.spawnEntityInWorld(builder);
|
||||
//}
|
||||
|
||||
//if (builder.readyToBuild()) {
|
||||
// while (blueprintIterator.hasNext()) {
|
||||
// if (builder.scheduleContruction(blueprintIterator.next())) {
|
||||
// powerHandler.useEnergy(0, 25, true);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
protected void dig() {
|
||||
powerHandler.configure(100 * BuildCraftFactory.miningMultiplier, 500 * BuildCraftFactory.miningMultiplier, BuildCraftFactory.MINING_MJ_COST_PER_BLOCK, MAX_ENERGY * BuildCraftFactory.miningMultiplier);
|
||||
|
||||
float mj = BuildCraftFactory.MINING_MJ_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier;
|
||||
|
||||
if (powerHandler.useEnergy(mj, mj, true) != mj) {
|
||||
if (mjStored < mj) {
|
||||
return;
|
||||
} else {
|
||||
mjStored -= mj;
|
||||
}
|
||||
|
||||
if (!findTarget(true)) {
|
||||
|
@ -300,18 +237,18 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
private void createColumnVisitList() {
|
||||
visitList.clear();
|
||||
|
||||
Integer[][] columnHeights = new Integer[blueprintBuilder.blueprint.sizeX - 2][blueprintBuilder.blueprint.sizeZ - 2];
|
||||
boolean[][] blockedColumns = new boolean[blueprintBuilder.blueprint.sizeX - 2][blueprintBuilder.blueprint.sizeZ - 2];
|
||||
Integer[][] columnHeights = new Integer[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2];
|
||||
boolean[][] blockedColumns = new boolean[builder.blueprint.sizeX - 2][builder.blueprint.sizeZ - 2];
|
||||
|
||||
for (int searchY = yCoord + 3; searchY >= 0; --searchY) {
|
||||
int startX, endX, incX;
|
||||
|
||||
if (searchY % 2 == 0) {
|
||||
startX = 0;
|
||||
endX = blueprintBuilder.blueprint.sizeX - 2;
|
||||
endX = builder.blueprint.sizeX - 2;
|
||||
incX = 1;
|
||||
} else {
|
||||
startX = blueprintBuilder.blueprint.sizeX - 3;
|
||||
startX = builder.blueprint.sizeX - 3;
|
||||
endX = -1;
|
||||
incX = -1;
|
||||
}
|
||||
|
@ -321,10 +258,10 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
|
||||
if (searchX % 2 == searchY % 2) {
|
||||
startZ = 0;
|
||||
endZ = blueprintBuilder.blueprint.sizeZ - 2;
|
||||
endZ = builder.blueprint.sizeZ - 2;
|
||||
incZ = 1;
|
||||
} else {
|
||||
startZ = blueprintBuilder.blueprint.sizeZ - 3;
|
||||
startZ = builder.blueprint.sizeZ - 3;
|
||||
endZ = -1;
|
||||
incZ = -1;
|
||||
}
|
||||
|
@ -356,7 +293,7 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
|
||||
// Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this
|
||||
|
||||
if (visitList.size() > blueprintBuilder.blueprint.sizeZ * blueprintBuilder.blueprint.sizeX * 2) {
|
||||
if (visitList.size() > builder.blueprint.sizeZ * builder.blueprint.sizeX * 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -369,8 +306,7 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
|
||||
powerHandler.readFromNBT(nbttagcompound);
|
||||
initPowerProvider();
|
||||
|
||||
|
||||
if (nbttagcompound.hasKey("box")) {
|
||||
box.initialize(nbttagcompound.getCompoundTag("box"));
|
||||
|
@ -407,8 +343,6 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
powerHandler.writeToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound.setInteger("targetX", targetX);
|
||||
nbttagcompound.setInteger("targetY", targetY);
|
||||
nbttagcompound.setInteger("targetZ", targetZ);
|
||||
|
@ -534,10 +468,6 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
arm.setDead();
|
||||
}
|
||||
|
||||
if (builder != null) {
|
||||
builder.setDead();
|
||||
}
|
||||
|
||||
arm = null;
|
||||
}
|
||||
|
||||
|
@ -639,28 +569,10 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
}
|
||||
|
||||
private void initializeBlueprintBuilder() {
|
||||
Blueprint blueprint = new Blueprint (box.sizeX(), box.sizeY(), box.sizeZ());
|
||||
Blueprint bpt = FillerManager.registry.getPattern("buildcraft:frame")
|
||||
.getBlueprint(box, BuildCraftFactory.frameBlock);
|
||||
|
||||
for (int it = 0; it < 2; it++) {
|
||||
for (int i = 0; i < blueprint.sizeX; ++i) {
|
||||
blueprint.contents [i][it * (box.sizeY() - 1)][0] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
blueprint.contents [i][it * (box.sizeY() - 1)][blueprint.sizeZ - 1] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
}
|
||||
|
||||
for (int k = 0; k < blueprint.sizeZ; ++k) {
|
||||
blueprint.contents [0][it * (box.sizeY() - 1)][k] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
blueprint.contents [blueprint.sizeX - 1][it * (box.sizeY() - 1)][k] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
}
|
||||
}
|
||||
|
||||
for (int h = 1; h < box.sizeY(); ++h) {
|
||||
blueprint.contents [0][h][0] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
blueprint.contents [0][h][blueprint.sizeZ - 1] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
blueprint.contents [blueprint.sizeX - 1][h][0] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
blueprint.contents [blueprint.sizeX - 1][h][blueprint.sizeZ - 1] = SchematicRegistry.newSchematicBlock(BuildCraftFactory.frameBlock);
|
||||
}
|
||||
|
||||
blueprintBuilder = new BptBuilderBlueprint(blueprint, worldObj, box.xMin, yCoord, box.zMin); //ForgeDirection.NORTH
|
||||
builder = new BptBuilderBlueprint(bpt, worldObj, box.xMin, yCoord, box.zMin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -693,16 +605,10 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
}
|
||||
|
||||
public void reinitalize() {
|
||||
builderDone = false;
|
||||
initializeBlueprintBuilder();
|
||||
isDigging = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side) {
|
||||
return powerHandler.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean manageFluids() {
|
||||
return false;
|
||||
|
@ -715,17 +621,17 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return null;
|
||||
return new ItemStack(BuildCraftFactory.frameBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
return null;
|
||||
return new ItemStack(BuildCraftFactory.frameBlock, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -882,20 +788,12 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine, IPowerR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addBuildingItem(BuildingItem item) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return new Box (this).extendToEncompass(box).expand(50).getBoundingBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<BuildingItem> getBuilders() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<LaserData> getPathLaser() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
public Box getBox() {
|
||||
return box;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue