This commit is contained in:
Henry Mao 2012-11-07 20:53:32 -08:00
parent 449890530c
commit bde67ef14d
20 changed files with 154 additions and 115 deletions

View file

@ -21,11 +21,9 @@ import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
@ -77,7 +75,7 @@ public class AssemblyLine
// Add Names
LanguageRegistry.addName(new ItemStack(blockConveyorBelt, 1), "Conveyor Belt");
for(MachineType type : MachineType.values())
for (MachineType type : MachineType.values())
{
LanguageRegistry.addName(new ItemStack(blockInteraction, 1, type.metadata), type.name);
}

View file

@ -2,11 +2,11 @@ package assemblyline.ai;
import java.util.List;
import universalelectricity.core.Vector3;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.EntityItem;
import net.minecraft.src.ItemStack;
import net.minecraft.src.World;
import universalelectricity.core.Vector3;
public class ArmHelper
{

View file

@ -5,23 +5,32 @@ import java.util.List;
import net.minecraft.src.Entity;
import net.minecraftforge.common.ForgeDirection;
public interface IBelt {
public interface IBelt
{
/**
* Gets the facing direction of the belt, used but other machines to know
* which direction to start an item at
* Gets the facing direction of the belt, used
* but other machines to know which direction
* to start an item at
*
* @return
*/
public ForgeDirection getFacing();
/**
* 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.
* @param entity - entity being ignored
* 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.
*
* @param entity
* - entity being ignored
*/
public void ignoreEntity(Entity entity);
/**
* Used to get a list of entities above this belt
* Used to get a list of entities above this
* belt
*
* @return list of entities
*/
public List<Entity> getEntityAbove();

View file

@ -1,5 +1,8 @@
package assemblyline.api;
public interface IBotArm {
//TODO will add methods here to change the arms task, target, location,etc as need by other mods
public interface IBotArm
{
// TODO will add methods here to change the
// arms task, target, location,etc as need by
// other mods
}

View file

@ -6,12 +6,16 @@ import universalelectricity.core.Vector3;
public interface IManipulator
{
/**
* Throws the items from the manipulator into the world
* Throws the items from the manipulator into
* the world
*
* @param outputPosition
* @param items
*/
public void rejectItem(Vector3 outputPosition, ItemStack items);
//TODO add a few more methods here to access the functions the manipulator
//can do. For example storing items, and retrieving items, or power on/off
// TODO add a few more methods here to access
// the functions the manipulator
// can do. For example storing items, and
// retrieving items, or power on/off
}

View file

@ -44,8 +44,7 @@ public class BlockConveyorBelt extends BlockMachine
par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 0);
return true;
}
else
if (metadata >= 7)
else if (metadata >= 7)
{
par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 4);
return true;
@ -68,8 +67,10 @@ public class BlockConveyorBelt extends BlockMachine
{
if (metadata >= 0 && metadata < 4) { return new TileEntityConveyorBelt(); }
if (metadata >= 4 && metadata < 8) { return new TileEntityCoveredBelt(); }
//if (metadata >= 8 && metadata < 12) { //TODO vertical Belt }
//if (metadata >= 12 && metadata < 16) { //TODO IDK}
// if (metadata >= 8 && metadata < 12) {
// //TODO vertical Belt }
// if (metadata >= 12 && metadata < 16) {
// //TODO IDK}
return null;
}

View file

@ -131,19 +131,26 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
this.doBeltAction();
}
}
/**
* almost unneeded but is change for each different belt type
* almost unneeded but is change for each
* different belt type
*/
public void doBeltAction()
{
this.conveyItemsHorizontal(true,false);
this.conveyItemsHorizontal(true, false);
}
/**
* Causes all items to be moved above the belt
* @param extendLife - increases the items life
* @param preventPickUp - prevent a player from picking the item up
*
* @param extendLife
* - increases the items life
* @param preventPickUp
* - prevent a player from picking
* the item up
*/
public void conveyItemsHorizontal(boolean extendLife, boolean preventPickUp )
public void conveyItemsHorizontal(boolean extendLife, boolean preventPickUp)
{
try
{
@ -154,27 +161,27 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
int direction = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if (!this.entityIgnoreList.contains(entity))
{
if(!(entity instanceof EntityPlayer && ((EntityPlayer)entity).isSneaking()))
if (!(entity instanceof EntityPlayer && ((EntityPlayer) entity).isSneaking()))
{
if (direction == 0)
{
entity.motionZ -= 1 * this.speed;
entity.posX = this.xCoord +0.5D;
entity.posX = this.xCoord + 0.5D;
}
if (direction == 1)
{
entity.motionX += 1 * this.speed;
entity.posZ = this.zCoord +0.5D;
entity.posZ = this.zCoord + 0.5D;
}
if (direction == 2)
{
entity.motionZ += 1 * this.speed;
entity.posX = this.xCoord +0.5D;
entity.posX = this.xCoord + 0.5D;
}
if (direction == 3)
{
entity.motionX -= 1 * this.speed;
entity.posZ = this.zCoord +0.5D;
entity.posZ = this.zCoord + 0.5D;
}
}
}
@ -204,6 +211,7 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
e.printStackTrace();
}
}
@Override
public Packet getDescriptionPacket()
{
@ -324,7 +332,8 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
}
@Override
public ForgeDirection getFacing() {
public ForgeDirection getFacing()
{
return ForgeDirection.getOrientation(this.getBeltDirection());
}

View file

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

View file

@ -16,36 +16,41 @@ public class TileEntityElevatorBelt extends TileEntityConveyorBelt
public void doBeltAction()
{
this.conveyItemsVertical(true,false);
this.conveyItemsVertical(true, false);
}
/**
* Used to detect belt bellow for rendering
* and to prevent items from falling
*
* @return
*/
public boolean isBellowABelt()
{
TileEntity ent = worldObj.getBlockTileEntity(xCoord, xCoord-1, zCoord);
if(ent instanceof TileEntityElevatorBelt)
{
return true;
}
TileEntity ent = worldObj.getBlockTileEntity(xCoord, xCoord - 1, zCoord);
if (ent instanceof TileEntityElevatorBelt) { return true; }
return false;
}
/**
* Same as conveyItemHorizontal but will pull, or lower the items up/down
* the belt like an elevator
* Same as conveyItemHorizontal but will pull,
* or lower the items up/down the belt like an
* elevator
*
* @param extendLife
* @param preventPickUp
*/
public void conveyItemsVertical(boolean extendLife, boolean preventPickUp )
public void conveyItemsVertical(boolean extendLife, boolean preventPickUp)
{
//TODO find all Entities in bounds
//Prevent entities from falling
//Find if can move up, only a few entities can be moved at a time, 1 EntityLiving, or 3 EntityItems
// ^ has to do with animation why only some not all move
//move those that can up
//IF top find belt, and/or throw slightly over the belt and back
// TODO find all Entities in bounds
// Prevent entities from falling
// Find if can move up, only a few
// entities can be moved at a time, 1
// EntityLiving, or 3 EntityItems
// ^ has to do with animation why only
// some not all move
// move those that can up
// IF top find belt, and/or throw slightly
// over the belt and back
}
}

View file

@ -2,8 +2,6 @@ package assemblyline.machines;
import java.util.List;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityLiving;
@ -17,6 +15,7 @@ import universalelectricity.implement.IRedstoneReceptor;
import universalelectricity.prefab.BlockMachine;
import assemblyline.AssemblyLine;
import assemblyline.render.RenderHelper;
import cpw.mods.fml.common.network.PacketDispatcher;
/**
* A metadata block containing a bunch of machines

View file

@ -2,8 +2,6 @@ package assemblyline.machines;
import java.util.List;
import com.google.common.io.ByteArrayDataInput;
import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
@ -27,7 +25,9 @@ import assemblyline.AssemblyLine;
import assemblyline.api.IManipulator;
import assemblyline.machines.BlockMulti.MachineType;
public class TileEntityManipulator extends TileEntityElectricityReceiver implements IRedstoneReceptor, IPacketReceiver,IManipulator
import com.google.common.io.ByteArrayDataInput;
public class TileEntityManipulator extends TileEntityElectricityReceiver implements IRedstoneReceptor, IPacketReceiver, IManipulator
{
/**
* Joules required to run this thing.
@ -163,8 +163,11 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
}
}
}
/**
* Throws the items from the manipulator into the world
* Throws the items from the manipulator into
* the world
*
* @param outputPosition
* @param items
*/
@ -176,6 +179,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
entityItem.motionY /= 5;
worldObj.spawnEntityInWorld(entityItem);
}
/**
* Tries to place an itemStack in a specific
* position if it is an inventory.

View file

@ -77,8 +77,8 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements
*/
if (this.ticks % 5 == 0 && !this.isDisabled())
{
//TODO remove after testing
//this.wattsReceived += 100;
// TODO remove after testing
// this.wattsReceived += 100;
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
this.firePiston = false;
@ -243,11 +243,13 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements
{
this.guiButtons[i] = true;
}
Packet packet = PacketManager.getPacket("asmLine", this, new Object[]{PacketTypes.SETTINGON.ordinal(), i});
Packet packet = PacketManager.getPacket("asmLine", this, new Object[]
{ PacketTypes.SETTINGON.ordinal(), i });
if (worldObj.isRemote)
{
PacketDispatcher.sendPacketToServer(packet);
}else
}
else
{
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 10);
}

View file

@ -1,9 +1,5 @@
package assemblyline.machines;
import assemblyline.belts.TileEntityConveyorBelt;
import com.google.common.io.ByteArrayDataInput;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.INetworkManager;
@ -15,8 +11,12 @@ import net.minecraft.src.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.TileEntityElectricityReceiver;
import universalelectricity.prefab.network.IPacketReceiver;
import assemblyline.belts.TileEntityConveyorBelt;
public class TileEntityRoboticSorter extends TileEntityElectricityReceiver implements IPacketReceiver, IInventory {
import com.google.common.io.ByteArrayDataInput;
public class TileEntityRoboticSorter extends TileEntityElectricityReceiver implements IPacketReceiver, IInventory
{
/**
* The items this container contains.
*/
@ -50,6 +50,7 @@ public class TileEntityRoboticSorter extends TileEntityElectricityReceiver imple
public TileEntityConveyorBelt[] beltSide = new TileEntityConveyorBelt[6];
private int playerUsing = 0;
@Override
public String getInvName()
{
@ -201,13 +202,14 @@ public class TileEntityRoboticSorter extends TileEntityElectricityReceiver imple
}
}
}
@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
}
/**
* Writes a tile entity to NBT.
*/
@ -242,11 +244,10 @@ public class TileEntityRoboticSorter extends TileEntityElectricityReceiver imple
}
@Override
public boolean canReceiveFromSide(ForgeDirection side) {
public boolean canReceiveFromSide(ForgeDirection side)
{
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,12 +1,11 @@
package assemblyline.machines.crafter;
import universalelectricity.prefab.BlockMachine;
import net.minecraft.src.BlockContainer;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Material;
import net.minecraft.src.TileEntity;
import net.minecraft.src.World;
import universalelectricity.prefab.BlockMachine;
import assemblyline.AssemblyLine;
public class BlockCrafter extends BlockMachine

View file

@ -8,7 +8,9 @@ import net.minecraft.src.ItemStack;
import net.minecraft.src.Slot;
/**
* I am planning to make the crafter not use a GUI.
* I am planning to make the crafter not use a
* GUI.
*
* @author Calclavia
*
*/
@ -24,7 +26,9 @@ public class ContainerCrafter extends Container
{
for (int i = 0; i < 3; i++)
{
//this.addSlotToContainer(new Slot(tileEntity, i + r * 3, 33 + i * 18, 34 + r * 18));
// this.addSlotToContainer(new
// Slot(tileEntity, i + r * 3, 33
// + i * 18, 34 + r * 18));
}
}
int var3;

View file

@ -1,11 +1,11 @@
package assemblyline.machines.crafter;
import universalelectricity.core.Vector3;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityItem;
import net.minecraft.src.ItemStack;
import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.World;
import universalelectricity.core.Vector3;
public class EntityCraftingArm extends Entity
{

View file

@ -29,13 +29,11 @@ public class TaskArmCollect extends Task
{
super.doTask();
if(entityItem == null)
{
return false;
}
if (entityItem == null) { return false; }
/**
* Slowly stretch down the arm's model and grab the item
* Slowly stretch down the arm's model and
* grab the item
*/
return true;

View file

@ -50,10 +50,10 @@ public class TaskArmSearch extends Task
/**
* 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;
}

View file

@ -205,7 +205,7 @@ public class TileEntityCraftingArm extends TileEntityElectricityReceiver impleme
@Override
public void openChest()
{
this.playerUsing ++;
this.playerUsing++;
}
@Override