diff --git a/src/main/java/com/hbm/render/tileentity/RenderAssemblyFactory.java b/src/main/java/com/hbm/render/tileentity/RenderAssemblyFactory.java index 8c6b0d750..25cf3f70a 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderAssemblyFactory.java +++ b/src/main/java/com/hbm/render/tileentity/RenderAssemblyFactory.java @@ -6,6 +6,7 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.main.ResourceManager; import com.hbm.render.item.ItemRenderBase; +import com.hbm.tileentity.machine.TileEntityMachineAssemblyFactory; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.Item; @@ -29,8 +30,107 @@ public class RenderAssemblyFactory extends TileEntitySpecialRenderer implements case 5: GL11.glRotatef(270, 0F, 1F, 0F); break; } + TileEntityMachineAssemblyFactory assemfac = (TileEntityMachineAssemblyFactory) tileEntity; + bindTexture(ResourceManager.assembly_factory_tex); - ResourceManager.assembly_factory.renderAll(); + ResourceManager.assembly_factory.renderPart("Base"); + if(assemfac.frame) ResourceManager.assembly_factory.renderPart("Frame"); + + double[] arm1 = new double[] {-30, -30, -30, -0.125}; + double[] arm2 = new double[] {-30, -30, -30, -0.125}; + double blade = (System.currentTimeMillis() / 1) % 360D; + + GL11.glPushMatrix(); { + ResourceManager.assembly_factory.renderPart("Slider1"); + + GL11.glTranslated(0, 1.625, -0.9375); + GL11.glRotated(arm1[0], 1, 0, 0); + GL11.glTranslated(0, -1.625, 0.9375); + ResourceManager.assembly_factory.renderPart("ArmLower1"); + + GL11.glTranslated(0, 2.375, -0.9375); + GL11.glRotated(arm1[1], 1, 0, 0); + GL11.glTranslated(0, -2.375, 0.9375); + ResourceManager.assembly_factory.renderPart("ArmUpper1"); + + GL11.glTranslated(0, 2.375, -0.4375); + GL11.glRotated(arm1[2], 1, 0, 0); + GL11.glTranslated(0, -2.375, 0.4375); + ResourceManager.assembly_factory.renderPart("Head1"); + GL11.glTranslated(0, arm1[3], 0); + ResourceManager.assembly_factory.renderPart("Striker1"); + } GL11.glPopMatrix(); + + GL11.glPushMatrix(); { + ResourceManager.assembly_factory.renderPart("Slider2"); + + GL11.glTranslated(0, 1.625, 0.9375); + GL11.glRotated(-arm2[0], 1, 0, 0); + GL11.glTranslated(0, -1.625, -0.9375); + ResourceManager.assembly_factory.renderPart("ArmLower2"); + + GL11.glTranslated(0, 2.375, 0.9375); + GL11.glRotated(-arm2[1], 1, 0, 0); + GL11.glTranslated(0, -2.375, -0.9375); + ResourceManager.assembly_factory.renderPart("ArmUpper2"); + + GL11.glTranslated(0, 2.375, 0.4375); + GL11.glRotated(-arm2[2], 1, 0, 0); + GL11.glTranslated(0, -2.375, -0.4375); + ResourceManager.assembly_factory.renderPart("Head2"); + GL11.glTranslated(0, arm2[3], 0); + ResourceManager.assembly_factory.renderPart("Striker2"); + GL11.glTranslated(0, 1.625, 0.3125); + GL11.glRotated(-blade, 1, 0, 0); + GL11.glTranslated(0, -1.625, -0.3125); + ResourceManager.assembly_factory.renderPart("Blade2"); + } GL11.glPopMatrix(); + + GL11.glPushMatrix(); { + ResourceManager.assembly_factory.renderPart("Slider3"); + + GL11.glTranslated(0, 1.625, 0.9375); + GL11.glRotated(-arm2[0], 1, 0, 0); + GL11.glTranslated(0, -1.625, -0.9375); + ResourceManager.assembly_factory.renderPart("ArmLower3"); + + GL11.glTranslated(0, 2.375, 0.9375); + GL11.glRotated(-arm2[1], 1, 0, 0); + GL11.glTranslated(0, -2.375, -0.9375); + ResourceManager.assembly_factory.renderPart("ArmUpper3"); + + GL11.glTranslated(0, 2.375, 0.4375); + GL11.glRotated(-arm2[2], 1, 0, 0); + GL11.glTranslated(0, -2.375, -0.4375); + ResourceManager.assembly_factory.renderPart("Head3"); + GL11.glTranslated(0, arm2[3], 0); + ResourceManager.assembly_factory.renderPart("Striker3"); + } GL11.glPopMatrix(); + + GL11.glPushMatrix(); { + ResourceManager.assembly_factory.renderPart("Slider4"); + + GL11.glTranslated(0, 1.625, -0.9375); + GL11.glRotated(arm1[0], 1, 0, 0); + GL11.glTranslated(0, -1.625, 0.9375); + ResourceManager.assembly_factory.renderPart("ArmLower4"); + + GL11.glTranslated(0, 2.375, -0.9375); + GL11.glRotated(arm1[1], 1, 0, 0); + GL11.glTranslated(0, -2.375, 0.9375); + ResourceManager.assembly_factory.renderPart("ArmUpper4"); + + GL11.glTranslated(0, 2.375, -0.4375); + GL11.glRotated(arm1[2], 1, 0, 0); + GL11.glTranslated(0, -2.375, 0.4375); + ResourceManager.assembly_factory.renderPart("Head4"); + GL11.glTranslated(0, arm1[3], 0); + ResourceManager.assembly_factory.renderPart("Striker4"); + GL11.glTranslated(0, 1.625, -0.3125); + GL11.glRotated(blade, 1, 0, 0); + GL11.glTranslated(0, -1.625, 0.3125); + ResourceManager.assembly_factory.renderPart("Blade4"); + } GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java index e16572586..a978e5536 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java @@ -2,6 +2,7 @@ package com.hbm.tileentity.machine; import java.util.HashMap; import java.util.List; +import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IControlReceiver; @@ -24,6 +25,7 @@ import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.TileEntityProxyDyn.IProxyDelegateProvider; +import com.hbm.tileentity.machine.TileEntityMachineAssemblyMachine.AssemblerArm.ArmActionState; import com.hbm.util.BobMathUtil; import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.i18n.I18nUtil; @@ -181,6 +183,9 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl this.networkPackNT(100); } else { + if(worldObj.getTotalWorldTime() % 20 == 0) { + frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord); + } } } @@ -404,4 +409,52 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl @Override public FluidTank[] getAllTanks() { return TileEntityMachineAssemblyFactory.this.getAllTanks(); } } + + public static class TragicYuri { + + } + + public static class AssemblerArm { + + public double[] angles = new double[4]; + public double[] prevAngles = new double[4]; + public double[] targetAngles = new double[4]; + public double[] speed = new double[4]; + public double sawAngle; + public double prevSawAngle; + + Random rand = new Random(); + ArmActionState state = ArmActionState.ASSUME_POSITION; + int actionDelay = 0; + boolean saw = false; + + public AssemblerArm() { + this.resetSpeed(); + } + + private void resetSpeed() { + speed[0] = 15; //Pivot + speed[1] = 15; //Arm + speed[2] = 15; //Piston + speed[3] = 0.5; //Striker + } + + public double[] getPositions(float interp) { + return new double[] { + BobMathUtil.interp(this.prevAngles[0], this.angles[0], interp), + BobMathUtil.interp(this.prevAngles[1], this.angles[1], interp), + BobMathUtil.interp(this.prevAngles[2], this.angles[2], interp), + BobMathUtil.interp(this.prevAngles[3], this.angles[3], interp), + BobMathUtil.interp(this.prevSawAngle, this.sawAngle, interp) + }; + } + } + + public static enum YuriState { + WORKING, RETIRING, SLIDING + } + + public static enum ArmState { + REPOSITION, EXTEND, CUT, RETRACT, RETIRE + } } diff --git a/src/main/resources/assets/hbm/textures/models/machines/assembly_factory.png b/src/main/resources/assets/hbm/textures/models/machines/assembly_factory.png index 908603da4..c60feff7b 100644 Binary files a/src/main/resources/assets/hbm/textures/models/machines/assembly_factory.png and b/src/main/resources/assets/hbm/textures/models/machines/assembly_factory.png differ