Changed CCMethod call method in armbot task
Added vars to get the same varables as the normal call method. These should be passed in from the armbot or command handler.
This commit is contained in:
parent
37a889ea57
commit
0227c0e58b
19 changed files with 140 additions and 117 deletions
|
@ -1,4 +1,4 @@
|
|||
package dark.assembly.common.armbot;
|
||||
package dark.api.al.armbot;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -6,31 +6,89 @@ import universalelectricity.core.vector.Vector2;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
import dark.api.al.armbot.IArmbot;
|
||||
import dark.api.al.armbot.IArmbotTask;
|
||||
|
||||
/** An AI Commands that is used by TileEntities with AI.
|
||||
*
|
||||
* @author Calclavia */
|
||||
/** Basic command prefab used by machines like an armbot. You are not required to use this in order
|
||||
* to make armbot commands but it does help. Delete this if you don't plan to use it. */
|
||||
public abstract class Command implements IArmbotTask, Cloneable
|
||||
{
|
||||
/** Program this is part of. Can be null while stores as a prefab waiting to be copied */
|
||||
protected IProgram program;
|
||||
private String methodName;
|
||||
/** The amount of ticks this command has been running for. */
|
||||
protected int ticks = 0;
|
||||
|
||||
protected World world;
|
||||
/** World current working in */
|
||||
protected World worldObj;
|
||||
/** Armbot instance */
|
||||
protected IArmbot armbot;
|
||||
/** Armbot location */
|
||||
protected Vector3 armbotPos;
|
||||
/** Position in the coder is also used during loading to place everything together */
|
||||
protected Vector2 pos;
|
||||
|
||||
/** The parameters this command has, or the properties. Entered by the player in the disk.
|
||||
* Parameters are entered like a Java function. idle(20) = Idles for 20 seconds. */
|
||||
private String[] parameters;
|
||||
/** The parameters this command */
|
||||
private Object[] parameters;
|
||||
|
||||
public Command(String name)
|
||||
{
|
||||
this.methodName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.ticks++;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMethodCalled(World world, Vector3 location, IArmbot armbot, Object[] arguments)
|
||||
{
|
||||
this.worldObj = world;
|
||||
this.armbot = armbot;
|
||||
this.parameters = arguments;
|
||||
this.armbotPos = location;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] onCCMethodCalled(World world, Vector3 location, IArmbot armbot, IComputerAccess computer, ILuaContext context, Object[] arguments) throws Exception
|
||||
{
|
||||
this.worldObj = world;
|
||||
this.armbot = armbot;
|
||||
this.parameters = arguments;
|
||||
this.armbotPos = location;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminated()
|
||||
{
|
||||
}
|
||||
|
||||
public void setParameters(String[] strings)
|
||||
{
|
||||
this.parameters = strings;
|
||||
}
|
||||
|
||||
public Object[] getArgs()
|
||||
{
|
||||
return this.parameters;
|
||||
}
|
||||
|
||||
/** Some functions to help get parameter arguments. */
|
||||
protected Object getArg(int i)
|
||||
{
|
||||
if (i >= 0 && i < this.parameters.length)
|
||||
{
|
||||
return this.parameters[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2 getPosition()
|
||||
{
|
||||
|
@ -43,59 +101,11 @@ public abstract class Command implements IArmbotTask, Cloneable
|
|||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUpdate()
|
||||
{
|
||||
this.ticks++;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMethodCalled(World world, Vector3 location, IArmbot armbot, Object[] arguments)
|
||||
{
|
||||
this.world = world;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] onCCMethodCalled(IComputerAccess computer, ILuaContext context, Object[] arguments) throws Exception
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminated()
|
||||
{
|
||||
}
|
||||
|
||||
public void setParameters(String[] strings)
|
||||
{
|
||||
this.parameters = strings;
|
||||
}
|
||||
|
||||
public String[] getArgs()
|
||||
{
|
||||
return this.parameters;
|
||||
}
|
||||
|
||||
/** Some functions to help get parameter arguments. */
|
||||
protected String getArg(int i)
|
||||
{
|
||||
if (i >= 0 && i < this.parameters.length)
|
||||
{
|
||||
return this.parameters[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
this.ticks = nbt.getInteger("ticks");
|
||||
this.pos = new Vector2(nbt.getDouble("xx"),nbt.getDouble("yy"));
|
||||
this.pos = new Vector2(nbt.getDouble("xx"), nbt.getDouble("yy"));
|
||||
return this;
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public interface IArmbotTask
|
|||
|
||||
/** Passed in from both the armbot to the program manager then here after a Computer craft
|
||||
* machine calls a this commands method name. {@IPeripheral #callMethod()} */
|
||||
public Object[] onCCMethodCalled(IComputerAccess computer, ILuaContext context, Object[] arguments) throws Exception;
|
||||
public Object[] onCCMethodCalled(World world, Vector3 location, IArmbot armbot, IComputerAccess computer, ILuaContext context, Object[] arguments) throws Exception;
|
||||
|
||||
/** Update the current part of the command */
|
||||
public boolean onUpdate();
|
||||
|
|
|
@ -26,6 +26,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.api.al.armbot.IArmbot;
|
||||
import dark.assembly.common.AssemblyLine;
|
||||
import dark.assembly.common.armbot.command.CommandDrop;
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.core.prefab.helpers.ItemWorldHelper;
|
||||
|
||||
/** Used by arms to break a specific block in a position.
|
||||
|
@ -26,22 +26,22 @@ public class CommandBreak extends Command
|
|||
|
||||
Vector3 serachPosition = this.tileEntity.getHandPosition();
|
||||
|
||||
Block block = Block.blocksList[serachPosition.getBlockID(this.world)];
|
||||
Block block = Block.blocksList[serachPosition.getBlockID(this.worldObj)];
|
||||
|
||||
if (block != null && BREAK_TIME <= this.ticks)
|
||||
{
|
||||
ArrayList<ItemStack> items = block.getBlockDropped(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), serachPosition.getBlockMetadata(world), 0);
|
||||
ArrayList<ItemStack> items = block.getBlockDropped(this.worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), serachPosition.getBlockMetadata(worldObj), 0);
|
||||
|
||||
if (!this.keep || items.size() > 1)
|
||||
{
|
||||
ItemWorldHelper.dropBlockAsItem(this.world, serachPosition);
|
||||
ItemWorldHelper.dropBlockAsItem(this.worldObj, serachPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tileEntity.grabEntity(new EntityItem(this.world, serachPosition.intX() + 0.5D, serachPosition.intY() + 0.5D, serachPosition.intZ() + 0.5D, items.get(0)));
|
||||
this.tileEntity.grabEntity(new EntityItem(this.worldObj, serachPosition.intX() + 0.5D, serachPosition.intY() + 0.5D, serachPosition.intZ() + 0.5D, items.get(0)));
|
||||
}
|
||||
|
||||
world.setBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), 0, 0, 3);
|
||||
worldObj.setBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), 0, 0, 3);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
|
||||
public class CommandDrop extends Command
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ public class CommandDrop extends Command
|
|||
super.onUpdate();
|
||||
|
||||
this.tileEntity.drop("all");
|
||||
this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true);
|
||||
this.worldObj.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package dark.assembly.common.armbot.command;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -68,7 +68,7 @@ public class CommandFire extends Command
|
|||
Entity held = this.tileEntity.getGrabbedEntities().get(0);
|
||||
if (held != null)
|
||||
{
|
||||
this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.bow", velocity, 2f - (velocity / 4f), true);
|
||||
this.worldObj.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.bow", velocity, 2f - (velocity / 4f), true);
|
||||
if (held instanceof EntityItem)
|
||||
{
|
||||
EntityItem item = (EntityItem) held;
|
||||
|
@ -83,26 +83,26 @@ public class CommandFire extends Command
|
|||
else
|
||||
{
|
||||
this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).onUpdate();
|
||||
if (!this.world.isRemote)
|
||||
this.world.removeEntity(held);
|
||||
if (!this.worldObj.isRemote)
|
||||
this.worldObj.removeEntity(held);
|
||||
}
|
||||
if (item.getEntityItem().itemID == Item.arrow.itemID)
|
||||
{
|
||||
EntityArrow arrow = new EntityArrow(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z);
|
||||
EntityArrow arrow = new EntityArrow(worldObj, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z);
|
||||
arrow.motionX = this.finalVelocity.x;
|
||||
arrow.motionY = this.finalVelocity.y;
|
||||
arrow.motionZ = this.finalVelocity.z;
|
||||
if (!this.world.isRemote)
|
||||
this.world.spawnEntityInWorld(arrow);
|
||||
if (!this.worldObj.isRemote)
|
||||
this.worldObj.spawnEntityInWorld(arrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityItem item2 = new EntityItem(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z, thrown);
|
||||
EntityItem item2 = new EntityItem(worldObj, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z, thrown);
|
||||
item2.motionX = this.finalVelocity.x;
|
||||
item2.motionY = this.finalVelocity.y;
|
||||
item2.motionZ = this.finalVelocity.z;
|
||||
if (!this.world.isRemote)
|
||||
this.world.spawnEntityInWorld(item2);
|
||||
if (!this.worldObj.isRemote)
|
||||
this.worldObj.spawnEntityInWorld(item2);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.assembly.common.machine.InvInteractionHelper;
|
||||
|
||||
public class CommandGive extends Command
|
||||
|
@ -54,7 +54,7 @@ public class CommandGive extends Command
|
|||
@Override
|
||||
protected boolean onUpdate()
|
||||
{
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.world);
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.worldObj);
|
||||
|
||||
if (targetTile != null && this.tileEntity.getGrabbedItems().size() > 0)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.assembly.common.armbot.GrabDictionary;
|
||||
import dark.assembly.common.machine.belt.TileEntityConveyorBelt;
|
||||
|
||||
|
@ -68,11 +68,11 @@ public class CommandGrab extends Command
|
|||
}
|
||||
|
||||
Vector3 serachPosition = this.tileEntity.getHandPosition();
|
||||
List<Entity> found = this.world.getEntitiesWithinAABB(this.entityToInclude, AxisAlignedBB.getBoundingBox(serachPosition.x - radius, serachPosition.y - radius, serachPosition.z - radius, serachPosition.x + radius, serachPosition.y + radius, serachPosition.z + radius));
|
||||
List<Entity> found = this.worldObj.getEntitiesWithinAABB(this.entityToInclude, AxisAlignedBB.getBoundingBox(serachPosition.x - radius, serachPosition.y - radius, serachPosition.z - radius, serachPosition.x + radius, serachPosition.y + radius, serachPosition.z + radius));
|
||||
|
||||
TileEntity ent = serachPosition.getTileEntity(world);
|
||||
TileEntity ent = serachPosition.getTileEntity(worldObj);
|
||||
Vector3 searchPostion2 = Vector3.add(serachPosition, new Vector3(0, -1, 0));
|
||||
TileEntity ent2 = searchPostion2.getTileEntity(world);
|
||||
TileEntity ent2 = searchPostion2.getTileEntity(worldObj);
|
||||
if (ent instanceof TileEntityConveyorBelt)
|
||||
{
|
||||
this.belt = (TileEntityConveyorBelt) ent;
|
||||
|
@ -89,7 +89,7 @@ public class CommandGrab extends Command
|
|||
if (found.get(i) != null && !(found.get(i) instanceof EntityArrow) && !(found.get(i) instanceof EntityPlayer) && found.get(i).ridingEntity == null && (!(found.get(i) instanceof EntityAgeable) || (found.get(i) instanceof EntityAgeable && child == ((EntityAgeable) found.get(i)).isChild())))
|
||||
{
|
||||
this.tileEntity.grabEntity(found.get(i));
|
||||
this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true);
|
||||
this.worldObj.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true);
|
||||
if (this.belt != null)
|
||||
{
|
||||
belt.ignoreEntity(found.get(i));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import universalelectricity.core.vector.Vector2;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.api.al.armbot.IArmbotTask;
|
||||
import dark.api.al.armbot.ISplitArmbotTask;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
|
||||
public class CommandIF extends Command implements ISplitArmbotTask
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ public class CommandIF extends Command implements ISplitArmbotTask
|
|||
@Override
|
||||
public IArmbotTask getExitPoint()
|
||||
{
|
||||
if(this.isTrue)
|
||||
if (this.isTrue)
|
||||
{
|
||||
return this.exitTruePoint;
|
||||
}
|
||||
|
@ -66,6 +66,18 @@ public class CommandIF extends Command implements ISplitArmbotTask
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Command readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CommandIdle extends Command
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -30,7 +30,7 @@ public class CommandPlace extends Command
|
|||
|
||||
Vector3 serachPosition = this.tileEntity.getHandPosition();
|
||||
|
||||
Block block = Block.blocksList[serachPosition.getBlockID(this.world)];
|
||||
Block block = Block.blocksList[serachPosition.getBlockID(this.worldObj)];
|
||||
|
||||
if (block == null && ticks >= this.PLACE_TIME)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ public class CommandPlace extends Command
|
|||
{
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
((ItemBlock) itemStack.getItem()).placeBlockAt(itemStack, null, this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), 0, 0.5f, 0.5f, 0.5f, itemStack.getItemDamage());
|
||||
((ItemBlock) itemStack.getItem()).placeBlockAt(itemStack, null, this.worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), 0, 0.5f, 0.5f, 0.5f, itemStack.getItemDamage());
|
||||
|
||||
this.tileEntity.drop(entity);
|
||||
return false;
|
||||
|
@ -52,21 +52,21 @@ public class CommandPlace extends Command
|
|||
else if (itemStack.getItem() instanceof IPlantable)
|
||||
{
|
||||
IPlantable plantable = ((IPlantable) itemStack.getItem());
|
||||
Block blockBelow = Block.blocksList[Vector3.add(serachPosition, new Vector3(0, -1, 0)).getBlockID(this.world)];
|
||||
Block blockBelow = Block.blocksList[Vector3.add(serachPosition, new Vector3(0, -1, 0)).getBlockID(this.worldObj)];
|
||||
|
||||
if (blockBelow != null)
|
||||
{
|
||||
if (blockBelow.canSustainPlant(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), ForgeDirection.UP, plantable))
|
||||
if (blockBelow.canSustainPlant(this.worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), ForgeDirection.UP, plantable))
|
||||
{
|
||||
int blockID = plantable.getPlantID(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
int blockMetadata = plantable.getPlantMetadata(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
int blockID = plantable.getPlantID(this.worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
int blockMetadata = plantable.getPlantMetadata(this.worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
|
||||
if (this.world.setBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockID, blockMetadata, 3))
|
||||
if (this.worldObj.setBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockID, blockMetadata, 3))
|
||||
{
|
||||
if (this.world.getBlockId(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()) == blockID)
|
||||
if (this.worldObj.getBlockId(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()) == blockID)
|
||||
{
|
||||
Block.blocksList[blockID].onBlockPlacedBy(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null, itemStack);
|
||||
Block.blocksList[blockID].onPostBlockPlaced(world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockMetadata);
|
||||
Block.blocksList[blockID].onBlockPlacedBy(worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null, itemStack);
|
||||
Block.blocksList[blockID].onPostBlockPlaced(worldObj, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockMetadata);
|
||||
this.tileEntity.drop(entity);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.core.prefab.helpers.ItemWorldHelper;
|
||||
|
||||
public class CommandPowerTo extends Command
|
||||
|
@ -46,12 +46,12 @@ public class CommandPowerTo extends Command
|
|||
else if (this.tileEntity.isProvidingPower)
|
||||
{
|
||||
Vector3 loc = this.tileEntity.getHandPosition();
|
||||
world.spawnParticle("smoke", loc.x, loc.y, loc.z, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", loc.x, loc.y, loc.z, 0.0D, 0.0D, 0.0D);
|
||||
worldObj.spawnParticle("smoke", loc.x, loc.y, loc.z, 0.0D, 0.0D, 0.0D);
|
||||
worldObj.spawnParticle("flame", loc.x, loc.y, loc.z, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
Block block = Block.blocksList[this.world.getBlockId(tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ())];
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.world);
|
||||
Block block = Block.blocksList[this.worldObj.getBlockId(tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ())];
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.worldObj);
|
||||
|
||||
if (this.tileEntity.getGrabbedItems().size() > 0)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ public class CommandPowerTo extends Command
|
|||
for (int i = 2; i < 6; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||
this.world.notifyBlocksOfNeighborChange(this.tileEntity.xCoord + dir.offsetX, this.tileEntity.yCoord + dir.offsetY, this.tileEntity.zCoord + dir.offsetZ, id);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.tileEntity.xCoord + dir.offsetX, this.tileEntity.yCoord + dir.offsetY, this.tileEntity.zCoord + dir.offsetZ, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/** This task resets all previous tasks and does them again in a loop.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
|
||||
public class CommandReturn extends Command
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/** Rotates the armbot to a specific direction. If not specified, it will turn right.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package dark.assembly.common.armbot.command;
|
||||
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/** Rotates the armbot to a specific direction. If not specified, it will turn right.
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.assembly.common.machine.InvInteractionHelper;
|
||||
|
||||
public class CommandTake extends Command
|
||||
|
@ -53,7 +53,7 @@ public class CommandTake extends Command
|
|||
@Override
|
||||
protected boolean onUpdate()
|
||||
{
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.world);
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.worldObj);
|
||||
|
||||
if (targetTile != null && this.tileEntity.getGrabbedItems().size() <= 0)
|
||||
{
|
||||
|
|
|
@ -3,8 +3,8 @@ package dark.assembly.common.armbot.command;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import dark.api.al.armbot.Command;
|
||||
import dark.api.al.armbot.IArmbotUseable;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
|
||||
public class CommandUse extends Command
|
||||
{
|
||||
|
@ -29,8 +29,8 @@ public class CommandUse extends Command
|
|||
@Override
|
||||
protected boolean onUpdate()
|
||||
{
|
||||
Block block = Block.blocksList[this.world.getBlockId(tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ())];
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.world);
|
||||
Block block = Block.blocksList[this.worldObj.getBlockId(tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ())];
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity(this.worldObj);
|
||||
|
||||
if (targetTile != null)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ public class CommandUse extends Command
|
|||
{
|
||||
try
|
||||
{
|
||||
boolean f = block.onBlockActivated(this.world, tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ(), null, 0, 0, 0, 0);
|
||||
boolean f = block.onBlockActivated(this.worldObj, tileEntity.getHandPosition().intX(), tileEntity.getHandPosition().intY(), tileEntity.getHandPosition().intZ(), null, 0, 0, 0, 0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import dark.assembly.common.armbot.Command;
|
||||
import dark.api.al.armbot.Command;
|
||||
|
||||
public class TileEntityEncoder extends TileEntityAdvanced implements IPacketReceiver, ISidedInventory
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue