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;
import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance; 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.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; 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.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
@ -77,7 +75,7 @@ public class AssemblyLine
// Add Names // Add Names
LanguageRegistry.addName(new ItemStack(blockConveyorBelt, 1), "Conveyor Belt"); 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); LanguageRegistry.addName(new ItemStack(blockInteraction, 1, type.metadata), type.name);
} }

View file

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

View file

@ -5,23 +5,32 @@ import java.util.List;
import net.minecraft.src.Entity; import net.minecraft.src.Entity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
public interface IBelt { public interface IBelt
{
/** /**
* Gets the facing direction of the belt, used but other machines to know * Gets the facing direction of the belt, used
* which direction to start an item at * but other machines to know which direction
* to start an item at
* *
* @return * @return
*/ */
public ForgeDirection getFacing(); public ForgeDirection getFacing();
/** /**
* Causes the belt to ignore the entity for a few updates * Causes the belt to ignore the entity for a
* help in cases where another machine need to effect this entity * few updates help in cases where another
* without the belt doing so as well. * machine need to effect this entity without
* @param entity - entity being ignored * the belt doing so as well.
*
* @param entity
* - entity being ignored
*/ */
public void ignoreEntity(Entity entity); 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 * @return list of entities
*/ */
public List<Entity> getEntityAbove(); public List<Entity> getEntityAbove();

View file

@ -1,5 +1,8 @@
package assemblyline.api; package assemblyline.api;
public interface IBotArm { public interface IBotArm
//TODO will add methods here to change the arms task, target, location,etc as need by other mods {
// 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 public interface IManipulator
{ {
/** /**
* Throws the items from the manipulator into the world * Throws the items from the manipulator into
* the world
*
* @param outputPosition * @param outputPosition
* @param items * @param items
*/ */
public void rejectItem(Vector3 outputPosition, ItemStack items); public void rejectItem(Vector3 outputPosition, ItemStack items);
//TODO add a few more methods here to access the functions the manipulator // TODO add a few more methods here to access
//can do. For example storing items, and retrieving items, or power on/off // 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); par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 0);
return true; return true;
} }
else else if (metadata >= 7)
if (metadata >= 7)
{ {
par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 4); par1World.setBlockAndMetadataWithNotify(x, y, z, this.blockID, 4);
return true; return true;
@ -68,8 +67,10 @@ public class BlockConveyorBelt extends BlockMachine
{ {
if (metadata >= 0 && metadata < 4) { return new TileEntityConveyorBelt(); } if (metadata >= 0 && metadata < 4) { return new TileEntityConveyorBelt(); }
if (metadata >= 4 && metadata < 8) { return new TileEntityCoveredBelt(); } if (metadata >= 4 && metadata < 8) { return new TileEntityCoveredBelt(); }
//if (metadata >= 8 && metadata < 12) { //TODO vertical Belt } // if (metadata >= 8 && metadata < 12) {
//if (metadata >= 12 && metadata < 16) { //TODO IDK} // //TODO vertical Belt }
// if (metadata >= 12 && metadata < 16) {
// //TODO IDK}
return null; return null;
} }

View file

@ -131,19 +131,26 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
this.doBeltAction(); 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() public void doBeltAction()
{ {
this.conveyItemsHorizontal(true,false); this.conveyItemsHorizontal(true, false);
} }
/** /**
* Causes all items to be moved above the belt * 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 try
{ {
@ -154,27 +161,27 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
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()))
{ {
if (direction == 0) if (direction == 0)
{ {
entity.motionZ -= 1 * this.speed; entity.motionZ -= 1 * this.speed;
entity.posX = this.xCoord +0.5D; entity.posX = this.xCoord + 0.5D;
} }
if (direction == 1) if (direction == 1)
{ {
entity.motionX += 1 * this.speed; entity.motionX += 1 * this.speed;
entity.posZ = this.zCoord +0.5D; entity.posZ = this.zCoord + 0.5D;
} }
if (direction == 2) if (direction == 2)
{ {
entity.motionZ += 1 * this.speed; entity.motionZ += 1 * this.speed;
entity.posX = this.xCoord +0.5D; entity.posX = this.xCoord + 0.5D;
} }
if (direction == 3) if (direction == 3)
{ {
entity.motionX -= 1 * this.speed; 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(); e.printStackTrace();
} }
} }
@Override @Override
public Packet getDescriptionPacket() public Packet getDescriptionPacket()
{ {
@ -324,7 +332,8 @@ public class TileEntityConveyorBelt extends TileEntityElectricityReceiver implem
} }
@Override @Override
public ForgeDirection getFacing() { public ForgeDirection getFacing()
{
return ForgeDirection.getOrientation(this.getBeltDirection()); return ForgeDirection.getOrientation(this.getBeltDirection());
} }

View file

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

View file

@ -16,36 +16,41 @@ public class TileEntityElevatorBelt extends TileEntityConveyorBelt
public void doBeltAction() public void doBeltAction()
{ {
this.conveyItemsVertical(true,false); this.conveyItemsVertical(true, false);
} }
/** /**
* 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
*/ */
public boolean isBellowABelt() public boolean isBellowABelt()
{ {
TileEntity ent = worldObj.getBlockTileEntity(xCoord, xCoord-1, zCoord); TileEntity ent = worldObj.getBlockTileEntity(xCoord, xCoord - 1, zCoord);
if(ent instanceof TileEntityElevatorBelt) if (ent instanceof TileEntityElevatorBelt) { return true; }
{
return true;
}
return false; return false;
} }
/** /**
* Same as conveyItemHorizontal but will pull, or lower the items up/down * Same as conveyItemHorizontal but will pull,
* the belt like an elevator * or lower the items up/down the belt like an
* elevator
*
* @param extendLife * @param extendLife
* @param preventPickUp * @param preventPickUp
*/ */
public void conveyItemsVertical(boolean extendLife, boolean preventPickUp ) public void conveyItemsVertical(boolean extendLife, boolean preventPickUp)
{ {
//TODO find all Entities in bounds // TODO find all Entities in bounds
//Prevent entities from falling // Prevent entities from falling
//Find if can move up, only a few entities can be moved at a time, 1 EntityLiving, or 3 EntityItems // Find if can move up, only a few
// ^ has to do with animation why only some not all move // entities can be moved at a time, 1
//move those that can up // EntityLiving, or 3 EntityItems
//IF top find belt, and/or throw slightly over the belt and back // ^ 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 java.util.List;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.CreativeTabs; import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityLiving; import net.minecraft.src.EntityLiving;
@ -17,6 +15,7 @@ import universalelectricity.implement.IRedstoneReceptor;
import universalelectricity.prefab.BlockMachine; import universalelectricity.prefab.BlockMachine;
import assemblyline.AssemblyLine; import assemblyline.AssemblyLine;
import assemblyline.render.RenderHelper; import assemblyline.render.RenderHelper;
import cpw.mods.fml.common.network.PacketDispatcher;
/** /**
* A metadata block containing a bunch of machines * A metadata block containing a bunch of machines

View file

@ -2,8 +2,6 @@ package assemblyline.machines;
import java.util.List; import java.util.List;
import com.google.common.io.ByteArrayDataInput;
import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.EntityItem; import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer; import net.minecraft.src.EntityPlayer;
@ -27,7 +25,9 @@ import assemblyline.AssemblyLine;
import assemblyline.api.IManipulator; import assemblyline.api.IManipulator;
import assemblyline.machines.BlockMulti.MachineType; 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. * Joules required to run this thing.
@ -107,7 +107,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
if (remainingStack != null && remainingStack.stackSize > 0) if (remainingStack != null && remainingStack.stackSize > 0)
{ {
this.rejectItem(outputPosition, remainingStack); this.rejectItem(outputPosition, remainingStack);
} }
entity.setDead(); entity.setDead();
@ -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 outputPosition
* @param items * @param items
*/ */
@ -176,6 +179,7 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
entityItem.motionY /= 5; entityItem.motionY /= 5;
worldObj.spawnEntityInWorld(entityItem); worldObj.spawnEntityInWorld(entityItem);
} }
/** /**
* 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.

View file

@ -77,8 +77,8 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements
*/ */
if (this.ticks % 5 == 0 && !this.isDisabled()) if (this.ticks % 5 == 0 && !this.isDisabled())
{ {
//TODO remove after testing // TODO remove after testing
//this.wattsReceived += 100; // this.wattsReceived += 100;
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
this.firePiston = false; this.firePiston = false;
@ -243,11 +243,13 @@ public class TileEntityRejector extends TileEntityElectricityReceiver implements
{ {
this.guiButtons[i] = true; 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) if (worldObj.isRemote)
{ {
PacketDispatcher.sendPacketToServer(packet); PacketDispatcher.sendPacketToServer(packet);
}else }
else
{ {
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 10); PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 10);
} }

View file

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

View file

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

View file

@ -8,7 +8,9 @@ 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 GUI. * I am planning to make the crafter not use a
* GUI.
*
* @author Calclavia * @author Calclavia
* *
*/ */
@ -24,7 +26,9 @@ public class ContainerCrafter extends Container
{ {
for (int i = 0; i < 3; i++) 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; int var3;

View file

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

View file

@ -29,13 +29,11 @@ public class TaskArmCollect extends Task
{ {
super.doTask(); super.doTask();
if(entityItem == null) if (entityItem == null) { return false; }
{
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; return true;

View file

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

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