commit
8767ddda66
17 changed files with 72 additions and 50 deletions
|
@ -33,7 +33,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(modid = AssemblyLine.CHANNEL, name = AssemblyLine.NAME, version = AssemblyLine.VERSION, dependencies = "after:BasicComponents")
|
||||
@Mod(modid = AssemblyLine.CHANNEL, name = AssemblyLine.NAME, version = AssemblyLine.VERSION, dependencies = "required-after:BasicComponents")
|
||||
@NetworkMod(channels = { AssemblyLine.CHANNEL }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketManager.class)
|
||||
public class AssemblyLine
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package assemblyline.ai;
|
||||
|
||||
import assemblyline.machines.crafter.TileEntityCraftingArm;
|
||||
import assemblyline.machine.crafter.TileEntityCraftingArm;
|
||||
|
||||
/**
|
||||
* An AI Task that is used by TileEntities with AI.
|
||||
|
@ -19,11 +19,11 @@ public abstract class Task
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when a task is being done.
|
||||
* Called by the TaskManager to propagate tick updates
|
||||
*
|
||||
* @param ticks
|
||||
* The amount of ticks this task has been elapsed for.
|
||||
* @return Return true if the task is not finished and false if it is.
|
||||
* The amount of ticks this task has been running
|
||||
* @return false if the task is finished and can be removed, true otherwise
|
||||
*/
|
||||
protected boolean doTask()
|
||||
{
|
||||
|
@ -33,7 +33,6 @@ public abstract class Task
|
|||
|
||||
public void onTaskStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onTaskEnd()
|
||||
|
@ -41,10 +40,10 @@ public abstract class Task
|
|||
}
|
||||
|
||||
/**
|
||||
* @return The tick interval of this task. Return 0 for no ticks.
|
||||
* @return The tick interval of this task. 0 means it will receive no update ticks.
|
||||
*/
|
||||
public int getTickInterval()
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package assemblyline.ai;
|
||||
|
||||
import assemblyline.machines.crafter.TileEntityCraftingArm;
|
||||
import assemblyline.machine.crafter.TileEntityCraftingArm;
|
||||
|
||||
public class TaskIdle extends Task
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package assemblyline.ai;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
@ -22,8 +23,11 @@ public class TaskManager
|
|||
*/
|
||||
try
|
||||
{
|
||||
for (Task task : this.tasks)
|
||||
Task task;
|
||||
Iterator<Task> iter = tasks.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
task = iter.next();
|
||||
if (task.getTickInterval() > 0)
|
||||
{
|
||||
if (this.ticks % task.getTickInterval() == 0)
|
||||
|
@ -31,7 +35,7 @@ public class TaskManager
|
|||
if (!task.doTask())
|
||||
{
|
||||
task.onTaskEnd();
|
||||
tasks.remove(task);
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,14 +50,24 @@ public class TaskManager
|
|||
this.ticks++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to register Tasks for a TileEntity, executes onTaskStart
|
||||
* for the Task after registering it
|
||||
*
|
||||
* @param tileEntity TE instance to register the task for
|
||||
* @param task Task instance to register
|
||||
*/
|
||||
public void addTask(TileEntity tileEntity, Task task)
|
||||
{
|
||||
task.onTaskStart();
|
||||
tasks.add(task);
|
||||
task.onTaskStart();
|
||||
}
|
||||
|
||||
public boolean hasTask()
|
||||
/**
|
||||
* @return true when there are tasks registered, false otherwise
|
||||
*/
|
||||
public boolean hasTasks()
|
||||
{
|
||||
return this.tasks.size() > 0;
|
||||
return !tasks.isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface IBelt
|
|||
|
||||
/**
|
||||
* Causes the belt to ignore the entity for a few updates help in cases where another machine
|
||||
* need to effect this entity without the belt doing so as well.
|
||||
* needs to affect this particular entity without the belt interfering
|
||||
*
|
||||
* @param entity
|
||||
* - entity being ignored
|
||||
|
@ -25,9 +25,9 @@ public interface IBelt
|
|||
public void ignoreEntity(Entity entity);
|
||||
|
||||
/**
|
||||
* Used to get a list of entities above this belt
|
||||
* Used to get a list of entities the belt exerts an effect upon.
|
||||
*
|
||||
* @return list of entities
|
||||
* @return list of entities in the belts are of effect
|
||||
*/
|
||||
public List<Entity> getEntityAbove();
|
||||
public List<Entity> getAffectedEntities();
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
|
|||
{
|
||||
try
|
||||
{
|
||||
List<Entity> entityOnTop = this.getEntityAbove();
|
||||
List<Entity> entityOnTop = this.getAffectedEntities();
|
||||
|
||||
for (Entity entity : entityOnTop)
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
|
|||
return 0;
|
||||
}
|
||||
|
||||
public boolean middleBelt()
|
||||
public boolean getIsMiddleBelt()
|
||||
{
|
||||
|
||||
ForgeDirection front = ForgeDirection.getOrientation(getBeltDirection());
|
||||
|
@ -280,7 +280,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean FrontCap()
|
||||
public boolean getIsFrontCap()
|
||||
{
|
||||
|
||||
ForgeDirection front = ForgeDirection.getOrientation(getBeltDirection());
|
||||
|
@ -296,7 +296,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean BackCap()
|
||||
public boolean getIsBackCap()
|
||||
{
|
||||
|
||||
ForgeDirection front = ForgeDirection.getOrientation(getBeltDirection());
|
||||
|
@ -345,7 +345,8 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
|
|||
return ForgeDirection.getOrientation(this.getBeltDirection());
|
||||
}
|
||||
|
||||
public List<Entity> getEntityAbove()
|
||||
@Override
|
||||
public List<Entity> getAffectedEntities()
|
||||
{
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, this.xCoord + 1, this.yCoord + 1, this.zCoord + 1);
|
||||
return worldObj.getEntitiesWithinAABB(Entity.class, bounds);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityItem;
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import net.minecraft.src.Item;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import net.minecraft.src.EntityItem;
|
||||
import assemblyline.ai.Task;
|
|
@ -1,4 +1,6 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.Entity;
|
||||
|
@ -31,11 +33,17 @@ public class TaskArmSearch extends Task
|
|||
this.searchSpeed = searchSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskStart()
|
||||
{
|
||||
this.foundEntity = (Entity) this.tileEntity.worldObj.getEntitiesWithinAABB(this.entityToInclude, AxisAlignedBB.getBoundingBox(this.tileEntity.xCoord - this.radius, this.tileEntity.yCoord - this.radius, this.tileEntity.zCoord - this.radius, this.tileEntity.xCoord + this.radius, this.tileEntity.yCoord + this.radius, this.tileEntity.zCoord + this.radius)).get(0);
|
||||
}
|
||||
@Override
|
||||
public void onTaskStart()
|
||||
{
|
||||
List found = tileEntity.worldObj.getEntitiesWithinAABB(entityToInclude,
|
||||
AxisAlignedBB.getBoundingBox(tileEntity.xCoord - radius, tileEntity.yCoord - radius, tileEntity.zCoord - radius,
|
||||
tileEntity.xCoord + radius, tileEntity.yCoord + radius, tileEntity.zCoord + radius));
|
||||
if (found != null && !found.isEmpty())
|
||||
{
|
||||
foundEntity = (Entity) found.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean doTask()
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.INetworkManager;
|
|
@ -1,4 +1,4 @@
|
|||
package assemblyline.machines.crafter;
|
||||
package assemblyline.machine.crafter;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class TileEntityCraftingArm extends TileEntityElectricityReceiver impleme
|
|||
|
||||
taskManager.onUpdate();
|
||||
|
||||
if (this.ticks % 5 == 0 && !this.isDisabled() && this.taskManager.hasTask() && EntityArm != null)
|
||||
if (this.ticks % 5 == 0 && !this.isDisabled() && this.taskManager.hasTasks() && EntityArm != null)
|
||||
{
|
||||
this.wattsReceived -= this.WATT_REQUEST;
|
||||
this.doWork();
|
|
@ -13,11 +13,11 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
|
|||
{
|
||||
private ModelConveyorBelt model = new ModelConveyorBelt();
|
||||
|
||||
public void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f)
|
||||
private void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
String flip = "";// if(tileEntity.flip){flip
|
||||
// = "F";}
|
||||
boolean mid = tileEntity.middleBelt();
|
||||
boolean mid = tileEntity.getIsMiddleBelt();
|
||||
int face = tileEntity.getBeltDirection();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
@ -29,20 +29,20 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
|
|||
{
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 3)
|
||||
else if (face == 3)
|
||||
{
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 4)
|
||||
else if (face == 4)
|
||||
{
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 5)
|
||||
else if (face == 5)
|
||||
{
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
}
|
||||
int ent = tileEntity.worldObj.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
model.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.BackCap(), tileEntity.FrontCap(), false);
|
||||
model.render(0.0625F, (float) Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsBackCap(), tileEntity.getIsFrontCap(), false);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public class RenderManipulator extends TileEntitySpecialRenderer
|
|||
{
|
||||
private ModelManipulator model = new ModelManipulator();
|
||||
|
||||
public void renderAModelAt(TileEntityManipulator tileEntity, double x, double y, double z, float f)
|
||||
private void renderAModelAt(TileEntityManipulator tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
int face = tileEntity.getBeltDirection().ordinal();
|
||||
|
||||
|
@ -34,15 +34,15 @@ public class RenderManipulator extends TileEntitySpecialRenderer
|
|||
{
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 3)
|
||||
else if (face == 3)
|
||||
{
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 4)
|
||||
else if (face == 4)
|
||||
{
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 5)
|
||||
else if (face == 5)
|
||||
{
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class RenderSorter extends TileEntitySpecialRenderer
|
|||
{
|
||||
private ModelSorter model = new ModelSorter();
|
||||
|
||||
public void renderAModelAt(TileEntityRejector tileEntity, double x, double y, double z, float f)
|
||||
private void renderAModelAt(TileEntityRejector tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
boolean fire = tileEntity.firePiston;
|
||||
int face = tileEntity.getDirection(tileEntity.worldObj.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
|
@ -34,11 +34,11 @@ public class RenderSorter extends TileEntitySpecialRenderer
|
|||
{
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 4)
|
||||
else if (face == 4)
|
||||
{
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
}
|
||||
if (face == 5)
|
||||
else if (face == 5)
|
||||
{
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue