More Armbot + Imprinter Tweaks
This commit is contained in:
parent
d94cc46cef
commit
4cce5df0f6
5 changed files with 60 additions and 47 deletions
|
@ -17,6 +17,8 @@ public interface IArmbot
|
|||
*/
|
||||
public void grabEntity(Entity entity);
|
||||
|
||||
public void grabItem(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Drops a specific entity from the Armbot's hand.
|
||||
*/
|
||||
|
|
|
@ -129,24 +129,25 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
|
||||
if (block != null)
|
||||
{
|
||||
if (Block.isNormalCube(block.blockID))
|
||||
if (Block.isNormalCube(block.blockID) && block.getBlockHardness(this.worldObj, handPosition.intX(), handPosition.intY(), handPosition.intZ()) != -1)
|
||||
{
|
||||
TileEntity tileEntity = this.getHandPosition().getTileEntity(this.worldObj);
|
||||
|
||||
if (tileEntity == null)
|
||||
{
|
||||
block.dropBlockAsItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord, handPosition.getBlockMetadata(this.worldObj), 0);
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
block.dropBlockAsItem(this.worldObj, handPosition.intX(), handPosition.intY(), handPosition.intZ(), handPosition.getBlockMetadata(this.worldObj), 0);
|
||||
}
|
||||
|
||||
handPosition.setBlockWithNotify(this.worldObj, 0);
|
||||
}
|
||||
else
|
||||
else if (!(tileEntity instanceof IArmbotUseable))
|
||||
{
|
||||
if (!(tileEntity instanceof IArmbotUseable))
|
||||
{
|
||||
block.dropBlockAsItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord, handPosition.getBlockMetadata(this.worldObj), 0);
|
||||
handPosition.setBlockWithNotify(this.worldObj, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.disk == null && this.computersAttached == 0)
|
||||
{
|
||||
|
@ -232,7 +233,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
if (this.ticks % 5 == 0 && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
{
|
||||
// sound is 0.25 seconds long (20 ticks/second)
|
||||
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 2f, 1.7f, true);
|
||||
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 0.8f, 1.7f, true);
|
||||
}
|
||||
|
||||
if (Math.abs(this.renderYaw - this.rotationYaw) < this.ROTATION_SPEED + 0.1f)
|
||||
|
@ -915,7 +916,7 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
{
|
||||
if (entity instanceof EntityItem)
|
||||
{
|
||||
this.grabbedItems.add(((EntityItem) entity).getEntityItem());
|
||||
this.grabItem(((EntityItem) entity).getEntityItem());
|
||||
entity.setDead();
|
||||
}
|
||||
else
|
||||
|
@ -924,6 +925,12 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grabItem(ItemStack itemStack)
|
||||
{
|
||||
this.grabbedItems.add(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropEntity(Entity entity)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ public class CommandRotateBy extends Command
|
|||
if (Math.abs(this.tileEntity.rotationPitch - this.targetRotationPitch) > 0.001f)
|
||||
this.tileEntity.rotationPitch = this.targetRotationPitch;
|
||||
|
||||
if (this.ticks < this.totalTicks) { return true; }
|
||||
//if (this.ticks < this.totalTicks) { return true; }
|
||||
if (Math.abs(this.tileEntity.renderPitch - this.tileEntity.rotationPitch) > 0.001f) { return true; }
|
||||
if (Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f) { return true; }
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CommandRotateTo extends Command
|
|||
this.tileEntity.rotationYaw = this.targetRotationYaw;
|
||||
this.tileEntity.rotationPitch = this.targetRotationPitch;
|
||||
|
||||
if (this.ticks < this.totalTicks) { return true; }
|
||||
//if (this.ticks < this.totalTicks) { return true; }
|
||||
if (Math.abs(this.tileEntity.renderPitch - this.tileEntity.rotationPitch) > 0.001f) { return true; }
|
||||
if (Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f) { return true; }
|
||||
|
||||
|
|
|
@ -381,6 +381,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
/**
|
||||
* Fail to, hence consume from crafting grid.
|
||||
|
@ -423,6 +425,12 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
|
||||
this.replaceCraftingMatrix(inventoryCrafting);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Imprinter: Failed to craft");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -614,26 +622,22 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
|
|||
}
|
||||
|
||||
/**
|
||||
* Armbot
|
||||
*
|
||||
* @param tileEntity
|
||||
* @param heldEntity
|
||||
* @return
|
||||
* Tries to let the Armbot craft an item.
|
||||
*/
|
||||
@Override
|
||||
public boolean onUse(IArmbot armbot, String[] args)
|
||||
{
|
||||
this.onInventoryChanged();
|
||||
TileEntityArmbot armbotTile = (TileEntityArmbot) armbot;
|
||||
|
||||
if (this.imprinterMatrix[3] != null)
|
||||
if (this.imprinterMatrix[2] != null)
|
||||
{
|
||||
armbot.grabEntity(new EntityItem(this.worldObj, this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, this.imprinterMatrix[3]));
|
||||
this.imprinterMatrix[3] = null;
|
||||
armbot.grabItem(this.imprinterMatrix[2].copy());
|
||||
this.onPickUpFromResult(null, this.imprinterMatrix[2]);
|
||||
this.imprinterMatrix[2] = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* if (armbotTile.getGrabbedEntities().size() > 0) { Entity heldEntity =
|
||||
/**
|
||||
* OLD CODE if (armbotTile.getGrabbedEntities().size() > 0) { Entity heldEntity =
|
||||
* armbot.getGrabbedEntities().get(0);
|
||||
*
|
||||
* if (heldEntity != null) { if (heldEntity instanceof EntityItem) { ItemStack stack =
|
||||
|
|
Loading…
Reference in a new issue