This commit is contained in:
Henry Mao 2012-11-28 18:29:26 +08:00
parent 14295aece6
commit 232988887a
22 changed files with 75 additions and 141 deletions

View file

@ -1,11 +1,9 @@
package assemblyline.ai; package assemblyline.ai;
import net.minecraft.src.TileEntity;
import assemblyline.machines.crafter.TileEntityCraftingArm; import assemblyline.machines.crafter.TileEntityCraftingArm;
/** /**
* An AI Task that is used by TileEntities with * An AI Task that is used by TileEntities with AI.
* AI.
* *
* @author Calclavia * @author Calclavia
* *
@ -14,18 +12,18 @@ public abstract class Task
{ {
protected int ticks; protected int ticks;
protected TileEntityCraftingArm tileEntity; protected TileEntityCraftingArm tileEntity;
public Task(TileEntityCraftingArm arm) public Task(TileEntityCraftingArm arm)
{ {
this.tileEntity = arm; this.tileEntity = arm;
} }
/** /**
* Called when a task is being done. * Called when a task is being done.
* *
* @param ticks * @param ticks
* The amount of ticks this task * The amount of ticks this task has been elapsed for.
* has been elapsed for. * @return Return true if the task is not finished and false if it is.
* @return Return true if the task is not
* finished and false if it is.
*/ */
protected boolean doTask() protected boolean doTask()
{ {
@ -43,8 +41,7 @@ public abstract class Task
} }
/** /**
* @return The tick interval of this task. * @return The tick interval of this task. Return 0 for no ticks.
* Return 0 for no ticks.
*/ */
public int getTickInterval() public int getTickInterval()
{ {

View file

@ -1,7 +1,6 @@
package assemblyline.ai; package assemblyline.ai;
import assemblyline.machines.crafter.TileEntityCraftingArm; import assemblyline.machines.crafter.TileEntityCraftingArm;
import net.minecraft.src.TileEntity;
public class TaskIdle extends Task public class TaskIdle extends Task
{ {
@ -9,12 +8,11 @@ public class TaskIdle extends Task
{ {
super(arm); super(arm);
} }
protected boolean doTask() protected boolean doTask()
{ {
/** /**
* randomly move the arm to * randomly move the arm to similate life in the arm if the arm is powered
* similate life in the arm
* if the arm is powered
*/ */
return true; return true;

View file

@ -8,19 +8,16 @@ import net.minecraftforge.common.ForgeDirection;
public interface IBelt public interface IBelt
{ {
/** /**
* Gets the facing direction of the belt, used * Gets the facing direction of the belt, used but other machines to know which direction to
* but other machines to know which direction * start an item at
* to start an item at
* *
* @return * @return
*/ */
public ForgeDirection getFacing(); public ForgeDirection getFacing();
/** /**
* Causes the belt to ignore the entity for a * Causes the belt to ignore the entity for a few updates help in cases where another machine
* few updates help in cases where another * need to effect this entity without the belt doing so as well.
* machine need to effect this entity without
* the belt doing so as well.
* *
* @param entity * @param entity
* - entity being ignored * - entity being ignored
@ -28,8 +25,7 @@ public interface IBelt
public void ignoreEntity(Entity entity); public void ignoreEntity(Entity entity);
/** /**
* Used to get a list of entities above this * Used to get a list of entities above this belt
* belt
* *
* @return list of entities * @return list of entities
*/ */

View file

@ -6,8 +6,7 @@ import universalelectricity.core.vector.Vector3;
public interface IManipulator public interface IManipulator
{ {
/** /**
* Throws the items from the manipulator into * Throws the items from the manipulator into the world
* the world
* *
* @param outputPosition * @param outputPosition
* @param items * @param items

View file

@ -17,8 +17,7 @@ public class BlockArchitectTable extends Block
} }
/** /**
* Returns the block texture based on the side * Returns the block texture based on the side being looked at. Args: side
* being looked at. Args: side
*/ */
public int getBlockTextureFromSide(int par1) public int getBlockTextureFromSide(int par1)
{ {
@ -26,8 +25,7 @@ public class BlockArchitectTable extends Block
} }
/** /**
* Called upon block activation (right click * Called upon block activation (right click on the block.)
* on the block.)
*/ */
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{ {

View file

@ -19,8 +19,7 @@ import assemblyline.render.RenderHelper;
import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.PacketDispatcher;
/** /**
* A metadata block containing a bunch of machines * A metadata block containing a bunch of machines with direction.
* with direction.
* *
* @author Darkguardsman, Calclavia * @author Darkguardsman, Calclavia
* *
@ -55,8 +54,7 @@ public class BlockMulti extends BlockMachine
} }
/** /**
* Gets the direction based on the * Gets the direction based on the metadata
* metadata
* *
* @return A direction value from 0 to 4. * @return A direction value from 0 to 4.
*/ */
@ -68,8 +66,7 @@ public class BlockMulti extends BlockMachine
/** /**
* @param currentDirection * @param currentDirection
* - An integer from 0 to 4. * - An integer from 0 to 4.
* @return The metadata this block should * @return The metadata this block should change into.
* change into.
*/ */
public int getNextDirectionMeta(int currentDirection) public int getNextDirectionMeta(int currentDirection)
{ {
@ -199,8 +196,7 @@ public class BlockMulti extends BlockMachine
} }
/** /**
* Returns the bounding box of the wired * Returns the bounding box of the wired rectangular prism to render.
* rectangular prism to render.
*/ */
@Override @Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int x, int y, int z) public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int x, int y, int z)
@ -209,10 +205,8 @@ public class BlockMulti extends BlockMachine
} }
/** /**
* Returns a bounding box from the pool of * Returns a bounding box from the pool of bounding boxes (this means this box can change after
* bounding boxes (this means this box can * the pool has been cleared to be reused)
* change after the pool has been cleared to
* be reused)
*/ */
@Override @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int x, int y, int z) public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int x, int y, int z)

View file

@ -41,9 +41,7 @@ public class ContainerSorter extends Container
} }
/** /**
* Called to transfer a stack from one * Called to transfer a stack from one inventory to the other eg. when shift clicking.
* inventory to the other eg. when shift
* clicking.
*/ */
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1)

View file

@ -40,8 +40,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
public double wattsReceived = 0; public double wattsReceived = 0;
/** /**
* Is the manipulator wrenched to turn into * Is the manipulator wrenched to turn into output mode?
* output mode?
*/ */
public boolean isOutput = false; public boolean isOutput = false;
@ -65,9 +64,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
if (!this.isOutput) if (!this.isOutput)
{ {
/** /**
* Find items going into the * Find items going into the manipulator and input them into an inventory behind
* manipulator and input them
* into an inventory behind
* this manipulator. * this manipulator.
*/ */
Vector3 inputPosition = Vector3.get(this); Vector3 inputPosition = Vector3.get(this);
@ -87,11 +84,8 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
for (EntityItem entity : itemsInBound) for (EntityItem entity : itemsInBound)
{ {
/** /**
* Try top first, then * Try top first, then bottom, then the sides to see if it is possible to
* bottom, then the sides * insert the item into a inventory.
* to see if it is
* possible to insert the
* item into a inventory.
*/ */
ItemStack remainingStack = this.tryPlaceInPosition(entity.item.copy(), outputUp, ForgeDirection.DOWN); ItemStack remainingStack = this.tryPlaceInPosition(entity.item.copy(), outputUp, ForgeDirection.DOWN);
@ -116,10 +110,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
else else
{ {
/** /**
* Finds the connected * Finds the connected inventory and outputs the items upon a redstone pulse.
* inventory and outputs the
* items upon a redstone
* pulse.
*/ */
if (this.isPowered) if (this.isPowered)
{ {
@ -165,8 +156,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
} }
/** /**
* Throws the items from the manipulator into * Throws the items from the manipulator into the world.
* the world.
* *
* @param outputPosition * @param outputPosition
* @param items * @param items
@ -181,11 +171,9 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
} }
/** /**
* Tries to place an itemStack in a specific * Tries to place an itemStack in a specific position if it is an inventory.
* position if it is an inventory.
* *
* @return The ItemStack remained after place * @return The ItemStack remained after place attempt
* attempt
*/ */
private ItemStack tryPlaceInPosition(ItemStack itemStack, Vector3 position, ForgeDirection direction) private ItemStack tryPlaceInPosition(ItemStack itemStack, Vector3 position, ForgeDirection direction)
{ {
@ -286,8 +274,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
} }
/** /**
* Tries to take a item from a inventory at a * Tries to take a item from a inventory at a specific position.
* specific position.
* *
* @param position * @param position
* @return * @return

View file

@ -72,8 +72,7 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements
super.updateEntity(); super.updateEntity();
/** /**
* Has to update a bit faster than a * Has to update a bit faster than a conveyer belt
* conveyer belt
*/ */
if (this.ticks % 5 == 0 && !this.isDisabled()) if (this.ticks % 5 == 0 && !this.isDisabled())
{ {
@ -225,10 +224,8 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements
} }
/** /**
* Used to change any one of the boolean value * Used to change any one of the boolean value of on/off array After changing the value if it
* of on/off array After changing the value if * was changed client side it will send a packet server side with the changes
* it was changed client side it will send a
* packet server side with the changes
* *
* @param i * @param i
*/ */

View file

@ -7,7 +7,6 @@ import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList; import net.minecraft.src.NBTTagList;
import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import universalelectricity.prefab.tile.TileEntityElectricityReceiver;

View file

@ -133,8 +133,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
} }
/** /**
* almost unneeded but is change for each * almost unneeded but is change for each different belt type
* different belt type
*/ */
public void doBeltAction() public void doBeltAction()
{ {
@ -147,8 +146,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
* @param extendLife * @param extendLife
* - increases the items life * - increases the items life
* @param preventPickUp * @param preventPickUp
* - prevent a player from picking * - prevent a player from picking the item up
* the item up
*/ */
public void conveyItemsHorizontal(boolean extendLife, boolean preventPickUp) public void conveyItemsHorizontal(boolean extendLife, boolean preventPickUp)
{ {
@ -159,6 +157,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
for (Entity entity : entityOnTop) for (Entity entity : entityOnTop)
{ {
int direction = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); int direction = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if (!this.entityIgnoreList.contains(entity)) if (!this.entityIgnoreList.contains(entity))
{ {
if (!(entity instanceof EntityPlayer && ((EntityPlayer) entity).isSneaking())) if (!(entity instanceof EntityPlayer && ((EntityPlayer) entity).isSneaking()))
@ -185,6 +184,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
} }
} }
} }
if (this.clearCount++ >= 4) if (this.clearCount++ >= 4)
{ {
// clear the temp ignore // clear the temp ignore

View file

@ -1,9 +1,8 @@
package assemblyline.machine.belt; package assemblyline.machine.belt;
/** /**
* For the moment this is just a render place * For the moment this is just a render place holder, but will be convered to prevent item pickups
* holder, but will be convered to prevent item * from the belts.
* pickups from the belts.
* *
* @author Rseifert * @author Rseifert
* *

View file

@ -20,8 +20,7 @@ public class TileEntityElevatorBelt extends TileEntityConveyorBelt
} }
/** /**
* Used to detect belt bellow for rendering * Used to detect belt bellow for rendering and to prevent items from falling
* and to prevent items from falling
* *
* @return * @return
*/ */
@ -33,8 +32,7 @@ public class TileEntityElevatorBelt extends TileEntityConveyorBelt
} }
/** /**
* Same as conveyItemHorizontal but will pull, * Same as conveyItemHorizontal but will pull, or lower the items up/down the belt like an
* or lower the items up/down the belt like an
* elevator * elevator
* *
* @param extendLife * @param extendLife

View file

@ -46,8 +46,7 @@ public class BlockCrafter extends BlockMachine
} }
/** /**
* Gets the direction based on the * Gets the direction based on the metadata
* metadata
* *
* @return A direction value from 0 to 4. * @return A direction value from 0 to 4.
*/ */
@ -59,8 +58,7 @@ public class BlockCrafter extends BlockMachine
/** /**
* @param currentDirection * @param currentDirection
* - An integer from 0 to 4. * - An integer from 0 to 4.
* @return The metadata this block should * @return The metadata this block should change into.
* change into.
*/ */
public int getNextDirectionMeta(int currentDirection) public int getNextDirectionMeta(int currentDirection)
{ {

View file

@ -8,8 +8,7 @@ import net.minecraft.src.ItemStack;
import net.minecraft.src.Slot; import net.minecraft.src.Slot;
/** /**
* I am planning to make the crafter not use a * I am planning to make the crafter not use a GUI.
* GUI.
* *
* @author Calclavia * @author Calclavia
* *
@ -54,9 +53,7 @@ public class ContainerCrafter extends Container
} }
/** /**
* Called to transfer a stack from one * Called to transfer a stack from one inventory to the other eg. when shift clicking.
* inventory to the other eg. when shift
* clicking.
*/ */
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1)

View file

@ -1,19 +1,16 @@
package assemblyline.machines.crafter; package assemblyline.machines.crafter;
import net.minecraft.src.EntityItem; import net.minecraft.src.EntityItem;
import net.minecraft.src.TileEntity;
import assemblyline.ai.Task; import assemblyline.ai.Task;
/** /**
* Used by arms to collect items in a specific * Used by arms to collect items in a specific region.
* region.
* *
* @author Calclavia * @author Calclavia
*/ */
public class TaskArmCollect extends Task public class TaskArmCollect extends Task
{ {
/** /**
* The item to be collected. * The item to be collected.
*/ */
@ -33,8 +30,7 @@ public class TaskArmCollect extends Task
if (entityItem == null) { return false; } if (entityItem == null) { return false; }
/** /**
* Slowly stretch down the arm's model and * Slowly stretch down the arm's model and grab the item
* grab the item
*/ */
return true; return true;

View file

@ -2,8 +2,6 @@ package assemblyline.machines.crafter;
import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.Entity; import net.minecraft.src.Entity;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import assemblyline.ai.Task; import assemblyline.ai.Task;
/** /**
@ -47,9 +45,7 @@ public class TaskArmSearch extends Task
if (this.entityToInclude == null || this.foundEntity == null) { return false; } if (this.entityToInclude == null || this.foundEntity == null) { return false; }
/** /**
* Move the robotic arm around and emulate * Move the robotic arm around and emulate an item search. Then initiate a collect task.
* an item search. Then initiate a collect
* task.
*/ */
return true; return true;

View file

@ -7,7 +7,6 @@ import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound; import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.NBTTagList; import net.minecraft.src.NBTTagList;
import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.tile.TileEntityElectricityReceiver; import universalelectricity.prefab.tile.TileEntityElectricityReceiver;
@ -25,8 +24,7 @@ public class TileEntityCraftingArm extends TileEntityElectricityReceiver impleme
private TaskManager taskManager = new TaskManager(); private TaskManager taskManager = new TaskManager();
/** /**
* Entity robotic arm to be used with this * Entity robotic arm to be used with this tileEntity
* tileEntity
*/ */
public EntityCraftingArm EntityArm = null; public EntityCraftingArm EntityArm = null;
@ -56,8 +54,7 @@ public class TileEntityCraftingArm extends TileEntityElectricityReceiver impleme
} }
/** /**
* controls the robotic arm into doing a set * controls the robotic arm into doing a set task
* task
*/ */
public void doWork() public void doWork()
{ {
@ -258,5 +255,4 @@ public class TileEntityCraftingArm extends TileEntityElectricityReceiver impleme
nbt.setTag("Items", var2); nbt.setTag("Items", var2);
} }
} }

View file

@ -28,9 +28,7 @@ public class GuiAutoCrafting extends GuiContainer
} }
/** /**
* Draw the foreground layer for the * Draw the foreground layer for the GuiContainer (everything in front of the items)
* GuiContainer (everything in front of the
* items)
*/ */
protected void drawGuiContainerForegroundLayer() protected void drawGuiContainerForegroundLayer()
{ {
@ -39,8 +37,7 @@ public class GuiAutoCrafting extends GuiContainer
} }
/** /**
* Draw the background layer for the * Draw the background layer for the GuiContainer (everything behind the items)
* GuiContainer (everything behind the items)
*/ */
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{ {

View file

@ -9,8 +9,7 @@ import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly; import cpw.mods.fml.common.asm.SideOnly;
/** /**
* Copied from GSM lib and modified for this mod * Copied from GSM lib and modified for this mod only
* only
* *
* @author Rseifert * @author Rseifert
* *

View file

@ -45,10 +45,8 @@ public class GuiSorter extends GuiContainer
} }
/** /**
* Fired when a control is clicked. This is * Fired when a control is clicked. This is the equivalent of
* the equivalent of * ActionListener.actionPerformed(ActionEvent e).
* ActionListener.actionPerformed(ActionEvent
* e).
*/ */
protected void actionPerformed(GuiButton button) protected void actionPerformed(GuiButton button)
{ {
@ -75,9 +73,7 @@ public class GuiSorter extends GuiContainer
} }
/** /**
* Draw the foreground layer for the * Draw the foreground layer for the GuiContainer (everything in front of the items)
* GuiContainer (everything in front of the
* items)
*/ */
@Override @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) protected void drawGuiContainerForegroundLayer(int par1, int par2)
@ -88,8 +84,7 @@ public class GuiSorter extends GuiContainer
} }
/** /**
* Draw the background layer for the * Draw the background layer for the GuiContainer (everything behind the items)
* GuiContainer (everything behind the items)
*/ */
@Override @Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)