Reformat
This commit is contained in:
parent
3fe2e0b919
commit
d3a40a764b
2 changed files with 47 additions and 42 deletions
|
@ -4,7 +4,7 @@ import net.minecraft.src.TileEntity;
|
|||
|
||||
/**
|
||||
* An AI Task that is used by TileEntities with
|
||||
* simple AI.
|
||||
* AI.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
|
@ -32,11 +32,15 @@ public abstract class Task
|
|||
* - The amount of ticks this task
|
||||
* has been elapsed for.
|
||||
*/
|
||||
protected void onDoTask()
|
||||
protected void doTask()
|
||||
{
|
||||
this.ticks++;
|
||||
}
|
||||
|
||||
public void resetTask()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the task should keep
|
||||
* executing.
|
||||
|
|
|
@ -11,14 +11,16 @@ import net.minecraft.src.Packet250CustomPayload;
|
|||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class TileEntityCraftingArm extends TileEntityBase implements IElectricityReceiver {
|
||||
public class TileEntityCraftingArm extends TileEntityBase implements IElectricityReceiver
|
||||
{
|
||||
public enum armTasks
|
||||
{
|
||||
NONE,COLLECT,MINE,PLACE,SORT,CRAFT
|
||||
NONE, COLLECT, MINE, PLACE, SORT, CRAFT
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity robotic arm to be used with this tileEntity
|
||||
* Entity robotic arm to be used with this
|
||||
* tileEntity
|
||||
*/
|
||||
public EntityCraftingArm EntityArm = null;
|
||||
|
||||
|
@ -39,7 +41,7 @@ public class TileEntityCraftingArm extends TileEntityBase implements IElectricit
|
|||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
if(this.ticks % 5 == 0 && !this.isDisabled() && this.hasTask && EntityArm != null)
|
||||
if (this.ticks % 5 == 0 && !this.isDisabled() && this.hasTask && EntityArm != null)
|
||||
{
|
||||
this.jouleReceived -= this.wattUsed;
|
||||
this.doWork();
|
||||
|
@ -47,7 +49,8 @@ public class TileEntityCraftingArm extends TileEntityBase implements IElectricit
|
|||
}
|
||||
|
||||
/**
|
||||
* controls the robotic arm into doing a set task
|
||||
* controls the robotic arm into doing a set
|
||||
* task
|
||||
*/
|
||||
public void doWork()
|
||||
{
|
||||
|
@ -58,60 +61,59 @@ public class TileEntityCraftingArm extends TileEntityBase implements IElectricit
|
|||
* UE methods
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(TileEntity sender, double amps, double voltage,
|
||||
ForgeDirection side) {
|
||||
this.jouleReceived = Math.max(jouleReceived + (amps * voltage),
|
||||
maxJoules);
|
||||
public void onReceive(TileEntity sender, double amps, double voltage, ForgeDirection side)
|
||||
{
|
||||
this.jouleReceived = Math.max(jouleReceived + (amps * voltage), maxJoules);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double wattRequest() {
|
||||
public double wattRequest()
|
||||
{
|
||||
return maxJoules - jouleReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveFromSide(ForgeDirection side) {
|
||||
if (side != ForgeDirection.UP) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void onDisable(int duration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDisabled() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection side) {
|
||||
if(side != ForgeDirection.UP)
|
||||
public boolean canReceiveFromSide(ForgeDirection side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (side != ForgeDirection.UP) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage() {
|
||||
public void onDisable(int duration)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisabled()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection side)
|
||||
{
|
||||
if (side != ForgeDirection.UP) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 120;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data
|
||||
*/
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType,
|
||||
Packet250CustomPayload packet, EntityPlayer player,
|
||||
ByteArrayDataInput dataStream) {
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
@ -120,18 +122,17 @@ public class TileEntityCraftingArm extends TileEntityBase implements IElectricit
|
|||
* inventory
|
||||
*/
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
public int getSizeInventory()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getInvName() {
|
||||
public String getInvName()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return "RoboticArm";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue