Merge branch 'master' of github.com:SirSengir/BuildCraft
This commit is contained in:
commit
416ab6022d
58 changed files with 380 additions and 337 deletions
|
@ -14,7 +14,6 @@ import java.util.Arrays;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.Render;
|
||||
|
|
|
@ -14,6 +14,7 @@ public class RenderLaser extends Render {
|
|||
private ModelRenderer box;
|
||||
|
||||
public RenderLaser() {
|
||||
|
||||
box = new ModelRenderer(model, 0, 0);
|
||||
box.addBox(0, -0.5F, -0.5F, 16, 1, 1);
|
||||
box.rotationPointX = 0;
|
||||
|
@ -23,14 +24,14 @@ public class RenderLaser extends Render {
|
|||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float f, float f1) {
|
||||
|
||||
doRender((EntityLaser) entity, x, y, z, f, f1);
|
||||
|
||||
entity.setAngles(45, 180);
|
||||
}
|
||||
|
||||
private void doRender(EntityLaser laser, double x, double y, double z, float f, float f1) {
|
||||
|
||||
if (laser.hidden)
|
||||
|
||||
if (!laser.isVisible())
|
||||
return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.energy;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.BuildCraftEnergy;
|
||||
import net.minecraft.src.RenderEngine;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 823 B After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 1.6 KiB |
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.src.Item;
|
|||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.StringTranslate;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.network.BuildCraftPacket;
|
||||
import net.minecraft.src.forge.NetworkMod;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.src.buildcraft.energy;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.src.buildcraft.factory;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.src.buildcraft.silicon;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
|
|
|
@ -12,10 +12,9 @@ import net.minecraft.src.buildcraft.core.network.PacketCoordinates;
|
|||
import net.minecraft.src.buildcraft.core.network.PacketIds;
|
||||
import net.minecraft.src.buildcraft.core.network.PacketSlotChange;
|
||||
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
||||
import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
|
||||
import net.minecraft.src.buildcraft.transport.CraftingGateInterface;
|
||||
import net.minecraft.src.buildcraft.transport.PipeLogicDiamond;
|
||||
import net.minecraft.src.buildcraft.transport.TileGenericPipe;
|
||||
import net.minecraft.src.buildcraft.transport.CraftingGateInterface;
|
||||
import net.minecraft.src.forge.IPacketHandler;
|
||||
|
||||
public class PacketHandler implements IPacketHandler {
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.PacketIds;
|
||||
import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
|
||||
import net.minecraft.src.forge.NetworkMod;
|
||||
|
||||
public class mod_BuildCraftSilicon extends NetworkMod {
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.src.buildcraft.core.CoreProxy;
|
|||
import net.minecraft.src.buildcraft.core.DefaultActionProvider;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.DefaultTriggerProvider;
|
||||
import net.minecraft.src.buildcraft.core.EntityEnergyLaser;
|
||||
import net.minecraft.src.buildcraft.core.EntityLaser;
|
||||
import net.minecraft.src.buildcraft.core.EntityRobot;
|
||||
import net.minecraft.src.buildcraft.core.ItemBuildCraft;
|
||||
|
@ -127,11 +128,11 @@ public class BuildCraftCore {
|
|||
public static void load() {
|
||||
|
||||
MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
||||
|
||||
// MinecraftForge.registerEntity(EntityBlock.class,
|
||||
// mod_BuildCraftCore.instance, EntityIds.BLOCK, 64, 10, true);
|
||||
MinecraftForge.registerEntity(EntityRobot.class, mod_BuildCraftCore.instance, EntityIds.ROBOT, 64, 3, true);
|
||||
MinecraftForge.registerEntity(EntityLaser.class, mod_BuildCraftCore.instance, EntityIds.LASER, 64, 10, false);
|
||||
|
||||
//MinecraftForge.registerEntity(EntityBlock.class, mod_BuildCraftCore.instance, EntityIds.BLOCK, 64, 10, true);
|
||||
MinecraftForge.registerEntity(EntityRobot.class, mod_BuildCraftCore.instance, EntityIds.ROBOT, 64, 1, true);
|
||||
MinecraftForge.registerEntity(EntityLaser.class, mod_BuildCraftCore.instance, EntityIds.LASER, 64, 1, false);
|
||||
MinecraftForge.registerEntity(EntityEnergyLaser.class, mod_BuildCraftCore.instance, EntityIds.LASER, 64, 1, false);
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
|
|
|
@ -123,9 +123,12 @@ public class BptBlock {
|
|||
* Return true if the block on the world correspond to the block stored in
|
||||
* the blueprint at the location given by the slot. By default, this
|
||||
* subprogram is permissive and doesn't take into account metadata.
|
||||
*
|
||||
* Added metadata sensitivity //Krapht
|
||||
*/
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
|
||||
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z)
|
||||
&& slot.meta == context.world().getBlockMetadata(slot.x, slot.y, slot.z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,6 @@ package net.minecraft.src.buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
|
|
|
@ -12,7 +12,6 @@ package net.minecraft.src.buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
|
|
@ -12,7 +12,6 @@ package net.minecraft.src.buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.Item;
|
||||
|
|
|
@ -12,7 +12,6 @@ package net.minecraft.src.buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.IBox;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.IBox;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.IBox;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.IBox;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.builders;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.IBox;
|
||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.src.buildcraft.api.APIProxy;
|
|||
import net.minecraft.src.buildcraft.api.IPowerReceptor;
|
||||
import net.minecraft.src.buildcraft.api.LaserKind;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.PowerFramework;
|
||||
import net.minecraft.src.buildcraft.api.PowerProvider;
|
||||
import net.minecraft.src.buildcraft.api.TileNetworkData;
|
||||
|
@ -35,6 +36,7 @@ import net.minecraft.src.buildcraft.core.BptBuilderBase;
|
|||
import net.minecraft.src.buildcraft.core.BptBuilderBlueprint;
|
||||
import net.minecraft.src.buildcraft.core.BptBuilderTemplate;
|
||||
import net.minecraft.src.buildcraft.core.BptContext;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.EntityLaser;
|
||||
import net.minecraft.src.buildcraft.core.EntityRobot;
|
||||
import net.minecraft.src.buildcraft.core.IBuilderInventory;
|
||||
|
@ -227,10 +229,12 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
for (BlockIndex b : path) {
|
||||
if (previous != null) {
|
||||
EntityLaser laser = new EntityLaser(worldObj);
|
||||
|
||||
laser.setPositions(previous.i + 0.5, previous.j + 0.5, previous.k + 0.5, b.i + 0.5, b.j + 0.5, b.k + 0.5);
|
||||
laser.setTexture("/net/minecraft/src/buildcraft/core/gui/stripes.png");
|
||||
|
||||
EntityLaser laser = new EntityLaser(worldObj,
|
||||
new Position(previous.i + 0.5, previous.j + 0.5, previous.k + 0.5),
|
||||
new Position(b.i + 0.5, b.j + 0.5, b.k + 0.5));
|
||||
|
||||
laser.setTexture(DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png");
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
pathLasers.add(laser);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,10 @@ import java.util.TreeSet;
|
|||
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.core.BlockIndex;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.EntityLaser;
|
||||
import net.minecraft.src.buildcraft.core.WorldIterator;
|
||||
import net.minecraft.src.buildcraft.core.WorldIteratorRadius;
|
||||
|
@ -38,12 +41,18 @@ public class TilePathMarker extends TileMarker {
|
|||
links[1] = marker;
|
||||
}
|
||||
}
|
||||
|
||||
public void createLaserAndConnect(TilePathMarker pathMarker) {
|
||||
EntityLaser laser = new EntityLaser(worldObj);
|
||||
laser.setPositions(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, pathMarker.xCoord + 0.5, pathMarker.yCoord + 0.5,
|
||||
pathMarker.zCoord + 0.5);
|
||||
laser.setTexture("/net/minecraft/src/buildcraft/core/gui/laser_1.png");
|
||||
|
||||
public void createLaserAndConnect (TilePathMarker pathMarker) {
|
||||
|
||||
if (APIProxy.isClient(worldObj))
|
||||
return;
|
||||
|
||||
EntityLaser laser = new EntityLaser(worldObj,
|
||||
new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5),
|
||||
new Position(pathMarker.xCoord + 0.5, pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5));
|
||||
laser.show();
|
||||
|
||||
laser.setTexture(DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png");
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
|
||||
connect(pathMarker, laser);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.Action;
|
||||
|
||||
public class ActionMachineControl extends Action {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.Action;
|
||||
|
||||
public class ActionRedstoneOutput extends Action {
|
||||
|
|
|
@ -3,13 +3,8 @@ package net.minecraft.src.buildcraft.core;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.forge.ITextureProvider;
|
||||
|
||||
public abstract class BlockBuildCraft extends BlockContainer implements ITextureProvider {
|
||||
|
|
|
@ -19,7 +19,7 @@ public class DefaultProps {
|
|||
|
||||
public static String TEXTURE_PATH_GUI = "/gfx/buildcraft/gui";
|
||||
public static String TEXTURE_PATH_BLOCKS = "/gfx/buildcraft/blocks";
|
||||
public static String TEXTURE_PATH_ENTITIES = "/gfx/buildcraft/entitites";
|
||||
public static String TEXTURE_PATH_ENTITIES = "/gfx/buildcraft/entities";
|
||||
|
||||
public static String TEXTURE_BLOCKS = TEXTURE_PATH_BLOCKS + "/blocks.png";
|
||||
public static String TEXTURE_EXTERNAL = TEXTURE_PATH_BLOCKS + "/external.png";
|
||||
|
|
|
@ -10,17 +10,30 @@
|
|||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
|
||||
public class EntityEnergyLaser extends EntityLaser {
|
||||
|
||||
public int displayStage = 0;
|
||||
|
||||
private float power[] = new float[100];
|
||||
private final float power [] = new float [100];
|
||||
private int powerIndex = 0;
|
||||
public float powerAverage = 0;
|
||||
|
||||
public EntityEnergyLaser(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityEnergyLaser(World world, Position head, Position tail) {
|
||||
super(world, head, tail);
|
||||
|
||||
for (int j = 0; j < power.length; ++j)
|
||||
power [j] = 0;
|
||||
}
|
||||
|
||||
public void pushPower(float p) {
|
||||
powerAverage -= power[powerIndex];
|
||||
public void pushPower (float p) {
|
||||
|
||||
powerAverage -= power [powerIndex];
|
||||
powerAverage += p;
|
||||
power[powerIndex] = p;
|
||||
powerIndex++;
|
||||
|
@ -33,22 +46,16 @@ public class EntityEnergyLaser extends EntityLaser {
|
|||
return powerAverage / power.length;
|
||||
}
|
||||
|
||||
public EntityEnergyLaser(World world) {
|
||||
super(world);
|
||||
|
||||
for (int j = 0; j < power.length; ++j)
|
||||
power[j] = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTexture() {
|
||||
if (getPowerAverage() <= 1.0)
|
||||
return "/net/minecraft/src/buildcraft/core/gui/laser_1.png";
|
||||
public String getTexture () {
|
||||
|
||||
if (getPowerAverage () <= 1.0)
|
||||
return DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png";
|
||||
else if (getPowerAverage() <= 2.0)
|
||||
return "/net/minecraft/src/buildcraft/core/gui/laser_2.png";
|
||||
return DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_2.png";
|
||||
else if (getPowerAverage() <= 3.0)
|
||||
return "/net/minecraft/src/buildcraft/core/gui/laser_3.png";
|
||||
return DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_3.png";
|
||||
else
|
||||
return "/net/minecraft/src/buildcraft/core/gui/laser_4.png";
|
||||
return DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_4.png";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,104 +9,191 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.forge.ISpawnHandler;
|
||||
|
||||
public class EntityLaser extends Entity {
|
||||
public class EntityLaser extends Entity implements ISpawnHandler {
|
||||
|
||||
protected Position head, tail;
|
||||
|
||||
public double x1, y1, z1, x2, y2, z2;
|
||||
|
||||
boolean hidden = false;
|
||||
|
||||
public String texture;
|
||||
protected double renderSize = 0;
|
||||
protected double angleY = 0;
|
||||
protected double angleZ = 0;
|
||||
protected String texture;
|
||||
|
||||
double lastY;
|
||||
|
||||
public EntityLaser(World world) {
|
||||
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityLaser(World world, Position head, Position tail) {
|
||||
|
||||
super(world);
|
||||
|
||||
this.head = head;
|
||||
this.tail = tail;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
|
||||
preventEntitySpawning = false;
|
||||
noClip = true;
|
||||
isImmuneToFire = true;
|
||||
|
||||
setPosition(x1, y1, z1);
|
||||
setPosition(head.x, head.y, head.z);
|
||||
setSize(10, 10);
|
||||
|
||||
dataWatcher.addObject(8 , Integer.valueOf(encodeDouble(head.x)));
|
||||
dataWatcher.addObject(9 , Integer.valueOf(encodeDouble(head.y)));
|
||||
dataWatcher.addObject(10, Integer.valueOf(encodeDouble(head.z)));
|
||||
dataWatcher.addObject(11, Integer.valueOf(encodeDouble(tail.x)));
|
||||
dataWatcher.addObject(12, Integer.valueOf(encodeDouble(tail.y)));
|
||||
dataWatcher.addObject(13, Integer.valueOf(encodeDouble(tail.z)));
|
||||
|
||||
dataWatcher.addObject(14, Byte.valueOf((byte) 0));
|
||||
|
||||
lastY = head.y;
|
||||
}
|
||||
|
||||
public void setPositions(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.z1 = z1;
|
||||
@Override
|
||||
public void writeSpawnData(DataOutputStream data) throws IOException {
|
||||
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.z2 = z2;
|
||||
data.writeDouble(head.x);
|
||||
data.writeDouble(head.y);
|
||||
data.writeDouble(head.z);
|
||||
data.writeDouble(tail.x);
|
||||
data.writeDouble(tail.y);
|
||||
data.writeDouble(tail.z);
|
||||
}
|
||||
|
||||
setPosition(x1, y1, z1);
|
||||
@Override
|
||||
public void readSpawnData(DataInputStream data) throws IOException {
|
||||
|
||||
head = new Position(data.readDouble(), data.readDouble(), data.readDouble());
|
||||
tail = new Position(data.readDouble(), data.readDouble(), data.readDouble());
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if (head == null || tail == null)
|
||||
return;
|
||||
|
||||
if (APIProxy.isClient(worldObj)) {
|
||||
updateData();
|
||||
}
|
||||
|
||||
boundingBox.minX = Math.min(head.x, tail.x);
|
||||
boundingBox.minY = Math.min(head.y, tail.y);
|
||||
boundingBox.minZ = Math.min(head.z, tail.z);
|
||||
|
||||
boundingBox.maxX = Math.max(head.x, tail.x);
|
||||
boundingBox.maxY = Math.max(head.y, tail.y);
|
||||
boundingBox.maxZ = Math.max(head.z, tail.z);
|
||||
|
||||
if (!APIProxy.isClient(worldObj)) {
|
||||
|
||||
boundingBox.minX--;
|
||||
boundingBox.minY--;
|
||||
boundingBox.minZ--;
|
||||
|
||||
boundingBox.maxX++;
|
||||
boundingBox.maxY++;
|
||||
boundingBox.maxZ++;
|
||||
}
|
||||
|
||||
double dx = head.x - tail.x;
|
||||
double dy = head.y - tail.y;
|
||||
double dz = head.z - tail.z;
|
||||
|
||||
renderSize = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
angleZ = 360 - (Math.atan2(dz, dx) * 180.0 / Math.PI + 180.0);
|
||||
dx = Math.sqrt(renderSize * renderSize - dy * dy);
|
||||
angleY = -Math.atan2(dy, dx) * 180 / Math.PI;
|
||||
}
|
||||
|
||||
protected void updateData() {
|
||||
|
||||
head.x = decodeDouble(dataWatcher.getWatchableObjectInt(8));
|
||||
head.y = decodeDouble(dataWatcher.getWatchableObjectInt(9));
|
||||
head.z = decodeDouble(dataWatcher.getWatchableObjectInt(10));
|
||||
tail.x = decodeDouble(dataWatcher.getWatchableObjectInt(11));
|
||||
tail.y = decodeDouble(dataWatcher.getWatchableObjectInt(12));
|
||||
tail.z = decodeDouble(dataWatcher.getWatchableObjectInt(13));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double x, double y, double z) {
|
||||
|
||||
posX = x;
|
||||
posY = y;
|
||||
posZ = z;
|
||||
}
|
||||
|
||||
public void setPositions(Position head, Position tail) {
|
||||
|
||||
this.head = head;
|
||||
this.tail = tail;
|
||||
|
||||
setPosition(head.x, head.y, head.z);
|
||||
|
||||
dataWatcher.updateObject(8 , Integer.valueOf(encodeDouble(head.x)));
|
||||
dataWatcher.updateObject(9 , Integer.valueOf(encodeDouble(head.y)));
|
||||
dataWatcher.updateObject(10, Integer.valueOf(encodeDouble(head.z)));
|
||||
dataWatcher.updateObject(11, Integer.valueOf(encodeDouble(tail.x)));
|
||||
dataWatcher.updateObject(12, Integer.valueOf(encodeDouble(tail.y)));
|
||||
dataWatcher.updateObject(13, Integer.valueOf(encodeDouble(tail.z)));
|
||||
}
|
||||
|
||||
public void show() {
|
||||
dataWatcher.updateObject(14, Byte.valueOf((byte) 1));
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
dataWatcher.updateObject(14, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return dataWatcher.getWatchableObjectByte(14) == 0 ? false : true;
|
||||
}
|
||||
|
||||
public void setTexture(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double d, double d1, double d2) {
|
||||
|
||||
posX = d;
|
||||
posY = d1;
|
||||
posZ = d2;
|
||||
|
||||
boundingBox.minX = x1 <= x2 ? x1 : x2;
|
||||
boundingBox.minY = y1 <= y2 ? y1 : y2;
|
||||
boundingBox.minZ = z1 <= z2 ? z1 : z2;
|
||||
|
||||
boundingBox.maxX = x1 <= x2 ? x2 : x1;
|
||||
boundingBox.maxY = y1 <= y2 ? y2 : y1;
|
||||
boundingBox.maxZ = z1 <= z2 ? z2 : z1;
|
||||
|
||||
boundingBox.minX--;
|
||||
boundingBox.minY--;
|
||||
boundingBox.minZ--;
|
||||
|
||||
boundingBox.maxX++;
|
||||
boundingBox.maxY++;
|
||||
boundingBox.maxZ++;
|
||||
|
||||
updateGraphicData();
|
||||
}
|
||||
|
||||
double renderSize = 0;
|
||||
double angleY = 0;
|
||||
double angleZ = 0;
|
||||
|
||||
public void updateGraphicData() {
|
||||
|
||||
double dx = x1 - x2;
|
||||
double dy = y1 - y2;
|
||||
double dz = z1 - z2;
|
||||
|
||||
renderSize = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
|
||||
angleZ = 360 - (Math.atan2(dz, dx) * 180.0 / Math.PI + 180.0);
|
||||
|
||||
dx = Math.sqrt(renderSize * renderSize - dy * dy);
|
||||
|
||||
angleY = -Math.atan2(dy, dx) * 180 / Math.PI;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
public String getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float par1) {
|
||||
return 210;
|
||||
|
||||
private int encodeDouble(double d) {
|
||||
return (int) (d * 8000);
|
||||
}
|
||||
|
||||
private double decodeDouble(int i) {
|
||||
return (i / 8000D);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package net.minecraft.src.buildcraft.core;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -23,6 +24,7 @@ import net.minecraft.src.World;
|
|||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.BptSlotInfo;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.core.BptSlot.Mode;
|
||||
import net.minecraft.src.forge.ISpawnHandler;
|
||||
|
||||
|
@ -76,11 +78,12 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
motionZ = 0;
|
||||
|
||||
setPosition(destX, destY, destZ);
|
||||
laser = new EntityEnergyLaser(worldObj);
|
||||
laser.hidden = true;
|
||||
laser.setPositions(posX, posY, posZ, posX, posY, posZ);
|
||||
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
if (!APIProxy.isClient(worldObj)) {
|
||||
|
||||
laser = new EntityEnergyLaser(worldObj, new Position(posX, posY, posZ), new Position(posX, posY, posZ));
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,20 +130,19 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
|
||||
protected void move() {
|
||||
|
||||
if (!reachedDesination()) {
|
||||
|
||||
setPosition(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
|
||||
return;
|
||||
}
|
||||
//System.out.println("move: " + new Position(motionX, motionY, motionZ));
|
||||
setPosition(posX + motionX, posY + motionY, posZ + motionZ);
|
||||
|
||||
if (APIProxy.isClient(worldObj))
|
||||
return;
|
||||
|
||||
BlockIndex newDesination = getNewDesination();
|
||||
if (newDesination != null) {
|
||||
if (reachedDesination()) {
|
||||
|
||||
setDestination(newDesination.i, newDesination.j, newDesination.k);
|
||||
BlockIndex newDesination = getNewDesination();
|
||||
if (newDesination != null) {
|
||||
setDestination(newDesination.i, newDesination.j, newDesination.k);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -178,9 +180,11 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
destZ = z;
|
||||
|
||||
// TODO: apply power modifier
|
||||
motionX = (destX - posX) / 75 * 1;
|
||||
motionY = (destY - posY) / 75 * 1;
|
||||
motionZ = (destZ - posZ) / 75 * 1;
|
||||
motionX = new BigDecimal((float) (destX - posX) / 75 * 1).setScale(4, BigDecimal.ROUND_HALF_EVEN).doubleValue();
|
||||
motionY = new BigDecimal((float) (destY - posY) / 75 * 1).setScale(4, BigDecimal.ROUND_HALF_EVEN).doubleValue();
|
||||
motionZ = new BigDecimal((float) (destZ - posZ) / 75 * 1).setScale(4, BigDecimal.ROUND_HALF_EVEN).doubleValue();
|
||||
|
||||
//System.out.println("setDest: " + new Position(motionX, motionY, motionZ));
|
||||
}
|
||||
|
||||
protected boolean reachedDesination() {
|
||||
|
@ -195,7 +199,7 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
|
||||
updateWait();
|
||||
|
||||
// TODO: rewrite
|
||||
// TODO: possible rewrite
|
||||
if (targets.size() > 0) {
|
||||
|
||||
Action a = targets.getFirst();
|
||||
|
@ -212,8 +216,9 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
} else if (target.stackToUse != null) {
|
||||
|
||||
worldObj.setBlockWithNotify(target.x, target.y, target.z, 0);
|
||||
target.stackToUse.getItem().onItemUse(target.stackToUse, BuildCraftAPI.getBuildCraftPlayer(worldObj),
|
||||
worldObj, target.x, target.y - 1, target.z, 1);
|
||||
target.stackToUse.getItem().onItemUse(target.stackToUse,
|
||||
BuildCraftAPI.getBuildCraftPlayer(worldObj), worldObj, target.x, target.y - 1,
|
||||
target.z, 1);
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
@ -232,8 +237,7 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
a.builder.postProcessing(worldObj);
|
||||
targets.pop();
|
||||
}
|
||||
} else
|
||||
laser.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateWait() {
|
||||
|
@ -246,19 +250,22 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
}
|
||||
|
||||
private void updateLaser() {
|
||||
|
||||
BptSlotInfo target = null;
|
||||
|
||||
|
||||
if (APIProxy.isClient(worldObj))
|
||||
return;
|
||||
|
||||
if (targets.size() > 0) {
|
||||
|
||||
Action a = targets.getFirst();
|
||||
target = a.slot;
|
||||
BptSlotInfo target = a.slot;
|
||||
|
||||
laser.setPositions(new Position(posX, posY, posZ), new Position(target.x + 0.5, target.y + 0.5, target.z + 0.5));
|
||||
laser.show();
|
||||
}
|
||||
|
||||
if (target != null)
|
||||
laser.setPositions(posX, posY, posZ, target.x + 0.5, target.y + 0.5, target.z + 0.5);
|
||||
else
|
||||
laser.hidden = true;
|
||||
|
||||
else {
|
||||
laser.hide();
|
||||
}
|
||||
|
||||
laser.pushPower(((float) targets.size()) / ((float) MAX_TARGETS) * 4F);
|
||||
}
|
||||
|
||||
|
@ -266,7 +273,7 @@ public class EntityRobot extends Entity implements ISpawnHandler {
|
|||
|
||||
if (slot != null) {
|
||||
targets.add(new Action(slot, context));
|
||||
laser.hidden = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.buildcraft.core.utils.StringUtil;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.ILiquidContainer;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
package net.minecraft.src.buildcraft.energy;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.energy;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
|
|
|
@ -11,8 +11,6 @@ package net.minecraft.src.buildcraft.factory;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
|
@ -23,8 +21,6 @@ import net.minecraft.src.buildcraft.api.APIProxy;
|
|||
import net.minecraft.src.buildcraft.core.BlockBuildCraft;
|
||||
import net.minecraft.src.buildcraft.core.GuiIds;
|
||||
import net.minecraft.src.buildcraft.core.IItemPipe;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
import net.minecraft.src.forge.ITextureProvider;
|
||||
|
||||
public class BlockAutoWorkbench extends BlockBuildCraft {
|
||||
|
||||
|
|
|
@ -40,102 +40,14 @@ public class BlockFrame extends Block implements ILegacyPipeConnection, IBlockPi
|
|||
setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockRemoval(World world, int i, int j, int k) {
|
||||
byte width = 1;
|
||||
int width2 = width + 1;
|
||||
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
if (!world.checkChunksExist(i - width2, j - width2, k - width2, i + width2, j + width2, k + width2))
|
||||
return;
|
||||
|
||||
Position[] targets = new Position[] { new Position(i + 1, j, k), new Position(i - 1, j, k), new Position(i, j + 1, k),
|
||||
new Position(i, j - 1, k), new Position(i, j, k + 1), new Position(i, j, k - 1) };
|
||||
|
||||
for (Position pos : targets) {
|
||||
int x = (int) pos.x;
|
||||
int y = (int) pos.y;
|
||||
int z = (int) pos.z;
|
||||
int blockID = world.getBlockId(x, y, z);
|
||||
|
||||
if (blockID == BuildCraftFactory.frameBlock.blockID) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
world.setBlockMetadata(x, y, z, meta | 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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 & 8) != 0 && (meta & 4) == 0) {
|
||||
byte width = 4;
|
||||
int width2 = width + 1;
|
||||
byte yFactor = 32;
|
||||
int zFactor = yFactor * yFactor;
|
||||
int xFactor = yFactor / 2;
|
||||
|
||||
int[] adjacentFrameBlocks = new int[yFactor * yFactor * yFactor];
|
||||
|
||||
if (world.checkChunksExist(i - width2, j - width2, k - width2, i + width2, j + width2, k + width2)) {
|
||||
for (int z = -width; z <= width; ++z) {
|
||||
for (int y = -width; y <= width; ++y) {
|
||||
for (int x = -width; x <= width; ++x) {
|
||||
int blockID = world.getBlockId(i + z, j + y, k + x);
|
||||
|
||||
if (blockID == BuildCraftFactory.quarryBlock.blockID)
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + x + xFactor] = 0;
|
||||
|
||||
else if (blockID == BuildCraftFactory.frameBlock.blockID)
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + x + xFactor] = -2;
|
||||
else
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + x + xFactor] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int type = 1; type <= 4; ++type) {
|
||||
for (int z = -width; z <= width; ++z) {
|
||||
for (int y = -width; y <= width; ++y) {
|
||||
for (int x = -width; x <= width; ++x) {
|
||||
if (adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + x + xFactor] == type - 1) {
|
||||
if (adjacentFrameBlocks[(z + xFactor - 1) * zFactor + (y + xFactor) * yFactor + x + xFactor] == -2)
|
||||
adjacentFrameBlocks[(z + xFactor - 1) * zFactor + (y + xFactor) * yFactor + x + xFactor] = type;
|
||||
|
||||
if (adjacentFrameBlocks[(z + xFactor + 1) * zFactor + (y + xFactor) * yFactor + x + xFactor] == -2)
|
||||
adjacentFrameBlocks[(z + xFactor + 1) * zFactor + (y + xFactor) * yFactor + x + xFactor] = type;
|
||||
|
||||
if (adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor - 1) * yFactor + x + xFactor] == -2)
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor - 1) * yFactor + x + xFactor] = type;
|
||||
|
||||
if (adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor + 1) * yFactor + x + xFactor] == -2)
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor + 1) * yFactor + x + xFactor] = type;
|
||||
|
||||
if (adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + (x + xFactor - 1)] == -2)
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + (x + xFactor - 1)] = type;
|
||||
|
||||
if (adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + x + xFactor + 1] == -2)
|
||||
adjacentFrameBlocks[(z + xFactor) * zFactor + (y + xFactor) * yFactor + x + xFactor + 1] = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int var12 = adjacentFrameBlocks[xFactor * zFactor + xFactor * yFactor + xFactor];
|
||||
|
||||
if (var12 >= 0)
|
||||
world.setBlockMetadata(i, j, k, meta & -9);
|
||||
else
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
if (meta == 1 && random.nextInt(10) > 5){
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ package net.minecraft.src.buildcraft.factory;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.util.ArrayList;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.IBlockAccess;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
|
|
|
@ -12,7 +12,6 @@ package net.minecraft.src.buildcraft.factory;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
|
|
@ -11,15 +11,16 @@ package net.minecraft.src.buildcraft.factory;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.BuildCraftFactory;
|
||||
import net.minecraft.src.EntityLiving;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.core.Box;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.core.Utils;
|
||||
import net.minecraft.src.forge.ITextureProvider;
|
||||
|
@ -110,41 +111,83 @@ public class BlockQuarry extends BlockMachineRoot implements ITextureProvider {
|
|||
searchFrames(world, i - 1, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void markFrameForDecay(World world, int x, int y, int z){
|
||||
if (world.getBlockId(x, y, z) == BuildCraftFactory.frameBlock.blockID){
|
||||
world.setBlockMetadata(x, y, z, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockRemoval(World world, int i, int j, int k) {
|
||||
|
||||
if (APIProxy.isRemote()){
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getBlockTileEntity(i, j, k);
|
||||
if (tile instanceof TileQuarry){
|
||||
TileQuarry quarry = (TileQuarry)tile;
|
||||
Box box = quarry.box;
|
||||
|
||||
//X - Axis
|
||||
for (int x = box.xMin; x <= box.xMax; x++) {
|
||||
markFrameForDecay(world, x, box.yMin, box.zMin);
|
||||
markFrameForDecay(world, x, box.yMax, box.zMin);
|
||||
markFrameForDecay(world, x, box.yMin, box.zMax);
|
||||
markFrameForDecay(world, x, box.yMax, box.zMax);
|
||||
}
|
||||
|
||||
//Z - Axis
|
||||
for (int z = box.zMin + 1; z <= box.zMax - 1; z++) {
|
||||
markFrameForDecay(world, box.xMin, box.yMin, z);
|
||||
markFrameForDecay(world, box.xMax, box.yMin, z);
|
||||
markFrameForDecay(world, box.xMin, box.yMax, z);
|
||||
markFrameForDecay(world, box.xMax, box.yMax, z);
|
||||
}
|
||||
|
||||
//Y - Axis
|
||||
for (int y = box.yMin + 1; y <= box.yMax -1; y++) {
|
||||
|
||||
markFrameForDecay(world, box.xMin, y, box.zMin);
|
||||
markFrameForDecay(world, box.xMax, y, box.zMin);
|
||||
markFrameForDecay(world, box.xMin, y, box.zMax);
|
||||
markFrameForDecay(world, box.xMax, y, box.zMax);
|
||||
}
|
||||
quarry.destroy();
|
||||
}
|
||||
|
||||
Utils.preDestroyBlock(world, i, j, k);
|
||||
|
||||
byte width = 1;
|
||||
int width2 = width + 1;
|
||||
|
||||
if (world.checkChunksExist(i - width2, j - width2, k - width2, i + width2, j + width2, k + width2)) {
|
||||
|
||||
boolean frameFound = false;
|
||||
for (int z = -width; z <= width; ++z) {
|
||||
|
||||
for (int y = -width; y <= width; ++y) {
|
||||
|
||||
for (int x = -width; x <= width; ++x) {
|
||||
|
||||
int blockID = world.getBlockId(i + z, j + y, k + x);
|
||||
|
||||
if (blockID == BuildCraftFactory.frameBlock.blockID) {
|
||||
searchFrames(world, i + z, j + y, k + x);
|
||||
frameFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (frameFound)
|
||||
break;
|
||||
}
|
||||
if (frameFound)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// byte width = 1;
|
||||
// int width2 = width + 1;
|
||||
//
|
||||
// if (world.checkChunksExist(i - width2, j - width2, k - width2, i + width2, j + width2, k + width2)) {
|
||||
//
|
||||
// boolean frameFound = false;
|
||||
// for (int z = -width; z <= width; ++z) {
|
||||
//
|
||||
// for (int y = -width; y <= width; ++y) {
|
||||
//
|
||||
// for (int x = -width; x <= width; ++x) {
|
||||
//
|
||||
// int blockID = world.getBlockId(i + z, j + y, k + x);
|
||||
//
|
||||
// if (blockID == BuildCraftFactory.frameBlock.blockID) {
|
||||
// searchFrames(world, i + z, j + y, k + x);
|
||||
// frameFound = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (frameFound)
|
||||
// break;
|
||||
// }
|
||||
// if (frameFound)
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
super.onBlockRemoval(world, i, j, k);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package net.minecraft.src.buildcraft.factory;
|
|||
import net.minecraft.src.BuildCraftFactory;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.EntityBlock;
|
||||
|
||||
|
@ -31,12 +32,14 @@ public class EntityMechanicalArm extends Entity {
|
|||
public IArmListener listener;
|
||||
boolean inProgressionXZ = false;
|
||||
boolean inProgressionY = false;
|
||||
|
||||
|
||||
protected TileEntity parent;
|
||||
|
||||
public EntityMechanicalArm(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMechanicalArm(World world, double i, double j, double k, double width, double height) {
|
||||
public EntityMechanicalArm(World world, double i, double j, double k, double width, double height, TileEntity parent) {
|
||||
super(world);
|
||||
|
||||
setPosition(i, j, k);
|
||||
|
@ -78,6 +81,8 @@ public class EntityMechanicalArm extends Entity {
|
|||
head.shadowSize = 1.0F;
|
||||
|
||||
updatePosition();
|
||||
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,6 +189,12 @@ public class EntityMechanicalArm extends Entity {
|
|||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if (parent != null && worldObj.getBlockTileEntity(parent.xCoord, parent.yCoord, parent.zCoord) != parent) {
|
||||
setDead();
|
||||
return;
|
||||
}
|
||||
|
||||
if (speed > 0) {
|
||||
doMove(speed);
|
||||
}
|
||||
|
|
|
@ -115,9 +115,11 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
|
|||
private boolean loadDefaultBoundaries = false;
|
||||
|
||||
private void createArm() {
|
||||
arm = new EntityMechanicalArm(worldObj, box.xMin + Utils.pipeMaxPos, yCoord + bluePrintBuilder.bluePrint.sizeY - 1
|
||||
+ Utils.pipeMinPos, box.zMin + Utils.pipeMaxPos, bluePrintBuilder.bluePrint.sizeX - 2 + Utils.pipeMinPos * 2,
|
||||
bluePrintBuilder.bluePrint.sizeZ - 2 + Utils.pipeMinPos * 2);
|
||||
arm = new EntityMechanicalArm(worldObj, box.xMin + Utils.pipeMaxPos,
|
||||
yCoord + bluePrintBuilder.bluePrint.sizeY - 1
|
||||
+ Utils.pipeMinPos, box.zMin + Utils.pipeMaxPos,
|
||||
bluePrintBuilder.bluePrint.sizeX - 2 + Utils.pipeMinPos * 2,
|
||||
bluePrintBuilder.bluePrint.sizeZ - 2 + Utils.pipeMinPos * 2, this);
|
||||
|
||||
arm.listener = this;
|
||||
loadArm = true;
|
||||
|
@ -159,11 +161,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
|
|||
return;
|
||||
}
|
||||
|
||||
if (inProcess) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isDigging) {
|
||||
if (inProcess || !isDigging) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -440,8 +438,8 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
destroy();
|
||||
public void invalidate () {
|
||||
destroy ();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -449,6 +447,10 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
|
|||
if (arm != null) {
|
||||
arm.setDead();
|
||||
}
|
||||
|
||||
if (builder != null){
|
||||
builder.setDead();
|
||||
}
|
||||
|
||||
box.deleteLasers();
|
||||
arm = null;
|
||||
|
|
|
@ -3,7 +3,6 @@ package net.minecraft.src.buildcraft.silicon;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
|
|
|
@ -12,7 +12,6 @@ package net.minecraft.src.buildcraft.silicon;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.src.BlockContainer;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.BuildCraftSilicon;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
|
|
|
@ -13,8 +13,10 @@ import java.util.LinkedList;
|
|||
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.buildcraft.api.APIProxy;
|
||||
import net.minecraft.src.buildcraft.api.IPowerReceptor;
|
||||
import net.minecraft.src.buildcraft.api.Orientations;
|
||||
import net.minecraft.src.buildcraft.api.Position;
|
||||
import net.minecraft.src.buildcraft.api.PowerFramework;
|
||||
import net.minecraft.src.buildcraft.api.PowerProvider;
|
||||
import net.minecraft.src.buildcraft.api.SafeTimeTracker;
|
||||
|
@ -25,10 +27,10 @@ import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
|
|||
public class TileLaser extends TileEntity implements IPowerReceptor {
|
||||
|
||||
private EntityEnergyLaser laser = null;
|
||||
|
||||
private SafeTimeTracker laserTickTracker = new SafeTimeTracker();
|
||||
private SafeTimeTracker searchTracker = new SafeTimeTracker();
|
||||
|
||||
|
||||
private final SafeTimeTracker laserTickTracker = new SafeTimeTracker();
|
||||
private final SafeTimeTracker searchTracker = new SafeTimeTracker();
|
||||
|
||||
private TileAssemblyTable assemblyTable;
|
||||
|
||||
private PowerProvider powerProvider;
|
||||
|
@ -81,6 +83,10 @@ public class TileLaser extends TileEntity implements IPowerReceptor {
|
|||
}
|
||||
|
||||
public void aim() {
|
||||
|
||||
if (APIProxy.isClient(worldObj))
|
||||
return;
|
||||
|
||||
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
|
||||
int minX = xCoord - 5;
|
||||
|
@ -134,11 +140,12 @@ public class TileLaser extends TileEntity implements IPowerReceptor {
|
|||
|
||||
BlockIndex b = targets.get(worldObj.rand.nextInt(targets.size()));
|
||||
assemblyTable = (TileAssemblyTable) worldObj.getBlockTileEntity(b.i, b.j, b.k);
|
||||
|
||||
|
||||
if (laser == null) {
|
||||
laser = new EntityEnergyLaser(worldObj);
|
||||
laser = new EntityEnergyLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord, zCoord));
|
||||
setLaserPosition();
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
laser.show();
|
||||
} else {
|
||||
setLaserPosition();
|
||||
}
|
||||
|
@ -168,10 +175,14 @@ public class TileLaser extends TileEntity implements IPowerReceptor {
|
|||
pz = 0.3;
|
||||
break;
|
||||
}
|
||||
|
||||
laser.setPositions(xCoord + 0.5 + px, yCoord + 0.5 + py, zCoord + 0.5 + pz,
|
||||
assemblyTable.xCoord + 0.475 + (worldObj.rand.nextFloat() - 0.5) / 5F, assemblyTable.yCoord + 9F / 16F,
|
||||
|
||||
Position head = new Position(xCoord + 0.5 + px, yCoord + 0.5 + py, zCoord + 0.5 + pz);
|
||||
Position tail = new Position(
|
||||
assemblyTable.xCoord + 0.475 + (worldObj.rand.nextFloat() - 0.5) / 5F,
|
||||
assemblyTable.yCoord + 9F / 16F,
|
||||
assemblyTable.zCoord + 0.475 + (worldObj.rand.nextFloat() - 0.5) / 5F);
|
||||
|
||||
laser.setPositions(head, tail);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.Action;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.Action;
|
||||
import net.minecraft.src.buildcraft.api.IPipe;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.BuildCraftTransport;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.IPipe;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package net.minecraft.src.buildcraft.transport;
|
||||
|
||||
import net.minecraft.src.BuildCraftCore;
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
|
|
Loading…
Reference in a new issue