Reformat + Organize

This commit is contained in:
Henry Mao 2013-02-06 14:29:59 +08:00
parent 92f212483b
commit 0f180e4f99
38 changed files with 207 additions and 110 deletions

View file

@ -1,9 +1,8 @@
package assemblyline.api;
import net.minecraft.entity.Entity;
/**
* The IUseable inteface is used by the ArmBot so that it may interact with Tile Entities. onUse will be called on the block an ArmBot is touching whenever the USE command is run on it.
* The IUseable inteface is used by the ArmBot so that it may interact with Tile Entities. onUse
* will be called on the block an ArmBot is touching whenever the USE command is run on it.
*
* @author Briman0094
*
@ -12,7 +11,8 @@ public interface IArmbotUseable
{
/**
* Called when the ArmBot command "USE" is run. This is called on any IUseable the ArmBot is touching.
* Called when the ArmBot command "USE" is run. This is called on any IUseable the ArmBot is
* touching.
*
* @param armbot - The Armbot instance.
*/

View file

@ -12,15 +12,15 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelCraneController extends ModelBase
{
// fields
ModelRenderer Base2;
ModelRenderer Base;
ModelRenderer ConnectorFront;
ModelRenderer Decoration1;
ModelRenderer Decoration2;
ModelRenderer Decoration3;
ModelRenderer Decoration4;
ModelRenderer ConnectorTop;
ModelRenderer ConnectorRight;
ModelRenderer Base2;
ModelRenderer Base;
ModelRenderer ConnectorFront;
ModelRenderer Decoration1;
ModelRenderer Decoration2;
ModelRenderer Decoration3;
ModelRenderer Decoration4;
ModelRenderer ConnectorTop;
ModelRenderer ConnectorRight;
public ModelCraneController()
{
@ -103,7 +103,7 @@ public class ModelCraneController extends ModelBase
setRotation(ConnectorFront, 0F, 1.570796F, 0F);
ConnectorRight.setRotationPoint(0.01F, 12F, -4F);
setRotation(ConnectorRight, 0F, 0F, 0F);
Base2.render(scale);
Base.render(scale);
ConnectorFront.render(scale);

View file

@ -10,7 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;

View file

@ -103,7 +103,10 @@ public class RenderCrate extends TileEntitySpecialRenderer
{
World world = tileEntity.worldObj;
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference)) { return; }
if (world.isBlockOpaqueCube(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference))
{
return;
}
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
int var11 = br % 65536;

View file

@ -27,8 +27,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class CommonProxy implements IGuiHandler
{
public static final int GUI_IMPRINTER = 1;
public static final int GUI_ENCODER = 2;
public static final int GUI_IMPRINTER = 1;
public static final int GUI_ENCODER = 2;
public void preInit()
{

View file

@ -12,7 +12,8 @@ import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
/**
* A block that allows the placement of mass amount of a specific item within it. It will be allowed to go on Conveyor Belts
* A block that allows the placement of mass amount of a specific item within it. It will be allowed
* to go on Conveyor Belts
*
* @author Calclavia
*
@ -110,7 +111,7 @@ public class BlockCrate extends BlockMachine
if (containedStack != null && (crateStack == null || (crateStack != null && containedStack.getItem().itemID == crateStack.getItem().itemID && containedStack.getItemDamage() == crateStack.getItemDamage())))
{
ItemStack returned = this.putIn(tileEntity, containedStack);
ItemBlockCrate.setContainingItemStack(currentStack, returned );
ItemBlockCrate.setContainingItemStack(currentStack, returned);
return true;
}
@ -246,7 +247,10 @@ public class BlockCrate extends BlockMachine
itemStack.stackSize = 0;
}
if (itemStack.stackSize <= 0) { return null; }
if (itemStack.stackSize <= 0)
{
return null;
}
return itemStack;
}

View file

@ -1,9 +1,9 @@
package assemblyline.common.block;
import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
public class BlockTurntable extends Block
{
@ -25,7 +25,7 @@ public class BlockTurntable extends Block
{
return this.blockIndexInTexture + 1;
}
return this.blockIndexInTexture + 2;
}
}

View file

@ -50,7 +50,7 @@ public class ItemBlockCrate extends ItemBlock
}
}
}
public static void setContainingItemStack(ItemStack itemStack, ItemStack containingStack)
{
if (itemStack.stackTagCompound == null)
@ -66,7 +66,8 @@ public class ItemBlockCrate extends ItemBlock
itemStack.getTagCompound().setTag("Item", itemTagCompound);
itemStack.getTagCompound().setInteger("Count", containingStack.stackSize);
}else
}
else
{
itemStack.getTagCompound().setTag("Item", new NBTTagCompound());
itemStack.getTagCompound().setInteger("Count", 0);

View file

@ -65,7 +65,10 @@ public class TileEntityCrate extends TileEntityAdvanced implements IInventory, I
@Override
public Packet getDescriptionPacket()
{
if (this.containingItems[0] != null) { return PacketManager.getPacket(AssemblyLine.CHANNEL, this, true, this.containingItems[0].itemID, this.containingItems[0].stackSize, this.containingItems[0].getItemDamage()); }
if (this.containingItems[0] != null)
{
return PacketManager.getPacket(AssemblyLine.CHANNEL, this, true, this.containingItems[0].itemID, this.containingItems[0].stackSize, this.containingItems[0].getItemDamage());
}
return PacketManager.getPacket(AssemblyLine.CHANNEL, this, false);
}

View file

@ -3,11 +3,8 @@ package assemblyline.common.machine;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityNetwork;
import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.prefab.network.PacketManager;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
/**
* A class to be inherited by all machines on the assembly line. This will allow all machines to be

View file

@ -280,7 +280,10 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
for (int i = startIndex; i < startIndex + inventory.getSizeInventorySide(direction); i++)
{
itemStack = this.addStackToInventory(i, inventory, itemStack);
if (itemStack == null) { return null; }
if (itemStack == null)
{
return null;
}
}
}
else if (tileEntity instanceof IInventory)
@ -290,12 +293,18 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
for (int i = 0; i < inventory.getSizeInventory(); i++)
{
itemStack = this.addStackToInventory(i, inventory, itemStack);
if (itemStack == null) { return null; }
if (itemStack == null)
{
return null;
}
}
}
}
if (itemStack.stackSize <= 0) { return null; }
if (itemStack.stackSize <= 0)
{
return null;
}
return itemStack;
}
@ -305,25 +314,31 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
if (inventory.getSizeInventory() > slotIndex)
{
ItemStack stackInInventory = inventory.getStackInSlot(slotIndex);
if (stackInInventory == null)
{
inventory.setInventorySlotContents(slotIndex, itemStack);
if (inventory.getStackInSlot(slotIndex) == null) { return itemStack; }
if (inventory.getStackInSlot(slotIndex) == null)
{
return itemStack;
}
return null;
}
else if (stackInInventory.isItemEqual(itemStack) && stackInInventory.isStackable())
{
{
stackInInventory = stackInInventory.copy();
int stackLim = Math.min(inventory.getInventoryStackLimit(), itemStack.getMaxStackSize());
int rejectedAmount = Math.max((stackInInventory.stackSize + itemStack.stackSize) - stackLim , 0);
int rejectedAmount = Math.max((stackInInventory.stackSize + itemStack.stackSize) - stackLim, 0);
stackInInventory.stackSize = Math.min(Math.max((stackInInventory.stackSize + itemStack.stackSize - rejectedAmount), 0), inventory.getInventoryStackLimit());
itemStack.stackSize = rejectedAmount;
inventory.setInventorySlotContents(slotIndex, stackInInventory);
}
}
if (itemStack.stackSize <= 0) { return null; }
if (itemStack.stackSize <= 0)
{
return null;
}
return itemStack;
}

View file

@ -39,7 +39,10 @@ public class BlockArmbot extends BlockMachine
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null && tileEntity instanceof IMultiBlock) { return ((IMultiBlock) tileEntity).onActivated(player); }
if (tileEntity != null && tileEntity instanceof IMultiBlock)
{
return ((IMultiBlock) tileEntity).onActivated(player);
}
return false;
}

View file

@ -802,7 +802,10 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
{
for (int i = 0; i < found.size(); i++)
{
if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && found.get(i).ridingEntity == null) { return new Object[] { true }; }
if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && found.get(i).ridingEntity == null)
{
return new Object[] { true };
}
}
}

View file

@ -67,8 +67,14 @@ public class BlockConveyorBelt extends BlockMachine
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN) { return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1); }
if (tileEntity.getSlant() == SlantType.TOP) { return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + 0.68f, (double) z + this.minZ, (double) x + this.maxX, (double) y + 0.98f, (double) z + this.maxZ); }
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
{
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1);
}
if (tileEntity.getSlant() == SlantType.TOP)
{
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + 0.68f, (double) z + this.minZ, (double) x + this.maxX, (double) y + 0.98f, (double) z + this.maxZ);
}
}
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);

View file

@ -305,7 +305,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
}
}
return this.animFrame;
}

View file

@ -27,7 +27,10 @@ public class TileEntityElevatorBelt extends TileEntityConveyorBelt
public boolean isBellowABelt()
{
TileEntity ent = worldObj.getBlockTileEntity(xCoord, xCoord - 1, zCoord);
if (ent instanceof TileEntityElevatorBelt) { return true; }
if (ent instanceof TileEntityElevatorBelt)
{
return true;
}
return false;
}

View file

@ -112,7 +112,10 @@ public abstract class Command
*/
protected String getArg(int i)
{
if (i >= 0 && i < this.parameters.length) { return this.parameters[i]; }
if (i >= 0 && i < this.parameters.length)
{
return this.parameters[i];
}
return null;
}

View file

@ -3,7 +3,6 @@ package assemblyline.common.machine.command;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -52,8 +51,10 @@ public class CommandBreak extends Command
*/
return true;
}
/**
* Drops an item stack at the exact center of the coords given
*
* @param world
* @param x
* @param y
@ -69,8 +70,10 @@ public class CommandBreak extends Command
world.spawnEntityInWorld(entity);
}
}
/**
* grabs all the items that the block can drop then pass them onto dropBlockAsItem_do
*
* @param world
* @param x
* @param y

View file

@ -1,8 +1,5 @@
package assemblyline.common.machine.command;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
public class CommandDrop extends Command
{
@Override

View file

@ -12,13 +12,13 @@ import universalelectricity.core.vector.Vector3;
public class CommandFire extends Command
{
private static final float MIN_ACTUAL_PITCH = -80;
private static final float MAX_ACTUAL_PITCH = 80;
private static final float MIN_ACTUAL_PITCH = -80;
private static final float MAX_ACTUAL_PITCH = 80;
private float actualYaw;
private float actualPitch;
private float velocity;
private Vector3 finalVelocity;
private float actualYaw;
private float actualPitch;
private float velocity;
private Vector3 finalVelocity;
@Override
public void onTaskStart()

View file

@ -3,7 +3,6 @@ package assemblyline.common.machine.command;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.AxisAlignedBB;

View file

@ -1,9 +1,5 @@
package assemblyline.common.machine.command;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import universalelectricity.core.vector.Vector3;
/**
* Used by arms to break a specific block in a position.
*
@ -12,6 +8,7 @@ import universalelectricity.core.vector.Vector3;
public class CommandHarvest extends CommandBreak
{
private CommandRotateTo rotateToCommand;
@Override
public void onTaskStart()
{

View file

@ -36,7 +36,7 @@ public class CommandIdle extends Command
return false;
}
@Override
public void readFromNBT(NBTTagCompound taskCompound)
{
@ -44,7 +44,7 @@ public class CommandIdle extends Command
this.idleTime = taskCompound.getInteger("idleTime");
this.totalIdleTime = taskCompound.getInteger("idleTotal");
}
@Override
public void writeToNBT(NBTTagCompound taskCompound)
{
@ -52,7 +52,7 @@ public class CommandIdle extends Command
taskCompound.setInteger("idleTime", this.idleTime);
taskCompound.setInteger("idleTotal", this.totalIdleTime);
}
@Override
public String toString()
{

View file

@ -70,7 +70,7 @@ public class CommandRepeat extends Command
taskCompound.setInteger("repCur", this.curReps);
taskCompound.setInteger("repGoal", this.numReps);
}
@Override
public String toString()
{

View file

@ -9,10 +9,10 @@ import net.minecraft.nbt.NBTTagCompound;
*/
public class CommandRotateBy extends Command
{
float targetRotationYaw = 0;
float targetRotationPitch = 0;
float deltaPitch = 0, deltaYaw = 90;
float totalTicks = 0f;
float targetRotationYaw = 0;
float targetRotationPitch = 0;
float deltaPitch = 0, deltaYaw = 90;
float totalTicks = 0f;
@Override
public void onTaskStart()
@ -62,7 +62,10 @@ public class CommandRotateBy extends Command
/*
* float rotationalDifference = Math.abs(this.tileEntity.rotationYaw - this.targetRotation);
*
* if (rotationalDifference < ROTATION_SPEED) { this.tileEntity.rotationYaw = this.targetRotation; } else { if (this.tileEntity.rotationYaw > this.targetRotation) { this.tileEntity.rotationYaw -= ROTATION_SPEED; } else { this.tileEntity.rotationYaw += ROTATION_SPEED; } this.ticks = 0; }
* if (rotationalDifference < ROTATION_SPEED) { this.tileEntity.rotationYaw =
* this.targetRotation; } else { if (this.tileEntity.rotationYaw > this.targetRotation) {
* this.tileEntity.rotationYaw -= ROTATION_SPEED; } else { this.tileEntity.rotationYaw +=
* ROTATION_SPEED; } this.ticks = 0; }
*/
// set the rotation to the target immediately and let the client handle animating it
@ -73,9 +76,15 @@ 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 (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; }
// 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;
}
return false;
}

View file

@ -72,9 +72,15 @@ public class CommandRotateTo extends Command
this.tileEntity.rotationYaw = this.targetRotationYaw;
this.tileEntity.rotationPitch = this.targetRotationPitch;
//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; }
// 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;
}
return false;
}

View file

@ -1,6 +1,5 @@
package assemblyline.common.machine.command;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import assemblyline.api.IArmbotUseable;

View file

@ -21,13 +21,13 @@ public class BlockCraneController extends BlockMachine
this.setHardness(5.0f);
this.setCreativeTab(TabAssemblyLine.INSTANCE);
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public boolean renderAsNormalBlock()
{
@ -40,22 +40,22 @@ public class BlockCraneController extends BlockMachine
int rot = (int) Math.min((entity.rotationYaw - 45f) / 90f, 3);
switch (rot)
{
case 0: //WEST
case 0: // WEST
{
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal());
break;
}
case 1: //NORTH
case 1: // NORTH
{
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal());
break;
}
case 2: //EAST
case 2: // EAST
{
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal());
break;
}
default: //SOUTH
default: // SOUTH
{
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal());
break;
@ -69,7 +69,7 @@ public class BlockCraneController extends BlockMachine
{
return BlockRenderingHandler.BLOCK_RENDER_ID;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{

View file

@ -4,5 +4,5 @@ import assemblyline.common.machine.TileEntityAssemblyNetwork;
public class TileEntityCraneController extends TileEntityAssemblyNetwork
{
}

View file

@ -91,7 +91,10 @@ public class BlockDetector extends BlockImprintable
@Override
public int getBlockTextureFromSideAndMetadata(int side, int metadata)
{
if (side == ForgeDirection.DOWN.ordinal()) { return this.blockIndexInTexture + 1; }
if (side == ForgeDirection.DOWN.ordinal())
{
return this.blockIndexInTexture + 1;
}
return this.blockIndexInTexture;
}
@ -150,7 +153,10 @@ public class BlockDetector extends BlockImprintable
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null)
{
if (tileEntity instanceof TileEntityDetector) { return ((TileEntityDetector) tileEntity).isPoweringTo(ForgeDirection.getOrientation(direction)); }
if (tileEntity instanceof TileEntityDetector)
{
return ((TileEntityDetector) tileEntity).isPoweringTo(ForgeDirection.getOrientation(direction));
}
}
return false;

View file

@ -30,7 +30,9 @@ public class BlockEncoder extends BlockMachine
return this.blockIndexInTexture;
}
else if (side == 1) { return this.blockIndexInTexture + 1;
else if (side == 1)
{
return this.blockIndexInTexture + 1;
}

View file

@ -64,10 +64,16 @@ public class ContainerEncoder extends Container
{
if (this.getSlot(0).isItemValid(slotStack))
{
if (!this.mergeItemStack(slotStack, 0, 1, false)) { return null; }
if (!this.mergeItemStack(slotStack, 0, 1, false))
{
return null;
}
}
}
else if (!this.mergeItemStack(slotStack, this.containingItems.length, 37, false)) { return null; }
else if (!this.mergeItemStack(slotStack, this.containingItems.length, 37, false))
{
return null;
}
if (slotStack.stackSize == 0)
{
@ -78,7 +84,10 @@ public class ContainerEncoder extends Container
slotObj.onSlotChanged();
}
if (slotStack.stackSize == copyStack.stackSize) { return null; }
if (slotStack.stackSize == copyStack.stackSize)
{
return null;
}
slotObj.onPickupFromSlot(player, slotStack);
}

View file

@ -30,7 +30,9 @@ public class BlockImprinter extends BlockMachine
return this.blockIndexInTexture;
}
else if (side == 1) { return this.blockIndexInTexture + 1;
else if (side == 1)
{
return this.blockIndexInTexture + 1;
}

View file

@ -92,11 +92,20 @@ public class ContainerImprinter extends Container implements ISlotWatcher
{
if (this.getSlot(this.tileEntity.IMPRINTER_MATRIX_START).isItemValid(slotStack))
{
if (!this.mergeItemStack(slotStack, this.tileEntity.IMPRINTER_MATRIX_START, this.tileEntity.IMPRINTER_MATRIX_START + 1, true)) { return null; }
if (!this.mergeItemStack(slotStack, this.tileEntity.IMPRINTER_MATRIX_START, this.tileEntity.IMPRINTER_MATRIX_START + 1, true))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, this.tileEntity.INVENTORY_START, this.tileEntity.getSizeInventory(), false))
{
return null;
}
else if (!this.mergeItemStack(slotStack, this.tileEntity.INVENTORY_START, this.tileEntity.getSizeInventory(), false)) { return null; }
}
else if (!this.mergeItemStack(slotStack, this.tileEntity.getSizeInventory(), this.tileEntity.getSizeInventory() + 36, false)) { return null; }
else if (!this.mergeItemStack(slotStack, this.tileEntity.getSizeInventory(), this.tileEntity.getSizeInventory() + 36, false))
{
return null;
}
if (slotStack.stackSize == 0)
{
@ -107,7 +116,10 @@ public class ContainerImprinter extends Container implements ISlotWatcher
slotObj.onSlotChanged();
}
if (slotStack.stackSize == copyStack.stackSize) { return null; }
if (slotStack.stackSize == copyStack.stackSize)
{
return null;
}
slotObj.onPickupFromSlot(player, slotStack);
}

View file

@ -39,8 +39,8 @@ public class ItemImprinter extends Item
if (entity != null && !(entity instanceof IProjectile) && !(entity instanceof EntityPlayer))
{
String stringName = EntityList.getEntityString(entity);
//TODO add to filter
player.sendChatToPlayer("Target: "+ stringName);
// TODO add to filter
player.sendChatToPlayer("Target: " + stringName);
return true;
}
return false;

View file

@ -25,7 +25,8 @@ public class SlotCraftingResult extends Slot
public boolean canTakeStack(EntityPlayer player)
{
return true;
// this.getStack() == null ? false : this.container.tileEntity.getIdealRecipe(this.getStack()) != null;
// this.getStack() == null ? false :
// this.container.tileEntity.getIdealRecipe(this.getStack()) != null;
}
@Override
@ -37,9 +38,14 @@ public class SlotCraftingResult extends Slot
}
/*
* private boolean playerHasRequiredIngredients(EntityPlayer player, ItemStack desiredItem) { if (this.getStack() != null) { ItemStack[] idealRecipe = this.container.tileEntity.getIdealRecipe(this.getStack()).getValue(); if (idealRecipe != null) { ItemStack[] requiredItems = idealRecipe.clone(); int foundItems = 0;
* private boolean playerHasRequiredIngredients(EntityPlayer player, ItemStack desiredItem) { if
* (this.getStack() != null) { ItemStack[] idealRecipe =
* this.container.tileEntity.getIdealRecipe(this.getStack()).getValue(); if (idealRecipe !=
* null) { ItemStack[] requiredItems = idealRecipe.clone(); int foundItems = 0;
*
* if (requiredItems != null) { for (ItemStack searchStack : requiredItems) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) { ItemStack checkStack = player.inventory.getStackInSlot(i);
* if (requiredItems != null) { for (ItemStack searchStack : requiredItems) { for (int i = 0; i
* < player.inventory.getSizeInventory(); i++) { ItemStack checkStack =
* player.inventory.getStackInSlot(i);
*
* if (checkStack != null) { if (searchStack.isItemEqual(checkStack)) { foundItems++; } } } } }
*

View file

@ -46,7 +46,10 @@ public abstract class TileEntityFilterable extends TileEntityAssemblyNetwork imp
{
if (checkStacks.get(i) != null)
{
if (checkStacks.get(i).isItemEqual(itemStack)) { return !inverted; }
if (checkStacks.get(i).isItemEqual(itemStack))
{
return !inverted;
}
}
}
}

View file

@ -3,8 +3,6 @@ package assemblyline.common.machine.imprinter;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
@ -24,9 +22,7 @@ import universalelectricity.prefab.TranslationHelper;
import universalelectricity.prefab.tile.TileEntityAdvanced;
import assemblyline.api.IArmbot;
import assemblyline.api.IArmbotUseable;
import assemblyline.common.AssemblyLine;
import assemblyline.common.Pair;
import assemblyline.common.machine.armbot.TileEntityArmbot;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.ReflectionHelper;
@ -464,11 +460,17 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
{
if (object instanceof ShapedRecipes)
{
if (this.hasResource(((ShapedRecipes) object).recipeItems) != null) { return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), ((ShapedRecipes) object).recipeItems); }
if (this.hasResource(((ShapedRecipes) object).recipeItems) != null)
{
return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), ((ShapedRecipes) object).recipeItems);
}
}
else if (object instanceof ShapelessRecipes)
{
if (this.hasResource(((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1])) != null) { return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), (ItemStack[]) ((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1])); }
if (this.hasResource(((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1])) != null)
{
return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), (ItemStack[]) ((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1]));
}
}
else if (object instanceof ShapedOreRecipe)
{
@ -477,9 +479,11 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
ArrayList<ItemStack> hasResources = this.hasResource(oreRecipeInput);
if (hasResources != null) {
if (hasResources != null)
{
return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1])); }
return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1]));
}
}
else if (object instanceof ShapelessOreRecipe)
{
@ -488,7 +492,10 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
List<ItemStack> hasResources = this.hasResource(oreRecipeInput.toArray());
if (hasResources != null) { return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1])); }
if (hasResources != null)
{
return new Pair<ItemStack, ItemStack[]>(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1]));
}
}
}
}