Version Bump

This commit is contained in:
Henry Mao 2012-12-15 11:48:44 +08:00
parent 6ef0840fdb
commit 75bf4c9244
13 changed files with 170 additions and 179 deletions

View file

@ -1 +1 @@
0.1.5
0.1.6

View file

@ -2,7 +2,7 @@
{
"modid" : "AssemblyLine",
"name" : "Assembly Line",
"version" : "0.1.5",
"version" : "0.1.6",
"url" : "http://calclavia.com/universalelectricity/?m=18",
"credits" : "",
"authors": [

View file

@ -5,12 +5,12 @@ import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import assemblyline.client.model.ModelConveyorBelt;
import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.belt.TileEntityConveyorBelt;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderConveyorBelt extends TileEntitySpecialRenderer
{

View file

@ -8,8 +8,6 @@ import org.lwjgl.opengl.GL11;
import assemblyline.common.block.TileEntityCrate;
import universalelectricity.core.vector.Vector3;
public class RenderCrate extends TileEntitySpecialRenderer
{

View file

@ -38,7 +38,7 @@ public class RenderHelper implements ISimpleBlockRenderingHandler
modelConveyorBelt.render(0.0625F, 0, false, false, false);
GL11.glPopMatrix();
}
else if (block.blockID == AssemblyLine.blockInteraction.blockID)
else if (block.blockID == AssemblyLine.blockMulti.blockID)
{
if (metadata == MachineType.SORTER.metadata)
{

View file

@ -44,7 +44,7 @@ public class AssemblyLine
public static final String NAME = "Assembly Line";
public static final String VERSION = "0.1.5";
public static final String VERSION = "0.1.6";
public static final String CHANNEL = "AssemblyLine";
@ -59,7 +59,7 @@ public class AssemblyLine
public static final int BLOCK_ID_PREFIX = 3030;
public static Block blockConveyorBelt;
public static Block blockInteraction;
public static Block blockMulti;
public static Block blockArchitectTable;
public static Block blockCrate;
@ -71,7 +71,7 @@ public class AssemblyLine
CONFIGURATION.load();
blockConveyorBelt = new BlockConveyorBelt(CONFIGURATION.getBlock("Conveyor Belt", BLOCK_ID_PREFIX).getInt());
blockInteraction = new BlockMulti(CONFIGURATION.getBlock("Machine", BLOCK_ID_PREFIX + 1).getInt());
blockMulti = new BlockMulti(CONFIGURATION.getBlock("Machine", BLOCK_ID_PREFIX + 1).getInt());
blockArchitectTable = new BlockArchitectTable(CONFIGURATION.getBlock("Architect's Table", BLOCK_ID_PREFIX + 2).getInt());
blockCrate = new BlockCrate(CONFIGURATION.getBlock("Crate", BLOCK_ID_PREFIX + 3).getInt());
CONFIGURATION.save();
@ -80,7 +80,7 @@ public class AssemblyLine
GameRegistry.registerBlock(blockConveyorBelt);
GameRegistry.registerBlock(blockArchitectTable);
GameRegistry.registerBlock(blockCrate, ItemBlockCrate.class);
GameRegistry.registerBlock(blockInteraction, ItemBlockMulti.class);
GameRegistry.registerBlock(blockMulti, ItemBlockMulti.class);
UpdateNotifier.INSTANCE.checkUpdate(NAME, VERSION, "http://calclavia.com/downloads/al/recommendedversion.txt");
@ -130,17 +130,17 @@ public class AssemblyLine
// Add Names
for (MachineType type : MachineType.values())
{
LanguageRegistry.addName(new ItemStack(blockInteraction, 1, type.metadata), type.name);
LanguageRegistry.addName(new ItemStack(blockMulti, 1, type.metadata), type.name);
}
// Conveyor Belt
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 4), new Object[] { "III", "WMW", 'I', "ingotSteel", 'W', Block.wood, 'M', "motor" }));
// Rejector
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockInteraction, 1, MachineType.SORTER.metadata), new Object[] { "WPW", "@R@", '@', "plateSteel", 'R', Item.redstone, 'P', Block.pistonBase, 'C', "basicCircuit", 'W', "copperWire" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockMulti, 1, MachineType.SORTER.metadata), new Object[] { "WPW", "@R@", '@', "plateSteel", 'R', Item.redstone, 'P', Block.pistonBase, 'C', "basicCircuit", 'W', "copperWire" }));
// Retriever
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockInteraction, 1, MachineType.MANIPULATOR.metadata), new Object[] { Block.dispenser, "basicCircuit" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockMulti, 1, MachineType.MANIPULATOR.metadata), new Object[] { Block.dispenser, "basicCircuit" }));
UETab.setItemStack(new ItemStack(blockConveyorBelt));
}

View file

@ -14,10 +14,8 @@ public class ArmHelper
/**
* Used to locate items in an area
*
* @param start
* - start xyz
* @param End
* - end xyz
* @param start - start xyz
* @param End - end xyz
* @return list of items
*/
public List<EntityItem> findItems(World world, Vector3 start, Vector3 end)

View file

@ -21,8 +21,7 @@ public abstract class Task
/**
* Called by the TaskManager to propagate tick updates
*
* @param ticks
* The amount of ticks this task has been running
* @param ticks 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()

View file

@ -23,11 +23,11 @@ public class TaskManager
*/
try
{
Task task;
Iterator<Task> iter = tasks.iterator();
Task task;
Iterator<Task> iter = tasks.iterator();
while (iter.hasNext())
{
task = iter.next();
task = iter.next();
if (task.getTickInterval() > 0)
{
if (this.ticks % task.getTickInterval() == 0)
@ -51,8 +51,8 @@ public class TaskManager
}
/**
* Used to register Tasks for a TileEntity, executes onTaskStart
* for the Task after registering it
* 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

View file

@ -1,7 +1,6 @@
package assemblyline.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View file

@ -63,7 +63,7 @@ public class BlockConveyorBelt extends BlockMachine
/**
* @author AtomicStryker
*/
//@Override
// @Override
public void onEntityCollidedWithBlockTest(World world, int x, int y, int z, Entity entity)
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z);

View file

@ -10,60 +10,59 @@ import net.minecraft.world.World;
import universalelectricity.core.vector.Vector3;
/**
* Paradigm: The Crafting Arm is made of *TO BE DETERMINED* jointed segments.
* We do not save any of these. They are automatically 'created' by the Renderer
* to connect the 'Claw' to the TileEntity fittingly. That's right they do not
* actually exist. MAGIC.
* Paradigm: The Crafting Arm is made of *TO BE DETERMINED* jointed segments. We do not save any of
* these. They are automatically 'created' by the Renderer to connect the 'Claw' to the TileEntity
* fittingly. That's right they do not actually exist. MAGIC.
*/
public class EntityCraftingArm extends Entity
{
/**
* Used to ID the type of arm
*/
public static enum CraftingArmType
{
ARM, SOLDER, DRILL, BREAKER
}
/**
* Maximal extended length of the Crafting Arm, to abort grabbings if the target
* moves out of range.
* Maximal extended length of the Crafting Arm, to abort grabbings if the target moves out of
* range.
*/
private static final float MAX_GRAB_DISTANCE = 3F;
/**
* At which distance from the target Item entity should the claw 'grab' it
*/
private static final float GRAB_CONNECT_DISTANCE = 0.2F;
private static final float MAX_GRAB_DISTANCE = 3F;
/**
* At which distance from the target Item entity should the claw 'grab' it
*/
private static final float GRAB_CONNECT_DISTANCE = 0.2F;
/**
* type of arm this robotic arm currently is
*/
private CraftingArmType currentArmType;
/**
* stack this arm is holding or null if not
*/
private ItemStack itemStackBeingHeld;
/**
* TileEntity this arm is originating from
*/
private TileEntityCraftingArm tileEntityCraftingArm;
/**
* position that the arms claw is at
*/
private Vector3 clawPos;
/**
* The Item Entity the claw is moving to grab. Not necessarily immobile!
*/
private EntityItem itemEntityTarget;
private boolean isWorking;
public EntityCraftingArm(World world)
{
super(world);
@ -78,23 +77,23 @@ public class EntityCraftingArm extends Entity
@Override
protected void entityInit()
{
dataWatcher.addObject(5, String.valueOf(clawPos.x));
dataWatcher.addObject(6, String.valueOf(clawPos.y));
dataWatcher.addObject(7, String.valueOf(clawPos.z));
dataWatcher.addObject(5, String.valueOf(clawPos.x));
dataWatcher.addObject(6, String.valueOf(clawPos.y));
dataWatcher.addObject(7, String.valueOf(clawPos.z));
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbt)
{
currentArmType = CraftingArmType.values()[nbt.getInteger("type")];
clawPos.x = nbt.getDouble("clawX");
clawPos.y = nbt.getDouble("clawY");
clawPos.z = nbt.getDouble("clawZ");
if (nbt.hasKey("itemStackBeingHeld"))
{
itemStackBeingHeld = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("itemStackBeingHeld"));
itemStackBeingHeld = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("itemStackBeingHeld"));
}
}
@ -102,164 +101,164 @@ public class EntityCraftingArm extends Entity
protected void writeEntityToNBT(NBTTagCompound nbt)
{
nbt.setInteger("type", currentArmType.ordinal());
nbt.setDouble("clawX", clawPos.x);
nbt.setDouble("clawY", clawPos.y);
nbt.setDouble("clawZ", clawPos.z);
if (itemStackBeingHeld != null)
{
NBTTagCompound itemNBT = new NBTTagCompound();
itemNBT = itemStackBeingHeld.writeToNBT(itemNBT);
nbt.setCompoundTag("itemStackBeingHeld", itemNBT);
NBTTagCompound itemNBT = new NBTTagCompound();
itemNBT = itemStackBeingHeld.writeToNBT(itemNBT);
nbt.setCompoundTag("itemStackBeingHeld", itemNBT);
}
}
@Override
public void onUpdate()
{
super.onUpdate();
if (!worldObj.isRemote)
{
// server only computations here, eg claw movement
updateClawMovement();
}
updateNetworkedClawPosition();
super.onUpdate();
if (!worldObj.isRemote)
{
// server only computations here, eg claw movement
updateClawMovement();
}
updateNetworkedClawPosition();
}
@Override
public void setDead()
{
// TODO deal with this error case
super.setDead();
}
@Override
public void setFire(int fire) // fire proof.
{
}
public void setDead()
{
// TODO deal with this error case
super.setDead();
}
@Override
public AxisAlignedBB getBoundingBox()
{
// TODO bounding box
return null;
}
@Override
public AxisAlignedBB getCollisionBox(Entity par1Entity)
{
// TODO bounding box
return null;
}
public void setFire(int fire) // fire proof.
{
}
@Override
public void applyEntityCollision(Entity collidingEnt) // immovable
{
}
/**
* Called when a player right clicks the crafting Arm
*/
public AxisAlignedBB getBoundingBox()
{
// TODO bounding box
return null;
}
@Override
public boolean interact(EntityPlayer entPlayer)
{
// TODO let the player take whatever the arm is holding?
return false;
}
public AxisAlignedBB getCollisionBox(Entity par1Entity)
{
// TODO bounding box
return null;
}
@Override
public void applyEntityCollision(Entity collidingEnt) // immovable
{
}
/**
* Deals with the Claw moving to and hitting the target Item Entity, also
* aborts if that moves out of range.
* Called when a player right clicks the crafting Arm
*/
private void updateClawMovement()
{
if (itemEntityTarget != null)
{
float distance = getDistanceToEntity(itemEntityTarget);
if (distance > MAX_GRAB_DISTANCE)
{
itemEntityTarget = null;
}
else
{
if (distance < GRAB_CONNECT_DISTANCE)
{
grabItem();
}
else
{
double diffX = posX - itemEntityTarget.posX;
double diffY = posY - itemEntityTarget.posY;
double diffZ = posZ - itemEntityTarget.posZ;
// TODO decide on how fast the claw should move toward the target, and move it
}
}
}
else
{
// TODO claw should return to some sort of 'waiting' position
}
}
@Override
public boolean interact(EntityPlayer entPlayer)
{
// TODO let the player take whatever the arm is holding?
return false;
}
/**
* On serverside, writes the current local claw position into the dataWatchers.
* On client, retrieves the current remote claw values.
* Yes DataWatchers lack a Double getter method.
* Deals with the Claw moving to and hitting the target Item Entity, also aborts if that moves
* out of range.
*/
private void updateClawMovement()
{
if (itemEntityTarget != null)
{
float distance = getDistanceToEntity(itemEntityTarget);
if (distance > MAX_GRAB_DISTANCE)
{
itemEntityTarget = null;
}
else
{
if (distance < GRAB_CONNECT_DISTANCE)
{
grabItem();
}
else
{
double diffX = posX - itemEntityTarget.posX;
double diffY = posY - itemEntityTarget.posY;
double diffZ = posZ - itemEntityTarget.posZ;
// TODO decide on how fast the claw should move toward the target, and move it
}
}
}
else
{
// TODO claw should return to some sort of 'waiting' position
}
}
/**
* On serverside, writes the current local claw position into the dataWatchers. On client,
* retrieves the current remote claw values. Yes DataWatchers lack a Double getter method.
*/
private void updateNetworkedClawPosition()
{
if (worldObj.isRemote)
{
clawPos.x = Double.valueOf(dataWatcher.getWatchableObjectString(5));
clawPos.y = Double.valueOf(dataWatcher.getWatchableObjectString(6));
clawPos.z = Double.valueOf(dataWatcher.getWatchableObjectString(7));
}
else
{
dataWatcher.updateObject(5, String.valueOf(clawPos.x));
dataWatcher.updateObject(6, String.valueOf(clawPos.x));
dataWatcher.updateObject(7, String.valueOf(clawPos.x));
}
if (worldObj.isRemote)
{
clawPos.x = Double.valueOf(dataWatcher.getWatchableObjectString(5));
clawPos.y = Double.valueOf(dataWatcher.getWatchableObjectString(6));
clawPos.z = Double.valueOf(dataWatcher.getWatchableObjectString(7));
}
else
{
dataWatcher.updateObject(5, String.valueOf(clawPos.x));
dataWatcher.updateObject(6, String.valueOf(clawPos.x));
dataWatcher.updateObject(7, String.valueOf(clawPos.x));
}
}
public ItemStack getCurrentlyHeldItem()
{
return itemStackBeingHeld;
return itemStackBeingHeld;
}
/**
* Designate an Item Entity as target for the claw to go to and grab.
*
* @param entItem Item Entity instance to grab
*/
private void setTargetEntityItem(EntityItem entItem)
{
itemEntityTarget = entItem;
itemEntityTarget = entItem;
}
/**
* Kills the targeted Item Entity, saves the ItemStack into the CraftingArm, creates FX at grab.
* Then resets the Item Entity to null.
*/
private void grabItem()
{
itemStackBeingHeld = itemEntityTarget.item;
playGrabbingEffects(itemEntityTarget.posX, itemEntityTarget.posY, itemEntityTarget.posZ);
itemEntityTarget.setDead();
itemEntityTarget = null;
itemStackBeingHeld = itemEntityTarget.item;
playGrabbingEffects(itemEntityTarget.posX, itemEntityTarget.posY, itemEntityTarget.posZ);
itemEntityTarget.setDead();
itemEntityTarget = null;
}
/**
* Displays particles and/or play's sounds to emphasize the claw having grabbed something
*
* @param posX coordinate of grab
* @param posY coordinate of grab
* @param posZ coordinate of grab
*/
private void playGrabbingEffects(double posX, double posY, double posZ)
{
// TODO sound, particles, etc
}
private void playGrabbingEffects(double posX, double posY, double posZ)
{
// TODO sound, particles, etc
}
}

View file

@ -33,17 +33,15 @@ public class TaskArmSearch extends Task
this.searchSpeed = searchSpeed;
}
@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
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()