diff --git a/buildnumber.txt b/buildnumber.txt index 7ed5f1a5..d82ce9e1 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -61 +61 diff --git a/recommendedversion.txt b/recommendedversion.txt index 60cd00d1..c1ce816c 100644 --- a/recommendedversion.txt +++ b/recommendedversion.txt @@ -1 +1 @@ -0.2.4 +0.2.4 diff --git a/src/minecraft/assemblyline/api/ConveyorIgnore.java b/src/minecraft/assemblyline/api/ConveyorIgnore.java deleted file mode 100644 index b7a904fb..00000000 --- a/src/minecraft/assemblyline/api/ConveyorIgnore.java +++ /dev/null @@ -1,30 +0,0 @@ -package assemblyline.api; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.Entity; - -/** - * A class that allows you to ignore specific entities on the Conveyor Belt. - * - * @author Calclavia - * - */ -public class ConveyorIgnore -{ - private static final List entityIgnoreList = new ArrayList(); - - public static void ignore(Entity entity) - { - if (!entityIgnoreList.contains(entity)) - { - entityIgnoreList.add(entity); - } - } - - public static boolean isIgnore(Entity entity) - { - return entityIgnoreList.contains(entity); - } -} diff --git a/src/minecraft/assemblyline/api/IArmbotUseable.java b/src/minecraft/assemblyline/api/IArmbotUseable.java index 24c868e7..fb133e59 100644 --- a/src/minecraft/assemblyline/api/IArmbotUseable.java +++ b/src/minecraft/assemblyline/api/IArmbotUseable.java @@ -1,25 +1,26 @@ package assemblyline.api; -import assemblyline.common.machine.armbot.TileEntityArmbot; import net.minecraft.entity.Entity; +import assemblyline.common.machine.armbot.TileEntityArmbot; /** - * 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 whenver 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 whenver the USE command is run on it. + * * @author Briman0094 - * + * */ 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 tileEntity the TileEntityArmbot that is using this IUseable * @param heldEntity the Entity being held by the ArmBot, or null if there is none * @return whether or not the "use" did anything */ public boolean onUse(TileEntityArmbot tileEntity, Entity heldEntity); - + } diff --git a/src/minecraft/assemblyline/client/model/ModelArmbot.java b/src/minecraft/assemblyline/client/model/ModelArmbot.java index 612039da..c83b833b 100644 --- a/src/minecraft/assemblyline/client/model/ModelArmbot.java +++ b/src/minecraft/assemblyline/client/model/ModelArmbot.java @@ -126,9 +126,28 @@ public class ModelArmbot extends ModelBase { /* - * armMountRight.setRotationPoint(baseRotation.rotationPointX, armMountRight.rotationPointY, baseRotation.rotationPointX); armMountLeft.setRotationPoint(baseRotation.rotationPointX, armMountLeft.rotationPointY, baseRotation.rotationPointX); armLower.setRotationPoint(baseRotation.rotationPointX, armLower.rotationPointY, baseRotation.rotationPointX); armUpper.setRotationPoint(baseRotation.rotationPointX, armUpper.rotationPointY, baseRotation.rotationPointX); baseRotation.setRotationPoint(baseRotation.rotationPointX, baseRotation.rotationPointY, baseRotation.rotationPointX); clampBody.setRotationPoint(baseRotation.rotationPointX, clampBody.rotationPointY, baseRotation.rotationPointX); clampBody2.setRotationPoint(baseRotation.rotationPointX, clampBody2.rotationPointY, baseRotation.rotationPointX); clampClawLower.setRotationPoint(baseRotation.rotationPointX, clampClawLower.rotationPointY, baseRotation.rotationPointX); clampClawLower2.setRotationPoint(baseRotation.rotationPointX, clampClawLower2.rotationPointY, baseRotation.rotationPointX); + * armMountRight.setRotationPoint(baseRotation.rotationPointX, armMountRight.rotationPointY, + * baseRotation.rotationPointX); armMountLeft.setRotationPoint(baseRotation.rotationPointX, + * armMountLeft.rotationPointY, baseRotation.rotationPointX); + * armLower.setRotationPoint(baseRotation.rotationPointX, armLower.rotationPointY, + * baseRotation.rotationPointX); armUpper.setRotationPoint(baseRotation.rotationPointX, + * armUpper.rotationPointY, baseRotation.rotationPointX); + * baseRotation.setRotationPoint(baseRotation.rotationPointX, baseRotation.rotationPointY, + * baseRotation.rotationPointX); clampBody.setRotationPoint(baseRotation.rotationPointX, + * clampBody.rotationPointY, baseRotation.rotationPointX); + * clampBody2.setRotationPoint(baseRotation.rotationPointX, clampBody2.rotationPointY, + * baseRotation.rotationPointX); + * clampClawLower.setRotationPoint(baseRotation.rotationPointX, + * clampClawLower.rotationPointY, baseRotation.rotationPointX); + * clampClawLower2.setRotationPoint(baseRotation.rotationPointX, + * clampClawLower2.rotationPointY, baseRotation.rotationPointX); * - * armMountRight.rotateAngleY = armBot.rotationYaw; armMountLeft.rotateAngleY = armBot.rotationYaw; armLower.rotateAngleY = armBot.rotationYaw; armUpper.rotateAngleY = armBot.rotationYaw; baseRotation.rotateAngleY = armBot.rotationYaw; clampBody.rotateAngleY = armBot.rotationYaw; clampBody2.rotateAngleY = armBot.rotationYaw; clampClawLower.rotateAngleY = armBot.rotationYaw; clampClawLower2.rotateAngleY = armBot.rotationYaw; + * armMountRight.rotateAngleY = armBot.rotationYaw; armMountLeft.rotateAngleY = + * armBot.rotationYaw; armLower.rotateAngleY = armBot.rotationYaw; armUpper.rotateAngleY = + * armBot.rotationYaw; baseRotation.rotateAngleY = armBot.rotationYaw; + * clampBody.rotateAngleY = armBot.rotationYaw; clampBody2.rotateAngleY = + * armBot.rotationYaw; clampClawLower.rotateAngleY = armBot.rotationYaw; + * clampClawLower2.rotateAngleY = armBot.rotationYaw; */ baseTop.render(f5); diff --git a/src/minecraft/assemblyline/client/model/ModelRejectorPiston.java b/src/minecraft/assemblyline/client/model/ModelRejectorPiston.java index bc0381af..0c88fa05 100644 --- a/src/minecraft/assemblyline/client/model/ModelRejectorPiston.java +++ b/src/minecraft/assemblyline/client/model/ModelRejectorPiston.java @@ -8,163 +8,162 @@ package assemblyline.client.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; public class ModelRejectorPiston extends ModelBase { - // fields - ModelRenderer BodyBottom; - ModelRenderer PistonFace2; - ModelRenderer PistonShaft; - ModelRenderer Piston; - ModelRenderer H1; - ModelRenderer H2; - ModelRenderer H3; - ModelRenderer PistonFace; - ModelRenderer WireCCRight; - ModelRenderer WireCCLeft; - ModelRenderer BodyP2; - ModelRenderer BodyP1; - ModelRenderer LeftSide; - ModelRenderer RightSide; - ModelRenderer PistonBack; - ModelRenderer WireCCFront; + // fields + ModelRenderer BodyBottom; + ModelRenderer PistonFace2; + ModelRenderer PistonShaft; + ModelRenderer Piston; + ModelRenderer H1; + ModelRenderer H2; + ModelRenderer H3; + ModelRenderer PistonFace; + ModelRenderer WireCCRight; + ModelRenderer WireCCLeft; + ModelRenderer BodyP2; + ModelRenderer BodyP1; + ModelRenderer LeftSide; + ModelRenderer RightSide; + ModelRenderer PistonBack; + ModelRenderer WireCCFront; - public ModelRejectorPiston() - { - textureWidth = 128; - textureHeight = 128; + public ModelRejectorPiston() + { + textureWidth = 128; + textureHeight = 128; - BodyBottom = new ModelRenderer(this, 29, 69); - BodyBottom.addBox(-5F, 0F, -2F, 10, 5, 15); - BodyBottom.setRotationPoint(0F, 19F, -6F); - BodyBottom.setTextureSize(128, 128); - BodyBottom.mirror = true; - setRotation(BodyBottom, 0F, 0F, 0F); - PistonFace2 = new ModelRenderer(this, 0, 53); - PistonFace2.addBox(-2F, -2F, -1F, 4, 6, 1); - PistonFace2.setRotationPoint(0F, 15F, -6F); - PistonFace2.setTextureSize(128, 128); - PistonFace2.mirror = true; - setRotation(PistonFace2, 0F, 0F, 0F); - PistonShaft = new ModelRenderer(this, 0, 75); - PistonShaft.addBox(-1.5F, -1.5F, 0F, 3, 3, 10); - PistonShaft.setRotationPoint(0F, 16F, -6F); - PistonShaft.setTextureSize(128, 128); - PistonShaft.mirror = true; - setRotation(PistonShaft, 0F, 0F, 0F); - Piston = new ModelRenderer(this, 0, 22); - Piston.addBox(-3F, -1F, 0F, 6, 6, 10); - Piston.setRotationPoint(0F, 14F, -5F); - Piston.setTextureSize(128, 128); - Piston.mirror = true; - setRotation(Piston, 0F, 0F, 0F); - H1 = new ModelRenderer(this, 33, 23); - H1.addBox(-1.5F, 0F, 0F, 3, 1, 8); - H1.setRotationPoint(0F, 12F, -4F); - H1.setTextureSize(128, 128); - H1.mirror = true; - setRotation(H1, 0F, 0F, 0F); - H2 = new ModelRenderer(this, 90, 23); - H2.addBox(0F, -1.5F, 0F, 1, 3, 8); - H2.setRotationPoint(-4F, 16F, -4F); - H2.setTextureSize(128, 128); - H2.mirror = true; - setRotation(H2, 0F, 0F, 0F); - H3 = new ModelRenderer(this, 70, 23); - H3.addBox(0F, -1.5F, 0F, 1, 3, 8); - H3.setRotationPoint(3F, 16F, -4F); - H3.setTextureSize(128, 128); - H3.mirror = true; - setRotation(H3, 0F, 0F, 0F); - PistonFace = new ModelRenderer(this, 0, 62); - PistonFace.addBox(-3F, -2F, -1F, 6, 4, 1); - PistonFace.setRotationPoint(0F, 16F, -6F); - PistonFace.setTextureSize(128, 128); - PistonFace.mirror = true; - setRotation(PistonFace, 0F, 0F, 0F); - WireCCRight = new ModelRenderer(this, 69, 52); - WireCCRight.addBox(-3F, -3F, 0F, 6, 11, 1); - WireCCRight.setRotationPoint(0F, 16F, 7F); - WireCCRight.setTextureSize(128, 128); - WireCCRight.mirror = true; - setRotation(WireCCRight, 0F, 0F, 0F); - WireCCLeft = new ModelRenderer(this, 54, 37); - WireCCLeft.addBox(0F, -3F, -3F, 1, 8, 6); - WireCCLeft.setRotationPoint(7F, 16F, 0F); - WireCCLeft.setTextureSize(128, 128); - WireCCLeft.mirror = true; - setRotation(WireCCLeft, 0F, 0F, 0F); - BodyP2 = new ModelRenderer(this, 100, 60); - BodyP2.addBox(1F, -2F, -2F, 2, 7, 4); - BodyP2.setRotationPoint(-8F, 16F, 0F); - BodyP2.setTextureSize(128, 128); - BodyP2.mirror = true; - setRotation(BodyP2, 0F, 0F, 0F); - BodyP1 = new ModelRenderer(this, 87, 60); - BodyP1.addBox(3F, -2F, -2F, 2, 7, 4); - BodyP1.setRotationPoint(2F, 16F, 0F); - BodyP1.setTextureSize(128, 128); - BodyP1.mirror = true; - setRotation(BodyP1, 0F, 0F, 0F); - LeftSide = new ModelRenderer(this, 29, 91); - LeftSide.addBox(0F, 0F, -2F, 3, 3, 14); - LeftSide.setRotationPoint(5F, 21F, -5F); - LeftSide.setTextureSize(128, 128); - LeftSide.mirror = true; - setRotation(LeftSide, 0F, 0F, 0F); - RightSide = new ModelRenderer(this, 64, 91); - RightSide.addBox(0F, 0F, -2F, 3, 3, 14); - RightSide.setRotationPoint(-8F, 21F, -5F); - RightSide.setTextureSize(128, 128); - RightSide.mirror = true; - setRotation(RightSide, 0F, 0F, 0F); - PistonBack = new ModelRenderer(this, 0, 12); - PistonBack.addBox(-2.5F, -2.5F, -1F, 5, 5, 2); - PistonBack.setRotationPoint(0F, 16F, 6F); - PistonBack.setTextureSize(128, 128); - PistonBack.mirror = true; - setRotation(PistonBack, 0F, 0F, 0F); - WireCCFront = new ModelRenderer(this, 69, 37); - WireCCFront.addBox(0F, -3F, -3F, 1, 8, 6); - WireCCFront.setRotationPoint(-8F, 16F, 0F); - WireCCFront.setTextureSize(128, 128); - WireCCFront.mirror = true; - setRotation(WireCCFront, 0F, 0F, 0F); - } + BodyBottom = new ModelRenderer(this, 29, 69); + BodyBottom.addBox(-5F, 0F, -2F, 10, 5, 15); + BodyBottom.setRotationPoint(0F, 19F, -6F); + BodyBottom.setTextureSize(128, 128); + BodyBottom.mirror = true; + setRotation(BodyBottom, 0F, 0F, 0F); + PistonFace2 = new ModelRenderer(this, 0, 53); + PistonFace2.addBox(-2F, -2F, -1F, 4, 6, 1); + PistonFace2.setRotationPoint(0F, 15F, -6F); + PistonFace2.setTextureSize(128, 128); + PistonFace2.mirror = true; + setRotation(PistonFace2, 0F, 0F, 0F); + PistonShaft = new ModelRenderer(this, 0, 75); + PistonShaft.addBox(-1.5F, -1.5F, 0F, 3, 3, 10); + PistonShaft.setRotationPoint(0F, 16F, -6F); + PistonShaft.setTextureSize(128, 128); + PistonShaft.mirror = true; + setRotation(PistonShaft, 0F, 0F, 0F); + Piston = new ModelRenderer(this, 0, 22); + Piston.addBox(-3F, -1F, 0F, 6, 6, 10); + Piston.setRotationPoint(0F, 14F, -5F); + Piston.setTextureSize(128, 128); + Piston.mirror = true; + setRotation(Piston, 0F, 0F, 0F); + H1 = new ModelRenderer(this, 33, 23); + H1.addBox(-1.5F, 0F, 0F, 3, 1, 8); + H1.setRotationPoint(0F, 12F, -4F); + H1.setTextureSize(128, 128); + H1.mirror = true; + setRotation(H1, 0F, 0F, 0F); + H2 = new ModelRenderer(this, 90, 23); + H2.addBox(0F, -1.5F, 0F, 1, 3, 8); + H2.setRotationPoint(-4F, 16F, -4F); + H2.setTextureSize(128, 128); + H2.mirror = true; + setRotation(H2, 0F, 0F, 0F); + H3 = new ModelRenderer(this, 70, 23); + H3.addBox(0F, -1.5F, 0F, 1, 3, 8); + H3.setRotationPoint(3F, 16F, -4F); + H3.setTextureSize(128, 128); + H3.mirror = true; + setRotation(H3, 0F, 0F, 0F); + PistonFace = new ModelRenderer(this, 0, 62); + PistonFace.addBox(-3F, -2F, -1F, 6, 4, 1); + PistonFace.setRotationPoint(0F, 16F, -6F); + PistonFace.setTextureSize(128, 128); + PistonFace.mirror = true; + setRotation(PistonFace, 0F, 0F, 0F); + WireCCRight = new ModelRenderer(this, 69, 52); + WireCCRight.addBox(-3F, -3F, 0F, 6, 11, 1); + WireCCRight.setRotationPoint(0F, 16F, 7F); + WireCCRight.setTextureSize(128, 128); + WireCCRight.mirror = true; + setRotation(WireCCRight, 0F, 0F, 0F); + WireCCLeft = new ModelRenderer(this, 54, 37); + WireCCLeft.addBox(0F, -3F, -3F, 1, 8, 6); + WireCCLeft.setRotationPoint(7F, 16F, 0F); + WireCCLeft.setTextureSize(128, 128); + WireCCLeft.mirror = true; + setRotation(WireCCLeft, 0F, 0F, 0F); + BodyP2 = new ModelRenderer(this, 100, 60); + BodyP2.addBox(1F, -2F, -2F, 2, 7, 4); + BodyP2.setRotationPoint(-8F, 16F, 0F); + BodyP2.setTextureSize(128, 128); + BodyP2.mirror = true; + setRotation(BodyP2, 0F, 0F, 0F); + BodyP1 = new ModelRenderer(this, 87, 60); + BodyP1.addBox(3F, -2F, -2F, 2, 7, 4); + BodyP1.setRotationPoint(2F, 16F, 0F); + BodyP1.setTextureSize(128, 128); + BodyP1.mirror = true; + setRotation(BodyP1, 0F, 0F, 0F); + LeftSide = new ModelRenderer(this, 29, 91); + LeftSide.addBox(0F, 0F, -2F, 3, 3, 14); + LeftSide.setRotationPoint(5F, 21F, -5F); + LeftSide.setTextureSize(128, 128); + LeftSide.mirror = true; + setRotation(LeftSide, 0F, 0F, 0F); + RightSide = new ModelRenderer(this, 64, 91); + RightSide.addBox(0F, 0F, -2F, 3, 3, 14); + RightSide.setRotationPoint(-8F, 21F, -5F); + RightSide.setTextureSize(128, 128); + RightSide.mirror = true; + setRotation(RightSide, 0F, 0F, 0F); + PistonBack = new ModelRenderer(this, 0, 12); + PistonBack.addBox(-2.5F, -2.5F, -1F, 5, 5, 2); + PistonBack.setRotationPoint(0F, 16F, 6F); + PistonBack.setTextureSize(128, 128); + PistonBack.mirror = true; + setRotation(PistonBack, 0F, 0F, 0F); + WireCCFront = new ModelRenderer(this, 69, 37); + WireCCFront.addBox(0F, -3F, -3F, 1, 8, 6); + WireCCFront.setRotationPoint(-8F, 16F, 0F); + WireCCFront.setTextureSize(128, 128); + WireCCFront.mirror = true; + setRotation(WireCCFront, 0F, 0F, 0F); + } - public void render(float f5) - { - BodyBottom.render(f5); - Piston.render(f5); - H1.render(f5); - H2.render(f5); - H3.render(f5); - WireCCRight.render(f5); - WireCCLeft.render(f5); - BodyP2.render(f5); - BodyP1.render(f5); - LeftSide.render(f5); - RightSide.render(f5); - PistonBack.render(f5); - WireCCFront.render(f5); - } + public void render(float f5) + { + BodyBottom.render(f5); + Piston.render(f5); + H1.render(f5); + H2.render(f5); + H3.render(f5); + WireCCRight.render(f5); + WireCCLeft.render(f5); + BodyP2.render(f5); + BodyP1.render(f5); + LeftSide.render(f5); + RightSide.render(f5); + PistonBack.render(f5); + WireCCFront.render(f5); + } - public void renderPiston(float f5, int p) - { - PistonFace2.setRotationPoint(0F, 15F, -6F-p); - PistonShaft.setRotationPoint(0F, 16F, -6F-p); - PistonFace.setRotationPoint(0F, 16F, -6F-p); - PistonFace2.render(f5); - PistonShaft.render(f5); - PistonFace.render(f5); - } + public void renderPiston(float f5, int p) + { + PistonFace2.setRotationPoint(0F, 15F, -6F - p); + PistonShaft.setRotationPoint(0F, 16F, -6F - p); + PistonFace.setRotationPoint(0F, 16F, -6F - p); + PistonFace2.render(f5); + PistonShaft.render(f5); + PistonFace.render(f5); + } - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } } diff --git a/src/minecraft/assemblyline/client/render/RenderArmbot.java b/src/minecraft/assemblyline/client/render/RenderArmbot.java index 8895d075..e541583d 100644 --- a/src/minecraft/assemblyline/client/render/RenderArmbot.java +++ b/src/minecraft/assemblyline/client/render/RenderArmbot.java @@ -1,6 +1,5 @@ package assemblyline.client.render; -import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -36,7 +35,8 @@ public class RenderArmbot extends TileEntitySpecialRenderer GL11.glRotatef(180, 0, 0, 1); for (Entity entity : ((TileEntityArmbot) tileEntity).grabbedEntities) { - if (entity != null && entity instanceof EntityItem) //items don't move right, so we render them manually + if (entity != null && entity instanceof EntityItem) // items don't move right, so we + // render them manually { EntityItem item = (EntityItem) entity; item.age = 0; diff --git a/src/minecraft/assemblyline/client/render/RenderCrate.java b/src/minecraft/assemblyline/client/render/RenderCrate.java index 4e6cfa66..96faf9e5 100644 --- a/src/minecraft/assemblyline/client/render/RenderCrate.java +++ b/src/minecraft/assemblyline/client/render/RenderCrate.java @@ -11,7 +11,7 @@ public class RenderCrate implements ISimpleBlockRenderingHandler @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { - + } @Override diff --git a/src/minecraft/assemblyline/common/block/BlockCrate.java b/src/minecraft/assemblyline/common/block/BlockCrate.java index 2698b5fa..962adecc 100644 --- a/src/minecraft/assemblyline/common/block/BlockCrate.java +++ b/src/minecraft/assemblyline/common/block/BlockCrate.java @@ -90,7 +90,7 @@ public class BlockCrate extends BlockMachine return false; } - + @Override public int getRenderType() { diff --git a/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java b/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java index 8ee0094c..2fd0ec6e 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityAssemblyNetwork.java @@ -11,7 +11,8 @@ 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 able to be powered through the powering of only one machine. + * A class to be inherited by all machines on the assembly line. This will allow all machines to be + * able to be powered through the powering of only one machine. * * @author Calclavia * diff --git a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java index 32859066..34237358 100644 --- a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java +++ b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java @@ -14,6 +14,7 @@ import net.minecraftforge.common.ISidedInventory; import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.implement.IRedstoneReceptor; import universalelectricity.prefab.implement.IRotatable; +import universalelectricity.prefab.multiblock.TileEntityMulti; import universalelectricity.prefab.network.PacketManager; import assemblyline.api.IManipulator; import assemblyline.common.machine.imprinter.TileEntityFilterable; @@ -21,14 +22,14 @@ import cpw.mods.fml.common.network.PacketDispatcher; public class TileEntityManipulator extends TileEntityFilterable implements IRotatable, IRedstoneReceptor, IManipulator { - public boolean selfPulse = false; + public boolean selfPulse = false; /** * Is the manipulator wrenched to turn into output mode? */ - private boolean isOutput = false; + private boolean isOutput = false; - private boolean isRedstonePowered = false; + private boolean isRedstonePowered = false; public boolean isOutput() { @@ -86,7 +87,8 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota } /** - * Find items going into the manipulator and input them into an inventory behind this manipulator. + * Find items going into the manipulator and input them into an inventory behind this + * manipulator. */ @Override public void inject() @@ -110,7 +112,8 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota if (entity.isDead) continue; /** - * Try top first, then bottom, then the sides to see if it is possible to insert the item into a inventory. + * Try top first, then bottom, then the sides to see if it is possible to insert the + * item into a inventory. */ ItemStack remainingStack = entity.func_92014_d().copy(); @@ -180,9 +183,16 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota } /* - * @Override public ArrayList getPacketData() { ArrayList list = super.getPacketData(); list.add(this.isOutput); list.add(this.wattsReceived); return list; } + * @Override public ArrayList getPacketData() { ArrayList list = super.getPacketData(); + * list.add(this.isOutput); list.add(this.wattsReceived); return list; } * - * @Override public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { if (worldObj.isRemote) { ByteArrayInputStream bis = new ByteArrayInputStream(packet.data); DataInputStream dis = new DataInputStream(bis); int id, x, y, z; try { id = dis.readInt(); x = dis.readInt(); y = dis.readInt(); z = dis.readInt(); NBTTagCompound tag = Packet.readNBTTagCompound(dis); readFromNBT(tag); this.wattsReceived = dis.readDouble(); this.isOutput = dis.readBoolean(); } catch (IOException e) { e.printStackTrace(); } } } + * @Override public void handlePacketData(INetworkManager network, int packetType, + * Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { if + * (worldObj.isRemote) { ByteArrayInputStream bis = new ByteArrayInputStream(packet.data); + * DataInputStream dis = new DataInputStream(bis); int id, x, y, z; try { id = dis.readInt(); x + * = dis.readInt(); y = dis.readInt(); z = dis.readInt(); NBTTagCompound tag = + * Packet.readNBTTagCompound(dis); readFromNBT(tag); this.wattsReceived = dis.readDouble(); + * this.isOutput = dis.readBoolean(); } catch (IOException e) { e.printStackTrace(); } } } */ /** @@ -215,7 +225,17 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota /** * Try to put items into a chest. */ - if (tileEntity instanceof TileEntityChest) + if (tileEntity instanceof TileEntityMulti) + { + Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition; + + if (mainBlockPosition != null) + { + if (!(mainBlockPosition.getTileEntity(this.worldObj) instanceof TileEntityMulti)) + return tryPlaceInPosition(itemStack, mainBlockPosition, direction); + } + } + else if (tileEntity instanceof TileEntityChest) { TileEntityChest[] chests = { (TileEntityChest) tileEntity, null }; @@ -323,7 +343,17 @@ public class TileEntityManipulator extends TileEntityFilterable implements IRota /** * Try to put items into a chest. */ - if (tileEntity instanceof TileEntityChest) + if (tileEntity instanceof TileEntityMulti) + { + Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition; + + if (mainBlockPosition != null) + { + if (!(mainBlockPosition.getTileEntity(this.worldObj) instanceof TileEntityMulti)) + return tryGrabFromPosition(mainBlockPosition, direction); + } + } + else if (tileEntity instanceof TileEntityChest) { TileEntityChest[] chests = { (TileEntityChest) tileEntity, null }; diff --git a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java index 50e65f21..5f07fb1a 100644 --- a/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java +++ b/src/minecraft/assemblyline/common/machine/armbot/TileEntityArmbot.java @@ -51,32 +51,32 @@ import dan200.computer.api.IPeripheral; public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMultiBlock, IInventory, IPacketReceiver, IJouleStorage, IPeripheral { - private final CommandManager commandManager = new CommandManager(); - private static final int PACKET_COMMANDS = 128; + private final CommandManager commandManager = new CommandManager(); + private static final int PACKET_COMMANDS = 128; /** * The items this container contains. */ - protected ItemStack disk = null; - public final double WATT_REQUEST = 20; - public double wattsReceived = 0; - private int playerUsing = 0; - private int computersAttached = 0; - private List connectedComputers = new ArrayList(); + protected ItemStack disk = null; + public final double WATT_REQUEST = 20; + public double wattsReceived = 0; + private int playerUsing = 0; + private int computersAttached = 0; + private List connectedComputers = new ArrayList(); /** * The rotation of the arms. In Degrees. */ - public float rotationPitch = 0; - public float rotationYaw = 0; - public float renderPitch = 0; - public float renderYaw = 0; - private int ticksSincePower = 0; - public final float ROTATION_SPEED = 1.3f; + public float rotationPitch = 0; + public float rotationYaw = 0; + public float renderPitch = 0; + public float renderYaw = 0; + private int ticksSincePower = 0; + public final float ROTATION_SPEED = 1.3f; /** * An entity that the armbot is grabbed onto. */ - public final List grabbedEntities = new ArrayList(); + public final List grabbedEntities = new ArrayList(); @Override public void initiate() @@ -215,7 +215,13 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult this.renderYaw -= 360; } - if (this.ticks % 5 == 0 && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) // sound is 0.25 seconds long (20 ticks/second) + 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); if (Math.abs(this.renderYaw - this.rotationYaw) < this.ROTATION_SPEED + 0.1f) @@ -254,7 +260,13 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult this.renderPitch = 60; } - if (this.ticks % 4 == 0 && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) // sound is 0.25 seconds long (20 ticks/second) + if (this.ticks % 4 == 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, 2.5f, true); if (Math.abs(this.renderPitch - this.rotationPitch) < this.ROTATION_SPEED + 0.1f) @@ -284,7 +296,9 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult double distance = 1f; Vector3 delta = new Vector3(); // The delta Y of the hand. - delta.y = Math.sin(Math.toRadians(this.renderPitch)) * distance * 2; //arm bend up in a taller-than-wide arc + delta.y = Math.sin(Math.toRadians(this.renderPitch)) * distance * 2; // arm bend up in a + // taller-than-wide + // arc // The horizontal delta of the hand. double dH = Math.cos(Math.toRadians(this.renderPitch)) * distance; // The delta X and Z. @@ -666,7 +680,8 @@ public class TileEntityArmbot extends TileEntityAssemblyNetwork implements IMult { return new Object[] { this.commandManager.hasTasks() }; } - case 5: // touchingEntity: returns whether or not the ArmBot is touching an entity it is able to pick up + case 5: // touchingEntity: returns whether or not the ArmBot is touching an entity it is + // able to pick up { Vector3 serachPosition = this.getHandPosition(); List found = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(serachPosition.x - 0.5f, serachPosition.y - 0.5f, serachPosition.z - 0.5f, serachPosition.x + 0.5f, serachPosition.y + 0.5f, serachPosition.z + 0.5f)); @@ -675,7 +690,15 @@ 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) // isn't null, isn't a player, and isn't riding anything + if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && found.get(i).ridingEntity == null) // isn't + // null, + // isn't + // a + // player, + // and + // isn't + // riding + // anything { return new Object[] { true }; } } } diff --git a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java index 72f2248f..d5f809fe 100644 --- a/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/BlockConveyorBelt.java @@ -1,7 +1,6 @@ package assemblyline.common.machine.belt; import java.util.List; -import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; @@ -34,7 +33,7 @@ public class BlockConveyorBelt extends BlockMachine this.setBlockBounds(0, 0, 0, 1, 0.3f, 1); this.setCreativeTab(TabAssemblyLine.INSTANCE); } - + @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { @@ -68,14 +67,8 @@ 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); @@ -276,7 +269,7 @@ public class BlockConveyorBelt extends BlockMachine entity.motionZ = direction.offsetZ * maxSpeed; entity.motionX = 0; } - + entity.motionY += 0.0125f; if (entity instanceof EntityItem) diff --git a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java index 36cf55fd..73cbed80 100644 --- a/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java +++ b/src/minecraft/assemblyline/common/machine/belt/TileEntityConveyorBelt.java @@ -3,7 +3,6 @@ package assemblyline.common.machine.belt; import java.util.EnumSet; import java.util.List; -import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -53,7 +52,8 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements } /** - * This function is overriden to allow conveyor belts to power belts that are diagonally going up. + * This function is overriden to allow conveyor belts to power belts that are diagonally going + * up. */ @Override public void updatePowerTransferRange() @@ -119,8 +119,11 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements if (this.isRunning()) { - if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(xCoord - 1, yCoord, zCoord) != AssemblyLine.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != AssemblyLine.blockConveyorBelt.blockID) // sound is 0.5 seconds long (20 ticks/second) - this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 0.5f, 0.3f, true); + if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(xCoord - 1, yCoord, zCoord) != AssemblyLine.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != AssemblyLine.blockConveyorBelt.blockID) + { + // Sound is 0.5 seconds long (20 ticks/second) + this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 0.3f, 0.3f, true); + } this.wheelRotation += 40; diff --git a/src/minecraft/assemblyline/common/machine/command/Command.java b/src/minecraft/assemblyline/common/machine/command/Command.java index ad978cbb..a99f2636 100644 --- a/src/minecraft/assemblyline/common/machine/command/Command.java +++ b/src/minecraft/assemblyline/common/machine/command/Command.java @@ -125,13 +125,13 @@ public abstract class Command } catch (Exception e) { - + } } return 0; } - + protected Double getDoubleArg(int i) { if (getArg(i) != null) @@ -142,13 +142,13 @@ public abstract class Command } catch (Exception e) { - + } } return 0.0; } - + protected Float getFloatArg(int i) { if (getArg(i) != null) @@ -159,7 +159,7 @@ public abstract class Command } catch (Exception e) { - + } } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandDrop.java b/src/minecraft/assemblyline/common/machine/command/CommandDrop.java index 913d3974..6db8cba0 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandDrop.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandDrop.java @@ -1,6 +1,5 @@ package assemblyline.common.machine.command; -import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -10,7 +9,7 @@ public class CommandDrop extends Command protected boolean doTask() { super.doTask(); - + if (this.tileEntity.grabbedEntities.size() == 0) return false; @@ -23,7 +22,8 @@ public class CommandDrop extends Command entity.worldObj = this.tileEntity.worldObj; if (entity instanceof EntityItem) if (!world.isRemote) - world.spawnEntityInWorld(entity); // items don't move right, so we render them manually + world.spawnEntityInWorld(entity); // items don't move right, so we render + // them manually this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true); } } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandFire.java b/src/minecraft/assemblyline/common/machine/command/CommandFire.java index e1050e97..6ca527f2 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandFire.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandFire.java @@ -1,117 +1,117 @@ -package assemblyline.common.machine.command; - -import java.util.Random; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -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 float actualYaw; - private float actualPitch; - private float velocity; - private Vector3 finalVelocity; - - @Override - public void onTaskStart() - { - super.onTaskStart(); - - velocity = this.getFloatArg(0); - if (velocity > 2.5f) - velocity = 2.5f; - if (velocity < 0.125f) - velocity = 1f; - - this.actualYaw = this.tileEntity.rotationYaw; - this.actualPitch = ((MAX_ACTUAL_PITCH - MIN_ACTUAL_PITCH) * (this.tileEntity.rotationPitch / 60f)) + MIN_ACTUAL_PITCH; - - double x, y, z; - double yaw, pitch; - yaw = Math.toRadians(actualYaw); - pitch = Math.toRadians(actualPitch); - // yaw = actualYaw; - // pitch = actualPitch; - - x = -Math.sin(yaw) * Math.cos(pitch); - y = Math.sin(pitch); - z = Math.cos(yaw) * Math.cos(pitch); - - this.finalVelocity = new Vector3(x, y, z); - Random random = new Random(System.currentTimeMillis()); - this.finalVelocity.x *= (1f - (1f / 200f)) + (random.nextFloat() * (1f / 100f)); - this.finalVelocity.y *= (1f - (1f / 200f)) + (random.nextFloat() * (1f / 100f)); - this.finalVelocity.z *= (1f - (1f / 200f)) + (random.nextFloat() * (1f / 100f)); - - this.finalVelocity.multiply(velocity); - } - - @Override - protected boolean doTask() - { - if (this.finalVelocity == null) // something went wrong - { - this.finalVelocity = new Vector3(0, 0, 0); - } - if (this.tileEntity.grabbedEntities.size() > 0) - { - Entity held = this.tileEntity.grabbedEntities.get(0); - if (held != null) - { - this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.bow", velocity, 2f - (velocity / 4f), true); - if (held instanceof EntityItem) - { - EntityItem item = (EntityItem) held; - ItemStack stack = item.func_92014_d(); - ItemStack thrown = stack.copy(); - thrown.stackSize = 1; - if (item.func_92014_d().stackSize > 0) - { - stack.stackSize--; - item.func_92013_a(stack); - } - else - { - this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).doTask(); - if (!this.world.isRemote) - this.world.removeEntity(held); - } - if (item.func_92014_d().itemID == Item.arrow.itemID) - { - EntityArrow arrow = new EntityArrow(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z); - arrow.motionX = this.finalVelocity.x; - arrow.motionY = this.finalVelocity.y; - arrow.motionZ = this.finalVelocity.z; - if (!this.world.isRemote) - this.world.spawnEntityInWorld(arrow); - } - else - { - EntityItem item2 = new EntityItem(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z, thrown); - item2.motionX = this.finalVelocity.x; - item2.motionY = this.finalVelocity.y; - item2.motionZ = this.finalVelocity.z; - if (!this.world.isRemote) - this.world.spawnEntityInWorld(item2); - } - } - else - { - this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).doTask(); - held.motionX = this.finalVelocity.x; - held.motionY = this.finalVelocity.y; - held.motionZ = this.finalVelocity.z; - } - } - } - - return false; - } -} +package assemblyline.common.machine.command; + +import java.util.Random; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +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 float actualYaw; + private float actualPitch; + private float velocity; + private Vector3 finalVelocity; + + @Override + public void onTaskStart() + { + super.onTaskStart(); + + velocity = this.getFloatArg(0); + if (velocity > 2.5f) + velocity = 2.5f; + if (velocity < 0.125f) + velocity = 1f; + + this.actualYaw = this.tileEntity.rotationYaw; + this.actualPitch = ((MAX_ACTUAL_PITCH - MIN_ACTUAL_PITCH) * (this.tileEntity.rotationPitch / 60f)) + MIN_ACTUAL_PITCH; + + double x, y, z; + double yaw, pitch; + yaw = Math.toRadians(actualYaw); + pitch = Math.toRadians(actualPitch); + // yaw = actualYaw; + // pitch = actualPitch; + + x = -Math.sin(yaw) * Math.cos(pitch); + y = Math.sin(pitch); + z = Math.cos(yaw) * Math.cos(pitch); + + this.finalVelocity = new Vector3(x, y, z); + Random random = new Random(System.currentTimeMillis()); + this.finalVelocity.x *= (1f - (1f / 200f)) + (random.nextFloat() * (1f / 100f)); + this.finalVelocity.y *= (1f - (1f / 200f)) + (random.nextFloat() * (1f / 100f)); + this.finalVelocity.z *= (1f - (1f / 200f)) + (random.nextFloat() * (1f / 100f)); + + this.finalVelocity.multiply(velocity); + } + + @Override + protected boolean doTask() + { + if (this.finalVelocity == null) // something went wrong + { + this.finalVelocity = new Vector3(0, 0, 0); + } + if (this.tileEntity.grabbedEntities.size() > 0) + { + Entity held = this.tileEntity.grabbedEntities.get(0); + if (held != null) + { + this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.bow", velocity, 2f - (velocity / 4f), true); + if (held instanceof EntityItem) + { + EntityItem item = (EntityItem) held; + ItemStack stack = item.func_92014_d(); + ItemStack thrown = stack.copy(); + thrown.stackSize = 1; + if (item.func_92014_d().stackSize > 0) + { + stack.stackSize--; + item.func_92013_a(stack); + } + else + { + this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).doTask(); + if (!this.world.isRemote) + this.world.removeEntity(held); + } + if (item.func_92014_d().itemID == Item.arrow.itemID) + { + EntityArrow arrow = new EntityArrow(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z); + arrow.motionX = this.finalVelocity.x; + arrow.motionY = this.finalVelocity.y; + arrow.motionZ = this.finalVelocity.z; + if (!this.world.isRemote) + this.world.spawnEntityInWorld(arrow); + } + else + { + EntityItem item2 = new EntityItem(world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z, thrown); + item2.motionX = this.finalVelocity.x; + item2.motionY = this.finalVelocity.y; + item2.motionZ = this.finalVelocity.z; + if (!this.world.isRemote) + this.world.spawnEntityInWorld(item2); + } + } + else + { + this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[] {}).doTask(); + held.motionX = this.finalVelocity.x; + held.motionY = this.finalVelocity.y; + held.motionZ = this.finalVelocity.z; + } + } + } + + return false; + } +} diff --git a/src/minecraft/assemblyline/common/machine/command/CommandGrab.java b/src/minecraft/assemblyline/common/machine/command/CommandGrab.java index 8dc0031c..ff5327d8 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandGrab.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandGrab.java @@ -34,10 +34,10 @@ public class CommandGrab extends Command protected boolean doTask() { super.doTask(); - + if (this.tileEntity.grabbedEntities.size() > 0) return false; - + Vector3 serachPosition = this.tileEntity.getHandPosition(); List found = this.world.getEntitiesWithinAABB(this.entityToInclude, AxisAlignedBB.getBoundingBox(serachPosition.x - radius, serachPosition.y - radius, serachPosition.z - radius, serachPosition.x + radius, serachPosition.y + radius, serachPosition.z + radius)); @@ -45,11 +45,22 @@ public class CommandGrab extends Command { for (int i = 0; i < found.size(); i++) { - if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && !(found.get(i) instanceof EntityArrow) && found.get(i).ridingEntity == null) // isn't null, isn't a player, and isn't riding anything + if (found.get(i) != null && !(found.get(i) instanceof EntityPlayer) && !(found.get(i) instanceof EntityArrow) && found.get(i).ridingEntity == null) // isn't + // null, + // isn't + // a + // player, + // and + // isn't + // riding + // anything { this.tileEntity.grabbedEntities.add(found.get(i)); if (found.get(i) instanceof EntityItem) - this.tileEntity.worldObj.removeEntity(found.get(i)); // items don't move right, so we render them manually\ + this.tileEntity.worldObj.removeEntity(found.get(i)); // items don't move + // right, so we + // render them + // manually\ this.world.playSound(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord, "random.pop", 0.2F, ((this.tileEntity.worldObj.rand.nextFloat() - this.tileEntity.worldObj.rand.nextFloat()) * 0.7F + 1.0F) * 1.0F, true); found.get(i).isDead = false; return false; diff --git a/src/minecraft/assemblyline/common/machine/command/CommandIdle.java b/src/minecraft/assemblyline/common/machine/command/CommandIdle.java index d4795da4..412c968f 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandIdle.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandIdle.java @@ -1,6 +1,5 @@ package assemblyline.common.machine.command; - public class CommandIdle extends Command { /** @@ -23,7 +22,7 @@ public class CommandIdle extends Command /** * Randomly move the arm to simulate life in the arm if the arm is powered */ - //this.tileEntity.rotationPitch *= 0.98 * this.world.rand.nextFloat(); + // this.tileEntity.rotationPitch *= 0.98 * this.world.rand.nextFloat(); if (this.idleTime > 0) { diff --git a/src/minecraft/assemblyline/common/machine/command/CommandManager.java b/src/minecraft/assemblyline/common/machine/command/CommandManager.java index d7065793..e5abac34 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandManager.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandManager.java @@ -6,17 +6,15 @@ import java.util.List; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import assemblyline.common.machine.armbot.TileEntityArmbot; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.relauncher.Side; public class CommandManager { - private final List tasks = new ArrayList(); + private final List tasks = new ArrayList(); - private int ticks = 0; - private int currentTask = 0; - private int lastTask = -1; + private int ticks = 0; + private int currentTask = 0; + private int lastTask = -1; /** * Must be called every tick by a tileEntity. @@ -45,18 +43,21 @@ public class CommandManager this.lastTask = this.currentTask; task.onTaskStart(); } - - //if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) - //System.out.println("curTask: " + this.currentTask + ": " + this.tasks.get(this.currentTask).toString().substring(this.tasks.get(this.currentTask).toString().lastIndexOf('.') + 1)); + + // if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) + // System.out.println("curTask: " + this.currentTask + ": " + + // this.tasks.get(this.currentTask).toString().substring(this.tasks.get(this.currentTask).toString().lastIndexOf('.') + // + 1)); if (!task.doTask()) { int tempCurrentTask = this.currentTask; task.onTaskEnd(); this.currentTask++; - if (!(task instanceof CommandRepeat)) //repeat needs to be persistent + if (!(task instanceof CommandRepeat)) // repeat needs to be persistent { - // End the task and reinitialize it into a new class to make sure it is fresh. + // End the task and reinitialize it into a new class to make sure it is + // fresh. this.tasks.set(tempCurrentTask, this.getNewCommand(task.tileEntity, task.getClass(), task.getArgs())); } } @@ -97,7 +98,8 @@ public class CommandManager } /** - * 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 newCommand Task instance to register diff --git a/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java b/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java index 39cf84ce..2ab2f648 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandRepeat.java @@ -11,10 +11,10 @@ public class CommandRepeat extends Command /** * The amount of tasks above this task to repeat. */ - private int tasksToRepeat; - private int numReps; - private int curReps; - private boolean initialized = false; + private int tasksToRepeat; + private int numReps; + private int curReps; + private boolean initialized = false; public void onTaskStart() { diff --git a/src/minecraft/assemblyline/common/machine/command/CommandReturn.java b/src/minecraft/assemblyline/common/machine/command/CommandReturn.java index c04fdd8f..e2ebab2f 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandReturn.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandReturn.java @@ -1,11 +1,10 @@ package assemblyline.common.machine.command; - public class CommandReturn extends CommandRotate { public static final float IDLE_ROTATION_PITCH = 0; public static final float IDLE_ROTATION_YAW = 0; - + @Override public void onTaskStart() { @@ -16,31 +15,25 @@ public class CommandReturn extends CommandRotate this.totalTicks = Math.max(totalTicksYaw, totalTicksPitch); } - /*@Override - protected boolean doTask() - { - /** - * Move the arm rotation to idle position if the machine is not idling - * - if (Math.abs(this.tileEntity.rotationPitch - IDLE_ROTATION_PITCH) > 0.01 || Math.abs(this.tileEntity.rotationYaw - IDLE_ROTATION_YAW) > 0.01) - { - if (Math.abs(IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) > 0.125) - this.tileEntity.rotationPitch += (IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) * 0.05; - else - this.tileEntity.rotationPitch += Math.signum(IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) * (0.125 * 0.05); - if (Math.abs(this.tileEntity.rotationPitch - IDLE_ROTATION_PITCH) < 0.0125) - this.tileEntity.rotationPitch = IDLE_ROTATION_PITCH; - - if (Math.abs(IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) > 0.125) - this.tileEntity.rotationYaw += (IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) * 0.05; - else - this.tileEntity.rotationYaw += Math.signum(IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) * (0.125 * 0.05); - if (Math.abs(this.tileEntity.rotationYaw - IDLE_ROTATION_YAW) < 0.0125) - this.tileEntity.rotationYaw = IDLE_ROTATION_YAW; - return true; - } - - return false; - }*/ + /* + * @Override protected boolean doTask() { /** Move the arm rotation to idle position if the + * machine is not idling + * + * if (Math.abs(this.tileEntity.rotationPitch - IDLE_ROTATION_PITCH) > 0.01 || + * Math.abs(this.tileEntity.rotationYaw - IDLE_ROTATION_YAW) > 0.01) { if + * (Math.abs(IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) > 0.125) + * this.tileEntity.rotationPitch += (IDLE_ROTATION_PITCH - this.tileEntity.rotationPitch) * + * 0.05; else this.tileEntity.rotationPitch += Math.signum(IDLE_ROTATION_PITCH - + * this.tileEntity.rotationPitch) * (0.125 * 0.05); if (Math.abs(this.tileEntity.rotationPitch - + * IDLE_ROTATION_PITCH) < 0.0125) this.tileEntity.rotationPitch = IDLE_ROTATION_PITCH; + * + * if (Math.abs(IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) > 0.125) + * this.tileEntity.rotationYaw += (IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) * 0.05; else + * this.tileEntity.rotationYaw += Math.signum(IDLE_ROTATION_YAW - this.tileEntity.rotationYaw) * + * (0.125 * 0.05); if (Math.abs(this.tileEntity.rotationYaw - IDLE_ROTATION_YAW) < 0.0125) + * this.tileEntity.rotationYaw = IDLE_ROTATION_YAW; return true; } + * + * return false; } + */ } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandRotate.java b/src/minecraft/assemblyline/common/machine/command/CommandRotate.java index 35c9980c..2fff7b05 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandRotate.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandRotate.java @@ -1,6 +1,5 @@ package assemblyline.common.machine.command; - /** * Rotates the armbot to a specific direction. If not specified, it will turn right. * @@ -16,7 +15,7 @@ public class CommandRotate extends Command public void onTaskStart() { super.onTaskStart(); - + this.ticks = 0; if (this.getArg(0) != null) @@ -27,7 +26,7 @@ public class CommandRotate extends Command { this.targetRotationYaw = this.tileEntity.rotationYaw + 90; } - + if (this.getArg(1) != null) { this.targetRotationPitch = this.tileEntity.rotationPitch + this.getFloatArg(1); @@ -45,7 +44,7 @@ public class CommandRotate extends Command { this.targetRotationYaw += 360; } - + if (this.targetRotationPitch >= 60) { this.targetRotationPitch = 60; @@ -54,7 +53,7 @@ public class CommandRotate extends Command { this.targetRotationPitch = 0; } - + float totalTicksYaw = Math.abs(this.targetRotationYaw - this.tileEntity.rotationYaw) / this.tileEntity.ROTATION_SPEED; float totalTicksPitch = Math.abs(this.targetRotationPitch - this.tileEntity.rotationPitch) / this.tileEntity.ROTATION_SPEED; this.totalTicks = Math.max(totalTicksYaw, totalTicksPitch); @@ -64,37 +63,24 @@ public class CommandRotate extends Command protected boolean doTask() { super.doTask(); - /*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; } + */ + + // set the rotation to the target immediately and let the client handle animating it + // wait for the client to catch up - 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 - //wait for the client to catch up - if (Math.abs(this.tileEntity.rotationYaw - this.targetRotationYaw) > 0.001f) this.tileEntity.rotationYaw = this.targetRotationYaw; 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; } return false; } diff --git a/src/minecraft/assemblyline/common/machine/command/CommandUse.java b/src/minecraft/assemblyline/common/machine/command/CommandUse.java index f47a2c66..d9e81ecc 100644 --- a/src/minecraft/assemblyline/common/machine/command/CommandUse.java +++ b/src/minecraft/assemblyline/common/machine/command/CommandUse.java @@ -38,12 +38,12 @@ public class CommandUse extends Command ((IArmbotUseable) handTile).onUse(this.tileEntity, handEntity); } } - + curTimes++; if (curTimes >= times) return false; - + return true; } } diff --git a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java index c95e6c30..aaedd60a 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/BlockImprinter.java @@ -19,7 +19,7 @@ public class BlockImprinter extends BlockMachine this.setCreativeTab(TabAssemblyLine.INSTANCE); this.setTextureFile(AssemblyLine.BLOCK_TEXTURE_PATH); } - + @Override public void onBlockAdded(World world, int x, int y, int z) { diff --git a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java index 9f2d4a37..b27546b0 100644 --- a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java +++ b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprinter.java @@ -52,10 +52,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv @Override public int getSizeInventorySide(ForgeDirection side) { - if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) - { - return 1; - } + if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { return 1; } return INVENTORY_LENGTH; } @@ -72,7 +69,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv } /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack. + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and + * returns them in a new stack. */ @Override public ItemStack decrStackSize(int i, int amount) @@ -106,7 +104,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv } /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI. + * When some containers are closed they call this on each slot, then drop whatever it returns as + * an EntityItem - like when you close a workbench GUI. */ @Override public ItemStack getStackInSlotOnClosing(int slot) @@ -124,7 +123,8 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv } /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor + * sections). */ @Override public void setInventorySlotContents(int par1, ItemStack par2ItemStack) @@ -263,17 +263,11 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv { if (object instanceof ShapedRecipes) { - if (this.hasResource(((ShapedRecipes) object).recipeItems) != null) - { - return new Pair(((IRecipe) object).getRecipeOutput().copy(), ((ShapedRecipes) object).recipeItems); - } + if (this.hasResource(((ShapedRecipes) object).recipeItems) != null) { return new Pair(((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(((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(((IRecipe) object).getRecipeOutput().copy(), (ItemStack[]) ((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1])); } } else if (object instanceof ShapedOreRecipe) { @@ -282,11 +276,9 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv ArrayList hasResources = this.hasResource(oreRecipeInput); - if (hasResources != null) - { + if (hasResources != null) { - return new Pair(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1])); - } + return new Pair(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1])); } } else if (object instanceof ShapelessOreRecipe) { @@ -295,10 +287,7 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv List hasResources = this.hasResource(oreRecipeInput.toArray()); - if (hasResources != null) - { - return new Pair(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1])); - } + if (hasResources != null) { return new Pair(((IRecipe) object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1])); } } } } @@ -446,7 +435,17 @@ public class TileEntityImprinter extends TileEntityAdvanced implements ISidedInv if (heldEntity instanceof EntityItem) { ItemStack stack = ((EntityItem) heldEntity).func_92014_d(); - if (this.getStackInSlot(3) == null && stack != null && stack.itemID == AssemblyLine.itemImprint.itemID) // no crafting imprint and stack not null and stack is imprint + if (this.getStackInSlot(3) == null && stack != null && stack.itemID == AssemblyLine.itemImprint.itemID) // no + // crafting + // imprint + // and + // stack + // not + // null + // and + // stack + // is + // imprint { this.setInventorySlotContents(3, stack); this.onInventoryChanged();