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; 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 * @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. * @param armbot - The Armbot instance.
*/ */

View file

@ -12,15 +12,15 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelCraneController extends ModelBase public class ModelCraneController extends ModelBase
{ {
// fields // fields
ModelRenderer Base2; ModelRenderer Base2;
ModelRenderer Base; ModelRenderer Base;
ModelRenderer ConnectorFront; ModelRenderer ConnectorFront;
ModelRenderer Decoration1; ModelRenderer Decoration1;
ModelRenderer Decoration2; ModelRenderer Decoration2;
ModelRenderer Decoration3; ModelRenderer Decoration3;
ModelRenderer Decoration4; ModelRenderer Decoration4;
ModelRenderer ConnectorTop; ModelRenderer ConnectorTop;
ModelRenderer ConnectorRight; ModelRenderer ConnectorRight;
public ModelCraneController() public ModelCraneController()
{ {

View file

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

View file

@ -103,7 +103,10 @@ public class RenderCrate extends TileEntitySpecialRenderer
{ {
World world = tileEntity.worldObj; 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 br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
int var11 = br % 65536; int var11 = br % 65536;

View file

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

View file

@ -12,7 +12,8 @@ import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine; 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 * @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()))) if (containedStack != null && (crateStack == null || (crateStack != null && containedStack.getItem().itemID == crateStack.getItem().itemID && containedStack.getItemDamage() == crateStack.getItemDamage())))
{ {
ItemStack returned = this.putIn(tileEntity, containedStack); ItemStack returned = this.putIn(tileEntity, containedStack);
ItemBlockCrate.setContainingItemStack(currentStack, returned ); ItemBlockCrate.setContainingItemStack(currentStack, returned);
return true; return true;
} }
@ -246,7 +247,10 @@ public class BlockCrate extends BlockMachine
itemStack.stackSize = 0; itemStack.stackSize = 0;
} }
if (itemStack.stackSize <= 0) { return null; } if (itemStack.stackSize <= 0)
{
return null;
}
return itemStack; return itemStack;
} }

View file

@ -1,9 +1,9 @@
package assemblyline.common.block; package assemblyline.common.block;
import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import assemblyline.common.AssemblyLine;
import assemblyline.common.TabAssemblyLine;
public class BlockTurntable extends Block public class BlockTurntable extends Block
{ {

View file

@ -66,7 +66,8 @@ public class ItemBlockCrate extends ItemBlock
itemStack.getTagCompound().setTag("Item", itemTagCompound); itemStack.getTagCompound().setTag("Item", itemTagCompound);
itemStack.getTagCompound().setInteger("Count", containingStack.stackSize); itemStack.getTagCompound().setInteger("Count", containingStack.stackSize);
}else }
else
{ {
itemStack.getTagCompound().setTag("Item", new NBTTagCompound()); itemStack.getTagCompound().setTag("Item", new NBTTagCompound());
itemStack.getTagCompound().setInteger("Count", 0); itemStack.getTagCompound().setInteger("Count", 0);

View file

@ -65,7 +65,10 @@ public class TileEntityCrate extends TileEntityAdvanced implements IInventory, I
@Override @Override
public Packet getDescriptionPacket() 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); 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.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityNetwork;
import universalelectricity.core.electricity.ElectricityPack; import universalelectricity.core.electricity.ElectricityPack;
import universalelectricity.prefab.network.PacketManager; 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 * 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++) for (int i = startIndex; i < startIndex + inventory.getSizeInventorySide(direction); i++)
{ {
itemStack = this.addStackToInventory(i, inventory, itemStack); itemStack = this.addStackToInventory(i, inventory, itemStack);
if (itemStack == null) { return null; } if (itemStack == null)
{
return null;
}
} }
} }
else if (tileEntity instanceof IInventory) else if (tileEntity instanceof IInventory)
@ -290,12 +293,18 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
for (int i = 0; i < inventory.getSizeInventory(); i++) for (int i = 0; i < inventory.getSizeInventory(); i++)
{ {
itemStack = this.addStackToInventory(i, inventory, itemStack); 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; return itemStack;
} }
@ -309,21 +318,27 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota
if (stackInInventory == null) if (stackInInventory == null)
{ {
inventory.setInventorySlotContents(slotIndex, itemStack); inventory.setInventorySlotContents(slotIndex, itemStack);
if (inventory.getStackInSlot(slotIndex) == null) { return itemStack; } if (inventory.getStackInSlot(slotIndex) == null)
{
return itemStack;
}
return null; return null;
} }
else if (stackInInventory.isItemEqual(itemStack) && stackInInventory.isStackable()) else if (stackInInventory.isItemEqual(itemStack) && stackInInventory.isStackable())
{ {
stackInInventory = stackInInventory.copy(); stackInInventory = stackInInventory.copy();
int stackLim = Math.min(inventory.getInventoryStackLimit(), itemStack.getMaxStackSize()); 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()); stackInInventory.stackSize = Math.min(Math.max((stackInInventory.stackSize + itemStack.stackSize - rejectedAmount), 0), inventory.getInventoryStackLimit());
itemStack.stackSize = rejectedAmount; itemStack.stackSize = rejectedAmount;
inventory.setInventorySlotContents(slotIndex, stackInInventory); inventory.setInventorySlotContents(slotIndex, stackInInventory);
} }
} }
if (itemStack.stackSize <= 0) { return null; } if (itemStack.stackSize <= 0)
{
return null;
}
return itemStack; return itemStack;
} }

View file

@ -39,7 +39,10 @@ public class BlockArmbot extends BlockMachine
{ {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z); 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; return false;
} }

View file

@ -802,7 +802,10 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult
{ {
for (int i = 0; i < found.size(); i++) 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; 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.UP || tileEntity.getSlant() == SlantType.DOWN)
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 + 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); 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

@ -27,7 +27,10 @@ public class TileEntityElevatorBelt extends TileEntityConveyorBelt
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) { return true; } if (ent instanceof TileEntityElevatorBelt)
{
return true;
}
return false; return false;
} }

View file

@ -112,7 +112,10 @@ public abstract class Command
*/ */
protected String getArg(int i) 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; return null;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,5 @@
package assemblyline.common.machine.command; 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. * 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 public class CommandHarvest extends CommandBreak
{ {
private CommandRotateTo rotateToCommand; private CommandRotateTo rotateToCommand;
@Override @Override
public void onTaskStart() public void onTaskStart()
{ {

View file

@ -9,10 +9,10 @@ import net.minecraft.nbt.NBTTagCompound;
*/ */
public class CommandRotateBy extends Command public class CommandRotateBy extends Command
{ {
float targetRotationYaw = 0; float targetRotationYaw = 0;
float targetRotationPitch = 0; float targetRotationPitch = 0;
float deltaPitch = 0, deltaYaw = 90; float deltaPitch = 0, deltaYaw = 90;
float totalTicks = 0f; float totalTicks = 0f;
@Override @Override
public void onTaskStart() public void onTaskStart()
@ -62,7 +62,10 @@ public class CommandRotateBy extends Command
/* /*
* float rotationalDifference = Math.abs(this.tileEntity.rotationYaw - this.targetRotation); * 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 // 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) if (Math.abs(this.tileEntity.rotationPitch - this.targetRotationPitch) > 0.001f)
this.tileEntity.rotationPitch = this.targetRotationPitch; 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.renderPitch - this.tileEntity.rotationPitch) > 0.001f)
if (Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f) { return true; } {
return true;
}
if (Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f)
{
return true;
}
return false; return false;
} }

View file

@ -72,9 +72,15 @@ public class CommandRotateTo extends Command
this.tileEntity.rotationYaw = this.targetRotationYaw; this.tileEntity.rotationYaw = this.targetRotationYaw;
this.tileEntity.rotationPitch = this.targetRotationPitch; 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.renderPitch - this.tileEntity.rotationPitch) > 0.001f)
if (Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f) { return true; } {
return true;
}
if (Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f)
{
return true;
}
return false; return false;
} }

View file

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

View file

@ -40,22 +40,22 @@ public class BlockCraneController extends BlockMachine
int rot = (int) Math.min((entity.rotationYaw - 45f) / 90f, 3); int rot = (int) Math.min((entity.rotationYaw - 45f) / 90f, 3);
switch (rot) switch (rot)
{ {
case 0: //WEST case 0: // WEST
{ {
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal()); world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal());
break; break;
} }
case 1: //NORTH case 1: // NORTH
{ {
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal()); world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal());
break; break;
} }
case 2: //EAST case 2: // EAST
{ {
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal()); world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal());
break; break;
} }
default: //SOUTH default: // SOUTH
{ {
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal()); world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal());
break; break;

View file

@ -91,7 +91,10 @@ public class BlockDetector extends BlockImprintable
@Override @Override
public int getBlockTextureFromSideAndMetadata(int side, int metadata) 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; return this.blockIndexInTexture;
} }
@ -150,7 +153,10 @@ public class BlockDetector extends BlockImprintable
TileEntity tileEntity = world.getBlockTileEntity(x, y, z); TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity != null) 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; return false;

View file

@ -30,7 +30,9 @@ public class BlockEncoder extends BlockMachine
return this.blockIndexInTexture; 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.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) if (slotStack.stackSize == 0)
{ {
@ -78,7 +84,10 @@ public class ContainerEncoder extends Container
slotObj.onSlotChanged(); slotObj.onSlotChanged();
} }
if (slotStack.stackSize == copyStack.stackSize) { return null; } if (slotStack.stackSize == copyStack.stackSize)
{
return null;
}
slotObj.onPickupFromSlot(player, slotStack); slotObj.onPickupFromSlot(player, slotStack);
} }

View file

@ -30,7 +30,9 @@ public class BlockImprinter extends BlockMachine
return this.blockIndexInTexture; 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.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) if (slotStack.stackSize == 0)
{ {
@ -107,7 +116,10 @@ public class ContainerImprinter extends Container implements ISlotWatcher
slotObj.onSlotChanged(); slotObj.onSlotChanged();
} }
if (slotStack.stackSize == copyStack.stackSize) { return null; } if (slotStack.stackSize == copyStack.stackSize)
{
return null;
}
slotObj.onPickupFromSlot(player, slotStack); slotObj.onPickupFromSlot(player, slotStack);
} }

View file

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

View file

@ -25,7 +25,8 @@ public class SlotCraftingResult extends Slot
public boolean canTakeStack(EntityPlayer player) public boolean canTakeStack(EntityPlayer player)
{ {
return true; 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 @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++; } } } } } * 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) != 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.ArrayList;
import java.util.List; 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.player.EntityPlayer;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -24,9 +22,7 @@ import universalelectricity.prefab.TranslationHelper;
import universalelectricity.prefab.tile.TileEntityAdvanced; import universalelectricity.prefab.tile.TileEntityAdvanced;
import assemblyline.api.IArmbot; import assemblyline.api.IArmbot;
import assemblyline.api.IArmbotUseable; import assemblyline.api.IArmbotUseable;
import assemblyline.common.AssemblyLine;
import assemblyline.common.Pair; import assemblyline.common.Pair;
import assemblyline.common.machine.armbot.TileEntityArmbot;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.ReflectionHelper;
@ -464,11 +460,17 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
{ {
if (object instanceof ShapedRecipes) 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) 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) else if (object instanceof ShapedOreRecipe)
{ {
@ -477,9 +479,11 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
ArrayList<ItemStack> hasResources = this.hasResource(oreRecipeInput); 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) else if (object instanceof ShapelessOreRecipe)
{ {
@ -488,7 +492,10 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv
List<ItemStack> hasResources = this.hasResource(oreRecipeInput.toArray()); 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]));
}
} }
} }
} }